public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/arm-12-m-pacbti)] arm: Add pacbti related multilib support for armv8.1-m.main.
@ 2023-03-10 16:21 Andrea Corallo
  0 siblings, 0 replies; only message in thread
From: Andrea Corallo @ 2023-03-10 16:21 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:014175926e6317ea278c7bbca285cde1361e8ba5

commit 014175926e6317ea278c7bbca285cde1361e8ba5
Author: Srinath Parvathaneni <srinath.parvathaneni@arm.com>
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  <srinath.parvathaneni@arm.com>
    
            * 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  <srinath.parvathaneni@arm.com>
    
            * 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 4135169d6f0..b6dab5a6e47 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4462,6 +4462,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
+   <http://www.gnu.org/licenses/>.  */
+
+#define MULTILIB_DEFAULTS { "mbranch-protection=none" }
diff --git a/gcc/config/arm/t-rmprofile b/gcc/config/arm/t-rmprofile
index fe46a1efa1a..f66919a2374 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 82cc66a9007..7c5bc06ea6e 100644
--- a/gcc/testsuite/gcc.target/arm/multilib.exp
+++ b/gcc/testsuite/gcc.target/arm/multilib.exp
@@ -526,6 +526,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"
@@ -556,10 +560,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"
@@ -610,14 +614,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"
@@ -858,12 +862,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"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-10 16:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 16:21 [gcc(refs/vendors/ARM/heads/arm-12-m-pacbti)] arm: Add pacbti related multilib support for armv8.1-m.main Andrea Corallo

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).