]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fixes powerpc64le ld segfaults when --emit-relocs is used.
authorAlan Modra <amodra@gmail.com>
Fri, 24 Jan 2014 03:53:37 +0000 (14:23 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 24 Jan 2014 03:59:29 +0000 (14:29 +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.

Also backport a couple of other minor fixes.

* elf64-ppc.c (ppc_build_one_stub): Correct reloc count passed
to get_relocs for ELFv2.
(STK_LINKER): Comment typo fix.

2013-12-16  Andreas Schwab  <schwab@suse.de>
* elf64-ppc.c (ppc64_elf_relocate_section): Add newline to error
message.

bfd/ChangeLog
bfd/elf64-ppc.c

index 2918efee251fdabd6158d9efde4716453e594222..af251c9aa7965d9bc45063e7d7ff410c07e5af6a 100644 (file)
@@ -1,3 +1,13 @@
+2014-01-24  Alan Modra  <amodra@gmail.com>
+
+       * elf64-ppc.c (ppc_build_one_stub): Correct reloc count passed
+       to get_relocs for ELFv2.
+       (STK_LINKER): Comment typo fix.
+
+       2013-12-16  Andreas Schwab  <schwab@suse.de>
+       * elf64-ppc.c (ppc64_elf_relocate_section): Add newline to error
+       message.
+
 2013-12-20  Alan Modra  <amodra@gmail.com>
 
        * elflink.c (_bfd_elf_merge_symbol): If merging a new weak
index 96719a9352999ec38ba029fc51852791a6df8067..9e40fcf7de67a74102f7d2dd8edf88aee6fee223 100644 (file)
@@ -134,7 +134,7 @@ static bfd_vma opd_entry_value
 /* Offsets to some stack save slots.  */
 #define STK_LR 16
 #define STK_TOC(htab) (htab->opd_abi ? 40 : 24)
-/* This one is dodgy.  ABIv2 does not have a linker word, so use the
+/* This one is dodgy.  ELFv2 does not have a linker word, so use the
    CR save slot.  Used only by optimised __tls_get_addr call stub,
    relying on __tls_get_addr_opt not saving CR..  */
 #define STK_LINKER(htab) (htab->opd_abi ? 32 : 8)
@@ -10751,10 +10751,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;
@@ -13653,7 +13654,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
                {
                  info->callbacks->einfo
                    (_("%P: %H: call to `%T' lacks nop, can't restore toc; "
-                      "recompile with -fPIC"),
+                      "recompile with -fPIC\n"),
                     input_bfd, input_section, rel->r_offset, sym_name);
 
                  bfd_set_error (bfd_error_bad_value);