[LLD][ELF] - Add a test case for code in Archive::fetch(). NFCI.
authorGeorge Rimar <grimar@accesssoftek.com>
Tue, 7 Aug 2018 08:41:37 +0000 (08:41 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Tue, 7 Aug 2018 08:41:37 +0000 (08:41 +0000)
This covers the following piece with a test.
https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L830

Thanks to Peter Collingbourne for providing the reproducer sample!

llvm-svn: 339114

lld/test/ELF/archive-fetch.s [new file with mode: 0644]

diff --git a/lld/test/ELF/archive-fetch.s b/lld/test/ELF/archive-fetch.s
new file mode 100644 (file)
index 0000000..201218f
--- /dev/null
@@ -0,0 +1,15 @@
+# REQUIRES: x86
+
+# We have a code in LLD that prevents fetching the same object from archive file twice.
+# This test triggers that code, without it we would fail to link output.
+
+# RUN: echo '.globl foo, bar; foo:' | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %tfoo.o
+# RUN: echo '.globl foo, bar; bar:' | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %tbar.o
+# RUN: rm -f %t.a
+# RUN: llvm-ar rcs %t.a %tfoo.o %tbar.o
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld %t.a %t.o -o /dev/null
+
+_start:
+callq foo