[GOLD] Power10 segv due to wild r2
authorAlan Modra <amodra@gmail.com>
Fri, 9 Oct 2020 06:26:33 +0000 (16:56 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 9 Oct 2020 12:54:17 +0000 (23:24 +1030)
commitfa40fbe484954c560ab1c0ff4bc1b2eeb1511344
tree2e6af9068d974acf0b43a502398d069bbe23f0ec
parent4290b0ab2b65db23afc9bd8177885bfd91911c0c
[GOLD] Power10 segv due to wild r2

Calling non-pcrel functions from pcrel code requires a stub to set up
r2.  Gold created the stub, but an "optimisation" made the stub jump
to the function local entry, ie. r2 was not initialised.

This patch fixes that long branch stub problem, and another that might
occur for plt call stubs to local functions.

bfd/
* elf64-ppc.c (write_plt_relocs_for_local_syms): Don't do local
entry offset optimisation.
gold/
* powerpc.cc (Powerpc_relobj::do_relocate_sections): Don't do
local entry offset optimisation for lplt_section.
(Target_powerpc::Branch_info::make_stub): Don't add local
entry offset to long branch dest passed to
add_long_branch_entry.  Do pass st_other bits.
(Stub_table::Branch_stub_ent): Add "other_" field.
(Stub_table::add_long_branch_entry): Add "other" param, and
save.
(Stub_table::branch_stub_size): Adjust long branch offset.
(Stub_table::do_write): Likewise.
(Target_powerpc::Relocate::relocate): Likewise.
bfd/ChangeLog
bfd/elf64-ppc.c
gold/ChangeLog
gold/powerpc.cc
This page took 0.027168 seconds and 4 git commands to generate.