Hi all,
This patch adds an effective target check to the pointer authentication B key
execution tests. These were failing with an assembler error when run with a
non-recent version of binutils, and this change will instead make them
unsupported in such cases.
Tested with a recent version of binutils where it passes, and with a non-recent
version where it is unsupported.
OK for trunk?
Sam
gcc/testsuite
2019-08-02 Sam Tebbs<[email protected]>
* lib/target-supports.exp
(check_effective_target_arm_v8_4a_bkey_directive): New proc.
* g++.target/aarch64/return_address_sign_b_exception.C,
return_address_sign_ab_exception.C: Add dg-require-effective-target
checks.
diff --git
a/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C
b/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C
index 520cd18..ead11de 100644
--- a/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C
+++ b/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "--save-temps" } */
+/* { dg-require-effective-target arm_v8_3a_bkey_directive } */
__attribute__((target("branch-protection=pac-ret+leaf")))
int foo_a () {
diff --git a/gcc/testsuite/g++.target/aarch64/return_address_sign_b_exception.C
b/gcc/testsuite/g++.target/aarch64/return_address_sign_b_exception.C
index eab2869..2f82731 100644
--- a/gcc/testsuite/g++.target/aarch64/return_address_sign_b_exception.C
+++ b/gcc/testsuite/g++.target/aarch64/return_address_sign_b_exception.C
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-mbranch-protection=pac-ret+leaf+b-key --save-temps" } */
+/* { dg-require-effective-target arm_v8_3a_bkey_directive } */
int foo () {
throw 22;
diff --git a/gcc/testsuite/lib/target-supports.exp
b/gcc/testsuite/lib/target-supports.exp
index 815e837..3c50b89 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9463,6 +9463,16 @@ proc check_effective_target_arm_v8_3a_complex_neon_hw {
} {
} [add_options_for_arm_v8_3a_complex_neon ""]]
}
+# Return 1 if the assembler supports assembling the Armv8.3 pointer
authentication B key directive
+proc check_effective_target_arm_v8_3a_bkey_directive { } {
+ return [check_no_compiler_messages cet object {
+ int main(void) {
+ asm (".cfi_b_key_frame");
+ return 0;
+ }
+ }]
+}
+
# Returns 1 if the target is using glibc, 0 otherwise.
proc check_effective_target_glibc { } {