summaryrefslogtreecommitdiff
path: root/test/CodeGen/shadowcallstack-attr.c
blob: 45e710d875627fce82327166bf4a6d2128f99cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// RUN: %clang_cc1 -triple x86_64-linux-unknown -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=UNBLACKLISTED %s

// RUN: %clang_cc1 -D ATTR -triple x86_64-linux-unknown -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=BLACKLISTED %s

// RUN: echo -e "[shadow-call-stack]\nfun:foo" > %t
// RUN: %clang_cc1 -fsanitize-blacklist=%t -triple x86_64-linux-unknown -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=BLACKLISTED %s

#ifdef ATTR
__attribute__((no_sanitize("shadow-call-stack")))
#endif
int foo(int *a) { return *a; }

// CHECK: define i32 @foo(i32* %a)

// BLACKLISTED-NOT: attributes {{.*}}shadowcallstack{{.*}}
// UNBLACKLISTED: attributes {{.*}}shadowcallstack{{.*}}