forked from OSchip/llvm-project
103 lines
4.4 KiB
C
103 lines
4.4 KiB
C
|
// Test sanitizers ld flags.
|
||
|
|
||
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||
|
// RUN: -target i386-unknown-linux -fsanitize=address \
|
||
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX %s
|
||
|
//
|
||
|
// CHECK-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
||
|
// CHECK-ASAN-LINUX-NOT: "-lc"
|
||
|
// CHECK-ASAN-LINUX: libclang_rt.asan-i386.a"
|
||
|
// CHECK-ASAN-LINUX: "-lpthread"
|
||
|
// CHECK-ASAN-LINUX: "-ldl"
|
||
|
// CHECK-ASAN-LINUX: "-export-dynamic"
|
||
|
|
||
|
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||
|
// RUN: -target i386-unknown-linux -fsanitize=address \
|
||
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s
|
||
|
//
|
||
|
// CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
||
|
// CHECK-ASAN-LINUX-CXX-NOT: "-lc"
|
||
|
// CHECK-ASAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive"
|
||
|
// CHECK-ASAN-LINUX-CXX: "-lpthread"
|
||
|
// CHECK-ASAN-LINUX-CXX: "-ldl"
|
||
|
// CHECK-ASAN-LINUX-CXX: "-export-dynamic"
|
||
|
// CHECK-ASAN-LINUX-CXX: stdc++
|
||
|
|
||
|
// RUN: %clang -no-canonical-prefixes %s -### -o /dev/null -fsanitize=address \
|
||
|
// RUN: -target i386-unknown-linux --sysroot=%S/Inputs/basic_linux_tree \
|
||
|
// RUN: -lstdc++ -static 2>&1 \
|
||
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX-STATIC %s
|
||
|
//
|
||
|
// CHECK-ASAN-LINUX-CXX-STATIC: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
||
|
// CHECK-ASAN-LINUX-CXX-STATIC-NOT: stdc++
|
||
|
// CHECK-ASAN-LINUX-CXX-STATIC: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive"
|
||
|
// CHECK-ASAN-LINUX-CXX-STATIC: stdc++
|
||
|
|
||
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||
|
// RUN: -target arm-linux-androideabi -fsanitize=address \
|
||
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
|
||
|
//
|
||
|
// CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
||
|
// CHECK-ASAN-ANDROID-NOT: "-lc"
|
||
|
// CHECK-ASAN-ANDROID: libclang_rt.asan-arm-android.so"
|
||
|
// CHECK-ASAN-ANDROID-NOT: "-lpthread"
|
||
|
//
|
||
|
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||
|
// RUN: -target arm-linux-androideabi -fsanitize=address \
|
||
|
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||
|
// RUN: -shared \
|
||
|
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
|
||
|
//
|
||
|
// CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
||
|
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lc"
|
||
|
// CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan-arm-android.so"
|
||
|
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
|
||
|
|
||
|
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||
|
// RUN: -target x86_64-unknown-linux -lstdc++ -fsanitize=thread \
|
||
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||
|
// RUN: | FileCheck --check-prefix=CHECK-TSAN-LINUX-CXX %s
|
||
|
//
|
||
|
// CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
||
|
// CHECK-TSAN-LINUX-CXX-NOT: stdc++
|
||
|
// CHECK-TSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "-no-whole-archive"
|
||
|
// CHECK-TSAN-LINUX-CXX: "-lpthread"
|
||
|
// CHECK-TSAN-LINUX-CXX: "-ldl"
|
||
|
// CHECK-TSAN-LINUX-CXX: "-export-dynamic"
|
||
|
// CHECK-TSAN-LINUX-CXX: stdc++
|
||
|
|
||
|
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||
|
// RUN: -target x86_64-unknown-linux -lstdc++ -fsanitize=memory \
|
||
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||
|
// RUN: | FileCheck --check-prefix=CHECK-MSAN-LINUX-CXX %s
|
||
|
//
|
||
|
// CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
||
|
// CHECK-MSAN-LINUX-CXX-NOT: stdc++
|
||
|
// CHECK-MSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "-no-whole-archive"
|
||
|
// CHECK-MSAN-LINUX-CXX: "-lpthread"
|
||
|
// CHECK-MSAN-LINUX-CXX: "-ldl"
|
||
|
// CHECK-MSAN-LINUX-CXX: "-export-dynamic"
|
||
|
// CHECK-MSAN-LINUX-CXX: stdc++
|
||
|
|
||
|
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
|
||
|
// RUN: -target i386-unknown-linux \
|
||
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
|
||
|
// CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
|
||
|
// CHECK-UBSAN-LINUX-NOT: "-lc"
|
||
|
// CHECK-UBSAN-LINUX: libclang_rt.ubsan-i386.a"
|
||
|
// CHECK-UBSAN-LINUX: "-lpthread"
|
||
|
|
||
|
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
|
||
|
// RUN: -target i386-unknown-linux \
|
||
|
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||
|
// RUN: -shared \
|
||
|
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHARED %s
|
||
|
// CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}"
|
||
|
// CHECK-UBSAN-LINUX-SHARED-NOT: "-lc"
|
||
|
// CHECK-UBSAN-LINUX-SHARED: libclang_rt.ubsan-i386.a"
|
||
|
// CHECK-UBSAN-LINUX-SHARED: "-lpthread"
|