diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index f5cdb199d4c99..b5510b3b27362 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -13,6 +13,7 @@ #include "SymbolTable.h" #include "Symbols.h" #include "SyntheticSections.h" +#include "Target.h" #include "lld/Common/CommonLinkerContext.h" #include "lld/Common/DWARF.h" #include "llvm/ADT/STLExtras.h" @@ -217,24 +218,7 @@ template static void doParseFile(InputFile *file) { } // Add symbols in File to the symbol table. -void elf::parseFile(InputFile *file) { - switch (config->ekind) { - case ELF32LEKind: - doParseFile(file); - return; - case ELF32BEKind: - doParseFile(file); - return; - case ELF64LEKind: - doParseFile(file); - return; - case ELF64BEKind: - doParseFile(file); - return; - default: - llvm_unreachable("unknown ELFT"); - } -} +void elf::parseFile(InputFile *file) { invokeELFT(doParseFile, file); } // Concatenates arguments to construct a string representing an error location. static std::string createFileLineMsg(StringRef path, unsigned line) { diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 66abe20019734..4e5b0f6859227 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -83,22 +83,7 @@ InputSectionBase::InputSectionBase(InputFile *file, uint64_t flags, if (!zlib::isAvailable()) error(toString(file) + ": contains a compressed section, " + "but zlib is not available"); - switch (config->ekind) { - case ELF32LEKind: - parseCompressedHeader(); - break; - case ELF32BEKind: - parseCompressedHeader(); - break; - case ELF64LEKind: - parseCompressedHeader(); - break; - case ELF64BEKind: - parseCompressedHeader(); - break; - default: - llvm_unreachable("unknown ELFT"); - } + invokeELFT(parseCompressedHeader); } }