diff options
author | Alan Modra <amodra@gmail.com> | 2015-06-16 16:47:51 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2015-06-16 17:42:29 +0930 |
commit | 1d5c94cb3e2e312fc37e7841d17ea98a02f0412c (patch) | |
tree | c1af5e39acf43ea290e71861de2c9185508b8921 /bfd/elf32-ppc.c | |
parent | dd9bdb04c7ca31c4ca14e2aaf244d4a492d9d9b3 (diff) | |
download | gdb-1d5c94cb3e2e312fc37e7841d17ea98a02f0412c.zip gdb-1d5c94cb3e2e312fc37e7841d17ea98a02f0412c.tar.gz gdb-1d5c94cb3e2e312fc37e7841d17ea98a02f0412c.tar.bz2 |
ppc476 linker workaround shared lib fixes again
Huh, I can't even write a binary search properly.
bfd/
* elf32-ppc.c (ppc_elf_relocate_section): Correct binary search of
dynamic relocs.
ld/testsuite/
* ld-powerpc/ppc476-shared.s: Repeat dynamic reloc generating insns.
* ld-powerpc/ppc476-shared.d: Update.
* ld-powerpc/ppc476-shared2.d: Update.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r-- | bfd/elf32-ppc.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index a947e8e..f1fbc66 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -9642,32 +9642,33 @@ ppc_elf_relocate_section (bfd *output_bfd, sreloc = elf_section_data (input_section)->sreloc; if (sreloc != NULL) { - bfd_byte *slo, *shi, *srelend; + Elf32_External_Rela *slo, *shi, *srelend; bfd_vma soffset; - slo = sreloc->contents; - shi = srelend - = slo + sreloc->reloc_count * sizeof (Elf32_External_Rela); + slo = (Elf32_External_Rela *) sreloc->contents; + shi = srelend = slo + sreloc->reloc_count; soffset = (offset + input_section->output_section->vma + input_section->output_offset); while (slo < shi) { - bfd_byte *srel = slo + (shi - slo) / 2; - bfd_elf32_swap_reloca_in (output_bfd, srel, &outrel); + Elf32_External_Rela *srel = slo + (shi - slo) / 2; + bfd_elf32_swap_reloca_in (output_bfd, (bfd_byte *) srel, + &outrel); if (outrel.r_offset < soffset) slo = srel + 1; else if (outrel.r_offset > soffset + 3) shi = srel; else { - bfd_byte *nextr = srel + sizeof (Elf32_External_Rela); - if (nextr != srelend) + if (srel + 1 != srelend) { - memmove (srel, nextr, srelend - nextr); - srel = srelend - sizeof (Elf32_External_Rela); + memmove (srel, srel + 1, + (srelend - (srel + 1)) * sizeof (*srel)); + srel = srelend - 1; } outrel.r_offset += patch_off - offset; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, srel); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, + (bfd_byte *) srel); break; } } |