aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-03-14 15:01:53 +1030
committerAlan Modra <amodra@gmail.com>2014-03-14 15:01:53 +1030
commitc3301df1daed30afd62d8d2f8895d5aadfafb514 (patch)
treee7c33aaf2dbbfa7061345ebf4d02bea55da075f1 /bfd/elf32-ppc.c
parentd4ae5fb0b5d1ae4270b3343509e8bd2d529aa291 (diff)
downloadgdb-c3301df1daed30afd62d8d2f8895d5aadfafb514.zip
gdb-c3301df1daed30afd62d8d2f8895d5aadfafb514.tar.gz
gdb-c3301df1daed30afd62d8d2f8895d5aadfafb514.tar.bz2
Fix overflow handling of VLE_SDA21
bfd/ * elf32-ppc.c (ppc_elf_relocate_section): Correct overflow handling for VLE_SDA21 relocs. ld/testsuite/ * ld-powerpc/vle.ld: Place .PPC.EMB.sdata0 within 32k of 0. * ld-powerpc/vle-reloc-3.d: Update.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 750aa5e..868fe50 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -8859,11 +8859,12 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* And the final 11 bits of the value to bits 21 to 31. */
insn |= relocation & 0x7ff;
- /* Use _bfd_final_link_relocate to report overflow,
- but do so with a value that won't modify the insn. */
- if (relocation + 0x80000 > 0x100000)
- addend = 0x100000;
- relocation = 0;
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+
+ if (r_type == R_PPC_VLE_SDA21
+ && ((relocation + 0x80000) & 0xffffffff) > 0x100000)
+ goto overflow;
+ continue;
}
else if (r_type == R_PPC_EMB_SDA21
|| r_type == R_PPC_VLE_SDA21
@@ -9160,6 +9161,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
{
if (r == bfd_reloc_overflow)
{
+ overflow:
if (warned)
continue;
if (h != NULL