blob: 500fec4b2fcfc2fb7412cd826e8b3dff21c645af [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++
Kuba Breckae899e792014-11-04 23:38:57 +00009// CHECK-ASAN: libclang_rt.asan_osx_dynamic.dylib"
Kuba Brecka9ff912d2014-11-04 17:35:17 +000010// CHECK-ASAN: "-rpath" "@executable_path"
Kuba Breckae899e792014-11-04 23:38:57 +000011// CHECK-ASAN: "-rpath" "{{.*}}lib{{.*}}darwin"
Alexey Samsonov8368b372012-11-21 14:17:42 +000012
13// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Alexander Potapenko868cca92013-11-15 16:07:44 +000014// RUN: -fsanitize=address -mios-simulator-version-min=7.0 %s -o %t.o 2>&1 \
15// RUN: | FileCheck --check-prefix=CHECK-ASAN-IOSSIM %s
16
17// CHECK-ASAN-IOSSIM: "{{.*}}ld{{(.exe)?}}"
Alexander Potapenko4fe13012013-11-15 16:57:57 +000018// CHECK-ASAN-IOSSIM: lc++
Kuba Breckae899e792014-11-04 23:38:57 +000019// CHECK-ASAN-IOSSIM: libclang_rt.asan_iossim_dynamic.dylib"
Kuba Brecka9ff912d2014-11-04 17:35:17 +000020// CHECK-ASAN-IOSSIM: "-rpath" "@executable_path"
Kuba Breckae899e792014-11-04 23:38:57 +000021// CHECK-ASAN-IOSSIM: "-rpath" "{{.*}}lib{{.*}}darwin"
Alexander Potapenko868cca92013-11-15 16:07:44 +000022
23// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Alexey Samsonov8368b372012-11-21 14:17:42 +000024// RUN: -fPIC -shared -fsanitize=address %s -o %t.so 2>&1 \
25// RUN: | FileCheck --check-prefix=CHECK-DYN-ASAN %s
26
Alexey Samsonov062441b2012-11-21 15:52:36 +000027// CHECK-DYN-ASAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov8368b372012-11-21 14:17:42 +000028// CHECK-DYN-ASAN: "-dylib"
Kuba Breckae899e792014-11-04 23:38:57 +000029// CHECK-DYN-ASAN: libclang_rt.asan_osx_dynamic.dylib"
Kuba Brecka9ff912d2014-11-04 17:35:17 +000030// CHECK-DYN-ASAN: "-rpath" "@executable_path"
Kuba Breckae899e792014-11-04 23:38:57 +000031// CHECK-DYN-ASAN: "-rpath" "{{.*}}lib{{.*}}darwin"
Alexey Samsonov8368b372012-11-21 14:17:42 +000032
33// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
34// RUN: -fsanitize=undefined %s -o %t.o 2>&1 \
35// RUN: | FileCheck --check-prefix=CHECK-UBSAN %s
36
Alexey Samsonov062441b2012-11-21 15:52:36 +000037// CHECK-UBSAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov8368b372012-11-21 14:17:42 +000038// CHECK-UBSAN: libclang_rt.ubsan_osx.a"
Alexey Samsonove0619f52012-11-25 13:40:21 +000039// CHECK-UBSAN: stdc++
Alexey Samsonov8368b372012-11-21 14:17:42 +000040
41// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Richard Smith539e4a72013-02-23 02:53:19 +000042// RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \
43// RUN: %s -o %t.o 2>&1 \
Joey Goulyebc59d52012-11-23 10:39:49 +000044// RUN: | FileCheck --check-prefix=CHECK-BOUNDS %s
45
46// CHECK-BOUNDS: "{{.*}}ld{{(.exe)?}}"
47// CHECK-BOUNDS-NOT: libclang_rt.ubsan_osx.a"
Joey Goulyebc59d52012-11-23 10:39:49 +000048
49// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Alexey Samsonov8368b372012-11-21 14:17:42 +000050// RUN: -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \
51// RUN: | FileCheck --check-prefix=CHECK-DYN-UBSAN %s
52
Alexey Samsonov062441b2012-11-21 15:52:36 +000053// CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov8368b372012-11-21 14:17:42 +000054// CHECK-DYN-UBSAN: "-dylib"
Alexey Samsonov969be242013-01-21 08:45:02 +000055// CHECK-DYN-UBSAN: libclang_rt.ubsan_osx.a
Joey Goulyebc59d52012-11-23 10:39:49 +000056
57// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Richard Smith539e4a72013-02-23 02:53:19 +000058// RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \
59// RUN: %s -o %t.so -fPIC -shared 2>&1 \
Joey Goulyebc59d52012-11-23 10:39:49 +000060// RUN: | FileCheck --check-prefix=CHECK-DYN-BOUNDS %s
61
62// CHECK-DYN-BOUNDS: "{{.*}}ld{{(.exe)?}}"
63// CHECK-DYN-BOUNDS-NOT: libclang_rt.ubsan_osx.a