[8/8,Arm] Introduce multilibs for PACBTI target feature. [Was RE: [Patch 7/7, Arm, GCC] Introduce multilibs for PACBTI target feature.]

Message ID PAXPR08MB707593E3D8C45E0FD6887E5BEA869@PAXPR08MB7075.eurprd08.prod.outlook.com
State Superseded
Headers
Series [1/8,Arm,AArch64] Refactor mbranch-protection option parsing and make it common to AArch32 and AArch64 backends. [Was RE: [Patch 2/7, Arm, GCC] Add option -mbranch-protection.] |

Commit Message

Tejas Belagod Oct. 28, 2021, 11:43 a.m. UTC
  > -----Original Message-----
> From: Gcc-patches <gcc-patches-
> bounces+belagod=gcc.gnu.org@gcc.gnu.org> On Behalf Of Tejas Belagod via
> Gcc-patches
> Sent: Friday, October 8, 2021 1:19 PM
> To: gcc-patches@gcc.gnu.org
> Subject: [Patch 7/7, Arm, GCC] Introduce multilibs for PACBTI target feature.
> 
> Hi,
> 
> This patch adds a multilib for pacbti target feature.
> 
> Tested on arm-none-eabi. OK for trunk?
> 
> 2021-10-04  Tejas Belagod  <tbelagod@arm.com>
> 
> gcc/ChangeLog:
> 
> 	* config/arm/t-rmprofile: Add multilib rules for +pacbti.


This patch adds a multilib for pacbti target feature.

2021-10-04  Tejas Belagod  <tbelagod@arm.com>

gcc/ChangeLog:

	* config/arm/t-rmprofile: Add multilib rules for +pacbti.

Tested the following configurations, OK for trunk?

-mthumb/-march=armv8.1-m.main+pacbti/-mfloat-abi=soft
-marm/-march=armv7-a/-mfpu=vfpv3-d16/-mfloat-abi=softfp
mcmodel=small and tiny
aarch64-none-linux-gnu native test and bootstrap

Thanks,
Tejas.
  

Comments

Richard Earnshaw Dec. 7, 2021, 2:56 p.m. UTC | #1
On 28/10/2021 12:43, Tejas Belagod via Gcc-patches wrote:
> 
> 
>> -----Original Message-----
>> From: Gcc-patches <gcc-patches-
>> bounces+belagod=gcc.gnu.org@gcc.gnu.org> On Behalf Of Tejas Belagod via
>> Gcc-patches
>> Sent: Friday, October 8, 2021 1:19 PM
>> To: gcc-patches@gcc.gnu.org
>> Subject: [Patch 7/7, Arm, GCC] Introduce multilibs for PACBTI target feature.
>>
>> Hi,
>>
>> This patch adds a multilib for pacbti target feature.
>>
>> Tested on arm-none-eabi. OK for trunk?
>>
>> 2021-10-04  Tejas Belagod  <tbelagod@arm.com>
>>
>> gcc/ChangeLog:
>>
>> 	* config/arm/t-rmprofile: Add multilib rules for +pacbti.
> 
> 
> This patch adds a multilib for pacbti target feature.
> 
> 2021-10-04  Tejas Belagod  <tbelagod@arm.com>
> 
> gcc/ChangeLog:
> 
> 	* config/arm/t-rmprofile: Add multilib rules for +pacbti.
> 
> Tested the following configurations, OK for trunk?
> 
> -mthumb/-march=armv8.1-m.main+pacbti/-mfloat-abi=soft
> -marm/-march=armv7-a/-mfpu=vfpv3-d16/-mfloat-abi=softfp
> mcmodel=small and tiny
> aarch64-none-linux-gnu native test and bootstrap
> 
> Thanks,
> Tejas.
> 

I can't decide whether this is too much, or too little.  But it doesn't 
feel right as it is.

Ideally we don't want yet another multilib.  It would be better to have 
one of the existing multilib variants made pac/bti safe.

And secondly, what about the hand-written assembler files in libgcc? 
Don't they need updating to be PAC/BTI safe?

Also, does this even do what you intend it to do?  It adds the PAC/BTI 
architectural feature, but it doesn't actually enable PAC/BTI in the 
generated code.

R.
  
Andrea Corallo Dec. 10, 2021, 9:39 a.m. UTC | #2
Richard Earnshaw via Gcc-patches <gcc-patches@gcc.gnu.org> writes:

> On 28/10/2021 12:43, Tejas Belagod via Gcc-patches wrote:
>> 
>>> -----Original Message-----
>>> From: Gcc-patches <gcc-patches-
>>> bounces+belagod=gcc.gnu.org@gcc.gnu.org> On Behalf Of Tejas Belagod via
>>> Gcc-patches
>>> Sent: Friday, October 8, 2021 1:19 PM
>>> To: gcc-patches@gcc.gnu.org
>>> Subject: [Patch 7/7, Arm, GCC] Introduce multilibs for PACBTI target feature.
>>>
>>> Hi,
>>>
>>> This patch adds a multilib for pacbti target feature.
>>>
>>> Tested on arm-none-eabi. OK for trunk?
>>>
>>> 2021-10-04  Tejas Belagod  <tbelagod@arm.com>
>>>
>>> gcc/ChangeLog:
>>>
>>> 	* config/arm/t-rmprofile: Add multilib rules for +pacbti.
>> This patch adds a multilib for pacbti target feature.
>> 2021-10-04  Tejas Belagod  <tbelagod@arm.com>
>> gcc/ChangeLog:
>> 	* config/arm/t-rmprofile: Add multilib rules for +pacbti.
>> Tested the following configurations, OK for trunk?
>> -mthumb/-march=armv8.1-m.main+pacbti/-mfloat-abi=soft
>> -marm/-march=armv7-a/-mfpu=vfpv3-d16/-mfloat-abi=softfp
>> mcmodel=small and tiny
>> aarch64-none-linux-gnu native test and bootstrap
>> Thanks,
>> Tejas.
>> 

