Power10 stub selection

Alan Modra amodra@gmail.com
Sun Jul 19 03:46:20 GMT 2020


On Sun, Jul 19, 2020 at 12:30:31PM +0930, Alan Modra wrote:
> This patch better supports mixing of power10 and non-power10 code,
> as might be seen in a cpu-optimized library using ifuncs to select
> functions optimized for a given cpu.  Using -Wl,--no-power10-stubs
> isn't that good in this situation since non-power10 notoc stubs are
> slower and larger than the power10 variants, which you'd like to use
> on power10 code paths.
> 
> With this change, power10 pc-relative code that makes calls marked
> @notoc uses power10 stubs if stubs are necessary, and other calls use
> non-power10 instructions in stubs.  This will mean that if gcc is
> generating code for -mcpu=power10 but with pc-rel disabled then you'll
> get the older stubs even on power10 (unless you force with
> -Wl,--power10-stubs).  That shouldn't be too big a problem: stubs that
> use r2 are reasonable.  It's just the ones that set up addressing
> using "mflr 12; bcl 20,31,.+4; mflr 11; mtlr 12" that should be
> avoided if possible.

Nick, I've pushed this one on the branch too, with some trepidation at
making such a late change.  Hopefully this won't blow up in my face.

I do have some confidence that power9 and below aren't destabilised,
and the implementation by duplicating a hash table entry is well
tested in lang_output_section_statement_lookup and avoids lots of low
level tests in the stub generating code as would be required by a
change to enum ppc_stub_type or struct ppc_stub_hash_entry.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list