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