diff options
author | Greg McGary <greg@mcgary.org> | 2006-11-22 00:12:30 +0000 |
---|---|---|
committer | Greg McGary <greg@mcgary.org> | 2006-11-22 00:12:30 +0000 |
commit | 4fe5ca5b131cea35f0b3265d18a86f12bfc149e7 (patch) | |
tree | 511d0d72e75fb1281d3e3339043da72ccafce234 /bfd/elf32-ppc.c | |
parent | 3593430428fb3a3e8682d5888e84423b986e1ee0 (diff) | |
download | gdb-4fe5ca5b131cea35f0b3265d18a86f12bfc149e7.zip gdb-4fe5ca5b131cea35f0b3265d18a86f12bfc149e7.tar.gz gdb-4fe5ca5b131cea35f0b3265d18a86f12bfc149e7.tar.bz2 |
* elf32-ppc.c (ppc_elf_relocate_section): Fixup D field
at proper offset in little-endian mode.
* elf64-ppc.c (ppc_elf_relocate_section): Likewise.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r-- | bfd/elf32-ppc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 281fab0..3561d8b 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -5504,6 +5504,7 @@ ppc_elf_relocate_section (bfd *output_bfd, asection *got2, *sreloc = NULL; bfd_vma *local_got_offsets; bfd_boolean ret = TRUE; + bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0); #ifdef DEBUG _bfd_error_handler ("ppc_elf_relocate_section called for %B section %A, " @@ -5630,10 +5631,10 @@ ppc_elf_relocate_section (bfd *output_bfd, && (tls_mask & TLS_TPREL) == 0) { bfd_vma insn; - insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2); + insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset); insn &= 31 << 21; insn |= 0x3c020000; /* addis 0,2,0 */ - bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2); + bfd_put_32 (output_bfd, insn, contents + rel->r_offset - d_offset); r_type = R_PPC_TPREL16_HA; rel->r_info = ELF32_R_INFO (r_symndx, r_type); } @@ -5677,9 +5678,10 @@ ppc_elf_relocate_section (bfd *output_bfd, bfd_put_32 (output_bfd, insn, contents + rel->r_offset); r_type = R_PPC_TPREL16_LO; rel->r_info = ELF32_R_INFO (r_symndx, r_type); + /* Was PPC_TLS which sits on insn boundary, now - PPC_TPREL16_LO which is at insn+2. */ - rel->r_offset += 2; + PPC_TPREL16_LO which is at low-order half-word. */ + rel->r_offset += d_offset; } break; @@ -5701,7 +5703,7 @@ ppc_elf_relocate_section (bfd *output_bfd, else { bfd_put_32 (output_bfd, NOP, contents + rel->r_offset); - rel->r_offset -= 2; + rel->r_offset -= d_offset; r_type = R_PPC_NONE; } rel->r_info = ELF32_R_INFO (r_symndx, r_type); @@ -5750,7 +5752,7 @@ ppc_elf_relocate_section (bfd *output_bfd, /* OK, it checks out. Replace the call. */ offset = rel[1].r_offset; insn1 = bfd_get_32 (output_bfd, - contents + rel->r_offset - 2); + contents + rel->r_offset - d_offset); if ((tls_mask & tls_gd) != 0) { /* IE */ @@ -5778,10 +5780,10 @@ ppc_elf_relocate_section (bfd *output_bfd, rel->r_info = ELF32_R_INFO (r_symndx, r_type); rel[1].r_info = ELF32_R_INFO (r_symndx, R_PPC_TPREL16_LO); - rel[1].r_offset += 2; + rel[1].r_offset += d_offset; rel[1].r_addend = rel->r_addend; } - bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2); + bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - d_offset); bfd_put_32 (output_bfd, insn2, contents + offset); if (tls_gd == 0) { |