summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Krasin <krasin@chromium.org>2016-08-12 17:26:37 +0000
committerIvan Krasin <krasin@chromium.org>2016-08-12 17:26:37 +0000
commit3fbf3a0cb4ccc8060d9410bbfa355f90999beae0 (patch)
treee3b8a0f8e77580f8c00508212950af2a3a3212e8
parentc10f095ca2b622996e8b19498d8d598318d55957 (diff)
Add compiler-rt side test for no_sanitize("cfi") attribute
Summary: Add a test case for __attribute__((no_sanitize("cfi"))) being effective. Reviewers: kcc Subscribers: dberris Differential Revision: https://reviews.llvm.org/D23425 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278530 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/cfi/simple-fail.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/cfi/simple-fail.cpp b/test/cfi/simple-fail.cpp
index 92b132271..595ca1617 100644
--- a/test/cfi/simple-fail.cpp
+++ b/test/cfi/simple-fail.cpp
@@ -52,6 +52,9 @@
// RUN: %clangxx -o %t18 %s
// RUN: %t18 2>&1 | FileCheck --check-prefix=NCFI %s
+// RUN: %clangxx_cfi -DCHECK_NO_SANITIZE_CFI -o %t19 %s
+// RUN: %t19 2>&1 | FileCheck --check-prefix=NCFI %s
+
// Tests that the CFI mechanism crashes the program when making a virtual call
// to an object of the wrong class but with a compatible vtable, by casting a
// pointer to such an object and attempting to make a call through it.
@@ -73,6 +76,9 @@ struct B {
void B::f() {}
+#if defined(CHECK_NO_SANITIZE_CFI)
+__attribute__((no_sanitize("cfi")))
+#endif
int main() {
create_derivers<B>();