Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / reproduce.s
blob314c08b4f7cdd580e87c2938af5607ed97b0e69f
1 # REQUIRES: x86
3 # RUN: rm -rf %t.dir
4 # RUN: mkdir -p %t.dir/build1
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build1/foo.o
6 # RUN: cd %t.dir
7 # RUN: ld.lld --hash-style=gnu build1/foo.o -o bar -shared --as-needed --reproduce repro1.tar
8 # RUN: tar xOf repro1.tar repro1/%:t.dir/build1/foo.o > build1-foo.o
9 # RUN: cmp build1/foo.o build1-foo.o
11 # RUN: tar xf repro1.tar repro1/response.txt repro1/version.txt
12 # RUN: FileCheck %s --check-prefix=RSP1 < repro1/response.txt
13 # RSP1: {{^}}--hash-style gnu{{$}}
14 # RSP1-NOT: {{^}}repro1{{[/\\]}}
15 # RSP1-NEXT: {{[/\\]}}foo.o
16 # RSP1-NEXT: -o bar
17 # RSP1-NEXT: -shared
18 # RSP1-NEXT: --as-needed
20 # RUN: FileCheck %s --check-prefix=VERSION < repro1/version.txt
21 # VERSION: LLD
23 # RUN: mkdir -p %t.dir/build2/a/b/c
24 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build2/foo.o
25 # RUN: cd %t.dir/build2/a/b/c
26 # RUN: env LLD_REPRODUCE=repro2.tar ld.lld ./../../../foo.o -o /dev/null -shared --as-needed
27 # RUN: tar xOf repro2.tar repro2/%:t.dir/build2/foo.o > build2-foo.o
28 # RUN: cmp %t.dir/build2/foo.o build2-foo.o
30 # RUN: mkdir -p %t.dir/build3
31 # RUN: cd %t.dir/build3
32 # RUN: echo "{ local: *; };" > ver
33 # RUN: echo "{};" > dyn
34 # RUN: cp dyn dyn2
35 # RUN: echo > file
36 # RUN: echo > file2
37 # RUN: echo "_start" > order
38 # RUN: mkdir "sysroot with spaces"
39 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o 'foo bar'
40 # RUN: ld.lld --reproduce repro3.tar 'foo bar' -L"foo bar" -Lfile -Tfile2 \
41 # RUN: --dynamic-list dyn --export-dynamic-symbol-list dyn2 -rpath file --script=file --symbol-ordering-file order \
42 # RUN: --sysroot "sysroot with spaces" --sysroot="sysroot with spaces" \
43 # RUN: --version-script ver --dynamic-linker "some unusual/path" -soname 'foo bar' \
44 # RUN: -soname='foo bar'
45 # RUN: tar xOf repro3.tar repro3/response.txt | FileCheck %s --check-prefix=RSP3
46 # RSP3: --chroot .
47 # RSP3: "{{.*}}foo bar"
48 # RSP3-NEXT: -L "[[BASEDIR:.+]]/foo bar"
49 # RSP3-NEXT: -L [[BASEDIR]]/file
50 # RSP3-NEXT: --script [[BASEDIR]]/file2
51 # RSP3-NEXT: --dynamic-list [[BASEDIR]]/dyn
52 # RSP3-NEXT: --export-dynamic-symbol-list [[BASEDIR]]/dyn2
53 # RSP3-NEXT: -rpath [[BASEDIR]]/file
54 # RSP3-NEXT: --script [[BASEDIR]]/file
55 # RSP3-NEXT: --symbol-ordering-file [[BASEDIR]]/order
56 # RSP3-NEXT: --sysroot "[[BASEDIR]]/sysroot with spaces"
57 # RSP3-NEXT: --sysroot "[[BASEDIR]]/sysroot with spaces"
58 # RSP3-NEXT: --version-script [[BASEDIR]]/ver
59 # RSP3-NEXT: --dynamic-linker "some unusual/path"
60 # RSP3-NEXT: -soname "foo bar"
61 # RSP3-NEXT: -soname "foo bar"
63 # RUN: tar tf repro3.tar | FileCheck %s
64 # CHECK: repro3/response.txt
65 # CHECK-NEXT: repro3/version.txt
66 # CHECK-NEXT: repro3/{{.*}}/order
67 # CHECK-NEXT: repro3/{{.*}}/dyn
68 # CHECK-NEXT: repro3/{{.*}}/dyn2
69 # CHECK-NEXT: repro3/{{.*}}/ver
70 # CHECK-NEXT: repro3/{{.*}}/foo bar
71 # CHECK-NEXT: repro3/{{.*}}/file2
72 # CHECK-NEXT: repro3/{{.*}}/file
74 ## Check that directory path is stripped from -o <file-path>
75 # RUN: mkdir -p %t.dir/build4/a/b/c
76 # RUN: cd %t.dir
77 # RUN: ld.lld build1/foo.o -o build4/a/b/c/bar -Map build4/map --print-archive-stats=build4/stats \
78 # RUN: --why-extract=build4/why -shared --as-needed --reproduce=repro4.tar
79 # RUN: tar xOf repro4.tar repro4/response.txt | FileCheck %s --check-prefix=RSP4
80 # RSP4: -o bar
81 # RSP4-NEXT: -Map map
82 # RSP4-NEXT: --print-archive-stats=stats
83 # RSP4-NEXT: --why-extract=why
85 .globl _start
86 _start:
87 mov $60, %rax
88 mov $42, %rdi
89 syscall