summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/catch-undef-behavior.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-07-18 17:50:06 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-07-18 17:50:06 +0000
commit6c12414358031407667b75657b9d768080f16409 (patch)
treefdca701ab7a2c9095e7d95de449b704f5347caed /clang/test/CodeGenCXX/catch-undef-behavior.cpp
parent54502402193e5d58a450dd7d8b30c46ae9bbe484 (diff)
downloadbcm5719-llvm-6c12414358031407667b75657b9d768080f16409.tar.gz
bcm5719-llvm-6c12414358031407667b75657b9d768080f16409.zip
Make sure globals created by UBSan are not instrumented by ASan.
Summary: This change adds description of globals created by UBSan instrumentation (UBSan handlers, type descriptors, filenames) to llvm.asan.globals metadata, effectively "blacklisting" them. This can dramatically decrease the data section in binaries built with UBSan+ASan, as UBSan tends to create a lot of handlers, and ASan instrumentation increases the global size to at least 64 bytes. Test Plan: clang regression test suite Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits, byoungyoung, kcc Differential Revision: http://reviews.llvm.org/D4575 llvm-svn: 213392
Diffstat (limited to 'clang/test/CodeGenCXX/catch-undef-behavior.cpp')
-rw-r--r--clang/test/CodeGenCXX/catch-undef-behavior.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/catch-undef-behavior.cpp b/clang/test/CodeGenCXX/catch-undef-behavior.cpp
index d97893378e2..f875d9299e9 100644
--- a/clang/test/CodeGenCXX/catch-undef-behavior.cpp
+++ b/clang/test/CodeGenCXX/catch-undef-behavior.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -std=c++11 -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -fsanitize=vptr,address -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-ASAN
struct S {
double d;
@@ -6,6 +7,12 @@ struct S {
virtual int f();
};
+// Check that type descriptor global is not modified by ASan.
+// CHECK-ASAN: [[TYPE_DESCR:@[0-9]+]] = private unnamed_addr constant { i16, i16, [4 x i8] } { i16 -1, i16 0, [4 x i8] c"'S'\00" }
+
+// Check that type mismatch handler is not modified by ASan.
+// CHECK-ASAN: private unnamed_addr global { { [{{.*}} x i8]*, i32, i32 }, { i16, i16, [4 x i8] }*, i8*, i8 } { {{.*}}, { i16, i16, [4 x i8] }* [[TYPE_DESCR]], {{.*}} }
+
struct T : S {};
// CHECK-LABEL: @_Z17reference_binding
@@ -31,6 +38,7 @@ void reference_binding(int *p, S *q) {
}
// CHECK-LABEL: @_Z13member_access
+// CHECK-ASAN-LABEL: @_Z13member_access
void member_access(S *p) {
// (1a) Check 'p' is appropriately sized and aligned for member access.
OpenPOWER on IntegriCloud