[PATCH] rs6000: Rework ELFv2 support for -fpatchable-function-entry* [PR99888]

Segher Boessenkool segher@kernel.crashing.org
Tue Aug 9 10:35:04 GMT 2022


Hi!

> +	  /* As ELFv2 ABI shows, the allowable bytes past the global entry
> +	     point are 0, 4, 8, 16, 32 and 64.  Considering there are two
> +	     non-prefixed instructions for global entry (8 bytes), the count
> +	     for patchable NOPs before local entry would be 2, 6 and 14.  */

The other option is to allow other numbers of nops, but in that case not
have a local entry point (so, always use the global entry point).

I don't know if that is useful for any users of this support (if there
even are such users :-P )

> +	  if (patch_area_entry > 0)
> +	    {
> +	      if (patch_area_entry != 2
> +		  && patch_area_entry != 6
> +		  && patch_area_entry != 14)
> +		error ("for %<-fpatchable-function-entry=%u,%u%>, patching "
> +		       "%u NOP(s) before function entry is invalid, it can "
> +		       "cause assembler error",

I would not say "it can [etc.]" at all.  Oh, and "NOP" (capitals) isn't
a thing, it is not an acronym or such ;-)

> +/* { dg-require-effective-target powerpc_elfv2 } */
> +/* Specify -mcpu=power9 to ensure global entry is needed.  */
> +/* { dg-options "-mdejagnu-cpu=power9" } */

Why would it be needed for p9, and not older, or newer?

Every function always has a GEP, so I'm not sure what you are trying to
say here anyway :-)


Rest looks good to me.


Segher


More information about the Gcc-patches mailing list