]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Fix return_address_sign_ab_exception.C regression
authorAndrea Corallo <andrea.corallo@arm.com>
Thu, 2 Feb 2023 16:25:05 +0000 (17:25 +0100)
committerAndrea Corallo <andrea.corallo@arm.com>
Wed, 8 Feb 2023 13:45:13 +0000 (14:45 +0100)
Hi all,

this is to fix the regression of
g++.target/aarch64/return_address_sign_ab_exception.C that I
introduced with d8dadbc9a5199bf7bac1ab7376b0f84f45e94350.

'aarch_ra_sign_key' for aarch64 ended up being non defined in the opt
file and the function attribute "branch-protection=pac-ret+leaf+b-key"
stopped working as expected.

This patch moves the definition of 'aarch_ra_sign_key' to the opt
files for both Arm back-ends.

Regards

  Andera Corallo

gcc/ChangeLog:

* config/aarch64/aarch64-protos.h (aarch_ra_sign_key): Remove
declaration.
* config/aarch64/aarch64.cc (aarch_ra_sign_key): Remove
definition.
* config/aarch64/aarch64.opt (aarch64_ra_sign_key): Rename
to 'aarch_ra_sign_key'.
* config/arm/aarch-common.cc (aarch_ra_sign_key): Remove
declaration.
* config/arm/arm-protos.h (aarch_ra_sign_key): Likewise.
* config/arm/arm.cc (enum aarch_key_type): Remove definition.
* config/arm/arm.opt: Define.

gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/aarch64.cc
gcc/config/aarch64/aarch64.opt
gcc/config/arm/aarch-common.cc
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.cc
gcc/config/arm/arm.opt

index 6ab6d49af3773b4a1b7cc4f5bd135dfb5ee48d1c..f75eb892f3daa7c2576efcedc8d944ab1e895cdb 100644 (file)
@@ -662,8 +662,6 @@ enum simd_immediate_check {
   AARCH64_CHECK_MOV  = AARCH64_CHECK_ORR | AARCH64_CHECK_BIC
 };
 
-extern enum aarch_key_type aarch_ra_sign_key;
-
 extern struct tune_params aarch64_tune_params;
 
 /* The available SVE predicate patterns, known in the ACLE as "svpattern".  */
index e6f47cbbb0d04a6f33b9a741ebb614cabd0204b9..5c40b6ed22a508723bd535a7460762c3a243d441 100644 (file)
@@ -2759,8 +2759,6 @@ static const struct processor all_cores[] =
   {NULL, aarch64_none, aarch64_none, aarch64_no_arch, 0, NULL}
 };
 
-enum aarch_key_type aarch_ra_sign_key = AARCH_KEY_A;
-
 /* The current tuning set.  */
 struct tune_params aarch64_tune_params = generic_tunings;
 
index 137e506fe19847ec1a3242ee9c9dde16e0421494..1d7967db9c0ca867fd0699370ce67b5242235c7f 100644 (file)
@@ -40,7 +40,7 @@ TargetVariable
 unsigned aarch_enable_bti = 2
 
 TargetVariable
-enum aarch64_key_type aarch64_ra_sign_key = AARCH64_KEY_A
+enum aarch_key_type aarch_ra_sign_key = AARCH_KEY_A
 
 ; The TLS dialect names to use with -mtls-dialect.
 
index 27e6c8f39b47c8a366c7e5767ca49c184a0ddb76..5b96ff4c2e89722a2cad686bd78ce12721a02010 100644 (file)
@@ -661,7 +661,6 @@ arm_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
 
 #define BRANCH_PROTECT_STR_MAX 255
 extern char *accepted_branch_protection_string;
-extern enum aarch_key_type aarch_ra_sign_key;
 
 static enum aarch_parse_opt_result
 aarch_handle_no_branch_protection (char* str, char* rest)
index aea472bfbb9deaa8e925756963c7c5cc6fdc0d09..c8ae5e1e9c16b35cd04147f98b4cc97641a4bb3b 100644 (file)
@@ -585,7 +585,6 @@ struct cpu_option
 extern const arch_option all_architectures[];
 extern const cpu_option all_cores[];
 
-extern enum aarch_key_type aarch_ra_sign_key;
 
 const cpu_option *arm_parse_cpu_option_name (const cpu_option *, const char *,
                                             const char *, bool = true);
index 1d285051fa6d8e6c05813801eb678e58da25714d..a46627bc375719c8ff30b6857ca864d71e130a4f 100644 (file)
@@ -2420,9 +2420,6 @@ const struct tune_params arm_fa726te_tune =
   tune_params::SCHED_AUTOPREF_OFF
 };
 
-/* Key type for Pointer Authentication extension.  */
-enum aarch_key_type aarch_ra_sign_key = AARCH_KEY_A;
-
 char *accepted_branch_protection_string = NULL;
 
 /* Auto-generated CPU, FPU and architecture tables.  */
index 260700f16bcd110ae3b661b3c0ee06a99e4690de..3a49b51ece0e3711d49ee5fb94e2bfdac3a05e38 100644 (file)
@@ -30,6 +30,9 @@ enum aarch_function_type aarch_ra_sign_scope = AARCH_FUNCTION_NONE
 TargetVariable
 unsigned aarch_enable_bti = 0
 
+TargetVariable
+enum aarch_key_type aarch_ra_sign_key = AARCH_KEY_A
+
 Enum
 Name(tls_type) Type(enum arm_tls_type)
 TLS dialect to use: