public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrea Corallo <akrl@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/arm-12-m-pacbti)] [PATCH 7/15] arm: Emit build attributes for PACBTI target feature Date: Fri, 12 Aug 2022 16:30:43 +0000 (GMT) [thread overview] Message-ID: <20220812163043.B9F133858006@sourceware.org> (raw) https://gcc.gnu.org/g:8d7778d759c496f376540130a3183a88c12a1aa1 commit 8d7778d759c496f376540130a3183a88c12a1aa1 Author: Andrea Corallo <andrea.corallo@arm.com> Date: Mon Dec 6 11:42:24 2021 +0100 [PATCH 7/15] arm: Emit build attributes for PACBTI target feature This patch emits assembler directives for PACBTI build attributes as defined by the ABI. <https://github.com/ARM-software/abi-aa/releases/download/2021Q1/addenda32.pdf> gcc/ChangeLog: * config/arm/arm.c (arm_file_start): Emit EABI attributes for Tag_PAC_extension, Tag_BTI_extension, TAG_BTI_use, TAG_PACRET_use. gcc/testsuite/ChangeLog: * gcc.target/arm/acle/pacbti-m-predef-1.c: New test. * gcc.target/arm/acle/pacbti-m-predef-3: Likewise. * gcc.target/arm/acle/pacbti-m-predef-6.c: Likewise. * gcc.target/arm/acle/pacbti-m-predef-7.c: Likewise. Co-Authored-By: Tejas Belagod <tbelagod@arm.com> Diff: --- gcc/config/arm/arm.cc | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c | 16 ++++++++++++++++ gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c | 17 +++++++++++++++++ 5 files changed, 85 insertions(+) diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index e584d14c9ee..c49c86e75b8 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -28357,6 +28357,8 @@ static void arm_file_start (void) { int val; + bool pac = (aarch_ra_sign_scope != AARCH_FUNCTION_NONE); + bool bti = (aarch_enable_bti == 1); arm_print_asm_arch_directives (asm_out_file, TREE_TARGET_OPTION (target_option_default_node)); @@ -28427,6 +28429,22 @@ arm_file_start (void) arm_emit_eabi_attribute ("Tag_ABI_FP_16bit_format", 38, (int) arm_fp16_format); + if (TARGET_HAVE_PACBTI) + { + arm_emit_eabi_attribute ("Tag_PAC_extension", 50, 2); + arm_emit_eabi_attribute ("Tag_BTI_extension", 52, 2); + } + else if (pac || bti) + { + arm_emit_eabi_attribute ("Tag_PAC_extension", 50, 1); + arm_emit_eabi_attribute ("Tag_BTI_extension", 52, 1); + } + + if (bti) + arm_emit_eabi_attribute ("TAG_BTI_use", 74, 1); + if (pac) + arm_emit_eabi_attribute ("TAG_PACRET_use", 76, 1); + if (arm_lang_output_object_attributes_hook) arm_lang_output_object_attributes_hook(); } diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c new file mode 100644 index 00000000000..122f7a762a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options "-march=armv8.1-m.main+fp -mbranch-protection=pac-ret+bti -mfloat-abi=hard --save-temps" } */ + +#if !defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined." +#endif + +/* { dg-final { scan-assembler-not "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 74, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 76, 1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c new file mode 100644 index 00000000000..b94f3447ad9 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-options "-march=armv8.1-m.main+fp -mbranch-protection=pac-ret+leaf -mfloat-abi=hard --save-temps" } */ + +#if defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be undefined." +#endif + +#if !defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be defined." +#endif + +/* { dg-final { scan-assembler-not "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 1" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 74" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 76, 1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c new file mode 100644 index 00000000000..ed52afc83c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-6.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-additional-options "-march=armv8.1-m.main+fp -mbranch-protection=bti -mfloat-abi=hard --save-temps" } */ + +#if !defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be defined." +#endif + +#if defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be undefined." +#endif +/* { dg-final { scan-assembler-not "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 1" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 74, 1" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 76" } } */ diff --git a/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c new file mode 100644 index 00000000000..1b25907635e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/acle/pacbti-m-predef-7.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ +/* { dg-additional-options "-march=armv8.1-m.main+pacbti+fp --save-temps -mfloat-abi=hard" } */ + +#if defined (__ARM_FEATURE_BTI_DEFAULT) +#error "Feature test macro __ARM_FEATURE_BTI_DEFAULT should be undefined." +#endif + +#if defined (__ARM_FEATURE_PAC_DEFAULT) +#error "Feature test macro __ARM_FEATURE_PAC_DEFAULT should be undefined." +#endif + +/* { dg-final { scan-assembler "\.arch_extension pacbti" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 50, 2" } } */ +/* { dg-final { scan-assembler "\.eabi_attribute 52, 2" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 74" } } */ +/* { dg-final { scan-assembler-not "\.eabi_attribute 76" } } */
next reply other threads:[~2022-08-12 16:30 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-12 16:30 Andrea Corallo [this message] 2023-03-10 16:21 Andrea Corallo
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220812163043.B9F133858006@sourceware.org \ --to=akrl@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).