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.
This commit is contained in:
Alan Modra
2014-01-24 14:22:10 +10:30
parent 598beeff91
commit 3ba720c788
2 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2014-01-24 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc_build_one_stub): Correct reloc count passed
to get_relocs for ELFv2.
2014-01-23 H.J. Lu <hongjiu.lu@intel.com> 2014-01-23 H.J. Lu <hongjiu.lu@intel.com>
PR ld/16498 PR ld/16498

View File

@ -10750,10 +10750,11 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (info->emitrelocations) if (info->emitrelocations)
{ {
r = get_relocs (stub_entry->stub_sec, r = get_relocs (stub_entry->stub_sec,
(2 ((PPC_HA (off) != 0)
+ (PPC_HA (off) != 0) + (htab->opd_abi
+ (htab->plt_static_chain ? 2 + (htab->plt_static_chain
&& PPC_HA (off + 16) == PPC_HA (off)))); && PPC_HA (off + 16) == PPC_HA (off))
: 1)));
if (r == NULL) if (r == NULL)
return FALSE; return FALSE;
r[0].r_offset = loc - stub_entry->stub_sec->contents; r[0].r_offset = loc - stub_entry->stub_sec->contents;