From 88661f55c3292ca7b6c265aa559ec34010e82f1d Mon Sep 17 00:00:00 2001 From: Ivan Krasin Date: Fri, 12 Aug 2016 17:26:37 +0000 Subject: [PATCH] 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 llvm-svn: 278530 --- compiler-rt/test/cfi/simple-fail.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler-rt/test/cfi/simple-fail.cpp b/compiler-rt/test/cfi/simple-fail.cpp index 92b1322..595ca16 100644 --- a/compiler-rt/test/cfi/simple-fail.cpp +++ b/compiler-rt/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(); -- 2.7.4