1# REQUIRES: x86 2 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 10 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 19 20# RUN: FileCheck %s --check-prefix=VERSION < repro1/version.txt 21# VERSION: LLD 22 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 29 30# RUN: mkdir -p %t.dir/build3 31# RUN: cd %t.dir/build3 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 repro3.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 xOf repro3.tar repro3/response.txt | FileCheck %s --check-prefix=RSP3 45# RSP3: --chroot . 46# RSP3: "{{.*}}foo bar" 47# RSP3-NEXT: --library-path "[[BASEDIR:.+]]/foo bar" 48# RSP3-NEXT: --library-path [[BASEDIR]]/file 49# RSP3-NEXT: --script [[BASEDIR]]/file2 50# RSP3-NEXT: --dynamic-list [[BASEDIR]]/dyn 51# RSP3-NEXT: -rpath [[BASEDIR]]/file 52# RSP3-NEXT: --script [[BASEDIR]]/file 53# RSP3-NEXT: --symbol-ordering-file [[BASEDIR]]/order 54# RSP3-NEXT: --sysroot "[[BASEDIR]]/sysroot with spaces" 55# RSP3-NEXT: --sysroot "[[BASEDIR]]/sysroot with spaces" 56# RSP3-NEXT: --version-script [[BASEDIR]]/ver 57# RSP3-NEXT: --dynamic-linker "some unusual/path" 58# RSP3-NEXT: -soname "foo bar" 59# RSP3-NEXT: -soname "foo bar" 60 61# RUN: tar tf repro3.tar | FileCheck %s 62# CHECK: repro3/response.txt 63# CHECK-NEXT: repro3/version.txt 64# CHECK-NEXT: repro3/{{.*}}/order 65# CHECK-NEXT: repro3/{{.*}}/dyn 66# CHECK-NEXT: repro3/{{.*}}/ver 67# CHECK-NEXT: repro3/{{.*}}/foo bar 68# CHECK-NEXT: repro3/{{.*}}/file2 69# CHECK-NEXT: repro3/{{.*}}/file 70 71## Check that directory path is stripped from -o <file-path> 72# RUN: mkdir -p %t.dir/build4/a/b/c 73# RUN: cd %t.dir 74# RUN: ld.lld build1/foo.o -o build4/a/b/c/bar -shared --as-needed --reproduce=repro4.tar 75# RUN: tar xOf repro4.tar repro4/response.txt | FileCheck %s --check-prefix=RSP4 76# RSP4: -o bar 77 78.globl _start 79_start: 80 mov $60, %rax 81 mov $42, %rdi 82 syscall 83