Home | History | Annotate | Download | only in Driver
      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: stdc++
     39 // CHECK-UBSAN: libclang_rt.ubsan_osx_dynamic.dylib"
     40 // CHECK-UBSAN: "-rpath" "@executable_path"
     41 // CHECK-UBSAN: "-rpath" "{{.*}}lib{{.*}}darwin"
     42 
     43 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
     44 // RUN:   -fsanitize=bounds -fsanitize-undefined-trap-on-error \
     45 // RUN:   %s -o %t.o 2>&1 \
     46 // RUN:   | FileCheck --check-prefix=CHECK-BOUNDS %s
     47 
     48 // CHECK-BOUNDS: "{{.*}}ld{{(.exe)?}}"
     49 // CHECK-BOUNDS-NOT: libclang_rt.ubsan_osx.a"
     50 
     51 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
     52 // RUN:   -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \
     53 // RUN:   | FileCheck --check-prefix=CHECK-DYN-UBSAN %s
     54 
     55 // CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}"
     56 // CHECK-DYN-UBSAN: "-dylib"
     57 // CHECK-DYN-UBSAN: libclang_rt.ubsan_osx_dynamic.dylib"
     58 // CHECK-DYN-UBSAN: "-rpath" "@executable_path"
     59 // CHECK-DYN-UBSAN: "-rpath" "{{.*}}lib{{.*}}darwin"
     60 
     61 // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
     62 // RUN:   -fsanitize=bounds -fsanitize-undefined-trap-on-error \
     63 // RUN:   %s -o %t.so -fPIC -shared 2>&1 \
     64 // RUN:   | FileCheck --check-prefix=CHECK-DYN-BOUNDS %s
     65 
     66 // CHECK-DYN-BOUNDS: "{{.*}}ld{{(.exe)?}}"
     67 // CHECK-DYN-BOUNDS-NOT: ubsan_osx
     68