Index: ELF/Config.h =================================================================== --- ELF/Config.h +++ ELF/Config.h @@ -11,13 +11,26 @@ #define LLD_ELF_CONFIG_H #include "llvm/ADT/StringRef.h" +#include "llvm/Support/ELF.h" #include namespace lld { namespace elf2 { +enum ELFKind { + ELFNoneKind, + ELF32LEKind, + ELF32BEKind, + ELF64LEKind, + ELF64BEKind +}; + struct Configuration { + bool is64() const { + return ElfKind == ELF64BEKind || ElfKind == ELF64LEKind; + } + llvm::StringRef DynamicLinker; llvm::StringRef Entry; llvm::StringRef OutputFile = "a.out"; @@ -31,6 +44,9 @@ bool ExportDynamic = false; bool NoInhibitExec = false; bool Shared = false; + ELFKind ElfKind = ELFNoneKind; + uint16_t EMachine = llvm::ELF::EM_NONE; + llvm::StringRef FirstObjName; }; extern Configuration *Config; Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -47,17 +47,36 @@ return MBRef; } +template