mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-14 09:26:07 +00:00

Summary: Add support for the -fsanitize=shadow-call-stack flag which causes clang to add ShadowCallStack attribute to functions compiled with that flag enabled. Reviewers: pcc, kcc Reviewed By: pcc, kcc Subscribers: cryptoad, cfe-commits, kcc Differential Revision: https://reviews.llvm.org/D44801 llvm-svn: 329122
17 lines
753 B
C
17 lines
753 B
C
// 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{{.*}}
|