| Alexey Samsonov | 8368b37 | 2012-11-21 14:17:42 +0000 | [diff] [blame] | 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 | |
| Alexey Samsonov | 062441b | 2012-11-21 15:52:36 +0000 | [diff] [blame] | 7 | // CHECK-ASAN: "{{.*}}ld{{(.exe)?}}" |
| Alexey Samsonov | e0619f5 | 2012-11-25 13:40:21 +0000 | [diff] [blame] | 8 | // CHECK-ASAN: stdc++ |
| Kuba Brecka | e899e79 | 2014-11-04 23:38:57 +0000 | [diff] [blame] | 9 | // CHECK-ASAN: libclang_rt.asan_osx_dynamic.dylib" |
| Kuba Brecka | 9ff912d | 2014-11-04 17:35:17 +0000 | [diff] [blame] | 10 | // CHECK-ASAN: "-rpath" "@executable_path" |
| Kuba Brecka | e899e79 | 2014-11-04 23:38:57 +0000 | [diff] [blame] | 11 | // CHECK-ASAN: "-rpath" "{{.*}}lib{{.*}}darwin" |
| Alexey Samsonov | 8368b37 | 2012-11-21 14:17:42 +0000 | [diff] [blame] | 12 | |
| 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 Samsonov | 062441b | 2012-11-21 15:52:36 +0000 | [diff] [blame] | 17 | // CHECK-DYN-ASAN: "{{.*}}ld{{(.exe)?}}" |
| Alexey Samsonov | 8368b37 | 2012-11-21 14:17:42 +0000 | [diff] [blame] | 18 | // CHECK-DYN-ASAN: "-dylib" |
| Kuba Brecka | e899e79 | 2014-11-04 23:38:57 +0000 | [diff] [blame] | 19 | // CHECK-DYN-ASAN: libclang_rt.asan_osx_dynamic.dylib" |
| Kuba Brecka | 9ff912d | 2014-11-04 17:35:17 +0000 | [diff] [blame] | 20 | // CHECK-DYN-ASAN: "-rpath" "@executable_path" |
| Kuba Brecka | e899e79 | 2014-11-04 23:38:57 +0000 | [diff] [blame] | 21 | // CHECK-DYN-ASAN: "-rpath" "{{.*}}lib{{.*}}darwin" |
| Alexey Samsonov | 8368b37 | 2012-11-21 14:17:42 +0000 | [diff] [blame] | 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 Samsonov | 062441b | 2012-11-21 15:52:36 +0000 | [diff] [blame] | 27 | // CHECK-UBSAN: "{{.*}}ld{{(.exe)?}}" |
| Alexey Samsonov | e0619f5 | 2012-11-25 13:40:21 +0000 | [diff] [blame] | 28 | // CHECK-UBSAN: stdc++ |
| Alexey Samsonov | 498f3c3 | 2015-03-23 23:14:05 +0000 | [diff] [blame] | 29 | // CHECK-UBSAN: libclang_rt.ubsan_osx_dynamic.dylib" |
| 30 | // CHECK-UBSAN: "-rpath" "@executable_path" |
| 31 | // CHECK-UBSAN: "-rpath" "{{.*}}lib{{.*}}darwin" |
| Alexey Samsonov | 8368b37 | 2012-11-21 14:17:42 +0000 | [diff] [blame] | 32 | |
| 33 | // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ |
| Richard Smith | 539e4a7 | 2013-02-23 02:53:19 +0000 | [diff] [blame] | 34 | // RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \ |
| 35 | // RUN: %s -o %t.o 2>&1 \ |
| Joey Gouly | ebc59d5 | 2012-11-23 10:39:49 +0000 | [diff] [blame] | 36 | // RUN: | FileCheck --check-prefix=CHECK-BOUNDS %s |
| 37 | |
| 38 | // CHECK-BOUNDS: "{{.*}}ld{{(.exe)?}}" |
| 39 | // CHECK-BOUNDS-NOT: libclang_rt.ubsan_osx.a" |
| Joey Gouly | ebc59d5 | 2012-11-23 10:39:49 +0000 | [diff] [blame] | 40 | |
| 41 | // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ |
| Alexey Samsonov | 8368b37 | 2012-11-21 14:17:42 +0000 | [diff] [blame] | 42 | // RUN: -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \ |
| 43 | // RUN: | FileCheck --check-prefix=CHECK-DYN-UBSAN %s |
| 44 | |
| Alexey Samsonov | 062441b | 2012-11-21 15:52:36 +0000 | [diff] [blame] | 45 | // CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}" |
| Alexey Samsonov | 8368b37 | 2012-11-21 14:17:42 +0000 | [diff] [blame] | 46 | // CHECK-DYN-UBSAN: "-dylib" |
| Alexey Samsonov | 498f3c3 | 2015-03-23 23:14:05 +0000 | [diff] [blame] | 47 | // CHECK-DYN-UBSAN: libclang_rt.ubsan_osx_dynamic.dylib" |
| 48 | // CHECK-DYN-UBSAN: "-rpath" "@executable_path" |
| 49 | // CHECK-DYN-UBSAN: "-rpath" "{{.*}}lib{{.*}}darwin" |
| Joey Gouly | ebc59d5 | 2012-11-23 10:39:49 +0000 | [diff] [blame] | 50 | |
| 51 | // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ |
| Richard Smith | 539e4a7 | 2013-02-23 02:53:19 +0000 | [diff] [blame] | 52 | // RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \ |
| 53 | // RUN: %s -o %t.so -fPIC -shared 2>&1 \ |
| Joey Gouly | ebc59d5 | 2012-11-23 10:39:49 +0000 | [diff] [blame] | 54 | // RUN: | FileCheck --check-prefix=CHECK-DYN-BOUNDS %s |
| 55 | |
| 56 | // CHECK-DYN-BOUNDS: "{{.*}}ld{{(.exe)?}}" |
| Alexey Samsonov | 498f3c3 | 2015-03-23 23:14:05 +0000 | [diff] [blame] | 57 | // CHECK-DYN-BOUNDS-NOT: ubsan_osx |
| Anna Zaks | e67b402 | 2016-02-02 02:04:48 +0000 | [diff] [blame^] | 58 | |
| 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" |