From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2098) id 4E9B53858D33; Mon, 23 Jan 2023 11:06:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E9B53858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674471974; bh=eq5+/YU2zR5IjLVXYq8vMvB1h4BLPJrt1ZvMz6KLnKs=; h=From:To:Subject:Date:From; b=I+M8SceNZ5QlWvURblENZUxFTtGuYAd28d0G2tu3YOqKVty80UJpgsUCRl3xVuT1v DwF9W63cP/dP0PEtS4kufCoEoPDkoyc7oT7l6d1xQMx38tKTedYaDHidSLNWNSplBQ EzQncIMLTU+d/ozawuDJSv0EmlkiQZW9W8GoA+Hg= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: SRINATH PARVATHANENI To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5302] arm: Add pacbti related multilib support for armv8.1-m.main. X-Act-Checkin: gcc X-Git-Author: Srinath Parvathaneni X-Git-Refname: refs/heads/master X-Git-Oldrev: ccfd1e7f0d9686aa931e65a04845a7436f85d71c X-Git-Newrev: 3a0dd2cc28ee2833dc5bf1d4fb6d746a8c55ca4d Message-Id: <20230123110614.4E9B53858D33@sourceware.org> Date: Mon, 23 Jan 2023 11:06:14 +0000 (GMT) List-Id: https://gcc.gnu.org/g:3a0dd2cc28ee2833dc5bf1d4fb6d746a8c55ca4d commit r13-5302-g3a0dd2cc28ee2833dc5bf1d4fb6d746a8c55ca4d Author: Srinath Parvathaneni Date: Mon Jan 23 11:04:19 2023 +0000 arm: Add pacbti related multilib support for armv8.1-m.main. This patch adds the support for pacbti multlilib linking by making "-mbranch-protection=none" as default multilib option for arm-none-eabi target. Eg 1. If the passed command line flags are (without mbranch-protection): a) -march=armv8.1-m.main+mve -mfloat-abi=hard -mfpu=auto "-mbranch-protection=none" will be used in the multilib matching. Eg 2. If the passed command line flags are (with mbranch-protection): a) -march=armv8.1-m.main+mve+pacbti -mfloat-abi=hard -mfpu=auto -mbranch-protection=pac-ret "-mbranch-protection=standard" will be used in the multilib matching. gcc/ChangeLog: 2023-01-11 Srinath Parvathaneni * config.gcc ($tm_file): Update variable. * config/arm/arm-mlib.h: Create new header file. * config/arm/t-rmprofile (MULTI_ARCH_DIRS_RM): Rename mbranch-protection multilib arch directory. (MULTILIB_REUSE): Add multilib reuse rules. (MULTILIB_MATCHES): Add multilib match rules. gcc/testsuite/ChangeLog: 2023-01-11 Srinath Parvathaneni * gcc.target/arm/multilib.exp (multilib_config "rmprofile"): Update tests. * gcc.target/arm/pac-12.c: New test. * gcc.target/arm/pac-13.c: Likewise. * gcc.target/arm/pac-14.c: Likewise. Diff: --- gcc/config.gcc | 1 + gcc/config/arm/arm-mlib.h | 22 +++++++++++++++ gcc/config/arm/t-rmprofile | 46 +++++++++++++++++++++++++++++-- gcc/testsuite/gcc.target/arm/multilib.exp | 34 +++++++++++++---------- gcc/testsuite/gcc.target/arm/pac-12.c | 7 +++++ gcc/testsuite/gcc.target/arm/pac-13.c | 7 +++++ gcc/testsuite/gcc.target/arm/pac-14.c | 7 +++++ 7 files changed, 106 insertions(+), 18 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index a5b0cbc7b41..771bd35e803 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4350,6 +4350,7 @@ case "${target}" in case ${arm_multilib} in aprofile|rmprofile) tmake_profile_file="arm/t-multilib" + tm_file="$tm_file arm/arm-mlib.h" ;; @*) ml=`echo "X$arm_multilib" | sed '1s,^X@,,'` diff --git a/gcc/config/arm/arm-mlib.h b/gcc/config/arm/arm-mlib.h new file mode 100644 index 00000000000..02cfba0ba24 --- /dev/null +++ b/gcc/config/arm/arm-mlib.h @@ -0,0 +1,22 @@ +/* Arm multilib default option include file. + + Copyright (C) 2023 Free Software Foundation, Inc. + Contributed by Arm. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#define MULTILIB_DEFAULTS { "mbranch-protection=none" } diff --git a/gcc/config/arm/t-rmprofile b/gcc/config/arm/t-rmprofile index ecfdc9861e3..4d8e6ce10b8 100644 --- a/gcc/config/arm/t-rmprofile +++ b/gcc/config/arm/t-rmprofile @@ -31,7 +31,7 @@ MULTI_ARCH_OPTS_RM = march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7e-m+ MULTI_ARCH_DIRS_RM = v6-m v7-m v7e-m v7e-m+fp v7e-m+dp v8-m.base v8-m.main v8-m.main+fp v8-m.main+dp v8.1-m.main+mve v8.1-m.main+pacbti v8.1-m.main+pacbti+fp v8.1-m.main+pacbti+dp v8.1-m.main+pacbti+mve MULTI_ARCH_OPTS_RM += mbranch-protection=standard -MULTI_ARCH_DIRS_RM += mbranch-protection +MULTI_ARCH_DIRS_RM += bp # Base M-profile (no fp) MULTILIB_REQUIRED += mthumb/march=armv6s-m/mfloat-abi=soft @@ -113,7 +113,47 @@ MULTILIB_MATCHES += march?armv8-m.main=mlibarch?armv8-m.main MULTILIB_MATCHES += march?armv8-m.main+fp=mlibarch?armv8-m.main+fp MULTILIB_MATCHES += march?armv8-m.main+fp.dp=mlibarch?armv8-m.main+fp.dp MULTILIB_MATCHES += march?armv8.1-m.main+mve=mlibarch?armv8.1-m.main+mve + +# For -mbranch-protection=none and +pacbti reuses the existing non pacbti +# multilibs. +MULTILIB_REUSE += $(foreach OPT, fp fp\.dp, \ + mthumb/march.armv8-m\.main+$(OPT)/mfloat-abi.softfp=mthumb/march.armv8\.1-m\.main+pacbti+$(OPT)/mfloat-abi.softfp) +MULTILIB_REUSE += $(foreach OPT, fp fp\.dp, \ + mthumb/march.armv8-m\.main+$(OPT)/mfloat-abi.hard=mthumb/march.armv8\.1-m\.main+pacbti+$(OPT)/mfloat-abi.hard) + +MULTILIB_REUSE += $(foreach OPT, pacbti pacbti+mve, \ + mthumb/march.armv8-m\.main/mfloat-abi.soft=mthumb/march.armv8\.1-m\.main+$(OPT)/mfloat-abi.soft) +MULTILIB_REUSE += $(foreach OPT, pacbti pacbti+mve, \ + mthumb/march.armv8-m\.main/mfloat-abi.soft=mthumb/march.armv8\.1-m\.main+$(OPT)/mfloat-abi.softfp) + +MULTILIB_REUSE += mthumb/march.armv8\.1-m\.main+mve/mfloat-abi.hard=mthumb/march.armv8\.1-m\.main+pacbti+mve/mfloat-abi.hard + +pacbti_fp_variants = fp fp+mve mve.fp fp+mve.fp +pacbti_dp_variants = fp.dp fp.dp+mve fp.dp+mve.fp + +# For -mbranch-protection=standard and +pacbti linking to existing pacbti +# multlibs. MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+pacbti -MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+pacbti+fp -MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+pacbti+fp.dp +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+pacbti+dsp +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+dsp+pacbti MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+pacbti+mve +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+pacbti+dsp+mve +MULTILIB_MATCHES += march?armv8.1-m.main+pacbti+mve=mlibarch?armv8.1-m.main+dsp+pacbti+mve + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_fp_variants), \ + march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+pacbti+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_fp_variants), \ + march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+pacbti+dsp+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_dp_variants), \ + march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+pacbti+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_dp_variants), \ + march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+pacbti+dsp+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_fp_variants), \ + march?armv8.1-m.main+pacbti+fp=mlibarch?armv8.1-m.main+dsp+pacbti+$(OPT)) + +MULTILIB_MATCHES += $(foreach OPT, $(pacbti_dp_variants), \ + march?armv8.1-m.main+pacbti+fp.dp=mlibarch?armv8.1-m.main+dsp+pacbti+$(OPT)) diff --git a/gcc/testsuite/gcc.target/arm/multilib.exp b/gcc/testsuite/gcc.target/arm/multilib.exp index 8442f45306a..d365711d398 100644 --- a/gcc/testsuite/gcc.target/arm/multilib.exp +++ b/gcc/testsuite/gcc.target/arm/multilib.exp @@ -529,6 +529,10 @@ if {[multilib_config "rmprofile"] } { {-mcpu=cortex-m85+nopacbti+nomve -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m85+nopacbti+nodsp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m85+nopacbti+nomve.fp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85 -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nomve.fp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nomve -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" + {-mcpu=cortex-m85+nodsp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m4 -mfpu=auto -mfloat-abi=hard} "thumb/v7e-m+fp/hard" {-mcpu=cortex-m7 -mfpu=auto -mfloat-abi=hard} "thumb/v7e-m+dp/hard" {-mcpu=cortex-m33 -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+fp/hard" @@ -559,10 +563,10 @@ if {[multilib_config "rmprofile"] } { {-mcpu=cortex-m85+nopacbti+nodsp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" {-mcpu=cortex-m85+nopacbti+nofp -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+mve/hard" {-mcpu=cortex-m85+nopacbti+nomve.fp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" - {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" - {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" - {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" - {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" + {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" + {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" + {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" + {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" {-mcpu=cortex-m0 -mfpu=auto -mfloat-abi=softfp} "thumb/v6-m/nofp" {-mcpu=cortex-m1 -mfpu=auto -mfloat-abi=softfp} "thumb/v6-m/nofp" {-mcpu=cortex-m3 -mfpu=auto -mfloat-abi=softfp} "thumb/v7-m/nofp" @@ -613,14 +617,14 @@ if {[multilib_config "rmprofile"] } { {-mcpu=cortex-m33 -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m7+nofp.dp -mfpu=fpv5-d16 -mfloat-abi=softfp} "thumb/v7e-m+dp/softfp" {-mcpu=cortex-m85+nopacbti+nofp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp" - {-mcpu=cortex-m85+nopacbti -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" + {-mcpu=cortex-m85+nopacbti -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m85+nopacbti+nomve -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m85+nopacbti+nodsp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m85+nopacbti+nomve.fp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" - {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" - {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" - {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" - {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/softfp" + {-mcpu=cortex-m85 -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" + {-mcpu=cortex-m85+nomve -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" + {-mcpu=cortex-m85+nomve.fp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" + {-mcpu=cortex-m85+nodsp -mbranch-protection=standard -mfpu=auto -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" {-march=armv6-m -mfpu=auto -mfloat-abi=soft} "thumb/v6-m/nofp" {-march=armv7-m -mfpu=auto -mfloat-abi=soft} "thumb/v7-m/nofp" {-march=armv7e-m -mfpu=auto -mfloat-abi=soft} "thumb/v7e-m/nofp" @@ -861,12 +865,12 @@ if {[multilib_config "rmprofile"] } { {-march=armv8.1-m.main+mve.fp+fp.dp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-march=armv8.1-m.main+mve+fp.dp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" {-march=armv8.1-m.main+mve.fp+fp.dp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" - {-march=armv8.1-m.main+pacbti -mbranch-protection=standard -mfloat-abi=soft} "thumb/v8.1-m.main+pacbti/mbranch-protection/nofp" - {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+fp/mbranch-protection/soft" - {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+fp/mbranch-protection/hard" - {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/soft" - {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard" - {-march=armv8.1-m.main+pacbti+mve -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+mve/mbranch-protection/hard" + {-march=armv8.1-m.main+pacbti -mbranch-protection=standard -mfloat-abi=soft} "thumb/v8.1-m.main+pacbti/bp/nofp" + {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+fp/bp/softfp" + {-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+fp/bp/hard" + {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=softfp} "thumb/v8.1-m.main+pacbti+dp/bp/softfp" + {-march=armv8.1-m.main+pacbti+fp.dp -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+dp/bp/hard" + {-march=armv8.1-m.main+pacbti+mve -mbranch-protection=standard -mfloat-abi=hard} "thumb/v8.1-m.main+pacbti+mve/bp/hard" {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp" {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp" {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard" diff --git a/gcc/testsuite/gcc.target/arm/pac-12.c b/gcc/testsuite/gcc.target/arm/pac-12.c new file mode 100644 index 00000000000..6e1295c834d --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-12.c @@ -0,0 +1,7 @@ +/* Testing PACBTI multilibs matches without mve. */ +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "" } { "-mfloat-abi=hard" } } */ +/* { dg-options "-march=armv8.1-m.main+dsp+fp.dp+pacbti -mbranch-protection=standard -mthumb -mfloat-abi=hard" } */ + +#include "pac.h" diff --git a/gcc/testsuite/gcc.target/arm/pac-13.c b/gcc/testsuite/gcc.target/arm/pac-13.c new file mode 100644 index 00000000000..faf836b2026 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-13.c @@ -0,0 +1,7 @@ +/* Testing PACBTI multilib matches. */ +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "" } { "-mfloat-abi=hard" } } */ +/* { dg-options "-march=armv8.1-m.main+mve.fp+fp.dp+pacbti -mbranch-protection=standard -mthumb -mfloat-abi=hard" } */ + +#include "pac.h" diff --git a/gcc/testsuite/gcc.target/arm/pac-14.c b/gcc/testsuite/gcc.target/arm/pac-14.c new file mode 100644 index 00000000000..51609b61c75 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pac-14.c @@ -0,0 +1,7 @@ +/* Testing PACBTI multilibs matches without mve float. */ +/* { dg-do run } */ +/* { dg-require-effective-target arm_pacbti_hw } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "" } { "-mfloat-abi=hard" } } */ +/* { dg-options "-march=armv8.1-m.main+mve+fp.dp+pacbti -mbranch-protection=standard -mthumb -mfloat-abi=hard" } */ + +#include "pac.h"