On Thu, 2020-04-02 at 20:36 -0400, Michael Meissner via Gcc-patches wrote: > Enable -mpcrel on PowerPC -mcpu=future ELF v2 systems, V3 >
Hi, > This patch changes the default for -mcpu=future to be -mpcrel (i.e. > use > PC-relative addressing) if the ABI allows PC-relative relocations and > the user > did not use either -mno-pcrel or -mno-prefixed. > > I have changed the spelling of the macro to PCREL_SUPPORTED_BY_ABI > (from > PCREL_SUPPORTED_BY_OS) since you pointed out it is more properly a > function of > the particular ABI, rather than just an OS choice. I have changed > the various > comments to make it clearer. > > I have done a bootstrap and a make check with and without the patch > and there > were no regressions by adding the patch on a little endian PowerPC > Linux > system. > > I also tested by hand that if I use: > > -mcpu=power9 > -mcpu=future -mno-prefixed > -mcpu=future -mno-pcrel > -mcpu=future -mabi=elfv1 (or) > -mcpu=future -mcmodel=large > > that PC-relative addressing is not enabled by default. Variants of > this patch > have been used since December, building power8/power9 code on big > endian > systems, and power8/power9/future on little endian systems. Can I > check this > into the master branch? > > 2020-04-02 Michael Meissner <meiss...@linux.ibm.com> > > * config/rs6000/linux64.h (PCREL_SUPPORTED_BY_ABI): Enable > prefixed PC-relative addressing if the ABI supports it. > * config/rs6000/rs6000-cpus.def (ISA_FUTURE_MASKS_SERVER): Do > not > set OPTION_MASK_FUTURE here. Patch contents suggest this should be "Do not set OPTION_MASK_PREFIXED here." > * config/rs6000/rs6000.c (rs6000_option_override_internal): > Enable > OPTION_MASK_PREFIXED and OPTION_MASK_PREFIXED on -mcpu=future > by > default if the current ABI allows the options. It's so good we enable it twice. :-) One of those should be s/OPTION_MASK_PREFIXED/OPTION_MASK_PCREL/ > > --- /tmp/IPB30g_linux64.h 2020-04-02 15:23:19.977060411 -0500 > +++ gcc/config/rs6000/linux64.h 2020-04-02 15:23:01.016474023 > -0500 > @@ -640,3 +640,11 @@ extern int dot_symbols; > enabling the __float128 keyword. */ > #undef TARGET_FLOAT128_ENABLE_TYPE > #define TARGET_FLOAT128_ENABLE_TYPE 1 > + > +/* Enable using prefixed PC-relative addressing on the 'future' > machine if the > + ABI supports it. The ELF v2 ABI only supports PC-relative > relocations for > + the medium code model. */ > +#undef PCREL_SUPPORTED_BY_ABI A previous comment suggested the #undef there should not be there. (potential for hiding or introducing a bug). Thanks -Will