aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-01-24 14:22:10 +1030
committerAlan Modra <amodra@gmail.com>2014-01-24 14:26:39 +1030
commit3ba720c788c2845c93a6dfe592f36163cbfa63fd (patch)
tree01e49d9d621be39c262fe17036377ab08600fb99 /bfd/elf64-ppc.c
parent598beeff91ca20aa09586d8b39eae8a1ae83baa0 (diff)
downloadgdb-3ba720c788c2845c93a6dfe592f36163cbfa63fd.zip
gdb-3ba720c788c2845c93a6dfe592f36163cbfa63fd.tar.gz
gdb-3ba720c788c2845c93a6dfe592f36163cbfa63fd.tar.bz2
Fixes powerpc64le ld segfaults when --emit-relocs is used.
ELFv2 needs fewer relocs to annotate plt call stubs. I correctly allocated a smaller buffer and wrote the proper relocs, but stupidly bumped the reloc count as for ELFv1. * elf64-ppc.c (ppc_build_one_stub): Correct reloc count passed to get_relocs for ELFv2.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index bb3326d..c97a39e 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -10750,10 +10750,11 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (info->emitrelocations)
{
r = get_relocs (stub_entry->stub_sec,
- (2
- + (PPC_HA (off) != 0)
- + (htab->plt_static_chain
- && PPC_HA (off + 16) == PPC_HA (off))));
+ ((PPC_HA (off) != 0)
+ + (htab->opd_abi
+ ? 2 + (htab->plt_static_chain
+ && PPC_HA (off + 16) == PPC_HA (off))
+ : 1)));
if (r == NULL)
return FALSE;
r[0].r_offset = loc - stub_entry->stub_sec->contents;