1 // Test sanitizers ld flags.
3 // RUN: %clang -### %s 2>&1 \
4 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address \
5 // RUN: -resource-dir=%S/Inputs/resource_dir \
6 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
7 // RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX %s
9 // CHECK-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
10 // CHECK-ASAN-LINUX-NOT: "-lc"
11 // CHECK-ASAN-LINUX: libclang_rt.asan-i386.a"
12 // CHECK-ASAN-LINUX-NOT: "--export-dynamic"
13 // CHECK-ASAN-LINUX: "--dynamic-list={{.*}}libclang_rt.asan-i386.a.syms"
14 // CHECK-ASAN-LINUX-NOT: "--export-dynamic"
15 // CHECK-ASAN-LINUX: "-lpthread"
16 // CHECK-ASAN-LINUX: "-lrt"
17 // CHECK-ASAN-LINUX: "-ldl"
18 // CHECK-ASAN-LINUX: "-lresolv"
20 // RUN: %clang -fsanitize=address -fno-sanitize-link-runtime -### %s 2>&1 \
21 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
22 // RUN: -resource-dir=%S/Inputs/resource_dir \
23 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
24 // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s
26 // CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64
28 // RUN: %clang -fsanitize=address -fno-sanitize-link-runtime -### %s 2>&1 \
29 // RUN: --target=arm64e-apple-macosx -fuse-ld=ld \
30 // RUN: -resource-dir=%S/Inputs/resource_dir \
31 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
32 // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-DARWIN %s
34 // CHECK-ASAN-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.asan
36 // RUN: %clang -fsanitize=address -### %s 2>&1 \
37 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
38 // RUN: -resource-dir=%S/Inputs/resource_dir \
39 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
40 // RUN: | FileCheck --check-prefix=CHECK-ASAN-EXECUTABLE-LINUX %s
42 // CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan_static-x86_64
43 // CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan-x86_64
45 // RUN: %clang -fsanitize=address -shared -### %s 2>&1 \
46 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
47 // RUN: -resource-dir=%S/Inputs/resource_dir \
48 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
49 // RUN: | FileCheck --check-prefix=CHECK-ASAN-SHARED-LINUX %s
51 // CHECK-ASAN-SHARED-LINUX: libclang_rt.asan_static-x86_64
52 // CHECK-ASAN-SHARED-LINUX-NOT: libclang_rt.asan-x86_64
54 // RUN: %clang -### %s 2>&1 \
55 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
56 // RUN: -resource-dir=%S/Inputs/resource_dir \
57 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
58 // RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
60 // RUN: %clang -### %s 2>&1 \
61 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan \
62 // RUN: -resource-dir=%S/Inputs/resource_dir \
63 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
64 // RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
66 // RUN: %clang -### %s 2>&1 \
67 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address \
68 // RUN: -shared-libsan -static-libsan -shared-libasan \
69 // RUN: -resource-dir=%S/Inputs/resource_dir \
70 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
71 // RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
73 // CHECK-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
74 // CHECK-SHARED-ASAN-LINUX-NOT: "-lc"
75 // CHECK-SHARED-ASAN-LINUX-NOT: libclang_rt.asan-i386.a"
76 // CHECK-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so"
77 // CHECK-SHARED-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-preinit-i386.a" "--no-whole-archive"
78 // CHECK-SHARED-ASAN-LINUX-NOT: "-lpthread"
79 // CHECK-SHARED-ASAN-LINUX-NOT: "-lrt"
80 // CHECK-SHARED-ASAN-LINUX-NOT: "-ldl"
81 // CHECK-SHARED-ASAN-LINUX-NOT: "-lresolv"
82 // CHECK-SHARED-ASAN-LINUX-NOT: "--export-dynamic"
83 // CHECK-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
85 // RUN: %clang -### %s -o %t.so -shared 2>&1 \
86 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
87 // RUN: -resource-dir=%S/Inputs/resource_dir \
88 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
89 // RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s
91 // CHECK-DSO-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
92 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lc"
93 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: libclang_rt.asan-i386.a"
94 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "libclang_rt.asan-preinit-i386.a"
95 // CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so"
96 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lpthread"
97 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lrt"
98 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-ldl"
99 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lresolv"
100 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--export-dynamic"
101 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
103 // RUN: %clang -### %s 2>&1 \
104 // RUN: --target=i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
105 // RUN: -resource-dir=%S/Inputs/resource_dir \
106 // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
107 // RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s
109 // CHECK-ASAN-FREEBSD: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
110 // CHECK-ASAN-FREEBSD-NOT: "-lc"
111 // CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
112 // CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan-i386.a"
113 // CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
114 // CHECK-ASAN-FREEBSD-NOT: "--dynamic-list"
115 // CHECK-ASAN-FREEBSD: "--export-dynamic"
116 // CHECK-ASAN-FREEBSD: "-lpthread"
117 // CHECK-ASAN-FREEBSD: "-lrt"
119 // RUN: %clang -### %s 2>&1 \
120 // RUN: --target=i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
121 // RUN: -resource-dir=%S/Inputs/resource_dir \
122 // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
123 // RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD-LDL %s
125 // CHECK-ASAN-FREEBSD-LDL: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
126 // CHECK-ASAN-FREEBSD-LDL-NOT: "-ldl"
128 // RUN: %clangxx -### %s 2>&1 \
129 // RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform -fsanitize=address \
130 // RUN: -resource-dir=%S/Inputs/empty_resource_dir \
131 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
132 // RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s
134 // CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
135 // CHECK-ASAN-LINUX-CXX-NOT: "-lc"
136 // CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
137 // CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "--no-whole-archive"
138 // CHECK-ASAN-LINUX-CXX-NOT: "--dynamic-list"
139 // CHECK-ASAN-LINUX-CXX: "--export-dynamic"
140 // CHECK-ASAN-LINUX-CXX: stdc++
141 // CHECK-ASAN-LINUX-CXX: "-lpthread"
142 // CHECK-ASAN-LINUX-CXX: "-lrt"
143 // CHECK-ASAN-LINUX-CXX: "-ldl"
144 // CHECK-ASAN-LINUX-CXX: "-lresolv"
146 // RUN: %clang -### %s -o /dev/null -fsanitize=address \
147 // RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
148 // RUN: -resource-dir=%S/Inputs/resource_dir \
149 // RUN: --sysroot=%S/Inputs/basic_linux_tree -lstdc++ -static 2>&1 \
150 // RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX-STATIC %s
152 // CHECK-ASAN-LINUX-CXX-STATIC: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
153 // CHECK-ASAN-LINUX-CXX-STATIC-NOT: stdc++
154 // CHECK-ASAN-LINUX-CXX-STATIC: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
155 // CHECK-ASAN-LINUX-CXX-STATIC: stdc++
157 // RUN: %clang -### %s 2>&1 \
158 // RUN: --target=arm-linux-gnueabi -fuse-ld=ld -fsanitize=address \
159 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
160 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s
162 // CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
163 // CHECK-ASAN-ARM-NOT: "-lc"
164 // CHECK-ASAN-ARM: libclang_rt.asan-arm.a"
166 // RUN: %clang -### %s 2>&1 \
167 // RUN: --target=armv7l-linux-gnueabi -fuse-ld=ld -fsanitize=address \
168 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
169 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s
171 // CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
172 // CHECK-ASAN-ARMv7-NOT: "-lc"
173 // CHECK-ASAN-ARMv7: libclang_rt.asan-arm.a"
175 // RUN: %clang -### %s 2>&1 \
176 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
177 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
178 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
180 // CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
181 // CHECK-ASAN-ANDROID: "-pie"
182 // CHECK-ASAN-ANDROID-NOT: "-lc"
183 // CHECK-ASAN-ANDROID-NOT: "-lpthread"
184 // CHECK-ASAN-ANDROID-NOT: "-lresolv"
185 // CHECK-ASAN-ANDROID: libclang_rt.asan-arm-android.so"
186 // CHECK-ASAN-ANDROID-NOT: "-lpthread"
187 // CHECK-ASAN-ANDROID-NOT: "-lresolv"
189 // RUN: %clang -### %s 2>&1 \
190 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
191 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
192 // RUN: -static-libsan \
193 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s
195 // CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
196 // CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan-arm-android.a"
197 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
198 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
199 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
201 // RUN: %clang -### %s 2>&1 \
202 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
203 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
204 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s
206 // CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
207 // CHECK-UBSAN-ANDROID: "-pie"
208 // CHECK-UBSAN-ANDROID-NOT: "-lc"
209 // CHECK-UBSAN-ANDROID-NOT: "-lpthread"
210 // CHECK-UBSAN-ANDROID-NOT: "-lresolv"
211 // CHECK-UBSAN-ANDROID: libclang_rt.ubsan_standalone-arm-android.so"
212 // CHECK-UBSAN-ANDROID-NOT: "-lpthread"
213 // CHECK-UBSAN-ANDROID-NOT: "-lresolv"
215 // RUN: %clang -### %s 2>&1 \
216 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
217 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
218 // RUN: -static-libsan \
219 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s
221 // CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
222 // CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone-arm-android.a"
223 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
224 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
225 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
228 // RUN: %clang -### %s 2>&1 \
229 // RUN: --target=i686-linux-android -fuse-ld=ld -fsanitize=address \
230 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
231 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s
233 // CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
234 // CHECK-ASAN-ANDROID-X86: "-pie"
235 // CHECK-ASAN-ANDROID-X86-NOT: "-lc"
236 // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
237 // CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
238 // CHECK-ASAN-ANDROID-X86: libclang_rt.asan-i686-android.so"
239 // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
240 // CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
242 // RUN: %clang -### %s 2>&1 \
243 // RUN: --target=arm-linux-androideabi -fsanitize=address \
244 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
245 // RUN: -shared-libsan \
246 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED-LIBASAN %s
248 // CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libsan'
250 // RUN: %clang -### %s 2>&1 \
251 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
252 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
254 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
256 // CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
257 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lc"
258 // CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan-arm-android.so"
259 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
260 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lresolv"
262 // RUN: %clangxx -### %s 2>&1 \
263 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \
264 // RUN: -fsanitize=thread \
265 // RUN: -resource-dir=%S/Inputs/resource_dir \
266 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
267 // RUN: | FileCheck --check-prefix=CHECK-TSAN-LINUX-CXX %s
269 // CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
270 // CHECK-TSAN-LINUX-CXX-NOT: stdc++
271 // CHECK-TSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "--no-whole-archive"
272 // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan-x86_64.a.syms"
273 // CHECK-TSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan_cxx-x86_64.a" "--no-whole-archive"
274 // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan_cxx-x86_64.a.syms"
275 // CHECK-TSAN-LINUX-CXX-NOT: "--export-dynamic"
276 // CHECK-TSAN-LINUX-CXX: stdc++
277 // CHECK-TSAN-LINUX-CXX: "-lpthread"
278 // CHECK-TSAN-LINUX-CXX: "-lrt"
279 // CHECK-TSAN-LINUX-CXX: "-ldl"
280 // CHECK-TSAN-LINUX-CXX: "-lresolv"
282 // RUN: %clang -fsanitize=thread -fno-sanitize-link-runtime -### %s 2>&1 \
283 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
284 // RUN: -resource-dir=%S/Inputs/resource_dir \
285 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
286 // RUN: | FileCheck --check-prefix=CHECK-TSAN-NO-LINK-RUNTIME-LINUX %s
288 // CHECK-TSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.tsan
290 // RUN: not %clang -fsanitize=thread -fno-sanitize-link-runtime -### %s 2>&1 \
291 // RUN: --target=arm64e-apple-ios -fuse-ld=ld \
292 // RUN: -resource-dir=%S/Inputs/resource_dir \
293 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
294 // RUN: | FileCheck --check-prefix=CHECK-TSAN-NO-LINK-RUNTIME-DARWIN %s
296 // CHECK-TSAN-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.tsan
298 // RUN: %clangxx -### %s 2>&1 \
299 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \
300 // RUN: -fsanitize=memory \
301 // RUN: -resource-dir=%S/Inputs/resource_dir \
302 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
303 // RUN: | FileCheck --check-prefix=CHECK-MSAN-LINUX-CXX %s
305 // CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
306 // CHECK-MSAN-LINUX-CXX-NOT: stdc++
307 // CHECK-MSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "--no-whole-archive"
308 // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan-x86_64.a.syms"
309 // CHECK-MSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan_cxx-x86_64.a" "--no-whole-archive"
310 // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan_cxx-x86_64.a.syms"
311 // CHECK-MSAN-LINUX-CXX-NOT: "--export-dynamic"
312 // CHECK-MSAN-LINUX-CXX: stdc++
313 // CHECK-MSAN-LINUX-CXX: "-lpthread"
314 // CHECK-MSAN-LINUX-CXX: "-lrt"
315 // CHECK-MSAN-LINUX-CXX: "-ldl"
316 // CHECK-MSAN-LINUX-CXX: "-lresolv"
318 // RUN: %clang -fsanitize=memory -fno-sanitize-link-runtime -### %s 2>&1 \
319 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
320 // RUN: -resource-dir=%S/Inputs/resource_dir \
321 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
322 // RUN: | FileCheck --check-prefix=CHECK-MSAN-NO-LINK-RUNTIME-LINUX %s
324 // CHECK-MSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.msan
326 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
327 // RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
328 // RUN: -resource-dir=%S/Inputs/resource_dir \
329 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
330 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
332 // RUN: %clang -fsanitize=float-divide-by-zero -### %s 2>&1 \
333 // RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
334 // RUN: -resource-dir=%S/Inputs/resource_dir \
335 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
336 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
338 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
339 // RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
340 // RUN: -resource-dir=%S/Inputs/resource_dir \
341 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
342 // RUN: -static-libsan \
343 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
345 // CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
346 // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
347 // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
348 // CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x32.a" "--no-whole-archive"
349 // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
350 // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
351 // CHECK-UBSAN-LINUX-NOT: "-lstdc++"
352 // CHECK-UBSAN-LINUX: "-lpthread"
353 // CHECK-UBSAN-LINUX: "-lresolv"
355 // RUN: %clang -fsanitize=undefined -fno-sanitize-link-runtime -### %s 2>&1 \
356 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
357 // RUN: -resource-dir=%S/Inputs/resource_dir \
358 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
359 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-NO-LINK-RUNTIME-LINUX %s
361 // CHECK-UBSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.undefined
363 // RUN: %clang -fsanitize=undefined -fno-sanitize-link-runtime -### %s 2>&1 \
364 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
365 // RUN: -resource-dir=%S/Inputs/resource_dir \
366 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
367 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-NO-LINK-RUNTIME-DARWIN %s
369 // CHECK-UBSAN-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.ubsan
371 // RUN: %clang -fsanitize=fuzzer -fno-sanitize-link-runtime -### %s 2>&1 \
372 // RUN: --target=arm64e-apple-watchos -fuse-ld=ld \
373 // RUN: -resource-dir=%S/Inputs/resource_dir \
374 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
375 // RUN: | FileCheck --check-prefix=CHECK-FUZZER-NO-LINK-RUNTIME-DARWIN %s
377 // CHECK-FUZZER-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.fuzzer
379 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
380 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
381 // RUN: -resource-dir=%S/Inputs/resource_dir \
382 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
383 // RUN: -shared-libsan \
384 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
386 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
387 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
388 // RUN: -resource-dir=%S/Inputs/resource_dir \
389 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
390 // RUN: -static-libsan -shared-libsan \
391 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
393 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
394 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
395 // RUN: -resource-dir=%S/Inputs/resource_dir \
396 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
397 // RUN: -shared -shared-libsan \
398 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
400 // CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}ld{{(.exe)?}}"
401 // CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}libclang_rt.ubsan_standalone-i386.so{{.*}}"
403 // RUN: %clang -fsanitize=undefined -fsanitize-link-c++-runtime -### %s 2>&1 \
404 // RUN: --target=i386-unknown-linux \
405 // RUN: -resource-dir=%S/Inputs/resource_dir \
406 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
407 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s
408 // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
409 // CHECK-UBSAN-LINUX-LINK-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "--no-whole-archive"
410 // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
412 // RUN: %clangxx -fsanitize=undefined -### %s 2>&1 \
413 // RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
414 // RUN: -resource-dir=%S/Inputs/resource_dir \
415 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
416 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s
417 // CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
418 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
419 // CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "--no-whole-archive"
420 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
421 // CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "--no-whole-archive"
422 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
423 // CHECK-UBSAN-LINUX-CXX: "-lstdc++"
424 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
425 // CHECK-UBSAN-LINUX-CXX: "-lpthread"
426 // CHECK-UBSAN-LINUX-CXX: "-lresolv"
428 // RUN: %clang -fsanitize=undefined -fsanitize-minimal-runtime -### %s 2>&1 \
429 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
430 // RUN: -resource-dir=%S/Inputs/resource_dir \
431 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
432 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-LINUX %s
433 // CHECK-UBSAN-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}"
434 // CHECK-UBSAN-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_minimal-i386.a" "--no-whole-archive"
435 // CHECK-UBSAN-MINIMAL-LINUX: "-lpthread"
436 // CHECK-UBSAN-MINIMAL-LINUX: "-lresolv"
438 // RUN: %clang -fsanitize=undefined -fsanitize-minimal-runtime -### %s 2>&1 \
439 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
440 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
441 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-DARWIN %s
442 // CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}ld{{(.exe)?}}"
443 // CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}libclang_rt.ubsan_minimal_osx_dynamic.dylib"
445 // RUN: not %clang -fsanitize=undefined -### %s 2>&1 \
446 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld -static-libsan \
447 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
448 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-STATIC-DARWIN %s
449 // CHECK-UBSAN-STATIC-DARWIN: {{.*}}error: static UndefinedBehaviorSanitizer runtime is not supported on darwin
451 // RUN: not %clang -fsanitize=address -### %s 2>&1 \
452 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld -static-libsan \
453 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
454 // RUN: | FileCheck --check-prefix=CHECK-ASAN-STATIC-DARWIN %s
455 // CHECK-ASAN-STATIC-DARWIN: {{.*}}error: static AddressSanitizer runtime is not supported on darwin
457 // RUN: not %clang -fsanitize=thread -### %s 2>&1 \
458 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld -static-libsan \
459 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
460 // RUN: | FileCheck --check-prefix=CHECK-TSAN-STATIC-DARWIN %s
461 // CHECK-TSAN-STATIC-DARWIN: {{.*}}error: static ThreadSanitizer runtime is not supported on darwin
463 // RUN: %clang -fsanitize=address,undefined -### %s 2>&1 \
464 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
465 // RUN: -resource-dir=%S/Inputs/resource_dir \
466 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
467 // RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX %s
468 // CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
469 // CHECK-ASAN-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
470 // CHECK-ASAN-UBSAN-LINUX-NOT: libclang_rt.ubsan
471 // CHECK-ASAN-UBSAN-LINUX-NOT: "-lstdc++"
472 // CHECK-ASAN-UBSAN-LINUX: "-lpthread"
473 // CHECK-ASAN-UBSAN-LINUX: "-lresolv"
475 // RUN: %clangxx -fsanitize=address,undefined -### %s 2>&1 \
476 // RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
477 // RUN: -resource-dir=%S/Inputs/resource_dir \
478 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
479 // RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s
480 // CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
481 // CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
482 // CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "--no-whole-archive"
483 // CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
484 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lstdc++"
485 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread"
486 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lresolv"
488 // RUN: %clangxx -fsanitize=memory,undefined -### %s 2>&1 \
489 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
490 // RUN: -resource-dir=%S/Inputs/resource_dir \
491 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
492 // RUN: | FileCheck --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX %s
493 // CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
494 // CHECK-MSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "--no-whole-archive"
495 // CHECK-MSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
497 // RUN: %clangxx -fsanitize=thread,undefined -### %s 2>&1 \
498 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
499 // RUN: -resource-dir=%S/Inputs/resource_dir \
500 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
501 // RUN: | FileCheck --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX %s
502 // CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
503 // CHECK-TSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "--no-whole-archive"
504 // CHECK-TSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
506 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
507 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
508 // RUN: -resource-dir=%S/Inputs/resource_dir \
509 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
511 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHARED %s
512 // CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}"
513 // CHECK-UBSAN-LINUX-SHARED-NOT: --export-dynamic
514 // CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list
515 // CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan
517 // RUN: %clang -### %s 2>&1 \
518 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak \
519 // RUN: -resource-dir=%S/Inputs/resource_dir \
520 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
521 // RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s
523 // CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
524 // CHECK-LSAN-LINUX-NOT: "-lc"
525 // CHECK-LSAN-LINUX-NOT: libclang_rt.ubsan
526 // CHECK-LSAN-LINUX: libclang_rt.lsan-x86_64.a"
527 // CHECK-LSAN-LINUX: "-lpthread"
528 // CHECK-LSAN-LINUX: "-ldl"
529 // CHECK-LSAN-LINUX: "-lresolv"
531 // RUN: %clang -fsanitize=leak -fno-sanitize-link-runtime -### %s 2>&1 \
532 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
533 // RUN: -resource-dir=%S/Inputs/resource_dir \
534 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
535 // RUN: | FileCheck --check-prefix=CHECK-LSAN-NO-LINK-RUNTIME-LINUX %s
537 // CHECK-LSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.lsan
539 // RUN: %clang -### %s 2>&1 \
540 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak -fsanitize-coverage=func \
541 // RUN: -resource-dir=%S/Inputs/resource_dir \
542 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
543 // RUN: | FileCheck --check-prefix=CHECK-LSAN-COV-LINUX %s
545 // CHECK-LSAN-COV-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
546 // CHECK-LSAN-COV-LINUX-NOT: "-lc"
547 // CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan
548 // CHECK-LSAV-COV-LINUX: libclang_rt.lsan-x86_64.a"
549 // CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan
550 // CHECK-LSAN-COV-LINUX: "-lpthread"
551 // CHECK-LSAN-COV-LINUX: "-ldl"
552 // CHECK-LSAN-COV-LINUX: "-lresolv"
554 // RUN: %clang -fsanitize=leak,address -### %s 2>&1 \
555 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
556 // RUN: -resource-dir=%S/Inputs/resource_dir \
557 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
558 // RUN: | FileCheck --check-prefix=CHECK-LSAN-ASAN-LINUX %s
559 // CHECK-LSAN-ASAN-LINUX: "{{.*}}ld{{(.exe)?}}"
560 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan
561 // CHECK-LSAN-ASAN-LINUX: libclang_rt.asan-x86_64
562 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan
564 // RUN: %clang -fsanitize=address -fsanitize-coverage=func -### %s 2>&1 \
565 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
566 // RUN: -resource-dir=%S/Inputs/resource_dir \
567 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
568 // RUN: | FileCheck --check-prefix=CHECK-ASAN-COV-LINUX %s
569 // CHECK-ASAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
570 // CHECK-ASAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-x86_64.a" "--no-whole-archive"
571 // CHECK-ASAN-COV-LINUX-NOT: libclang_rt.ubsan
572 // CHECK-ASAN-COV-LINUX-NOT: "-lstdc++"
573 // CHECK-ASAN-COV-LINUX: "-lpthread"
574 // CHECK-ASAN-COV-LINUX: "-lresolv"
576 // RUN: %clang -fsanitize=memory -fsanitize-coverage=func -### %s 2>&1 \
577 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
578 // RUN: -resource-dir=%S/Inputs/resource_dir \
579 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
580 // RUN: | FileCheck --check-prefix=CHECK-MSAN-COV-LINUX %s
581 // CHECK-MSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
582 // CHECK-MSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "--no-whole-archive"
583 // CHECK-MSAN-COV-LINUX-NOT: libclang_rt.ubsan
584 // CHECK-MSAN-COV-LINUX-NOT: "-lstdc++"
585 // CHECK-MSAN-COV-LINUX: "-lpthread"
586 // CHECK-MSAN-COV-LINUX: "-lresolv"
588 // RUN: %clang -fsanitize=dataflow -fsanitize-coverage=func -### %s 2>&1 \
589 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
590 // RUN: -resource-dir=%S/Inputs/resource_dir \
591 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
592 // RUN: | FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX %s
593 // CHECK-DFSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
594 // CHECK-DFSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.dfsan-x86_64.a" "--no-whole-archive"
595 // CHECK-DFSAN-COV-LINUX-NOT: libclang_rt.ubsan
596 // CHECK-DFSAN-COV-LINUX-NOT: "-lstdc++"
597 // CHECK-DFSAN-COV-LINUX: "-lpthread"
598 // CHECK-DFSAN-COV-LINUX: "-lresolv"
600 // RUN: %clang -fsanitize=undefined -fsanitize-coverage=func -### %s 2>&1 \
601 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
602 // RUN: -resource-dir=%S/Inputs/resource_dir \
603 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
604 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX %s
605 // CHECK-UBSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
606 // CHECK-UBSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x86_64.a" "--no-whole-archive"
607 // CHECK-UBSAN-COV-LINUX-NOT: "-lstdc++"
608 // CHECK-UBSAN-COV-LINUX: "-lpthread"
609 // CHECK-UBSAN-COV-LINUX: "-lresolv"
611 // RUN: %clang -fsanitize-coverage=func -### %s 2>&1 \
612 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
613 // RUN: -resource-dir=%S/Inputs/resource_dir \
614 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
615 // RUN: | FileCheck --check-prefix=CHECK-COV-LINUX %s
616 // CHECK-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
617 // CHECK-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x86_64.a" "--no-whole-archive"
618 // CHECK-COV-LINUX-NOT: "-lstdc++"
619 // CHECK-COV-LINUX: "-lpthread"
620 // CHECK-COV-LINUX: "-lresolv"
622 // CFI by itself does not link runtime libraries.
623 // RUN: not %clang -fsanitize=cfi -### %s 2>&1 \
624 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -rtlib=platform \
625 // RUN: -resource-dir=%S/Inputs/resource_dir \
626 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
627 // RUN: | FileCheck --check-prefix=CHECK-CFI-LINUX %s
628 // CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}"
629 // CHECK-CFI-LINUX-NOT: libclang_rt.
631 // CFI with diagnostics links the UBSan runtime.
632 // RUN: not %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
633 // RUN: -### %s 2>&1\
634 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
635 // RUN: -resource-dir=%S/Inputs/resource_dir \
636 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
637 // RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s
638 // CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
639 // CHECK-CFI-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a" "--no-whole-archive"
641 // Cross-DSO CFI links the CFI runtime.
642 // RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
643 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
644 // RUN: -resource-dir=%S/Inputs/resource_dir \
645 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
646 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s
647 // CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}"
648 // CHECK-CFI-CROSS-DSO-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi-x86_64.a" "--no-whole-archive"
649 // CHECK-CFI-CROSS-DSO-LINUX: -export-dynamic
651 // Cross-DSO CFI with diagnostics links just the CFI runtime.
652 // RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
653 // RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
654 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
655 // RUN: -resource-dir=%S/Inputs/resource_dir \
656 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
657 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s
658 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
659 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi_diag-x86_64.a" "--no-whole-archive"
660 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: -export-dynamic
662 // Cross-DSO CFI on Android does not link runtime libraries.
663 // RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
664 // RUN: --target=aarch64-linux-android -fuse-ld=ld \
665 // RUN: -resource-dir=%S/Inputs/resource_dir \
666 // RUN: --sysroot=%S/Inputs/basic_android_tree \
667 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-ANDROID %s
668 // CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld{{(.exe)?}}"
669 // CHECK-CFI-CROSS-DSO-ANDROID-NOT: libclang_rt.cfi
671 // Cross-DSO CFI with diagnostics on Android links just the UBSAN runtime.
672 // RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
673 // RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
674 // RUN: --target=aarch64-linux-android -fuse-ld=ld \
675 // RUN: -resource-dir=%S/Inputs/resource_dir \
676 // RUN: --sysroot=%S/Inputs/basic_android_tree \
677 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s
678 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld{{(.exe)?}}"
679 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone-aarch64-android.so"
680 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "--export-dynamic-symbol=__cfi_check"
682 // RUN: %clangxx -fsanitize=address -### %s 2>&1 \
683 // RUN: -mmacosx-version-min=10.6 \
684 // RUN: --target=x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
685 // RUN: -resource-dir=%S/Inputs/resource_dir \
686 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
687 // RUN: | FileCheck --check-prefix=CHECK-ASAN-DARWIN106-CXX %s
688 // CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
689 // CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib
690 // CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi
692 // RUN: %clangxx -fsanitize=leak -### %s 2>&1 \
693 // RUN: -mmacosx-version-min=10.6 \
694 // RUN: --target=x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
695 // RUN: -resource-dir=%S/Inputs/resource_dir \
696 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
697 // RUN: | FileCheck --check-prefix=CHECK-LSAN-DARWIN106-CXX %s
698 // CHECK-LSAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
699 // CHECK-LSAN-DARWIN106-CXX: libclang_rt.lsan_osx_dynamic.dylib
700 // CHECK-LSAN-DARWIN106-CXX-NOT: -lc++abi
702 // RUN: %clang -### %s 2>&1 \
703 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
704 // RUN: -resource-dir=%S/Inputs/resource_dir \
705 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
706 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s
708 // CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
709 // CHECK-SAFESTACK-LINUX-NOT: "-lc"
710 // CHECK-SAFESTACK-LINUX-NOT: whole-archive
711 // CHECK-SAFESTACK-LINUX: libclang_rt.safestack-x86_64.a"
712 // CHECK-SAFESTACK-LINUX: "-u" "__safestack_init"
713 // CHECK-SAFESTACK-LINUX: "-lpthread"
714 // CHECK-SAFESTACK-LINUX: "-ldl"
715 // CHECK-SAFESTACK-LINUX: "-lresolv"
717 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
718 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
719 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-X86-64 %s
720 // CHECK-SHADOWCALLSTACK-LINUX-X86-64-NOT: error:
722 // RUN: not %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
723 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld \
724 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64 %s
725 // CHECK-SHADOWCALLSTACK-LINUX-AARCH64: '-fsanitize=shadow-call-stack' only allowed with '-ffixed-x18'
727 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
728 // RUN: --target=riscv32-unknown-elf -fuse-ld=ld \
729 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-ELF-RISCV32 %s
730 // CHECK-SHADOWCALLSTACK-ELF-RISCV32-NOT: error:
732 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
733 // RUN: --target=riscv64-unknown-linux -fuse-ld=ld \
734 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-RISCV64 %s
735 // CHECK-SHADOWCALLSTACK-LINUX-RISCV64-NOT: error:
737 // RUN: %clang -target riscv64-linux-android -fsanitize=shadow-call-stack %s -### 2>&1 \
738 // RUN: | FileCheck %s --check-prefix=CHECK-SHADOWCALLSTACK-ANDROID-RISCV64
739 // CHECK-SHADOWCALLSTACK-ANDROID-RISCV64-NOT: error:
741 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
742 // RUN: --target=riscv64-unknown-fuchsia -fuse-ld=ld \
743 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-FUCHSIA-RISCV64 %s
744 // CHECK-SHADOWCALLSTACK-FUCHSIA-RISCV64-NOT: error:
746 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
747 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld -ffixed-x18 \
748 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
749 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
750 // RUN: --target=arm64-unknown-ios -fuse-ld=ld \
751 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
752 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
753 // RUN: --target=aarch64-unknown-linux-android -fuse-ld=ld \
754 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
755 // CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18-NOT: error:
757 // RUN: not %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
758 // RUN: --target=x86-unknown-linux -fuse-ld=ld \
759 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-X86 %s
760 // CHECK-SHADOWCALLSTACK-LINUX-X86: error: unsupported option '-fsanitize=shadow-call-stack' for target 'x86-unknown-linux'
762 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
763 // RUN: -fsanitize=safe-stack --target=x86_64-unknown-linux -fuse-ld=ld \
764 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-SAFESTACK %s
765 // CHECK-SHADOWCALLSTACK-SAFESTACK-NOT: error:
767 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
768 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
769 // RUN: -resource-dir=%S/Inputs/resource_dir \
770 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
771 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s
772 // CHECK-CFI-STATS-LINUX: "{{.*}}ld{{(.exe)?}}"
773 // CHECK-CFI-STATS-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.stats_client-x86_64.a" "--no-whole-archive"
774 // CHECK-CFI-STATS-LINUX-NOT: "--whole-archive"
775 // CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats-x86_64.a"
777 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
778 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
779 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
780 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-DARWIN %s
781 // CHECK-CFI-STATS-DARWIN: "{{.*}}ld{{(.exe)?}}"
782 // CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_client_osx.a"
783 // CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_osx_dynamic.dylib"
785 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
786 // RUN: --target=x86_64-pc-windows \
787 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
788 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN64 %s
789 // CHECK-CFI-STATS-WIN64: "--dependent-lib=clang_rt.stats_client{{(-x86_64)?}}.lib"
790 // CHECK-CFI-STATS-WIN64: "--dependent-lib=clang_rt.stats{{(-x86_64)?}}.lib"
791 // CHECK-CFI-STATS-WIN64: "--linker-option=/include:__sanitizer_stats_register"
793 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
794 // RUN: --target=i686-pc-windows \
795 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
796 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN32 %s
797 // CHECK-CFI-STATS-WIN32: "--dependent-lib=clang_rt.stats_client{{(-i386)?}}.lib"
798 // CHECK-CFI-STATS-WIN32: "--dependent-lib=clang_rt.stats{{(-i386)?}}.lib"
799 // CHECK-CFI-STATS-WIN32: "--linker-option=/include:___sanitizer_stats_register"
801 // RUN: %clang -### %s 2>&1 \
802 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
803 // RUN: --sysroot=%S/Inputs/basic_android_tree \
804 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
806 // CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
807 // CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack
809 // RUN: %clang -### %s -shared 2>&1 \
810 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
811 // RUN: --sysroot=%S/Inputs/basic_android_tree \
812 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-SHARED-ANDROID-ARM %s
814 // CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
815 // CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack
817 // RUN: %clang -### %s 2>&1 \
818 // RUN: --target=aarch64-linux-android -fuse-ld=ld -fsanitize=safe-stack \
819 // RUN: --sysroot=%S/Inputs/basic_android_tree \
820 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-AARCH64 %s
822 // CHECK-SAFESTACK-ANDROID-AARCH64: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
823 // CHECK-SAFESTACK-ANDROID-AARCH64-NOT: libclang_rt.safestack
825 // RUN: not %clang -fsanitize=undefined -### %s 2>&1 \
826 // RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
828 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS4 %s
829 // CHECK-UBSAN-PS4: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
830 // CHECK-UBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
831 // CHECK-UBSAN-PS4: -lSceDbgUBSanitizer_stub_weak
833 // RUN: not %clang -fsanitize=undefined -### %s 2>&1 \
834 // RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
836 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS5 %s
837 // CHECK-UBSAN-PS5: --dependent-lib=libSceUBSanitizer_nosubmission_stub_weak.a
838 // CHECK-UBSAN-PS5: "{{.*}}ld{{(.gold)?(.exe)?}}"
839 // CHECK-UBSAN-PS5: -lSceUBSanitizer_nosubmission_stub_weak
841 // RUN: not %clang -fsanitize=address -### %s 2>&1 \
842 // RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
844 // RUN: | FileCheck --check-prefix=CHECK-ASAN-PS4 %s
845 // CHECK-ASAN-PS4: --dependent-lib=libSceDbgAddressSanitizer_stub_weak.a
846 // CHECK-ASAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
847 // CHECK-ASAN-PS4: -lSceDbgAddressSanitizer_stub_weak
849 // RUN: not %clang -fsanitize=address -### %s 2>&1 \
850 // RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
852 // RUN: | FileCheck --check-prefix=CHECK-ASAN-PS5 %s
853 // CHECK-ASAN-PS5: --dependent-lib=libSceAddressSanitizer_nosubmission_stub_weak.a
854 // CHECK-ASAN-PS5: "{{.*}}ld{{(.gold)?(.exe)?}}"
855 // CHECK-ASAN-PS5: -lSceAddressSanitizer_nosubmission_stub_weak
857 // RUN: not %clang -fsanitize=address,undefined -### %s 2>&1 \
858 // RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
860 // RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS4 %s
861 // CHECK-AUBSAN-PS4-NOT: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
862 // CHECK-AUBSAN-PS4: --dependent-lib=libSceDbgAddressSanitizer_stub_weak.a
863 // CHECK-AUBSAN-PS4-NOT: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
864 // CHECK-AUBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
865 // CHECK-AUBSAN-PS4: -lSceDbgAddressSanitizer_stub_weak
867 // RUN: not %clang -fsanitize=address,undefined -### %s 2>&1 \
868 // RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
870 // RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS5 %s
871 // CHECK-AUBSAN-PS5-NOT: --dependent-lib=libSceUBSanitizer_nosubmission_stub_weak.a
872 // CHECK-AUBSAN-PS5: --dependent-lib=libSceAddressSanitizer_nosubmission_stub_weak.a
873 // CHECK-AUBSAN-PS5-NOT: --dependent-lib=libSceUBSanitizer_nosubmission_stub_weak.a
874 // CHECK-AUBSAN-PS5: "{{.*}}ld{{(.gold)?(.exe)?}}"
875 // CHECK-AUBSAN-PS5: -lSceAddressSanitizer_nosubmission_stub_weak
877 // RUN: not %clang -fsanitize=address,undefined -### %s 2>&1 \
878 // RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
881 // RUN: | FileCheck --check-prefix=CHECK-NOLIB-PS4 %s
882 // CHECK-NOLIB-PS4-NOT: SceDbgAddressSanitizer_stub_weak
884 // RUN: not %clang -fsanitize=address,undefined -### %s 2>&1 \
885 // RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
888 // RUN: | FileCheck --check-prefix=CHECK-NOLIB-PS5 %s
889 // CHECK-NOLIB-PS5-NOT: SceAddressSanitizer_nosubmission_stub_weak
891 // RUN: %clang -fsanitize=scudo -### %s 2>&1 \
892 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
893 // RUN: -resource-dir=%S/Inputs/resource_dir \
894 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
895 // RUN: | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s
896 // CHECK-SCUDO-LINUX: "{{.*}}ld{{(.exe)?}}"
897 // CHECK-SCUDO-LINUX: "-pie"
898 // CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone-i386.a" "--no-whole-archive"
899 // CHECK-SCUDO-LINUX-NOT: "-lstdc++"
900 // CHECK-SCUDO-LINUX: "-lpthread"
901 // CHECK-SCUDO-LINUX: "-ldl"
902 // CHECK-SCUDO-LINUX: "-lresolv"
904 // RUN: %clang -### %s -o %t.so -shared 2>&1 \
905 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=scudo -shared-libsan \
906 // RUN: -resource-dir=%S/Inputs/resource_dir \
907 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
908 // RUN: | FileCheck --check-prefix=CHECK-SCUDO-SHARED-LINUX %s
910 // CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
911 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lc"
912 // CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo_standalone-i386.a"
913 // CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo_standalone-i386.so"
914 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lpthread"
915 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lrt"
916 // CHECK-SCUDO-SHARED-LINUX-NOT: "-ldl"
917 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lresolv"
918 // CHECK-SCUDO-SHARED-LINUX-NOT: "--export-dynamic"
919 // CHECK-SCUDO-SHARED-LINUX-NOT: "--dynamic-list"
921 // RUN: %clang -### %s 2>&1 \
922 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
923 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
924 // RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID %s
926 // CHECK-SCUDO-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
927 // CHECK-SCUDO-ANDROID-NOT: "-lc"
928 // CHECK-SCUDO-ANDROID: "-pie"
929 // CHECK-SCUDO-ANDROID-NOT: "-lpthread"
930 // CHECK-SCUDO-ANDROID-NOT: "-lresolv"
931 // CHECK-SCUDO-ANDROID: libclang_rt.scudo_standalone-arm-android.so"
932 // CHECK-SCUDO-ANDROID-NOT: "-lpthread"
933 // CHECK-SCUDO-ANDROID-NOT: "-lresolv"
935 // RUN: %clang -### %s 2>&1 \
936 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
937 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
938 // RUN: -static-libsan \
939 // RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s
940 // CHECK-SCUDO-ANDROID-STATIC: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
941 // CHECK-SCUDO-ANDROID-STATIC: "-pie"
942 // CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone-arm-android.a" "--no-whole-archive"
943 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lstdc++"
944 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lpthread"
945 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lrt"
946 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lresolv"
948 // RUN: %clang -### %s 2>&1 \
949 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
950 // RUN: -resource-dir=%S/Inputs/resource_dir \
951 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
952 // RUN: | FileCheck --check-prefix=CHECK-HWASAN-X86-64-LINUX %s
954 // CHECK-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
955 // CHECK-HWASAN-X86-64-LINUX-NOT: "-lc"
956 // CHECK-HWASAN-X86-64-LINUX: libclang_rt.hwasan-x86_64.a"
957 // CHECK-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
958 // CHECK-HWASAN-X86-64-LINUX: "--dynamic-list={{.*}}libclang_rt.hwasan-x86_64.a.syms"
959 // CHECK-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
960 // CHECK-HWASAN-X86-64-LINUX: "-lpthread"
961 // CHECK-HWASAN-X86-64-LINUX: "-lrt"
962 // CHECK-HWASAN-X86-64-LINUX: "-ldl"
963 // CHECK-HWASAN-X86-64-LINUX: "-lresolv"
965 // RUN: %clang -### %s 2>&1 \
966 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
967 // RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
968 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
969 // RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-X86-64-LINUX %s
971 // CHECK-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
972 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
973 // CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan-x86_64.so"
974 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
975 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
976 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
977 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lresolv"
978 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
979 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "--dynamic-list"
981 // RUN: %clang -### %s -o %t.so -shared 2>&1 \
982 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
983 // RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
984 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
985 // RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-X86-64-LINUX %s
987 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
988 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
989 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan-x86_64.so"
990 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
991 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
992 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
993 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lresolv"
994 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
995 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "--dynamic-list"
997 // RUN: %clang -### %s 2>&1 \
998 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
999 // RUN: -resource-dir=%S/Inputs/resource_dir \
1000 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1001 // RUN: | FileCheck --check-prefix=CHECK-HWASAN-AARCH64-LINUX %s
1003 // CHECK-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
1004 // CHECK-HWASAN-AARCH64-LINUX-NOT: "-lc"
1005 // CHECK-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-aarch64.a"
1006 // CHECK-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
1007 // CHECK-HWASAN-AARCH64-LINUX: "--dynamic-list={{.*}}libclang_rt.hwasan-aarch64.a.syms"
1008 // CHECK-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
1009 // CHECK-HWASAN-AARCH64-LINUX: "-lpthread"
1010 // CHECK-HWASAN-AARCH64-LINUX: "-lrt"
1011 // CHECK-HWASAN-AARCH64-LINUX: "-ldl"
1012 // CHECK-HWASAN-AARCH64-LINUX: "-lresolv"
1014 // RUN: %clang -### %s 2>&1 \
1015 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
1016 // RUN: -shared-libsan \
1017 // RUN: -resource-dir=%S/Inputs/resource_dir \
1018 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1019 // RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-AARCH64-LINUX %s
1021 // CHECK-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
1022 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
1023 // CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-aarch64.so"
1024 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
1025 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
1026 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
1027 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lresolv"
1028 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
1029 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "--dynamic-list"
1031 // RUN: %clang -### %s -o %t.so -shared 2>&1 \
1032 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
1033 // RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
1034 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1035 // RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX %s
1037 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
1038 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
1039 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-aarch64.so"
1040 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
1041 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
1042 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
1043 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lresolv"
1044 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
1045 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "--dynamic-list"