diff options
author | Alan Modra <amodra@gmail.com> | 2003-11-04 06:16:39 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-11-04 06:16:39 +0000 |
commit | e1918d23874ba95c5fcdab4902a6d5e24c504f87 (patch) | |
tree | 3a1b472a12a89789caf6e3463bc1cfc6a73ba584 /bfd/elf32-ppc.c | |
parent | 4d100af478667041f27d8cd94fda566847e6f7c9 (diff) | |
download | gdb-e1918d23874ba95c5fcdab4902a6d5e24c504f87.zip gdb-e1918d23874ba95c5fcdab4902a6d5e24c504f87.tar.gz gdb-e1918d23874ba95c5fcdab4902a6d5e24c504f87.tar.bz2 |
* bfd-in.h (_bfd_elf_tls_setup): Declare.
* bfd-in2.h: Regenerate.
* elf-bfd.h (struct elf_link_tls_segment): Delete.
(struct elf_link_hash_table): Add tls_sec and tls_size.
* elf.c (_bfd_elf_link_hash_table_init): Init tls_sec and tls_size.
* elflink.c (_bfd_elf_tls_setup): New function.
* elflink.h (struct elf_final_link_info): Remove first_tls_sec.
(elf_bfd_final_link): Don't set first_tls_sec here. Update code
saving tls segment info, round segment size up.
(elf_link_output_extsym): Adjust code using tls segment info.
(elf_link_input_bfd): Likewise.
* elf32-i386.c (dtpoff_base, tpoff): Likewise.
* elf32-s390.c (dtpoff_base, tpoff): Likewise.
* elf32-sh.c (dtpoff_base, tpoff): Likewise.
* elf32-sparc.c (dtpoff_base, tpoff): Likewise.
* elf64-s390.c (dtpoff_base, tpoff): Likewise.
* elf64-x86-64.c (dtpoff_base, tpoff): Likewise.
* elfxx-ia64.c (elfNN_ia64_tprel_base): Likewise.
(elfNN_ia64_dtprel_base): Likewise.
* elf64-alpha.c (alpha_get_dtprel_base): Likewise.
(alpha_get_tprel_base): Likewise.
(struct alpha_relax_info): Remove tls_segment.
(elf64_alpha_relax_got_load): Adjust invocation of
alpha_get_dtprel_base and alpha_get_tprel_base.
(elf64_alpha_relax_tls_get_addr): Likewise.
(elf64_alpha_relax_section): Likewise.
(elf64_alpha_relocate_section): Likewise.
(elf64_alpha_relax_find_tls_segment): Delete.
* elf32-ppc.c (struct ppc_elf_link_hash_table): Remove tls_sec.
(ppc_elf_tls_setup): Call _bfd_elf_tls_setup. Return section.
(ppc_elf_relocate_section): Adjust to use elf.tls_sec.
* elf32-ppc.h (ppc_elf_tls_setup): Update.
* elf64-ppc.c (struct ppc_link_hash_table): Remove tls_sec.
(ppc64_elf_tls_setup): Call _bfd_elf_tls_setup. Return section.
(ppc64_elf_tls_optimize): Adjust to use elf.tls_sec.
(ppc64_elf_relocate_section): Likewise.
* elf64-ppc.h (ppc64_elf_tls_setup): Update.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Call
_bfd_elf_tls_setup.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r-- | bfd/elf32-ppc.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 85755bb..1b10e56 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -205,9 +205,6 @@ struct ppc_elf_link_hash_table elf_linker_section_t *sdata2; asection *sbss; - /* Short-cut to first output tls section. */ - asection *tls_sec; - /* Shortcut to .__tls_get_addr. */ struct elf_link_hash_entry *tls_get_addr; @@ -4184,25 +4181,18 @@ ppc_elf_gc_sweep_hook (bfd *abfd, return TRUE; } -/* Set htab->tls_sec and htab->tls_get_addr. */ +/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */ -bfd_boolean +asection * ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) { - asection *tls; struct ppc_elf_link_hash_table *htab; htab = ppc_elf_hash_table (info); htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr", FALSE, FALSE, TRUE); - for (tls = obfd->sections; tls != NULL; tls = tls->next) - if ((tls->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) - == (SEC_THREAD_LOCAL | SEC_LOAD)) - break; - htab->tls_sec = tls; - - return tls != NULL; + return _bfd_elf_tls_setup (obfd, info); } /* Run through all the TLS relocs looking for optimization @@ -4917,8 +4907,8 @@ ppc_elf_relocate_section (bfd *output_bfd, { /* Was an LD reloc. */ r_symndx = 0; - rel->r_addend = htab->tls_sec->vma + DTP_OFFSET; - rel[1].r_addend = htab->tls_sec->vma + DTP_OFFSET; + rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; + rel[1].r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; } r_type = R_PPC_TPREL16_HA; rel->r_info = ELF32_R_INFO (r_symndx, r_type); @@ -5156,7 +5146,7 @@ ppc_elf_relocate_section (bfd *output_bfd, { outrel.r_addend += relocation; if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL)) - outrel.r_addend -= htab->tls_sec->vma; + outrel.r_addend -= htab->elf.tls_sec->vma; } loc = htab->relgot->contents; loc += (htab->relgot->reloc_count++ @@ -5174,7 +5164,7 @@ ppc_elf_relocate_section (bfd *output_bfd, value = 1; else if (tls_ty != 0) { - value -= htab->tls_sec->vma + DTP_OFFSET; + value -= htab->elf.tls_sec->vma + DTP_OFFSET; if (tls_ty == (TLS_TLS | TLS_TPREL)) value += DTP_OFFSET - TP_OFFSET; @@ -5262,7 +5252,7 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_DTPREL16_LO: case R_PPC_DTPREL16_HI: case R_PPC_DTPREL16_HA: - addend -= htab->tls_sec->vma + DTP_OFFSET; + addend -= htab->elf.tls_sec->vma + DTP_OFFSET; break; /* Relocations that may need to be propagated if this is a shared @@ -5271,18 +5261,18 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_TPREL16_LO: case R_PPC_TPREL16_HI: case R_PPC_TPREL16_HA: - addend -= htab->tls_sec->vma + TP_OFFSET; + addend -= htab->elf.tls_sec->vma + TP_OFFSET; /* The TPREL16 relocs shouldn't really be used in shared libs as they will result in DT_TEXTREL being set, but support them anyway. */ goto dodyn; case R_PPC_TPREL32: - addend -= htab->tls_sec->vma + TP_OFFSET; + addend -= htab->elf.tls_sec->vma + TP_OFFSET; goto dodyn; case R_PPC_DTPREL32: - addend -= htab->tls_sec->vma + DTP_OFFSET; + addend -= htab->elf.tls_sec->vma + DTP_OFFSET; goto dodyn; case R_PPC_DTPMOD32: |