blob: 169c4bfec567a7af492c69ae593c9184f981972a [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 \
14// RUN: -fPIC -shared -fsanitize=address %s -o %t.so 2>&1 \
15// RUN: | FileCheck --check-prefix=CHECK-DYN-ASAN %s
16
Alexey Samsonov062441b2012-11-21 15:52:36 +000017// CHECK-DYN-ASAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov8368b372012-11-21 14:17:42 +000018// CHECK-DYN-ASAN: "-dylib"
Kuba Breckae899e792014-11-04 23:38:57 +000019// CHECK-DYN-ASAN: libclang_rt.asan_osx_dynamic.dylib"
Kuba Brecka9ff912d2014-11-04 17:35:17 +000020// CHECK-DYN-ASAN: "-rpath" "@executable_path"
Kuba Breckae899e792014-11-04 23:38:57 +000021// CHECK-DYN-ASAN: "-rpath" "{{.*}}lib{{.*}}darwin"
Alexey Samsonov8368b372012-11-21 14:17:42 +000022
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 Samsonov062441b2012-11-21 15:52:36 +000027// CHECK-UBSAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonove0619f52012-11-25 13:40:21 +000028// CHECK-UBSAN: stdc++
Alexey Samsonov498f3c32015-03-23 23:14:05 +000029// CHECK-UBSAN: libclang_rt.ubsan_osx_dynamic.dylib"
30// CHECK-UBSAN: "-rpath" "@executable_path"
31// CHECK-UBSAN: "-rpath" "{{.*}}lib{{.*}}darwin"
Alexey Samsonov8368b372012-11-21 14:17:42 +000032
33// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Richard Smith539e4a72013-02-23 02:53:19 +000034// RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \
35// RUN: %s -o %t.o 2>&1 \
Joey Goulyebc59d52012-11-23 10:39:49 +000036// RUN: | FileCheck --check-prefix=CHECK-BOUNDS %s
37
38// CHECK-BOUNDS: "{{.*}}ld{{(.exe)?}}"
39// CHECK-BOUNDS-NOT: libclang_rt.ubsan_osx.a"
Joey Goulyebc59d52012-11-23 10:39:49 +000040
41// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
Alexey Samsonov8368b372012-11-21 14:17:42 +000042// RUN: -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \
43// RUN: | FileCheck --check-prefix=CHECK-DYN-UBSAN %s
44
Alexey Samsonov062441b2012-11-21 15:52:36 +000045// CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}"
Alexey Samsonov8368b372012-11-21 14:17:42 +000046// CHECK-DYN-UBSAN: "-dylib"
Alexey Samsonov498f3c32015-03-23 23:14:05 +000047// CHECK-DYN-UBSAN: libclang_rt.ubsan_osx_dynamic.dylib"
48// CHECK-DYN-UBSAN: "-rpath" "@executable_path"
49// CHECK-DYN-UBSAN: "-rpath" "{{.*}}lib{{.*}}darwin"
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)?}}"
Alexey Samsonov498f3c32015-03-23 23:14:05 +000057// CHECK-DYN-BOUNDS-NOT: ubsan_osx
Anna Zakse67b4022016-02-02 02:04:48 +000058
59// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
60// RUN: -fsanitize=address -mios-simulator-version-min=7.0 %s -o %t.o 2>&1 \
61// RUN: | FileCheck --check-prefix=CHECK-ASAN-IOSSIM %s
62
63// CHECK-ASAN-IOSSIM: "{{.*}}ld{{(.exe)?}}"
64// CHECK-ASAN-IOSSIM: lc++
65// CHECK-ASAN-IOSSIM: libclang_rt.asan_iossim_dynamic.dylib"
66// CHECK-ASAN-IOSSIM: "-rpath" "@executable_path"
67// CHECK-ASAN-IOSSIM: "-rpath" "{{.*}}lib{{.*}}darwin"
68
69// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
70// RUN: -fsanitize=address -mtvos-simulator-version-min=8.3.0 %s -o %t.o 2>&1 \
71// RUN: | FileCheck --check-prefix=CHECK-ASAN-TVOSSIM %s
72
73// CHECK-ASAN-TVOSSIM: "{{.*}}ld{{(.exe)?}}"
74// CHECK-ASAN-TVOSSIM: lc++
75// CHECK-ASAN-TVOSSIM: libclang_rt.asan_tvossim_dynamic.dylib"
76// CHECK-ASAN-TVOSSIM: "-rpath" "@executable_path"
77// CHECK-ASAN-TVOSSIM: "-rpath" "{{.*}}lib{{.*}}darwin"
78
79// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
80// RUN: -fsanitize=address -mwatchos-simulator-version-min=2.0.0 %s -o %t.o 2>&1 \
81// RUN: | FileCheck --check-prefix=CHECK-ASAN-WATCHOSSIM %s
82
83// CHECK-ASAN-WATCHOSSIM: "{{.*}}ld{{(.exe)?}}"
84// CHECK-ASAN-WATCHOSSIM: lc++
85// CHECK-ASAN-WATCHOSSIM: libclang_rt.asan_watchossim_dynamic.dylib"
86// CHECK-ASAN-WATCHOSSIM: "-rpath" "@executable_path"
87// CHECK-ASAN-WATCHOSSIM: "-rpath" "{{.*}}lib{{.*}}darwin"
88
89// RUN: %clang -no-canonical-prefixes -### -target armv7-apple-ios \
90// RUN: -fsanitize=address -miphoneos-version-min=7 %s -o %t.o 2>&1 \
91// RUN: | FileCheck --check-prefix=CHECK-ASAN-IOS %s
92
93// CHECK-ASAN-IOS: "{{.*}}ld{{(.exe)?}}"
94// CHECK-ASAN-IOS: lc++
95// CHECK-ASAN-IOS: libclang_rt.asan_ios_dynamic.dylib"
96// CHECK-ASAN-IOS: "-rpath" "@executable_path"
97// CHECK-ASAN-IOS: "-rpath" "{{.*}}lib{{.*}}darwin"
98
99// RUN: %clang -no-canonical-prefixes -### -target arm64-apple-tvos \
100// RUN: -fsanitize=address -mtvos-version-min=8.3 %s -o %t.o 2>&1 \
101// RUN: | FileCheck --check-prefix=CHECK-ASAN-TVOS %s
102
103// CHECK-ASAN-TVOS: "{{.*}}ld{{(.exe)?}}"
104// CHECK-ASAN-TVOS: lc++
105// CHECK-ASAN-TVOS: libclang_rt.asan_tvos_dynamic.dylib"
106// CHECK-ASAN-TVOS: "-rpath" "@executable_path"
107// CHECK-ASAN-TVOS: "-rpath" "{{.*}}lib{{.*}}darwin"
108
109// RUN: %clang -no-canonical-prefixes -### -target armv7k-apple-watchos \
110// RUN: -fsanitize=address -mwatchos-version-min=2.0 %s -o %t.o 2>&1 \
111// RUN: | FileCheck --check-prefix=CHECK-ASAN-WATCHOS %s
112
113// CHECK-ASAN-WATCHOS: "{{.*}}ld{{(.exe)?}}"
114// CHECK-ASAN-WATCHOS: lc++
115// CHECK-ASAN-WATCHOS: libclang_rt.asan_watchos_dynamic.dylib"
116// CHECK-ASAN-WATCHOS: "-rpath" "@executable_path"
117// CHECK-ASAN-WATCHOS: "-rpath" "{{.*}}lib{{.*}}darwin"