Fixes powerpc64le ld segfaults when --emit-relocs is used.
authorAlan Modra <amodra@gmail.com>
Fri, 24 Jan 2014 03:52:10 +0000 (14:22 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 24 Jan 2014 03:56:39 +0000 (14:26 +1030)
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.

bfd/ChangeLog
bfd/elf64-ppc.c

index 78aa794ddf6cb15218fe66d5dd6dd326f3b65c0f..a5fcadf84dc1ce9c36735fcb7668043c39e48940 100644 (file)
@@ -1,7 +1,12 @@
+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>
 
        PR ld/16498
-       * elf.c (_bfd_elf_map_sections_to_segments): Issue a linker error 
+       * elf.c (_bfd_elf_map_sections_to_segments): Issue a linker error
        if TLS sections are not adjacent.
 
 2014-01-22  Alan Modra  <amodra@gmail.com>
index bb3326da17a09e4ae7507f91c70739264bb72f7a..c97a39e12967041cce0fe16b652839addd42ad1f 100644 (file)
@@ -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;