|
1 | 1 | // UNSUPPORTED: system-windows |
2 | 2 |
|
3 | | -// TODO: Make this test portable across platforms |
4 | | -// REQUIRES: system-darwin |
5 | | - |
6 | 3 | // Tests to check that we link against the toolchain-provided libc++ built library when it is provided. |
7 | 4 | // This is required to prefer the toolchain's libc++ over the system's libc++, which matches the behavior |
8 | 5 | // we have for header search paths. |
| 6 | +// |
| 7 | +// Note that we explicitly specify the linker path to use to make this test portable across platforms. |
9 | 8 |
|
10 | 9 | // When libc++.dylib is NOT in the toolchain, we should use -lc++ and fall back to the libc++ |
11 | 10 | // in the sysroot. |
12 | 11 | // |
13 | 12 | // (1) Without -fexperimental-library. |
14 | 13 | // RUN: %clangxx -### %s 2>&1 \ |
15 | 14 | // RUN: --target=x86_64-apple-darwin \ |
| 15 | +// RUN: --ld-path=%S/Inputs/lld/ld.lld \ |
16 | 16 | // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \ |
17 | 17 | // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain_no_libcxx \ |
| 18 | +// RUN: -DINPUTS=%S/Inputs \ |
18 | 19 | // RUN: --check-prefix=CHECK-1 %s |
19 | | -// CHECK-1: "/usr/bin/ld" |
| 20 | +// CHECK-1: "[[INPUTS]]/lld/ld.lld" |
20 | 21 | // CHECK-1: "-lc++" |
21 | 22 | // CHECK-1-NOT: "[[TOOLCHAIN]]/usr/lib" |
22 | 23 | // |
23 | 24 | // (2) With -fexperimental-library. |
24 | 25 | // RUN: %clangxx -### %s 2>&1 \ |
25 | 26 | // RUN: --target=x86_64-apple-darwin \ |
| 27 | +// RUN: --ld-path=%S/Inputs/lld/ld.lld \ |
26 | 28 | // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \ |
27 | 29 | // RUN: -fexperimental-library \ |
28 | 30 | // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain_no_libcxx \ |
| 31 | +// RUN: -DINPUTS=%S/Inputs \ |
29 | 32 | // RUN: --check-prefix=CHECK-2 %s |
30 | | -// CHECK-2: "/usr/bin/ld" |
| 33 | +// CHECK-2: "[[INPUTS]]/lld/ld.lld" |
31 | 34 | // CHECK-2: "-lc++" "-lc++experimental" |
32 | 35 | // CHECK-2-NOT: "[[TOOLCHAIN]]/usr/lib" |
33 | 36 |
|
|
37 | 40 | // (1) Without -fexperimental-library. |
38 | 41 | // RUN: %clangxx -### %s 2>&1 \ |
39 | 42 | // RUN: --target=x86_64-apple-darwin \ |
| 43 | +// RUN: --ld-path=%S/Inputs/lld/ld.lld \ |
40 | 44 | // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \ |
41 | 45 | // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \ |
| 46 | +// RUN: -DINPUTS=%S/Inputs \ |
42 | 47 | // RUN: --check-prefix=CHECK-3 %s |
43 | | -// CHECK-3: "/usr/bin/ld" |
| 48 | +// CHECK-3: "[[INPUTS]]/lld/ld.lld" |
44 | 49 | // CHECK-3: "[[TOOLCHAIN]]/usr/lib/libc++.dylib" |
45 | 50 | // CHECK-3-NOT: "-lc++" |
46 | 51 | // |
47 | 52 | // (2) With -fexperimental-library. |
48 | 53 | // RUN: %clangxx -### %s 2>&1 \ |
49 | 54 | // RUN: --target=x86_64-apple-darwin \ |
| 55 | +// RUN: --ld-path=%S/Inputs/lld/ld.lld \ |
50 | 56 | // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \ |
51 | 57 | // RUN: -fexperimental-library \ |
52 | 58 | // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain \ |
| 59 | +// RUN: -DINPUTS=%S/Inputs \ |
53 | 60 | // RUN: --check-prefix=CHECK-4 %s |
54 | | -// CHECK-4: "/usr/bin/ld" |
| 61 | +// CHECK-4: "[[INPUTS]]/lld/ld.lld" |
55 | 62 | // CHECK-4: "[[TOOLCHAIN]]/usr/lib/libc++.dylib" |
56 | 63 | // CHECK-4: "[[TOOLCHAIN]]/usr/lib/libc++experimental.a" |
57 | 64 | // CHECK-4-NOT: "-lc++" |
|
63 | 70 | // (1) Without -fexperimental-library. |
64 | 71 | // RUN: %clangxx -### %s 2>&1 \ |
65 | 72 | // RUN: --target=x86_64-apple-darwin \ |
| 73 | +// RUN: --ld-path=%S/Inputs/lld/ld.lld \ |
66 | 74 | // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_static/usr/bin \ |
67 | 75 | // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain_static \ |
| 76 | +// RUN: -DINPUTS=%S/Inputs \ |
68 | 77 | // RUN: --check-prefix=CHECK-5 %s |
69 | | -// CHECK-5: "/usr/bin/ld" |
| 78 | +// CHECK-5: "[[INPUTS]]/lld/ld.lld" |
70 | 79 | // CHECK-5: "[[TOOLCHAIN]]/usr/lib/libc++.a" |
71 | 80 | // CHECK-5-NOT: "-lc++" |
72 | 81 | // |
73 | 82 | // (2) With -fexperimental-library. |
74 | 83 | // RUN: %clangxx -### %s 2>&1 \ |
75 | 84 | // RUN: --target=x86_64-apple-darwin \ |
| 85 | +// RUN: --ld-path=%S/Inputs/lld/ld.lld \ |
76 | 86 | // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_static/usr/bin \ |
77 | 87 | // RUN: -fexperimental-library \ |
78 | 88 | // RUN: | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain_static \ |
| 89 | +// RUN: -DINPUTS=%S/Inputs \ |
79 | 90 | // RUN: --check-prefix=CHECK-6 %s |
80 | | -// CHECK-6: "/usr/bin/ld" |
| 91 | +// CHECK-6: "[[INPUTS]]/lld/ld.lld" |
81 | 92 | // CHECK-6: "[[TOOLCHAIN]]/usr/lib/libc++.a" |
82 | 93 | // CHECK-6: "[[TOOLCHAIN]]/usr/lib/libc++experimental.a" |
83 | 94 | // CHECK-6-NOT: "-lc++" |
|
0 commit comments