1 // REQUIRES: arm-registered-target
2
3 /// Check warning for
4 // RUN: %clang -target arm-arm-none-eabi -march=armv7-m -mbranch-protection=bti %s -S -emit-llvm -o - 2>&1 | FileCheck %s
5
f()6 __attribute__((target("arch=cortex-m0"))) void f() {}
7
8 // CHECK: warning: ignoring the 'branch-protection' attribute because the 'cortex-m0' architecture does not support it [-Wbranch-protection]
9 // CHECK-NEXT: __attribute__((target("arch=cortex-m0"))) void f() {}
10
11 /// Check there are no branch protection function attributes
12
13 // CHECK-NOT: attributes { {{.*}} "sign-return-address"
14 // CHECK-NOT: attributes { {{.*}} "sign-return-address-key"
15 // CHECK-NOT: attributes { {{.*}} "branch-target-enforcement"
16
17 /// Check that there are branch protection module attributes despite the warning.
18 // CHECK: !{i32 8, !"branch-target-enforcement", i32 1}
19