]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/reproduce.s
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / ELF / reproduce.s
1 # REQUIRES: x86
2 # REQUIRES: shell
3
4 # Extracting the tar archive can get over the path limit on windows.
5
6 # RUN: rm -rf %t.dir
7 # RUN: mkdir -p %t.dir/build1
8 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build1/foo.o
9 # RUN: cd %t.dir
10 # RUN: ld.lld --hash-style=gnu build1/foo.o -o bar -shared --as-needed --reproduce repro.tar
11 # RUN: tar xf repro.tar
12 # RUN: diff build1/foo.o repro/%:t.dir/build1/foo.o
13
14 # RUN: FileCheck %s --check-prefix=RSP < repro/response.txt
15 # RSP: {{^}}--hash-style gnu{{$}}
16 # RSP-NOT: repro{{[/\\]}}
17 # RSP-NEXT: {{[/\\]}}foo.o
18 # RSP-NEXT: -o bar
19 # RSP-NEXT: -shared
20 # RSP-NEXT: --as-needed
21
22 # RUN: FileCheck %s --check-prefix=VERSION < repro/version.txt
23 # VERSION: LLD
24
25 # RUN: mkdir -p %t.dir/build2/a/b/c
26 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build2/foo.o
27 # RUN: cd %t.dir/build2/a/b/c
28 # RUN: env LLD_REPRODUCE=repro.tar ld.lld ./../../../foo.o -o bar -shared --as-needed
29 # RUN: tar xf repro.tar
30 # RUN: diff %t.dir/build2/foo.o repro/%:t.dir/build2/foo.o
31
32 # RUN: echo "{ local: *; };" >  ver
33 # RUN: echo "{};" > dyn
34 # RUN: echo > file
35 # RUN: echo > file2
36 # RUN: echo "_start" > order
37 # RUN: mkdir "sysroot with spaces"
38 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o 'foo bar'
39 # RUN: ld.lld --reproduce repro2.tar 'foo bar' -L"foo bar" -Lfile -Tfile2 \
40 # RUN:   --dynamic-list dyn -rpath file --script=file --symbol-ordering-file order \
41 # RUN:   --sysroot "sysroot with spaces" --sysroot="sysroot with spaces" \
42 # RUN:   --version-script ver --dynamic-linker "some unusual/path" -soname 'foo bar' \
43 # RUN:   -soname='foo bar'
44 # RUN: tar xf repro2.tar
45 # RUN: FileCheck %s --check-prefix=RSP2 < repro2/response.txt
46 # RSP2:      --chroot .
47 # RSP2:      "{{.*}}foo bar"
48 # RSP2-NEXT: --library-path "[[BASEDIR:.+]]/foo bar"
49 # RSP2-NEXT: --library-path [[BASEDIR]]/file
50 # RSP2-NEXT: --script [[BASEDIR]]/file2
51 # RSP2-NEXT: --dynamic-list [[BASEDIR]]/dyn
52 # RSP2-NEXT: -rpath [[BASEDIR]]/file
53 # RSP2-NEXT: --script [[BASEDIR]]/file
54 # RSP2-NEXT: --symbol-ordering-file [[BASEDIR]]/order
55 # RSP2-NEXT: --sysroot "[[BASEDIR]]/sysroot with spaces"
56 # RSP2-NEXT: --sysroot "[[BASEDIR]]/sysroot with spaces"
57 # RSP2-NEXT: --version-script [[BASEDIR]]/ver
58 # RSP2-NEXT: --dynamic-linker "some unusual/path"
59 # RSP2-NEXT: -soname "foo bar"
60 # RSP2-NEXT: -soname "foo bar"
61
62 # RUN: tar tf repro2.tar | FileCheck %s
63 # CHECK:      repro2/response.txt
64 # CHECK-NEXT: repro2/version.txt
65 # CHECK-NEXT: repro2/{{.*}}/order
66 # CHECK-NEXT: repro2/{{.*}}/dyn
67 # CHECK-NEXT: repro2/{{.*}}/ver
68 # CHECK-NEXT: repro2/{{.*}}/foo bar
69 # CHECK-NEXT: repro2/{{.*}}/file2
70 # CHECK-NEXT: repro2/{{.*}}/file
71
72 ## Check that directory path is stripped from -o <file-path>
73 # RUN: mkdir -p %t.dir/build3/a/b/c
74 # RUN: cd %t.dir
75 # RUN: ld.lld build1/foo.o -o build3/a/b/c/bar -shared --as-needed --reproduce=repro3.tar
76 # RUN: tar xf repro3.tar
77 # RUN: FileCheck %s --check-prefix=RSP3 < repro3/response.txt
78 # RSP3: -o bar
79
80 .globl _start
81 _start:
82   mov $60, %rax
83   mov $42, %rdi
84   syscall