[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
Fri Jun 9 05:27:39 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL305069: [ELF] - Allow producing -r output if only empty archive is given. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D33937?vs=101855&id=102019#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33937

Files:
  lld/trunk/ELF/Driver.cpp
  lld/trunk/test/ELF/relocatable-empty-archive.s


Index: lld/trunk/test/ELF/relocatable-empty-archive.s
===================================================================
--- lld/trunk/test/ELF/relocatable-empty-archive.s
+++ lld/trunk/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: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/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.102019.patch
Type: text/x-patch
Size: 1116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170609/156b097b/attachment.bin>


More information about the llvm-commits mailing list