• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión9bcc30e4178baac8307a52841ea9fef5cda8846d (tree)
Tiempo2020-06-08 20:30:56
AutorH.J. Lu <hjl.tools@gmai...>
CommiterH.J. Lu

Log Message

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
      1. Special values are 0, if not necessary (or not found
        to be necessary yet), and -1 if needed but not determined
      2. */
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.

Cambiar Resumen

Diferencia incremental

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,32 @@
1+2020-06-08 H.J. Lu <hongjiu.lu@intel.com>
2+
3+ * elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt and
4+ tlsdesc_got.
5+ * elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt
6+ and dt_tlsdesc_got.
7+ (elf32_arm_size_dynamic_sections): Updated. Clear
8+ root.tlsdesc_plt for DF_BIND_NOW.
9+ (elf32_arm_finish_dynamic_sections): Updated.
10+ (elf32_arm_output_arch_local_syms): Likewise.
11+ * elf32-nds32.c (nds32_elf_size_dynamic_sections): Updated.
12+ Clear root.tlsdesc_plt for DF_BIND_NOW.
13+ (nds32_elf_finish_dynamic_sections): Updated.
14+ * elf32-nds32.h (elf_nds32_link_hash_table): Remove
15+ dt_tlsdesc_plt and dt_tlsdesc_got.
16+ * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated.
17+ * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
18+ tlsdesc_plt and dt_tlsdesc_got.
19+ (elfNN_aarch64_allocate_dynrelocs): Updated.
20+ (elfNN_aarch64_finish_dynamic_sections): Likewise.
21+ (elfNN_aarch64_size_dynamic_sections): Updated. Clear
22+ root.tlsdesc_plt for DF_BIND_NOW. Don't check DF_BIND_NOW
23+ twice.
24+ * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
25+ (_bfd_x86_elf_size_dynamic_sections): Likewise.
26+ (_bfd_x86_elf_finish_dynamic_sections): Likewise.
27+ * elfxx-x86.h (elf_x86_link_hash_table): Remove tlsdesc_plt and
28+ tlsdesc_got.
29+
130 2020-06-07 H.J. Lu <hongjiu.lu@intel.com>
231
332 * elf32-tic6x.c (elf32_bed): Defined the default to
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -650,6 +650,17 @@ struct elf_link_hash_table
650650 asection *tls_sec;
651651 bfd_size_type tls_size; /* Bytes. */
652652
653+ /* The offset into splt of the PLT entry for the TLS descriptor
654+ resolver. Special values are 0, if not necessary (or not found
655+ to be necessary yet), and -1 if needed but not determined
656+ yet. */
657+ bfd_vma tlsdesc_plt;
658+
659+ /* The GOT offset for the lazy trampoline. Communicated to the
660+ loader via DT_TLSDESC_GOT. The magic value (bfd_vma) -1
661+ indicates an offset is not allocated. */
662+ bfd_vma tlsdesc_got;
663+
653664 /* Target OS for linker output. */
654665 enum elf_target_os target_os;
655666
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -3380,16 +3380,6 @@ struct elf32_arm_link_hash_table
33803380 /* The (unloaded but important) VxWorks .rela.plt.unloaded section. */
33813381 asection *srelplt2;
33823382
3383- /* The offset into splt of the PLT entry for the TLS descriptor
3384- resolver. Special values are 0, if not necessary (or not found
3385- to be necessary yet), and -1 if needed but not determined
3386- yet. */
3387- bfd_vma dt_tlsdesc_plt;
3388-
3389- /* The offset into sgot of the GOT entry used by the PLT entry
3390- above. */
3391- bfd_vma dt_tlsdesc_got;
3392-
33933383 /* Offset in .plt section of tls_arm_trampoline. */
33943384 bfd_vma tls_trampoline;
33953385
@@ -16971,12 +16961,14 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
1697116961
1697216962 /* If we're not using lazy TLS relocations, don't generate the
1697316963 PLT and GOT entries they require. */
16974- if (!(info->flags & DF_BIND_NOW))
16964+ if ((info->flags & DF_BIND_NOW))
16965+ htab->root.tlsdesc_plt = 0;
16966+ else
1697516967 {
16976- htab->dt_tlsdesc_got = htab->root.sgot->size;
16968+ htab->root.tlsdesc_got = htab->root.sgot->size;
1697716969 htab->root.sgot->size += 4;
1697816970
16979- htab->dt_tlsdesc_plt = htab->root.splt->size;
16971+ htab->root.tlsdesc_plt = htab->root.splt->size;
1698016972 htab->root.splt->size += 4 * ARRAY_SIZE (dl_tlsdesc_lazy_trampoline);
1698116973 }
1698216974 }
@@ -17077,7 +17069,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
1707717069 || !add_dynamic_entry (DT_JMPREL, 0))
1707817070 return FALSE;
1707917071
17080- if (htab->dt_tlsdesc_plt
17072+ if (htab->root.tlsdesc_plt
1708117073 && (!add_dynamic_entry (DT_TLSDESC_PLT,0)
1708217074 || !add_dynamic_entry (DT_TLSDESC_GOT,0)))
1708317075 return FALSE;
@@ -17462,14 +17454,14 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
1746217454 case DT_TLSDESC_PLT:
1746317455 s = htab->root.splt;
1746417456 dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset
17465- + htab->dt_tlsdesc_plt);
17457+ + htab->root.tlsdesc_plt);
1746617458 bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
1746717459 break;
1746817460
1746917461 case DT_TLSDESC_GOT:
1747017462 s = htab->root.sgot;
1747117463 dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset
17472- + htab->dt_tlsdesc_got);
17464+ + htab->root.tlsdesc_got);
1747317465 bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
1747417466 break;
1747517467
@@ -17580,7 +17572,7 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
1758017572 if (splt->output_section->owner == output_bfd)
1758117573 elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
1758217574
17583- if (htab->dt_tlsdesc_plt)
17575+ if (htab->root.tlsdesc_plt)
1758417576 {
1758517577 bfd_vma got_address
1758617578 = sgot->output_section->vma + sgot->output_offset;
@@ -17590,18 +17582,18 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
1759017582 = splt->output_section->vma + splt->output_offset;
1759117583
1759217584 arm_put_trampoline (htab, output_bfd,
17593- splt->contents + htab->dt_tlsdesc_plt,
17585+ splt->contents + htab->root.tlsdesc_plt,
1759417586 dl_tlsdesc_lazy_trampoline, 6);
1759517587
1759617588 bfd_put_32 (output_bfd,
17597- gotplt_address + htab->dt_tlsdesc_got
17598- - (plt_address + htab->dt_tlsdesc_plt)
17589+ gotplt_address + htab->root.tlsdesc_got
17590+ - (plt_address + htab->root.tlsdesc_plt)
1759917591 - dl_tlsdesc_lazy_trampoline[6],
17600- splt->contents + htab->dt_tlsdesc_plt + 24);
17592+ splt->contents + htab->root.tlsdesc_plt + 24);
1760117593 bfd_put_32 (output_bfd,
17602- got_address - (plt_address + htab->dt_tlsdesc_plt)
17594+ got_address - (plt_address + htab->root.tlsdesc_plt)
1760317595 - dl_tlsdesc_lazy_trampoline[7],
17604- splt->contents + htab->dt_tlsdesc_plt + 24 + 4);
17596+ splt->contents + htab->root.tlsdesc_plt + 24 + 4);
1760517597 }
1760617598
1760717599 if (htab->tls_trampoline)
@@ -18374,14 +18366,15 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
1837418366 }
1837518367 }
1837618368 }
18377- if (htab->dt_tlsdesc_plt != 0)
18369+ if (htab->root.tlsdesc_plt != 0)
1837818370 {
1837918371 /* Mapping symbols for the lazy tls trampoline. */
18380- if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, htab->dt_tlsdesc_plt))
18372+ if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM,
18373+ htab->root.tlsdesc_plt))
1838118374 return FALSE;
1838218375
1838318376 if (!elf32_arm_output_map_sym (&osi, ARM_MAP_DATA,
18384- htab->dt_tlsdesc_plt + 24))
18377+ htab->root.tlsdesc_plt + 24))
1838518378 return FALSE;
1838618379 }
1838718380 if (htab->tls_trampoline != 0)
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -4405,12 +4405,14 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
44054405
44064406 /* If we're not using lazy TLS relocations, don't generate the
44074407 PLT and GOT entries they require. */
4408- if (!(info->flags & DF_BIND_NOW))
4408+ if ((info->flags & DF_BIND_NOW))
4409+ htab->root.tlsdesc_plt = 0;
4410+ else
44094411 {
4410- htab->dt_tlsdesc_got = htab->root.sgot->size;
4412+ htab->root.tlsdesc_got = htab->root.sgot->size;
44114413 htab->root.sgot->size += 4;
44124414
4413- htab->dt_tlsdesc_plt = htab->root.splt->size;
4415+ htab->root.tlsdesc_plt = htab->root.splt->size;
44144416 htab->root.splt->size += 4 * ARRAY_SIZE (dl_tlsdesc_lazy_trampoline);
44154417 }
44164418 }
@@ -4509,7 +4511,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
45094511
45104512 if (htab->tls_desc_trampoline && plt)
45114513 {
4512- if (htab->dt_tlsdesc_plt
4514+ if (htab->root.tlsdesc_plt
45134515 && (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
45144516 || !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
45154517 return FALSE;
@@ -6435,14 +6437,14 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
64356437 case DT_TLSDESC_PLT:
64366438 s = htab->root.splt;
64376439 dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset
6438- + htab->dt_tlsdesc_plt);
6440+ + htab->root.tlsdesc_plt);
64396441 bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
64406442 break;
64416443
64426444 case DT_TLSDESC_GOT:
64436445 s = htab->root.sgot;
64446446 dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset
6445- + htab->dt_tlsdesc_got);
6447+ + htab->root.tlsdesc_got);
64466448 bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
64476449 break;
64486450 }
@@ -6505,14 +6507,14 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
65056507 PLT_ENTRY_SIZE;
65066508 }
65076509
6508- if (htab->dt_tlsdesc_plt)
6510+ if (htab->root.tlsdesc_plt)
65096511 {
65106512 /* Calculate addresses. */
65116513 asection *sgot = sgot = ehtab->sgot;
65126514 bfd_vma pltgot = sgotplt->output_section->vma
65136515 + sgotplt->output_offset;
65146516 bfd_vma tlsdesc_got = sgot->output_section->vma + sgot->output_offset
6515- + htab->dt_tlsdesc_got;
6517+ + htab->root.tlsdesc_got;
65166518
65176519 /* Get GP offset. */
65186520 pltgot -= elf_gp (output_bfd) - 4; /* PLTGOT[1] */
@@ -6525,7 +6527,7 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
65256527 dl_tlsdesc_lazy_trampoline[5] += 0xfff & pltgot;
65266528
65276529 /* Insert .plt. */
6528- nds32_put_trampoline (splt->contents + htab->dt_tlsdesc_plt,
6530+ nds32_put_trampoline (splt->contents + htab->root.tlsdesc_plt,
65296531 dl_tlsdesc_lazy_trampoline,
65306532 ARRAY_SIZE (dl_tlsdesc_lazy_trampoline));
65316533 }
--- a/bfd/elf32-nds32.h
+++ b/bfd/elf32-nds32.h
@@ -138,16 +138,6 @@ struct elf_nds32_link_hash_table
138138 /* Disable if linking a dynamically linked executable. */
139139 int load_store_relax;
140140
141- /* The offset into splt of the PLT entry for the TLS descriptor
142- resolver. Special values are 0, if not necessary (or not found
143- to be necessary yet), and -1 if needed but not determined
144- yet. */
145- bfd_vma dt_tlsdesc_plt;
146-
147- /* The offset into sgot of the GOT entry used by the PLT entry
148- above. */
149- bfd_vma dt_tlsdesc_got;
150-
151141 /* Offset in .plt section of tls_nds32_trampoline. */
152142 bfd_vma tls_trampoline;
153143
--- 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,
46674667 + htab->lazy_plt->plt0_got2_offset));
46684668 }
46694669
4670- if (htab->tlsdesc_plt)
4670+ if (htab->elf.tlsdesc_plt)
46714671 {
46724672 bfd_put_64 (output_bfd, (bfd_vma) 0,
4673- htab->elf.sgot->contents + htab->tlsdesc_got);
4673+ htab->elf.sgot->contents + htab->elf.tlsdesc_got);
46744674
4675- memcpy (htab->elf.splt->contents + htab->tlsdesc_plt,
4675+ memcpy (htab->elf.splt->contents + htab->elf.tlsdesc_plt,
46764676 htab->lazy_plt->plt_tlsdesc_entry,
46774677 htab->lazy_plt->plt_tlsdesc_entry_size);
46784678
@@ -4685,10 +4685,10 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
46854685 + 8
46864686 - htab->elf.splt->output_section->vma
46874687 - htab->elf.splt->output_offset
4688- - htab->tlsdesc_plt
4688+ - htab->elf.tlsdesc_plt
46894689 - htab->lazy_plt->plt_tlsdesc_got1_insn_end),
46904690 (htab->elf.splt->contents
4691- + htab->tlsdesc_plt
4691+ + htab->elf.tlsdesc_plt
46924692 + htab->lazy_plt->plt_tlsdesc_got1_offset));
46934693 /* Add offset for indirect branch via GOT+TDG, where TDG
46944694 stands for htab->tlsdesc_got, subtracting the offset
@@ -4696,13 +4696,13 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
46964696 bfd_put_32 (output_bfd,
46974697 (htab->elf.sgot->output_section->vma
46984698 + htab->elf.sgot->output_offset
4699- + htab->tlsdesc_got
4699+ + htab->elf.tlsdesc_got
47004700 - htab->elf.splt->output_section->vma
47014701 - htab->elf.splt->output_offset
4702- - htab->tlsdesc_plt
4702+ - htab->elf.tlsdesc_plt
47034703 - htab->lazy_plt->plt_tlsdesc_got2_insn_end),
47044704 (htab->elf.splt->contents
4705- + htab->tlsdesc_plt
4705+ + htab->elf.tlsdesc_plt
47064706 + htab->lazy_plt->plt_tlsdesc_got2_offset));
47074707 }
47084708 }
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -2682,20 +2682,9 @@ struct elf_aarch64_link_hash_table
26822682 /* JUMP_SLOT relocs for variant PCS symbols may be present. */
26832683 int variant_pcs;
26842684
2685- /* The offset into splt of the PLT entry for the TLS descriptor
2686- resolver. Special values are 0, if not necessary (or not found
2687- to be necessary yet), and -1 if needed but not determined
2688- yet. */
2689- bfd_vma tlsdesc_plt;
2690-
26912685 /* The number of bytes in the PLT enty for the TLS descriptor. */
26922686 bfd_size_type tlsdesc_plt_entry_size;
26932687
2694- /* The GOT offset for the lazy trampoline. Communicated to the
2695- loader via DT_TLSDESC_GOT. The magic value (bfd_vma) -1
2696- indicates an offset is not allocated. */
2697- bfd_vma dt_tlsdesc_got;
2698-
26992688 /* Used by local STT_GNU_IFUNC symbols. */
27002689 htab_t loc_hash_table;
27012690 void * loc_hash_memory;
@@ -2932,7 +2921,7 @@ elfNN_aarch64_link_hash_table_create (bfd *abfd)
29322921 ret->plt_entry = elfNN_aarch64_small_plt_entry;
29332922 ret->tlsdesc_plt_entry_size = PLT_TLSDESC_ENTRY_SIZE;
29342923 ret->obfd = abfd;
2935- ret->dt_tlsdesc_got = (bfd_vma) - 1;
2924+ ret->root.tlsdesc_got = (bfd_vma) - 1;
29362925
29372926 if (!bfd_hash_table_init (&ret->stub_hash_table, stub_hash_newfunc,
29382927 sizeof (struct elf_aarch64_stub_hash_entry)))
@@ -8682,7 +8671,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
86828671 type. */
86838672
86848673 /* TLSDESC PLT is now needed, but not yet determined. */
8685- htab->tlsdesc_plt = (bfd_vma) - 1;
8674+ htab->root.tlsdesc_plt = (bfd_vma) - 1;
86868675 }
86878676
86888677 if (got_type & GOT_TLS_GD)
@@ -8968,7 +8957,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
89688957 {
89698958 htab->root.srelplt->size += RELOC_SIZE (htab);
89708959 /* Note RELOC_COUNT not incremented here! */
8971- htab->tlsdesc_plt = (bfd_vma) - 1;
8960+ htab->root.tlsdesc_plt = (bfd_vma) - 1;
89728961 }
89738962
89748963 if (got_type & GOT_TLS_GD)
@@ -9011,19 +9000,21 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
90119000 if (htab->root.srelplt)
90129001 htab->sgotplt_jump_table_size = aarch64_compute_jump_table_size (htab);
90139002
9014- if (htab->tlsdesc_plt)
9003+ if (htab->root.tlsdesc_plt)
90159004 {
90169005 if (htab->root.splt->size == 0)
90179006 htab->root.splt->size += htab->plt_header_size;
90189007
90199008 /* If we're not using lazy TLS relocations, don't generate the
90209009 GOT and PLT entry required. */
9021- if (!(info->flags & DF_BIND_NOW))
9010+ if ((info->flags & DF_BIND_NOW))
9011+ htab->root.tlsdesc_plt = 0;
9012+ else
90229013 {
9023- htab->tlsdesc_plt = htab->root.splt->size;
9014+ htab->root.tlsdesc_plt = htab->root.splt->size;
90249015 htab->root.splt->size += htab->tlsdesc_plt_entry_size;
90259016
9026- htab->dt_tlsdesc_got = htab->root.sgot->size;
9017+ htab->root.tlsdesc_got = htab->root.sgot->size;
90279018 htab->root.sgot->size += GOT_ENTRY_SIZE;
90289019 }
90299020 }
@@ -9129,8 +9120,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
91299120 && !add_dynamic_entry (DT_AARCH64_VARIANT_PCS, 0))
91309121 return FALSE;
91319122
9132- if (htab->tlsdesc_plt
9133- && !(info->flags & DF_BIND_NOW)
9123+ if (htab->root.tlsdesc_plt
91349124 && (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
91359125 || !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
91369126 return FALSE;
@@ -9639,14 +9629,14 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
96399629 case DT_TLSDESC_PLT:
96409630 s = htab->root.splt;
96419631 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
9642- + htab->tlsdesc_plt;
9632+ + htab->root.tlsdesc_plt;
96439633 break;
96449634
96459635 case DT_TLSDESC_GOT:
96469636 s = htab->root.sgot;
9647- BFD_ASSERT (htab->dt_tlsdesc_got != (bfd_vma)-1);
9637+ BFD_ASSERT (htab->root.tlsdesc_got != (bfd_vma)-1);
96489638 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
9649- + htab->dt_tlsdesc_got;
9639+ + htab->root.tlsdesc_got;
96509640 break;
96519641 }
96529642
@@ -9664,11 +9654,11 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
96649654 this_hdr.sh_entsize = htab->plt_entry_size;
96659655
96669656
9667- if (htab->tlsdesc_plt && !(info->flags & DF_BIND_NOW))
9657+ if (htab->root.tlsdesc_plt && !(info->flags & DF_BIND_NOW))
96689658 {
9669- BFD_ASSERT (htab->dt_tlsdesc_got != (bfd_vma)-1);
9659+ BFD_ASSERT (htab->root.tlsdesc_got != (bfd_vma)-1);
96709660 bfd_put_NN (output_bfd, (bfd_vma) 0,
9671- htab->root.sgot->contents + htab->dt_tlsdesc_got);
9661+ htab->root.sgot->contents + htab->root.tlsdesc_got);
96729662
96739663 const bfd_byte *entry = elfNN_aarch64_tlsdesc_small_plt_entry;
96749664 htab->tlsdesc_plt_entry_size = PLT_TLSDESC_ENTRY_SIZE;
@@ -9679,13 +9669,14 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
96799669 entry = elfNN_aarch64_tlsdesc_small_plt_bti_entry;
96809670 }
96819671
9682- memcpy (htab->root.splt->contents + htab->tlsdesc_plt,
9672+ memcpy (htab->root.splt->contents + htab->root.tlsdesc_plt,
96839673 entry, htab->tlsdesc_plt_entry_size);
96849674
96859675 {
96869676 bfd_vma adrp1_addr =
96879677 htab->root.splt->output_section->vma
9688- + htab->root.splt->output_offset + htab->tlsdesc_plt + 4;
9678+ + htab->root.splt->output_offset
9679+ + htab->root.tlsdesc_plt + 4;
96899680
96909681 bfd_vma adrp2_addr = adrp1_addr + 4;
96919682
@@ -9697,10 +9688,10 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
96979688 htab->root.sgotplt->output_section->vma
96989689 + htab->root.sgotplt->output_offset;
96999690
9700- bfd_vma dt_tlsdesc_got = got_addr + htab->dt_tlsdesc_got;
9691+ bfd_vma dt_tlsdesc_got = got_addr + htab->root.tlsdesc_got;
97019692
97029693 bfd_byte *plt_entry =
9703- htab->root.splt->contents + htab->tlsdesc_plt;
9694+ htab->root.splt->contents + htab->root.tlsdesc_plt;
97049695
97059696 /* First instruction in BTI enabled PLT stub is a BTI
97069697 instruction so skip it. */
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -369,7 +369,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
369369 {
370370 htab->elf.srelplt->size += htab->sizeof_reloc;
371371 if (bed->target_id == X86_64_ELF_DATA)
372- htab->tlsdesc_plt = (bfd_vma) -1;
372+ htab->elf.tlsdesc_plt = (bfd_vma) -1;
373373 }
374374 }
375375 else
@@ -1116,7 +1116,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd,
11161116 {
11171117 htab->elf.srelplt->size += htab->sizeof_reloc;
11181118 if (bed->target_id == X86_64_ELF_DATA)
1119- htab->tlsdesc_plt = (bfd_vma) -1;
1119+ htab->elf.tlsdesc_plt = (bfd_vma) -1;
11201120 }
11211121 }
11221122 }
@@ -1163,22 +1163,22 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd,
11631163 else if (htab->elf.irelplt)
11641164 htab->next_irelative_index = htab->elf.irelplt->reloc_count - 1;
11651165
1166- if (htab->tlsdesc_plt)
1166+ if (htab->elf.tlsdesc_plt)
11671167 {
11681168 /* NB: tlsdesc_plt is set only for x86-64. If we're not using
11691169 lazy TLS relocations, don't generate the PLT and GOT entries
11701170 they require. */
11711171 if ((info->flags & DF_BIND_NOW))
1172- htab->tlsdesc_plt = 0;
1172+ htab->elf.tlsdesc_plt = 0;
11731173 else
11741174 {
1175- htab->tlsdesc_got = htab->elf.sgot->size;
1175+ htab->elf.tlsdesc_got = htab->elf.sgot->size;
11761176 htab->elf.sgot->size += htab->got_entry_size;
11771177 /* Reserve room for the initial entry.
11781178 FIXME: we could probably do away with it in this case. */
11791179 if (htab->elf.splt->size == 0)
11801180 htab->elf.splt->size = htab->plt.plt_entry_size;
1181- htab->tlsdesc_plt = htab->elf.splt->size;
1181+ htab->elf.tlsdesc_plt = htab->elf.splt->size;
11821182 htab->elf.splt->size += htab->plt.plt_entry_size;
11831183 }
11841184 }
@@ -1395,7 +1395,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd,
13951395 return FALSE;
13961396 }
13971397
1398- if (htab->tlsdesc_plt
1398+ if (htab->elf.tlsdesc_plt
13991399 && (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
14001400 || !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
14011401 return FALSE;
@@ -1544,13 +1544,13 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd,
15441544 case DT_TLSDESC_PLT:
15451545 s = htab->elf.splt;
15461546 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
1547- + htab->tlsdesc_plt;
1547+ + htab->elf.tlsdesc_plt;
15481548 break;
15491549
15501550 case DT_TLSDESC_GOT:
15511551 s = htab->elf.sgot;
15521552 dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
1553- + htab->tlsdesc_got;
1553+ + htab->elf.tlsdesc_got;
15541554 break;
15551555 }
15561556
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -478,10 +478,6 @@ struct elf_x86_link_hash_table
478478 htab_t loc_hash_table;
479479 void * loc_hash_memory;
480480
481- /* The offset into sgot of the GOT entry used by the PLT entry
482- above. */
483- bfd_vma tlsdesc_got;
484-
485481 /* The index of the next R_X86_64_JUMP_SLOT entry in .rela.plt. */
486482 bfd_vma next_jump_slot_index;
487483 /* The index of the next R_X86_64_IRELATIVE entry in .rela.plt. */
@@ -499,12 +495,6 @@ struct elf_x86_link_hash_table
499495 is only used for i386. */
500496 bfd_vma next_tls_desc_index;
501497
502- /* The offset into splt of the PLT entry for the TLS descriptor
503- resolver. Special values are 0, if not necessary (or not found
504- to be necessary yet), and -1 if needed but not determined
505- yet. This is only used for x86-64. */
506- bfd_vma tlsdesc_plt;
507-
508498 /* Value used to fill the unused bytes of the first PLT entry. This
509499 is only used for i386. */
510500 bfd_byte plt0_pad_byte;