aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-06-08 04:24:04 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-06-08 04:30:56 -0700
commit9bcc30e4178baac8307a52841ea9fef5cda8846d (patch)
treeb55be2375cd10a5b9a55f5000458b730b8a3bed6 /bfd/elf64-x86-64.c
parentb37a7714400cdc264ed236f72668b8956477b2ed (diff)
downloadgdb-9bcc30e4178baac8307a52841ea9fef5cda8846d.zip
gdb-9bcc30e4178baac8307a52841ea9fef5cda8846d.tar.gz
gdb-9bcc30e4178baac8307a52841ea9fef5cda8846d.tar.bz2
ELF: Move tlsdesc_plt/tlsdesc_got to elf_link_hash_table
All ELF backends with TLS descriptor support have /* The offset into splt of the PLT entry for the TLS descriptor resolver. Special values are 0, if not necessary (or not found to be necessary yet), and -1 if needed but not determined yet. */ bfd_vma tlsdesc_plt; /* The GOT offset for the lazy trampoline. Communicated to the loader via DT_TLSDESC_GOT. The magic value (bfd_vma) -1 indicates an offset is not allocated. */ bfd_vma tlsdesc_got; in symbol hash entry. Move tlsdesc_plt/tlsdesc_got to elf_link_hash_entry to reduce code duplication. * elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt and tlsdesc_got. * elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt and dt_tlsdesc_got. (elf32_arm_size_dynamic_sections): Updated. Clear root.tlsdesc_plt for DF_BIND_NOW. (elf32_arm_finish_dynamic_sections): Updated. (elf32_arm_output_arch_local_syms): Likewise. * elf32-nds32.c (nds32_elf_size_dynamic_sections): Updated. Clear root.tlsdesc_plt for DF_BIND_NOW. (nds32_elf_finish_dynamic_sections): Updated. * elf32-nds32.h (elf_nds32_link_hash_table): Remove dt_tlsdesc_plt and dt_tlsdesc_got. * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated. * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove tlsdesc_plt and dt_tlsdesc_got. (elfNN_aarch64_allocate_dynrelocs): Updated. (elfNN_aarch64_finish_dynamic_sections): Likewise. (elfNN_aarch64_size_dynamic_sections): Updated. Clear root.tlsdesc_plt for DF_BIND_NOW. Don't check DF_BIND_NOW twice. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated. (_bfd_x86_elf_size_dynamic_sections): Likewise. (_bfd_x86_elf_finish_dynamic_sections): Likewise. * elfxx-x86.h (elf_x86_link_hash_table): Remove tlsdesc_plt and tlsdesc_got.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 6e6c3c3..8562f33 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -4667,12 +4667,12 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
+ htab->lazy_plt->plt0_got2_offset));
}
- if (htab->tlsdesc_plt)
+ if (htab->elf.tlsdesc_plt)
{
bfd_put_64 (output_bfd, (bfd_vma) 0,
- htab->elf.sgot->contents + htab->tlsdesc_got);
+ htab->elf.sgot->contents + htab->elf.tlsdesc_got);
- memcpy (htab->elf.splt->contents + htab->tlsdesc_plt,
+ memcpy (htab->elf.splt->contents + htab->elf.tlsdesc_plt,
htab->lazy_plt->plt_tlsdesc_entry,
htab->lazy_plt->plt_tlsdesc_entry_size);
@@ -4685,10 +4685,10 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
+ 8
- htab->elf.splt->output_section->vma
- htab->elf.splt->output_offset
- - htab->tlsdesc_plt
+ - htab->elf.tlsdesc_plt
- htab->lazy_plt->plt_tlsdesc_got1_insn_end),
(htab->elf.splt->contents
- + htab->tlsdesc_plt
+ + htab->elf.tlsdesc_plt
+ htab->lazy_plt->plt_tlsdesc_got1_offset));
/* Add offset for indirect branch via GOT+TDG, where TDG
stands for htab->tlsdesc_got, subtracting the offset
@@ -4696,13 +4696,13 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
bfd_put_32 (output_bfd,
(htab->elf.sgot->output_section->vma
+ htab->elf.sgot->output_offset
- + htab->tlsdesc_got
+ + htab->elf.tlsdesc_got
- htab->elf.splt->output_section->vma
- htab->elf.splt->output_offset
- - htab->tlsdesc_plt
+ - htab->elf.tlsdesc_plt
- htab->lazy_plt->plt_tlsdesc_got2_insn_end),
(htab->elf.splt->contents
- + htab->tlsdesc_plt
+ + htab->elf.tlsdesc_plt
+ htab->lazy_plt->plt_tlsdesc_got2_offset));
}
}