49 lines · c
1// REQUIRES: arm-registered-target2// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -emit-llvm %s -o - \3// RUN: | FileCheck %s --check-prefix=CHECK4// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -mbranch-target-enforce -emit-llvm %s -o - \5// RUN: | FileCheck %s --check-prefix=CHECK6// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -msign-return-address=all -emit-llvm %s -o - \7// RUN: | FileCheck %s --check-prefix=CHECK8// 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=CHECK10 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"49