1 // UNSUPPORTED: system-windows
2 // General tests that ld invocations on Linux targets sane. Note that we use
3 // sysroot to make these tests independent of the host system.
5 // RUN: %clang -### -Werror %s -no-pie 2>&1 \
6 // RUN: --target=i386-unknown-linux -rtlib=platform --unwindlib=platform \
7 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
8 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
9 // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
10 // CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
11 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0"
12 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../i386-unknown-linux/lib"
13 // CHECK-LD-32: "-L[[SYSROOT]]/lib"
14 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
16 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
17 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
18 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
19 // RUN: | FileCheck --check-prefix=CHECK-LD-64 %s
20 // CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
21 // CHECK-LD-64: "--eh-frame-hdr"
22 // CHECK-LD-64: "-m" "elf_x86_64"
23 // CHECK-LD-64: "-dynamic-linker"
24 // CHECK-LD-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
25 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0"
26 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
27 // CHECK-LD-64: "-L[[SYSROOT]]/lib"
28 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib"
29 // CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
31 // CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
33 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
34 // RUN: --target=x86_64-unknown-linux-gnux32 -rtlib=platform --unwindlib=platform \
35 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
36 // RUN: | FileCheck --check-prefix=CHECK-LD-X32 %s
37 // CHECK-LD-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
38 // CHECK-LD-X32: "--eh-frame-hdr"
39 // CHECK-LD-X32: "-m" "elf32_x86_64"
40 // CHECK-LD-X32: "-dynamic-linker"
41 // CHECK-LD-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
42 // CHECK-LD-X32: "-lc"
43 // CHECK-LD-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
45 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
46 // RUN: --target=x86_64-unknown-linux \
47 // RUN: -resource-dir=%S/Inputs/resource_dir \
48 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
49 // RUN: --rtlib=compiler-rt \
50 // RUN: | FileCheck --check-prefix=CHECK-LD-RT %s
51 // CHECK-LD-RT: "-resource-dir" "[[RESDIR:[^"]*]]"
52 // CHECK-LD-RT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
53 // CHECK-LD-RT: "--eh-frame-hdr"
54 // CHECK-LD-RT: "-m" "elf_x86_64"
55 // CHECK-LD-RT: "-dynamic-linker"
56 // CHECK-LD-RT: "[[RESDIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-linux{{/|\\\\}}clang_rt.crtbegin.o"
57 // CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0"
58 // CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
59 // CHECK-LD-RT: "-L[[SYSROOT]]/lib"
60 // CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib"
61 // CHECK-LD-RT: libclang_rt.builtins.a"
63 // CHECK-LD-RT: libclang_rt.builtins.a"
64 // CHECK-LD-RT: "[[RESDIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-linux{{/|\\\\}}clang_rt.crtend.o"
66 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
67 // RUN: --target=i686-unknown-linux \
68 // RUN: -resource-dir=%S/Inputs/resource_dir \
69 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
70 // RUN: --rtlib=compiler-rt \
71 // RUN: | FileCheck --check-prefix=CHECK-LD-RT-I686 %s
72 // CHECK-LD-RT-I686: "-resource-dir" "[[RESDIR:[^"]*]]"
73 // CHECK-LD-RT-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
74 // CHECK-LD-RT-I686: "--eh-frame-hdr"
75 // CHECK-LD-RT-I686: "-m" "elf_i386"
76 // CHECK-LD-RT-I686: "-dynamic-linker"
77 // CHECK-LD-RT-I686: "[[RESDIR]]{{/|\\\\}}lib{{/|\\\\}}i686-unknown-linux{{/|\\\\}}clang_rt.crtbegin.o"
78 // CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/10.2.0"
79 // CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/10.2.0/../../../../i686-unknown-linux/lib"
80 // CHECK-LD-RT-I686: "-L[[SYSROOT]]/lib"
81 // CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib"
82 // CHECK-LD-RT-I686: libclang_rt.builtins.a"
83 // CHECK-LD-RT-I686: "-lc"
84 // CHECK-LD-RT-I686: libclang_rt.builtins.a"
85 // CHECK-LD-RT-I686: "[[RESDIR]]{{/|\\\\}}lib{{/|\\\\}}i686-unknown-linux{{/|\\\\}}clang_rt.crtend.o"
87 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
88 // RUN: --target=arm-linux-androideabi \
89 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
90 // RUN: -resource-dir=%S/Inputs/resource_dir \
91 // RUN: --rtlib=compiler-rt \
92 // RUN: | FileCheck --check-prefix=CHECK-LD-RT-ANDROID %s
93 // CHECK-LD-RT-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
94 // CHECK-LD-RT-ANDROID: "--eh-frame-hdr"
95 // CHECK-LD-RT-ANDROID: "-m" "armelf_linux_eabi"
96 // CHECK-LD-RT-ANDROID: "-dynamic-linker"
97 // CHECK-LD-RT-ANDROID: libclang_rt.builtins.a"
98 // CHECK-LD-RT-ANDROID: "-lc"
99 // CHECK-LD-RT-ANDROID: libclang_rt.builtins.a"
101 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
102 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
103 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
104 // RUN: | FileCheck --check-prefix=CHECK-LD-GCC %s
105 // CHECK-LD-GCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
106 // CHECK-LD-GCC: "--eh-frame-hdr"
107 // CHECK-LD-GCC: "-m" "elf_x86_64"
108 // CHECK-LD-GCC: "-dynamic-linker"
109 // CHECK-LD-GCC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
110 // CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0"
111 // CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
112 // CHECK-LD-GCC: "-L[[SYSROOT]]/lib"
113 // CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib"
114 // CHECK-LD-GCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
115 // CHECK-LD-GCC: "-lc"
116 // CHECK-LD-GCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
118 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
119 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
120 // RUN: -static-libgcc \
121 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
122 // RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC-LIBGCC %s
123 // CHECK-LD-64-STATIC-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
124 // CHECK-LD-64-STATIC-LIBGCC: "--eh-frame-hdr"
125 // CHECK-LD-64-STATIC-LIBGCC: "-m" "elf_x86_64"
126 // CHECK-LD-64-STATIC-LIBGCC: "-dynamic-linker"
127 // CHECK-LD-64-STATIC-LIBGCC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
128 // CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0"
129 // CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
130 // CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/lib"
131 // CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib"
132 // CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
133 // CHECK-LD-64-STATIC-LIBGCC: "-lc"
134 // CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
136 // RUN: %clang -### %s -no-pie 2>&1 \
137 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
138 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
139 // RUN: | FileCheck --check-prefix=CHECK-CLANG-NO-LIBGCC %s
140 // CHECK-CLANG-NO-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
141 // CHECK-CLANG-NO-LIBGCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
142 // CHECK-CLANG-NO-LIBGCC: "-lc"
143 // CHECK-CLANG-NO-LIBGCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
145 // RUN: %clangxx -### %s -no-pie 2>&1 \
146 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
147 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
148 // RUN: | FileCheck --check-prefix=CHECK-CLANGXX-NO-LIBGCC %s
149 // CHECK-CLANGXX-NO-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
150 // CHECK-CLANGXX-NO-LIBGCC: "-lgcc_s" "-lgcc"
151 // CHECK-CLANGXX-NO-LIBGCC: "-lc"
152 // CHECK-CLANGXX-NO-LIBGCC: "-lgcc_s" "-lgcc"
154 // RUN: %clang -static -### %s 2>&1 \
155 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
156 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
157 // RUN: | FileCheck --check-prefix=CHECK-CLANG-NO-LIBGCC-STATIC %s
158 // CHECK-CLANG-NO-LIBGCC-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
159 // CHECK-CLANG-NO-LIBGCC-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
161 // RUN: %clang -static-pie -### %s 2>&1 \
162 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
163 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
164 // RUN: | FileCheck --check-prefix=CHECK-CLANG-LD-STATIC-PIE %s
165 // CHECK-CLANG-LD-STATIC-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
166 // CHECK-CLANG-LD-STATIC-PIE: "-m" "elf_x86_64"
167 // CHECK-CLANG-LD-STATIC-PIE-SAME: "-static" "-pie" "--no-dynamic-linker" "-z" "text"
168 // CHECK-CLANG-LD-STATIC-PIE: "{{.*}}rcrt1.o"
169 // CHECK-CLANG-LD-STATIC-PIE: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
171 // RUN: not %clang -static-pie -pie -### %s -no-pie 2>&1 \
172 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
173 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
174 // RUN: | FileCheck --check-prefix=CHECK-CLANG-LD-STATIC-PIE-PIE %s
175 // CHECK-CLANG-LD-STATIC-PIE-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
176 // CHECK-CLANG-LD-STATIC-PIE-PIE: "-m" "elf_x86_64"
177 // CHECK-CLANG-LD-STATIC-PIE-PIE-SAME: "-static" "-pie" "--no-dynamic-linker" "-z" "text"
178 // CHECK-CLANG-LD-STATIC-PIE-PIE: "{{.*}}rcrt1.o"
179 // CHECK-CLANG-LD-STATIC-PIE-PIE: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
181 // RUN: not %clang -static-pie -static -### %s -no-pie 2>&1 \
182 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
183 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
184 // RUN: | FileCheck --check-prefix=CHECK-CLANG-LD-STATIC-PIE-STATIC %s
185 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
186 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "-m" "elf_x86_64"
187 // CHECK-CLANG-LD-STATIC-PIE-STATIC-SAME: "-static" "-pie" "--no-dynamic-linker" "-z" "text"
188 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "{{.*}}rcrt1.o"
189 // CHECK-CLANG-LD-STATIC-PIE-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
191 // RUN: not %clang -static-pie -### %s -no-pie 2>&1 \
192 // RUN: --target=x86_64-unknown-linux -rtlib=platform \
193 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
194 // RUN: | FileCheck --check-prefix=CHECK-CLANG-LD-STATIC-PIE-NOPIE %s
195 // CHECK-CLANG-LD-STATIC-PIE-NOPIE: error: cannot specify 'nopie' along with 'static-pie'
197 // RUN: %clang -dynamic -### %s -no-pie 2>&1 \
198 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
199 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
200 // RUN: | FileCheck --check-prefix=CHECK-CLANG-NO-LIBGCC-DYNAMIC %s
201 // CHECK-CLANG-NO-LIBGCC-DYNAMIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
202 // CHECK-CLANG-NO-LIBGCC-DYNAMIC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
203 // CHECK-CLANG-NO-LIBGCC-DYNAMIC: "-lc"
204 // CHECK-CLANG-NO-LIBGCC-DYNAMIC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
206 // RUN: %clang -static-libgcc -### %s -no-pie 2>&1 \
207 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
208 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
209 // RUN: | FileCheck --check-prefix=CHECK-CLANG-STATIC-LIBGCC %s
210 // CHECK-CLANG-STATIC-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
211 // CHECK-CLANG-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
212 // CHECK-CLANG-STATIC-LIBGCC: "-lc"
213 // CHECK-CLANG-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
215 // RUN: %clang -static-libgcc -dynamic -### %s -no-pie 2>&1 \
216 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
217 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
218 // RUN: | FileCheck --check-prefix=CHECK-CLANG-STATIC-LIBGCC-DYNAMIC %s
219 // CHECK-CLANG-STATIC-LIBGCC-DYNAMIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
220 // CHECK-CLANG-STATIC-LIBGCC-DYNAMIC: "-lgcc" "-lgcc_eh"
221 // CHECK-CLANG-STATIC-LIBGCC-DYNAMIC: "-lc"
222 // CHECK-CLANG-STATIC-LIBGCC-DYNAMIC: "-lgcc" "-lgcc_eh"
224 // RUN: %clang -shared-libgcc -### %s -no-pie 2>&1 \
225 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
226 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
227 // RUN: | FileCheck --check-prefix=CHECK-CLANG-SHARED-LIBGCC %s
228 // CHECK-CLANG-SHARED-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
229 // CHECK-CLANG-SHARED-LIBGCC: "-lgcc_s" "-lgcc"
230 // CHECK-CLANG-SHARED-LIBGCC: "-lc"
231 // CHECK-CLANG-SHARED-LIBGCC: "-lgcc_s" "-lgcc"
233 // RUN: %clang -shared-libgcc -dynamic -### %s -no-pie 2>&1 \
234 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
235 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
236 // RUN: | FileCheck --check-prefix=CHECK-CLANG-SHARED-LIBGCC-DYNAMIC %s
237 // CHECK-CLANG-SHARED-LIBGCC-DYNAMIC: "-lgcc_s" "-lgcc"
238 // CHECK-CLANG-SHARED-LIBGCC-DYNAMIC: "-lc"
239 // CHECK-CLANG-SHARED-LIBGCC-DYNAMIC: "-lgcc_s" "-lgcc"
241 // RUN: %clang -### %s -no-pie 2>&1 \
242 // RUN: --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
243 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
244 // RUN: | FileCheck --check-prefix=CHECK-CLANG-ANDROID-NONE %s
245 // CHECK-CLANG-ANDROID-NONE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
246 // CHECK-CLANG-ANDROID-NONE: "-l:libunwind.a" "-ldl" "-lc"
248 // RUN: %clang -shared -### %s -no-pie 2>&1 \
249 // RUN: --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
250 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
251 // RUN: | FileCheck --check-prefix=CHECK-CLANG-ANDROID-SHARED %s
252 // CHECK-CLANG-ANDROID-SHARED: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
253 // CHECK-CLANG-ANDROID-SHARED: "-l:libunwind.a" "-ldl" "-lc"
255 // RUN: %clang -static -### %s -no-pie 2>&1 \
256 // RUN: --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
257 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
258 // RUN: -resource-dir=%S/Inputs/resource_dir \
259 // RUN: | FileCheck --check-prefix=CHECK-CLANG-ANDROID-STATIC %s
260 // CHECK-CLANG-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
261 // CHECK-CLANG-ANDROID-STATIC: "--start-group" "{{[^"]*}}{{/|\\\\}}libclang_rt.builtins.a" "-l:libunwind.a" "-lc" "--end-group"
263 // RUN: %clang -### %s -Werror --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
265 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
266 // RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC %s
267 // CHECK-LD-64-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
268 // CHECK-LD-64-STATIC: "--eh-frame-hdr"
269 // CHECK-LD-64-STATIC: "-m" "elf_x86_64"
270 // CHECK-LD-64-STATIC-NOT: "-dynamic-linker"
271 // CHECK-LD-64-STATIC: "-static"
272 // CHECK-LD-64-STATIC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0{{/|\\\\}}crtbeginT.o"
273 // CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0"
274 // CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
275 // CHECK-LD-64-STATIC: "-L[[SYSROOT]]/lib"
276 // CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib"
277 // CHECK-LD-64-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
279 // RUN: %clang -no-pie -### %s --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform -shared -static \
280 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 | FileCheck --check-prefix=CHECK-LD-SHARED-STATIC %s
281 // CHECK-LD-SHARED-STATIC: "-shared" "-static"
282 // CHECK-LD-SHARED-STATIC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0{{/|\\\\}}crtbeginS.o"
283 // CHECK-LD-SHARED-STATIC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0{{/|\\\\}}crtendS.o"
285 // Check that flags can be combined. The -static dominates.
286 // RUN: %clang -### %s 2>&1 \
287 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
288 // RUN: -static-libgcc -static \
289 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
290 // RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC %s
292 // RUN: %clang -### %s -no-pie 2>&1 \
293 // RUN: --target=i386-unknown-linux -rtlib=platform --unwindlib=platform -m32 \
294 // RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
295 // RUN: | FileCheck --check-prefix=CHECK-32-TO-32 %s
296 // CHECK-32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
297 // CHECK-32-TO-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
298 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0"
299 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../i386-unknown-linux/lib/../lib32"
300 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../lib32"
301 // CHECK-32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
302 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
303 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../i386-unknown-linux/lib"
304 // CHECK-32-TO-32: "-L[[SYSROOT]]/lib"
305 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib"
307 // RUN: %clang -### %s -no-pie 2>&1 \
308 // RUN: --target=i386-unknown-linux -rtlib=platform --unwindlib=platform -m64 \
309 // RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
310 // RUN: | FileCheck --check-prefix=CHECK-32-TO-64 %s
311 // CHECK-32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
312 // CHECK-32-TO-64: "{{.*}}/usr/lib/gcc/i386-unknown-linux/10.2.0/64{{/|\\\\}}crtbegin.o"
313 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/64"
314 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../i386-unknown-linux/lib/../lib64"
315 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../lib64"
316 // CHECK-32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
317 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
318 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../i386-unknown-linux/lib"
319 // CHECK-32-TO-64: "-L[[SYSROOT]]/lib"
320 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib"
322 // RUN: %clang -### %s -no-pie 2>&1 \
323 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform -m64 \
324 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
325 // RUN: | FileCheck --check-prefix=CHECK-64-TO-64 %s
326 // CHECK-64-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
327 // CHECK-64-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
328 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0"
329 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib/../lib64"
330 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../lib64"
331 // CHECK-64-TO-64: "-L[[SYSROOT]]/lib/../lib64"
332 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
333 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
334 // CHECK-64-TO-64: "-L[[SYSROOT]]/lib"
335 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib"
337 // RUN: not %clang -### %s -no-pie 2>&1 \
338 // RUN: --target=x86_64-unknown-linux -rtlib=plaform --unwindlib=platform -m32 \
339 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
340 // RUN: | FileCheck --check-prefix=CHECK-64-TO-32 %s
341 // CHECK-64-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
342 // CHECK-64-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0/32{{/|\\\\}}crtbegin.o"
343 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/32"
344 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib/../lib32"
345 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../lib32"
346 // CHECK-64-TO-32: "-L[[SYSROOT]]/lib/../lib32"
347 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
348 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
349 // CHECK-64-TO-32: "-L[[SYSROOT]]/lib"
350 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib"
352 // RUN: %clang -### %s -no-pie 2>&1 \
353 // RUN: --target=x86_64-unknown-linux-gnux32 -rtlib=platform --unwindlib=platform \
354 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
355 // RUN: | FileCheck --check-prefix=CHECK-X32 %s
356 // CHECK-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
357 // CHECK-X32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0/x32{{/|\\\\}}crtbegin.o"
358 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/x32"
359 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib/../libx32"
360 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../libx32"
361 // CHECK-X32: "-L[[SYSROOT]]/lib/../libx32"
362 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
363 // CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
364 // CHECK-X32: "-L[[SYSROOT]]/lib"
365 // CHECK-X32: "-L[[SYSROOT]]/usr/lib"
367 // RUN: %clang -### %s -no-pie 2>&1 \
368 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform -mx32 \
369 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
370 // RUN: | FileCheck --check-prefix=CHECK-64-TO-X32 %s
371 // CHECK-64-TO-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
372 // CHECK-64-TO-X32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0/x32{{/|\\\\}}crtbegin.o"
373 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/x32"
374 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib/../libx32"
375 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../libx32"
376 // CHECK-64-TO-X32: "-L[[SYSROOT]]/lib/../libx32"
377 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
378 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
379 // CHECK-64-TO-X32: "-L[[SYSROOT]]/lib"
380 // CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib"
382 // RUN: %clang -### %s -no-pie 2>&1 \
383 // RUN: --target=i386-unknown-linux -rtlib=platform --unwindlib=platform -mx32 \
384 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
385 // RUN: | FileCheck --check-prefix=CHECK-32-TO-X32 %s
386 // CHECK-32-TO-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
387 // CHECK-32-TO-X32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0/x32{{/|\\\\}}crtbegin.o"
388 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/x32"
389 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib/../libx32"
390 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../libx32"
391 // CHECK-32-TO-X32: "-L[[SYSROOT]]/lib/../libx32"
392 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
393 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
394 // CHECK-32-TO-X32: "-L[[SYSROOT]]/lib"
395 // CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib"
397 // RUN: %clang -### %s -no-pie 2>&1 \
398 // RUN: --target=x86_64-unknown-linux-gnux32 -rtlib=platform --unwindlib=platform -m64 \
399 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
400 // RUN: | FileCheck --check-prefix=CHECK-X32-TO-64 %s
401 // CHECK-X32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
402 // CHECK-X32-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
403 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0"
404 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib/../lib64"
405 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../lib64"
406 // CHECK-X32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
407 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
408 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
409 // CHECK-X32-TO-64: "-L[[SYSROOT]]/lib"
410 // CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib"
412 // RUN: %clang -### %s -no-pie 2>&1 \
413 // RUN: --target=x86_64-unknown-linux-gnux32 -rtlib=platform --unwindlib=platform -m32 \
414 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
415 // RUN: | FileCheck --check-prefix=CHECK-X32-TO-32 %s
416 // CHECK-X32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
417 // CHECK-X32-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0/32{{/|\\\\}}crtbegin.o"
418 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/32"
419 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib/../lib32"
420 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../lib32"
421 // CHECK-X32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
422 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
423 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/lib"
424 // CHECK-X32-TO-32: "-L[[SYSROOT]]/lib"
425 // CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib"
427 // RUN: %clang -### %s -no-pie 2>&1 \
428 // RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform -m32 \
429 // RUN: --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \
430 // RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
431 // RUN: | FileCheck --check-prefix=CHECK-64-TO-32-SYSROOT %s
432 // CHECK-64-TO-32-SYSROOT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
433 // CHECK-64-TO-32-SYSROOT: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/10.2.0/32{{/|\\\\}}crtbegin.o"
434 // CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/10.2.0/32"
435 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib/../lib32"
436 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib/../lib32"
437 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib"
438 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib"
440 // Check that we support unusual patch version formats, including missing that
442 // RUN: %clang -### %s -no-pie 2>&1 \
443 // RUN: --target=i386-unknown-linux -rtlib=platform --unwindlib=platform -m32 \
444 // RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing1/bin \
445 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
446 // RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION1 %s
447 // CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
448 // CHECK-GCC-VERSION1: "{{.*}}/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
450 // Test a simulated installation of libc++ on Linux, both through sysroot and
451 // the installation path of Clang.
452 // RUN: %clangxx -x c++ -### %s -no-pie 2>&1 \
453 // RUN: --target=x86_64-unknown-linux-gnu \
454 // RUN: -stdlib=libc++ \
455 // RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
456 // RUN: -resource-dir=%S/Inputs/resource_dir \
457 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
458 // RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-SYSROOT %s
459 // CHECK-BASIC-LIBCXX-SYSROOT: "-cc1"
460 // CHECK-BASIC-LIBCXX-SYSROOT: "-isysroot" "[[SYSROOT:[^"]+]]"
461 // CHECK-BASIC-LIBCXX-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"
462 // CHECK-BASIC-LIBCXX-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
463 // CHECK-BASIC-LIBCXX-SYSROOT: "--sysroot=[[SYSROOT]]"
464 // RUN: %clang -x c++ -### %s -no-pie 2>&1 \
465 // RUN: --target=x86_64-unknown-linux-gnu \
466 // RUN: -stdlib=libc++ \
467 // RUN: -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \
468 // RUN: -resource-dir=%S/Inputs/resource_dir \
469 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
470 // RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-INSTALL %s
471 // CHECK-BASIC-LIBCXX-INSTALL: "-cc1"
472 // CHECK-BASIC-LIBCXX-INSTALL: "-isysroot" "[[SYSROOT:[^"]+]]"
473 // CHECK-BASIC-LIBCXX-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v1"
474 // CHECK-BASIC-LIBCXX-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
475 // CHECK-BASIC-LIBCXX-INSTALL: "--sysroot=[[SYSROOT]]"
477 // Test that we can use -stdlib=libc++ in a build system even when it
478 // occasionally links C code instead of C++ code.
479 // RUN: %clang -x c -### %s -Werror -no-pie 2>&1 \
480 // RUN: --target=x86_64-unknown-linux-gnu \
481 // RUN: -stdlib=libc++ \
482 // RUN: -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \
483 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
484 // RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-C-LINK %s
485 // CHECK-BASIC-LIBCXX-C-LINK: "-cc1"
486 // CHECK-BASIC-LIBCXX-C-LINK: "-isysroot" "[[SYSROOT:[^"]+]]"
487 // CHECK-BASIC-LIBCXX-C-LINK-NOT: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v1"
488 // CHECK-BASIC-LIBCXX-C-LINK: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
489 // CHECK-BASIC-LIBCXX-C-LINK: "--sysroot=[[SYSROOT]]"
491 // Check multi arch support on Ubuntu 12.04 LTS.
492 // RUN: %clang -### %s -no-pie 2>&1 \
493 // RUN: --target=arm-unknown-linux-gnueabihf -rtlib=platform --unwindlib=platform \
494 // RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
495 // RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM-HF %s
497 // Check that musleabihf is treated as a hardfloat config, with respect to
498 // multiarch directories.
500 // RUN: %clang -### %s -no-pie 2>&1 \
501 // RUN: --target=arm-unknown-linux-musleabihf -rtlib=platform --unwindlib=platform \
502 // RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
503 // RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM-HF %s
504 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
505 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/arm-linux-gnueabihf{{/|\\\\}}crt1.o"
506 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/arm-linux-gnueabihf{{/|\\\\}}crti.o"
507 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3{{/|\\\\}}crtbegin.o"
508 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3"
509 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/lib/arm-linux-gnueabihf"
510 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabihf"
511 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3{{/|\\\\}}crtend.o"
512 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/arm-linux-gnueabihf{{/|\\\\}}crtn.o"
514 // Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabihf.
515 // RUN: %clang -### %s -no-pie 2>&1 \
516 // RUN: --target=arm-linux-gnueabihf -rtlib=platform --unwindlib=platform \
517 // RUN: --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
518 // RUN: | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM-HF %s
519 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
520 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-dynamic-linker" "{{(/usr/arm--linux-gnueabihf)?}}/lib/ld-linux-armhf.so.3"
521 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crt1.o"
522 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crti.o"
523 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtbegin.o"
524 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8"
525 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib"
526 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/lib/../lib"
527 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/../lib"
528 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib"
529 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtend.o"
530 // CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crtn.o"
532 // Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabi.
533 // RUN: %clang -### %s -no-pie 2>&1 \
534 // RUN: --target=arm-linux-gnueabi -rtlib=platform --unwindlib=platform \
535 // RUN: --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
536 // RUN: | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM %s
537 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
538 // CHECK-X86-64-UBUNTU-13-10-ARM: "-dynamic-linker" "{{(/usr/arm--linux-gnueabi)?}}/lib/ld-linux.so.3"
539 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crt1.o"
540 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crti.o"
541 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtbegin.o"
542 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7"
543 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib"
544 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/lib/../lib"
545 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/../lib"
546 // CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib"
547 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtend.o"
548 // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crtn.o"
550 // Check Ubuntu 14.04 on powerpc64le.
551 // RUN: %clang -### %s -no-pie 2>&1 \
552 // RUN: --target=powerpc64le-unknown-linux-gnu -rtlib=platform --unwindlib=platform \
553 // RUN: --sysroot=%S/Inputs/ubuntu_14.04_multiarch_tree \
554 // RUN: | FileCheck --check-prefix=CHECK-UBUNTU-14-04-PPC64LE %s
555 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
556 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/powerpc64le-linux-gnu{{/|\\\\}}crt1.o"
557 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/powerpc64le-linux-gnu{{/|\\\\}}crti.o"
558 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8{{/|\\\\}}crtbegin.o"
559 // CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8"
560 // CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/lib/powerpc64le-linux-gnu"
561 // CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/powerpc64le-linux-gnu"
562 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8{{/|\\\\}}crtend.o"
563 // CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/powerpc64le-linux-gnu{{/|\\\\}}crtn.o"
565 // Check Ubuntu 14.04 on x32.
566 // "/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32/crtn.o"
567 // RUN: %clang -### %s -no-pie 2>&1 \
568 // RUN: --target=x86_64-unknown-linux-gnux32 -rtlib=platform --unwindlib=platform \
569 // RUN: --sysroot=%S/Inputs/ubuntu_14.04_multiarch_tree \
570 // RUN: | FileCheck --check-prefix=CHECK-UBUNTU-14-04-X32 %s
571 // CHECK-UBUNTU-14-04-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
572 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32{{/|\\\\}}crt1.o"
573 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32{{/|\\\\}}crti.o"
574 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/x32{{/|\\\\}}crtbegin.o"
575 // CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/x32"
576 // CHECK-UBUNTU-14-04-X32-SAME: {{^}} "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32"
577 // CHECK-UBUNTU-14-04-X32-SAME: {{^}} "-L[[SYSROOT]]/lib/../libx32"
578 // CHECK-UBUNTU-14-04-X32-SAME: {{^}} "-L[[SYSROOT]]/usr/lib/../libx32"
579 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/x32{{/|\\\\}}crtend.o"
580 // CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32{{/|\\\\}}crtn.o"
582 // Check fedora 18 on arm.
583 // RUN: %clang -### %s -no-pie 2>&1 \
584 // RUN: --target=armv7-unknown-linux-gnueabihf -rtlib=platform --unwindlib=platform \
585 // RUN: --sysroot=%S/Inputs/fedora_18_tree \
586 // RUN: | FileCheck --check-prefix=CHECK-FEDORA-18-ARM-HF %s
587 // CHECK-FEDORA-18-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
588 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crt1.o"
589 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crti.o"
590 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtbegin.o"
591 // CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2"
592 // CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib"
593 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtend.o"
594 // CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crtn.o"
596 // Check Fedora 21 on AArch64.
597 // RUN: %clang -### %s -no-pie 2>&1 \
598 // RUN: --target=arm64-unknown-linux-gnu -rtlib=platform --unwindlib=platform \
599 // RUN: --sysroot=%S/Inputs/fedora_21_tree \
600 // RUN: | FileCheck --check-prefix=CHECK-FEDORA-21-AARCH64 %s
601 // RUN: %clang -### %s -no-pie 2>&1 \
602 // RUN: --target=aarch64-unknown-linux-gnu -rtlib=platform --unwindlib=platform \
603 // RUN: --sysroot=%S/Inputs/fedora_21_tree \
604 // RUN: | FileCheck --check-prefix=CHECK-FEDORA-21-AARCH64 %s
605 // CHECK-FEDORA-21-AARCH64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
606 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crt1.o"
607 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crti.o"
608 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|\\\\}}crtbegin.o"
609 // CHECK-FEDORA-21-AARCH64: "-L[[SYSROOT]]/usr/lib/gcc/aarch64-redhat-linux/4.9.0"
610 // CHECK-FEDORA-21-AARCH64: "-L[[SYSROOT]]/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64"
611 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|\\\\}}crtend.o"
612 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crtn.o"
614 // Check Fedora 31 on riscv64.
615 // RUN: %clang -### %s -no-pie 2>&1 \
616 // RUN: --target=riscv64-redhat-linux -rtlib=platform --unwindlib=platform \
617 // RUN: --sysroot=%S/Inputs/fedora_31_riscv64_tree \
618 // RUN: | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
619 // CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
620 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|\\\\}}crt1.o"
621 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crti.o"
622 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtbegin.o"
623 // CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
624 // CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
625 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtend.o"
626 // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtn.o"
628 // RUN: %clang -### %s -no-pie 2>&1 \
629 // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform --unwindlib=platform \
630 // RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
631 // RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM %s
632 // CHECK-UBUNTU-12-04-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
633 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/arm-linux-gnueabi{{/|\\\\}}crt1.o"
634 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/arm-linux-gnueabi{{/|\\\\}}crti.o"
635 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1{{/|\\\\}}crtbegin.o"
636 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1"
637 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/lib/arm-linux-gnueabi"
638 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabi"
639 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1{{/|\\\\}}crtend.o"
640 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/arm-linux-gnueabi{{/|\\\\}}crtn.o"
642 // Test the setup that shipped in SUSE 10.3 on ppc64.
643 // RUN: %clang -### %s -no-pie 2>&1 \
644 // RUN: --target=powerpc64-suse-linux -rtlib=platform --unwindlib=platform \
645 // RUN: --sysroot=%S/Inputs/suse_10.3_ppc64_tree \
646 // RUN: | FileCheck --check-prefix=CHECK-SUSE-10-3-PPC64 %s
647 // CHECK-SUSE-10-3-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
648 // CHECK-SUSE-10-3-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64{{/|\\\\}}crtbegin.o"
649 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64"
650 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/../../../../lib64"
651 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
652 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
654 // Check openSuse Leap 42.2 on AArch64
655 // RUN: %clang -### %s -no-pie 2>&1 \
656 // RUN: --target=arm64-unknown-linux-gnu -rtlib=platform --unwindlib=platform \
657 // RUN: --sysroot=%S/Inputs/opensuse_42.2_aarch64_tree \
658 // RUN: | FileCheck --check-prefix=CHECK-OPENSUSE-42-2-AARCH64 %s
659 // RUN: %clang -### %s -no-pie 2>&1 \
660 // RUN: --target=aarch64-unknown-linux-gnu -rtlib=platform --unwindlib=platform \
661 // RUN: --sysroot=%S/Inputs/opensuse_42.2_aarch64_tree \
662 // RUN: | FileCheck --check-prefix=CHECK-OPENSUSE-42-2-AARCH64 %s
663 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
664 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|\\\\}}crt1.o"
665 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|\\\\}}crti.o"
666 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8{{/|\\\\}}crtbegin.o"
667 // CHECK-OPENSUSE-42-2-AARCH64: "-L[[SYSROOT]]/usr/lib64/gcc/aarch64-suse-linux/4.8"
668 // CHECK-OPENSUSE-42-2-AARCH64: "-L[[SYSROOT]]/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64"
669 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8{{/|\\\\}}crtend.o"
670 // CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|\\\\}}crtn.o"
672 // Check openSUSE Tumbleweed on armv6hl
673 // RUN: %clang -### %s -no-pie 2>&1 \
674 // RUN: --target=armv6hl-suse-linux-gnueabi -rtlib=platform --unwindlib=platform \
675 // RUN: --sysroot=%S/Inputs/opensuse_tumbleweed_armv6hl_tree \
676 // RUN: | FileCheck --check-prefix=CHECK-OPENSUSE-TW-ARMV6HL %s
677 // RUN: %clang -### %s -no-pie 2>&1 \
678 // RUN: --target=armv6hl-suse-linux-gnueabi -rtlib=platform --unwindlib=platform \
679 // RUN: --sysroot=%S/Inputs/opensuse_tumbleweed_armv6hl_tree \
680 // RUN: | FileCheck --check-prefix=CHECK-OPENSUSE-TW-ARMV6HL %s
681 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
682 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crt1.o"
683 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crti.o"
684 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5{{/|\\\\}}crtbegin.o"
685 // CHECK-OPENSUSE-TW-ARMV6HL: "-L[[SYSROOT]]/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5"
686 // CHECK-OPENSUSE-TW-ARMV6HL: "-L[[SYSROOT]]/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/../../../../lib"
687 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5{{/|\\\\}}crtend.o"
688 // CHECK-OPENSUSE-TW-ARMV6HL: "{{.*}}/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crtn.o"
690 // Check openSUSE Tumbleweed on armv7hl
691 // RUN: %clang -### %s -no-pie 2>&1 \
692 // RUN: --target=armv7hl-suse-linux-gnueabi -rtlib=platform --unwindlib=platform \
693 // RUN: --sysroot=%S/Inputs/opensuse_tumbleweed_armv7hl_tree \
694 // RUN: | FileCheck --check-prefix=CHECK-OPENSUSE-TW-ARMV7HL %s
695 // RUN: %clang -### %s -no-pie 2>&1 \
696 // RUN: --target=armv7hl-suse-linux-gnueabi -rtlib=platform --unwindlib=platform \
697 // RUN: --sysroot=%S/Inputs/opensuse_tumbleweed_armv7hl_tree \
698 // RUN: | FileCheck --check-prefix=CHECK-OPENSUSE-TW-ARMV7HL %s
699 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
700 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crt1.o"
701 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crti.o"
702 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5{{/|\\\\}}crtbegin.o"
703 // CHECK-OPENSUSE-TW-ARMV7HL: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5"
704 // CHECK-OPENSUSE-TW-ARMV7HL: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/../../../../lib"
705 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5{{/|\\\\}}crtend.o"
706 // CHECK-OPENSUSE-TW-ARMV7HL: "{{.*}}/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/../../../../lib{{/|\\\\}}crtn.o"
708 // Check openSUSE Tumbleweed on riscv64
709 // RUN: %clang -### %s -no-pie 2>&1 \
710 // RUN: --target=riscv64-suse-linux -rtlib=platform --unwindlib=platform \
711 // RUN: --sysroot=%S/Inputs/opensuse_tumbleweed_riscv64_tree \
712 // RUN: | FileCheck --check-prefix=CHECK-OPENSUSE-TW-RISCV64 %s
713 // RUN: %clang -### %s -no-pie 2>&1 \
714 // RUN: --target=riscv64-suse-linux -rtlib=platform --unwindlib=platform \
715 // RUN: --sysroot=%S/Inputs/opensuse_tumbleweed_riscv64_tree \
716 // RUN: | FileCheck --check-prefix=CHECK-OPENSUSE-TW-RISCV64 %s
717 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
718 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64{{/|\\\\}}crt1.o"
719 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64{{/|\\\\}}crti.o"
720 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9{{/|\\\\}}crtbegin.o"
721 // CHECK-OPENSUSE-TW-RISCV64: "-L[[SYSROOT]]/usr/lib64/gcc/riscv64-suse-linux/9"
722 // CHECK-OPENSUSE-TW-RISCV64: "-L[[SYSROOT]]/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64"
723 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9{{/|\\\\}}crtend.o"
724 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64{{/|\\\\}}crtn.o"
726 // Check openSUSE Tumbleweed on ppc
727 // RUN: %clang -### %s -no-pie 2>&1 \
728 // RUN: --target=powerpc-unknown-linux-gnu -rtlib=platform --unwindlib=platform \
729 // RUN: --sysroot=%S/Inputs/opensuse_tumbleweed_ppc_tree \
730 // RUN: | FileCheck --check-prefix=CHECK-OPENSUSE-TW-PPC %s
731 // CHECK-OPENSUSE-TW-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
732 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib{{/|\\\\}}crt1.o"
733 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib{{/|\\\\}}crti.o"
734 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9{{/|\\\\}}crtbegin.o"
735 // CHECK-OPENSUSE-TW-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/9"
736 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9{{/|\\\\}}crtend.o"
737 // CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/crtn.o"
739 // Check dynamic-linker for different archs
740 // RUN: %clang -### %s -no-pie 2>&1 \
741 // RUN: --target=arm-linux-gnueabi \
742 // RUN: | FileCheck --check-prefix=CHECK-ARM %s
743 // CHECK-ARM: "{{.*}}ld{{(.exe)?}}"
744 // CHECK-ARM: "-m" "armelf_linux_eabi"
745 // CHECK-ARM: "-dynamic-linker" "{{.*}}/lib/ld-linux.so.3"
747 // RUN: %clang -### %s -no-pie 2>&1 \
748 // RUN: --target=arm-linux-gnueabi -mfloat-abi=hard \
749 // RUN: | FileCheck --check-prefix=CHECK-ARM-ABIHF %s
750 // CHECK-ARM-ABIHF: "{{.*}}ld{{(.exe)?}}"
751 // CHECK-ARM-ABIHF: "-m" "armelf_linux_eabi"
752 // CHECK-ARM-ABIHF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3"
754 // RUN: %clang -### %s -no-pie 2>&1 \
755 // RUN: --target=arm-linux-gnueabihf \
756 // RUN: | FileCheck --check-prefix=CHECK-ARM-HF %s
757 // CHECK-ARM-HF: "{{.*}}ld{{(.exe)?}}"
758 // CHECK-ARM-HF: "-m" "armelf_linux_eabi"
759 // CHECK-ARM-HF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3"
761 // RUN: %clang -### %s -no-pie 2>&1 \
762 // RUN: --target=loongarch64-linux-gnu \
763 // RUN: | FileCheck --check-prefix=CHECK-LOONGARCH-LP64D %s
764 // RUN: %clang -### %s -no-pie 2>&1 \
765 // RUN: --target=loongarch64-linux-gnuf64 \
766 // RUN: | FileCheck --check-prefix=CHECK-LOONGARCH-LP64D %s
767 // CHECK-LOONGARCH-LP64D: "{{.*}}ld{{(.exe)?}}"
768 // CHECK-LOONGARCH-LP64D: "-m" "elf64loongarch"
769 // CHECK-LOONGARCH-LP64D: "-dynamic-linker" "{{.*}}/lib64/ld-linux-loongarch-lp64d.so.1"
771 // RUN: %clang -### %s -no-pie 2>&1 \
772 // RUN: --target=loongarch64-linux-gnuf32 \
773 // RUN: | FileCheck --check-prefix=CHECK-LOONGARCH-LP64F %s
774 // CHECK-LOONGARCH-LP64F: "{{.*}}ld{{(.exe)?}}"
775 // CHECK-LOONGARCH-LP64F: "-m" "elf64loongarch"
776 // CHECK-LOONGARCH-LP64F: "-dynamic-linker" "{{.*}}/lib64/ld-linux-loongarch-lp64f.so.1"
778 // RUN: %clang -### %s -no-pie 2>&1 \
779 // RUN: --target=loongarch64-linux-gnusf \
780 // RUN: | FileCheck --check-prefix=CHECK-LOONGARCH-LP64S %s
781 // CHECK-LOONGARCH-LP64S: "{{.*}}ld{{(.exe)?}}"
782 // CHECK-LOONGARCH-LP64S: "-m" "elf64loongarch"
783 // CHECK-LOONGARCH-LP64S: "-dynamic-linker" "{{.*}}/lib64/ld-linux-loongarch-lp64s.so.1"
785 // RUN: %clang -### %s -no-pie 2>&1 \
786 // RUN: --target=powerpc64-linux-gnu \
787 // RUN: | FileCheck --check-prefix=CHECK-PPC64 %s
788 // CHECK-PPC64: "{{.*}}ld{{(.exe)?}}"
789 // CHECK-PPC64: "-m" "elf64ppc"
790 // CHECK-PPC64: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.1"
792 // RUN: %clang -### %s -no-pie 2>&1 \
793 // RUN: --target=powerpc64-linux-gnu -mabi=elfv1 \
794 // RUN: | FileCheck --check-prefix=CHECK-PPC64-ELFv1 %s
795 // CHECK-PPC64-ELFv1: "{{.*}}ld{{(.exe)?}}"
796 // CHECK-PPC64-ELFv1: "-m" "elf64ppc"
797 // CHECK-PPC64-ELFv1: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.1"
799 // RUN: %clang -### %s -no-pie 2>&1 \
800 // RUN: --target=powerpc64-linux-gnu -mabi=elfv2 \
801 // RUN: | FileCheck --check-prefix=CHECK-PPC64-ELFv2 %s
802 // CHECK-PPC64-ELFv2: "{{.*}}ld{{(.exe)?}}"
803 // CHECK-PPC64-ELFv2: "-m" "elf64ppc"
804 // CHECK-PPC64-ELFv2: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.2"
806 // RUN: %clang -### %s -no-pie 2>&1 \
807 // RUN: --target=powerpc64le-linux-gnu \
808 // RUN: | FileCheck --check-prefix=CHECK-PPC64LE %s
809 // CHECK-PPC64LE: "{{.*}}ld{{(.exe)?}}"
810 // CHECK-PPC64LE: "-m" "elf64lppc"
811 // CHECK-PPC64LE: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.2"
813 // RUN: %clang -### %s -no-pie 2>&1 \
814 // RUN: --target=powerpc64le-linux-gnu -mabi=elfv1 \
815 // RUN: | FileCheck --check-prefix=CHECK-PPC64LE-ELFv1 %s
816 // CHECK-PPC64LE-ELFv1: "{{.*}}ld{{(.exe)?}}"
817 // CHECK-PPC64LE-ELFv1: "-m" "elf64lppc"
818 // CHECK-PPC64LE-ELFv1: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.1"
820 // RUN: %clang -### %s -no-pie 2>&1 \
821 // RUN: --target=powerpc64le-linux-gnu -mabi=elfv2 \
822 // RUN: | FileCheck --check-prefix=CHECK-PPC64LE-ELFv2 %s
823 // CHECK-PPC64LE-ELFv2: "{{.*}}ld{{(.exe)?}}"
824 // CHECK-PPC64LE-ELFv2: "-m" "elf64lppc"
825 // CHECK-PPC64LE-ELFv2: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.2"
827 // Check that we do not pass --hash-style=gnu or --hash-style=both to
828 // hexagon linux linker
829 // RUN: %clang -### %s -no-pie 2>&1 \
830 // RUN: --target=hexagon-linux-gnu \
831 // RUN: | FileCheck --check-prefix=CHECK-HEXAGON %s
832 // CHECK-HEXAGON: "{{.*}}{{hexagon-link|ld}}{{(.exe)?}}"
833 // CHECK-HEXAGON-NOT: "--hash-style={{gnu|both}}"
835 // Check that we do not pass --hash-style=gnu and --hash-style=both to linker
836 // and provide correct path to the dynamic linker and emulation mode when build
837 // for MIPS platforms.
838 // RUN: %clang -### %s -no-pie 2>&1 \
839 // RUN: --target=mips-linux-gnu \
840 // RUN: | FileCheck --check-prefix=CHECK-MIPS %s
841 // CHECK-MIPS: "{{.*}}ld{{(.exe)?}}"
842 // CHECK-MIPS: "-m" "elf32btsmip"
843 // CHECK-MIPS: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
844 // CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
846 // RUN: %clang -### %s -no-pie 2>&1 \
847 // RUN: --target=mipsel-linux-gnu \
848 // RUN: | FileCheck --check-prefix=CHECK-MIPSEL %s
849 // CHECK-MIPSEL: "{{.*}}ld{{(.exe)?}}"
850 // CHECK-MIPSEL: "-m" "elf32ltsmip"
851 // CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
852 // CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
854 // RUN: %clang -### %s -no-pie 2>&1 --target=mipsel-linux-gnu -mnan=2008 \
855 // RUN: | FileCheck --check-prefix=CHECK-MIPSEL-NAN2008 %s
856 // CHECK-MIPSEL-NAN2008: "{{.*}}ld{{(.exe)?}}"
857 // CHECK-MIPSEL-NAN2008: "-m" "elf32ltsmip"
858 // CHECK-MIPSEL-NAN2008: "-dynamic-linker" "{{.*}}/lib/ld-linux-mipsn8.so.1"
859 // CHECK-MIPSEL-NAN2008-NOT: "--hash-style={{gnu|both}}"
861 // RUN: %clang -### %s -no-pie 2>&1 --target=mipsel-linux-gnu -mcpu=mips32r6 \
862 // RUN: | FileCheck --check-prefix=CHECK-MIPS32R6EL %s
863 // CHECK-MIPS32R6EL: "{{.*}}ld{{(.exe)?}}"
864 // CHECK-MIPS32R6EL: "-m" "elf32ltsmip"
865 // CHECK-MIPS32R6EL: "-dynamic-linker" "{{.*}}/lib/ld-linux-mipsn8.so.1"
866 // CHECK-MIPS32R6EL-NOT: "--hash-style={{gnu|both}}"
868 // RUN: %clang -### %s -no-pie 2>&1 \
869 // RUN: --target=mips64-linux-gnu \
870 // RUN: | FileCheck --check-prefix=CHECK-MIPS64 %s
871 // CHECK-MIPS64: "{{.*}}ld{{(.exe)?}}"
872 // CHECK-MIPS64: "-m" "elf64btsmip"
873 // CHECK-MIPS64: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1"
874 // CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
876 // RUN: %clang -### %s -no-pie 2>&1 \
877 // RUN: --target=mips64el-linux-gnu \
878 // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL %s
879 // CHECK-MIPS64EL: "{{.*}}ld{{(.exe)?}}"
880 // CHECK-MIPS64EL: "-m" "elf64ltsmip"
881 // CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1"
882 // CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
884 // RUN: %clang -### %s -no-pie 2>&1 --target=mips64el-linux-gnu -mnan=2008 \
885 // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-NAN2008 %s
886 // CHECK-MIPS64EL-NAN2008: "{{.*}}ld{{(.exe)?}}"
887 // CHECK-MIPS64EL-NAN2008: "-m" "elf64ltsmip"
888 // CHECK-MIPS64EL-NAN2008: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld-linux-mipsn8.so.1"
889 // CHECK-MIPS64EL-NAN2008-NOT: "--hash-style={{gnu|both}}"
891 // RUN: %clang -### %s -no-pie 2>&1 --target=mips64el-linux-gnu -mcpu=mips64r6 \
892 // RUN: | FileCheck --check-prefix=CHECK-MIPS64R6EL %s
893 // CHECK-MIPS64R6EL: "{{.*}}ld{{(.exe)?}}"
894 // CHECK-MIPS64R6EL: "-m" "elf64ltsmip"
895 // CHECK-MIPS64R6EL: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld-linux-mipsn8.so.1"
896 // CHECK-MIPS64R6EL-NOT: "--hash-style={{gnu|both}}"
898 // RUN: %clang -### %s -no-pie 2>&1 \
899 // RUN: --target=mips64-linux-gnu -mabi=n32 \
900 // RUN: | FileCheck --check-prefix=CHECK-MIPS64-N32 %s
901 // CHECK-MIPS64-N32: "{{.*}}ld{{(.exe)?}}"
902 // CHECK-MIPS64-N32: "-m" "elf32btsmipn32"
903 // CHECK-MIPS64-N32: "-dynamic-linker" "{{.*}}/lib{{(32)?}}/ld.so.1"
904 // CHECK-MIPS64-N32-NOT: "--hash-style={{gnu|both}}"
906 // RUN: %clang -### %s -no-pie 2>&1 \
907 // RUN: --target=mips64el-linux-gnu -mabi=n32 \
908 // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-N32 %s
909 // CHECK-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}"
910 // CHECK-MIPS64EL-N32: "-m" "elf32ltsmipn32"
911 // CHECK-MIPS64EL-N32: "-dynamic-linker" "{{.*}}/lib{{(32)?}}/ld.so.1"
912 // CHECK-MIPS64EL-N32-NOT: "--hash-style={{gnu|both}}"
914 // RUN: %clang -### %s -no-pie 2>&1 --target=mips64el-linux-gnu -mabi=n32 \
915 // RUN: -mnan=2008 | FileCheck --check-prefix=CHECK-MIPS64EL-N32-NAN2008 %s
916 // CHECK-MIPS64EL-N32-NAN2008: "{{.*}}ld{{(.exe)?}}"
917 // CHECK-MIPS64EL-N32-NAN2008: "-m" "elf32ltsmipn32"
918 // CHECK-MIPS64EL-N32-NAN2008: "-dynamic-linker" "{{.*}}/lib{{(32)?}}/ld-linux-mipsn8.so.1"
919 // CHECK-MIPS64EL-N32-NAN2008-NOT: "--hash-style={{gnu|both}}"
921 // RUN: %clang -### %s -no-pie 2>&1 --target=mips64el-redhat-linux \
922 // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-REDHAT %s
923 // CHECK-MIPS64EL-REDHAT: "{{.*}}ld{{(.exe)?}}"
924 // CHECK-MIPS64EL-REDHAT: "-m" "elf64ltsmip"
925 // CHECK-MIPS64EL-REDHAT: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1"
926 // CHECK-MIPS64EL-REDHAT-NOT: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld-musl-mipsel.so.1"
927 // CHECK-MIPS64EL-REDHAT-NOT: "--hash-style={{gnu|both}}"
929 // Check that we pass --hash-style=both for pre-M Android versions and
930 // --hash-style=gnu for newer Android versions.
931 // RUN: %clang -### %s -no-pie 2>&1 \
932 // RUN: --target=armv7-linux-android21 \
933 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-HASH-STYLE-L %s
934 // CHECK-ANDROID-HASH-STYLE-L: "{{.*}}ld{{(.exe)?}}"
935 // CHECK-ANDROID-HASH-STYLE-L: "--hash-style=both"
937 // RUN: %clang -### %s -no-pie 2>&1 \
938 // RUN: --target=armv7-linux-android23 \
939 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-HASH-STYLE-M %s
940 // CHECK-ANDROID-HASH-STYLE-M: "{{.*}}ld{{(.exe)?}}"
941 // CHECK-ANDROID-HASH-STYLE-M: "--hash-style=gnu"
943 // RUN: %clang -### %s -no-pie 2>&1 --target=mips64-linux-gnuabin32 \
944 // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-GNUABIN32 %s
945 // CHECK-MIPS64EL-GNUABIN32: "{{.*}}ld{{(.exe)?}}"
946 // CHECK-MIPS64EL-GNUABIN32: "-m" "elf32btsmipn32"
947 // CHECK-MIPS64EL-GNUABIN32: "-dynamic-linker" "{{.*}}/lib{{(32)?}}/ld.so.1"
948 // CHECK-MIPS64EL-GNUABIN32-NOT: "--hash-style={{gnu|both}}"
950 // RUN: %clang -### %s -no-pie 2>&1 --target=mips64-linux-gnuabi64 \
951 // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-GNUABI64 %s
952 // CHECK-MIPS64EL-GNUABI64: "{{.*}}ld{{(.exe)?}}"
953 // CHECK-MIPS64EL-GNUABI64: "-m" "elf64btsmip"
954 // CHECK-MIPS64EL-GNUABI64: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1"
955 // CHECK-MIPS64EL-GNUABI64-NOT: "--hash-style={{gnu|both}}"
957 // RUN: %clang -### %s -no-pie 2>&1 \
958 // RUN: --target=sparc-unknown-linux-gnu \
959 // RUN: | FileCheck --check-prefix=CHECK-SPARCV8 %s
960 // CHECK-SPARCV8: "{{.*}}ld{{(.exe)?}}"
961 // CHECK-SPARCV8: "-m" "elf32_sparc"
962 // CHECK-SPARCV8: "-dynamic-linker" "{{(/usr/sparc-unknown-linux-gnu)?}}/lib/ld-linux.so.2"
963 // CHECK-SPARCV8: "--push-state" "--as-needed" "-latomic" "--pop-state"
965 // RUN: %clang -### %s -no-pie 2>&1 \
966 // RUN: --target=sparcel-unknown-linux-gnu \
967 // RUN: | FileCheck --check-prefix=CHECK-SPARCV8EL %s
968 // CHECK-SPARCV8EL: "{{.*}}ld{{(.exe)?}}"
969 // CHECK-SPARCV8EL: "-m" "elf32_sparc"
970 // CHECK-SPARCV8EL: "-dynamic-linker" "{{(/usr/sparcel-unknown-linux-gnu)?}}/lib/ld-linux.so.2"
972 // RUN: %clang -### %s -no-pie 2>&1 \
973 // RUN: --target=sparcv9-unknown-linux-gnu \
974 // RUN: | FileCheck --check-prefix=CHECK-SPARCV9 %s
975 // CHECK-SPARCV9: "{{.*}}ld{{(.exe)?}}"
976 // CHECK-SPARCV9: "-m" "elf64_sparc"
977 // CHECK-SPARCV9: "-dynamic-linker" "{{(/usr/sparcv9-unknown-linux-gnu)?}}/lib{{(64)?}}/ld-linux.so.2"
978 // CHECK-SPARCV9-NOT: "-latomic"
980 // Test linker invocation on Android.
981 // RUN: %clang -### %s -no-pie 2>&1 \
982 // RUN: --target=arm-linux-androideabi -rtlib=platform --unwindlib=platform \
983 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
984 // RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
985 // RUN: %clang -### %s -no-pie 2>&1 \
986 // RUN: --target=arm-linux-android -rtlib=platform --unwindlib=platform \
987 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
988 // RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
989 // RUN: %clang -### %s -no-pie 2>&1 \
990 // RUN: --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
991 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
992 // RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
993 // RUN: %clang -### %s -no-pie 2>&1 \
994 // RUN: --target=arm64-linux-android -rtlib=platform --unwindlib=platform \
995 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
996 // RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
997 // RUN: %clang -### %s -no-pie 2>&1 \
998 // RUN: --target=i686-linux-android -rtlib=platform --unwindlib=platform \
999 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1000 // RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
1001 // RUN: %clang -### %s -no-pie 2>&1 \
1002 // RUN: --target=x86_64-linux-android -rtlib=platform --unwindlib=platform \
1003 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1004 // RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
1005 // CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1006 // CHECK-ANDROID: "-z" "now"
1007 // CHECK-ANDROID: "-z" "relro"
1008 // CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
1009 // CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib"
1010 // CHECK-ANDROID-NOT: "-lgcc_s"
1011 // CHECK-ANDROID-NOT: "-lgcc"
1012 // CHECK-ANDROID: "-l:libunwind.a"
1013 // CHECK-ANDROID: "-ldl"
1014 // CHECK-ANDROID-NOT: "-lgcc_s"
1015 // CHECK-ANDROID-NOT: "-lgcc"
1016 // CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtend_android.o"
1017 // RUN: %clang -### %s -no-pie 2>&1 \
1018 // RUN: --target=arm-linux-androideabi -rtlib=platform --unwindlib=platform \
1019 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1021 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1022 // RUN: %clang -### %s -no-pie 2>&1 \
1023 // RUN: --target=arm-linux-android -rtlib=platform --unwindlib=platform \
1024 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1026 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1027 // RUN: %clang -### %s -no-pie 2>&1 \
1028 // RUN: --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
1029 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1031 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1032 // RUN: %clang -### %s -no-pie 2>&1 \
1033 // RUN: --target=arm64-linux-android -rtlib=platform --unwindlib=platform \
1034 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1036 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1037 // RUN: %clang -### %s -no-pie 2>&1 \
1038 // RUN: --target=i686-linux-android -rtlib=platform --unwindlib=platform \
1039 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1041 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1042 // RUN: %clang -### %s -no-pie 2>&1 \
1043 // RUN: --target=x86_64-linux-android -rtlib=platform --unwindlib=platform \
1044 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1046 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
1047 // CHECK-ANDROID-SO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1048 // CHECK-ANDROID-SO-NOT: "-Bsymbolic"
1049 // CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtbegin_so.o"
1050 // CHECK-ANDROID-SO: "-L[[SYSROOT]]/usr/lib"
1051 // CHECK-ANDROID-SO-NOT: "-lgcc_s"
1052 // CHECK-ANDROID-SO-NOT: "-lgcc"
1053 // CHECK-ANDROID-SO: "-l:libunwind.a"
1054 // CHECK-ANDROID-SO: "-ldl"
1055 // CHECK-ANDROID-SO-NOT: "-lgcc_s"
1056 // CHECK-ANDROID-SO-NOT: "-lgcc"
1057 // CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtend_so.o"
1058 // RUN: %clang -### %s -no-pie 2>&1 \
1059 // RUN: --target=arm-linux-androideabi -rtlib=platform --unwindlib=platform \
1060 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1062 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1063 // RUN: %clang -### %s -no-pie 2>&1 \
1064 // RUN: --target=arm-linux-android -rtlib=platform --unwindlib=platform \
1065 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1067 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1068 // RUN: %clang -### %s -no-pie 2>&1 \
1069 // RUN: --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
1070 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1072 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1073 // RUN: %clang -### %s -no-pie 2>&1 \
1074 // RUN: --target=arm64-linux-android -rtlib=platform --unwindlib=platform \
1075 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1077 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1078 // RUN: %clang -### %s -no-pie 2>&1 \
1079 // RUN: --target=i686-linux-android -rtlib=platform --unwindlib=platform \
1080 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1082 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1083 // RUN: %clang -### %s -no-pie 2>&1 \
1084 // RUN: --target=x86_64-linux-android -rtlib=platform --unwindlib=platform \
1085 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1087 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1088 // CHECK-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1089 // CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtbegin_static.o"
1090 // CHECK-ANDROID-STATIC: "-L[[SYSROOT]]/usr/lib"
1091 // CHECK-ANDROID-STATIC-NOT: "-lgcc_eh"
1092 // CHECK-ANDROID-STATIC-NOT: "-lgcc"
1093 // CHECK-ANDROID-STATIC: "-l:libunwind.a"
1094 // CHECK-ANDROID-STATIC-NOT: "-ldl"
1095 // CHECK-ANDROID-STATIC-NOT: "-lgcc_eh"
1096 // CHECK-ANDROID-STATIC-NOT: "-lgcc"
1097 // CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtend_android.o"
1098 // RUN: %clang -### %s -no-pie 2>&1 \
1099 // RUN: --target=arm-linux-androideabi -rtlib=platform --unwindlib=platform \
1100 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1102 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1103 // RUN: %clang -### %s -no-pie 2>&1 \
1104 // RUN: --target=arm-linux-android -rtlib=platform --unwindlib=platform \
1105 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1107 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1108 // RUN: %clang -### %s -no-pie 2>&1 \
1109 // RUN: --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
1110 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1112 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1113 // RUN: %clang -### %s -no-pie 2>&1 \
1114 // RUN: --target=arm64-linux-android -rtlib=platform --unwindlib=platform \
1115 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1117 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1118 // RUN: %clang -### %s -no-pie 2>&1 \
1119 // RUN: --target=i686-linux-android -rtlib=platform --unwindlib=platform \
1120 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1122 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1123 // RUN: %clang -### %s -no-pie 2>&1 \
1124 // RUN: --target=x86_64-linux-android -rtlib=platform --unwindlib=platform \
1125 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1127 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1128 // CHECK-ANDROID-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1129 // CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
1130 // CHECK-ANDROID-PIE: "-L[[SYSROOT]]/usr/lib"
1131 // CHECK-ANDROID-PIE-NOT: "-lgcc_s"
1132 // CHECK-ANDROID-PIE-NOT: "-lgcc"
1133 // CHECK-ANDROID-PIE: "-l:libunwind.a"
1134 // CHECK-ANDROID-PIE-NOT: "-lgcc_s"
1135 // CHECK-ANDROID-PIE-NOT: "-lgcc"
1136 // CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtend_android.o"
1137 // RUN: %clang -### %s -no-pie 2>&1 \
1138 // RUN: --target=arm-linux-androideabi \
1139 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1140 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1141 // RUN: %clang -### %s -no-pie 2>&1 \
1142 // RUN: --target=arm-linux-android \
1143 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1144 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1145 // RUN: %clang -### %s -no-pie 2>&1 \
1146 // RUN: --target=aarch64-linux-android \
1147 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1148 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1149 // RUN: %clang -### %s -no-pie 2>&1 \
1150 // RUN: --target=arm64-linux-android \
1151 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1152 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1153 // RUN: %clang -### %s -no-pie 2>&1 \
1154 // RUN: --target=i686-linux-android \
1155 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1156 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1157 // RUN: %clang -### %s -no-pie 2>&1 \
1158 // RUN: --target=x86_64-linux-android \
1159 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1160 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1161 // CHECK-ANDROID-32: "-dynamic-linker" "/system/bin/linker"
1162 // CHECK-ANDROID-64: "-dynamic-linker" "/system/bin/linker64"
1164 // Test that Android 14 and newer use linker_hwasan64 for hwasan builds
1165 // RUN: %clang -### %s -no-pie 2>&1 \
1166 // RUN: -fsanitize=hwaddress \
1167 // RUN: --target=x86_64-linux-android33 \
1168 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1169 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-OLD %s
1170 // RUN: %clang -### %s -no-pie 2>&1 \
1171 // RUN: -fsanitize=hwaddress \
1172 // RUN: --target=x86_64-linux-android34 \
1173 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1174 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-NEW %s
1175 // CHECK-ANDROID-OLD: "-dynamic-linker" "/system/bin/linker64"
1176 // CHECK-ANDROID-NEW: "-dynamic-linker" "/system/bin/linker_hwasan64"
1178 // Test that -pthread does not add -lpthread on Android.
1179 // RUN: %clang -### %s -no-pie 2>&1 \
1180 // RUN: --target=arm-linux-androideabi -pthread \
1181 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1182 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1183 // RUN: %clang -### %s -no-pie 2>&1 \
1184 // RUN: --target=arm-linux-android -pthread \
1185 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1186 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1187 // RUN: %clang -### %s -no-pie 2>&1 \
1188 // RUN: --target=aarch64-linux-android -pthread \
1189 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1190 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1191 // RUN: %clang -### %s -no-pie 2>&1 \
1192 // RUN: --target=arm64-linux-android -pthread \
1193 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1194 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1195 // RUN: %clang -### %s -no-pie 2>&1 \
1196 // RUN: --target=i686-linux-android -pthread \
1197 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1198 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1199 // RUN: %clang -### %s -no-pie 2>&1 \
1200 // RUN: --target=x86_64-linux-android -pthread \
1201 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1202 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1203 // RUN: %clang -### %s -no-pie 2>&1 \
1204 // RUN: --target=arm-linux-androideabi -pthread \
1205 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1207 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1208 // RUN: %clang -### %s -no-pie 2>&1 \
1209 // RUN: --target=arm-linux-android -pthread \
1210 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1212 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1213 // RUN: %clang -### %s -no-pie 2>&1 \
1214 // RUN: --target=aarch64-linux-android -pthread \
1215 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1217 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1218 // RUN: %clang -### %s -no-pie 2>&1 \
1219 // RUN: --target=arm64-linux-android -pthread \
1220 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1222 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1223 // RUN: %clang -### %s -no-pie 2>&1 \
1224 // RUN: --target=i686-linux-android -pthread \
1225 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1227 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1228 // RUN: %clang -### %s -no-pie 2>&1 \
1229 // RUN: --target=x86_64-linux-android -pthread \
1230 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1232 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1233 // CHECK-ANDROID-PTHREAD-NOT: -lpthread
1235 // RUN: not %clang %t.o -no-pie -### -o %t 2>&1 \
1236 // RUN: --target=arm-linux-androideabi -pthread \
1237 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1238 // RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD-LINK %s
1239 // CHECK-ANDROID-PTHREAD-LINK-NOT: argument unused during compilation: '-pthread'
1241 /// Check -fandroid-pad-segment.
1242 // RUN: %clang -### %s --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
1243 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1244 // RUN: -fandroid-pad-segment 2>&1 | FileCheck --check-prefix=CHECK-ANDROID-PAD-PHDR %s
1245 // CHECK-ANDROID-PAD-PHDR: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1246 // CHECK-ANDROID-PAD-PHDR: "[[SYSROOT]]/usr/lib/crtbegin_dynamic.o" "[[SYSROOT]]/usr/lib/crt_pad_segment.o"
1248 // RUN: %clang -### %s --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
1249 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1250 // RUN: -fandroid-pad-segment -fno-android-pad-segment 2>&1 | FileCheck --check-prefix=CHECK-NO-ANDROID-PAD-PHDR %s
1251 // CHECK-NO-ANDROID-PAD-PHDR: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1252 // CHECK-NO-ANDROID-PAD-PHDR: "[[SYSROOT]]/usr/lib/crtbegin_dynamic.o"
1253 // CHECK-NO-ANDROID-PAD-PHDR-NOT: crt_pad_segment.o"
1255 // RUN: not %clang -### %s --target=aarch64-linux -fandroid-pad-segment 2>&1 | FileCheck --check-prefix=ERR-ANDROID-PAD-EHDR %s
1256 // ERR-ANDROID-PAD-EHDR: error: unsupported option '-fandroid-pad-segment' for target 'aarch64-linux'
1258 // Check linker invocation on a Debian LoongArch sysroot.
1259 // RUN: %clang -### %s -no-pie 2>&1 \
1260 // RUN: --target=loongarch64-linux-gnu -rtlib=platform --unwindlib=platform \
1261 // RUN: --sysroot=%S/Inputs/debian_loong64_tree \
1262 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-LOONG64 %s
1264 // Check that "-gnuf64" is seen as "-gnu" for loong64.
1265 // RUN: %clang -### %s -no-pie 2>&1 \
1266 // RUN: --target=loongarch64-linux-gnuf64 -rtlib=platform --unwindlib=platform \
1267 // RUN: --sysroot=%S/Inputs/debian_loong64_tree \
1268 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-LOONG64 %s
1269 // CHECK-DEBIAN-ML-LOONG64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1270 // CHECK-DEBIAN-ML-LOONG64: "[[SYSROOT]]/usr/lib/loongarch64-linux-gnu/crt1.o"
1271 // CHECK-DEBIAN-ML-LOONG64: "[[SYSROOT]]/usr/lib/loongarch64-linux-gnu/crti.o"
1272 // CHECK-DEBIAN-ML-LOONG64: "[[SYSROOT]]/usr/lib/gcc/loongarch64-linux-gnu/13/crtbegin.o"
1273 // CHECK-DEBIAN-ML-LOONG64: "-L[[SYSROOT]]/usr/lib/gcc/loongarch64-linux-gnu/13"
1274 // CHECK-DEBIAN-ML-LOONG64: "-L[[SYSROOT]]/usr/lib/loongarch64-linux-gnu"
1275 // CHECK-DEBIAN-ML-LOONG64: "-L[[SYSROOT]]/usr/lib"
1276 // CHECK-DEBIAN-ML-LOONG64: "[[SYSROOT]]/usr/lib/gcc/loongarch64-linux-gnu/13/crtend.o"
1277 // CHECK-DEBIAN-ML-LOONG64: "[[SYSROOT]]/usr/lib/loongarch64-linux-gnu/crtn.o"
1279 // Check linker invocation on Debian 6 MIPS 32/64-bit.
1280 // RUN: %clang -### %s -no-pie 2>&1 \
1281 // RUN: --target=mipsel-linux-gnu -rtlib=platform --unwindlib=platform \
1282 // RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
1283 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPSEL %s
1284 // CHECK-DEBIAN-ML-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1285 // CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib{{/|\\\\}}crt1.o"
1286 // CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib{{/|\\\\}}crti.o"
1287 // CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4{{/|\\\\}}crtbegin.o"
1288 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4"
1289 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib"
1290 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib/../lib"
1291 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/../lib"
1292 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib"
1293 // CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib"
1295 // RUN: %clang -### %s -no-pie 2>&1 \
1296 // RUN: --target=mips64el-linux-gnu -rtlib=platform --unwindlib=platform \
1297 // RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
1298 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL %s
1299 // CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1300 // CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64{{/|\\\\}}crt1.o"
1301 // CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64{{/|\\\\}}crti.o"
1302 // CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/64{{/|\\\\}}crtbegin.o"
1303 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/64"
1304 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64"
1305 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib/../lib64"
1306 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/../lib64"
1307 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib"
1308 // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
1310 // RUN: %clang -### %s -no-pie 2>&1 \
1311 // RUN: --target=mips64el-linux-gnu -rtlib=platform --unwindlib=platform -mabi=n32 \
1312 // RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
1313 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-N32 %s
1314 // CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1315 // CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32{{/|\\\\}}crt1.o"
1316 // CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32{{/|\\\\}}crti.o"
1317 // CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/n32{{/|\\\\}}crtbegin.o"
1318 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/n32"
1319 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32"
1320 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib/../lib32"
1321 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/../lib32"
1322 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib"
1323 // CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
1325 // RUN: %clang -### %s -no-pie 2>&1 \
1326 // RUN: --target=mips64el-linux-gnuabi64 -rtlib=platform --unwindlib=platform -mabi=32 \
1327 // RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
1328 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-O32 %s
1329 // CHECK-DEBIAN-ML-MIPS64EL-O32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1330 // CHECK-DEBIAN-ML-MIPS64EL-O32: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../../libo32{{/|\\\\}}crt1.o"
1331 // CHECK-DEBIAN-ML-MIPS64EL-O32: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../../libo32{{/|\\\\}}crti.o"
1332 // CHECK-DEBIAN-ML-MIPS64EL-O32: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/32{{/|\\\\}}crtbegin.o"
1333 // CHECK-DEBIAN-ML-MIPS64EL-O32: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/32"
1334 // CHECK-DEBIAN-ML-MIPS64EL-O32: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../../libo32"
1335 // CHECK-DEBIAN-ML-MIPS64EL-O32: "-L[[SYSROOT]]/libo32"
1336 // CHECK-DEBIAN-ML-MIPS64EL-O32: "-L[[SYSROOT]]/usr/libo32"
1337 // CHECK-DEBIAN-ML-MIPS64EL-O32: "-L[[SYSROOT]]/lib"
1338 // CHECK-DEBIAN-ML-MIPS64EL-O32: "-L[[SYSROOT]]/usr/lib"
1340 // RUN: %clang -### %s -no-pie 2>&1 \
1341 // RUN: --target=mips64-unknown-linux-gnu --rtlib=platform --unwindlib=platform \
1342 // RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
1343 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64-GNUABI %s
1344 // RUN: %clang -### %s -no-pie 2>&1 \
1345 // RUN: --target=mips64-linux-gnuabi64 -rtlib=platform --unwindlib=platform -mabi=n64 \
1346 // RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
1347 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64-GNUABI %s
1348 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1349 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/mips64-linux-gnuabi64{{/|\\\\}}crt1.o"
1350 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/mips64-linux-gnuabi64{{/|\\\\}}crti.o"
1351 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9{{/|\\\\}}crtbegin.o"
1352 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9"
1353 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/lib/mips64-linux-gnuabi64"
1354 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/mips64-linux-gnuabi64"
1355 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/lib"
1356 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib"
1357 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9{{/|\\\\}}crtend.o"
1358 // CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/mips64-linux-gnuabi64{{/|\\\\}}crtn.o"
1360 // RUN: %clang -### %s -no-pie 2>&1 \
1361 // RUN: --target=mips64el-unknown-linux-gnu -rtlib=platform --unwindlib=platform \
1362 // RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
1363 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-GNUABI %s
1364 // RUN: %clang -### %s -no-pie 2>&1 \
1365 // RUN: --target=mips64el-linux-gnuabi64 -rtlib=platform --unwindlib=platform -mabi=n64 \
1366 // RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
1367 // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-GNUABI %s
1368 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1369 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/mips64el-linux-gnuabi64{{/|\\\\}}crt1.o"
1370 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/mips64el-linux-gnuabi64{{/|\\\\}}crti.o"
1371 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9{{/|\\\\}}crtbegin.o"
1372 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9"
1373 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/lib/mips64el-linux-gnuabi64"
1374 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/mips64el-linux-gnuabi64"
1375 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/lib"
1376 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib"
1377 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9{{/|\\\\}}crtend.o"
1378 // CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/mips64el-linux-gnuabi64{{/|\\\\}}crtn.o"
1380 // Test linker invocation for Freescale SDK (OpenEmbedded).
1381 // RUN: %clang -### %s -no-pie 2>&1 \
1382 // RUN: --target=powerpc-fsl-linux -rtlib=platform --unwindlib=platform \
1383 // RUN: --sysroot=%S/Inputs/freescale_ppc_tree \
1384 // RUN: | FileCheck --check-prefix=CHECK-FSL-PPC %s
1385 // CHECK-FSL-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1386 // CHECK-FSL-PPC: "-m" "elf32ppclinux"
1387 // CHECK-FSL-PPC: "{{.*}}{{/|\\\\}}crt1.o"
1388 // CHECK-FSL-PPC: "{{.*}}{{/|\\\\}}crtbegin.o"
1389 // CHECK-FSL-PPC: "-L[[SYSROOT]]/usr/lib"
1390 // RUN: %clang -### %s -no-pie 2>&1 \
1391 // RUN: --target=powerpc64-fsl-linux -rtlib=platform --unwindlib=platform \
1392 // RUN: --sysroot=%S/Inputs/freescale_ppc64_tree \
1393 // RUN: | FileCheck --check-prefix=CHECK-FSL-PPC64 %s
1394 // CHECK-FSL-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1395 // CHECK-FSL-PPC64: "-m" "elf64ppc"
1396 // CHECK-FSL-PPC64: "{{.*}}{{/|\\\\}}crt1.o"
1397 // CHECK-FSL-PPC64: "{{.*}}{{/|\\\\}}crtbegin.o"
1399 // Check that crtfastmath.o is linked with -ffast-math and with -Ofast.
1400 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s \
1401 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1402 // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1403 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -ffast-math \
1404 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1405 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1406 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -funsafe-math-optimizations\
1407 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1408 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1409 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -ffp-model=fast \
1410 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1411 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1412 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -Ofast\
1413 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1414 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1415 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -Ofast -O3\
1416 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1417 // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1418 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -O3 -Ofast\
1419 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1420 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1421 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -ffast-math -fno-fast-math \
1422 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1423 // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1424 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -Ofast -fno-fast-math \
1425 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1426 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1427 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -Ofast -fno-unsafe-math-optimizations \
1428 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1429 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1430 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -fno-fast-math -Ofast \
1431 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1432 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1433 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -fno-unsafe-math-optimizations -Ofast \
1434 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1435 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1436 // We don't have crtfastmath.o in the i386 tree, use it to check that file
1438 // RUN: %clang --target=i386-unknown-linux -no-pie -### %s -ffast-math \
1439 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1440 // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1441 // Don't link crtfastmath.o with -shared
1442 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -ffast-math -shared \
1443 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1444 // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1445 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -Ofast -shared \
1446 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1447 // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1448 // Check for effects of -mdaz-ftz
1449 // RUN: %clang --target=x86_64-unknown-linux -### %s -ffast-math -shared -mdaz-ftz \
1450 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1451 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1452 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -ffast-math -mdaz-ftz \
1453 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1454 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1455 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -mdaz-ftz \
1456 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1457 // RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1458 // RUN: %clang --target=x86_64-unknown-linux -### %s -ffast-math -shared -mno-daz-ftz \
1459 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1460 // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1461 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -ffast-math -mno-daz-ftz \
1462 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1463 // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1464 // RUN: %clang --target=x86_64-unknown-linux -no-pie -### %s -mno-daz-ftz \
1465 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1466 // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1467 // CHECK-CRTFASTMATH: usr/lib/gcc/x86_64-unknown-linux/10.2.0{{/|\\\\}}crtfastmath.o
1468 // CHECK-NOCRTFASTMATH-NOT: crtfastmath.o
1470 // Check that we link in gcrt1.o when compiling with -pg
1471 // RUN: %clang -pg --target=x86_64-unknown-linux -no-pie -### %s \
1472 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>& 1 \
1473 // RUN: | FileCheck --check-prefix=CHECK-PG %s
1474 // CHECK-PG: gcrt1.o
1476 // GCC forwards -u to the linker.
1477 // RUN: %clang -u asdf --target=x86_64-unknown-linux -no-pie -### %s \
1478 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>& 1 \
1479 // RUN: | FileCheck --check-prefix=CHECK-u %s
1480 // CHECK-u: "-u" "asdf"
1482 // RUN: %clang -### %s -no-pie 2>&1 \
1483 // RUN: --target=armeb-unknown-linux \
1484 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1485 // RUN: | FileCheck --check-prefix=CHECK-ARMEB %s
1486 // CHECK-ARMEB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1487 // CHECK-ARMEB-NOT: "--be8"
1488 // CHECK-ARMEB: "-EB"
1489 // CHECK-ARMEB: "-m" "armelfb_linux_eabi"
1491 // RUN: %clang -### %s -no-pie 2>&1 \
1492 // RUN: --target=armebv7-unknown-linux \
1493 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1494 // RUN: | FileCheck --check-prefix=CHECK-ARMV7EB %s
1495 // CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1496 // CHECK-ARMV7EB: "--be8"
1497 // CHECK-ARMV7EB: "-EB"
1498 // CHECK-ARMV7EB: "-m" "armelfb_linux_eabi"
1500 // RUN: %clang -### %s -no-pie 2>&1 \
1501 // RUN: --target=armv7-unknown-linux \
1502 // RUN: -mbig-endian \
1503 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1504 // RUN: | FileCheck --check-prefix=CHECK-ARMV7EB %s
1506 // RUN: %clang -### %s -no-pie 2>&1 \
1507 // RUN: --target=armebv7-unknown-linux \
1508 // RUN: -mbig-endian \
1509 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1510 // RUN: | FileCheck --check-prefix=CHECK-ARMV7EB %s
1512 // RUN: %clang -### %s -no-pie 2>&1 \
1513 // RUN: --target=armv7-unknown-linux \
1514 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1515 // RUN: | FileCheck --check-prefix=CHECK-ARMV7EL %s
1516 // CHECK-ARMV7EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1517 // CHECK-ARMV7EL-NOT: "--be8"
1518 // CHECK-ARMV7EL: "-EL"
1519 // CHECK-ARMV7EL: "-m" "armelf_linux_eabi"
1521 // RUN: %clang -### %s -no-pie 2>&1 \
1522 // RUN: --target=armebv7-unknown-linux \
1523 // RUN: -mlittle-endian \
1524 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1525 // RUN: | FileCheck --check-prefix=CHECK-ARMV7EL %s
1527 // RUN: %clang -### %s -no-pie 2>&1 \
1528 // RUN: --target=armv7-unknown-linux \
1529 // RUN: -mlittle-endian \
1530 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1531 // RUN: | FileCheck --check-prefix=CHECK-ARMV7EL %s
1533 // RUN: %clang -### %s -no-pie 2>&1 \
1534 // RUN: --target=aarch64_be-unknown-linux \
1535 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1536 // RUN: | FileCheck --check-prefix=CHECK-AARCH64BE %s
1537 // CHECK-AARCH64BE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1538 // CHECK-AARCH64BE-NOT: "--be8"
1539 // CHECK-AARCH64BE: "-EB"
1540 // CHECK-AARCH64BE: "-m" "aarch64linuxb"
1542 // RUN: %clang -### %s -no-pie 2>&1 \
1543 // RUN: --target=aarch64-unknown-linux \
1544 // RUN: -mbig-endian \
1545 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1546 // RUN: | FileCheck --check-prefix=CHECK-AARCH64BE %s
1548 // RUN: %clang -### %s -no-pie 2>&1 \
1549 // RUN: --target=aarch64_be-unknown-linux \
1550 // RUN: -mbig-endian \
1551 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1552 // RUN: | FileCheck --check-prefix=CHECK-AARCH64BE %s
1554 // RUN: %clang -### %s -no-pie 2>&1 \
1555 // RUN: --target=aarch64-unknown-linux \
1556 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1557 // RUN: | FileCheck --check-prefix=CHECK-AARCH64LE %s
1558 // CHECK-AARCH64LE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1559 // CHECK-AARCH64LE-NOT: "--be8"
1560 // CHECK-AARCH64LE: "-EL"
1561 // CHECK-AARCH64LE: "-m" "aarch64linux"
1563 // RUN: %clang -### %s -no-pie 2>&1 \
1564 // RUN: --target=aarch64_be-unknown-linux \
1565 // RUN: -mlittle-endian \
1566 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1567 // RUN: | FileCheck --check-prefix=CHECK-AARCH64LE %s
1569 // Check dynamic-linker for musl-libc
1570 // RUN: %clang -### %s -no-pie 2>&1 \
1571 // RUN: --target=i386-pc-linux-musl \
1572 // RUN: | FileCheck --check-prefix=CHECK-MUSL-X86 %s
1573 // RUN: %clang -### %s -no-pie 2>&1 \
1574 // RUN: --target=x86_64-pc-linux-musl \
1575 // RUN: | FileCheck --check-prefix=CHECK-MUSL-X86_64 %s
1576 // RUN: %clang -### %s -no-pie 2>&1 \
1577 // RUN: --target=mips-pc-linux-musl \
1578 // RUN: | FileCheck --check-prefix=CHECK-MUSL-MIPS %s
1579 // RUN: %clang -### %s -no-pie 2>&1 \
1580 // RUN: --target=mipsel-pc-linux-musl \
1581 // RUN: | FileCheck --check-prefix=CHECK-MUSL-MIPSEL %s
1582 // RUN: %clang -### %s -no-pie 2>&1 \
1583 // RUN: --target=mips64-pc-linux-musl \
1584 // RUN: | FileCheck --check-prefix=CHECK-MUSL-MIPS64 %s
1585 // RUN: %clang -### %s -no-pie 2>&1 \
1586 // RUN: --target=mips64el-pc-linux-musl \
1587 // RUN: | FileCheck --check-prefix=CHECK-MUSL-MIPS64EL %s
1588 // RUN: %clang -### %s -no-pie 2>&1 \
1589 // RUN: --target=powerpc-pc-linux-musl \
1590 // RUN: | FileCheck --check-prefix=CHECK-MUSL-PPC %s
1591 // RUN: %clang -### %s -no-pie 2>&1 \
1592 // RUN: --target=powerpc64-pc-linux-musl \
1593 // RUN: | FileCheck --check-prefix=CHECK-MUSL-PPC64 %s
1594 // RUN: %clang -### %s -no-pie 2>&1 \
1595 // RUN: --target=powerpcspe-pc-linux-musl \
1596 // RUN: | FileCheck --check-prefix=CHECK-MUSL-PPCSPE %s
1597 // RUN: %clang -### %s -no-pie 2>&1 \
1598 // RUN: --target=thumb-pc-linux-musleabi \
1599 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARM %s
1600 // RUN: %clang -### %s -no-pie 2>&1 \
1601 // RUN: --target=thumb-pc-linux-musleabihf \
1602 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
1603 // RUN: %clang -### %s -no-pie 2>&1 \
1604 // RUN: --target=thumbv7-pc-linux-musleabi -mhard-float \
1605 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
1606 // RUN: %clang -### %s -no-pie 2>&1 \
1607 // RUN: --target=thumbeb-pc-linux-musleabi \
1608 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEB %s
1609 // RUN: %clang -### %s -no-pie 2>&1 \
1610 // RUN: --target=thumbeb-pc-linux-musleabihf \
1611 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
1612 // RUN: %clang -### %s -no-pie 2>&1 \
1613 // RUN: --target=thumbv7eb-pc-linux-musleabi -mhard-float \
1614 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
1615 // RUN: %clang -### %s -no-pie 2>&1 \
1616 // RUN: --target=arm-pc-linux-musleabi \
1617 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARM %s
1618 // RUN: %clang -### %s -no-pie 2>&1 \
1619 // RUN: --target=arm-pc-linux-musleabihf \
1620 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
1621 // RUN: %clang -### %s -no-pie 2>&1 \
1622 // RUN: --target=armv7-pc-linux-musleabi -mhard-float \
1623 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
1624 // RUN: %clang -### %s -no-pie 2>&1 \
1625 // RUN: --target=armeb-pc-linux-musleabi \
1626 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEB %s
1627 // RUN: %clang -### %s -no-pie 2>&1 \
1628 // RUN: --target=armeb-pc-linux-musleabihf \
1629 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
1630 // RUN: %clang -### %s -no-pie 2>&1 \
1631 // RUN: --target=armv7eb-pc-linux-musleabi -mhard-float \
1632 // RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
1633 // RUN: %clang -### %s -no-pie 2>&1 \
1634 // RUN: --target=aarch64-pc-linux-musl \
1635 // RUN: | FileCheck --check-prefix=CHECK-MUSL-AARCH64 %s
1636 // RUN: %clang -### %s -no-pie 2>&1 \
1637 // RUN: --target=aarch64_be-pc-linux-musl \
1638 // RUN: | FileCheck --check-prefix=CHECK-MUSL-AARCH64_BE %s
1639 // CHECK-MUSL-X86: "-dynamic-linker" "/lib/ld-musl-i386.so.1"
1640 // CHECK-MUSL-X86_64: "-dynamic-linker" "/lib/ld-musl-x86_64.so.1"
1641 // CHECK-MUSL-MIPS: "-dynamic-linker" "/lib/ld-musl-mips.so.1"
1642 // CHECK-MUSL-MIPSEL: "-dynamic-linker" "/lib/ld-musl-mipsel.so.1"
1643 // CHECK-MUSL-MIPS64: "-dynamic-linker" "/lib/ld-musl-mips64.so.1"
1644 // CHECK-MUSL-MIPS64EL: "-dynamic-linker" "/lib/ld-musl-mips64el.so.1"
1645 // CHECK-MUSL-PPC: "-dynamic-linker" "/lib/ld-musl-powerpc.so.1"
1646 // CHECK-MUSL-PPC64: "-dynamic-linker" "/lib/ld-musl-powerpc64.so.1"
1647 // CHECK-MUSL-PPCSPE: "-dynamic-linker" "/lib/ld-musl-powerpc-sf.so.1"
1648 // CHECK-MUSL-ARM: "-dynamic-linker" "/lib/ld-musl-arm.so.1"
1649 // CHECK-MUSL-ARMHF: "-dynamic-linker" "/lib/ld-musl-armhf.so.1"
1650 // CHECK-MUSL-ARMEB: "-dynamic-linker" "/lib/ld-musl-armeb.so.1"
1651 // CHECK-MUSL-ARMEBHF: "-dynamic-linker" "/lib/ld-musl-armebhf.so.1"
1652 // CHECK-MUSL-AARCH64: "-dynamic-linker" "/lib/ld-musl-aarch64.so.1"
1653 // CHECK-MUSL-AARCH64_BE: "-dynamic-linker" "/lib/ld-musl-aarch64_be.so.1"
1655 // Check whether multilib gcc install works fine on Gentoo with gcc-config
1656 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
1657 // RUN: --target=x86_64-unknown-linux-gnu -rtlib=platform --unwindlib=platform \
1658 // RUN: --sysroot=%S/Inputs/gentoo_linux_gcc_multi_version_tree \
1659 // RUN: | FileCheck --check-prefix=CHECK-LD-GENTOO %s
1660 // CHECK-LD-GENTOO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1661 // CHECK-LD-GENTOO: "--eh-frame-hdr"
1662 // CHECK-LD-GENTOO: "-m" "elf_x86_64"
1663 // CHECK-LD-GENTOO: "-dynamic-linker"
1664 // CHECK-LD-GENTOO: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3{{/|\\\\}}crtbegin.o"
1665 // CHECK-LD-GENTOO: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3"
1666 // CHECK-LD-GENTOO: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib"
1667 // CHECK-LD-GENTOO: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1668 // CHECK-LD-GENTOO: "-lc"
1669 // CHECK-LD-GENTOO: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1670 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
1671 // RUN: --target=i686-unknown-linux-gnu -rtlib=platform --unwindlib=platform \
1672 // RUN: --sysroot=%S/Inputs/gentoo_linux_gcc_multi_version_tree \
1673 // RUN: | FileCheck --check-prefix=CHECK-LD-GENTOO-32 %s
1674 // CHECK-LD-GENTOO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1675 // CHECK-LD-GENTOO-32: "--eh-frame-hdr"
1676 // CHECK-LD-GENTOO-32: "-m" "elf_i386"
1677 // CHECK-LD-GENTOO-32: "-dynamic-linker"
1678 // CHECK-LD-GENTOO-32: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32{{/|\\\\}}crtbegin.o"
1679 // CHECK-LD-GENTOO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32"
1680 // CHECK-LD-GENTOO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib"
1681 // CHECK-LD-GENTOO-32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1682 // CHECK-LD-GENTOO-32: "-lc"
1683 // CHECK-LD-GENTOO-32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1684 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
1685 // RUN: --target=x86_64-unknown-linux-gnux32 -rtlib=platform --unwindlib=platform \
1686 // RUN: --sysroot=%S/Inputs/gentoo_linux_gcc_multi_version_tree \
1687 // RUN: | FileCheck --check-prefix=CHECK-LD-GENTOO-X32 %s
1688 // CHECK-LD-GENTOO-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1689 // CHECK-LD-GENTOO-X32: "--eh-frame-hdr"
1690 // CHECK-LD-GENTOO-X32: "-m" "elf32_x86_64"
1691 // CHECK-LD-GENTOO-X32: "-dynamic-linker"
1692 // CHECK-LD-GENTOO-X32: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/x32{{/|\\\\}}crtbegin.o"
1693 // CHECK-LD-GENTOO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/x32"
1694 // CHECK-LD-GENTOO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib"
1695 // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1696 // CHECK-LD-GENTOO-X32: "-lc"
1697 // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1699 // RUN: %clang -### %s -no-pie -fuse-ld=ld 2>&1 \
1700 // RUN: --target=x86_64-unknown-linux-gnu \
1701 // RUN: --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \
1702 // RUN: --sysroot="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root" \
1703 // RUN: | FileCheck --check-prefix=CHECK-LD-RHEL7-DTS %s
1704 // CHECK-LD-RHEL7-DTS: "-isysroot" "[[SYSROOT:[^"]+]]"
1705 // CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld
1706 // CHECK-LD-RHEL7-DTS: [[SYSROOT]]/usr/lib/gcc/x86_64-redhat-linux/7/../../../../bin/ld
1708 // Check whether gcc7 install works fine on Amazon Linux AMI
1709 // RUN: %clang -### %s -Werror -no-pie 2>&1 \
1710 // RUN: --target=x86_64-amazon-linux -rtlib=libgcc --unwindlib=platform \
1711 // RUN: --sysroot=%S/Inputs/ami_linux_tree \
1712 // RUN: | FileCheck --check-prefix=CHECK-LD-AMI %s
1713 // CHECK-LD-AMI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1714 // CHECK-LD-AMI: "--eh-frame-hdr"
1715 // CHECK-LD-AMI: "-m" "elf_x86_64"
1716 // CHECK-LD-AMI: "-dynamic-linker"
1717 // CHECK-LD-AMI: "{{.*}}/usr/lib/gcc/x86_64-amazon-linux/7{{/|\\\\}}crtbegin.o"
1718 // CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7"
1719 // CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../../../lib64"
1720 // CHECK-LD-AMI: "-L[[SYSROOT]]/lib"
1721 // CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib"
1722 // CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1723 // CHECK-LD-AMI: "-lc"
1724 // CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1726 // Check whether the OpenEmbedded ARM libs are added correctly.
1727 // RUN: %clang -### %s -no-pie 2>&1 \
1728 // RUN: --target=arm-oe-linux-gnueabi -rtlib=libgcc --unwindlib=platform \
1729 // RUN: --sysroot=%S/Inputs/openembedded_arm_linux_tree \
1730 // RUN: | FileCheck --check-prefix=CHECK-OE-ARM %s
1732 // CHECK-OE-ARM: "-cc1" "-triple" "armv4t-oe-linux-gnueabi"
1733 // CHECK-OE-ARM: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]"
1734 // CHECK-OE-ARM: "-m" "armelf_linux_eabi" "-dynamic-linker"
1735 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0/../../../lib{{/|\\\\}}crt1.o"
1736 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0/../../../lib{{/|\\\\}}crti.o"
1737 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0{{/|\\\\}}crtbegin.o"
1738 // CHECK-OE-ARM: "-L[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0"
1739 // CHECK-OE-ARM: "-L[[SYSROOT]]/usr/lib"
1740 // CHECK-OE-ARM: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1741 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0{{/|\\\\}}crtend.o"
1742 // CHECK-OE-ARM: "[[SYSROOT]]/usr/lib/arm-oe-linux-gnueabi/6.3.0/../../../lib{{/|\\\\}}crtn.o"
1744 // Check whether the OpenEmbedded AArch64 libs are added correctly.
1745 // RUN: %clang -### %s -no-pie 2>&1 \
1746 // RUN: --target=aarch64-oe-linux -rtlib=libgcc --unwindlib=platform \
1747 // RUN: --sysroot=%S/Inputs/openembedded_aarch64_linux_tree \
1748 // RUN: | FileCheck --check-prefix=CHECK-OE-AARCH64 %s
1750 // CHECK-OE-AARCH64: "-cc1" "-triple" "aarch64-oe-linux"
1751 // CHECK-OE-AARCH64: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]"
1752 // CHECK-OE-AARCH64: "-m" "aarch64linux" "-dynamic-linker"
1753 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../lib64{{/|\\\\}}crt1.o"
1754 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../lib64{{/|\\\\}}crti.o"
1755 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0{{/|\\\\}}crtbegin.o"
1756 // CHECK-OE-AARCH64: "-L[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0"
1757 // CHECK-OE-AARCH64: "-L[[SYSROOT]]/usr/lib64"
1758 // CHECK-OE-AARCH64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
1759 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0{{/|\\\\}}crtend.o"
1760 // CHECK-OE-AARCH64: "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../lib64{{/|\\\\}}crtn.o"
1762 /// -nopie is OpenBSD-specific.
1763 // RUN: not %clang -### --target=x86_64-unknown-linux-gnu %s -nopie 2>&1 | FileCheck %s --check-prefix=CHECK-NOPIE
1764 // CHECK-NOPIE: error: unsupported option '-nopie' for target 'x86_64-unknown-linux-gnu'