blob: 1aef0caf9f093a1a2e0050f7fbf5d13b0c4c6738 [file] [log] [blame]
Alexey Samsonov8368b372012-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 Samsonov062441b2012-11-21 15:52:36 +00007// CHECK-ASAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonove0619f52012-11-25 13:40:21 +00008// CHECK-ASAN: stdc++
Alexander Potapenko4462c5b2013-09-20 08:23:19 +00009// CHECK-ASAN: libclang_rt.asan_osx_dynamic.dylib"
Alexey Samsonov8368b372012-11-21 14:17:42 +000010
11// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Alexander Potapenko868cca92013-11-15 16:07:44 +000012// 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: stdc++
17// CHECK-ASAN-IOSSIM: libclang_rt.asan_iossim_dynamic.dylib"
18
19// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Alexey Samsonov8368b372012-11-21 14:17:42 +000020// RUN: -fPIC -shared -fsanitize=address %s -o %t.so 2>&1 \
21// RUN: | FileCheck --check-prefix=CHECK-DYN-ASAN %s
22
Alexey Samsonov062441b2012-11-21 15:52:36 +000023// CHECK-DYN-ASAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov8368b372012-11-21 14:17:42 +000024// CHECK-DYN-ASAN: "-dylib"
Alexander Potapenko4462c5b2013-09-20 08:23:19 +000025// CHECK-DYN-ASAN: libclang_rt.asan_osx_dynamic.dylib
Alexey Samsonov8368b372012-11-21 14:17:42 +000026
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
Alexey Samsonov062441b2012-11-21 15:52:36 +000031// CHECK-UBSAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov8368b372012-11-21 14:17:42 +000032// CHECK-UBSAN: libclang_rt.ubsan_osx.a"
Alexey Samsonove0619f52012-11-25 13:40:21 +000033// CHECK-UBSAN: stdc++
Alexey Samsonov8368b372012-11-21 14:17:42 +000034
35// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Richard Smith539e4a72013-02-23 02:53:19 +000036// RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \
37// RUN: %s -o %t.o 2>&1 \
Joey Goulyebc59d52012-11-23 10:39:49 +000038// RUN: | FileCheck --check-prefix=CHECK-BOUNDS %s
39
40// CHECK-BOUNDS: "{{.*}}ld{{(.exe)?}}"
41// CHECK-BOUNDS-NOT: libclang_rt.ubsan_osx.a"
Joey Goulyebc59d52012-11-23 10:39:49 +000042
43// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Alexey Samsonov8368b372012-11-21 14:17:42 +000044// RUN: -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \
45// RUN: | FileCheck --check-prefix=CHECK-DYN-UBSAN %s
46
Alexey Samsonov062441b2012-11-21 15:52:36 +000047// CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov8368b372012-11-21 14:17:42 +000048// CHECK-DYN-UBSAN: "-dylib"
Alexey Samsonov969be242013-01-21 08:45:02 +000049// CHECK-DYN-UBSAN: libclang_rt.ubsan_osx.a
Joey Goulyebc59d52012-11-23 10:39:49 +000050
51// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Richard Smith539e4a72013-02-23 02:53:19 +000052// RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \
53// RUN: %s -o %t.so -fPIC -shared 2>&1 \
Joey Goulyebc59d52012-11-23 10:39:49 +000054// 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