xref: /llvm-project/lld/test/MachO/reproduce.s (revision b6772e6e2045ab491b41d3767f788250800f97ea)
1# REQUIRES: x86, shell
2
3# RUN: rm -rf %t.dir
4# RUN: mkdir -p %t.dir/build1
5# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.dir/build1/foo.o
6# RUN: echo '_main' > %t.dir/main.exports
7# RUN: echo '_main' > %t.dir/main.order
8# RUN: echo 'not a virus' > %t.dir/sectdata.txt
9# RUN: cd %t.dir
10# RUN: %lld -platform_version macos 10.10.0 11.0 \
11# RUN:     -exported_symbols_list main.exports \
12# RUN:     -order_file main.order \
13# RUN:     -sectcreate __COMPLETELY __legit sectdata.txt \
14# RUN:     -rpath /usr/lib/swift \
15# RUN:     build1/foo.o -o bar --reproduce repro1.tar
16
17# RUN: tar tf repro1.tar | FileCheck -DPATH='%:t.dir' --check-prefix=LIST %s
18# LIST: repro1/response.txt
19# LIST: [[PATH]]/main.exports
20# LIST: [[PATH]]/build1/foo.o
21# LIST: [[PATH]]/main.order
22# LIST: [[PATH]]/sectdata.txt
23
24# RUN: tar xf repro1.tar
25# RUN: cmp build1/foo.o repro1/%:t.dir/build1/foo.o
26# RUN: diff main.exports repro1/%:t.dir/main.exports
27# RUN: diff main.order repro1/%:t.dir/main.order
28# RUN: diff sectdata.txt repro1/%:t.dir/sectdata.txt
29# RUN: FileCheck %s --check-prefix=RSP1 < repro1/response.txt
30# RSP1:      {{^}}-platform_version macos 10.10.0 11.0{{$}}
31# RSP1-NEXT: -exported_symbols_list [[BASEDIR:.+]]/main.exports
32# RSP1-NEXT: -order_file [[BASEDIR]]/main.order
33# RSP1-NEXT: -sectcreate __COMPLETELY __legit [[BASEDIR]]/sectdata.txt
34# RSP1-NEXT: -rpath /usr/lib/swift
35# RSP1-NOT:  {{^}}repro1{{[/\\]}}
36# RSP1-NEXT: [[BASEDIR]]/build1/foo.o
37# RSP1-NEXT: -o bar
38# RSP1-NOT:  --reproduce
39
40# RUN: FileCheck %s --check-prefix=VERSION < repro1/version.txt
41# VERSION: LLD
42
43# RUN: cd repro1; %no-arg-lld @response.txt
44
45# RUN: mkdir -p %t.dir/build2/a/b/c
46# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.dir/build2/foo.o
47# RUN: cd %t.dir/build2/a/b/c
48# RUN: echo ./../../../foo.o > %t.dir/build2/filelist
49# RUN: env LLD_REPRODUCE=repro2.tar %lld -filelist %t.dir/build2/filelist -o /dev/null
50# RUN: tar xf repro2.tar
51# RUN: cmp %t.dir/build2/foo.o repro2/%:t.dir/build2/foo.o
52# RUN: FileCheck %s --check-prefix=RSP2 < repro2/response.txt
53# RSP2-NOT:  {{^}}repro2{{[/\\]}}
54# RSP2:      {{[/\\]}}foo.o
55
56# RUN: cd repro2; %no-arg-lld @response.txt
57
58.globl _main
59_main:
60  ret
61