aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-03-18 23:32:22 +1030
committerAlan Modra <amodra@gmail.com>2019-03-18 23:37:21 +1030
commit1a4839f89446137089f2b45e17ddb28793262629 (patch)
tree2c288af291fc3f91039831f841181f029d58a13e
parentc6f021093dbd26b4d8e761e9a19af817e9f2561f (diff)
downloadgdb-binutils-2_30-branch.zip
gdb-binutils-2_30-branch.tar.gz
gdb-binutils-2_30-branch.tar.bz2
PR24355, segmentation fault in function called from ppc_finish_symbolsbinutils-2_30-branch
Backport to 2.30, where the problem might be triggered by gc-sections rather than inline PLT optimization as in the PR. PR 24355 * elf32-ppc.c (ppc_elf_relocate_section): Don't call write_glink_stub for local iplt syms with ent->plt.offset == -1. Remove ineffective attempt at writing glink stubs only once. Correct plt.offset mask.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf32-ppc.c13
2 files changed, 12 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2c1c75c..f5a8af8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2019-03-18 Alan Modra <amodra@gmail.com>
+
+ PR 24355
+ * elf32-ppc.c (ppc_elf_relocate_section): Don't call write_glink_stub
+ for local iplt syms with ent->plt.offset == -1. Remove ineffective
+ attempt at writing glink stubs only once. Correct plt.offset mask.
+
2018-07-04 H.J. Lu <hongjiu.lu@intel.com>
PR ld/23324
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 16ee60f..7c6a96a 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -8259,6 +8259,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
{
Elf_Internal_Rela rela;
bfd_byte *loc;
+ unsigned char *p;
rela.r_offset = (htab->elf.iplt->output_section->vma
+ htab->elf.iplt->output_offset
@@ -8272,14 +8273,10 @@ ppc_elf_relocate_section (bfd *output_bfd,
htab->local_ifunc_resolver = 1;
ent->plt.offset |= 1;
- }
- if (h == NULL && (ent->glink_offset & 1) == 0)
- {
- unsigned char *p = ((unsigned char *) htab->glink->contents
- + ent->glink_offset);
+ p = ((unsigned char *) htab->glink->contents
+ + ent->glink_offset);
write_glink_stub (NULL, ent, htab->elf.iplt, p, info);
- ent->glink_offset |= 1;
}
unresolved_reloc = FALSE;
@@ -8289,11 +8286,11 @@ ppc_elf_relocate_section (bfd *output_bfd,
|| h->dynindx == -1)
relocation = (htab->glink->output_section->vma
+ htab->glink->output_offset
- + (ent->glink_offset & ~1));
+ + ent->glink_offset);
else
relocation = (htab->elf.splt->output_section->vma
+ htab->elf.splt->output_offset
- + ent->plt.offset);
+ + (ent->plt.offset & ~1));
}
}