aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-03-04 12:12:11 +0000
committerAlan Modra <amodra@gmail.com>2013-03-04 12:12:11 +0000
commitf75e0e336f4dc82dfcd05c87d59d0723cbb147de (patch)
tree9e3a8f8adcd697d9e0dab32ce858fa230d4c4aa0
parent17e3916e23e6a4228b2d1c34ecef260c69d4c680 (diff)
downloadgdb-f75e0e336f4dc82dfcd05c87d59d0723cbb147de.zip
gdb-f75e0e336f4dc82dfcd05c87d59d0723cbb147de.tar.gz
gdb-f75e0e336f4dc82dfcd05c87d59d0723cbb147de.tar.bz2
* 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.
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/elf32-ppc.c58
2 files changed, 39 insertions, 29 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8b949e4..70015a5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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-03-04 Nick Clifton <nickc@redhat.com>
* archive64.c (bfd_elf64_archive_write_armap): Fix calculation of
@@ -1017,8 +1023,8 @@
2013-01-07 Tom Tromey <tromey@redhat.com>
* section.c (_bfd_std_section): Rename from std_section.
- (bfd_com_section_ptr, bfd_und_section_ptr, bfd_abs_section_ptr)
- (STD_SECTION): Update.
+ (bfd_com_section_ptr, bfd_und_section_ptr, bfd_abs_section_ptr)
+ (STD_SECTION): Update.
* bfd-in2.h: Rebuild.
2013-01-04 Juergen Urban <JuergenUrban@gmx.de>
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index bac1ce2..c05f2f0 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -7472,7 +7472,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. */
@@ -8477,33 +8477,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_. */