diff options
author | Alan Modra <amodra@gmail.com> | 2003-03-10 23:25:13 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-03-10 23:25:13 +0000 |
commit | e515b051720482023e3f79e418d8b381e29273f3 (patch) | |
tree | 655fb7c6e6041c298be80fff59d491198ae7c21f /bfd/elf32-ppc.c | |
parent | 8c87bc22967dca0135f841ee6ccfbdc36f6597ee (diff) | |
download | gdb-e515b051720482023e3f79e418d8b381e29273f3.zip gdb-e515b051720482023e3f79e418d8b381e29273f3.tar.gz gdb-e515b051720482023e3f79e418d8b381e29273f3.tar.bz2 |
* elf32-ppc.c (ppc_elf_relocate_section): Subtract tls seg vma from
zero index dynamic tls relocs generated for the GOT. Tidy code.
Set "relocation" to 1 on DTPMOD32 relocs. Optimize HA adjustment.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* ld-powerpc/tlsso.r: Adjust for corrected zero symbol index relocs.
* ld-powerpc/tlsso32.r: Likewise.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r-- | bfd/elf32-ppc.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index b7b09dc..6d54419 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4779,10 +4779,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_offset = (htab->got->output_section->vma + htab->got->output_offset + off); + outrel.r_addend = 0; if (tls_ty & (TLS_LD | TLS_GD)) { outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPMOD32); - outrel.r_addend = 0; if (tls_ty == (TLS_TLS | TLS_GD)) { loc = htab->relgot->contents; @@ -4790,9 +4790,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, * sizeof (Elf32_External_Rela)); bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + outrel.r_offset += 4; outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPREL32); - outrel.r_offset += 4; } } else if (tls_ty == (TLS_TLS | TLS_DTPREL)) @@ -4803,9 +4803,12 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE); else outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT); - outrel.r_addend = 0; if (indx == 0) - outrel.r_addend += relocation; + { + outrel.r_addend += relocation; + if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL)) + outrel.r_addend -= htab->tls_sec->vma; + } loc = htab->relgot->contents; loc += (htab->relgot->reloc_count++ * sizeof (Elf32_External_Rela)); @@ -4933,6 +4936,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, addend -= htab->tls_sec->vma + DTP_OFFSET; goto dodyn; + case R_PPC_DTPMOD32: + relocation = 1; + addend = 0; + goto dodyn; + case R_PPC_REL24: case R_PPC_REL32: case R_PPC_REL14: @@ -4959,7 +4967,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_ADDR14_BRNTAKEN: case R_PPC_UADDR32: case R_PPC_UADDR16: - case R_PPC_DTPMOD32: /* r_symndx will be zero only for relocs against symbols from removed linkonce sections, or sections discarded by a linker script. */ @@ -5332,8 +5339,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, 'sec' would be NULL, and we should leave the symbol alone (it will be set to zero elsewhere in the link). */ if (sec != NULL) - /* Add 0x10000 if sign bit in 0:15 is set. */ - addend += ((relocation + addend) & 0x8000) << 1; + /* Add 0x10000 if sign bit in 0:15 is set. + Bits 0:15 are not used. */ + addend += 0x8000; break; } |