| 1 |
// REQUIRES: aarch64-registered-target |
| 2 |
|
| 3 |
// RUN: %clang -target aarch64-linux-pauthtest %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: %s |
| 4 |
// RUN: not %clang -target aarch64 -fptrauth-returns %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: --check-prefix=PTRAUTH-RETURNS %s |
| 5 |
|
| 6 |
// Clang fails early, no LLVM IR output produced. |
| 7 |
// PTRAUTH-RETURNS: clang: error: unsupported option '-fptrauth-returns' for target 'aarch64' |
| 8 |
// PTRAUTH-RETURNS-NOT: attributes |
| 9 |
|
| 10 |
/// Unsupported with pauthtest, warning emitted |
| 11 |
__attribute__((target("branch-protection=pac-ret"))) void f1() {} |
| 12 |
// CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes] |
| 13 |
// CHECK-NEXT: __attribute__((target("branch-protection=pac-ret"))) void f1() {} |
| 14 |
__attribute__((target("branch-protection=gcs"))) void f2() {} |
| 15 |
// CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes] |
| 16 |
// CHECK-NEXT: __attribute__((target("branch-protection=gcs"))) void f2() {} |
| 17 |
__attribute__((target("branch-protection=standard"))) void f3() {} |
| 18 |
// CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes] |
| 19 |
// CHECK-NEXT: __attribute__((target("branch-protection=standard"))) void f3() {} |
| 20 |
|
| 21 |
/// Supported with pauthtest, no warning emitted |
| 22 |
__attribute__((target("branch-protection=bti"))) void f4() {} |
| 23 |
|
| 24 |
/// Supported with pauthtest, no warning emitted |
| 25 |
__attribute__((target("branch-protection=none"))) void f5() {} |
| 26 |
|
| 27 |
/// Check there are no branch protection function attributes which are unsupported with pauthtest |
| 28 |
|
| 29 |
// CHECK-NOT: attributes {{.*}} "sign-return-address" |
| 30 |
// CHECK-NOT: attributes {{.*}} "sign-return-address-key" |
| 31 |
// CHECK-NOT: attributes {{.*}} "branch-protection-pauth-lr" |
| 32 |
// CHECK-NOT: attributes {{.*}} "guarded-control-stack" |
| 33 |
|
| 34 |
/// Check function attributes which are supported with pauthtest |
| 35 |
// CHECK: attributes {{.*}} "branch-target-enforcement" |