| 1 |
// REQUIRES: arm-registered-target |
| 2 |
// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -emit-llvm %s -o - \ |
| 3 |
// RUN: | FileCheck %s --check-prefix=CHECK |
| 4 |
// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -mbranch-target-enforce -emit-llvm %s -o - \ |
| 5 |
// RUN: | FileCheck %s --check-prefix=CHECK |
| 6 |
// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -msign-return-address=all -emit-llvm %s -o - \ |
| 7 |
// RUN: | FileCheck %s --check-prefix=CHECK |
| 8 |
// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -mbranch-target-enforce -msign-return-address=all -emit-llvm %s -o - \ |
| 9 |
// RUN: | FileCheck %s --check-prefix=CHECK |
| 10 |
|
| 11 |
__attribute__((target("branch-protection=none"))) void none() {} |
| 12 |
// CHECK: define{{.*}} void @none() #[[#NONE:]] |
| 13 |
|
| 14 |
__attribute__((target("branch-protection=standard"))) void std() {} |
| 15 |
// CHECK: define{{.*}} void @std() #[[#STD:]] |
| 16 |
|
| 17 |
__attribute__((target("branch-protection=bti"))) void btionly() {} |
| 18 |
// CHECK: define{{.*}} void @btionly() #[[#BTI:]] |
| 19 |
|
| 20 |
__attribute__((target("branch-protection=pac-ret"))) void paconly0() {} |
| 21 |
// CHECK: define{{.*}} void @paconly0() #[[#PAC:]] |
| 22 |
|
| 23 |
__attribute__((target("branch-protection=pac-ret+b-key"))) void paconly1() {} |
| 24 |
// CHECK: define{{.*}} void @paconly1() #[[#PAC]] |
| 25 |
|
| 26 |
__attribute__((target("branch-protection=pac-ret+bti"))) void pacbti0() {} |
| 27 |
// CHECK: define{{.*}} void @pacbti0() #[[#STD]] |
| 28 |
|
| 29 |
__attribute__((target("branch-protection=bti+pac-ret"))) void pacbti1() {} |
| 30 |
// CHECK: define{{.*}} void @pacbti1() #[[#STD]] |
| 31 |
|
| 32 |
__attribute__((target("branch-protection=pac-ret+leaf"))) void leaf() {} |
| 33 |
// CHECK: define{{.*}} void @leaf() #[[#PACLEAF:]] |
| 34 |
|
| 35 |
__attribute__((target("branch-protection=pac-ret+leaf+bti"))) void btileaf() {} |
| 36 |
// CHECK: define{{.*}} void @btileaf() #[[#BTIPACLEAF:]] |
| 37 |
|
| 38 |
// CHECK-DAG: attributes #[[#NONE]] = { {{.*}} |
| 39 |
|
| 40 |
// CHECK-DAG: attributes #[[#STD]] = { {{.*}} "branch-target-enforcement" {{.*}} "sign-return-address"="non-leaf" |
| 41 |
|
| 42 |
// CHECK-DAG: attributes #[[#BTI]] = { {{.*}} "branch-target-enforcement" |
| 43 |
|
| 44 |
// CHECK-DAG: attributes #[[#PAC]] = { {{.*}} "sign-return-address"="non-leaf" |
| 45 |
|
| 46 |
// CHECK-DAG: attributes #[[#PACLEAF]] = { {{.*}} "sign-return-address"="all" |
| 47 |
|
| 48 |
// CHECK-DAG: attributes #[[#BTIPACLEAF]] = { {{.*}} "branch-target-enforcement" {{.*}} "sign-return-address"="all" |