Skip to content

Commit 643ec67

Browse files
committed
[lld-macho] Always include custom syslibroot when running tests
This greatly reduces the amount of boilerplate in our tests. Reviewed By: #lld-macho, compnerd Differential Revision: https://reviews.llvm.org/D87960
1 parent 62a3f0c commit 643ec67

File tree

89 files changed

+280
-273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+280
-273
lines changed

lld/test/MachO/abs-symbols.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem %t.o -o %t
3+
# RUN: %lld -lSystem %t.o -o %t
44
# RUN: llvm-objdump --macho --syms --exports-trie %t | FileCheck %s
55

66
# CHECK-LABEL: SYMBOL TABLE:

lld/test/MachO/arch.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-darwin %s -o %t.o
3-
# RUN: lld -flavor darwinnew -o /dev/null %t.o
4-
# RUN: not lld -flavor darwinnew -arch i386 -o /dev/null %t.o 2>&1 | FileCheck %s
3+
# RUN: %lld -o /dev/null %t.o
4+
# RUN: not %lld -arch i386 -o /dev/null %t.o 2>&1 | FileCheck %s
55
# CHECK: error: missing or unsupported -arch i386
66

77
.text

lld/test/MachO/archive.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# RUN: rm -f %t/test.a
99
# RUN: llvm-ar rcs %t/test.a %t/2.o %t/3.o %t/4.o
10-
# RUN: lld -flavor darwinnew %t/main.o %t/test.a -o %t/test.out
10+
# RUN: %lld %t/main.o %t/test.a -o %t/test.out
1111

1212
## TODO: Run llvm-nm -p to validate symbol order
1313
# RUN: llvm-nm %t/test.out | FileCheck %s
@@ -16,7 +16,7 @@
1616
# CHECK: T _main
1717

1818
## Linking with the archive first in the command line shouldn't change anything
19-
# RUN: lld -flavor darwinnew %t/test.a %t/main.o -o %t/test.out
19+
# RUN: %lld %t/test.a %t/main.o -o %t/test.out
2020
# RUN: llvm-nm %t/test.out | FileCheck %s --check-prefix ARCHIVE-FIRST
2121
# ARCHIVE-FIRST: T _bar
2222
# ARCHIVE-FIRST: T _boo
@@ -26,7 +26,7 @@
2626
# VISIBLE-NOT: T _undefined
2727
# VISIBLE-NOT: T _unused
2828

29-
# RUN: lld -flavor darwinnew %t/test.a %t/main.o -o %t/all-load -all_load
29+
# RUN: %lld %t/test.a %t/main.o -o %t/all-load -all_load
3030
# RUN: llvm-nm %t/all-load | FileCheck %s --check-prefix ALL-LOAD
3131
# ALL-LOAD: T _bar
3232
# ALL-LOAD: T _boo

lld/test/MachO/bss.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3-
# RUN: lld -flavor darwinnew -o %t %t.o
3+
# RUN: %lld -o %t %t.o
44
# RUN: llvm-readobj --section-headers --macho-segment %t | FileCheck %s
55

66
## Check that __bss takes up zero file size, is at file offset zero, and

lld/test/MachO/common-symbol-coalescing.s

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@
99

1010
## Check that we pick the definition with the larger size, regardless of
1111
## its alignment.
12-
# RUN: lld -flavor darwinnew %t/test.o %t/smaller-size.o -order_file %t/order -o %t/test
12+
# RUN: %lld %t/test.o %t/smaller-size.o -order_file %t/order -o %t/test
1313
# RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s --check-prefix=SMALLER-ALIGNMENT
14-
# RUN: lld -flavor darwinnew %t/smaller-size.o %t/test.o -order_file %t/order -o %t/test
14+
# RUN: %lld %t/smaller-size.o %t/test.o -order_file %t/order -o %t/test
1515
# RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s --check-prefix=SMALLER-ALIGNMENT
1616

1717
## When the sizes are equal, we pick the symbol whose file occurs later in the
1818
## command-line argument list.
19-
# RUN: lld -flavor darwinnew %t/test.o %t/same-size.o -order_file %t/order -o %t/test
19+
# RUN: %lld %t/test.o %t/same-size.o -order_file %t/order -o %t/test
2020
# RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s --check-prefix=LARGER-ALIGNMENT
21-
# RUN: lld -flavor darwinnew %t/same-size.o %t/test.o -order_file %t/order -o %t/test
21+
# RUN: %lld %t/same-size.o %t/test.o -order_file %t/order -o %t/test
2222
# RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s --check-prefix=SMALLER-ALIGNMENT
2323

