[PATCH] D33937: [ELF] - Allow producing -r output if only empty archive is given.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 7 22:23:21 PDT 2017
grimar updated this revision to Diff 101855.
grimar added a comment.
- Updated.
https://reviews.llvm.org/D33937
Files:
ELF/Driver.cpp
test/ELF/relocatable-empty-archive.s
Index: test/ELF/relocatable-empty-archive.s
===================================================================
--- test/ELF/relocatable-empty-archive.s
+++ test/ELF/relocatable-empty-archive.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: rm %t.a
+# RUN: llvm-ar rc %t.a
+# RUN: ld.lld -m elf_x86_64 %t.a -o %t -r
+# RUN: llvm-readobj -file-headers %t | FileCheck %s
+
+# CHECK: Format: ELF64-x86-64
+# CHECK: Arch: x86_64
+# CHECK: AddressSize: 64bit
+# CHECK: Type: Relocatable
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -185,7 +185,7 @@
// is attempting LTO and using a default ar command that doesn't
// understand the LLVM bitcode file. It is a pretty common error, so
// we'll handle it as if it had a symbol table.
- if (!File->hasSymbolTable()) {
+ if (!File->isEmpty() && !File->hasSymbolTable()) {
for (const auto &P : getArchiveMembers(MBRef))
Files.push_back(make<LazyObjectFile>(P.first, Path, P.second));
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33937.101855.patch
Type: text/x-patch
Size: 1056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170608/ef78b08a/attachment.bin>
More information about the llvm-commits
mailing list