Files
clang-p2996/clang/test/CodeGen/stack-protector-guard.c
Nick Desaulniers 033138ea45 [IR] make stack-protector-guard-* flags into module attrs
D88631 added initial support for:

- -mstack-protector-guard=
- -mstack-protector-guard-reg=
- -mstack-protector-guard-offset=

flags, and D100919 extended these to AArch64. Unfortunately, these flags
aren't retained for LTO. Make them module attributes rather than
TargetOptions.

Link: https://github.com/ClangBuiltLinux/linux/issues/1378

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D102742
2021-05-21 15:53:30 -07:00

17 lines
713 B
C

// RUN: %clang_cc1 -mstack-protector-guard=sysreg \
// RUN: -mstack-protector-guard-reg=sp_el0 \
// RUN: -mstack-protector-guard-offset=1024 \
// RUN: -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-NONE %s
void foo(int*);
void bar(int x) {
int baz[x];
foo(baz);
}
// CHECK: !llvm.module.flags = !{{{.*}}[[ATTR1:![0-9]+]], [[ATTR2:![0-9]+]], [[ATTR3:![0-9]+]]}
// CHECK: [[ATTR1]] = !{i32 1, !"stack-protector-guard", !"sysreg"}
// CHECK: [[ATTR2]] = !{i32 1, !"stack-protector-guard-reg", !"sp_el0"}
// CHECK: [[ATTR3]] = !{i32 1, !"stack-protector-guard-offset", i32 1024}
// CHECK-NONE-NOT: !"stack-protector-guard