24-
# RUN: lld -flavor darwinnew %t/test.o %t/zero-align.o -order_file %t/order -o %t/test
24+
# RUN: %lld %t/test.o %t/zero-align.o -order_file %t/order -o %t/test
2525
# RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s --check-prefix=LARGER-ALIGNMENT
26-
# RUN: lld -flavor darwinnew %t/zero-align.o %t/test.o -order_file %t/order -o %t/test
26+
# RUN: %lld %t/zero-align.o %t/test.o -order_file %t/order -o %t/test
2727
# RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s --check-prefix=LARGER-ALIGNMENT
2828

29-
# RUN: lld -flavor darwinnew %t/test.o %t/zero-align-round-up.o -order_file %t/order -o %t/test
29+
# RUN: %lld %t/test.o %t/zero-align-round-up.o -order_file %t/order -o %t/test
3030
# RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s --check-prefix=LARGER-ALIGNMENT
31-
# RUN: lld -flavor darwinnew %t/zero-align-round-up.o %t/test.o -order_file %t/order -o %t/test
31+
# RUN: %lld %t/zero-align-round-up.o %t/test.o -order_file %t/order -o %t/test
3232
# RUN: llvm-objdump --section-headers --syms %t/test | FileCheck %s --check-prefix=LARGER-ALIGNMENT
3333

3434
# SMALLER-ALIGNMENT-LABEL: Sections:

lld/test/MachO/common-symbol-resolution.s

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
1010
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/calls-foo.s -o %t/calls-foo.o
1111

12-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order -dylib %t/libfoo.o -o %t/libfoo.dylib
12+
# RUN: %lld -lSystem -order_file %t/order -dylib %t/libfoo.o -o %t/libfoo.dylib
1313

1414
# RUN: rm -f %t/defined.a %t/weak-defined-and-common.a
1515
# RUN: llvm-ar rcs %t/defined.a %t/defined.o
@@ -20,39 +20,39 @@
2020
## regardless of whether it is weak. Moreover, the resolved symbol in the output
2121
## file will always be non-weak, even if the winning input symbol definition was
2222
## weak.
23-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/common.o %t/weak-common.o %t/test.o -o %t/test
23+
# RUN: %lld -lSystem -order_file %t/order %t/common.o %t/weak-common.o %t/test.o -o %t/test
2424
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=LARGER-COMMON
25-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/weak-common.o %t/common.o %t/test.o -o %t/test
25+
# RUN: %lld -lSystem -order_file %t/order %t/weak-common.o %t/common.o %t/test.o -o %t/test
2626
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=LARGER-COMMON
2727

2828
## Defined symbols are the only ones that take precedence over common symbols.
29-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/defined.o %t/common.o %t/test.o -o %t/test
29+
# RUN: %lld -lSystem -order_file %t/order %t/defined.o %t/common.o %t/test.o -o %t/test
3030
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=DEFINED
31-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/common.o %t/defined.o %t/test.o -o %t/test
31+
# RUN: %lld -lSystem -order_file %t/order %t/common.o %t/defined.o %t/test.o -o %t/test
3232
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=DEFINED
3333

34-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/weak-defined.o %t/common.o %t/test.o -o %t/test
34+
# RUN: %lld -lSystem -order_file %t/order %t/weak-defined.o %t/common.o %t/test.o -o %t/test
3535
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=WEAK-DEFINED
36-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/common.o %t/weak-defined.o %t/test.o -o %t/test
36+
# RUN: %lld -lSystem -order_file %t/order %t/common.o %t/weak-defined.o %t/test.o -o %t/test
3737
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=WEAK-DEFINED
3838

3939
## Common symbols take precedence over archive symbols.
40-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/defined.a %t/weak-common.o %t/test.o -o %t/test
40+
# RUN: %lld -lSystem -order_file %t/order %t/defined.a %t/weak-common.o %t/test.o -o %t/test
4141
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=LARGER-COMMON
42-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/weak-common.o %t/defined.a %t/test.o -o %t/test
42+
# RUN: %lld -lSystem -order_file %t/order %t/weak-common.o %t/defined.a %t/test.o -o %t/test
4343
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=LARGER-COMMON
4444

