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.a"
12 // CHECK-ASAN-LINUX-NOT: "--export-dynamic"
13 // CHECK-ASAN-LINUX: "--dynamic-list={{.*}}libclang_rt.asan.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_static-x86_64
27 // CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64
29 // RUN: %clang -fsanitize=address -fno-sanitize-link-runtime -### %s 2>&1 \
30 // RUN: --target=arm64e-apple-macosx -fuse-ld=ld \
31 // RUN: -resource-dir=%S/Inputs/resource_dir \
32 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
33 // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-DARWIN %s
35 // CHECK-ASAN-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.asan_static
36 // CHECK-ASAN-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.asan
38 // RUN: %clang -fsanitize=address -### %s 2>&1 \
39 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
40 // RUN: -resource-dir=%S/Inputs/resource_dir \
41 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
42 // RUN: | FileCheck --check-prefix=CHECK-ASAN-EXECUTABLE-LINUX %s
44 // CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan_static
45 // CHECK-ASAN-EXECUTABLE-LINUX: libclang_rt.asan
47 // RUN: %clang -fsanitize=address -shared -### %s 2>&1 \
48 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
49 // RUN: -resource-dir=%S/Inputs/resource_dir \
50 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
51 // RUN: | FileCheck --check-prefix=CHECK-ASAN-SHARED-LINUX %s
53 // CHECK-ASAN-SHARED-LINUX: libclang_rt.asan_static
54 // CHECK-ASAN-SHARED-LINUX-NOT: libclang_rt.asan
56 // RUN: %clang -### %s 2>&1 \
57 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
58 // RUN: -resource-dir=%S/Inputs/resource_dir \
59 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
60 // RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
62 // RUN: %clang -### %s 2>&1 \
63 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan \
64 // RUN: -resource-dir=%S/Inputs/resource_dir \
65 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
66 // RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
68 // RUN: %clang -### %s 2>&1 \
69 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address \
70 // RUN: -shared-libsan -static-libsan -shared-libasan \
71 // RUN: -resource-dir=%S/Inputs/resource_dir \
72 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
73 // RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
75 // CHECK-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
76 // CHECK-SHARED-ASAN-LINUX-NOT: "-lc"
77 // CHECK-SHARED-ASAN-LINUX-NOT: libclang_rt.asan.a"
78 // CHECK-SHARED-ASAN-LINUX: libclang_rt.asan.so"
79 // CHECK-SHARED-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-preinit.a" "--no-whole-archive"
80 // CHECK-SHARED-ASAN-LINUX-NOT: "-lpthread"
81 // CHECK-SHARED-ASAN-LINUX-NOT: "-lrt"
82 // CHECK-SHARED-ASAN-LINUX-NOT: "-ldl"
83 // CHECK-SHARED-ASAN-LINUX-NOT: "-lresolv"
84 // CHECK-SHARED-ASAN-LINUX-NOT: "--export-dynamic"
85 // CHECK-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
87 // RUN: %clang -### %s -o %t.so -shared 2>&1 \
88 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
89 // RUN: -resource-dir=%S/Inputs/resource_dir \
90 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
91 // RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s
93 // CHECK-DSO-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
94 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lc"
95 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: libclang_rt.asan.a"
96 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "libclang_rt.asan-preinit.a"
97 // CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan.so"
98 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lpthread"
99 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lrt"
100 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-ldl"
101 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lresolv"
102 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--export-dynamic"
103 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
105 // RUN: %clang -### %s 2>&1 \
106 // RUN: --target=i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
107 // RUN: -resource-dir=%S/Inputs/resource_dir \
108 // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
109 // RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s
111 // CHECK-ASAN-FREEBSD: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
112 // CHECK-ASAN-FREEBSD-NOT: "-lc"
113 // CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
114 // CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan.a"
115 // CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
116 // CHECK-ASAN-FREEBSD-NOT: "--dynamic-list"
117 // CHECK-ASAN-FREEBSD: "--export-dynamic"
118 // CHECK-ASAN-FREEBSD: "-lpthread"
119 // CHECK-ASAN-FREEBSD: "-lrt"
121 // RUN: %clang -### %s 2>&1 \
122 // RUN: --target=i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
123 // RUN: -resource-dir=%S/Inputs/resource_dir \
124 // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
125 // RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD-LDL %s
127 // CHECK-ASAN-FREEBSD-LDL: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
128 // CHECK-ASAN-FREEBSD-LDL-NOT: "-ldl"
130 // RUN: %clangxx -### %s 2>&1 \
131 // RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform -fsanitize=address \
132 // RUN: -resource-dir=%S/Inputs/empty_resource_dir \
133 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
134 // RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s
136 // CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
137 // CHECK-ASAN-LINUX-CXX-NOT: "-lc"
138 // CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
139 // CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx.a" "--no-whole-archive"
140 // CHECK-ASAN-LINUX-CXX-NOT: "--dynamic-list"
141 // CHECK-ASAN-LINUX-CXX: "--export-dynamic"
142 // CHECK-ASAN-LINUX-CXX: stdc++
143 // CHECK-ASAN-LINUX-CXX: "-lpthread"
144 // CHECK-ASAN-LINUX-CXX: "-lrt"
145 // CHECK-ASAN-LINUX-CXX: "-ldl"
146 // CHECK-ASAN-LINUX-CXX: "-lresolv"
148 // RUN: %clang -### %s -o /dev/null -fsanitize=address \
149 // RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
150 // RUN: -resource-dir=%S/Inputs/resource_dir \
151 // RUN: --sysroot=%S/Inputs/basic_linux_tree -lstdc++ -static 2>&1 \
152 // RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX-STATIC %s
154 // CHECK-ASAN-LINUX-CXX-STATIC: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
155 // CHECK-ASAN-LINUX-CXX-STATIC-NOT: stdc++
156 // CHECK-ASAN-LINUX-CXX-STATIC: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
157 // CHECK-ASAN-LINUX-CXX-STATIC: stdc++
159 // RUN: %clang -### %s 2>&1 \
160 // RUN: --target=arm-linux-gnueabi -fuse-ld=ld -fsanitize=address \
161 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
162 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s
164 // CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
165 // CHECK-ASAN-ARM-NOT: "-lc"
166 // CHECK-ASAN-ARM: libclang_rt.asan.a"
168 // RUN: %clang -### %s 2>&1 \
169 // RUN: --target=armv7l-linux-gnueabi -fuse-ld=ld -fsanitize=address \
170 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
171 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s
173 // CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
174 // CHECK-ASAN-ARMv7-NOT: "-lc"
175 // CHECK-ASAN-ARMv7: libclang_rt.asan.a"
177 // RUN: %clang -### %s 2>&1 \
178 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
179 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
180 // RUN: -resource-dir=%S/Inputs/resource_dir \
181 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
183 // CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
184 // CHECK-ASAN-ANDROID: "-pie"
185 // CHECK-ASAN-ANDROID-NOT: "-lc"
186 // CHECK-ASAN-ANDROID-NOT: "-lpthread"
187 // CHECK-ASAN-ANDROID-NOT: "-lresolv"
188 // CHECK-ASAN-ANDROID: libclang_rt.asan.so"
189 // CHECK-ASAN-ANDROID-NOT: "-lpthread"
190 // CHECK-ASAN-ANDROID-NOT: "-lresolv"
192 // RUN: %clang -### %s 2>&1 \
193 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
194 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
195 // RUN: -resource-dir=%S/Inputs/resource_dir \
196 // RUN: -static-libsan \
197 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s
199 // RUN: %clang -### %s 2>&1 \
200 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
201 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
202 // RUN: -resource-dir=%S/Inputs/resource_dir \
203 // RUN: -static-libasan \
204 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s
206 // CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
207 // CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan.a"
208 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
209 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
210 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
212 // RUN: %clang -### %s 2>&1 \
213 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
214 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
215 // RUN: -resource-dir=%S/Inputs/resource_dir \
216 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s
218 // CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
219 // CHECK-UBSAN-ANDROID: "-pie"
220 // CHECK-UBSAN-ANDROID-NOT: "-lc"
221 // CHECK-UBSAN-ANDROID-NOT: "-lpthread"
222 // CHECK-UBSAN-ANDROID-NOT: "-lresolv"
223 // CHECK-UBSAN-ANDROID: libclang_rt.ubsan_standalone.so"
224 // CHECK-UBSAN-ANDROID-NOT: "-lpthread"
225 // CHECK-UBSAN-ANDROID-NOT: "-lresolv"
227 // RUN: %clang -### %s 2>&1 \
228 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
229 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
230 // RUN: -resource-dir=%S/Inputs/resource_dir \
231 // RUN: -static-libsan \
232 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s
234 // CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
235 // CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone.a"
236 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
237 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
238 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lresolv"
241 // RUN: %clang -### %s 2>&1 \
242 // RUN: --target=i686-linux-android -fuse-ld=ld -fsanitize=address \
243 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
244 // RUN: -resource-dir=%S/Inputs/resource_dir \
245 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s
247 // CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
248 // CHECK-ASAN-ANDROID-X86: "-pie"
249 // CHECK-ASAN-ANDROID-X86-NOT: "-lc"
250 // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
251 // CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
252 // CHECK-ASAN-ANDROID-X86: libclang_rt.asan.so"
253 // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
254 // CHECK-ASAN-ANDROID-X86-NOT: "-lresolv"
256 // RUN: %clang -### %s 2>&1 \
257 // RUN: --target=arm-linux-androideabi -fsanitize=address \
258 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
259 // RUN: -shared-libsan \
260 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED-LIBASAN %s
262 // CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libsan'
264 // RUN: %clang -### %s 2>&1 \
265 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
266 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
267 // RUN: -resource-dir=%S/Inputs/resource_dir \
269 // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
271 // CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
272 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lc"
273 // CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan.so"
274 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
275 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lresolv"
277 // RUN: %clangxx -### %s 2>&1 \
278 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \
279 // RUN: -fsanitize=thread \
280 // RUN: -resource-dir=%S/Inputs/resource_dir \
281 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
282 // RUN: | FileCheck --check-prefix=CHECK-TSAN-LINUX-CXX %s
284 // CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
285 // CHECK-TSAN-LINUX-CXX-NOT: stdc++
286 // CHECK-TSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan.a" "--no-whole-archive"
287 // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan.a.syms"
288 // CHECK-TSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan_cxx.a" "--no-whole-archive"
289 // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan_cxx.a.syms"
290 // CHECK-TSAN-LINUX-CXX-NOT: "--export-dynamic"
291 // CHECK-TSAN-LINUX-CXX: stdc++
292 // CHECK-TSAN-LINUX-CXX: "-lpthread"
293 // CHECK-TSAN-LINUX-CXX: "-lrt"
294 // CHECK-TSAN-LINUX-CXX: "-ldl"
295 // CHECK-TSAN-LINUX-CXX: "-lresolv"
297 // RUN: %clang -fsanitize=thread -fno-sanitize-link-runtime -### %s 2>&1 \
298 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
299 // RUN: -resource-dir=%S/Inputs/resource_dir \
300 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
301 // RUN: | FileCheck --check-prefix=CHECK-TSAN-NO-LINK-RUNTIME-LINUX %s
303 // CHECK-TSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.tsan
305 // RUN: not %clang -fsanitize=thread -fno-sanitize-link-runtime -### %s 2>&1 \
306 // RUN: --target=arm64e-apple-ios -fuse-ld=ld \
307 // RUN: -resource-dir=%S/Inputs/resource_dir \
308 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
309 // RUN: | FileCheck --check-prefix=CHECK-TSAN-NO-LINK-RUNTIME-DARWIN %s
311 // CHECK-TSAN-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.tsan
313 // RUN: %clangxx -### %s 2>&1 \
314 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \
315 // RUN: -fsanitize=memory \
316 // RUN: -resource-dir=%S/Inputs/resource_dir \
317 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
318 // RUN: | FileCheck --check-prefix=CHECK-MSAN-LINUX-CXX %s
320 // CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
321 // CHECK-MSAN-LINUX-CXX-NOT: stdc++
322 // CHECK-MSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan.a" "--no-whole-archive"
323 // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan.a.syms"
324 // CHECK-MSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan_cxx.a" "--no-whole-archive"
325 // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan_cxx.a.syms"
326 // CHECK-MSAN-LINUX-CXX-NOT: "--export-dynamic"
327 // CHECK-MSAN-LINUX-CXX: stdc++
328 // CHECK-MSAN-LINUX-CXX: "-lpthread"
329 // CHECK-MSAN-LINUX-CXX: "-lrt"
330 // CHECK-MSAN-LINUX-CXX: "-ldl"
331 // CHECK-MSAN-LINUX-CXX: "-lresolv"
333 // RUN: %clang -fsanitize=memory -fno-sanitize-link-runtime -### %s 2>&1 \
334 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
335 // RUN: -resource-dir=%S/Inputs/resource_dir \
336 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
337 // RUN: | FileCheck --check-prefix=CHECK-MSAN-NO-LINK-RUNTIME-LINUX %s
339 // CHECK-MSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.msan
341 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
342 // RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
343 // RUN: -resource-dir=%S/Inputs/resource_dir \
344 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
345 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
347 // RUN: %clang -fsanitize=float-divide-by-zero -### %s 2>&1 \
348 // RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
349 // RUN: -resource-dir=%S/Inputs/resource_dir \
350 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
351 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
353 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
354 // RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \
355 // RUN: -resource-dir=%S/Inputs/resource_dir \
356 // RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
357 // RUN: -static-libsan \
358 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
360 // CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
361 // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
362 // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
363 // CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
364 // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
365 // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
366 // CHECK-UBSAN-LINUX-NOT: "-lstdc++"
367 // CHECK-UBSAN-LINUX: "-lpthread"
368 // CHECK-UBSAN-LINUX: "-lresolv"
370 // RUN: %clang -fsanitize=undefined -fno-sanitize-link-runtime -### %s 2>&1 \
371 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
372 // RUN: -resource-dir=%S/Inputs/resource_dir \
373 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
374 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-NO-LINK-RUNTIME-LINUX %s
376 // CHECK-UBSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.undefined
378 // RUN: %clang -fsanitize=undefined -fno-sanitize-link-runtime -### %s 2>&1 \
379 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
380 // RUN: -resource-dir=%S/Inputs/resource_dir \
381 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
382 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-NO-LINK-RUNTIME-DARWIN %s
384 // CHECK-UBSAN-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.ubsan
386 // RUN: %clang -fsanitize=fuzzer -fno-sanitize-link-runtime -### %s 2>&1 \
387 // RUN: --target=arm64e-apple-watchos -fuse-ld=ld \
388 // RUN: -resource-dir=%S/Inputs/resource_dir \
389 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
390 // RUN: | FileCheck --check-prefix=CHECK-FUZZER-NO-LINK-RUNTIME-DARWIN %s
392 // CHECK-FUZZER-NO-LINK-RUNTIME-DARWIN-NOT: libclang_rt.fuzzer
394 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
395 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
396 // RUN: -resource-dir=%S/Inputs/resource_dir \
397 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
398 // RUN: -shared-libsan \
399 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
401 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
402 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
403 // RUN: -resource-dir=%S/Inputs/resource_dir \
404 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
405 // RUN: -static-libsan -shared-libsan \
406 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
408 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
409 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
410 // RUN: -resource-dir=%S/Inputs/resource_dir \
411 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
412 // RUN: -shared -shared-libsan \
413 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
415 // CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}ld{{(.exe)?}}"
416 // CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}libclang_rt.ubsan_standalone.so{{.*}}"
418 // RUN: %clang -fsanitize=undefined -fsanitize-link-c++-runtime -### %s 2>&1 \
419 // RUN: --target=i386-unknown-linux \
420 // RUN: -resource-dir=%S/Inputs/resource_dir \
421 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
422 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s
423 // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
424 // CHECK-UBSAN-LINUX-LINK-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx.a" "--no-whole-archive"
425 // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
427 // RUN: %clangxx -fsanitize=undefined -### %s 2>&1 \
428 // RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
429 // RUN: -resource-dir=%S/Inputs/resource_dir \
430 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
431 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s
432 // CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
433 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
434 // CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
435 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
436 // CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx.a" "--no-whole-archive"
437 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
438 // CHECK-UBSAN-LINUX-CXX: "-lstdc++"
439 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
440 // CHECK-UBSAN-LINUX-CXX: "-lpthread"
441 // CHECK-UBSAN-LINUX-CXX: "-lresolv"
443 // RUN: %clang -fsanitize=undefined -fsanitize-minimal-runtime -### %s 2>&1 \
444 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
445 // RUN: -resource-dir=%S/Inputs/resource_dir \
446 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
447 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-LINUX %s
448 // CHECK-UBSAN-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}"
449 // CHECK-UBSAN-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_minimal.a" "--no-whole-archive"
450 // CHECK-UBSAN-MINIMAL-LINUX: "-lpthread"
451 // CHECK-UBSAN-MINIMAL-LINUX: "-lresolv"
453 // RUN: %clang -fsanitize=undefined -fsanitize-minimal-runtime -### %s 2>&1 \
454 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
455 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
456 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-DARWIN %s
457 // CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}ld{{(.exe)?}}"
458 // CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}libclang_rt.ubsan_minimal_osx_dynamic.dylib"
460 // RUN: not %clang -fsanitize=undefined -### %s 2>&1 \
461 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld -static-libsan \
462 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
463 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-STATIC-DARWIN %s
464 // CHECK-UBSAN-STATIC-DARWIN: {{.*}}error: static UndefinedBehaviorSanitizer runtime is not supported on darwin
466 // RUN: not %clang -fsanitize=address -### %s 2>&1 \
467 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld -static-libsan \
468 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
469 // RUN: | FileCheck --check-prefix=CHECK-ASAN-STATIC-DARWIN %s
470 // CHECK-ASAN-STATIC-DARWIN: {{.*}}error: static AddressSanitizer runtime is not supported on darwin
472 // RUN: not %clang -fsanitize=thread -### %s 2>&1 \
473 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld -static-libsan \
474 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
475 // RUN: | FileCheck --check-prefix=CHECK-TSAN-STATIC-DARWIN %s
476 // CHECK-TSAN-STATIC-DARWIN: {{.*}}error: static ThreadSanitizer runtime is not supported on darwin
478 // RUN: %clang -fsanitize=address,undefined -### %s 2>&1 \
479 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
480 // RUN: -resource-dir=%S/Inputs/resource_dir \
481 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
482 // RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX %s
483 // CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
484 // CHECK-ASAN-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
485 // CHECK-ASAN-UBSAN-LINUX-NOT: libclang_rt.ubsan
486 // CHECK-ASAN-UBSAN-LINUX-NOT: "-lstdc++"
487 // CHECK-ASAN-UBSAN-LINUX: "-lpthread"
488 // CHECK-ASAN-UBSAN-LINUX: "-lresolv"
490 // RUN: %clangxx -fsanitize=address,undefined -### %s 2>&1 \
491 // RUN: --target=i386-unknown-linux -fuse-ld=ld -stdlib=platform \
492 // RUN: -resource-dir=%S/Inputs/resource_dir \
493 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
494 // RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s
495 // CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
496 // CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
497 // CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx.a" "--no-whole-archive"
498 // CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
499 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lstdc++"
500 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread"
501 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lresolv"
503 // RUN: %clangxx -fsanitize=memory,undefined -### %s 2>&1 \
504 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
505 // RUN: -resource-dir=%S/Inputs/resource_dir \
506 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
507 // RUN: | FileCheck --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX %s
508 // CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
509 // CHECK-MSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan.a" "--no-whole-archive"
510 // CHECK-MSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
512 // RUN: %clangxx -fsanitize=thread,undefined -### %s 2>&1 \
513 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
514 // RUN: -resource-dir=%S/Inputs/resource_dir \
515 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
516 // RUN: | FileCheck --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX %s
517 // CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
518 // CHECK-TSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan.a" "--no-whole-archive"
519 // CHECK-TSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
521 // RUN: %clang -fsanitize=undefined -### %s 2>&1 \
522 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
523 // RUN: -resource-dir=%S/Inputs/resource_dir \
524 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
526 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHARED %s
527 // CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}"
528 // CHECK-UBSAN-LINUX-SHARED-NOT: --export-dynamic
529 // CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list
530 // CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan
532 // RUN: %clang -### %s 2>&1 \
533 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak \
534 // RUN: -resource-dir=%S/Inputs/resource_dir \
535 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
536 // RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s
538 // CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
539 // CHECK-LSAN-LINUX-NOT: "-lc"
540 // CHECK-LSAN-LINUX-NOT: libclang_rt.ubsan
541 // CHECK-LSAN-LINUX: libclang_rt.lsan.a"
542 // CHECK-LSAN-LINUX: "-lpthread"
543 // CHECK-LSAN-LINUX: "-ldl"
544 // CHECK-LSAN-LINUX: "-lresolv"
546 // RUN: %clang -fsanitize=leak -fno-sanitize-link-runtime -### %s 2>&1 \
547 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
548 // RUN: -resource-dir=%S/Inputs/resource_dir \
549 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
550 // RUN: | FileCheck --check-prefix=CHECK-LSAN-NO-LINK-RUNTIME-LINUX %s
552 // CHECK-LSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.lsan
554 // RUN: %clang -### %s 2>&1 \
555 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak -fsanitize-coverage=func \
556 // RUN: -resource-dir=%S/Inputs/resource_dir \
557 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
558 // RUN: | FileCheck --check-prefix=CHECK-LSAN-COV-LINUX %s
560 // CHECK-LSAN-COV-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
561 // CHECK-LSAN-COV-LINUX-NOT: "-lc"
562 // CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan
563 // CHECK-LSAV-COV-LINUX: libclang_rt.lsan-x86_64.a"
564 // CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan
565 // CHECK-LSAN-COV-LINUX: "-lpthread"
566 // CHECK-LSAN-COV-LINUX: "-ldl"
567 // CHECK-LSAN-COV-LINUX: "-lresolv"
569 // RUN: %clang -fsanitize=leak,address -### %s 2>&1 \
570 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
571 // RUN: -resource-dir=%S/Inputs/resource_dir \
572 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
573 // RUN: | FileCheck --check-prefix=CHECK-LSAN-ASAN-LINUX %s
574 // CHECK-LSAN-ASAN-LINUX: "{{.*}}ld{{(.exe)?}}"
575 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan
576 // CHECK-LSAN-ASAN-LINUX: libclang_rt.asan
577 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan
579 // RUN: %clang -fsanitize=address -fsanitize-coverage=func -### %s 2>&1 \
580 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
581 // RUN: -resource-dir=%S/Inputs/resource_dir \
582 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
583 // RUN: | FileCheck --check-prefix=CHECK-ASAN-COV-LINUX %s
584 // CHECK-ASAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
585 // CHECK-ASAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive"
586 // CHECK-ASAN-COV-LINUX-NOT: libclang_rt.ubsan
587 // CHECK-ASAN-COV-LINUX-NOT: "-lstdc++"
588 // CHECK-ASAN-COV-LINUX: "-lpthread"
589 // CHECK-ASAN-COV-LINUX: "-lresolv"
591 // RUN: %clang -fsanitize=memory -fsanitize-coverage=func -### %s 2>&1 \
592 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
593 // RUN: -resource-dir=%S/Inputs/resource_dir \
594 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
595 // RUN: | FileCheck --check-prefix=CHECK-MSAN-COV-LINUX %s
596 // CHECK-MSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
597 // CHECK-MSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.msan.a" "--no-whole-archive"
598 // CHECK-MSAN-COV-LINUX-NOT: libclang_rt.ubsan
599 // CHECK-MSAN-COV-LINUX-NOT: "-lstdc++"
600 // CHECK-MSAN-COV-LINUX: "-lpthread"
601 // CHECK-MSAN-COV-LINUX: "-lresolv"
603 // RUN: %clang -fsanitize=dataflow -fsanitize-coverage=func -### %s 2>&1 \
604 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
605 // RUN: -resource-dir=%S/Inputs/resource_dir \
606 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
607 // RUN: | FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX %s
608 // CHECK-DFSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
609 // CHECK-DFSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.dfsan.a" "--no-whole-archive"
610 // CHECK-DFSAN-COV-LINUX-NOT: libclang_rt.ubsan
611 // CHECK-DFSAN-COV-LINUX-NOT: "-lstdc++"
612 // CHECK-DFSAN-COV-LINUX: "-lpthread"
613 // CHECK-DFSAN-COV-LINUX: "-lresolv"
615 // RUN: %clang -fsanitize=undefined -fsanitize-coverage=func -### %s 2>&1 \
616 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
617 // RUN: -resource-dir=%S/Inputs/resource_dir \
618 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
619 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX %s
620 // CHECK-UBSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
621 // CHECK-UBSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
622 // CHECK-UBSAN-COV-LINUX-NOT: "-lstdc++"
623 // CHECK-UBSAN-COV-LINUX: "-lpthread"
624 // CHECK-UBSAN-COV-LINUX: "-lresolv"
626 // RUN: %clang -fsanitize-coverage=func -### %s 2>&1 \
627 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
628 // RUN: -resource-dir=%S/Inputs/resource_dir \
629 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
630 // RUN: | FileCheck --check-prefix=CHECK-COV-LINUX %s
631 // CHECK-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
632 // CHECK-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
633 // CHECK-COV-LINUX-NOT: "-lstdc++"
634 // CHECK-COV-LINUX: "-lpthread"
635 // CHECK-COV-LINUX: "-lresolv"
637 // RUN: %clang -### %s 2>&1 \
638 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=numerical \
639 // RUN: -resource-dir=%S/Inputs/resource_dir \
640 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
641 // RUN: | FileCheck --check-prefix=CHECK-NSAN-LINUX %s
643 // CHECK-NSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
644 // CHECK-NSAN-LINUX-NOT: "-lc"
645 // CHECK-NSAN-LINUX-NOT: libclang_rt.ubsan
646 // CHECK-NSAN-LINUX: libclang_rt.nsan.a"
647 // CHECK-NSAN-LINUX: "-lpthread" "-lrt" "-lm" "-ldl" "-lresolv"
649 // RUN: %clang -### %s 2>&1 --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=numerical -shared-libsan \
650 // RUN: -resource-dir=%S/Inputs/resource_dir \
651 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
652 // RUN: | FileCheck --check-prefix=CHECK-NSAN-SHARED-LINUX %s
654 // CHECK-NSAN-SHARED-LINUX: libclang_rt.nsan.so"
655 // CHECK-NSAN-SHARED-LINUX-NOT: "-lpthread"
656 // CHECK-NSAN-SHARED-LINUX-NOT: "-ldl"
657 // CHECK-NSAN-SHARED-LINUX-NOT: "--dynamic-list
659 // RUN: %clang -### %s 2>&1 --target=x86_64-unknown-linux -fsanitize=numerical,undefined \
660 // RUN: -resource-dir=%S/Inputs/resource_dir \
661 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
662 // RUN: | FileCheck --check-prefix=CHECK-NSAN-UBSAN %s
664 // CHECK-NSAN-UBSAN: "--whole-archive" "{{[^"]*}}libclang_rt.nsan.a" "--no-whole-archive"
665 // CHECK-NSAN-UBSAN-NOT: libclang_rt.ubsan
667 // CFI by itself does not link runtime libraries.
668 // RUN: not %clang -fsanitize=cfi -### %s 2>&1 \
669 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -rtlib=platform \
670 // RUN: -resource-dir=%S/Inputs/resource_dir \
671 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
672 // RUN: | FileCheck --check-prefix=CHECK-CFI-LINUX %s
673 // CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}"
674 // CHECK-CFI-LINUX-NOT: libclang_rt.
676 // CFI with diagnostics links the UBSan runtime.
677 // RUN: not %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
678 // RUN: -### %s 2>&1\
679 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
680 // RUN: -resource-dir=%S/Inputs/resource_dir \
681 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
682 // RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s
683 // CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
684 // CHECK-CFI-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
686 // Cross-DSO CFI links the CFI runtime.
687 // RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
688 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
689 // RUN: -resource-dir=%S/Inputs/resource_dir \
690 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
691 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s
692 // CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}"
693 // CHECK-CFI-CROSS-DSO-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi.a" "--no-whole-archive"
694 // CHECK-CFI-CROSS-DSO-LINUX: -export-dynamic
696 // Cross-DSO CFI with diagnostics links just the CFI runtime.
697 // RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
698 // RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
699 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
700 // RUN: -resource-dir=%S/Inputs/resource_dir \
701 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
702 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s
703 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
704 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi_diag.a" "--no-whole-archive"
705 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: -export-dynamic
707 // Cross-DSO CFI on Android does not link runtime libraries.
708 // RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
709 // RUN: --target=aarch64-linux-android -fuse-ld=ld \
710 // RUN: -resource-dir=%S/Inputs/resource_dir \
711 // RUN: --sysroot=%S/Inputs/basic_android_tree \
712 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-ANDROID %s
713 // CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld{{(.exe)?}}"
714 // CHECK-CFI-CROSS-DSO-ANDROID-NOT: libclang_rt.cfi
716 // Cross-DSO CFI with diagnostics on Android links just the UBSAN runtime.
717 // RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso -### %s 2>&1 \
718 // RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
719 // RUN: --target=aarch64-linux-android -fuse-ld=ld \
720 // RUN: -resource-dir=%S/Inputs/resource_dir \
721 // RUN: --sysroot=%S/Inputs/basic_android_tree \
722 // RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s
723 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld{{(.exe)?}}"
724 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone.so"
725 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "--export-dynamic-symbol=__cfi_check"
727 // RUN: %clangxx -fsanitize=address -### %s 2>&1 \
728 // RUN: -mmacos-version-min=10.6 \
729 // RUN: --target=x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
730 // RUN: -resource-dir=%S/Inputs/resource_dir \
731 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
732 // RUN: | FileCheck --check-prefix=CHECK-ASAN-DARWIN106-CXX %s
733 // CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
734 // CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib
735 // CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi
737 // RUN: %clangxx -fsanitize=leak -### %s 2>&1 \
738 // RUN: -mmacos-version-min=10.6 \
739 // RUN: --target=x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
740 // RUN: -resource-dir=%S/Inputs/resource_dir \
741 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
742 // RUN: | FileCheck --check-prefix=CHECK-LSAN-DARWIN106-CXX %s
743 // CHECK-LSAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
744 // CHECK-LSAN-DARWIN106-CXX: libclang_rt.lsan_osx_dynamic.dylib
745 // CHECK-LSAN-DARWIN106-CXX-NOT: -lc++abi
747 // RUN: %clang -### %s 2>&1 \
748 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
749 // RUN: -resource-dir=%S/Inputs/resource_dir \
750 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
751 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s
753 // CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
754 // CHECK-SAFESTACK-LINUX-NOT: "-lc"
755 // CHECK-SAFESTACK-LINUX-NOT: whole-archive
756 // CHECK-SAFESTACK-LINUX: "-u" "__safestack_init"
757 // CHECK-SAFESTACK-LINUX: libclang_rt.safestack.a"
758 // CHECK-SAFESTACK-LINUX: "-lpthread"
759 // CHECK-SAFESTACK-LINUX: "-ldl"
760 // CHECK-SAFESTACK-LINUX: "-lresolv"
762 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
763 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
764 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-X86-64 %s
765 // CHECK-SHADOWCALLSTACK-LINUX-X86-64-NOT: error:
767 // RUN: not %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
768 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld \
769 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64 %s
770 // CHECK-SHADOWCALLSTACK-LINUX-AARCH64: '-fsanitize=shadow-call-stack' only allowed with '-ffixed-x18'
772 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
773 // RUN: --target=riscv32-unknown-elf -fuse-ld=ld \
774 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-ELF-RISCV32 %s
775 // CHECK-SHADOWCALLSTACK-ELF-RISCV32-NOT: error:
777 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
778 // RUN: --target=riscv64-unknown-linux -fuse-ld=ld \
779 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-RISCV64 %s
780 // CHECK-SHADOWCALLSTACK-LINUX-RISCV64-NOT: error:
782 // RUN: %clang -target riscv64-linux-android -fsanitize=shadow-call-stack %s -### 2>&1 \
783 // RUN: | FileCheck %s --check-prefix=CHECK-SHADOWCALLSTACK-ANDROID-RISCV64
784 // CHECK-SHADOWCALLSTACK-ANDROID-RISCV64-NOT: error:
786 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
787 // RUN: --target=riscv64-unknown-fuchsia -fuse-ld=ld \
788 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-FUCHSIA-RISCV64 %s
789 // CHECK-SHADOWCALLSTACK-FUCHSIA-RISCV64-NOT: error:
791 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
792 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld -ffixed-x18 \
793 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
794 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
795 // RUN: --target=arm64-unknown-ios -fuse-ld=ld \
796 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
797 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
798 // RUN: --target=aarch64-unknown-linux-android -fuse-ld=ld \
799 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
800 // CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18-NOT: error:
802 // RUN: not %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
803 // RUN: --target=x86-unknown-linux -fuse-ld=ld \
804 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-X86 %s
805 // CHECK-SHADOWCALLSTACK-LINUX-X86: error: unsupported option '-fsanitize=shadow-call-stack' for target 'x86-unknown-linux'
807 // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \
808 // RUN: -fsanitize=safe-stack --target=x86_64-unknown-linux -fuse-ld=ld \
809 // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-SAFESTACK %s
810 // CHECK-SHADOWCALLSTACK-SAFESTACK-NOT: error:
812 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
813 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
814 // RUN: -resource-dir=%S/Inputs/resource_dir \
815 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
816 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s
817 // CHECK-CFI-STATS-LINUX: "{{.*}}ld{{(.exe)?}}"
818 // CHECK-CFI-STATS-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.stats_client.a" "--no-whole-archive"
819 // CHECK-CFI-STATS-LINUX-NOT: "--whole-archive"
820 // CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats.a"
822 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
823 // RUN: --target=x86_64-apple-darwin -fuse-ld=ld \
824 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
825 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-DARWIN %s
826 // CHECK-CFI-STATS-DARWIN: "{{.*}}ld{{(.exe)?}}"
827 // CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_client_osx.a"
828 // CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_osx_dynamic.dylib"
830 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
831 // RUN: --target=x86_64-pc-windows \
832 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
833 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN64 %s
834 // CHECK-CFI-STATS-WIN64: "--dependent-lib=clang_rt.stats_client{{(-x86_64)?}}.lib"
835 // CHECK-CFI-STATS-WIN64: "--dependent-lib=clang_rt.stats{{(-x86_64)?}}.lib"
836 // CHECK-CFI-STATS-WIN64: "--linker-option=/include:__sanitizer_stats_register"
838 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
839 // RUN: --target=i686-pc-windows \
840 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
841 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN32 %s
842 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
843 // RUN: --target=i686-pc-windows \
844 // RUN: -fno-rtlib-defaultlib \
845 // RUN: -frtlib-defaultlib \
846 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
847 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN32 %s
848 // CHECK-CFI-STATS-WIN32: "--dependent-lib=clang_rt.stats_client{{(-i386)?}}.lib"
849 // CHECK-CFI-STATS-WIN32: "--dependent-lib=clang_rt.stats{{(-i386)?}}.lib"
850 // CHECK-CFI-STATS-WIN32: "--linker-option=/include:___sanitizer_stats_register"
852 // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \
853 // RUN: --target=i686-pc-windows \
854 // RUN: -fno-rtlib-defaultlib \
855 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
856 // RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-WIN32-NODEF %s
857 // CHECK-CFI-STATS-WIN32-NODEF-NOT: "--dependent-lib=clang_rt.stats_client{{(-i386)?}}.lib"
858 // CHECK-CFI-STATS-WIN32-NODEF-NOT: "--dependent-lib=clang_rt.stats{{(-i386)?}}.lib"
860 // RUN: %clang -### %s 2>&1 \
861 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
862 // RUN: --sysroot=%S/Inputs/basic_android_tree \
863 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
865 // CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
866 // CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack
868 // RUN: %clang -### %s -shared 2>&1 \
869 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
870 // RUN: --sysroot=%S/Inputs/basic_android_tree \
871 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-SHARED-ANDROID-ARM %s
873 // CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
874 // CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack
876 // RUN: %clang -### %s 2>&1 \
877 // RUN: --target=aarch64-linux-android -fuse-ld=ld -fsanitize=safe-stack \
878 // RUN: --sysroot=%S/Inputs/basic_android_tree \
879 // RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-AARCH64 %s
881 // CHECK-SAFESTACK-ANDROID-AARCH64: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
882 // CHECK-SAFESTACK-ANDROID-AARCH64-NOT: libclang_rt.safestack
884 // RUN: not %clang -fsanitize=undefined -### %s 2>&1 \
885 // RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
887 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS4 %s
888 // CHECK-UBSAN-PS4: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
889 // CHECK-UBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
890 // CHECK-UBSAN-PS4: -lSceDbgUBSanitizer_stub_weak
892 // RUN: not %clang -fsanitize=undefined -### %s 2>&1 \
893 // RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
895 // RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS5 %s
896 // CHECK-UBSAN-PS5: --dependent-lib=libSceUBSanitizer_nosubmission_stub_weak.a
897 // CHECK-UBSAN-PS5: "{{.*}}ld{{(.gold)?(.exe)?}}"
898 // CHECK-UBSAN-PS5: -lSceUBSanitizer_nosubmission_stub_weak
900 // RUN: not %clang -fsanitize=address -### %s 2>&1 \
901 // RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
903 // RUN: | FileCheck --check-prefix=CHECK-ASAN-PS4 %s
904 // CHECK-ASAN-PS4: --dependent-lib=libSceDbgAddressSanitizer_stub_weak.a
905 // CHECK-ASAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
906 // CHECK-ASAN-PS4: -lSceDbgAddressSanitizer_stub_weak
908 // RUN: not %clang -fsanitize=address -### %s 2>&1 \
909 // RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
911 // RUN: | FileCheck --check-prefix=CHECK-ASAN-PS5 %s
912 // CHECK-ASAN-PS5: --dependent-lib=libSceAddressSanitizer_nosubmission_stub_weak.a
913 // CHECK-ASAN-PS5: "{{.*}}ld{{(.gold)?(.exe)?}}"
914 // CHECK-ASAN-PS5: -lSceAddressSanitizer_nosubmission_stub_weak
916 // RUN: not %clang -fsanitize=address,undefined -### %s 2>&1 \
917 // RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
919 // RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS4 %s
920 // CHECK-AUBSAN-PS4-NOT: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
921 // CHECK-AUBSAN-PS4: --dependent-lib=libSceDbgAddressSanitizer_stub_weak.a
922 // CHECK-AUBSAN-PS4-NOT: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
923 // CHECK-AUBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
924 // CHECK-AUBSAN-PS4: -lSceDbgAddressSanitizer_stub_weak
926 // RUN: not %clang -fsanitize=address,undefined -### %s 2>&1 \
927 // RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
929 // RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS5 %s
930 // CHECK-AUBSAN-PS5-NOT: --dependent-lib=libSceUBSanitizer_nosubmission_stub_weak.a
931 // CHECK-AUBSAN-PS5: --dependent-lib=libSceAddressSanitizer_nosubmission_stub_weak.a
932 // CHECK-AUBSAN-PS5-NOT: --dependent-lib=libSceUBSanitizer_nosubmission_stub_weak.a
933 // CHECK-AUBSAN-PS5: "{{.*}}ld{{(.gold)?(.exe)?}}"
934 // CHECK-AUBSAN-PS5: -lSceAddressSanitizer_nosubmission_stub_weak
936 // RUN: not %clang -fsanitize=address,undefined -### %s 2>&1 \
937 // RUN: --target=x86_64-scei-ps4 -fuse-ld=ld \
940 // RUN: | FileCheck --check-prefix=CHECK-NOLIB-PS4 %s
941 // CHECK-NOLIB-PS4-NOT: SceDbgAddressSanitizer_stub_weak
943 // RUN: not %clang -fsanitize=address,undefined -### %s 2>&1 \
944 // RUN: --target=x86_64-sie-ps5 -fuse-ld=ld \
947 // RUN: | FileCheck --check-prefix=CHECK-NOLIB-PS5 %s
948 // CHECK-NOLIB-PS5-NOT: SceAddressSanitizer_nosubmission_stub_weak
950 // RUN: %clang -fsanitize=scudo -### %s 2>&1 \
951 // RUN: --target=i386-unknown-linux -fuse-ld=ld \
952 // RUN: -resource-dir=%S/Inputs/resource_dir \
953 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
954 // RUN: | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s
955 // CHECK-SCUDO-LINUX: "{{.*}}ld{{(.exe)?}}"
956 // CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone.a" "--no-whole-archive"
957 // CHECK-SCUDO-LINUX-NOT: "-lstdc++"
958 // CHECK-SCUDO-LINUX: "-lpthread"
959 // CHECK-SCUDO-LINUX: "-ldl"
960 // CHECK-SCUDO-LINUX: "-lresolv"
962 // RUN: %clang -### %s -o %t.so -shared 2>&1 \
963 // RUN: --target=i386-unknown-linux -fuse-ld=ld -fsanitize=scudo -shared-libsan \
964 // RUN: -resource-dir=%S/Inputs/resource_dir \
965 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
966 // RUN: | FileCheck --check-prefix=CHECK-SCUDO-SHARED-LINUX %s
968 // CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
969 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lc"
970 // CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo_standalone.a"
971 // CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo_standalone.so"
972 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lpthread"
973 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lrt"
974 // CHECK-SCUDO-SHARED-LINUX-NOT: "-ldl"
975 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lresolv"
976 // CHECK-SCUDO-SHARED-LINUX-NOT: "--export-dynamic"
977 // CHECK-SCUDO-SHARED-LINUX-NOT: "--dynamic-list"
979 // RUN: %clang -### %s 2>&1 \
980 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
981 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
982 // RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID %s
984 // CHECK-SCUDO-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
985 // CHECK-SCUDO-ANDROID-NOT: "-lc"
986 // CHECK-SCUDO-ANDROID: "-pie"
987 // CHECK-SCUDO-ANDROID-NOT: "-lpthread"
988 // CHECK-SCUDO-ANDROID-NOT: "-lresolv"
989 // CHECK-SCUDO-ANDROID: libclang_rt.scudo_standalone.so"
990 // CHECK-SCUDO-ANDROID-NOT: "-lpthread"
991 // CHECK-SCUDO-ANDROID-NOT: "-lresolv"
993 // RUN: %clang -### %s 2>&1 \
994 // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
995 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
996 // RUN: -static-libsan \
997 // RUN: | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s
998 // CHECK-SCUDO-ANDROID-STATIC: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
999 // CHECK-SCUDO-ANDROID-STATIC: "-pie"
1000 // CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone.a" "--no-whole-archive"
1001 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lstdc++"
1002 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lpthread"
1003 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lrt"
1004 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lresolv"
1006 // RUN: %clang -### %s 2>&1 \
1007 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
1008 // RUN: -resource-dir=%S/Inputs/resource_dir \
1009 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1010 // RUN: | FileCheck --check-prefix=CHECK-HWASAN-X86-64-LINUX %s
1012 // CHECK-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
1013 // CHECK-HWASAN-X86-64-LINUX-NOT: "-lc"
1014 // CHECK-HWASAN-X86-64-LINUX: libclang_rt.hwasan.a"
1015 // CHECK-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
1016 // CHECK-HWASAN-X86-64-LINUX: "--dynamic-list={{.*}}libclang_rt.hwasan.a.syms"
1017 // CHECK-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
1018 // CHECK-HWASAN-X86-64-LINUX: "-lpthread"
1019 // CHECK-HWASAN-X86-64-LINUX: "-lrt"
1020 // CHECK-HWASAN-X86-64-LINUX: "-ldl"
1021 // CHECK-HWASAN-X86-64-LINUX: "-lresolv"
1023 // RUN: %clang -### %s 2>&1 \
1024 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
1025 // RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
1026 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1027 // RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-X86-64-LINUX %s
1029 // CHECK-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
1030 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
1031 // CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan.so"
1032 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
1033 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
1034 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
1035 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lresolv"
1036 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
1037 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "--dynamic-list"
1039 // RUN: %clang -### %s -o %t.so -shared 2>&1 \
1040 // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
1041 // RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
1042 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1043 // RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-X86-64-LINUX %s
1045 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
1046 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
1047 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan.so"
1048 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
1049 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
1050 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
1051 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lresolv"
1052 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
1053 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "--dynamic-list"
1055 // RUN: %clang -### %s 2>&1 \
1056 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
1057 // RUN: -resource-dir=%S/Inputs/resource_dir \
1058 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1059 // RUN: | FileCheck --check-prefix=CHECK-HWASAN-AARCH64-LINUX %s
1061 // CHECK-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
1062 // CHECK-HWASAN-AARCH64-LINUX-NOT: "-lc"
1063 // CHECK-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.a"
1064 // CHECK-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
1065 // CHECK-HWASAN-AARCH64-LINUX: "--dynamic-list={{.*}}libclang_rt.hwasan.a.syms"
1066 // CHECK-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
1067 // CHECK-HWASAN-AARCH64-LINUX: "-lpthread"
1068 // CHECK-HWASAN-AARCH64-LINUX: "-lrt"
1069 // CHECK-HWASAN-AARCH64-LINUX: "-ldl"
1070 // CHECK-HWASAN-AARCH64-LINUX: "-lresolv"
1072 // RUN: %clang -### %s 2>&1 \
1073 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
1074 // RUN: -shared-libsan \
1075 // RUN: -resource-dir=%S/Inputs/resource_dir \
1076 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1077 // RUN: | FileCheck --check-prefix=CHECK-SHARED-HWASAN-AARCH64-LINUX %s
1079 // CHECK-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
1080 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
1081 // CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.so"
1082 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
1083 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
1084 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
1085 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lresolv"
1086 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
1087 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "--dynamic-list"
1089 // RUN: %clang -### %s -o %t.so -shared 2>&1 \
1090 // RUN: --target=aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
1091 // RUN: -shared-libsan -resource-dir=%S/Inputs/resource_dir \
1092 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
1093 // RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX %s
1095 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
1096 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
1097 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.so"
1098 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
1099 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
1100 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
1101 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lresolv"
1102 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
1103 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "--dynamic-list"