diff mbox series

FreeBSD PowerPC use secure-plt

Message ID 02866edb-ed71-7d50-741e-f5bb35792737@fgznet.ch
State New
Headers show
Series FreeBSD PowerPC use secure-plt | expand

Commit Message

Andreas Tobler Sept. 25, 2019, 8:46 p.m. UTC
Hi all,

the attached patch makes use of the secure-plt for 32-bit PowerPC on 
FreeBSD 13 and upwards. The OS support will arrive in FreeBSD 13.0

I'd like to commit this patch to head and later to all open branches.

Comments appreciated!

If I do not get any, I'll commit in a few days.

TIA,
Andreas
--- UTC
Index: gcc/config.gcc
===================================================================

Comments

Segher Boessenkool Sept. 25, 2019, 10:49 p.m. UTC | #1
Hi!

On Wed, Sep 25, 2019 at 10:46:57PM +0200, Andreas Tobler wrote:
> --- gcc/config/rs6000/t-freebsd64	(revision 276090)
> +++ gcc/config/rs6000/t-freebsd64	(working copy)
> @@ -27,3 +27,6 @@
>  MULTILIB_EXCEPTIONS     =
>  MULTILIB_OSDIRNAMES	= ../lib32
>  
> +SECURE_PLT = $(if $(findstring TARGET_FREEBSD32_SECURE_PLT=1, $(tm_defines)),msecure-plt)
> +
> +MULTILIB_EXTRA_OPTS += $(SECURE_PLT)

$(findstring) isn't super great, it looks for substrings, so it would
also match "TARGET_FREEBSD32_SECURE_PLT=123"; you can use $(filter) instead?

Looks fine to me either way.


Segher
Andreas Tobler Sept. 26, 2019, 6:13 a.m. UTC | #2
Hi Segher,

On 26.09.19 00:49, Segher Boessenkool wrote:

> On Wed, Sep 25, 2019 at 10:46:57PM +0200, Andreas Tobler wrote:
>> --- gcc/config/rs6000/t-freebsd64	(revision 276090)
>> +++ gcc/config/rs6000/t-freebsd64	(working copy)
>> @@ -27,3 +27,6 @@
>>   MULTILIB_EXCEPTIONS     =
>>   MULTILIB_OSDIRNAMES	= ../lib32
>>   
>> +SECURE_PLT = $(if $(findstring TARGET_FREEBSD32_SECURE_PLT=1, $(tm_defines)),msecure-plt)
>> +
>> +MULTILIB_EXTRA_OPTS += $(SECURE_PLT)
> 
> $(findstring) isn't super great, it looks for substrings, so it would
> also match "TARGET_FREEBSD32_SECURE_PLT=123"; you can use $(filter) instead?

Thank you for the feedback. Indeed, filter looks better. Testing again :)

And here for completeness the CL.

2019-09-25  Andreas Tobler  <andreast@gcc.gnu.org>

	* config.gcc: Use the secure-plt on FreeBSD 13 and upwards for
	32-bit PowerPC.
	Define TARGET_FREEBSD32_SECURE_PLT for 64-bit PowerPC.
	* config/rs6000/t-freebsd64: Make use of the above define and build
	the 32-bit libraries with secure-plt.

> Looks fine to me either way.

Thank you.

Andreas
Andreas Tobler Sept. 30, 2019, 7:57 a.m. UTC | #3
On 26.09.19 08:13, Andreas Tobler wrote:
> Hi Segher,
> 
> On 26.09.19 00:49, Segher Boessenkool wrote:
> 
>> On Wed, Sep 25, 2019 at 10:46:57PM +0200, Andreas Tobler wrote:
>>> --- gcc/config/rs6000/t-freebsd64	(revision 276090)
>>> +++ gcc/config/rs6000/t-freebsd64	(working copy)
>>> @@ -27,3 +27,6 @@
>>>    MULTILIB_EXCEPTIONS     =
>>>    MULTILIB_OSDIRNAMES	= ../lib32
>>>    
>>> +SECURE_PLT = $(if $(findstring TARGET_FREEBSD32_SECURE_PLT=1, $(tm_defines)),msecure-plt)
>>> +
>>> +MULTILIB_EXTRA_OPTS += $(SECURE_PLT)
>>
>> $(findstring) isn't super great, it looks for substrings, so it would
>> also match "TARGET_FREEBSD32_SECURE_PLT=123"; you can use $(filter) instead?
> 
> Thank you for the feedback. Indeed, filter looks better. Testing again :)
> 
> And here for completeness the CL.
> 
> 2019-09-25  Andreas Tobler  <andreast@gcc.gnu.org>
> 
> 	* config.gcc: Use the secure-plt on FreeBSD 13 and upwards for
> 	32-bit PowerPC.
> 	Define TARGET_FREEBSD32_SECURE_PLT for 64-bit PowerPC.
> 	* config/rs6000/t-freebsd64: Make use of the above define and build
> 	the 32-bit libraries with secure-plt.
> 
>> Looks fine to me either way.

Committed to trunk.

Andreas
diff mbox series

Patch

--- gcc/config.gcc	(revision 276112)
+++ gcc/config.gcc	(working copy)
@@ -2687,8 +2687,14 @@ 
 	    	tm_file="${tm_file} rs6000/default64.h rs6000/freebsd64.h"
 		tmake_file="${tmake_file} rs6000/t-freebsd64"
 		extra_options="${extra_options} rs6000/linux64.opt"
+		if test $fbsd_major -ge 13; then
+		    tm_defines="${tm_defines} TARGET_FREEBSD32_SECURE_PLT=1"
+		fi
 		;;
 	     *)
+		if test $fbsd_major -ge 13; then
+		    tm_file="rs6000/secureplt.h ${tm_file}"
+		fi
 	        tm_file="${tm_file} rs6000/freebsd.h"
 		;;
 	esac
Index: gcc/config/rs6000/t-freebsd64
===================================================================
--- gcc/config/rs6000/t-freebsd64	(revision 276090)
+++ gcc/config/rs6000/t-freebsd64	(working copy)
@@ -27,3 +27,6 @@ 
 MULTILIB_EXCEPTIONS     =
 MULTILIB_OSDIRNAMES	= ../lib32
 
+SECURE_PLT = $(if $(findstring TARGET_FREEBSD32_SECURE_PLT=1, $(tm_defines)),msecure-plt)
+
+MULTILIB_EXTRA_OPTS += $(SECURE_PLT)