blob: cc6ab7784c75402e7a1165923a1ba962cfc0fda9 [file] [log] [blame]
Alexey Samsonov69b77d72012-11-21 14:17:42 +00001// 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
Alexey Samsonov803dd9e2012-11-21 15:52:36 +00007// CHECK-ASAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov69b77d72012-11-21 14:17:42 +00008// CHECK-ASAN: libclang_rt.asan_osx.a"
9// CHECK-ASAN: "-lstdc++"
10// CHECK-ASAN: "-framework" "CoreFoundation"
11
12// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
13// RUN: -fPIC -shared -fsanitize=address %s -o %t.so 2>&1 \
14// RUN: | FileCheck --check-prefix=CHECK-DYN-ASAN %s
15
Alexey Samsonov803dd9e2012-11-21 15:52:36 +000016// CHECK-DYN-ASAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov69b77d72012-11-21 14:17:42 +000017// CHECK-DYN-ASAN: "-dylib"
18// CHECK-DYN-ASAN-NOT: libclang_rt.asan_osx.a
19// CHECK-DYN-ASAN: "-undefined"
20// CHECK-DYN-ASAN: "dynamic_lookup"
21// CHECK-DYN-ASAN-NOT: libclang_rt.asan_osx.a
22
23// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
24// RUN: -fsanitize=undefined %s -o %t.o 2>&1 \
25// RUN: | FileCheck --check-prefix=CHECK-UBSAN %s
26
Alexey Samsonov803dd9e2012-11-21 15:52:36 +000027// CHECK-UBSAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov69b77d72012-11-21 14:17:42 +000028// CHECK-UBSAN: libclang_rt.ubsan_osx.a"
29// CHECK-UBSAN: "-lstdc++"
30
31// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Joey Gouly85489082012-11-23 10:39:49 +000032// RUN: -fsanitize=bounds %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// CHECK-BOUNDS-NOT: "-lstdc++"
38
39// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Alexey Samsonov69b77d72012-11-21 14:17:42 +000040// RUN: -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \
41// RUN: | FileCheck --check-prefix=CHECK-DYN-UBSAN %s
42
Alexey Samsonov803dd9e2012-11-21 15:52:36 +000043// CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov69b77d72012-11-21 14:17:42 +000044// CHECK-DYN-UBSAN: "-dylib"
45// CHECK-DYN-UBSAN-NOT: libclang_rt.ubsan_osx.a
46// CHECK-DYN-UBSAN: "-undefined"
47// CHECK-DYN-UBSAN: "dynamic_lookup"
48// CHECK-DYN-UBSAN-NOT: libclang_rt.ubsan_osx.a
Joey Gouly85489082012-11-23 10:39:49 +000049
50// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
51// RUN: -fPIC -shared -fsanitize=bounds %s -o %t.so 2>&1 \
52// RUN: | FileCheck --check-prefix=CHECK-DYN-BOUNDS %s
53
54// CHECK-DYN-BOUNDS: "{{.*}}ld{{(.exe)?}}"
55// CHECK-DYN-BOUNDS-NOT: libclang_rt.ubsan_osx.a