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

Segher Boessenkool segher@kernel.crashing.org
Fri Aug 30 19:46:00 GMT 2019


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.


> +  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?


Segher



More information about the Gcc-patches mailing list