This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, V3, #5 of 10], Make -mpcrel default on little endian Linux systems


On Fri, Aug 30, 2019 at 01:32:57PM -0500, Segher Boessenkool wrote:
> On Mon, Aug 26, 2019 at 05:07:25PM -0400, Michael Meissner wrote:
> > +/* By default enable support for pc-relative and numeric prefixed addressing on
> > +   the 'future' system, unless it is overriden at build time.  */
> > +#ifndef TARGET_PREFIXED_ADDR_DEFAULT
> > +#define TARGET_PREFIXED_ADDR_DEFAULT	1
> > +#endif
> > +
> > +#if !defined (TARGET_PCREL_DEFAULT) && TARGET_PREFIXED_ADDR_DEFAULT
> > +#define TARGET_PCREL_DEFAULT		1
> > +#endif
> 
> Spelling ("overridden").
> 
> How can it be overridden at build time?
> 
> How can it be defined already, when linux64.h is included?  Don't put in
> guards against things that cannot happen.

You can define TARGET_PREFIXED_ADDR_DEFAULT or TARGET_PCREL_DEFAULT in your
CFLAGS or via the make command line (which is how I tested it).

> 
> > +  if (TARGET_FUTURE)
> > +    {
> > +      bool explicit_prefixed = ((rs6000_isa_flags_explicit
> > +				 & OPTION_MASK_PREFIXED_ADDR) != 0);
> > +      bool explicit_pcrel = ((rs6000_isa_flags_explicit
> > +			      & OPTION_MASK_PCREL) != 0);
> > +
> > +      /* Prefixed addressing requires 64-bit registers.  */
> 
> Does it?  Don't disable things just because you do not want to think
> about if and how to support them.  Be much more exact in the comment here
> if you do have a reason to disable it here.
>
> > +      if (!TARGET_POWERPC64)
> > +	{
> > +	  if (TARGET_PCREL && explicit_pcrel)
> > +	    error ("%qs requires %qs", "-mpcrel", "-m64");
> 
> TARGET_POWERPC64 is -mpowerpc64.  -m64 is TARGET_64BIT.
> 
> > +      /* Enable defaults if desired.  */
> > +      else
> > +	{
> > +	  if (!explicit_prefixed
> > +	      && (TARGET_PREFIXED_ADDR_DEFAULT
> > +		  || TARGET_PCREL
> > +		  || TARGET_PCREL_DEFAULT))
> > +	    rs6000_isa_flags |= OPTION_MASK_PREFIXED_ADDR;
> > +
> > +	  if (!explicit_pcrel && TARGET_PCREL_DEFAULT
> > +	      && TARGET_CMODEL == CMODEL_MEDIUM)
> > +	    rs6000_isa_flags |= OPTION_MASK_PCREL;
> > +	}
> 
> Should these be the other way around?

I'm not sure I follow the question.  You want to enable pc-relative support if
prefixed addressing support is enabled, and the OS says that it supports
pc-relative addressing.

If you previously disabled prefixed addressing, you can't enable pc-relative by default.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]