1 // General tests that ld invocations on Linux targets sane. Note that we use
2 // sysroot to make these tests independent of the host system.
3 //
4 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
5 // RUN:     --target=i386-unknown-linux -rtlib=platform \
6 // RUN:     --gcc-toolchain="" \
7 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
8 // RUN:   | FileCheck --check-prefix=CHECK-LD-32 %s
9 // CHECK-LD-32-NOT: warning:
10 // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
11 // CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
12 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
13 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
14 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
15 // CHECK-LD-32: "-L[[SYSROOT]]/lib"
16 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
17 //
18 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
19 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
20 // RUN:     --gcc-toolchain="" \
21 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
22 // RUN:   | FileCheck --check-prefix=CHECK-LD-64 %s
23 // CHECK-LD-64-NOT: warning:
24 // CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
25 // CHECK-LD-64: "--eh-frame-hdr"
26 // CHECK-LD-64: "-m" "elf_x86_64"
27 // CHECK-LD-64: "-dynamic-linker"
28 // CHECK-LD-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
29 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
30 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
31 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
32 // CHECK-LD-64: "-L[[SYSROOT]]/lib"
33 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib"
34 // CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
35 // CHECK-LD-64: "-lc"
36 // CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
37 //
38 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
39 // RUN:     --target=x86_64-unknown-linux-gnux32 -rtlib=platform \
40 // RUN:     --gcc-toolchain="" \
41 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
42 // RUN:   | FileCheck --check-prefix=CHECK-LD-X32 %s
43 // CHECK-LD-X32-NOT: warning:
44 // CHECK-LD-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
45 // CHECK-LD-X32: "--eh-frame-hdr"
46 // CHECK-LD-X32: "-m" "elf32_x86_64"
47 // CHECK-LD-X32: "-dynamic-linker"
48 // CHECK-LD-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
49 // CHECK-LD-X32: "-lc"
50 // CHECK-LD-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
51 //
52 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
53 // RUN:     --target=x86_64-unknown-linux \
54 // RUN:     -resource-dir=%S/Inputs/resource_dir \
55 // RUN:     --gcc-toolchain="" \
56 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
57 // RUN:     --rtlib=compiler-rt \
58 // RUN:   | FileCheck --check-prefix=CHECK-LD-RT %s
59 // CHECK-LD-RT-NOT: warning:
60 // CHECK-LD-RT: "-resource-dir" "[[RESDIR:[^"]*]]"
61 // CHECK-LD-RT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
62 // CHECK-LD-RT: "--eh-frame-hdr"
63 // CHECK-LD-RT: "-m" "elf_x86_64"
64 // CHECK-LD-RT: "-dynamic-linker"
65 // CHECK-LD-RT: "[[RESDIR]]{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}clang_rt.crtbegin-x86_64.o"
66 // CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
67 // CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
68 // CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
69 // CHECK-LD-RT: "-L[[SYSROOT]]/lib"
70 // CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib"
71 // CHECK-LD-RT: libclang_rt.builtins-x86_64.a"
72 // CHECK-LD-RT: "-lc"
73 // CHECK-LD-RT: libclang_rt.builtins-x86_64.a"
74 // CHECK-LD-RT: "[[RESDIR]]{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}clang_rt.crtend-x86_64.o"
75 //
76 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
77 // RUN:     --target=i686-unknown-linux \
78 // RUN:     -resource-dir=%S/Inputs/resource_dir \
79 // RUN:     --gcc-toolchain="" \
80 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
81 // RUN:     --rtlib=compiler-rt \
82 // RUN:   | FileCheck --check-prefix=CHECK-LD-RT-I686 %s
83 // CHECK-LD-RT-I686-NOT: warning:
84 // CHECK-LD-RT-I686: "-resource-dir" "[[RESDIR:[^"]*]]"
85 // CHECK-LD-RT-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
86 // CHECK-LD-RT-I686: "--eh-frame-hdr"
87 // CHECK-LD-RT-I686: "-m" "elf_i386"
88 // CHECK-LD-RT-I686: "-dynamic-linker"
89 // CHECK-LD-RT-I686: "[[RESDIR]]{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}clang_rt.crtbegin-i386.o"
90 // CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0"
91 // CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../../../i686-unknown-linux/lib"
92 // CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../.."
93 // CHECK-LD-RT-I686: "-L[[SYSROOT]]/lib"
94 // CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib"
95 // CHECK-LD-RT-I686: libclang_rt.builtins-i386.a"
96 // CHECK-LD-RT-I686: "-lc"
97 // CHECK-LD-RT-I686: libclang_rt.builtins-i386.a"
98 // CHECK-LD-RT-I686: "[[RESDIR]]{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}clang_rt.crtend-i386.o"
99 //
100 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
101 // RUN:     --target=arm-linux-androideabi \
102 // RUN:     --gcc-toolchain="" \
103 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
104 // RUN:     --rtlib=compiler-rt \
105 // RUN:   | FileCheck --check-prefix=CHECK-LD-RT-ANDROID %s
106 // CHECK-LD-RT-ANDROID-NOT: warning:
107 // CHECK-LD-RT-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
108 // CHECK-LD-RT-ANDROID: "--eh-frame-hdr"
109 // CHECK-LD-RT-ANDROID: "-m" "armelf_linux_eabi"
110 // CHECK-LD-RT-ANDROID: "-dynamic-linker"
111 // CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a"
112 // CHECK-LD-RT-ANDROID: "-lc"
113 // CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a"
114 //
115 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
116 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
117 // RUN:     --gcc-toolchain="" \
118 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
119 // RUN:   | FileCheck --check-prefix=CHECK-LD-GCC %s
120 // CHECK-LD-GCC-NOT: warning:
121 // CHECK-LD-GCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
122 // CHECK-LD-GCC: "--eh-frame-hdr"
123 // CHECK-LD-GCC: "-m" "elf_x86_64"
124 // CHECK-LD-GCC: "-dynamic-linker"
125 // CHECK-LD-GCC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
126 // CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
127 // CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
128 // CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
129 // CHECK-LD-GCC: "-L[[SYSROOT]]/lib"
130 // CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib"
131 // CHECK-LD-GCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
132 // CHECK-LD-GCC: "-lc"
133 // CHECK-LD-GCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
134 //
135 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
136 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
137 // RUN:     -static-libgcc \
138 // RUN:     --gcc-toolchain="" \
139 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
140 // RUN:   | FileCheck --check-prefix=CHECK-LD-64-STATIC-LIBGCC %s
141 // CHECK-LD-64-STATIC-LIBGCC-NOT: warning:
142 // CHECK-LD-64-STATIC-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
143 // CHECK-LD-64-STATIC-LIBGCC: "--eh-frame-hdr"
144 // CHECK-LD-64-STATIC-LIBGCC: "-m" "elf_x86_64"
145 // CHECK-LD-64-STATIC-LIBGCC: "-dynamic-linker"
146 // CHECK-LD-64-STATIC-LIBGCC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
147 // CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
148 // CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
149 // CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
150 // CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/lib"
151 // CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib"
152 // CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
153 // CHECK-LD-64-STATIC-LIBGCC: "-lc"
154 // CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
155 //
156 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
157 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
158 // RUN:     --gcc-toolchain="" \
159 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
160 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-NO-LIBGCC %s
161 // CHECK-CLANG-NO-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
162 // CHECK-CLANG-NO-LIBGCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
163 // CHECK-CLANG-NO-LIBGCC: "-lc"
164 // CHECK-CLANG-NO-LIBGCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
165 //
166 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
167 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
168 // RUN:     --gcc-toolchain="" \
169 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
170 // RUN:   | FileCheck --check-prefix=CHECK-CLANGXX-NO-LIBGCC %s
171 // CHECK-CLANGXX-NO-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
172 // CHECK-CLANGXX-NO-LIBGCC: "-lgcc_s" "-lgcc"
173 // CHECK-CLANGXX-NO-LIBGCC: "-lc"
174 // CHECK-CLANGXX-NO-LIBGCC: "-lgcc_s" "-lgcc"
175 //
176 // RUN: %clang -static -no-canonical-prefixes %s -### -o %t.o 2>&1 \
177 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
178 // RUN:     --gcc-toolchain="" \
179 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
180 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-NO-LIBGCC-STATIC %s
181 // CHECK-CLANG-NO-LIBGCC-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
182 // CHECK-CLANG-NO-LIBGCC-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
183 //
184 // RUN: %clang -static-pie -no-canonical-prefixes %s -### -o %t.o 2>&1 \
185 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
186 // RUN:     --gcc-toolchain="" \
187 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
188 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-LD-STATIC-PIE %s
189 // CHECK-CLANG-LD-STATIC-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
190 // CHECK-CLANG-LD-STATIC-PIE: "-static"
191 // CHECK-CLANG-LD-STATIC-PIE: "-pie"
192 // CHECK-CLANG-LD-STATIC-PIE: "--no-dynamic-linker"
193 // CHECK-CLANG-LD-STATIC-PIE: "-z"
194 // CHECK-CLANG-LD-STATIC-PIE: "text"
195 // CHECK-CLANG-LD-STATIC-PIE: "-m" "elf_x86_64"
196 // CHECK-CLANG-LD-STATIC-PIE: "{{.*}}rcrt1.o"
197 // CHECK-CLANG-LD-STATIC-PIE: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
198 //
199 // RUN: %clang -static-pie -pie -no-canonical-prefixes %s -### -o %t.o 2>&1 \
200 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
201 // RUN:     --gcc-toolchain="" \
202 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
203 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-LD-STATIC-PIE-PIE %s
204 // CHECK-CLANG-LD-STATIC-PIE-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
205 // CHECK-CLANG-LD-STATIC-PIE-PIE: "-static"
206 // CHECK-CLANG-LD-STATIC-PIE-PIE: "-pie"
207 // CHECK-CLANG-LD-STATIC-PIE-PIE: "--no-dynamic-linker"
208 // CHECK-CLANG-LD-STATIC-PIE-PIE: "-z"
209 // CHECK-CLANG-LD-STATIC-PIE-PIE: "text"
210 // CHECK-CLANG-LD-STATIC-PIE-PIE: "-m" "elf_x86_64"
211 // CHECK-CLANG-LD-STATIC-PIE-PIE: "{{.*}}rcrt1.o"
212 // CHECK-CLANG-LD-STATIC-PIE-PIE: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
213 //
214 // RUN: %clang -static-pie -static -no-canonical-prefixes %s -### -o %t.o 2>&1 \
215 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
216 // RUN:     --gcc-toolchain="" \
217 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
218 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-LD-STATIC-PIE-STATIC %s
219 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
220 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "-static"
221 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "-pie"
222 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "--no-dynamic-linker"
223 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "-z"
224 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "text"
225 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "-m" "elf_x86_64"
226 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "{{.*}}rcrt1.o"
227 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
228 //
229 // RUN: %clang -static-pie -nopie -no-canonical-prefixes %s -### -o %t.o 2>&1 \
230 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
231 // RUN:     --gcc-toolchain="" \
232 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
233 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-LD-STATIC-PIE-NOPIE %s
234 // CHECK-CLANG-LD-STATIC-PIE-NOPIE: error: cannot specify 'nopie' along with 'static-pie'
235 //
236 // RUN: %clang -dynamic -no-canonical-prefixes %s -### -o %t.o 2>&1 \
237 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
238 // RUN:     --gcc-toolchain="" \
239 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
240 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-NO-LIBGCC-DYNAMIC %s
241 // CHECK-CLANG-NO-LIBGCC-DYNAMIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
242 // CHECK-CLANG-NO-LIBGCC-DYNAMIC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
243 // CHECK-CLANG-NO-LIBGCC-DYNAMIC: "-lc"
244 // CHECK-CLANG-NO-LIBGCC-DYNAMIC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
245 //
246 // RUN: %clang -static-libgcc -no-canonical-prefixes %s -### -o %t.o 2>&1 \
247 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
248 // RUN:     --gcc-toolchain="" \
249 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
250 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-STATIC-LIBGCC %s
251 // CHECK-CLANG-STATIC-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
252 // CHECK-CLANG-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
253 // CHECK-CLANG-STATIC-LIBGCC: "-lc"
254 // CHECK-CLANG-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
255 //
256 // RUN: %clang -static-libgcc -dynamic -no-canonical-prefixes %s -### -o %t.o 2>&1 \
257 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
258 // RUN:     --gcc-toolchain="" \
259 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
260 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-STATIC-LIBGCC-DYNAMIC %s
261 // CHECK-CLANG-STATIC-LIBGCC-DYNAMIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
262 // CHECK-CLANG-STATIC-LIBGCC-DYNAMIC: "-lgcc" "-lgcc_eh"
263 // CHECK-CLANG-STATIC-LIBGCC-DYNAMIC: "-lc"
264 // CHECK-CLANG-STATIC-LIBGCC-DYNAMIC: "-lgcc" "-lgcc_eh"
265 //
266 // RUN: %clang -shared-libgcc -no-canonical-prefixes %s -### -o %t.o 2>&1 \
267 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
268 // RUN:     --gcc-toolchain="" \
269 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
270 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-SHARED-LIBGCC %s
271 // CHECK-CLANG-SHARED-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
272 // CHECK-CLANG-SHARED-LIBGCC: "-lgcc_s" "-lgcc"
273 // CHECK-CLANG-SHARED-LIBGCC: "-lc"
274 // CHECK-CLANG-SHARED-LIBGCC: "-lgcc_s" "-lgcc"
275 //
276 // RUN: %clang -shared-libgcc -dynamic -no-canonical-prefixes %s -### -o %t.o 2>&1 \
277 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
278 // RUN:     --gcc-toolchain="" \
279 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
280 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-SHARED-LIBGCC-DYNAMIC %s
281 // CHECK-CLANG-SHARED-LIBGCC-DYNAMIC: "-lgcc_s" "-lgcc"
282 // CHECK-CLANG-SHARED-LIBGCC-DYNAMIC: "-lc"
283 // CHECK-CLANG-SHARED-LIBGCC-DYNAMIC: "-lgcc_s" "-lgcc"
284 //
285 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
286 // RUN:     --target=aarch64-linux-android -rtlib=platform \
287 // RUN:     --gcc-toolchain="" \
288 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
289 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-ANDROID-NONE %s
290 // CHECK-CLANG-ANDROID-NONE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
291 // CHECK-CLANG-ANDROID-NONE: "-lgcc" "-ldl" "-lc"
292 //
293 // RUN: %clang -shared -no-canonical-prefixes %s -### -o %t.o 2>&1 \
294 // RUN:     --target=aarch64-linux-android -rtlib=platform \
295 // RUN:     --gcc-toolchain="" \
296 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
297 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-ANDROID-SHARED %s
298 // CHECK-CLANG-ANDROID-SHARED: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
299 // CHECK-CLANG-ANDROID-SHARED: "-lgcc" "-ldl" "-lc"
300 //
301 // RUN: %clang -static -no-canonical-prefixes %s -### -o %t.o 2>&1 \
302 // RUN:     --target=aarch64-linux-android -rtlib=platform \
303 // RUN:     --gcc-toolchain="" \
304 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
305 // RUN:   | FileCheck --check-prefix=CHECK-CLANG-ANDROID-STATIC %s
306 // CHECK-CLANG-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
307 // CHECK-CLANG-ANDROID-STATIC: "--start-group" "-lgcc" "-lc" "--end-group"
308 //
309 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1      \
310 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
311 // RUN:     -static \
312 // RUN:     --gcc-toolchain="" \
313 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
314 // RUN:   | FileCheck --check-prefix=CHECK-LD-64-STATIC %s
315 // CHECK-LD-64-STATIC-NOT: warning:
316 // CHECK-LD-64-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
317 // CHECK-LD-64-STATIC: "--eh-frame-hdr"
318 // CHECK-LD-64-STATIC: "-m" "elf_x86_64"
319 // CHECK-LD-64-STATIC-NOT: "-dynamic-linker"
320 // CHECK-LD-64-STATIC: "-static"
321 // CHECK-LD-64-STATIC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbeginT.o"
322 // CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
323 // CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
324 // CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
325 // CHECK-LD-64-STATIC: "-L[[SYSROOT]]/lib"
326 // CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib"
327 // CHECK-LD-64-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
328 //
329 // Check that flags can be combined. The -static dominates.
330 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
331 // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
332 // RUN:     -static-libgcc -static \
333 // RUN:     --gcc-toolchain="" \
334 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
335 // RUN:   | FileCheck --check-prefix=CHECK-LD-64-STATIC %s
336 //
337 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
338 // RUN:     --target=i386-unknown-linux -rtlib=platform -m32 \
339 // RUN:     --gcc-toolchain="" \
340 // RUN:     --sysroot=%S/Inputs/multilib_32bit_linux_tree \
341 // RUN:   | FileCheck --check-prefix=CHECK-32-TO-32 %s
342 // CHECK-32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
343 // CHECK-32-TO-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
344 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
345 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib32"
346 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib32"
347 // CHECK-32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
348 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
349 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
350 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
351 // CHECK-32-TO-32: "-L[[SYSROOT]]/lib"
352 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib"
353 //
354 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
355 // RUN:     --target=i386-unknown-linux -rtlib=platform -m64 \
356 // RUN:     --gcc-toolchain="" \
357 // RUN:     --sysroot=%S/Inputs/multilib_32bit_linux_tree \
358 // RUN:   | FileCheck --check-prefix=CHECK-32-TO-64 %s
359 // CHECK-32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
360 // CHECK-32-TO-64: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/64{{/|\\\\}}crtbegin.o"
361 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/64"
362 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib64"
363 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib64"
364 // CHECK-32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
365 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
366 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
367 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
368 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
369 // CHECK-32-TO-64: "-L[[SYSROOT]]/lib"
370 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib"
371 //
372 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
373 // RUN:     --target=x86_64-unknown-linux -rtlib=platform -m64 \
374 // RUN:     --gcc-toolchain="" \
375 // RUN:     --sysroot=%S/Inputs/multilib_64bit_linux_tree \
376 // RUN:   | FileCheck --check-prefix=CHECK-64-TO-64 %s
377 // CHECK-64-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
378 // CHECK-64-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
379 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
380 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib64"
381 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib64"
382 // CHECK-64-TO-64: "-L[[SYSROOT]]/lib/../lib64"
383 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
384 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
385 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
386 // CHECK-64-TO-64: "-L[[SYSROOT]]/lib"
387 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib"
388 //
389 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
390 // RUN:     --target=x86_64-unknown-linux -rtlib=plaform -m32 \
391 // RUN:     --gcc-toolchain="" \
392 // RUN:     --sysroot=%S/Inputs/multilib_64bit_linux_tree \
393 // RUN:   | FileCheck --check-prefix=CHECK-64-TO-32 %s
394 // CHECK-64-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
395 // CHECK-64-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32{{/|\\\\}}crtbegin.o"
396 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
397 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib32"
398 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib32"
399 // CHECK-64-TO-32: "-L[[SYSROOT]]/lib/../lib32"
400 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
401 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
402 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
403 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
404 // CHECK-64-TO-32: "-L[[SYSROOT]]/lib"
405 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib"
406 //
407 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
408 // RUN:     --target=x86_64-unknown-linux-gnux32 -rtlib=platform \
409 // RUN:     --gcc-toolchain="" \
410 // RUN:     --sysroot=%S/Inputs/multilib_64bit_linux_tree \
411 // RUN:   | FileCheck --check-prefix=CHECK-X32 %s
412 // CHECK-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
413 // CHECK-X32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32{{/|\\\\}}crtbegin.o"
414 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32"
415 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../libx32"
416 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../libx32"
417 // CHECK-X32: "-L[[SYSROOT]]/lib/../libx32"
418 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
419 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
420 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
421 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
422 // CHECK-X32: "-L[[SYSROOT]]/lib"
423 // CHECK-X32: "-L[[SYSROOT]]/usr/lib"
424 //
425 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
426 // RUN:     --target=x86_64-unknown-linux -rtlib=platform -mx32 \
427 // RUN:     --gcc-toolchain="" \
428 // RUN:     --sysroot=%S/Inputs/multilib_64bit_linux_tree \
429 // RUN:   | FileCheck --check-prefix=CHECK-64-TO-X32 %s
430 // CHECK-64-TO-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
431 // CHECK-64-TO-X32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32{{/|\\\\}}crtbegin.o"
432 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32"
433 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../libx32"
434 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../libx32"
435 // CHECK-64-TO-X32: "-L[[SYSROOT]]/lib/../libx32"
436 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
437 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
438 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
439 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
440 // CHECK-64-TO-X32: "-L[[SYSROOT]]/lib"
441 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib"
442 //
443 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
444 // RUN:     --target=i386-unknown-linux -rtlib=platform -mx32 \
445 // RUN:     --gcc-toolchain="" \
446 // RUN:     --sysroot=%S/Inputs/multilib_64bit_linux_tree \
447 // RUN:   | FileCheck --check-prefix=CHECK-32-TO-X32 %s
448 // CHECK-32-TO-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
449 // CHECK-32-TO-X32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32{{/|\\\\}}crtbegin.o"
450 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32"
451 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../libx32"
452 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../libx32"
453 // CHECK-32-TO-X32: "-L[[SYSROOT]]/lib/../libx32"
454 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
455 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
456 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
457 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
458 // CHECK-32-TO-X32: "-L[[SYSROOT]]/lib"
459 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib"
460 //
461 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
462 // RUN:     --target=x86_64-unknown-linux-gnux32 -rtlib=platform -m64 \
463 // RUN:     --gcc-toolchain="" \
464 // RUN:     --sysroot=%S/Inputs/multilib_64bit_linux_tree \
465 // RUN:   | FileCheck --check-prefix=CHECK-X32-TO-64 %s
466 // CHECK-X32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
467 // CHECK-X32-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
468 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
469 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib64"
470 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib64"
471 // CHECK-X32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
472 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
473 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
474 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
475 // CHECK-X32-TO-64: "-L[[SYSROOT]]/lib"
476 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib"
477 //
478 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
479 // RUN:     --target=x86_64-unknown-linux-gnux32 -rtlib=platform -m32 \
480 // RUN:     --gcc-toolchain="" \
481 // RUN:     --sysroot=%S/Inputs/multilib_64bit_linux_tree \
482 // RUN:   | FileCheck --check-prefix=CHECK-X32-TO-32 %s
483 // CHECK-X32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
484 // CHECK-X32-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32{{/|\\\\}}crtbegin.o"
485 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
486 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib32"
487 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib32"
488 // CHECK-X32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
489 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
490 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
491 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
492 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
493 // CHECK-X32-TO-32: "-L[[SYSROOT]]/lib"
494 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib"
495 //
496 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
497 // RUN:     --target=x86_64-unknown-linux -rtlib=platform -m32 \
498 // RUN:     --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \
499 // RUN:     --sysroot=%S/Inputs/multilib_32bit_linux_tree \
500 // RUN:   | FileCheck --check-prefix=CHECK-64-TO-32-SYSROOT %s
501 // CHECK-64-TO-32-SYSROOT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
502 // CHECK-64-TO-32-SYSROOT: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32{{/|\\\\}}crtbegin.o"
503 // CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
504 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib/../lib32"
505 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib/../lib32"
506 // CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
507 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib"
508 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib"
509 //
510 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
511 // RUN:     --target=i386-unknown-linux -rtlib=platform -m32 \
512 // RUN:     -ccc-install-dir %S/Inputs/fake_install_tree/bin \
513 // RUN:     --gcc-toolchain="" \
514 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
515 // RUN:   | FileCheck --check-prefix=CHECK-INSTALL-DIR-32 %s
516 // CHECK-INSTALL-DIR-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
517 // CHECK-INSTALL-DIR-32: "{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0{{/|\\\\}}crtbegin.o"
518 // CHECK-INSTALL-DIR-32: "-L{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0"
519 //
520 // Check that with 64-bit builds, we don't actually use the install directory
521 // as its version of GCC is lower than our sysrooted version.
522 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
523 // RUN:     --target=x86_64-unknown-linux -rtlib=platform -m64 \
524 // RUN:     -ccc-install-dir %S/Inputs/fake_install_tree/bin \
525 // RUN:     --gcc-toolchain="" \
526 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
527 // RUN:   | FileCheck --check-prefix=CHECK-INSTALL-DIR-64 %s
528 // CHECK-INSTALL-DIR-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
529 // CHECK-INSTALL-DIR-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
530 // CHECK-INSTALL-DIR-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
531 //
532 // Check that we support unusual patch version formats, including missing that
533 // component.
534 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
535 // RUN:     --target=i386-unknown-linux -rtlib=platform -m32 \
536 // RUN:     -ccc-install-dir %S/Inputs/gcc_version_parsing1/bin \
537 // RUN:     --gcc-toolchain="" \
538 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
539 // RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION1 %s
540 // CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
541 // CHECK-GCC-VERSION1: "{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7{{/|\\\\}}crtbegin.o"
542 // CHECK-GCC-VERSION1: "-L{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7"
543 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
544 // RUN:     --target=i386-unknown-linux -rtlib=platform -m32 \
545 // RUN:     -ccc-install-dir %S/Inputs/gcc_version_parsing2/bin \
546 // RUN:     --gcc-toolchain="" \
547 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
548 // RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION2 %s
549 // CHECK-GCC-VERSION2: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
550 // CHECK-GCC-VERSION2: "{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x{{/|\\\\}}crtbegin.o"
551 // CHECK-GCC-VERSION2: "-L{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x"
552 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
553 // RUN:     --target=i386-unknown-linux -rtlib=platform -m32 \
554 // RUN:     -ccc-install-dir %S/Inputs/gcc_version_parsing3/bin \
555 // RUN:     --gcc-toolchain="" \
556 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
557 // RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION3 %s
558 // CHECK-GCC-VERSION3: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
559 // CHECK-GCC-VERSION3: "{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5{{/|\\\\}}crtbegin.o"
560 // CHECK-GCC-VERSION3: "-L{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5"
561 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
562 // RUN:     --target=i386-unknown-linux -rtlib=platform -m32 \
563 // RUN:     -ccc-install-dir %S/Inputs/gcc_version_parsing4/bin \
564 // RUN:     --gcc-toolchain="" \
565 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
566 // RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION4 %s
567 // CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
568 // CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99{{/|\\\\}}crtbegin.o"
569 // CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99"
570 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
571 // RUN:     --target=i386-unknown-linux -rtlib=platform -m32 \
572 // RUN:     -ccc-install-dir %S/Inputs/gcc_version_parsing5/bin \
573 // RUN:     --gcc-toolchain="" \
574 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
575 // RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION5 %s
576 // CHECK-GCC-VERSION5: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
577 // CHECK-GCC-VERSION5: "{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5{{/|\\\\}}crtbegin.o"
578 // CHECK-GCC-VERSION5: "-L{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5"
579 //
580 // Test a simulated installation of libc++ on Linux, both through sysroot and
581 // the installation path of Clang.
582 // RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
583 // RUN:     -target x86_64-unknown-linux-gnu \
584 // RUN:     -stdlib=libc++ \
585 // RUN:     -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
586 // RUN:     --gcc-toolchain="" \
587 // RUN:     -resource-dir=%S/Inputs/resource_dir \
588 // RUN:     --sysroot=%S/Inputs/basic_linux_libcxx_tree \
589 // RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-SYSROOT %s
590 // CHECK-BASIC-LIBCXX-SYSROOT: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
591 // CHECK-BASIC-LIBCXX-SYSROOT: "-isysroot" "[[SYSROOT:[^"]+]]"
592 // CHECK-BASIC-LIBCXX-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"
593 // CHECK-BASIC-LIBCXX-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
594 // CHECK-BASIC-LIBCXX-SYSROOT: "--sysroot=[[SYSROOT]]"
595 // RUN: %clang -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
596 // RUN:     -target x86_64-unknown-linux-gnu \
597 // RUN:     -stdlib=libc++ \
598 // RUN:     -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \
599 // RUN:     --gcc-toolchain="" \
600 // RUN:     -resource-dir=%S/Inputs/resource_dir \
601 // RUN:     --sysroot=%S/Inputs/basic_linux_libcxx_tree \
602 // RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-INSTALL %s
603 // CHECK-BASIC-LIBCXX-INSTALL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
604 // CHECK-BASIC-LIBCXX-INSTALL: "-isysroot" "[[SYSROOT:[^"]+]]"
605 // CHECK-BASIC-LIBCXX-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v1"
606 // CHECK-BASIC-LIBCXX-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
607 // CHECK-BASIC-LIBCXX-INSTALL: "--sysroot=[[SYSROOT]]"
608 // CHECK-BASIC-LIBCXX-INSTALL: "-L[[SYSROOT]]/usr/bin/../lib"
609 //
610 // Test that we can use -stdlib=libc++ in a build system even when it
611 // occasionally links C code instead of C++ code.
612 // RUN: %clang -no-canonical-prefixes -x c %s -### -o %t.o 2>&1 \
613 // RUN:     -target x86_64-unknown-linux-gnu \
614 // RUN:     -stdlib=libc++ \
615 // RUN:     -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \
616 // RUN:     --gcc-toolchain="" \
617 // RUN:     --sysroot=%S/Inputs/basic_linux_libcxx_tree \
618 // RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-C-LINK %s
619 // CHECK-BASIC-LIBCXX-C-LINK-NOT: warning:
620 // CHECK-BASIC-LIBCXX-C-LINK: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
621 // CHECK-BASIC-LIBCXX-C-LINK: "-isysroot" "[[SYSROOT:[^"]+]]"
622 // CHECK-BASIC-LIBCXX-C-LINK-NOT: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v1"
623 // CHECK-BASIC-LIBCXX-C-LINK: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
624 // CHECK-BASIC-LIBCXX-C-LINK: "--sysroot=[[SYSROOT]]"
625 // CHECK-BASIC-LIBCXX-C-LINK: "-L[[SYSROOT]]/usr/bin/../lib"
626 //
627 // Test a very broken version of multiarch that shipped in Ubuntu 11.04.
628 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
629 // RUN:     --target=i386-unknown-linux -rtlib=platform \
630 // RUN:     --gcc-toolchain="" \
631 // RUN:     --sysroot=%S/Inputs/ubuntu_11.04_multiarch_tree \
632 // RUN:   | FileCheck --check-prefix=CHECK-UBUNTU-11-04 %s
633 // CHECK-UBUNTU-11-04: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
634 // CHECK-UBUNTU-11-04: "{{.*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
635 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
636 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu"
637 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
638 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
639 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/lib"
640 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib"
641 //
642 // Check multi arch support on Ubuntu 12.04 LTS.
643 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
644 // RUN:     --target=arm-unknown-linux-gnueabihf -rtlib=platform \
645 // RUN:     --gcc-toolchain="" \
646 // RUN:     --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
647 // RUN:   | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM-HF %s
648 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
649 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crt1.o"
650 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crti.o"
651 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3{{/|\\\\}}crtbegin.o"
652 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3"
653 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf"
654 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/lib/arm-linux-gnueabihf"
655 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabihf"
656 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../.."
657 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3{{/|\\\\}}crtend.o"
658 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crtn.o"
659 //
660 // Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabihf.
661 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
662 // RUN:     --target=arm-linux-gnueabihf -rtlib=platform \
663 // RUN:     --gcc-toolchain="" \
664 // RUN:     --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
665 // RUN:   | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM-HF %s
666 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
667 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-dynamic-linker" "{{(/usr/arm--linux-gnueabihf)?}}/lib/ld-linux-armhf.so.3"
668 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crt1.o"
669 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crti.o"
670 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtbegin.o"
671 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8"
672 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib"
673 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/lib/../lib"
674 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/../lib"
675 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib"
676 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtend.o"
677 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crtn.o"
678 //
679 // Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabi.
680 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
681 // RUN:     --target=arm-linux-gnueabi -rtlib=platform \
682 // RUN:     --gcc-toolchain="" \
683 // RUN:     --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
684 // RUN:   | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM %s
685 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
686 // CHECK-X86-64-UBUNTU-13-10-ARM: "-dynamic-linker" "{{(/usr/arm--linux-gnueabi)?}}/lib/ld-linux.so.3"
687 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crt1.o"
688 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crti.o"
689 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtbegin.o"
690 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7"
691 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib"
692 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/lib/../lib"
693 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/../lib"
694 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib"
695 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtend.o"
696 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crtn.o"
697 //
698 // Check Ubuntu 14.04 on powerpc64le.
699 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
700 // RUN:     --target=powerpc64le-unknown-linux-gnu -rtlib=platform \
701 // RUN:     --gcc-toolchain="" \
702 // RUN:     --sysroot=%S/Inputs/ubuntu_14.04_multiarch_tree \
703 // RUN:   | FileCheck --check-prefix=CHECK-UBUNTU-14-04-PPC64LE %s
704 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
705 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu{{/|\\\\}}crt1.o"
706 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu{{/|\\\\}}crti.o"
707 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8{{/|\\\\}}crtbegin.o"
708 // CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8"
709 // CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu"
710 // CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/lib/powerpc64le-linux-gnu"
711 // CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/powerpc64le-linux-gnu"
712 // CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../.."
713 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8{{/|\\\\}}crtend.o"
714 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu{{/|\\\\}}crtn.o"
715 //
716 // Check Ubuntu 14.04 on x32.
717 // "/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32/crtn.o"
718 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
719 // RUN:     --target=x86_64-unknown-linux-gnux32 -rtlib=platform \
720 // RUN:     --gcc-toolchain="" \
721 // RUN:     --sysroot=%S/Inputs/ubuntu_14.04_multiarch_tree \
722 // RUN:   | FileCheck --check-prefix=CHECK-UBUNTU-14-04-X32 %s
723 // CHECK-UBUNTU-14-04-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
724 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32{{/|\\\\}}crt1.o"
725 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32{{/|\\\\}}crti.o"
726 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/x32{{/|\\\\}}crtbegin.o"
727 // CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/x32"
728 // CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32"
729 // CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/lib/../libx32"
730 // CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
731 // CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/x86_64-linux-gnu/../../libx32"
732 // CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8"
733 // CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.."
734 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/x32{{/|\\\\}}crtend.o"
735 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32{{/|\\\\}}crtn.o"
736 //
737 // Check fedora 18 on arm.
738 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
739 // RUN:     --target=armv7-unknown-linux-gnueabihf -rtlib=platform \
740 // RUN:     --gcc-toolchain="" \
741 // RUN:     --sysroot=%S/Inputs/fedora_18_tree \
742 // RUN:   | FileCheck --check-prefix=CHECK-FEDORA-18-ARM-HF %s
743 // CHECK-FEDORA-18-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
744 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crt1.o"
745 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crti.o"
746 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtbegin.o"
747 // CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2"
748 // CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib"
749 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtend.o"
750 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crtn.o"
751 //
752 // Check Fedora 21 on AArch64.
753 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
754 // RUN:     --target=arm64-unknown-linux-gnu -rtlib=platform \
755 // RUN:     --gcc-toolchain="" \
756 // RUN:     --sysroot=%S/Inputs/fedora_21_tree \
757 // RUN:   | FileCheck --check-prefix=CHECK-FEDORA-21-AARCH64 %s
758 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
759 // RUN:     --target=aarch64-unknown-linux-gnu -rtlib=platform \
760 // RUN:     --gcc-toolchain="" \
761 // RUN:     --sysroot=%S/Inputs/fedora_21_tree \
762 // RUN:   | FileCheck --check-prefix=CHECK-FEDORA-21-AARCH64 %s
763 // CHECK-FEDORA-21-AARCH64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
764 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crt1.o"
765 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crti.o"
766 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|\\\\}}crtbegin.o"
767 // CHECK-FEDORA-21-AARCH64: "-L[[SYSROOT]]/usr/lib/gcc/aarch64-redhat-linux/4.9.0"
768 // CHECK-FEDORA-21-AARCH64: "-L[[SYSROOT]]/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64"
769 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|\\\\}}crtend.o"
770 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crtn.o"
771 //
772 // Check Fedora 31 on riscv64.
773 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
774 // RUN:     --target=riscv64-redhat-linux -rtlib=platform \
775 // RUN:     --gcc-toolchain="" \
776 // RUN:     --sysroot=%S/Inputs/fedora_31_riscv64_tree \
777 // RUN:   | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
778 // CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
779 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|\\\\}}crt1.o"
780 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crti.o"
781 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtbegin.o"
782 // CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
783 // CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
784 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtend.o"
785 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtn.o"
786 //
787 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
788 // RUN:     --target=arm-unknown-linux-gnueabi -rtlib=platform \
789 // RUN:     --gcc-toolchain="" \
790 // RUN:     --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
791 // RUN:   | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM %s
792 // CHECK-UBUNTU-12-04-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
793 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi{{/|\\\\}}crt1.o"
794 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi{{/|\\\\}}crti.o"
795 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1{{/|\\\\}}crtbegin.o"
796 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1"
797 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi"
798 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/lib/arm-linux-gnueabi"
799 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabi"
800 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../.."
801 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1{{/|\\\\}}crtend.o"
802 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi{{/|\\\\}}crtn.o"
803 //
804 // Test the setup that shipped in SUSE 10.3 on ppc64.
805 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
806 // RUN:     --target=powerpc64-suse-linux -rtlib=platform \
807 // RUN:     --gcc-toolchain="" \
808 // RUN:     --sysroot=%S/Inputs/suse_10.3_ppc64_tree \
809 // RUN:   | FileCheck --check-prefix=CHECK-SUSE-10-3-PPC64 %s
810 // CHECK-SUSE-10-3-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
811 // CHECK-SUSE-10-3-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64{{/|\\\\}}crtbegin.o"
812 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64"
813 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/../../../../lib64"
814 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
815 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
816 //
817 // Check openSuse Leap 42.2 on AArch64
818 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
819 // RUN:     --target=arm64-unknown-linux-gnu -rtlib=platform \
820 // RUN:     --gcc-toolchain="" \
821 // RUN:     --sysroot=%S/Inputs/opensuse_42.2_aarch64_tree \
822 // RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-42-2-AARCH64 %s
823 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
824 // RUN:     --target=aarch64-unknown-linux-gnu -rtlib=platform \
825 // RUN:     --gcc-toolchain="" \
826 // RUN:     --sysroot=%S/Inputs/opensuse_42.2_aarch64_tree \
827 // RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-42-2-AARCH64 %s
828 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
829 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|\\\\}}crt1.o"
830 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|\\\\}}crti.o"
831 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8{{/|\\\\}}crtbegin.o"
832 // CHECK-OPENSUSE-42-2-AARCH64: "-L[[SYSROOT]]/usr/lib64/gcc/aarch64-suse-linux/4.8"
833 // CHECK-OPENSUSE-42-2-AARCH64: "-L[[SYSROOT]]/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64"
834 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8{{/|\\\\}}crtend.o"
835 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|\\\\}}crtn.o"
836 //
837 // Check openSUSE Tumbleweed on armv6hl
838 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
839 // RUN:     --target=armv6hl-suse-linux-gnueabi -rtlib=platform \
840 // RUN:     --gcc-toolchain="" \
841 // RUN:     --sysroot=%S/Inputs/opensuse_tumbleweed_armv6hl_tree \
842 // RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-TW-ARMV6HL %s
843 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
844 // RUN:     --target=armv6hl-suse-linux-gnueabi -rtlib=platform \
845 // RUN:     --gcc-toolchain="" \
846 // RUN:     --sysroot=%S/Inputs/opensuse_tumbleweed_armv6hl_tree \
847 // RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-TW-ARMV6HL %s
848 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
849 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crt1.o"
850 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crti.o"
851 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5{{/|\\\\}}crtbegin.o"
852 // CHECK-OPENSUSE-TW-ARMV6HL: "-L[[SYSROOT]]/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5"
853 // CHECK-OPENSUSE-TW-ARMV6HL: "-L[[SYSROOT]]/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/../../../../lib"
854 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5{{/|\\\\}}crtend.o"
855 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crtn.o"
856 //
857 // Check openSUSE Tumbleweed on armv7hl
858 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
859 // RUN:     --target=armv7hl-suse-linux-gnueabi -rtlib=platform \
860 // RUN:     --gcc-toolchain="" \
861 // RUN:     --sysroot=%S/Inputs/opensuse_tumbleweed_armv7hl_tree \
862 // RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-TW-ARMV7HL %s
863 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
864 // RUN:     --target=armv7hl-suse-linux-gnueabi -rtlib=platform \
865 // RUN:     --gcc-toolchain="" \
866 // RUN:     --sysroot=%S/Inputs/opensuse_tumbleweed_armv7hl_tree \
867 // RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-TW-ARMV7HL %s
868 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
869 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crt1.o"
870 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crti.o"
871 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5{{/|\\\\}}crtbegin.o"
872 // CHECK-OPENSUSE-TW-ARMV7HL: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5"
873 // CHECK-OPENSUSE-TW-ARMV7HL: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/../../../../lib"
874 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5{{/|\\\\}}crtend.o"
875 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crtn.o"
876 //
877 // Check openSUSE Tumbleweed on riscv64
878 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
879 // RUN:     --target=riscv64-suse-linux -rtlib=platform \
880 // RUN:     --gcc-toolchain="" \
881 // RUN:     --sysroot=%S/Inputs/opensuse_tumbleweed_riscv64_tree \
882 // RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-TW-RISCV64 %s
883 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
884 // RUN:     --target=riscv64-suse-linux -rtlib=platform \
885 // RUN:     --gcc-toolchain="" \
886 // RUN:     --sysroot=%S/Inputs/opensuse_tumbleweed_riscv64_tree \
887 // RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-TW-RISCV64 %s
888 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
889 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64{{/|\\\\}}crt1.o"
890 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64{{/|\\\\}}crti.o"
891 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9{{/|\\\\}}crtbegin.o"
892 // CHECK-OPENSUSE-TW-RISCV64: "-L[[SYSROOT]]/usr/lib64/gcc/riscv64-suse-linux/9"
893 // CHECK-OPENSUSE-TW-RISCV64: "-L[[SYSROOT]]/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64"
894 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9{{/|\\\\}}crtend.o"
895 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64{{/|\\\\}}crtn.o"
896 //
897 // Check openSUSE Tumbleweed on ppc
898 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
899 // RUN:     --target=powerpc-unknown-linux-gnu -rtlib=platform \
900 // RUN:     --gcc-toolchain="" \
901 // RUN:     --sysroot=%S/Inputs/opensuse_tumbleweed_ppc_tree \
902 // RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-TW-PPC %s
903 // CHECK-OPENSUSE-TW-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
904 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9/../../..{{/|\\\\}}crt1.o"
905 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9/../../..{{/|\\\\}}crti.o"
906 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9{{/|\\\\}}crtbegin.o"
907 // CHECK-OPENSUSE-TW-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/9"
908 // CHECK-OPENSUSE-TW-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/9/../../.."
909 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9{{/|\\\\}}crtend.o"
910 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9/../../..{{/|\\\\}}crtn.o"
911 //
912 // Check dynamic-linker for different archs
913 // RUN: %clang %s -### -o %t.o 2>&1 \
914 // RUN:     --target=arm-linux-gnueabi \
915 // RUN:   | FileCheck --check-prefix=CHECK-ARM %s
916 // CHECK-ARM: "{{.*}}ld{{(.exe)?}}"
917 // CHECK-ARM: "-m" "armelf_linux_eabi"
918 // CHECK-ARM: "-dynamic-linker" "{{.*}}/lib/ld-linux.so.3"
919 //
920 // RUN: %clang %s -### -o %t.o 2>&1 \
921 // RUN:     --target=arm-linux-gnueabi -mfloat-abi=hard \
922 // RUN:   | FileCheck --check-prefix=CHECK-ARM-ABIHF %s
923 // CHECK-ARM-ABIHF: "{{.*}}ld{{(.exe)?}}"
924 // CHECK-ARM-ABIHF: "-m" "armelf_linux_eabi"
925 // CHECK-ARM-ABIHF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3"
926 //
927 // RUN: %clang %s -### -o %t.o 2>&1 \
928 // RUN:     --target=arm-linux-gnueabihf \
929 // RUN:   | FileCheck --check-prefix=CHECK-ARM-HF %s
930 // CHECK-ARM-HF: "{{.*}}ld{{(.exe)?}}"
931 // CHECK-ARM-HF: "-m" "armelf_linux_eabi"
932 // CHECK-ARM-HF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3"
933 //
934 // RUN: %clang %s -### -o %t.o 2>&1 \
935 // RUN:     --target=powerpc64-linux-gnu \
936 // RUN:   | FileCheck --check-prefix=CHECK-PPC64 %s
937 // CHECK-PPC64: "{{.*}}ld{{(.exe)?}}"
938 // CHECK-PPC64: "-m" "elf64ppc"
939 // CHECK-PPC64: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.1"
940 //
941 // RUN: %clang %s -### -o %t.o 2>&1 \
942 // RUN:     --target=powerpc64-linux-gnu -mabi=elfv1 \
943 // RUN:   | FileCheck --check-prefix=CHECK-PPC64-ELFv1 %s
944 // CHECK-PPC64-ELFv1: "{{.*}}ld{{(.exe)?}}"
945 // CHECK-PPC64-ELFv1: "-m" "elf64ppc"
946 // CHECK-PPC64-ELFv1: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.1"
947 //
948 // RUN: %clang %s -### -o %t.o 2>&1 \
949 // RUN:     --target=powerpc64-linux-gnu -mabi=elfv2 \
950 // RUN:   | FileCheck --check-prefix=CHECK-PPC64-ELFv2 %s
951 // CHECK-PPC64-ELFv2: "{{.*}}ld{{(.exe)?}}"
952 // CHECK-PPC64-ELFv2: "-m" "elf64ppc"
953 // CHECK-PPC64-ELFv2: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.2"
954 //
955 // RUN: %clang %s -### -o %t.o 2>&1 \
956 // RUN:     --target=powerpc64le-linux-gnu \
957 // RUN:   | FileCheck --check-prefix=CHECK-PPC64LE %s
958 // CHECK-PPC64LE: "{{.*}}ld{{(.exe)?}}"
959 // CHECK-PPC64LE: "-m" "elf64lppc"
960 // CHECK-PPC64LE: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.2"
961 //
962 // RUN: %clang %s -### -o %t.o 2>&1 \
963 // RUN:     --target=powerpc64le-linux-gnu -mabi=elfv1 \
964 // RUN:   | FileCheck --check-prefix=CHECK-PPC64LE-ELFv1 %s
965 // CHECK-PPC64LE-ELFv1: "{{.*}}ld{{(.exe)?}}"
966 // CHECK-PPC64LE-ELFv1: "-m" "elf64lppc"
967 // CHECK-PPC64LE-ELFv1: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.1"
968 //
969 // RUN: %clang %s -### -o %t.o 2>&1 \
970 // RUN:     --target=powerpc64le-linux-gnu -mabi=elfv2 \
971 // RUN:   | FileCheck --check-prefix=CHECK-PPC64LE-ELFv2 %s
972 // CHECK-PPC64LE-ELFv2: "{{.*}}ld{{(.exe)?}}"
973 // CHECK-PPC64LE-ELFv2: "-m" "elf64lppc"
974 // CHECK-PPC64LE-ELFv2: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.2"
975 //
976 // Check that we do not pass --hash-style=gnu or --hash-style=both to
977 // hexagon linux linker
978 // RUN: %clang %s -### -o %t.o 2>&1 \
979 // RUN:     --target=hexagon-linux-gnu \
980 // RUN:   | FileCheck --check-prefix=CHECK-HEXAGON %s
981 // CHECK-HEXAGON: "{{.*}}{{hexagon-link|ld}}{{(.exe)?}}"
982 // CHECK-HEXAGON-NOT: "--hash-style={{gnu|both}}"
983 //
984 // Check that we do not pass --hash-style=gnu and --hash-style=both to linker
985 // and provide correct path to the dynamic linker and emulation mode when build
986 // for MIPS platforms.
987 // RUN: %clang %s -### -o %t.o 2>&1 \
988 // RUN:     --target=mips-linux-gnu \
989 // RUN:   | FileCheck --check-prefix=CHECK-MIPS %s
990 // CHECK-MIPS: "{{.*}}ld{{(.exe)?}}"
991 // CHECK-MIPS: "-m" "elf32btsmip"
992 // CHECK-MIPS: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
993 // CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
994 //
995 // RUN: %clang %s -### -o %t.o 2>&1 \
996 // RUN:     --target=mipsel-linux-gnu \
997 // RUN:   | FileCheck --check-prefix=CHECK-MIPSEL %s
998 // CHECK-MIPSEL: "{{.*}}ld{{(.exe)?}}"
999 // CHECK-MIPSEL: "-m" "elf32ltsmip"
1000 // CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
1001 // CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
1002 //
1003 // RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-gnu -mnan=2008 \
1004 // RUN:   | FileCheck --check-prefix=CHECK-MIPSEL-NAN2008 %s
1005 // CHECK-MIPSEL-NAN2008: "{{.*}}ld{{(.exe)?}}"
1006 // CHECK-MIPSEL-NAN2008: "-m" "elf32ltsmip"
1007 // CHECK-MIPSEL-NAN2008: "-dynamic-linker" "{{.*}}/lib/ld-linux-mipsn8.so.1"
1008 // CHECK-MIPSEL-NAN2008-NOT: "--hash-style={{gnu|both}}"
1009 //
1010 // RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-gnu -mcpu=mips32r6 \
1011 // RUN:   | FileCheck --check-prefix=CHECK-MIPS32R6EL %s
1012 // CHECK-MIPS32R6EL: "{{.*}}ld{{(.exe)?}}"
1013 // CHECK-MIPS32R6EL: "-m" "elf32ltsmip"
1014 // CHECK-MIPS32R6EL: "-dynamic-linker" "{{.*}}/lib/ld-linux-mipsn8.so.1"
1015 // CHECK-MIPS32R6EL-NOT: "--hash-style={{gnu|both}}"
1016 //
1017 // RUN: %clang %s -### -o %t.o 2>&1 \
1018 // RUN:     --target=mips64-linux-gnu \
1019 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64 %s
1020 // CHECK-MIPS64: "{{.*}}ld{{(.exe)?}}"
1021 // CHECK-MIPS64: "-m" "elf64btsmip"
1022 // CHECK-MIPS64: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1"
1023 // CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
1024 //
1025 // RUN: %clang %s -### -o %t.o 2>&1 \
1026 // RUN:     --target=mips64el-linux-gnu \
1027 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL %s
1028 // CHECK-MIPS64EL: "{{.*}}ld{{(.exe)?}}"
1029 // CHECK-MIPS64EL: "-m" "elf64ltsmip"
1030 // CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1"
1031 // CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
1032 //
1033 // RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-gnu -mnan=2008 \
1034 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL-NAN2008 %s
1035 // CHECK-MIPS64EL-NAN2008: "{{.*}}ld{{(.exe)?}}"
1036 // CHECK-MIPS64EL-NAN2008: "-m" "elf64ltsmip"
1037 // CHECK-MIPS64EL-NAN2008: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld-linux-mipsn8.so.1"
1038 // CHECK-MIPS64EL-NAN2008-NOT: "--hash-style={{gnu|both}}"
1039 //
1040 // RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-gnu -mcpu=mips64r6 \
1041 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64R6EL %s
1042 // CHECK-MIPS64R6EL: "{{.*}}ld{{(.exe)?}}"
1043 // CHECK-MIPS64R6EL: "-m" "elf64ltsmip"
1044 // CHECK-MIPS64R6EL: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld-linux-mipsn8.so.1"
1045 // CHECK-MIPS64R6EL-NOT: "--hash-style={{gnu|both}}"
1046 //
1047 // RUN: %clang %s -### -o %t.o 2>&1 \
1048 // RUN:     --target=mips64-linux-gnu -mabi=n32 \
1049 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64-N32 %s
1050 // CHECK-MIPS64-N32: "{{.*}}ld{{(.exe)?}}"
1051 // CHECK-MIPS64-N32: "-m" "elf32btsmipn32"
1052 // CHECK-MIPS64-N32: "-dynamic-linker" "{{.*}}/lib{{(32)?}}/ld.so.1"
1053 // CHECK-MIPS64-N32-NOT: "--hash-style={{gnu|both}}"
1054 //
1055 // RUN: %clang %s -### -o %t.o 2>&1 \
1056 // RUN:     --target=mips64el-linux-gnu -mabi=n32 \
1057 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL-N32 %s
1058 // CHECK-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}"
1059 // CHECK-MIPS64EL-N32: "-m" "elf32ltsmipn32"
1060 // CHECK-MIPS64EL-N32: "-dynamic-linker" "{{.*}}/lib{{(32)?}}/ld.so.1"
1061 // CHECK-MIPS64EL-N32-NOT: "--hash-style={{gnu|both}}"
1062 //
1063 // RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-gnu -mabi=n32 \
1064 // RUN:   -mnan=2008 | FileCheck --check-prefix=CHECK-MIPS64EL-N32-NAN2008 %s
1065 // CHECK-MIPS64EL-N32-NAN2008: "{{.*}}ld{{(.exe)?}}"
1066 // CHECK-MIPS64EL-N32-NAN2008: "-m" "elf32ltsmipn32"
1067 // CHECK-MIPS64EL-N32-NAN2008: "-dynamic-linker" "{{.*}}/lib{{(32)?}}/ld-linux-mipsn8.so.1"
1068 // CHECK-MIPS64EL-N32-NAN2008-NOT: "--hash-style={{gnu|both}}"
1069 //
1070 // RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-redhat-linux \
1071 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL-REDHAT %s
1072 // CHECK-MIPS64EL-REDHAT: "{{.*}}ld{{(.exe)?}}"
1073 // CHECK-MIPS64EL-REDHAT: "-m" "elf64ltsmip"
1074 // CHECK-MIPS64EL-REDHAT: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1"
1075 // CHECK-MIPS64EL-REDHAT-NOT: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld-musl-mipsel.so.1"
1076 // CHECK-MIPS64EL-REDHAT-NOT: "--hash-style={{gnu|both}}"
1077 
1078 // Check that we pass --hash-style=both for pre-M Android versions and
1079 // --hash-style=gnu for newer Android versions.
1080 // RUN: %clang %s -### -o %t.o 2>&1 \
1081 // RUN:     --target=armv7-linux-android21 \
1082 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-HASH-STYLE-L %s
1083 // CHECK-ANDROID-HASH-STYLE-L: "{{.*}}ld{{(.exe)?}}"
1084 // CHECK-ANDROID-HASH-STYLE-L: "--hash-style=both"
1085 //
1086 // RUN: %clang %s -### -o %t.o 2>&1 \
1087 // RUN:     --target=armv7-linux-android23 \
1088 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-HASH-STYLE-M %s
1089 // CHECK-ANDROID-HASH-STYLE-M: "{{.*}}ld{{(.exe)?}}"
1090 // CHECK-ANDROID-HASH-STYLE-M: "--hash-style=gnu"
1091 
1092 // RUN: %clang %s -### -o %t.o 2>&1 \
1093 // RUN:     --target=armv7-linux-android21 \
1094 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-NOEXECSTACK %s
1095 // CHECK-ANDROID-NOEXECSTACK: "{{.*}}ld{{(.exe)?}}"
1096 // CHECK-ANDROID-NOEXECSTACK: "-z" "noexecstack"
1097 // CHECK-ANDROID-NOEXECSTACK-NOT: "-z" "execstack"
1098 // CHECK-ANDROID-NOEXECSTACK-NOT: "-z,execstack"
1099 // CHECK-ANDROID-NOEXECSTACK-NOT: "-zexecstack"
1100 
1101 +// RUN: %clang %s -### -o %t.o 2>&1 \
1102 +// RUN:     --target=armv7-linux-android21 \
1103 +// RUN:   | FileCheck --check-prefix=CHECK-ANDROID-WARN-SHARED-TEXTREL %s
1104 +// CHECK-ANDROID-WARN-SHARED-TEXTREL: "{{.*}}ld{{(.exe)?}}"
1105 +// CHECK-ANDROID-WARN-SHARED-TEXTREL: "--warn-shared-textrel"
1106 
1107 // RUN: %clang %s -### -o %t.o 2>&1 --target=mips64-linux-gnuabin32 \
1108 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL-GNUABIN32 %s
1109 // CHECK-MIPS64EL-GNUABIN32: "{{.*}}ld{{(.exe)?}}"
1110 // CHECK-MIPS64EL-GNUABIN32: "-m" "elf32btsmipn32"
1111 // CHECK-MIPS64EL-GNUABIN32: "-dynamic-linker" "{{.*}}/lib{{(32)?}}/ld.so.1"
1112 // CHECK-MIPS64EL-GNUABIN32-NOT: "--hash-style={{gnu|both}}"
1113 //
1114 // RUN: %clang %s -### -o %t.o 2>&1 --target=mips64-linux-gnuabi64 \
1115 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL-GNUABI64 %s
1116 // CHECK-MIPS64EL-GNUABI64: "{{.*}}ld{{(.exe)?}}"
1117 // CHECK-MIPS64EL-GNUABI64: "-m" "elf64btsmip"
1118 // CHECK-MIPS64EL-GNUABI64: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1"
1119 // CHECK-MIPS64EL-GNUABI64-NOT: "--hash-style={{gnu|both}}"
1120 //
1121 // RUN: %clang %s -### -o %t.o 2>&1 \
1122 // RUN:     --target=sparc-unknown-linux-gnu \
1123 // RUN:   | FileCheck --check-prefix=CHECK-SPARCV8 %s
1124 // CHECK-SPARCV8: "{{.*}}ld{{(.exe)?}}"
1125 // CHECK-SPARCV8: "-m" "elf32_sparc"
1126 // CHECK-SPARCV8: "-dynamic-linker" "{{(/usr/sparc-unknown-linux-gnu)?}}/lib/ld-linux.so.2"
1127 //
1128 // RUN: %clang %s -### -o %t.o 2>&1 \
1129 // RUN:     --target=sparcel-unknown-linux-gnu \
1130 // RUN:   | FileCheck --check-prefix=CHECK-SPARCV8EL %s
1131 // CHECK-SPARCV8EL: "{{.*}}ld{{(.exe)?}}"
1132 // CHECK-SPARCV8EL: "-m" "elf32_sparc"
1133 // CHECK-SPARCV8EL: "-dynamic-linker" "{{(/usr/sparcel-unknown-linux-gnu)?}}/lib/ld-linux.so.2"
1134 //
1135 // RUN: %clang %s -### -o %t.o 2>&1 \
1136 // RUN:     --target=sparcv9-unknown-linux-gnu \
1137 // RUN:   | FileCheck --check-prefix=CHECK-SPARCV9 %s
1138 // CHECK-SPARCV9: "{{.*}}ld{{(.exe)?}}"
1139 // CHECK-SPARCV9: "-m" "elf64_sparc"
1140 // CHECK-SPARCV9: "-dynamic-linker" "{{(/usr/sparcv9-unknown-linux-gnu)?}}/lib{{(64)?}}/ld-linux.so.2"
1141 //
1142 // Thoroughly exercise the Debian multiarch environment.
1143 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1144 // RUN:     --target=i686-linux-gnu -rtlib=platform \
1145 // RUN:     --gcc-toolchain="" \
1146 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1147 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-X86 %s
1148 // CHECK-DEBIAN-X86: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1149 // CHECK-DEBIAN-X86: "{{.*}}/usr/lib/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
1150 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5"
1151 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../i386-linux-gnu"
1152 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
1153 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../.."
1154 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/lib"
1155 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib"
1156 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1157 // RUN:     --target=x86_64-linux-gnu -rtlib=platform \
1158 // RUN:     --gcc-toolchain="" \
1159 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1160 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-X86-64 %s
1161 // CHECK-DEBIAN-X86-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1162 // CHECK-DEBIAN-X86-64: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
1163 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5"
1164 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../x86_64-linux-gnu"
1165 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/x86_64-linux-gnu"
1166 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../.."
1167 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/lib"
1168 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib"
1169 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1170 // RUN:     --target=powerpc-linux-gnu -rtlib=platform \
1171 // RUN:     --gcc-toolchain="" \
1172 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1173 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-PPC %s
1174 // CHECK-DEBIAN-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1175 // CHECK-DEBIAN-PPC: "{{.*}}/usr/lib/gcc/powerpc-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
1176 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5"
1177 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../powerpc-linux-gnu"
1178 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/powerpc-linux-gnu"
1179 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../.."
1180 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/lib"
1181 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib"
1182 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1183 // RUN:     --target=powerpc64le-linux-gnu -rtlib=platform \
1184 // RUN:     --gcc-toolchain="" \
1185 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1186 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-PPC64LE %s
1187 // CHECK-DEBIAN-PPC64LE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1188 // CHECK-DEBIAN-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
1189 // CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.5"
1190 // CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.5/../../../powerpc64le-linux-gnu"
1191 // CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib/powerpc64le-linux-gnu"
1192 // CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.5/../../.."
1193 // CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/lib"
1194 // CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib"
1195 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1196 // RUN:     --target=powerpc64-linux-gnu -rtlib=platform \
1197 // RUN:     --gcc-toolchain="" \
1198 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1199 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-PPC64 %s
1200 // CHECK-DEBIAN-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1201 // CHECK-DEBIAN-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
1202 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5"
1203 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../powerpc64-linux-gnu"
1204 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/powerpc64-linux-gnu"
1205 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../.."
1206 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/lib"
1207 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib"
1208 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1209 // RUN:     --target=mips-linux-gnu -rtlib=platform \
1210 // RUN:     --gcc-toolchain="" \
1211 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1212 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPS %s
1213 // CHECK-DEBIAN-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1214 // CHECK-DEBIAN-MIPS: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
1215 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
1216 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../../mips-linux-gnu"
1217 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/mips-linux-gnu"
1218 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
1219 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/lib"
1220 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib"
1221 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1222 // RUN:     --target=mipsel-linux-gnu -rtlib=platform \
1223 // RUN:     --gcc-toolchain="" \
1224 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1225 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPSEL %s
1226 // CHECK-DEBIAN-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1227 // CHECK-DEBIAN-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
1228 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
1229 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../../mipsel-linux-gnu"
1230 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/mipsel-linux-gnu"
1231 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
1232 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/lib"
1233 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib"
1234 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1235 // RUN:     --target=mips64-linux-gnu -rtlib=platform \
1236 // RUN:     --gcc-toolchain="" \
1237 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1238 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64 %s
1239 // CHECK-DEBIAN-MIPS64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1240 // CHECK-DEBIAN-MIPS64: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/64{{/|\\\\}}crtbegin.o"
1241 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/64"
1242 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
1243 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
1244 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/lib"
1245 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib"
1246 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1247 // RUN:     --target=mips64el-linux-gnu -rtlib=platform \
1248 // RUN:     --gcc-toolchain="" \
1249 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1250 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL %s
1251 // CHECK-DEBIAN-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1252 // CHECK-DEBIAN-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/64{{/|\\\\}}crtbegin.o"
1253 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/64"
1254 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
1255 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
1256 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/lib"
1257 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
1258 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1259 // RUN:     --target=mips64-linux-gnu -rtlib=platform -mabi=n32 \
1260 // RUN:     --gcc-toolchain="" \
1261 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1262 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64-N32 %s
1263 // CHECK-DEBIAN-MIPS64-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1264 // CHECK-DEBIAN-MIPS64-N32: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/n32{{/|\\\\}}crtbegin.o"
1265 // CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/n32"
1266 // CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
1267 // CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
1268 // CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/lib"
1269 // CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib"
1270 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1271 // RUN:     --target=mips64el-linux-gnu -rtlib=platform -mabi=n32 \
1272 // RUN:     --gcc-toolchain="" \
1273 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1274 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL-N32 %s
1275 // CHECK-DEBIAN-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1276 // CHECK-DEBIAN-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/n32{{/|\\\\}}crtbegin.o"
1277 // CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/n32"
1278 // CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
1279 // CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
1280 // CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/lib"
1281 // CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
1282 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1283 // RUN:     --target=sparc-linux-gnu -rtlib=platform \
1284 // RUN:     --gcc-toolchain="" \
1285 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1286 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-SPARC %s
1287 // CHECK-DEBIAN-SPARC:      "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1288 // CHECK-DEBIAN-SPARC-SAME: "{{.*}}/usr/lib/gcc/sparc-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
1289 // CHECK-DEBIAN-SPARC-SAME: "-L[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.5"
1290 // CHECK-DEBIAN-SPARC-SAME: "-L[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.5/../../../sparc-linux-gnu"
1291 // CHECK-DEBIAN-SPARC-SAME: "-L[[SYSROOT]]/usr/lib/sparc-linux-gnu"
1292 // CHECK-DEBIAN-SPARC-SAME: "-L[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.5/../../.."
1293 // CHECK-DEBIAN-SPARC-SAME: "-L[[SYSROOT]]/lib"
1294 // CHECK-DEBIAN-SPARC-SAME: "-L[[SYSROOT]]/usr/lib"
1295 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1296 // RUN:     --target=sparc64-linux-gnu -rtlib=platform \
1297 // RUN:     --gcc-toolchain="" \
1298 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
1299 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-SPARC64 %s
1300 // CHECK-DEBIAN-SPARC64:      "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1301 // CHECK-DEBIAN-SPARC64-SAME: "{{.*}}/usr/lib/gcc/sparc64-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
1302 // CHECK-DEBIAN-SPARC64-SAME: "-L[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.5"
1303 // CHECK-DEBIAN-SPARC64-SAME: "-L[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.5/../../../sparc64-linux-gnu"
1304 // CHECK-DEBIAN-SPARC64-SAME: "-L[[SYSROOT]]/usr/lib/sparc64-linux-gnu"
1305 // CHECK-DEBIAN-SPARC64-SAME: "-L[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.5/../../.."
1306 // CHECK-DEBIAN-SPARC64-SAME: "-L[[SYSROOT]]/lib"
1307 // CHECK-DEBIAN-SPARC64-SAME: "-L[[SYSROOT]]/usr/lib"
1308 //
1309 // Test linker invocation on Android.
1310 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1311 // RUN:     --target=arm-linux-androideabi -rtlib=platform \
1312 // RUN:     --gcc-toolchain="" \
1313 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1314 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
1315 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1316 // RUN:     --target=arm-linux-android -rtlib=platform \
1317 // RUN:     --gcc-toolchain="" \
1318 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1319 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
1320 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1321 // RUN:     --target=aarch64-linux-android -rtlib=platform \
1322 // RUN:     --gcc-toolchain="" \
1323 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1324 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
1325 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1326 // RUN:     --target=arm64-linux-android -rtlib=platform \
1327 // RUN:     --gcc-toolchain="" \
1328 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1329 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
1330 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1331 // RUN:     --target=mipsel-linux-android -rtlib=platform \
1332 // RUN:     --gcc-toolchain="" \
1333 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1334 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
1335 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1336 // RUN:     --target=mips64el-linux-android -rtlib=platform \
1337 // RUN:     --gcc-toolchain="" \
1338 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1339 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
1340 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1341 // RUN:     --target=i686-linux-android -rtlib=platform \
1342 // RUN:     --gcc-toolchain="" \
1343 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1344 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
1345 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1346 // RUN:     --target=x86_64-linux-android -rtlib=platform \
1347 // RUN:     --gcc-toolchain="" \
1348 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1349 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
1350 // CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1351 // CHECK-ANDROID: "-z" "now"
1352 // CHECK-ANDROID: "-z" "relro"
1353 // CHECK-ANDROID: "--enable-new-dtags"
1354 // CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
1355 // CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib"
1356 // CHECK-ANDROID-NOT: "gcc_s"
1357 // CHECK-ANDROID: "-lgcc"
1358 // CHECK-ANDROID: "-ldl"
1359 // CHECK-ANDROID-NOT: "gcc_s"
1360 // CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtend_android.o"
1361 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1362 // RUN:     --target=arm-linux-androideabi -rtlib=platform \
1363 // RUN:     --gcc-toolchain="" \
1364 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1365 // RUN:     -shared \
1366 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1367 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1368 // RUN:     --target=arm-linux-android -rtlib=platform \
1369 // RUN:     --gcc-toolchain="" \
1370 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1371 // RUN:     -shared \
1372 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1373 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1374 // RUN:     --target=aarch64-linux-android -rtlib=platform \
1375 // RUN:     --gcc-toolchain="" \
1376 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1377 // RUN:     -shared \
1378 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1379 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1380 // RUN:     --target=arm64-linux-android -rtlib=platform \
1381 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1382 // RUN:     -shared \
1383 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1384 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1385 // RUN:     --target=mipsel-linux-android -rtlib=platform \
1386 // RUN:     --gcc-toolchain="" \
1387 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1388 // RUN:     -shared \
1389 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1390 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1391 // RUN:     --target=mips64el-linux-android -rtlib=platform \
1392 // RUN:     --gcc-toolchain="" \
1393 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1394 // RUN:     -shared \
1395 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1396 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1397 // RUN:     --target=i686-linux-android -rtlib=platform \
1398 // RUN:     --gcc-toolchain="" \
1399 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1400 // RUN:     -shared \
1401 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1402 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1403 // RUN:     --target=x86_64-linux-android -rtlib=platform \
1404 // RUN:     --gcc-toolchain="" \
1405 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1406 // RUN:     -shared \
1407 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1408 // CHECK-ANDROID-SO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1409 // CHECK-ANDROID-SO-NOT: "-Bsymbolic"
1410 // CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtbegin_so.o"
1411 // CHECK-ANDROID-SO: "-L[[SYSROOT]]/usr/lib"
1412 // CHECK-ANDROID-SO-NOT: "gcc_s"
1413 // CHECK-ANDROID-SO: "-lgcc"
1414 // CHECK-ANDROID-SO: "-ldl"
1415 // CHECK-ANDROID-SO-NOT: "gcc_s"
1416 // CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtend_so.o"
1417 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1418 // RUN:     --target=arm-linux-androideabi -rtlib=platform \
1419 // RUN:     --gcc-toolchain="" \
1420 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1421 // RUN:     -static \
1422 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1423 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1424 // RUN:     --target=arm-linux-android -rtlib=platform \
1425 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1426 // RUN:     -static \
1427 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1428 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1429 // RUN:     --target=aarch64-linux-android -rtlib=platform \
1430 // RUN:     --gcc-toolchain="" \
1431 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1432 // RUN:     -static \
1433 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1434 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1435 // RUN:     --target=arm64-linux-android -rtlib=platform \
1436 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1437 // RUN:     -static \
1438 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1439 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1440 // RUN:     --target=mipsel-linux-android -rtlib=platform \
1441 // RUN:     --gcc-toolchain="" \
1442 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1443 // RUN:     -static \
1444 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1445 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1446 // RUN:     --target=mips64el-linux-android -rtlib=platform \
1447 // RUN:     --gcc-toolchain="" \
1448 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1449 // RUN:     -static \
1450 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1451 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1452 // RUN:     --target=i686-linux-android -rtlib=platform \
1453 // RUN:     --gcc-toolchain="" \
1454 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1455 // RUN:     -static \
1456 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1457 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1458 // RUN:     --target=x86_64-linux-android -rtlib=platform \
1459 // RUN:     --gcc-toolchain="" \
1460 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1461 // RUN:     -static \
1462 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1463 // CHECK-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1464 // CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtbegin_static.o"
1465 // CHECK-ANDROID-STATIC: "-L[[SYSROOT]]/usr/lib"
1466 // CHECK-ANDROID-STATIC-NOT: "gcc_s"
1467 // CHECK-ANDROID-STATIC: "-lgcc"
1468 // CHECK-ANDROID-STATIC-NOT: "-ldl"
1469 // CHECK-ANDROID-STATIC-NOT: "gcc_s"
1470 // CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtend_android.o"
1471 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1472 // RUN:     --target=arm-linux-androideabi -rtlib=platform \
1473 // RUN:     --gcc-toolchain="" \
1474 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot  \
1475 // RUN:     -pie \
1476 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1477 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1478 // RUN:     --target=arm-linux-android -rtlib=platform \
1479 // RUN:     --gcc-toolchain="" \
1480 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1481 // RUN:     -pie \
1482 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1483 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1484 // RUN:     --target=aarch64-linux-android -rtlib=platform \
1485 // RUN:     --gcc-toolchain="" \
1486 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot  \
1487 // RUN:     -pie \
1488 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1489 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1490 // RUN:     --target=arm64-linux-android -rtlib=platform \
1491 // RUN:     --gcc-toolchain="" \
1492 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot  \
1493 // RUN:     -pie \
1494 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1495 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1496 // RUN:     --target=mipsel-linux-android -rtlib=platform \
1497 // RUN:     --gcc-toolchain="" \
1498 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1499 // RUN:     -pie \
1500 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1501 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1502 // RUN:     --target=mips64el-linux-android -rtlib=platform \
1503 // RUN:     --gcc-toolchain="" \
1504 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1505 // RUN:     -pie \
1506 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1507 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1508 // RUN:     --target=i686-linux-android -rtlib=platform \
1509 // RUN:     --gcc-toolchain="" \
1510 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1511 // RUN:     -pie \
1512 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1513 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1514 // RUN:     --target=x86_64-linux-android -rtlib=platform \
1515 // RUN:     --gcc-toolchain="" \
1516 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1517 // RUN:     -pie \
1518 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1519 // CHECK-ANDROID-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1520 // CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
1521 // CHECK-ANDROID-PIE: "-L[[SYSROOT]]/usr/lib"
1522 // CHECK-ANDROID-PIE-NOT: "gcc_s"
1523 // CHECK-ANDROID-PIE: "-lgcc"
1524 // CHECK-ANDROID-PIE-NOT: "gcc_s"
1525 // CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtend_android.o"
1526 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1527 // RUN:     --target=arm-linux-androideabi \
1528 // RUN:     --gcc-toolchain="" \
1529 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1530 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1531 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1532 // RUN:     --target=arm-linux-android \
1533 // RUN:     --gcc-toolchain="" \
1534 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1535 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1536 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1537 // RUN:     --target=mipsel-linux-android \
1538 // RUN:     --gcc-toolchain="" \
1539 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1540 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1541 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1542 // RUN:     --target=aarch64-linux-android \
1543 // RUN:     --gcc-toolchain="" \
1544 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1545 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1546 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1547 // RUN:     --target=arm64-linux-android \
1548 // RUN:     --gcc-toolchain="" \
1549 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1550 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1551 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1552 // RUN:     --target=mips64el-linux-android \
1553 // RUN:     --gcc-toolchain="" \
1554 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1555 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1556 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1557 // RUN:     --target=i686-linux-android \
1558 // RUN:     --gcc-toolchain="" \
1559 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1560 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1561 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1562 // RUN:     --target=x86_64-linux-android \
1563 // RUN:     --gcc-toolchain="" \
1564 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1565 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1566 // CHECK-ANDROID-32: "-dynamic-linker" "/system/bin/linker"
1567 // CHECK-ANDROID-64: "-dynamic-linker" "/system/bin/linker64"
1568 //
1569 // Test that -pthread does not add -lpthread on Android.
1570 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1571 // RUN:     --target=arm-linux-androideabi -pthread \
1572 // RUN:     --gcc-toolchain="" \
1573 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1574 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1575 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1576 // RUN:     --target=arm-linux-android -pthread \
1577 // RUN:     --gcc-toolchain="" \
1578 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1579 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1580 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1581 // RUN:     --target=aarch64-linux-android -pthread \
1582 // RUN:     --gcc-toolchain="" \
1583 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1584 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1585 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1586 // RUN:     --target=arm64-linux-android -pthread \
1587 // RUN:     --gcc-toolchain="" \
1588 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1589 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1590 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1591 // RUN:     --target=mipsel-linux-android -pthread \
1592 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1593 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1594 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1595 // RUN:     --target=mips64el-linux-android -pthread \
1596 // RUN:     --gcc-toolchain="" \
1597 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1598 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1599 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1600 // RUN:     --target=i686-linux-android -pthread \
1601 // RUN:     --gcc-toolchain="" \
1602 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1603 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1604 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1605 // RUN:     --target=x86_64-linux-android -pthread \
1606 // RUN:     --gcc-toolchain="" \
1607 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1608 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1609 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1610 // RUN:     --target=arm-linux-androideabi -pthread \
1611 // RUN:     --gcc-toolchain="" \
1612 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1613 // RUN:     -shared \
1614 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1615 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1616 // RUN:     --target=arm-linux-android -pthread \
1617 // RUN:     --gcc-toolchain="" \
1618 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1619 // RUN:     -shared \
1620 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1621 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1622 // RUN:     --target=aarch64-linux-android -pthread \
1623 // RUN:     --gcc-toolchain="" \
1624 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1625 // RUN:     -shared \
1626 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1627 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1628 // RUN:     --target=arm64-linux-android -pthread \
1629 // RUN:     --gcc-toolchain="" \
1630 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1631 // RUN:     -shared \
1632 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1633 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1634 // RUN:     --target=mipsel-linux-android -pthread \
1635 // RUN:     --gcc-toolchain="" \
1636 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1637 // RUN:     -shared \
1638 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1639 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1640 // RUN:     --target=mips64el-linux-android -pthread \
1641 // RUN:     --gcc-toolchain="" \
1642 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1643 // RUN:     -shared \
1644 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1645 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1646 // RUN:     --target=i686-linux-android -pthread \
1647 // RUN:     --gcc-toolchain="" \
1648 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1649 // RUN:     -shared \
1650 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1651 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1652 // RUN:     --target=x86_64-linux-android -pthread \
1653 // RUN:     --gcc-toolchain="" \
1654 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1655 // RUN:     -shared \
1656 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1657 // CHECK-ANDROID-PTHREAD-NOT: -lpthread
1658 //
1659 // RUN: %clang -no-canonical-prefixes %t.o -### -o %t 2>&1 \
1660 // RUN:     --target=arm-linux-androideabi -pthread \
1661 // RUN:     --gcc-toolchain="" \
1662 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
1663 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD-LINK %s
1664 // CHECK-ANDROID-PTHREAD-LINK-NOT: argument unused during compilation: '-pthread'
1665 //
1666 // Check linker invocation on Debian 6 MIPS 32/64-bit.
1667 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1668 // RUN:     --target=mipsel-linux-gnu -rtlib=platform \
1669 // RUN:     --gcc-toolchain="" \
1670 // RUN:     --sysroot=%S/Inputs/debian_6_mips_tree \
1671 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPSEL %s
1672 // CHECK-DEBIAN-ML-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1673 // CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib{{/|\\\\}}crt1.o"
1674 // CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib{{/|\\\\}}crti.o"
1675 // CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4{{/|\\\\}}crtbegin.o"
1676 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4"
1677 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib"
1678 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib/../lib"
1679 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/../lib"
1680 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
1681 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib"
1682 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib"
1683 //
1684 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1685 // RUN:     --target=mips64el-linux-gnu -rtlib=platform \
1686 // RUN:     --gcc-toolchain="" \
1687 // RUN:     --sysroot=%S/Inputs/debian_6_mips_tree \
1688 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL %s
1689 // CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1690 // CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64{{/|\\\\}}crt1.o"
1691 // CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64{{/|\\\\}}crti.o"
1692 // CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/64{{/|\\\\}}crtbegin.o"
1693 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/64"
1694 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64"
1695 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib/../lib64"
1696 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/../lib64"
1697 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
1698 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib"
1699 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
1700 //
1701 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1702 // RUN:     --target=mips64el-linux-gnu -rtlib=platform -mabi=n32 \
1703 // RUN:     --gcc-toolchain="" \
1704 // RUN:     --sysroot=%S/Inputs/debian_6_mips_tree \
1705 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-N32 %s
1706 // CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1707 // CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32{{/|\\\\}}crt1.o"
1708 // CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32{{/|\\\\}}crti.o"
1709 // CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/n32{{/|\\\\}}crtbegin.o"
1710 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/n32"
1711 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32"
1712 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib/../lib32"
1713 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/../lib32"
1714 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
1715 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib"
1716 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
1717 //
1718 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1719 // RUN:     --target=mips64-unknown-linux-gnu --rtlib=platform \
1720 // RUN:     --gcc-toolchain="" \
1721 // RUN:     --sysroot=%S/Inputs/debian_6_mips64_tree \
1722 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64-GNUABI %s
1723 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1724 // RUN:     --target=mips64-linux-gnuabi64 -rtlib=platform -mabi=n64 \
1725 // RUN:     --gcc-toolchain="" \
1726 // RUN:     --sysroot=%S/Inputs/debian_6_mips64_tree \
1727 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64-GNUABI %s
1728 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1729 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../mips64-linux-gnuabi64{{/|\\\\}}crt1.o"
1730 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../mips64-linux-gnuabi64{{/|\\\\}}crti.o"
1731 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9{{/|\\\\}}crtbegin.o"
1732 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9"
1733 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../mips64-linux-gnuabi64"
1734 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/lib/mips64-linux-gnuabi64"
1735 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/mips64-linux-gnuabi64"
1736 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9"
1737 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../.."
1738 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/lib"
1739 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib"
1740 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9{{/|\\\\}}crtend.o"
1741 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../mips64-linux-gnuabi64{{/|\\\\}}crtn.o"
1742 //
1743 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1744 // RUN:     --target=mips64el-unknown-linux-gnu -rtlib=platform \
1745 // RUN:     --gcc-toolchain="" \
1746 // RUN:     --sysroot=%S/Inputs/debian_6_mips64_tree \
1747 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-GNUABI %s
1748 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1749 // RUN:     --target=mips64el-linux-gnuabi64 -rtlib=platform -mabi=n64 \
1750 // RUN:     --gcc-toolchain="" \
1751 // RUN:     --sysroot=%S/Inputs/debian_6_mips64_tree \
1752 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-GNUABI %s
1753 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1754 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64{{/|\\\\}}crt1.o"
1755 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64{{/|\\\\}}crti.o"
1756 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9{{/|\\\\}}crtbegin.o"
1757 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9"
1758 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64"
1759 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/lib/mips64el-linux-gnuabi64"
1760 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/mips64el-linux-gnuabi64"
1761 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9"
1762 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../.."
1763 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/lib"
1764 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib"
1765 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9{{/|\\\\}}crtend.o"
1766 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64{{/|\\\\}}crtn.o"
1767 //
1768 // Test linker invocation for Freescale SDK (OpenEmbedded).
1769 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1770 // RUN:     --target=powerpc-fsl-linux -rtlib=platform \
1771 // RUN:     --gcc-toolchain="" \
1772 // RUN:     --sysroot=%S/Inputs/freescale_ppc_tree \
1773 // RUN:   | FileCheck --check-prefix=CHECK-FSL-PPC %s
1774 // CHECK-FSL-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1775 // CHECK-FSL-PPC: "-m" "elf32ppclinux"
1776 // CHECK-FSL-PPC: "{{.*}}{{/|\\\\}}crt1.o"
1777 // CHECK-FSL-PPC: "{{.*}}{{/|\\\\}}crtbegin.o"
1778 // CHECK-FSL-PPC: "-L[[SYSROOT]]/usr/lib"
1779 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1780 // RUN:     --target=powerpc64-fsl-linux -rtlib=platform \
1781 // RUN:     --gcc-toolchain="" \
1782 // RUN:     --sysroot=%S/Inputs/freescale_ppc64_tree \
1783 // RUN:   | FileCheck --check-prefix=CHECK-FSL-PPC64 %s
1784 // CHECK-FSL-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1785 // CHECK-FSL-PPC64: "-m" "elf64ppc"
1786 // CHECK-FSL-PPC64: "{{.*}}{{/|\\\\}}crt1.o"
1787 // CHECK-FSL-PPC64: "{{.*}}{{/|\\\\}}crtbegin.o"
1788 // CHECK-FSL-PPC64: "-L[[SYSROOT]]/usr/lib64/powerpc64-fsl-linux/4.6.2/../.."
1789 //
1790 // Check that crtfastmath.o is linked with -ffast-math and with -Ofast.
1791 // RUN: %clang --target=x86_64-unknown-linux -### %s \
1792 // RUN:        --gcc-toolchain="" \
1793 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1794 // RUN:   | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1795 // RUN: %clang --target=x86_64-unknown-linux -### %s -ffast-math \
1796 // RUN:        --gcc-toolchain="" \
1797 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1798 // RUN:   | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1799 // RUN: %clang --target=x86_64-unknown-linux -### %s -funsafe-math-optimizations\
1800 // RUN:        --gcc-toolchain="" \
1801 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1802 // RUN:   | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1803 // RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast\
1804 // RUN:        --gcc-toolchain="" \
1805 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1806 // RUN:   | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1807 // RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast -O3\
1808 // RUN:        --gcc-toolchain="" \
1809 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1810 // RUN:   | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1811 // RUN: %clang --target=x86_64-unknown-linux -### %s -O3 -Ofast\
1812 // RUN:        --gcc-toolchain="" \
1813 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1814 // RUN:   | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1815 // RUN: %clang --target=x86_64-unknown-linux -### %s -ffast-math -fno-fast-math \
1816 // RUN:        --gcc-toolchain="" \
1817 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1818 // RUN:   | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1819 // RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast -fno-fast-math \
1820 // RUN:        --gcc-toolchain="" \
1821 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1822 // RUN:   | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1823 // RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast -fno-unsafe-math-optimizations \
1824 // RUN:        --gcc-toolchain="" \
1825 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1826 // RUN:   | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1827 // RUN: %clang --target=x86_64-unknown-linux -### %s -fno-fast-math -Ofast  \
1828 // RUN:        --gcc-toolchain="" \
1829 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1830 // RUN:   | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1831 // RUN: %clang --target=x86_64-unknown-linux -### %s -fno-unsafe-math-optimizations -Ofast \
1832 // RUN:        --gcc-toolchain="" \
1833 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1834 // RUN:   | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1835 // We don't have crtfastmath.o in the i386 tree, use it to check that file
1836 // detection works.
1837 // RUN: %clang --target=i386-unknown-linux -### %s -ffast-math \
1838 // RUN:        --gcc-toolchain="" \
1839 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1840 // RUN:   | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1841 // CHECK-CRTFASTMATH: usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtfastmath.o
1842 // CHECK-NOCRTFASTMATH-NOT: crtfastmath.o
1843 
1844 // Check that we link in gcrt1.o when compiling with -pg
1845 // RUN: %clang -pg --target=x86_64-unknown-linux -### %s \
1846 // RUN:        --gcc-toolchain="" \
1847 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>& 1 \
1848 // RUN:   | FileCheck --check-prefix=CHECK-PG %s
1849 // CHECK-PG: gcrt1.o
1850 
1851 // GCC forwards -u to the linker.
1852 // RUN: %clang -u asdf --target=x86_64-unknown-linux -### %s \
1853 // RUN:        --gcc-toolchain="" \
1854 // RUN:        --sysroot=%S/Inputs/basic_linux_tree 2>& 1 \
1855 // RUN:   | FileCheck --check-prefix=CHECK-u %s
1856 // CHECK-u: "-u" "asdf"
1857 
1858 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1859 // RUN:     --target=armeb-unknown-linux \
1860 // RUN:     --gcc-toolchain="" \
1861 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1862 // RUN:   | FileCheck --check-prefix=CHECK-ARMEB %s
1863 // CHECK-ARMEB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1864 // CHECK-ARMEB-NOT: "--be8"
1865 // CHECK-ARMEB: "-EB"
1866 // CHECK-ARMEB: "-m" "armelfb_linux_eabi"
1867 
1868 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1869 // RUN:     --target=armebv7-unknown-linux \
1870 // RUN:     --gcc-toolchain="" \
1871 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1872 // RUN:   | FileCheck --check-prefix=CHECK-ARMV7EB %s
1873 // CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1874 // CHECK-ARMV7EB: "--be8"
1875 // CHECK-ARMV7EB: "-EB"
1876 // CHECK-ARMV7EB: "-m" "armelfb_linux_eabi"
1877 
1878 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1879 // RUN:     --target=armv7-unknown-linux \
1880 // RUN:     -mbig-endian \
1881 // RUN:     --gcc-toolchain="" \
1882 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1883 // RUN:   | FileCheck --check-prefix=CHECK-ARMV7EB %s
1884 
1885 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1886 // RUN:     --target=armebv7-unknown-linux \
1887 // RUN:     -mbig-endian \
1888 // RUN:     --gcc-toolchain="" \
1889 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1890 // RUN:   | FileCheck --check-prefix=CHECK-ARMV7EB %s
1891 
1892 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1893 // RUN:     --target=armv7-unknown-linux \
1894 // RUN:     --gcc-toolchain="" \
1895 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1896 // RUN:   | FileCheck --check-prefix=CHECK-ARMV7EL %s
1897 // CHECK-ARMV7EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1898 // CHECK-ARMV7EL-NOT: "--be8"
1899 // CHECK-ARMV7EL: "-EL"
1900 // CHECK-ARMV7EL: "-m" "armelf_linux_eabi"
1901 
1902 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1903 // RUN:     --target=armebv7-unknown-linux \
1904 // RUN:     -mlittle-endian \
1905 // RUN:     --gcc-toolchain="" \
1906 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1907 // RUN:   | FileCheck --check-prefix=CHECK-ARMV7EL %s
1908 
1909 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1910 // RUN:     --target=armv7-unknown-linux \
1911 // RUN:     -mlittle-endian \
1912 // RUN:     --gcc-toolchain="" \
1913 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1914 // RUN:   | FileCheck --check-prefix=CHECK-ARMV7EL %s
1915 
1916 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1917 // RUN:     --target=aarch64_be-unknown-linux \
1918 // RUN:     --gcc-toolchain="" \
1919 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1920 // RUN:   | FileCheck --check-prefix=CHECK-AARCH64BE %s
1921 // CHECK-AARCH64BE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1922 // CHECK-AARCH64BE-NOT: "--be8"
1923 // CHECK-AARCH64BE: "-EB"
1924 // CHECK-AARCH64BE: "-m" "aarch64linuxb"
1925 
1926 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1927 // RUN:     --target=aarch64-unknown-linux \
1928 // RUN:     -mbig-endian \
1929 // RUN:     --gcc-toolchain="" \
1930 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1931 // RUN:   | FileCheck --check-prefix=CHECK-AARCH64BE %s
1932 
1933 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1934 // RUN:     --target=aarch64_be-unknown-linux \
1935 // RUN:     -mbig-endian \
1936 // RUN:     --gcc-toolchain="" \
1937 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1938 // RUN:   | FileCheck --check-prefix=CHECK-AARCH64BE %s
1939 
1940 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1941 // RUN:     --target=aarch64-unknown-linux \
1942 // RUN:     --gcc-toolchain="" \
1943 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1944 // RUN:   | FileCheck --check-prefix=CHECK-AARCH64LE %s
1945 // CHECK-AARCH64LE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1946 // CHECK-AARCH64LE-NOT: "--be8"
1947 // CHECK-AARCH64LE: "-EL"
1948 // CHECK-AARCH64LE: "-m" "aarch64linux"
1949 
1950 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1951 // RUN:     --target=aarch64_be-unknown-linux \
1952 // RUN:     -mlittle-endian \
1953 // RUN:     --gcc-toolchain="" \
1954 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
1955 // RUN:   | FileCheck --check-prefix=CHECK-AARCH64LE %s
1956 
1957 // Check dynamic-linker for musl-libc
1958 // RUN: %clang %s -### -o %t.o 2>&1 \
1959 // RUN:     --target=i386-pc-linux-musl \
1960 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-X86 %s
1961 // RUN: %clang %s -### -o %t.o 2>&1 \
1962 // RUN:     --target=x86_64-pc-linux-musl \
1963 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-X86_64 %s
1964 // RUN: %clang %s -### -o %t.o 2>&1 \
1965 // RUN:     --target=mips-pc-linux-musl \
1966 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-MIPS %s
1967 // RUN: %clang %s -### -o %t.o 2>&1 \
1968 // RUN:     --target=mipsel-pc-linux-musl \
1969 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-MIPSEL %s
1970 // RUN: %clang %s -### -o %t.o 2>&1 \
1971 // RUN:     --target=mips64-pc-linux-musl \
1972 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-MIPS64 %s
1973 // RUN: %clang %s -### -o %t.o 2>&1 \
1974 // RUN:     --target=mips64el-pc-linux-musl \
1975 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-MIPS64EL %s
1976 // RUN: %clang %s -### -o %t.o 2>&1 \
1977 // RUN:     --target=powerpc-pc-linux-musl \
1978 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-PPC %s
1979 // RUN: %clang %s -### -o %t.o 2>&1 \
1980 // RUN:     --target=powerpc64-pc-linux-musl \
1981 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-PPC64 %s
1982 // RUN: %clang %s -### -o %t.o 2>&1 \
1983 // RUN:     --target=thumb-pc-linux-musleabi \
1984 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARM %s
1985 // RUN: %clang %s -### -o %t.o 2>&1 \
1986 // RUN:     --target=thumb-pc-linux-musleabihf \
1987 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
1988 // RUN: %clang %s -### -o %t.o 2>&1 \
1989 // RUN:     --target=thumbv7-pc-linux-musleabi -mhard-float \
1990 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
1991 // RUN: %clang %s -### -o %t.o 2>&1 \
1992 // RUN:     --target=thumbeb-pc-linux-musleabi \
1993 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMEB %s
1994 // RUN: %clang %s -### -o %t.o 2>&1 \
1995 // RUN:     --target=thumbeb-pc-linux-musleabihf \
1996 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
1997 // RUN: %clang %s -### -o %t.o 2>&1 \
1998 // RUN:     --target=thumbv7eb-pc-linux-musleabi -mhard-float \
1999 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
2000 // RUN: %clang %s -### -o %t.o 2>&1 \
2001 // RUN:     --target=arm-pc-linux-musleabi \
2002 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARM %s
2003 // RUN: %clang %s -### -o %t.o 2>&1 \
2004 // RUN:     --target=arm-pc-linux-musleabihf \
2005 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
2006 // RUN: %clang %s -### -o %t.o 2>&1 \
2007 // RUN:     --target=armv7-pc-linux-musleabi -mhard-float \
2008 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
2009 // RUN: %clang %s -### -o %t.o 2>&1 \
2010 // RUN:     --target=armeb-pc-linux-musleabi \
2011 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMEB %s
2012 // RUN: %clang %s -### -o %t.o 2>&1 \
2013 // RUN:     --target=armeb-pc-linux-musleabihf \
2014 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
2015 // RUN: %clang %s -### -o %t.o 2>&1 \
2016 // RUN:     --target=armv7eb-pc-linux-musleabi -mhard-float \
2017 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
2018 // RUN: %clang %s -### -o %t.o 2>&1 \
2019 // RUN:     --target=aarch64-pc-linux-musleabi \
2020 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-AARCH64 %s
2021 // RUN: %clang %s -### -o %t.o 2>&1 \
2022 // RUN:     --target=aarch64_be-pc-linux-musleabi \
2023 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-AARCH64_BE %s
2024 // CHECK-MUSL-X86:        "-dynamic-linker" "/lib/ld-musl-i386.so.1"
2025 // CHECK-MUSL-X86_64:     "-dynamic-linker" "/lib/ld-musl-x86_64.so.1"
2026 // CHECK-MUSL-MIPS:       "-dynamic-linker" "/lib/ld-musl-mips.so.1"
2027 // CHECK-MUSL-MIPSEL:     "-dynamic-linker" "/lib/ld-musl-mipsel.so.1"
2028 // CHECK-MUSL-MIPS64:     "-dynamic-linker" "/lib/ld-musl-mips64.so.1"
2029 // CHECK-MUSL-MIPS64EL:   "-dynamic-linker" "/lib/ld-musl-mips64el.so.1"
2030 // CHECK-MUSL-PPC:        "-dynamic-linker" "/lib/ld-musl-powerpc.so.1"
2031 // CHECK-MUSL-PPC64:      "-dynamic-linker" "/lib/ld-musl-powerpc64.so.1"
2032 // CHECK-MUSL-ARM:        "-dynamic-linker" "/lib/ld-musl-arm.so.1"
2033 // CHECK-MUSL-ARMHF:      "-dynamic-linker" "/lib/ld-musl-armhf.so.1"
2034 // CHECK-MUSL-ARMEB:      "-dynamic-linker" "/lib/ld-musl-armeb.so.1"
2035 // CHECK-MUSL-ARMEBHF:    "-dynamic-linker" "/lib/ld-musl-armebhf.so.1"
2036 // CHECK-MUSL-AARCH64:    "-dynamic-linker" "/lib/ld-musl-aarch64.so.1"
2037 // CHECK-MUSL-AARCH64_BE: "-dynamic-linker" "/lib/ld-musl-aarch64_be.so.1"
2038 
2039 // Check whether multilib gcc install works fine on Gentoo with gcc-config
2040 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
2041 // RUN:     --target=x86_64-unknown-linux-gnu -rtlib=platform \
2042 // RUN:     --sysroot=%S/Inputs/gentoo_linux_gcc_multi_version_tree \
2043 // RUN:     --gcc-toolchain="" \
2044 // RUN:   | FileCheck --check-prefix=CHECK-LD-GENTOO %s
2045 // CHECK-LD-GENTOO-NOT: warning:
2046 // CHECK-LD-GENTOO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
2047 // CHECK-LD-GENTOO: "--eh-frame-hdr"
2048 // CHECK-LD-GENTOO: "-m" "elf_x86_64"
2049 // CHECK-LD-GENTOO: "-dynamic-linker"
2050 // CHECK-LD-GENTOO: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3{{/|\\\\}}crtbegin.o"
2051 // CHECK-LD-GENTOO: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3"
2052 // CHECK-LD-GENTOO: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib"
2053 // CHECK-LD-GENTOO: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../.."
2054 // CHECK-LD-GENTOO: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2055 // CHECK-LD-GENTOO: "-lc"
2056 // CHECK-LD-GENTOO: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2057 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
2058 // RUN:     --target=i686-unknown-linux-gnu -rtlib=platform \
2059 // RUN:     --sysroot=%S/Inputs/gentoo_linux_gcc_multi_version_tree \
2060 // RUN:     --gcc-toolchain="" \
2061 // RUN:   | FileCheck --check-prefix=CHECK-LD-GENTOO-32 %s
2062 // CHECK-LD-GENTOO-32-NOT: warning:
2063 // CHECK-LD-GENTOO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
2064 // CHECK-LD-GENTOO-32: "--eh-frame-hdr"
2065 // CHECK-LD-GENTOO-32: "-m" "elf_i386"
2066 // CHECK-LD-GENTOO-32: "-dynamic-linker"
2067 // CHECK-LD-GENTOO-32: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32{{/|\\\\}}crtbegin.o"
2068 // CHECK-LD-GENTOO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32"
2069 // CHECK-LD-GENTOO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib"
2070 // CHECK-LD-GENTOO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../.."
2071 // CHECK-LD-GENTOO-32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2072 // CHECK-LD-GENTOO-32: "-lc"
2073 // CHECK-LD-GENTOO-32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2074 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
2075 // RUN:     --target=x86_64-unknown-linux-gnux32 -rtlib=platform \
2076 // RUN:     --sysroot=%S/Inputs/gentoo_linux_gcc_multi_version_tree \
2077 // RUN:     --gcc-toolchain="" \
2078 // RUN:   | FileCheck --check-prefix=CHECK-LD-GENTOO-X32 %s
2079 // CHECK-LD-GENTOO-X32-NOT: warning:
2080 // CHECK-LD-GENTOO-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
2081 // CHECK-LD-GENTOO-X32: "--eh-frame-hdr"
2082 // CHECK-LD-GENTOO-X32: "-m" "elf32_x86_64"
2083 // CHECK-LD-GENTOO-X32: "-dynamic-linker"
2084 // CHECK-LD-GENTOO-X32: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/x32{{/|\\\\}}crtbegin.o"
2085 // CHECK-LD-GENTOO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/x32"
2086 // CHECK-LD-GENTOO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib"
2087 // CHECK-LD-GENTOO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../.."
2088 // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2089 // CHECK-LD-GENTOO-X32: "-lc"
2090 // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2091 
2092 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
2093 // RUN:     --target=x86_64-unknown-linux-gnu \
2094 // RUN:     --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \
2095 // RUN:     --sysroot=%S/Inputs/rhel_7_tree \
2096 // RUN:   | FileCheck --check-prefix=CHECK-LD-RHEL7-DTS %s
2097 // CHECK-LD-RHEL7-DTS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
2098 // CHECK-LD-RHLE7-DTS: Selected GCC installation: [[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]]
2099 // CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld
2100 // CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld
2101 
2102 // Check whether gcc7 install works fine on Amazon Linux AMI
2103 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
2104 // RUN:     --target=x86_64-amazon-linux -rtlib=libgcc \
2105 // RUN:     --gcc-toolchain="" \
2106 // RUN:     --sysroot=%S/Inputs/ami_linux_tree \
2107 // RUN:   | FileCheck --check-prefix=CHECK-LD-AMI %s
2108 // CHECK-LD-AMI-NOT: warning:
2109 // CHECK-LD-AMI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
2110 // CHECK-LD-AMI: "--eh-frame-hdr"
2111 // CHECK-LD-AMI: "-m" "elf_x86_64"
2112 // CHECK-LD-AMI: "-dynamic-linker"
2113 // CHECK-LD-AMI: "{{.*}}/usr/lib/gcc/x86_64-amazon-linux/7{{/|\\\\}}crtbegin.o"
2114 // CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7"
2115 // CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../../../lib64"
2116 // CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../.."
2117 // CHECK-LD-AMI: "-L[[SYSROOT]]/lib"
2118 // CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib"
2119 // CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2120 // CHECK-LD-AMI: "-lc"
2121 // CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2122 
2123 // Check whether the OpenEmbedded ARM libs are added correctly.
2124 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
2125 // RUN:     --target=arm-oe-linux-gnueabi -rtlib=libgcc \
2126 // RUN:     --gcc-toolchain="" \
2127 // RUN:     --sysroot=%S/Inputs/openembedded_arm_linux_tree \
2128 // RUN:   | FileCheck --check-prefix=CHECK-OE-ARM %s
2129 
2130 // CHECK-OE-ARM: "-cc1" "-triple" "armv4t-oe-linux-gnueabi"
2131 // CHECK-OE-ARM: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]"
2132 // CHECK-OE-ARM: "-m" "armelf_linux_eabi" "-dynamic-linker"
2133 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0/../../../lib{{/|\\\\}}crt1.o"
2134 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0/../../../lib{{/|\\\\}}crti.o"
2135 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0{{/|\\\\}}crtbegin.o"
2136 // CHECK-OE-ARM: "-L[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0"
2137 // CHECK-OE-ARM: "-L[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi"
2138 // CHECK-OE-ARM: "-L[[SYSROOT]]/usr/lib"
2139 // CHECK-OE-ARM: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2140 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0{{/|\\\\}}crtend.o"
2141 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0/../../../lib{{/|\\\\}}crtn.o"
2142 
2143 // Check whether the OpenEmbedded AArch64 libs are added correctly.
2144 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
2145 // RUN:     --target=aarch64-oe-linux -rtlib=libgcc \
2146 // RUN:     --gcc-toolchain="" \
2147 // RUN:     --sysroot=%S/Inputs/openembedded_aarch64_linux_tree \
2148 // RUN:   | FileCheck --check-prefix=CHECK-OE-AARCH64 %s
2149 
2150 // CHECK-OE-AARCH64: "-cc1" "-triple" "aarch64-oe-linux"
2151 // CHECK-OE-AARCH64: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]"
2152 // CHECK-OE-AARCH64: "-m" "aarch64linux" "-dynamic-linker"
2153 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../lib64{{/|\\\\}}crt1.o"
2154 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../lib64{{/|\\\\}}crti.o"
2155 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0{{/|\\\\}}crtbegin.o"
2156 // CHECK-OE-AARCH64: "-L[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0"
2157 // CHECK-OE-AARCH64: "-L[[SYSROOT]]/usr/lib64"
2158 // CHECK-OE-AARCH64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
2159 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0{{/|\\\\}}crtend.o"
2160 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../lib64{{/|\\\\}}crtn.o"
2161