ELF: Move tlsdesc_plt/tlsdesc_got to elf_link_hash_table
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 8 Jun 2020 11:24:04 +0000 (04:24 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 8 Jun 2020 11:30:56 +0000 (04:30 -0700)
commit9bcc30e4178baac8307a52841ea9fef5cda8846d
treeb55be2375cd10a5b9a55f5000458b730b8a3bed6
parentb37a7714400cdc264ed236f72668b8956477b2ed
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.
bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf32-arm.c
bfd/elf32-nds32.c
bfd/elf32-nds32.h
bfd/elf64-x86-64.c
bfd/elfnn-aarch64.c
bfd/elfxx-x86.c
bfd/elfxx-x86.h