]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* elf32-ppc.c (ppc_elf_relocate_section <R_PPC_PLTREL24>): Adjust
authorAlan Modra <amodra@gmail.com>
Mon, 4 Mar 2013 12:12:51 +0000 (12:12 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 4 Mar 2013 12:12:51 +0000 (12:12 +0000)
non-zero addends when relocatable, rather than addends >= 32768.
Always zero "addend" before applying relocation.

bfd/ChangeLog
bfd/elf32-ppc.c

index 6607accf341549f7b67ff6e36dc7299ce7d106c2..3a7ace0f22e018f5aa5450c0c5091d2017ea3aec 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-04  Alan Modra  <amodra@gmail.com>
+
+       * elf32-ppc.c (ppc_elf_relocate_section <R_PPC_PLTREL24>): Adjust
+       non-zero addends when relocatable, rather than addends >= 32768.
+       Always zero "addend" before applying relocation.
+
 2013-02-18  Alan Modra  <amodra@gmail.com>
 
        PR ld/12549
index 31bc6819b97a21d8734c817e6a81c0953ad9d9c8..6454a8350da35adf6ed1e2209d9e4774ab7c50e3 100644 (file)
@@ -7406,7 +7406,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
        {
          if (got2 != NULL
              && r_type == R_PPC_PLTREL24
-             && rel->r_addend >= 32768)
+             && rel->r_addend != 0)
            {
              /* R_PPC_PLTREL24 is rather special.  If non-zero, the
                 addend specifies the GOT pointer offset within .got2.  */
@@ -8411,33 +8411,37 @@ ppc_elf_relocate_section (bfd *output_bfd,
          break;
 
        case R_PPC_PLTREL24:
-         if (h == NULL || ifunc != NULL)
-           break;
-         /* Relocation is to the entry for this symbol in the
-            procedure linkage table.  */
-         {
-           struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2,
-                                                 info->shared ? addend : 0);
-           addend = 0;
-           if (ent == NULL
-               || htab->plt == NULL)
-             {
-               /* We didn't make a PLT entry for this symbol.  This
-                  happens when statically linking PIC code, or when
-                  using -Bsymbolic.  */
-               break;
-             }
+         if (h != NULL && ifunc == NULL)
+           {
+             struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2,
+                                                   info->shared ? addend : 0);
+             if (ent == NULL
+                 || htab->plt == NULL)
+               {
+                 /* We didn't make a PLT entry for this symbol.  This
+                    happens when statically linking PIC code, or when
+                    using -Bsymbolic.  */
+               }
+             else
+               {
+                 /* Relocation is to the entry for this symbol in the
+                    procedure linkage table.  */
+                 unresolved_reloc = FALSE;
+                 if (htab->plt_type == PLT_NEW)
+                   relocation = (htab->glink->output_section->vma
+                                 + htab->glink->output_offset
+                                 + ent->glink_offset);
+                 else
+                   relocation = (htab->plt->output_section->vma
+                                 + htab->plt->output_offset
+                                 + ent->plt.offset);
+               }
+           }
 
-           unresolved_reloc = FALSE;
-           if (htab->plt_type == PLT_NEW)
-             relocation = (htab->glink->output_section->vma
-                           + htab->glink->output_offset
-                           + ent->glink_offset);
-           else
-             relocation = (htab->plt->output_section->vma
-                           + htab->plt->output_offset
-                           + ent->plt.offset);
-         }
+         /* R_PPC_PLTREL24 is rather special.  If non-zero, the
+            addend specifies the GOT pointer offset within .got2.
+            Don't apply it to the relocation field.  */
+         addend = 0;
          break;
 
          /* Relocate against _SDA_BASE_.  */
@@ -9057,7 +9061,7 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
                            htab->plt->contents + ent->plt.offset + 28);
 
                /* Fill in the GOT entry corresponding to this PLT slot with
-                  the address immediately after the the "bctr" instruction
+                  the address immediately after the "bctr" instruction
                   in this PLT entry.  */
                bfd_put_32 (output_bfd, (htab->plt->output_section->vma
                                         + htab->plt->output_offset