Hi Richard,

> I can't decide whether this is too much, or too little.  But it
> doesn't feel right as it is.
>
> Ideally we don't want yet another multilib.  It would be better to
> have one of the existing multilib variants made pac/bti safe.
>
> And secondly, what about the hand-written assembler files in libgcc?
> Don't they need updating to be PAC/BTI safe?

I agree with you, this patch is missing at least bti landing pads in the
hand-written assembler files in libgcc.

> Also, does this even do what you intend it to do?  It adds the PAC/BTI
> architectural feature, but it doesn't actually enable PAC/BTI in the
> generated code.

Good point, I'll fix this too in the upcoming respin.

Thanks for reviewing.

BR

  Andrea
  
Andrea Corallo Dec. 16, 2021, 2:52 p.m. UTC | #3
Richard Earnshaw via Gcc-patches <gcc-patches@gcc.gnu.org> writes:

> On 28/10/2021 12:43, Tejas Belagod via Gcc-patches wrote:
>> 
>>> -----Original Message-----
>>> From: Gcc-patches <gcc-patches-
>>> bounces+belagod=gcc.gnu.org@gcc.gnu.org> On Behalf Of Tejas Belagod via
>>> Gcc-patches
>>> Sent: Friday, October 8, 2021 1:19 PM
>>> To: gcc-patches@gcc.gnu.org
>>> Subject: [Patch 7/7, Arm, GCC] Introduce multilibs for PACBTI target feature.
>>>
>>> Hi,
>>>
>>> This patch adds a multilib for pacbti target feature.
>>>
>>> Tested on arm-none-eabi. OK for trunk?
>>>
>>> 2021-10-04  Tejas Belagod  <tbelagod@arm.com>
>>>
>>> gcc/ChangeLog:
>>>
>>> 	* config/arm/t-rmprofile: Add multilib rules for +pacbti.
>> This patch adds a multilib for pacbti target feature.
>> 2021-10-04  Tejas Belagod  <tbelagod@arm.com>
>> gcc/ChangeLog:
>> 	* config/arm/t-rmprofile: Add multilib rules for +pacbti.
>> Tested the following configurations, OK for trunk?
>> -mthumb/-march=armv8.1-m.main+pacbti/-mfloat-abi=soft
>> -marm/-march=armv7-a/-mfpu=vfpv3-d16/-mfloat-abi=softfp
>> mcmodel=small and tiny
>> aarch64-none-linux-gnu native test and bootstrap
>> Thanks,
>> Tejas.
>> 
>
> I can't decide whether this is too much, or too little.  But it
> doesn't feel right as it is.
>
> Ideally we don't want yet another multilib.  It would be better to
> have one of the existing multilib variants made pac/bti safe.

Right, which one do you think we want to pick?

Thanks

  Andrea
  

Patch

diff --git a/gcc/config/arm/t-rmprofile b/gcc/config/arm/t-rmprofile
index a6036bf0a5191a3cac3bfbe2329783204d5c3ef4..241bf1939e30ae7890ae332556d33759f538ced5 100644
--- a/gcc/config/arm/t-rmprofile
+++ b/gcc/config/arm/t-rmprofile
@@ -27,8 +27,8 @@ 
 
 # Arch and FPU variants to build libraries with
 
-MULTI_ARCH_OPTS_RM	= march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7e-m+fp/march=armv7e-m+fp.dp/march=armv8-m.base/march=armv8-m.main/march=armv8-m.main+fp/march=armv8-m.main+fp.dp/march=armv8.1-m.main+mve
-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
+MULTI_ARCH_OPTS_RM	= march=armv6s-m/march=armv7-m/march=armv7e-m/march=armv7e-m+fp/march=armv7e-m+fp.dp/march=armv8-m.base/march=armv8-m.main/march=armv8-m.main+fp/march=armv8-m.main+fp.dp/march=armv8.1-m.main+mve/march=armv8.1-m.main+pacbti
+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
 
 # Base M-profile (no fp)
 MULTILIB_REQUIRED	+= mthumb/march=armv6s-m/mfloat-abi=soft
@@ -36,6 +36,7 @@  MULTILIB_REQUIRED	+= mthumb/march=armv7-m/mfloat-abi=soft
 MULTILIB_REQUIRED	+= mthumb/march=armv7e-m/mfloat-abi=soft
 MULTILIB_REQUIRED	+= mthumb/march=armv8-m.base/mfloat-abi=soft
 MULTILIB_REQUIRED	+= mthumb/march=armv8-m.main/mfloat-abi=soft
+MULTILIB_REQUIRED	+= mthumb/march=armv8.1-m.main+pacbti/mfloat-abi=soft
 
 # ARMv7e-M with FP (single and double precision variants)
 MULTILIB_REQUIRED	+= mthumb/march=armv7e-m+fp/mfloat-abi=hard
@@ -93,3 +94,4 @@  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
+MULTILIB_MATCHES	+= march?armv8.1-m.main+pacbti=mlibarch?armv8.1-m.main+pacbti