[ELF][test] Add reproduce test for dependent libraries
authorAndrew Ng <andrew.ng@sony.com>
Tue, 7 Apr 2020 20:47:38 +0000 (21:47 +0100)
committerAndrew Ng <andrew.ng@sony.com>
Wed, 8 Apr 2020 12:00:08 +0000 (13:00 +0100)
Differential Revision: https://reviews.llvm.org/D77659

lld/test/ELF/reproduce-deplibs.s [new file with mode: 0644]

diff --git a/lld/test/ELF/reproduce-deplibs.s b/lld/test/ELF/reproduce-deplibs.s
new file mode 100644 (file)
index 0000000..612f780
--- /dev/null
@@ -0,0 +1,23 @@
+# REQUIRES: x86, shell
+
+## The 'shell' requirement is to prevent this test from running by default on
+## Windows as the extraction of the tar archive can cause problems related to
+## path length limits.
+
+# RUN: rm -rf %t.dir
+# RUN: mkdir -p %t.dir
+# RUN: cd %t.dir
+# RUN: echo ".global foo; foo: ret" | \
+# RUN:   llvm-mc -filetype=obj -triple=x86_64 - -o foo.o
+# RUN: llvm-ar rc foo.a foo.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o bar.o
+
+# RUN: ld.lld bar.o -o /dev/null --reproduce repro.tar
+# RUN: tar xf repro.tar
+# RUN: cmp foo.a repro/%:t.dir/foo.a
+
+.globl _start
+_start:
+  call foo
+.section ".deplibs","MS",@llvm_dependent_libraries,1
+.asciz "foo.a"