xref: /llvm-project/clang/test/Frontend/arm-branch-protection-default-arch.c (revision 1f08b0867412d5696ed624a2da78bdba2cc672c3)
1 // REQUIRES: arm-registered-target
2 
3 /// Check warning for
4 // RUN: %clang -target arm-arm-none-eabi %s -S -o - 2>&1 | FileCheck %s
5 
f1()6 __attribute__((target("branch-protection=bti"))) void f1() {}
f2()7 __attribute__((target("branch-protection=pac-ret"))) void f2() {}
f3()8 __attribute__((target("branch-protection=bti+pac-ret"))) void f3() {}
f4()9 __attribute__((target("branch-protection=bti+pac-ret+leaf"))) void f4() {}
10 
11 // CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
12 // CHECK-NEXT: __attribute__((target("branch-protection=bti"))) void f1() {}
13 
14 // CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
15 // CHECK-NEXT: __attribute__((target("branch-protection=pac-ret"))) void f2() {}
16 
17 // CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
18 // CHECK-NEXT: __attribute__((target("branch-protection=bti+pac-ret"))) void f3() {}
19 
20 // CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
21 // CHECK-NEXT: __attribute__((target("branch-protection=bti+pac-ret+leaf"))) void f4() {}
22 
23 /// Check there are no branch protection function attributes
24 
25 // CHECK-NOT:  attributes { {{.*}} "sign-return-address"
26 // CHECK-NOT:  attributes { {{.*}} "sign-return-address-key"
27 // CHECK-NOT:  attributes { {{.*}} "branch-target-enforcement"
28