
This patch does two things. 1. Previously, when checking driver arguments, we emitted an error for unsupported values of `-mbranch-protection` when using pauthtest ABI. The reason for that was ptrauth-returns being enabled as part of pauthtest. This patch changes the check against pauthtest to a check against ptrauth-returns. 2. Similarly, check against values of the following function attribute which are unsupported with ptrauth-returns: `__attribute__((target("branch-protection=XXX`. Note that existing `validateBranchProtection` function is used, and current behavior is to ignore the unsupported attribute value, so no error is emitted.
32 lines
1.8 KiB
C
32 lines
1.8 KiB
C
// REQUIRES: aarch64-registered-target
|
|
|
|
// RUN: %clang -target aarch64-linux-pauthtest %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: %s
|
|
// RUN: %clang -target aarch64 -fptrauth-returns %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: %s
|
|
|
|
/// Unsupported with pauthtest, warning emitted
|
|
__attribute__((target("branch-protection=pac-ret"))) void f1() {}
|
|
// CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
|
|
// CHECK-NEXT: __attribute__((target("branch-protection=pac-ret"))) void f1() {}
|
|
__attribute__((target("branch-protection=gcs"))) void f2() {}
|
|
// CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
|
|
// CHECK-NEXT: __attribute__((target("branch-protection=gcs"))) void f2() {}
|
|
__attribute__((target("branch-protection=standard"))) void f3() {}
|
|
// CHECK: warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]
|
|
// CHECK-NEXT: __attribute__((target("branch-protection=standard"))) void f3() {}
|
|
|
|
/// Supported with pauthtest, no warning emitted
|
|
__attribute__((target("branch-protection=bti"))) void f4() {}
|
|
|
|
/// Supported with pauthtest, no warning emitted
|
|
__attribute__((target("branch-protection=none"))) void f5() {}
|
|
|
|
/// Check there are no branch protection function attributes which are unsupported with pauthtest
|
|
|
|
// CHECK-NOT: attributes {{.*}} "sign-return-address"
|
|
// CHECK-NOT: attributes {{.*}} "sign-return-address-key"
|
|
// CHECK-NOT: attributes {{.*}} "branch-protection-pauth-lr"
|
|
// CHECK-NOT: attributes {{.*}} "guarded-control-stack"
|
|
|
|
/// Check function attributes which are supported with pauthtest
|
|
// CHECK: attributes {{.*}} "branch-target-enforcement"
|