1 /// The absolute path warning is enabled by -Wfuse-ld-path and -Wextra.
2 // RUN: %clang %s -### -target x86_64-unknown-linux -Wfuse-ld-path \
3 // RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
4 // RUN:   FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
5 // CHECK-ABSOLUTE-LD: warning: '-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead
6 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
7 
8 // RUN: %clang %s -### -target x86_64-unknown-linux -Wextra \
9 // RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
10 // RUN:   FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
11 
12 // RUN: %clang %s -### -target x86_64-unknown-linux \
13 // RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
14 // RUN:   FileCheck %s --check-prefix=CHECK-NO-WARN
15 // CHECK-NO-WARN-NOT: warning:
16 
17 // RUN: %clang %s -### \
18 // RUN:     -target x86_64-unknown-freebsd 2>&1 \
19 // RUN:   | FileCheck %s --check-prefix=CHECK-FREEBSD-LD
20 // CHECK-FREEBSD-LD: ld
21 
22 // RUN: %clang %s -### -fuse-ld=bfd \
23 // RUN:     --sysroot=%S/Inputs/basic_freebsd_tree \
24 // RUN:     -target x86_64-unknown-freebsd \
25 // RUN:     -B%S/Inputs/basic_freebsd_tree/usr/bin 2>&1 \
26 // RUN:   | FileCheck %s -check-prefix=CHECK-FREEBSD-BFD
27 // CHECK-FREEBSD-BFD: Inputs/basic_freebsd_tree/usr/bin{{/|\\+}}ld.bfd
28 
29 // RUN: %clang %s -### -fuse-ld=gold \
30 // RUN:     --sysroot=%S/Inputs/basic_freebsd_tree \
31 // RUN:     -target x86_64-unknown-freebsd \
32 // RUN:     -B%S/Inputs/basic_freebsd_tree/usr/bin 2>&1 \
33 // RUN:   | FileCheck %s -check-prefix=CHECK-FREEBSD-GOLD
34 // CHECK-FREEBSD-GOLD: Inputs/basic_freebsd_tree/usr/bin{{/|\\+}}ld.gold
35 
36 // RUN: %clang %s -### -fuse-ld=plib \
37 // RUN:     --sysroot=%S/Inputs/basic_freebsd_tree \
38 // RUN:     -target x86_64-unknown-freebsd \
39 // RUN:     -B%S/Inputs/basic_freebsd_tree/usr/bin 2>&1 \
40 // RUN:   | FileCheck %s -check-prefix=CHECK-FREEBSD-PLIB
41 // CHECK-FREEBSD-PLIB: error: invalid linker name
42 
43 // RUN: %clang %s -### -fuse-ld=ld \
44 // RUN:     -target arm-linux-androideabi \
45 // RUN:     -B%S/Inputs/basic_android_tree/bin/arm-linux-androideabi- 2>&1 \
46 // RUN:   | FileCheck %s --check-prefix=CHECK-ANDROID-ARM-LD
47 // CHECK-ANDROID-ARM-LD: Inputs/basic_android_tree/bin{{/|\\+}}arm-linux-androideabi-ld
48 
49 // RUN: %clang %s -### -fuse-ld=bfd \
50 // RUN:     -target arm-linux-androideabi \
51 // RUN:     -B%S/Inputs/basic_android_tree/bin/arm-linux-androideabi- 2>&1 \
52 // RUN:   | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-BFD
53 // CHECK-ANDROID-ARM-BFD: Inputs/basic_android_tree/bin{{/|\\+}}arm-linux-androideabi-ld.bfd
54 
55 // RUN: %clang %s -### -fuse-ld=gold \
56 // RUN:     -target arm-linux-androideabi \
57 // RUN:     -B%S/Inputs/basic_android_tree/bin/arm-linux-androideabi- 2>&1 \
58 // RUN:   | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-GOLD
59 // CHECK-ANDROID-ARM-GOLD: Inputs/basic_android_tree/bin{{/|\\+}}arm-linux-androideabi-ld.gold
60 
61 // RUN: %clang %s -### -fuse-ld=ld \
62 // RUN:     -target arm-linux-androideabi \
63 // RUN:     -gcc-toolchain %S/Inputs/basic_android_tree 2>&1 \
64 // RUN:   | FileCheck %s --check-prefix=CHECK-ANDROID-ARM-LD-TC
65 // CHECK-ANDROID-ARM-LD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin{{/|\\+}}ld
66 
67 // RUN: %clang %s -### -fuse-ld=bfd \
68 // RUN:     -target arm-linux-androideabi \
69 // RUN:     -gcc-toolchain %S/Inputs/basic_android_tree 2>&1 \
70 // RUN:   | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-BFD-TC
71 // CHECK-ANDROID-ARM-BFD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin{{/|\\+}}ld.bfd
72 
73 // RUN: %clang %s -### -fuse-ld=gold \
74 // RUN:     -target arm-linux-androideabi \
75 // RUN:     -gcc-toolchain %S/Inputs/basic_android_tree 2>&1 \
76 // RUN:   | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-GOLD-TC
77 // CHECK-ANDROID-ARM-GOLD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin{{/|\\+}}ld.gold
78 
79 
80 // RUN: %clang %s -### -fuse-ld=link \
81 // RUN:     -target i686-unknown-windows-msvc 2>&1 \
82 // RUN:   | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-LINK
83 // CHECK-WINDOWS-MSVC-LINK: "{{.*}}link.exe"
84 // CHECK-WINDOWS-MSVC-LINK-SAME: "-out:{{.*}}"
85 
86 // RUN: %clang %s -### -fuse-ld=lld \
87 // RUN:     -target i686-unknown-windows-msvc 2>&1 \
88 // RUN:   | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-LLD
89 // CHECK-WINDOWS-MSVC-LLD: "{{.*}}lld-link{{\.exe"|"}}
90 // CHECK-WINDOWS-MSVC-LLD-SAME: "-out:{{.*}}"
91 
92 // RUN: %clang %s -### -fuse-ld=lld-link \
93 // RUN:     -target i686-unknown-windows-msvc 2>&1 \
94 // RUN:   | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-LLD-LINK
95 // CHECK-WINDOWS-MSVC-LLD-LINK: "{{.*}}lld-link{{\.exe"|"}}
96 // CHECK-WINDOWS-MSVC-LLD-LINK-SAME: "-out:{{.*}}"
97 
98 // RUN: %clang %s -### -fuse-ld=bfd \
99 // RUN:     -target i686-unknown-windows-msvc \
100 // RUN:     -B %S/Inputs/Windows/usr/bin 2>&1 \
101 // RUN:   | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-BFD
102 // CHECK-WINDOWS-MSVC-BFD: "{{.*}}ld.bfd"
103 // CHECK-WINDOWS-MSVC-BFD-SAME: "-o"
104