xref: /minix3/external/bsd/llvm/dist/clang/test/Driver/darwin-sanitizer-ld.c (revision b5e2faaaaf60a8b9a02f8d72f64caa56a87eb312)
1 // Test sanitizer link flags on Darwin.
2 
3 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
4 // RUN:   -fsanitize=address %s -o %t.o 2>&1 \
5 // RUN:   | FileCheck --check-prefix=CHECK-ASAN %s
6 
7 // CHECK-ASAN: "{{.*}}ld{{(.exe)?}}"
8 // CHECK-ASAN: stdc++
9 // CHECK-ASAN: libclang_rt.asan_osx_dynamic.dylib"
10 
11 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
12 // RUN:   -fsanitize=address -mios-simulator-version-min=7.0 %s -o %t.o 2>&1 \
13 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-IOSSIM %s
14 
15 // CHECK-ASAN-IOSSIM: "{{.*}}ld{{(.exe)?}}"
16 // CHECK-ASAN-IOSSIM: lc++
17 // CHECK-ASAN-IOSSIM: libclang_rt.asan_iossim_dynamic.dylib"
18 
19 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
20 // RUN:   -fPIC -shared -fsanitize=address %s -o %t.so 2>&1 \
21 // RUN:   | FileCheck --check-prefix=CHECK-DYN-ASAN %s
22 
23 // CHECK-DYN-ASAN: "{{.*}}ld{{(.exe)?}}"
24 // CHECK-DYN-ASAN: "-dylib"
25 // CHECK-DYN-ASAN: libclang_rt.asan_osx_dynamic.dylib
26 
27 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
28 // RUN:   -fsanitize=undefined %s -o %t.o 2>&1 \
29 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN %s
30 
31 // CHECK-UBSAN: "{{.*}}ld{{(.exe)?}}"
32 // CHECK-UBSAN: libclang_rt.ubsan_osx.a"
33 // CHECK-UBSAN: stdc++
34 
35 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
36 // RUN:   -fsanitize=bounds -fsanitize-undefined-trap-on-error \
37 // RUN:   %s -o %t.o 2>&1 \
38 // RUN:   | FileCheck --check-prefix=CHECK-BOUNDS %s
39 
40 // CHECK-BOUNDS: "{{.*}}ld{{(.exe)?}}"
41 // CHECK-BOUNDS-NOT: libclang_rt.ubsan_osx.a"
42 
43 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
44 // RUN:   -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \
45 // RUN:   | FileCheck --check-prefix=CHECK-DYN-UBSAN %s
46 
47 // CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}"
48 // CHECK-DYN-UBSAN: "-dylib"
49 // CHECK-DYN-UBSAN: libclang_rt.ubsan_osx.a
50 
51 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
52 // RUN:   -fsanitize=bounds -fsanitize-undefined-trap-on-error \
53 // RUN:   %s -o %t.so -fPIC -shared 2>&1 \
54 // RUN:   | FileCheck --check-prefix=CHECK-DYN-BOUNDS %s
55 
56 // CHECK-DYN-BOUNDS: "{{.*}}ld{{(.exe)?}}"
57 // CHECK-DYN-BOUNDS-NOT: libclang_rt.ubsan_osx.a
58