diff options
author | Alan Modra <amodra@gmail.com> | 2020-07-17 16:47:28 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-07-19 12:27:47 +0930 |
commit | e10a07b32dc1faed25b5bbcbbc47d68e2ff537b9 (patch) | |
tree | 1eeb63b4cdb332eb53f3e8f4ae91773bda69a008 /ld/ld.texi | |
parent | 6095ca52575d8e49003a3685453bc5bd0d929f1e (diff) | |
download | gdb-e10a07b32dc1faed25b5bbcbbc47d68e2ff537b9.zip gdb-e10a07b32dc1faed25b5bbcbbc47d68e2ff537b9.tar.gz gdb-e10a07b32dc1faed25b5bbcbbc47d68e2ff537b9.tar.bz2 |
Power10 stub selection
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.
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add has_power10_relocs.
(select_alt_stub): New function.
(ppc_get_stub_entry): Use it here.
(ppc64_elf_check_relocs): Set had_power10_relocs rather than
power10_stubs.
(ppc64_elf_size_stubs): Clear power10_stubs here instead. Don't
merge notoc stubs with other varieties when power10_stubs is "auto".
Instead dup the stub hash table entry.
(plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
tests of power10_stubs.
ld/
* emultempl/ppc64elf.em (power10-stubs): Accept optional "auto" arg.
* ld.texi (power10-stubs): Update.
* testsuite/ld-powerpc/callstub-1.d: Force --power10-stubs.
* testsuite/ld-powerpc/callstub-2.d: Relax branch offset comparison.
* testsuite/ld-powerpc/callstub-4.d: New test.
* testsuite/ld-powerpc/notoc.d: Force --no-power10-stubs.
* testsuite/ld-powerpc/notoc3.d,
* testsuite/ld-powerpc/notoc3.s,
* testsuite/ld-powerpc/notoc3.wf: New test.
* testsuite/ld-powerpc/powerpc.exp: Run new tests. Pass
--no-power10-stubs for notoc link.
Diffstat (limited to 'ld/ld.texi')
-rw-r--r-- | ld/ld.texi | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -7922,15 +7922,13 @@ care. @option{--no-plt-localentry} is the default. @itemx --no-power10-stubs When PowerPC64 @command{ld} links input object files containing relocations used on power10 prefixed instructions it normally creates -linkage stubs (PLT call and long branch) using power10 instructions. -In particular for @code{@@notoc} PLT calls where @code{r2} is not -known the power10 stubs are smaller and faster, so are preferred for +linkage stubs (PLT call and long branch) using power10 instructions +for @code{@@notoc} PLT calls where @code{r2} is not known. The +power10 notoc stubs are smaller and faster, so are preferred for power10. @option{--power10-stubs} and @option{--no-power10-stubs} allow you to override the linker's selection of stub instructions. -For example, when linking a shared library that contains cpu-optimized -versions of functions for both power9 and power10, you might use -@option{--no-power10-stubs} so that power9 code making calls doesn't -attempt to execute power10 instructions. +@option{--power10-stubs=auto} allows the user to select the default +auto mode. @end table @ifclear GENERIC |