4545
## If an archive has both a common and a defined symbol, the defined one should
4646
## win.
47-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/weak-defined-and-common.a %t/calls-foo.o -o %t/calls-foo
47+
# RUN: %lld -lSystem -order_file %t/order %t/weak-defined-and-common.a %t/calls-foo.o -o %t/calls-foo
4848
# RUN: llvm-objdump --syms %t/calls-foo | FileCheck %s --check-prefix=WEAK-DEFINED
49-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/calls-foo.o %t/weak-defined-and-common.a -o %t/calls-foo
49+
# RUN: %lld -lSystem -order_file %t/order %t/calls-foo.o %t/weak-defined-and-common.a -o %t/calls-foo
5050
# RUN: llvm-objdump --syms %t/calls-foo | FileCheck %s --check-prefix=WEAK-DEFINED
5151

5252
## Common symbols take precedence over dylib symbols.
53-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/libfoo.dylib %t/weak-common.o %t/test.o -o %t/test
53+
# RUN: %lld -lSystem -order_file %t/order %t/libfoo.dylib %t/weak-common.o %t/test.o -o %t/test
5454
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=LARGER-COMMON
55-
# RUN: lld -flavor darwinnew -syslibroot %S/Inputs/MacOSX.sdk -lSystem -order_file %t/order %t/weak-common.o %t/libfoo.dylib %t/test.o -o %t/test
55+
# RUN: %lld -lSystem -order_file %t/order %t/weak-common.o %t/libfoo.dylib %t/test.o -o %t/test
5656
# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=LARGER-COMMON
5757

5858
# LARGER-COMMON-LABEL: SYMBOL TABLE:

lld/test/MachO/compact-unwind-pie.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %s -o %t.o
3-
# RUN: lld -flavor darwinnew -pie -syslibroot %S/Inputs/MacOSX.sdk -lSystem %t.o -o %t
3+
# RUN: %lld -pie -lSystem %t.o -o %t
44
# RUN: llvm-objdump --macho --unwind-info --rebase %t | FileCheck %s
55

66
## Check that we do not add rebase opcodes to the compact unwind section.

lld/test/MachO/compact-unwind.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
# RUN: %python %S/tools/generate-cfi-funcs.py --seed=johnnyapple >%t.s
1818
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -o %t.o %t.s
19-
# RUN: lld -flavor darwinnew -Z -L%S/Inputs/MacOSX.sdk/usr/lib -lSystem -o %t %t.o
19+
# RUN: %lld -Z -L%S/Inputs/MacOSX.sdk/usr/lib -lSystem -o %t %t.o
2020
# RUN: llvm-objdump --unwind-info --syms %t %t.o >%t.dump
2121
# RUN: %python %S/tools/validate-unwind-info.py %t.dump

lld/test/MachO/dso-handle.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
33

4-
# RUN: lld -flavor darwinnew %t.o -o %t
4+
# RUN: %lld %t.o -o %t
55
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
66
# CHECK: leaq {{.*}} # 100000000
77
# CHECK-NEXT: leaq {{.*}} # 100000000
88

9-
# RUN: lld -flavor darwinnew -dylib %t.o -o %t.dylib
9+
# RUN: %lld -dylib %t.o -o %t.dylib
1010
# RUN: llvm-objdump -d --no-show-raw-insn %t.dylib | FileCheck %s --check-prefix=DYLIB-CHECK
1111
# DYLIB-CHECK: leaq {{.*}} # 0
1212
# DYLIB-CHECK-NEXT: leaq {{.*}} # 0

lld/test/MachO/dylib.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
33

4-
# RUN: lld -flavor darwinnew -dylib -install_name @executable_path/libfoo.dylib \
4+
# RUN: %lld -dylib -install_name @executable_path/libfoo.dylib \
55
# RUN: %t.o -o %t.dylib
66
# RUN: llvm-objdump --macho --dylib-id %t.dylib | FileCheck %s
77
# CHECK: @executable_path/libfoo.dylib
@@ -10,7 +10,7 @@
1010
## a flag for a missing entry symbol (since dylibs don't have entry symbols).
1111
## Also check that we come up with the right install name if one isn't
1212
## specified.
13-
# RUN: lld -flavor darwinnew -dylib %t.o -o %t.defaultInstallName.dylib -e missing_entry
13+
# RUN: %lld -dylib %t.o -o %t.defaultInstallName.dylib -e missing_entry
1414
# RUN: obj2yaml %t.defaultInstallName.dylib | FileCheck %s -DOUTPUT=%t.defaultInstallName.dylib --check-prefix=DEFAULT-INSTALL-NAME
1515
# DEFAULT-INSTALL-NAME: [[OUTPUT]]
1616

0 commit comments

Comments
 (0)