Index: lld/trunk/ELF/InputFiles.h =================================================================== --- lld/trunk/ELF/InputFiles.h +++ lld/trunk/ELF/InputFiles.h @@ -156,7 +156,7 @@ ArrayRef getSymbols(); ArrayRef getLocalSymbols(); - explicit ObjectFile(MemoryBufferRef M); + ObjectFile(MemoryBufferRef M, StringRef ArchiveName); void parse(llvm::DenseSet &ComdatGroups); InputSectionBase *getSection(const Elf_Sym &Sym) const; Index: lld/trunk/ELF/InputFiles.cpp =================================================================== --- lld/trunk/ELF/InputFiles.cpp +++ lld/trunk/ELF/InputFiles.cpp @@ -137,15 +137,13 @@ return F->ToStringCache; } -template static ELFKind getELFKind() { - if (ELFT::TargetEndianness == support::little) - return ELFT::Is64Bits ? ELF64LEKind : ELF32LEKind; - return ELFT::Is64Bits ? ELF64BEKind : ELF32BEKind; -} - template ELFFileBase::ELFFileBase(Kind K, MemoryBufferRef MB) : InputFile(K, MB) { - EKind = getELFKind(); + if (ELFT::TargetEndianness == support::little) + EKind = ELFT::Is64Bits ? ELF64LEKind : ELF32LEKind; + else + EKind = ELFT::Is64Bits ? ELF64BEKind : ELF32BEKind; + EMachine = getObj().getHeader()->e_machine; OSABI = getObj().getHeader()->e_ident[llvm::ELF::EI_OSABI]; } @@ -174,8 +172,10 @@ } template -elf::ObjectFile::ObjectFile(MemoryBufferRef M) - : ELFFileBase(Base::ObjectKind, M) {} +elf::ObjectFile::ObjectFile(MemoryBufferRef M, StringRef ArchiveName) + : ELFFileBase(Base::ObjectKind, M) { + this->ArchiveName = ArchiveName; +} template ArrayRef elf::ObjectFile::getLocalSymbols() { @@ -862,49 +862,24 @@ Symbols.push_back(createBitcodeSymbol(KeptComdats, ObjSym, this)); } -// Small bit of template meta programming to handle the SharedFile constructor -// being the only one with a DefaultSoName parameter. -template