Skip to content

Commit 2df94a9

Browse files
committed
Re-add attributes on function vars and decls.
1 parent 527297f commit 2df94a9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clang/test/CodeGen/cfi-salt.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fsanitize=kcfi -DORIG_ATTR_SYN -o - %s | FileCheck %s
12
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fsanitize=kcfi -o - %s | FileCheck %s
3+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fsanitize=kcfi -fpatchable-function-entry-offset=3 -DORIG_ATTR_SYN -o - %s | FileCheck %s --check-prefixes=CHECK,OFFSET
24
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fsanitize=kcfi -fpatchable-function-entry-offset=3 -o - %s | FileCheck %s --check-prefixes=CHECK,OFFSET
35

46
// Note that the interleving of functions, which normally would be in sequence,
@@ -8,7 +10,11 @@
810
#error Missing kcfi?
911
#endif
1012

13+
#ifdef ORIG_ATTR_SYN
14+
#define __cfi_salt __attribute__((cfi_salt("pepper")))
15+
#else
1116
#define __cfi_salt [[clang::cfi_salt("pepper")]]
17+
#endif
1218

1319
typedef int (*fn_t)(void);
1420
typedef int (* __cfi_salt fn_salt_t)(void);
@@ -55,7 +61,8 @@ int f7_typedef_salt(struct cfi_struct *ptr);
5561
// CHECK: call{{.*}} i32
5662
// CHECK-NOT: "kcfi"
5763
// CHECK-SAME: ()
58-
int __call(fn_t f) __attribute__((__no_sanitize__("kcfi"))) {
64+
__attribute__((__no_sanitize__("kcfi")))
65+
int __call(fn_t f) {
5966
return f();
6067
}
6168

0 commit comments

Comments
 (0)