2016-04-29 01:09:37 +08:00
|
|
|
// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility hidden -fms-extensions -fsanitize=cfi-vcall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOBL %s
|
2017-09-26 06:11:12 +08:00
|
|
|
|
|
|
|
// Check that blacklisting cfi and cfi-vcall work correctly
|
|
|
|
// RUN: echo "[cfi-vcall]" > %t.vcall.txt
|
|
|
|
// RUN: echo "type:std::*" >> %t.vcall.txt
|
|
|
|
// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility hidden -fms-extensions -fsanitize=cfi-vcall -fsanitize-blacklist=%t.vcall.txt -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOSTD %s
|
|
|
|
//
|
|
|
|
// RUN: echo "[cfi]" > %t.cfi.txt
|
|
|
|
// RUN: echo "type:std::*" >> %t.cfi.txt
|
|
|
|
// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility hidden -fms-extensions -fsanitize=cfi-vcall -fsanitize-blacklist=%t.cfi.txt -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOSTD %s
|
|
|
|
|
|
|
|
// Check that blacklisting non-vcall modes does not affect vcalls
|
|
|
|
// RUN: echo "[cfi-icall|cfi-nvcall|cfi-cast-strict|cfi-derived-cast|cfi-unrelated-cast]" > %t.other.txt
|
|
|
|
// RUN: echo "type:std::*" >> %t.other.txt
|
|
|
|
// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility hidden -fms-extensions -fsanitize=cfi-vcall -fsanitize-blacklist=%t.other.txt -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOBL %s
|
2016-04-29 01:09:37 +08:00
|
|
|
|
|
|
|
struct S1 {
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
|
|
|
|
struct S2 {
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: define{{.*}}s1f
|
2016-06-25 05:21:46 +08:00
|
|
|
// NOBL: llvm.type.test
|
|
|
|
// NOSTD: llvm.type.test
|
2016-04-29 01:09:37 +08:00
|
|
|
void s1f(S1 *s1) {
|
|
|
|
s1->f();
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: define{{.*}}s2f
|
2016-06-25 05:21:46 +08:00
|
|
|
// NOBL: llvm.type.test
|
|
|
|
// NOSTD-NOT: llvm.type.test
|
2016-04-29 01:09:37 +08:00
|
|
|
void s2f(std::S2 *s2) {
|
|
|
|
s2->f();
|
|
|
|
}
|