• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Test sanitizers ld flags.
2 
3 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 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
8 //
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 
19 // RUN: %clang -fsanitize=address -fno-sanitize-link-runtime %s -### -o %t.o 2>&1 \
20 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
21 // RUN:     -resource-dir=%S/Inputs/resource_dir \
22 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
23 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s
24 //
25 // CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan
26 
27 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
28 // RUN:     -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
29 // RUN:     -resource-dir=%S/Inputs/resource_dir \
30 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
31 // RUN:   | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
32 
33 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
34 // RUN:     -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan \
35 // RUN:     -resource-dir=%S/Inputs/resource_dir \
36 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
37 // RUN:   | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
38 
39 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
40 // RUN:     -target i386-unknown-linux -fuse-ld=ld -fsanitize=address \
41 // RUN:     -shared-libsan -static-libsan -shared-libasan             \
42 // RUN:     -resource-dir=%S/Inputs/resource_dir \
43 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
44 // RUN:   | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
45 //
46 // CHECK-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
47 // CHECK-SHARED-ASAN-LINUX-NOT: "-lc"
48 // CHECK-SHARED-ASAN-LINUX-NOT: libclang_rt.asan-i386.a"
49 // CHECK-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so"
50 // CHECK-SHARED-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-preinit-i386.a" "--no-whole-archive"
51 // CHECK-SHARED-ASAN-LINUX-NOT: "-lpthread"
52 // CHECK-SHARED-ASAN-LINUX-NOT: "-lrt"
53 // CHECK-SHARED-ASAN-LINUX-NOT: "-ldl"
54 // CHECK-SHARED-ASAN-LINUX-NOT: "--export-dynamic"
55 // CHECK-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
56 
57 // RUN: %clang -no-canonical-prefixes %s -### -o %t.so -shared 2>&1 \
58 // RUN:     -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \
59 // RUN:     -resource-dir=%S/Inputs/resource_dir \
60 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
61 // RUN:   | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s
62 //
63 // CHECK-DSO-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
64 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lc"
65 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: libclang_rt.asan-i386.a"
66 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "libclang_rt.asan-preinit-i386.a"
67 // CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so"
68 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lpthread"
69 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lrt"
70 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-ldl"
71 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--export-dynamic"
72 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
73 
74 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
75 // RUN:     -target i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
76 // RUN:     -resource-dir=%S/Inputs/resource_dir \
77 // RUN:     --sysroot=%S/Inputs/basic_freebsd_tree \
78 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s
79 //
80 // CHECK-ASAN-FREEBSD: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
81 // CHECK-ASAN-FREEBSD-NOT: "-lc"
82 // CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
83 // CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan-i386.a"
84 // CHECK-ASAN-FREEBSD-NOT: libclang_rt.asan_cxx
85 // CHECK-ASAN-FREEBSD-NOT: "--dynamic-list"
86 // CHECK-ASAN-FREEBSD: "--export-dynamic"
87 // CHECK-ASAN-FREEBSD: "-lpthread"
88 // CHECK-ASAN-FREEBSD: "-lrt"
89 
90 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
91 // RUN:     -target i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
92 // RUN:     -resource-dir=%S/Inputs/resource_dir \
93 // RUN:     --sysroot=%S/Inputs/basic_freebsd_tree \
94 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-FREEBSD-LDL %s
95 //
96 // CHECK-ASAN-FREEBSD-LDL: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
97 // CHECK-ASAN-FREEBSD-LDL-NOT: "-ldl"
98 
99 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
100 // RUN:     -target i386-unknown-linux -fuse-ld=ld -stdlib=platform -fsanitize=address \
101 // RUN:     -resource-dir=%S/Inputs/empty_resource_dir \
102 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
103 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s
104 //
105 // CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
106 // CHECK-ASAN-LINUX-CXX-NOT: "-lc"
107 // CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
108 // CHECK-ASAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "--no-whole-archive"
109 // CHECK-ASAN-LINUX-CXX-NOT: "--dynamic-list"
110 // CHECK-ASAN-LINUX-CXX: "--export-dynamic"
111 // CHECK-ASAN-LINUX-CXX: stdc++
112 // CHECK-ASAN-LINUX-CXX: "-lpthread"
113 // CHECK-ASAN-LINUX-CXX: "-lrt"
114 // CHECK-ASAN-LINUX-CXX: "-ldl"
115 
116 // RUN: %clang -no-canonical-prefixes %s -### -o /dev/null -fsanitize=address \
117 // RUN:     -target i386-unknown-linux -fuse-ld=ld -stdlib=platform \
118 // RUN:     --sysroot=%S/Inputs/basic_linux_tree -lstdc++ -static 2>&1 \
119 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX-STATIC %s
120 //
121 // CHECK-ASAN-LINUX-CXX-STATIC: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
122 // CHECK-ASAN-LINUX-CXX-STATIC-NOT: stdc++
123 // CHECK-ASAN-LINUX-CXX-STATIC: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
124 // CHECK-ASAN-LINUX-CXX-STATIC: stdc++
125 
126 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
127 // RUN:     -target arm-linux-gnueabi -fuse-ld=ld -fsanitize=address \
128 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
129 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ARM %s
130 //
131 // CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
132 // CHECK-ASAN-ARM-NOT: "-lc"
133 // CHECK-ASAN-ARM: libclang_rt.asan-arm.a"
134 //
135 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
136 // RUN:     -target armv7l-linux-gnueabi -fuse-ld=ld -fsanitize=address \
137 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
138 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s
139 //
140 // CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
141 // CHECK-ASAN-ARMv7-NOT: "-lc"
142 // CHECK-ASAN-ARMv7: libclang_rt.asan-arm.a"
143 
144 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
145 // RUN:     -target arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
146 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
147 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
148 //
149 // CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
150 // CHECK-ASAN-ANDROID-NOT: "-lc"
151 // CHECK-ASAN-ANDROID-NOT: "-pie"
152 // CHECK-ASAN-ANDROID-NOT: "-lpthread"
153 // CHECK-ASAN-ANDROID: libclang_rt.asan-arm-android.so"
154 // CHECK-ASAN-ANDROID-NOT: "-lpthread"
155 
156 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
157 // RUN:     -target arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
158 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
159 // RUN:     -static-libsan \
160 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s
161 //
162 // CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
163 // CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan-arm-android.a"
164 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
165 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
166 
167 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
168 // RUN:     -target arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
169 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
170 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s
171 //
172 // CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
173 // CHECK-UBSAN-ANDROID-NOT: "-lc"
174 // CHECK-UBSAN-ANDROID-NOT: "-pie"
175 // CHECK-UBSAN-ANDROID-NOT: "-lpthread"
176 // CHECK-UBSAN-ANDROID: libclang_rt.ubsan_standalone-arm-android.so"
177 // CHECK-UBSAN-ANDROID-NOT: "-lpthread"
178 
179 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
180 // RUN:     -target arm-linux-androideabi -fuse-ld=ld -fsanitize=undefined \
181 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
182 // RUN:     -static-libsan \
183 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s
184 //
185 // CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
186 // CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone-arm-android.a"
187 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
188 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
189 
190 //
191 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
192 // RUN:     -target i686-linux-android -fuse-ld=ld -fsanitize=address \
193 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
194 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s
195 //
196 // CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
197 // CHECK-ASAN-ANDROID-X86-NOT: "-lc"
198 // CHECK-ASAN-ANDROID-X86-NOT: "-pie"
199 // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
200 // CHECK-ASAN-ANDROID-X86: libclang_rt.asan-i686-android.so"
201 // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
202 //
203 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
204 // RUN:     -target arm-linux-androideabi -fsanitize=address \
205 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
206 // RUN:     -shared-libsan \
207 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED-LIBASAN %s
208 //
209 // CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libsan'
210 //
211 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
212 // RUN:     -target arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
213 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
214 // RUN:     -shared \
215 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
216 //
217 // CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
218 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lc"
219 // CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan-arm-android.so"
220 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
221 
222 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
223 // RUN:     -target sparcel-myriad-rtems-elf -fuse-ld=ld -fsanitize=address \
224 // RUN:     --sysroot=%S/Inputs/basic_myriad_tree \
225 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-MYRIAD %s
226 //
227 // CHECK-ASAN-MYRIAD: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
228 // CHECK-ASAN-MYRIAD-NOT: "-lc"
229 // CHECK-ASAN-MYRIAD: libclang_rt.asan-sparcel.a"
230 
231 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
232 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \
233 // RUN:     -fsanitize=thread \
234 // RUN:     -resource-dir=%S/Inputs/resource_dir \
235 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
236 // RUN:   | FileCheck --check-prefix=CHECK-TSAN-LINUX-CXX %s
237 //
238 // CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
239 // CHECK-TSAN-LINUX-CXX-NOT: stdc++
240 // CHECK-TSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "--no-whole-archive"
241 // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan-x86_64.a.syms"
242 // CHECK-TSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan_cxx-x86_64.a" "--no-whole-archive"
243 // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan_cxx-x86_64.a.syms"
244 // CHECK-TSAN-LINUX-CXX-NOT: "--export-dynamic"
245 // CHECK-TSAN-LINUX-CXX: stdc++
246 // CHECK-TSAN-LINUX-CXX: "-lpthread"
247 // CHECK-TSAN-LINUX-CXX: "-lrt"
248 // CHECK-TSAN-LINUX-CXX: "-ldl"
249 
250 // RUN: %clang -fsanitize=thread -fno-sanitize-link-runtime %s -### -o %t.o 2>&1 \
251 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
252 // RUN:     -resource-dir=%S/Inputs/resource_dir \
253 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
254 // RUN:   | FileCheck --check-prefix=CHECK-TSAN-NO-LINK-RUNTIME-LINUX %s
255 //
256 // CHECK-TSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.tsan
257 
258 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
259 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \
260 // RUN:     -fsanitize=memory \
261 // RUN:     -resource-dir=%S/Inputs/resource_dir \
262 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
263 // RUN:   | FileCheck --check-prefix=CHECK-MSAN-LINUX-CXX %s
264 //
265 // CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
266 // CHECK-MSAN-LINUX-CXX-NOT: stdc++
267 // CHECK-MSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "--no-whole-archive"
268 // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan-x86_64.a.syms"
269 // CHECK-MSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan_cxx-x86_64.a" "--no-whole-archive"
270 // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan_cxx-x86_64.a.syms"
271 // CHECK-MSAN-LINUX-CXX-NOT: "--export-dynamic"
272 // CHECK-MSAN-LINUX-CXX: stdc++
273 // CHECK-MSAN-LINUX-CXX: "-lpthread"
274 // CHECK-MSAN-LINUX-CXX: "-lrt"
275 // CHECK-MSAN-LINUX-CXX: "-ldl"
276 
277 // RUN: %clang -fsanitize=memory -fno-sanitize-link-runtime %s -### -o %t.o 2>&1 \
278 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
279 // RUN:     -resource-dir=%S/Inputs/resource_dir \
280 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
281 // RUN:   | FileCheck --check-prefix=CHECK-MSAN-NO-LINK-RUNTIME-LINUX %s
282 //
283 // CHECK-MSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.msan
284 
285 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
286 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
287 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
288 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
289 
290 // RUN: %clang -fsanitize=float-divide-by-zero %s -### -o %t.o 2>&1 \
291 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
292 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
293 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
294 
295 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
296 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
297 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
298 // RUN:     -static-libsan \
299 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
300 
301 // CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
302 // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
303 // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
304 // CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "--no-whole-archive"
305 // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan
306 // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx
307 // CHECK-UBSAN-LINUX-NOT: "-lstdc++"
308 // CHECK-UBSAN-LINUX: "-lpthread"
309 
310 // RUN: %clang -fsanitize=undefined -fno-sanitize-link-runtime %s -### -o %t.o 2>&1 \
311 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
312 // RUN:     -resource-dir=%S/Inputs/resource_dir \
313 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
314 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-NO-LINK-RUNTIME-LINUX %s
315 //
316 // CHECK-UBSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.undefined
317 
318 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
319 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
320 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
321 // RUN:     -shared-libsan \
322 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
323 
324 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
325 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
326 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
327 // RUN:     -static-libsan -shared-libsan \
328 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
329 
330 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
331 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
332 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
333 // RUN:     -shared -shared-libsan \
334 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN %s
335 
336 // CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}ld{{(.exe)?}}"
337 // CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}libclang_rt.ubsan_standalone-i386.so{{.*}}"
338 
339 // RUN: %clang -fsanitize=undefined -fsanitize-link-c++-runtime %s -### -o %t.o 2>&1 \
340 // RUN:     -target i386-unknown-linux \
341 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
342 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s
343 // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
344 // CHECK-UBSAN-LINUX-LINK-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "--no-whole-archive"
345 // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
346 
347 // RUN: %clangxx -fsanitize=undefined %s -### -o %t.o 2>&1 \
348 // RUN:     -target i386-unknown-linux -fuse-ld=ld -stdlib=platform \
349 // RUN:     -resource-dir=%S/Inputs/resource_dir \
350 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
351 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s
352 // CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
353 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
354 // CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "--no-whole-archive"
355 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
356 // CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "--no-whole-archive"
357 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
358 // CHECK-UBSAN-LINUX-CXX: "-lstdc++"
359 // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
360 // CHECK-UBSAN-LINUX-CXX: "-lpthread"
361 
362 // RUN: %clang -fsanitize=undefined -fsanitize-minimal-runtime %s -### -o %t.o 2>&1 \
363 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
364 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
365 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-LINUX %s
366 // CHECK-UBSAN-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}"
367 // CHECK-UBSAN-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_minimal-i386.a" "--no-whole-archive"
368 // CHECK-UBSAN-MINIMAL-LINUX: "-lpthread"
369 
370 // RUN: %clang -fsanitize=undefined -fsanitize-minimal-runtime %s -### -o %t.o 2>&1 \
371 // RUN:     -target x86_64-apple-darwin -fuse-ld=ld \
372 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
373 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-MINIMAL-DARWIN %s
374 // CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}ld{{(.exe)?}}"
375 // CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}libclang_rt.ubsan_minimal_osx_dynamic.dylib"
376 
377 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
378 // RUN:     -target x86_64-apple-darwin -fuse-ld=ld -static-libsan \
379 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
380 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-STATIC-DARWIN %s
381 // CHECK-UBSAN-STATIC-DARWIN: "{{.*}}ld{{(.exe)?}}"
382 // CHECK-UBSAN-STATIC-DARWIN: "{{.*}}libclang_rt.ubsan_osx.a"
383 
384 // RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
385 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
386 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
387 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX %s
388 // CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
389 // CHECK-ASAN-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
390 // CHECK-ASAN-UBSAN-LINUX-NOT: libclang_rt.ubsan
391 // CHECK-ASAN-UBSAN-LINUX-NOT: "-lstdc++"
392 // CHECK-ASAN-UBSAN-LINUX: "-lpthread"
393 
394 // RUN: %clangxx -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
395 // RUN:     -target i386-unknown-linux -fuse-ld=ld -stdlib=platform \
396 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
397 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s
398 // CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
399 // CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan-i386.a" "--no-whole-archive"
400 // CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "--no-whole-archive"
401 // CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
402 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lstdc++"
403 // CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread"
404 
405 // RUN: %clangxx -fsanitize=memory,undefined %s -### -o %t.o 2>&1 \
406 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
407 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
408 // RUN:   | FileCheck --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX %s
409 // CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
410 // CHECK-MSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "--no-whole-archive"
411 // CHECK-MSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
412 
413 // RUN: %clangxx -fsanitize=thread,undefined %s -### -o %t.o 2>&1 \
414 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
415 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
416 // RUN:   | FileCheck --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX %s
417 // CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
418 // CHECK-TSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "--no-whole-archive"
419 // CHECK-TSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
420 
421 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
422 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
423 // RUN:     -resource-dir=%S/Inputs/resource_dir \
424 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
425 // RUN:     -shared \
426 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHARED %s
427 // CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}"
428 // CHECK-UBSAN-LINUX-SHARED-NOT: --export-dynamic
429 // CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list
430 // CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan
431 
432 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
433 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak \
434 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
435 // RUN:   | FileCheck --check-prefix=CHECK-LSAN-LINUX %s
436 //
437 // CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
438 // CHECK-LSAN-LINUX-NOT: "-lc"
439 // CHECK-LSAN-LINUX-NOT: libclang_rt.ubsan
440 // CHECK-LSAN-LINUX: libclang_rt.lsan-x86_64.a"
441 // CHECK-LSAN-LINUX: "-lpthread"
442 // CHECK-LSAN-LINUX: "-ldl"
443 
444 // RUN: %clang -fsanitize=leak -fno-sanitize-link-runtime %s -### -o %t.o 2>&1 \
445 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
446 // RUN:     -resource-dir=%S/Inputs/resource_dir \
447 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
448 // RUN:   | FileCheck --check-prefix=CHECK-LSAN-NO-LINK-RUNTIME-LINUX %s
449 //
450 // CHECK-LSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.lsan
451 
452 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
453 // RUN:  -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak -fsanitize-coverage=func \
454 // RUN:  --sysroot=%S/Inputs/basic_linux_tree \
455 // RUN:   | FileCheck --check-prefix=CHECK-LSAN-COV-LINUX %s
456 //
457 // CHECK-LSAN-COV-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
458 // CHECK-LSAN-COV-LINUX-NOT: "-lc"
459 // CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan
460 // CHECK-LSAV-COV-LINUX: libclang_rt.lsan-x86_64.a"
461 // CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan
462 // CHECK-LSAN-COV-LINUX: "-lpthread"
463 // CHECK-LSAN-COV-LINUX: "-ldl"
464 
465 // RUN: %clang -fsanitize=leak,address %s -### -o %t.o 2>&1 \
466 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
467 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
468 // RUN:   | FileCheck --check-prefix=CHECK-LSAN-ASAN-LINUX %s
469 // CHECK-LSAN-ASAN-LINUX: "{{.*}}ld{{(.exe)?}}"
470 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan
471 // CHECK-LSAN-ASAN-LINUX: libclang_rt.asan-x86_64
472 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan
473 
474 // RUN: %clang -fsanitize=address -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
475 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
476 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
477 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-COV-LINUX %s
478 // CHECK-ASAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
479 // CHECK-ASAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-x86_64.a" "--no-whole-archive"
480 // CHECK-ASAN-COV-LINUX-NOT: libclang_rt.ubsan
481 // CHECK-ASAN-COV-LINUX-NOT: "-lstdc++"
482 // CHECK-ASAN-COV-LINUX: "-lpthread"
483 
484 // RUN: %clang -fsanitize=memory -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
485 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
486 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
487 // RUN:   | FileCheck --check-prefix=CHECK-MSAN-COV-LINUX %s
488 // CHECK-MSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
489 // CHECK-MSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "--no-whole-archive"
490 // CHECK-MSAN-COV-LINUX-NOT: libclang_rt.ubsan
491 // CHECK-MSAN-COV-LINUX-NOT: "-lstdc++"
492 // CHECK-MSAN-COV-LINUX: "-lpthread"
493 
494 // RUN: %clang -fsanitize=dataflow -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
495 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
496 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
497 // RUN:   | FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX %s
498 // CHECK-DFSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
499 // CHECK-DFSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.dfsan-x86_64.a" "--no-whole-archive"
500 // CHECK-DFSAN-COV-LINUX-NOT: libclang_rt.ubsan
501 // CHECK-DFSAN-COV-LINUX-NOT: "-lstdc++"
502 // CHECK-DFSAN-COV-LINUX: "-lpthread"
503 
504 // RUN: %clang -fsanitize=undefined -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
505 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
506 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
507 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX %s
508 // CHECK-UBSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
509 // CHECK-UBSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x86_64.a" "--no-whole-archive"
510 // CHECK-UBSAN-COV-LINUX-NOT: "-lstdc++"
511 // CHECK-UBSAN-COV-LINUX: "-lpthread"
512 
513 // RUN: %clang -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
514 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
515 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
516 // RUN:   | FileCheck --check-prefix=CHECK-COV-LINUX %s
517 // CHECK-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
518 // CHECK-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x86_64.a" "--no-whole-archive"
519 // CHECK-COV-LINUX-NOT: "-lstdc++"
520 // CHECK-COV-LINUX: "-lpthread"
521 
522 // CFI by itself does not link runtime libraries.
523 // RUN: %clang -fsanitize=cfi %s -### -o %t.o 2>&1 \
524 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld -rtlib=platform \
525 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
526 // RUN:   | FileCheck --check-prefix=CHECK-CFI-LINUX %s
527 // CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}"
528 // CHECK-CFI-LINUX-NOT: libclang_rt.
529 
530 // CFI with diagnostics links the UBSan runtime.
531 // RUN: %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
532 // RUN:     %s -### -o %t.o 2>&1\
533 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
534 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
535 // RUN:   | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s
536 // CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
537 // CHECK-CFI-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a" "--no-whole-archive"
538 
539 // Cross-DSO CFI links the CFI runtime.
540 // RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \
541 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
542 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
543 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s
544 // CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}"
545 // CHECK-CFI-CROSS-DSO-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi-x86_64.a" "--no-whole-archive"
546 // CHECK-CFI-CROSS-DSO-LINUX: -export-dynamic
547 
548 // Cross-DSO CFI with diagnostics links just the CFI runtime.
549 // RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \
550 // RUN:     -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
551 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
552 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
553 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s
554 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
555 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi_diag-x86_64.a" "--no-whole-archive"
556 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: -export-dynamic
557 
558 // Cross-DSO CFI on Android does not link runtime libraries.
559 // RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \
560 // RUN:     -target aarch64-linux-android -fuse-ld=ld \
561 // RUN:     --sysroot=%S/Inputs/basic_android_tree \
562 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-ANDROID %s
563 // CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld{{(.exe)?}}"
564 // CHECK-CFI-CROSS-DSO-ANDROID-NOT: libclang_rt.cfi
565 
566 // Cross-DSO CFI with diagnostics on Android links just the UBSAN runtime.
567 // RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \
568 // RUN:     -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
569 // RUN:     -target aarch64-linux-android -fuse-ld=ld \
570 // RUN:     --sysroot=%S/Inputs/basic_android_tree \
571 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s
572 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld{{(.exe)?}}"
573 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone-aarch64-android.so"
574 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "--export-dynamic-symbol=__cfi_check"
575 
576 // RUN: %clangxx -fsanitize=address %s -### -o %t.o 2>&1 \
577 // RUN:     -mmacosx-version-min=10.6 \
578 // RUN:     -target x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
579 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
580 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-DARWIN106-CXX %s
581 // CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
582 // CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib
583 // CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi
584 
585 // RUN: %clangxx -fsanitize=leak %s -### -o %t.o 2>&1 \
586 // RUN:     -mmacosx-version-min=10.6 \
587 // RUN:     -target x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
588 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
589 // RUN:   | FileCheck --check-prefix=CHECK-LSAN-DARWIN106-CXX %s
590 // CHECK-LSAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
591 // CHECK-LSAN-DARWIN106-CXX: libclang_rt.lsan_osx_dynamic.dylib
592 // CHECK-LSAN-DARWIN106-CXX-NOT: -lc++abi
593 
594 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
595 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
596 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
597 // RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s
598 //
599 // CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
600 // CHECK-SAFESTACK-LINUX-NOT: "-lc"
601 // CHECK-SAFESTACK-LINUX-NOT: whole-archive
602 // CHECK-SAFESTACK-LINUX: libclang_rt.safestack-x86_64.a"
603 // CHECK-SAFESTACK-LINUX: "-u" "__safestack_init"
604 // CHECK-SAFESTACK-LINUX: "-lpthread"
605 // CHECK-SAFESTACK-LINUX: "-ldl"
606 
607 // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \
608 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
609 // RUN:   | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-X86-64 %s
610 // CHECK-SHADOWCALLSTACK-LINUX-X86-64-NOT: error:
611 
612 // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \
613 // RUN:     -target aarch64-unknown-linux -fuse-ld=ld \
614 // RUN:   | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64 %s
615 // CHECK-SHADOWCALLSTACK-LINUX-AARCH64: '-fsanitize=shadow-call-stack' only allowed with '-ffixed-x18'
616 
617 // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \
618 // RUN:     -target riscv32-unknown-elf -fuse-ld=ld \
619 // RUN:   | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-ELF-RISCV32 %s
620 // CHECK-SHADOWCALLSTACK-ELF-RISCV32: '-fsanitize=shadow-call-stack' only allowed with '-ffixed-x18'
621 
622 // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \
623 // RUN:     -target riscv64-unknown-linux -fuse-ld=ld \
624 // RUN:   | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-RISCV64 %s
625 // CHECK-SHADOWCALLSTACK-LINUX-RISCV64: '-fsanitize=shadow-call-stack' only allowed with '-ffixed-x18'
626 
627 // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \
628 // RUN:     -target aarch64-unknown-linux -fuse-ld=ld -ffixed-x18 \
629 // RUN:   | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
630 // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \
631 // RUN:     -target arm64-unknown-ios -fuse-ld=ld \
632 // RUN:   | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
633 // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \
634 // RUN:     -target aarch64-unknown-linux-android -fuse-ld=ld \
635 // RUN:   | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 %s
636 // CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18-NOT: error:
637 
638 // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \
639 // RUN:     -target x86-unknown-linux -fuse-ld=ld \
640 // RUN:   | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-X86 %s
641 // CHECK-SHADOWCALLSTACK-LINUX-X86: error: unsupported option '-fsanitize=shadow-call-stack' for target 'x86-unknown-linux'
642 
643 // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \
644 // RUN:     -fsanitize=safe-stack -target x86_64-unknown-linux -fuse-ld=ld \
645 // RUN:   | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-SAFESTACK %s
646 // CHECK-SHADOWCALLSTACK-SAFESTACK-NOT: error:
647 
648 // RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
649 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld \
650 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
651 // RUN:   | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s
652 // CHECK-CFI-STATS-LINUX: "{{.*}}ld{{(.exe)?}}"
653 // CHECK-CFI-STATS-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.stats_client-x86_64.a" "--no-whole-archive"
654 // CHECK-CFI-STATS-LINUX-NOT: "--whole-archive"
655 // CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats-x86_64.a"
656 
657 // RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
658 // RUN:     -target x86_64-apple-darwin -fuse-ld=ld \
659 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
660 // RUN:   | FileCheck --check-prefix=CHECK-CFI-STATS-DARWIN %s
661 // CHECK-CFI-STATS-DARWIN: "{{.*}}ld{{(.exe)?}}"
662 // CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_client_osx.a"
663 // CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_osx_dynamic.dylib"
664 
665 // RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
666 // RUN:     -target x86_64-pc-windows \
667 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
668 // RUN:   | FileCheck --check-prefix=CHECK-CFI-STATS-WIN64 %s
669 // CHECK-CFI-STATS-WIN64: "--dependent-lib=clang_rt.stats_client-x86_64.lib"
670 // CHECK-CFI-STATS-WIN64: "--dependent-lib=clang_rt.stats-x86_64.lib"
671 // CHECK-CFI-STATS-WIN64: "--linker-option=/include:__sanitizer_stats_register"
672 
673 // RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
674 // RUN:     -target i686-pc-windows \
675 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
676 // RUN:   | FileCheck --check-prefix=CHECK-CFI-STATS-WIN32 %s
677 // CHECK-CFI-STATS-WIN32: "--dependent-lib=clang_rt.stats_client-i386.lib"
678 // CHECK-CFI-STATS-WIN32: "--dependent-lib=clang_rt.stats-i386.lib"
679 // CHECK-CFI-STATS-WIN32: "--linker-option=/include:___sanitizer_stats_register"
680 
681 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
682 // RUN:     -target arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
683 // RUN:     --sysroot=%S/Inputs/basic_android_tree \
684 // RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
685 //
686 // CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
687 // CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack
688 
689 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \
690 // RUN:     -target arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
691 // RUN:     --sysroot=%S/Inputs/basic_android_tree \
692 // RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-SHARED-ANDROID-ARM %s
693 //
694 // CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
695 // CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack
696 
697 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
698 // RUN:     -target aarch64-linux-android -fuse-ld=ld -fsanitize=safe-stack \
699 // RUN:     --sysroot=%S/Inputs/basic_android_tree \
700 // RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-AARCH64 %s
701 //
702 // CHECK-SAFESTACK-ANDROID-AARCH64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
703 // CHECK-SAFESTACK-ANDROID-AARCH64-NOT: libclang_rt.safestack
704 
705 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
706 // RUN:     -target x86_64-scei-ps4 -fuse-ld=ld \
707 // RUN:     -shared \
708 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-PS4 %s
709 // CHECK-UBSAN-PS4: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
710 // CHECK-UBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
711 // CHECK-UBSAN-PS4: -lSceDbgUBSanitizer_stub_weak
712 
713 // RUN: %clang -fsanitize=address %s -### -o %t.o 2>&1 \
714 // RUN:     -target x86_64-scei-ps4 -fuse-ld=ld \
715 // RUN:     -shared \
716 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-PS4 %s
717 // CHECK-ASAN-PS4: --dependent-lib=libSceDbgAddressSanitizer_stub_weak.a
718 // CHECK-ASAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
719 // CHECK-ASAN-PS4: -lSceDbgAddressSanitizer_stub_weak
720 
721 // RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
722 // RUN:     -target x86_64-scei-ps4 -fuse-ld=ld \
723 // RUN:     -shared \
724 // RUN:   | FileCheck --check-prefix=CHECK-AUBSAN-PS4 %s
725 // CHECK-AUBSAN-PS4-NOT: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
726 // CHECK-AUBSAN-PS4: --dependent-lib=libSceDbgAddressSanitizer_stub_weak.a
727 // CHECK-AUBSAN-PS4-NOT: --dependent-lib=libSceDbgUBSanitizer_stub_weak.a
728 // CHECK-AUBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
729 // CHECK-AUBSAN-PS4: -lSceDbgAddressSanitizer_stub_weak
730 
731 // RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
732 // RUN:     -target x86_64-scei-ps4 -fuse-ld=ld \
733 // RUN:     -shared \
734 // RUN:     -nostdlib \
735 // RUN:   | FileCheck --check-prefix=CHECK-NOLIB-PS4 %s
736 // CHECK-NOLIB-PS4-NOT: SceDbgAddressSanitizer_stub_weak
737 
738 // RUN: %clang -fsanitize=scudo %s -### -o %t.o 2>&1 \
739 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
740 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
741 // RUN:   | FileCheck --check-prefix=CHECK-SCUDO-LINUX %s
742 // CHECK-SCUDO-LINUX: "{{.*}}ld{{(.exe)?}}"
743 // CHECK-SCUDO-LINUX: "-pie"
744 // CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo-i386.a" "--no-whole-archive"
745 // CHECK-SCUDO-LINUX-NOT: "-lstdc++"
746 // CHECK-SCUDO-LINUX: "-lpthread"
747 // CHECK-SCUDO-LINUX: "-ldl"
748 
749 // RUN: %clang -fsanitize=scudo -fsanitize-minimal-runtime %s -### -o %t.o 2>&1 \
750 // RUN:     -target i386-unknown-linux -fuse-ld=ld \
751 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
752 // RUN:   | FileCheck --check-prefix=CHECK-SCUDO-MINIMAL-LINUX %s
753 // CHECK-SCUDO-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}"
754 // CHECK-SCUDO-MINIMAL-LINUX: "-pie"
755 // CHECK-SCUDO-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_minimal-i386.a" "--no-whole-archive"
756 // CHECK-SCUDO-MINIMAL-LINUX: "-lpthread"
757 
758 // RUN: %clang -no-canonical-prefixes %s -### -o %t.so -shared 2>&1 \
759 // RUN:     -target i386-unknown-linux -fuse-ld=ld -fsanitize=scudo -shared-libsan \
760 // RUN:     -resource-dir=%S/Inputs/resource_dir \
761 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
762 // RUN:   | FileCheck --check-prefix=CHECK-SCUDO-SHARED-LINUX %s
763 //
764 // CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
765 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lc"
766 // CHECK-SCUDO-SHARED-LINUX-NOT: libclang_rt.scudo-i386.a"
767 // CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo-i386.so"
768 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lpthread"
769 // CHECK-SCUDO-SHARED-LINUX-NOT: "-lrt"
770 // CHECK-SCUDO-SHARED-LINUX-NOT: "-ldl"
771 // CHECK-SCUDO-SHARED-LINUX-NOT: "--export-dynamic"
772 // CHECK-SCUDO-SHARED-LINUX-NOT: "--dynamic-list"
773 
774 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
775 // RUN:     -target arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
776 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
777 // RUN:   | FileCheck --check-prefix=CHECK-SCUDO-ANDROID %s
778 //
779 // CHECK-SCUDO-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
780 // CHECK-SCUDO-ANDROID-NOT: "-lc"
781 // CHECK-SCUDO-ANDROID: "-pie"
782 // CHECK-SCUDO-ANDROID-NOT: "-lpthread"
783 // CHECK-SCUDO-ANDROID: libclang_rt.scudo-arm-android.so"
784 // CHECK-SCUDO-ANDROID-NOT: "-lpthread"
785 
786 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
787 // RUN:     -target arm-linux-androideabi -fuse-ld=ld -fsanitize=scudo \
788 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
789 // RUN:     -static-libsan \
790 // RUN:   | FileCheck --check-prefix=CHECK-SCUDO-ANDROID-STATIC %s
791 // CHECK-SCUDO-ANDROID-STATIC: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
792 // CHECK-SCUDO-ANDROID-STATIC: "-pie"
793 // CHECK-SCUDO-ANDROID-STATIC: "--whole-archive" "{{.*}}libclang_rt.scudo-arm-android.a" "--no-whole-archive"
794 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lstdc++"
795 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lpthread"
796 // CHECK-SCUDO-ANDROID-STATIC-NOT: "-lrt"
797 
798 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
799 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
800 // RUN:     -resource-dir=%S/Inputs/resource_dir \
801 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
802 // RUN:   | FileCheck --check-prefix=CHECK-HWASAN-X86-64-LINUX %s
803 //
804 // CHECK-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
805 // CHECK-HWASAN-X86-64-LINUX: "-pie"
806 // CHECK-HWASAN-X86-64-LINUX-NOT: "-lc"
807 // CHECK-HWASAN-X86-64-LINUX: libclang_rt.hwasan-x86_64.a"
808 // CHECK-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
809 // CHECK-HWASAN-X86-64-LINUX: "--dynamic-list={{.*}}libclang_rt.hwasan-x86_64.a.syms"
810 // CHECK-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
811 // CHECK-HWASAN-X86-64-LINUX: "-lpthread"
812 // CHECK-HWASAN-X86-64-LINUX: "-lrt"
813 // CHECK-HWASAN-X86-64-LINUX: "-ldl"
814 
815 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
816 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
817 // RUN:     -shared-libsan -resource-dir=%S/Inputs/resource_dir \
818 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
819 // RUN:   | FileCheck --check-prefix=CHECK-SHARED-HWASAN-X86-64-LINUX %s
820 //
821 // CHECK-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
822 // CHECK-SHARED-HWASAN-X86-64-LINUX: "-pie"
823 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
824 // CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan-x86_64.so"
825 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
826 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
827 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
828 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
829 // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "--dynamic-list"
830 
831 // RUN: %clang -no-canonical-prefixes %s -### -o %t.so -shared 2>&1 \
832 // RUN:     -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
833 // RUN:     -shared-libsan -resource-dir=%S/Inputs/resource_dir \
834 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
835 // RUN:   | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-X86-64-LINUX %s
836 //
837 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
838 // CHECK-DSO_SHARED-HWASAN-X86-64-LINUX: "-pie"
839 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc"
840 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan-x86_64.so"
841 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread"
842 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lrt"
843 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-ldl"
844 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "--export-dynamic"
845 // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "--dynamic-list"
846 
847 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
848 // RUN:     -target aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
849 // RUN:     -resource-dir=%S/Inputs/resource_dir \
850 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
851 // RUN:   | FileCheck --check-prefix=CHECK-HWASAN-AARCH64-LINUX %s
852 //
853 // CHECK-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
854 // CHECK-HWASAN-AARCH64-LINUX: "-pie"
855 // CHECK-HWASAN-AARCH64-LINUX-NOT: "-lc"
856 // CHECK-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-aarch64.a"
857 // CHECK-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
858 // CHECK-HWASAN-AARCH64-LINUX: "--dynamic-list={{.*}}libclang_rt.hwasan-aarch64.a.syms"
859 // CHECK-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
860 // CHECK-HWASAN-AARCH64-LINUX: "-lpthread"
861 // CHECK-HWASAN-AARCH64-LINUX: "-lrt"
862 // CHECK-HWASAN-AARCH64-LINUX: "-ldl"
863 
864 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
865 // RUN:     -target aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
866 // RUN:     -shared-libsan \
867 // RUN:     -resource-dir=%S/Inputs/resource_dir \
868 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
869 // RUN:   | FileCheck --check-prefix=CHECK-SHARED-HWASAN-AARCH64-LINUX %s
870 //
871 // CHECK-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
872 // CHECK-SHARED-HWASAN-AARCH64-LINUX: "-pie"
873 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
874 // CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-aarch64.so"
875 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
876 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
877 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
878 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
879 // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "--dynamic-list"
880 
881 // RUN: %clang -no-canonical-prefixes %s -### -o %t.so -shared 2>&1 \
882 // RUN:     -target aarch64-unknown-linux -fuse-ld=ld -fsanitize=hwaddress \
883 // RUN:     -shared-libsan -resource-dir=%S/Inputs/resource_dir \
884 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
885 // RUN:   | FileCheck --check-prefix=CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX %s
886 //
887 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
888 // CHECK-DSO_SHARED-HWASAN-AARCH64-LINUX: "-pie"
889 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc"
890 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-aarch64.so"
891 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread"
892 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lrt"
893 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-ldl"
894 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic"
895 // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "--dynamic-list"
896