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 7 // CHECK-ASAN: "{{.*}}ld{{(.exe)?}}" 8 // CHECK-ASAN: stdc++ 9 // CHECK-ASAN: libclang_rt.asan_osx_dynamic.dylib" 10 // CHECK-ASAN: "-rpath" "@executable_path" 11 // CHECK-ASAN: "-rpath" "{{.*}}lib{{.*}}darwin" 12 13 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ 14 // 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)?}}" 18 // CHECK-ASAN-IOSSIM: lc++ 19 // CHECK-ASAN-IOSSIM: libclang_rt.asan_iossim_dynamic.dylib" 20 // CHECK-ASAN-IOSSIM: "-rpath" "@executable_path" 21 // CHECK-ASAN-IOSSIM: "-rpath" "{{.*}}lib{{.*}}darwin" 22 23 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ 24 // RUN: -fPIC -shared -fsanitize=address %s -o %t.so 2>&1 \ 25 // RUN: | FileCheck --check-prefix=CHECK-DYN-ASAN %s 26 27 // CHECK-DYN-ASAN: "{{.*}}ld{{(.exe)?}}" 28 // CHECK-DYN-ASAN: "-dylib" 29 // CHECK-DYN-ASAN: libclang_rt.asan_osx_dynamic.dylib" 30 // CHECK-DYN-ASAN: "-rpath" "@executable_path" 31 // CHECK-DYN-ASAN: "-rpath" "{{.*}}lib{{.*}}darwin" 32 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 37 // CHECK-UBSAN: "{{.*}}ld{{(.exe)?}}" 38 // CHECK-UBSAN: libclang_rt.ubsan_osx.a" 39 // CHECK-UBSAN: stdc++ 40 41 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ 42 // RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \ 43 // RUN: %s -o %t.o 2>&1 \ 44 // RUN: | FileCheck --check-prefix=CHECK-BOUNDS %s 45 46 // CHECK-BOUNDS: "{{.*}}ld{{(.exe)?}}" 47 // CHECK-BOUNDS-NOT: libclang_rt.ubsan_osx.a" 48 49 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ 50 // RUN: -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \ 51 // RUN: | FileCheck --check-prefix=CHECK-DYN-UBSAN %s 52 53 // CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}" 54 // CHECK-DYN-UBSAN: "-dylib" 55 // CHECK-DYN-UBSAN: libclang_rt.ubsan_osx.a 56 57 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ 58 // RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \ 59 // RUN: %s -o %t.so -fPIC -shared 2>&1 \ 60 // 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 64