aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-10-09 16:56:33 +1030
committerAlan Modra <amodra@gmail.com>2020-10-09 23:24:17 +1030
commitfa40fbe484954c560ab1c0ff4bc1b2eeb1511344 (patch)
tree2e6af9068d974acf0b43a502398d069bbe23f0ec /bfd
parent4290b0ab2b65db23afc9bd8177885bfd91911c0c (diff)
downloadgdb-fa40fbe484954c560ab1c0ff4bc1b2eeb1511344.zip
gdb-fa40fbe484954c560ab1c0ff4bc1b2eeb1511344.tar.gz
gdb-fa40fbe484954c560ab1c0ff4bc1b2eeb1511344.tar.bz2
[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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-ppc.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9650b3d..3ff3b1e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2020-10-09 Alan Modra <amodra@gmail.com>
+
+ * elf64-ppc.c (write_plt_relocs_for_local_syms): Don't do local
+ entry offset optimisation.
+
2020-10-09 H.J. Lu <hongjiu.lu@intel.com>
PR gas/26703
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index fa0c7f9..c30215b 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -14259,8 +14259,6 @@ write_plt_relocs_for_local_syms (struct bfd_link_info *info)
}
val = sym->st_value + ent->addend;
- if (ELF_ST_TYPE (sym->st_info) != STT_GNU_IFUNC)
- val += PPC64_LOCAL_ENTRY_OFFSET (sym->st_other);
if (sym_sec != NULL && sym_sec->output_section != NULL)
val += sym_sec->output_offset + sym_sec->output_section->vma;