On 11/01/2024 14:35, Szabolcs Nagy wrote:
> The branch-protection types are target specific, not the same on arm
> and aarch64.  This currently affects pac-ret+b-key, but there will be
> a new type on aarch64 that is not relevant for arm.
> 
> After the move, change aarch_ identifiers to aarch64_ or arm_ as
> appropriate.
> 
> Refactor aarch_validate_mbranch_protection to take the target specific
> branch-protection types as an argument.
> 
> In case of invalid input currently no hints are provided: the way
> branch-protection types and subtypes can be mixed makes it difficult
> without causing confusion.
> 
> gcc/ChangeLog:
> 
>       * config/aarch64/aarch64.md: Rename aarch_ to aarch64_.
>       * config/aarch64/aarch64.opt: Likewise.
>       * config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Likewise.
>       * config/aarch64/aarch64.cc (aarch64_expand_prologue): Likewise.
>       (aarch64_expand_epilogue): Likewise.
>       (aarch64_post_cfi_startproc): Likewise.
>       (aarch64_handle_no_branch_protection): Copy and rename.
>       (aarch64_handle_standard_branch_protection): Likewise.
>       (aarch64_handle_pac_ret_protection): Likewise.
>       (aarch64_handle_pac_ret_leaf): Likewise.
>       (aarch64_handle_pac_ret_b_key): Likewise.
>       (aarch64_handle_bti_protection): Likewise.
>       (aarch64_override_options): Update branch protection validation.
>       (aarch64_handle_attr_branch_protection): Likewise.
>       * config/arm/aarch-common-protos.h (aarch_validate_mbranch_protection):
>       Pass branch protection type description as argument.
>       (struct aarch_branch_protect_type): Move from aarch-common.h.
>       * config/arm/aarch-common.cc (aarch_handle_no_branch_protection):
>       Remove.
>       (aarch_handle_standard_branch_protection): Remove.
>       (aarch_handle_pac_ret_protection): Remove.
>       (aarch_handle_pac_ret_leaf): Remove.
>       (aarch_handle_pac_ret_b_key): Remove.
>       (aarch_handle_bti_protection): Remove.
>       (aarch_validate_mbranch_protection): Pass branch protection type
>       description as argument.
>       * config/arm/aarch-common.h (enum aarch_key_type): Remove.
>       (struct aarch_branch_protect_type): Remove.
>       * config/arm/arm-c.cc (arm_cpu_builtins): Remove aarch_ra_sign_key.
>       * config/arm/arm.cc (arm_handle_no_branch_protection): Copy and rename.
>       (arm_handle_standard_branch_protection): Likewise.
>       (arm_handle_pac_ret_protection): Likewise.
>       (arm_handle_pac_ret_leaf): Likewise.
>       (arm_handle_bti_protection): Likewise.
>       (arm_configure_build_target): Update branch protection validation.
>       * config/arm/arm.opt: Remove aarch_ra_sign_key.
> ---
> v4:
> - pass types as argument to validation.
> - make target specific types data static.
> 
>  gcc/config/aarch64/aarch64-c.cc      |  4 +-
>  gcc/config/aarch64/aarch64.cc        | 75 ++++++++++++++++++++++++----
>  gcc/config/aarch64/aarch64.md        |  2 +-
>  gcc/config/aarch64/aarch64.opt       |  2 +-
>  gcc/config/arm/aarch-common-protos.h | 19 ++++++-
>  gcc/config/arm/aarch-common.cc       | 71 ++++----------------------
>  gcc/config/arm/aarch-common.h        | 20 --------
>  gcc/config/arm/arm-c.cc              |  2 -
>  gcc/config/arm/arm.cc                | 55 +++++++++++++++++---
>  gcc/config/arm/arm.opt               |  3 --
>  10 files changed, 145 insertions(+), 108 deletions(-)
> 


OK

R.

Reply via email to