[PATCH] D17527: Handle bitcode files in archive files with --whole-archive.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 23 09:11:42 PST 2016
ruiu updated this revision to Diff 48823.
ruiu added a comment.
- address Rafael's comment
http://reviews.llvm.org/D17527
Files:
ELF/Driver.cpp
ELF/InputFiles.cpp
ELF/Symbols.cpp
test/ELF/lto/archive.ll
Index: test/ELF/lto/archive.ll
===================================================================
--- test/ELF/lto/archive.ll
+++ 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 (
Index: ELF/Symbols.cpp
===================================================================
--- ELF/Symbols.cpp
+++ ELF/Symbols.cpp
@@ -209,13 +209,6 @@
// 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());
}
Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -457,16 +457,13 @@
template <typename T>
static std::unique_ptr<InputFile> createELFFileAux(MemoryBufferRef MB) {
- std::unique_ptr<T> Ret = llvm::make_unique<T>(MB);
-
+ std::unique_ptr<T> Ret(new T(MB));
if (!Config->FirstElf)
Config->FirstElf = Ret.get();
-
if (Config->EKind == ELFNoneKind) {
Config->EKind = Ret->getELFKind();
Config->EMachine = Ret->getEMachine();
}
-
return std::move(Ret);
}
@@ -491,7 +488,12 @@
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;
}
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -113,9 +113,6 @@
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));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17527.48823.patch
Type: text/x-patch
Size: 2464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160223/cd0bce59/attachment.bin>
More information about the llvm-commits
mailing list