[PATCH] D63781: [ELF] Error on archive with missing index

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 19:30:22 PDT 2019


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL364998: [ELF] Error on archive with missing index (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D63781?vs=206492&id=207700#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63781/new/

https://reviews.llvm.org/D63781

Files:
  lld/trunk/ELF/Driver.cpp
  lld/trunk/test/ELF/archive-no-index.s
  lld/trunk/test/ELF/lto/archive-no-index.ll


Index: lld/trunk/test/ELF/lto/archive-no-index.ll
===================================================================
--- lld/trunk/test/ELF/lto/archive-no-index.ll
+++ lld/trunk/test/ELF/lto/archive-no-index.ll
@@ -26,7 +26,7 @@
 ; RUN: rm -f %t3.a
 ; RUN: llvm-ar crS %t3.a %t3.o
 ; RUN: not ld.lld -o /dev/null -emain %t1.o %t3.a 2>&1 | FileCheck -check-prefix=ERR1 %s
-; ERR1: error: undefined symbol: f
+; ERR1: error: {{.*}}.a: archive has no index; run ranlib to add one
 
 ; RUN: rm -f %t4.a
 ; RUN: llvm-ar cr %t4.a
Index: lld/trunk/test/ELF/archive-no-index.s
===================================================================
--- lld/trunk/test/ELF/archive-no-index.s
+++ lld/trunk/test/ELF/archive-no-index.s
@@ -0,0 +1,13 @@
+# REQUIRES: x86
+# Tests error on archive file without a symbol table
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux -o %t.o %s
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux -o %t.archive.o %S/Inputs/archive.s
+# RUN: rm -f %t.a
+# RUN: llvm-ar crS %t.a %t.archive.o
+
+# RUN: not ld.lld -o out.wasm %t.o %t.a 2>&1 | FileCheck %s
+
+.globl _start
+_start:
+
+# CHECK: error: {{.*}}.a: archive has no index; run ranlib to add one
Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/ELF/Driver.cpp
@@ -223,8 +223,10 @@
       // default action without the LTO hack described above.
       for (const std::pair<MemoryBufferRef, uint64_t> &P :
            getArchiveMembers(MBRef))
-        if (identify_magic(P.first.getBuffer()) != file_magic::bitcode)
+        if (identify_magic(P.first.getBuffer()) != file_magic::bitcode) {
+          error(Path + ": archive has no index; run ranlib to add one");
           return;
+        }
 
       for (const std::pair<MemoryBufferRef, uint64_t> &P :
            getArchiveMembers(MBRef))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63781.207700.patch
Type: text/x-patch
Size: 1876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190703/b8272b2e/attachment.bin>


More information about the llvm-commits mailing list