diff options
| -rw-r--r-- | lld/ELF/Driver.cpp | 3 | ||||
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 7 | ||||
| -rw-r--r-- | lld/ELF/Symbols.cpp | 7 | ||||
| -rw-r--r-- | lld/test/ELF/lto/archive.ll | 2 |
4 files changed, 8 insertions, 11 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 13e211d15c1..5d082377919 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -113,9 +113,6 @@ void LinkerDriver::addFile(StringRef Path) { case file_magic::elf_shared_object: Files.push_back(createSharedFile(MBRef)); return; - case sys::fs::file_magic::bitcode: - Files.push_back(make_unique<BitcodeFile>(MBRef)); - return; default: Files.push_back(createObjectFile(MBRef)); } diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 5a942ba0ab4..2ba02fc4df6 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -491,7 +491,12 @@ static std::unique_ptr<InputFile> createELFFile(MemoryBufferRef MB) { std::unique_ptr<InputFile> elf2::createObjectFile(MemoryBufferRef MB, StringRef ArchiveName) { - std::unique_ptr<InputFile> F = createELFFile<ObjectFile>(MB); + using namespace sys::fs; + std::unique_ptr<InputFile> F; + if (identify_magic(MB.getBuffer()) == file_magic::bitcode) + F.reset(new BitcodeFile(MB)); + else + F = createELFFile<ObjectFile>(MB); F->ArchiveName = ArchiveName; return F; } diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index ff089961680..39abc47404c 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -209,13 +209,6 @@ std::unique_ptr<InputFile> Lazy::getMember() { // read from the library. if (MBRef.getBuffer().empty()) return std::unique_ptr<InputFile>(nullptr); - - if (sys::fs::identify_magic(MBRef.getBuffer()) == - sys::fs::file_magic::bitcode) { - auto Ret = make_unique<BitcodeFile>(MBRef); - Ret->ArchiveName = File->getName(); - return std::move(Ret); - } return createObjectFile(MBRef, File->getName()); } diff --git a/lld/test/ELF/lto/archive.ll b/lld/test/ELF/lto/archive.ll index 37be78bfe9d..b3f69fb9920 100644 --- a/lld/test/ELF/lto/archive.ll +++ b/lld/test/ELF/lto/archive.ll @@ -5,6 +5,8 @@ ; RUN: llvm-as %s -o %t2.o ; RUN: ld.lld -m elf_x86_64 %t2.o %t.a -o %t3 -shared ; RUN: llvm-readobj -t %t3 | FileCheck %s +; RUN: ld.lld -m elf_x86_64 %t2.o --whole-archive %t.a -o %t3 -shared +; RUN: llvm-readobj -t %t3 | FileCheck %s ; CHECK: Name: g ( |

