• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: libclang_rt.asan_osx_dynamic.dylib"
9 // CHECK-ASAN: stdc++
10 
11 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
12 // RUN:   -fPIC -shared -fsanitize=address %s -o %t.so 2>&1 \
13 // RUN:   | FileCheck --check-prefix=CHECK-DYN-ASAN %s
14 
15 // CHECK-DYN-ASAN: "{{.*}}ld{{(.exe)?}}"
16 // CHECK-DYN-ASAN: "-dylib"
17 // CHECK-DYN-ASAN-NOT: libclang_rt.asan_osx_dynamic.dylib
18 // CHECK-DYN-ASAN: "-undefined"
19 // CHECK-DYN-ASAN: "dynamic_lookup"
20 // CHECK-DYN-ASAN-NOT: libclang_rt.asan_osx_dynamic.dylib
21 
22 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
23 // RUN:   -fsanitize=undefined %s -o %t.o 2>&1 \
24 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN %s
25 
26 // CHECK-UBSAN: "{{.*}}ld{{(.exe)?}}"
27 // CHECK-UBSAN: libclang_rt.ubsan_osx.a"
28 // CHECK-UBSAN: stdc++
29 
30 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
31 // RUN:   -fsanitize=bounds -fsanitize-undefined-trap-on-error \
32 // RUN:   %s -o %t.o 2>&1 \
33 // RUN:   | FileCheck --check-prefix=CHECK-BOUNDS %s
34 
35 // CHECK-BOUNDS: "{{.*}}ld{{(.exe)?}}"
36 // CHECK-BOUNDS-NOT: libclang_rt.ubsan_osx.a"
37 
38 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
39 // RUN:   -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \
40 // RUN:   | FileCheck --check-prefix=CHECK-DYN-UBSAN %s
41 
42 // CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}"
43 // CHECK-DYN-UBSAN: "-dylib"
44 // CHECK-DYN-UBSAN: libclang_rt.ubsan_osx.a
45 
46 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
47 // RUN:   -fsanitize=bounds -fsanitize-undefined-trap-on-error \
48 // RUN:   %s -o %t.so -fPIC -shared 2>&1 \
49 // RUN:   | FileCheck --check-prefix=CHECK-DYN-BOUNDS %s
50 
51 // CHECK-DYN-BOUNDS: "{{.*}}ld{{(.exe)?}}"
52 // CHECK-DYN-BOUNDS-NOT: libclang_rt.ubsan_osx.a
53