aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-x86.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/elfxx-x86.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/elfxx-x86.c')
-rw-r--r--bfd/elfxx-x86.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 6b8e56d..f020240 100644
--- 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)
{
htab->elf.srelplt->size += htab->sizeof_reloc;
if (bed->target_id == X86_64_ELF_DATA)
- htab->tlsdesc_plt = (bfd_vma) -1;
+ htab->elf.tlsdesc_plt = (bfd_vma) -1;
}
}
else
@@ -1116,7 +1116,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd,
{
htab->elf.srelplt->size += htab->sizeof_reloc;
if (bed->target_id == X86_64_ELF_DATA)
- htab->tlsdesc_plt = (bfd_vma) -1;
+ htab->elf.tlsdesc_plt = (bfd_vma) -1;
}
}
}
@@ -1163,22 +1163,22 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd,
else if (htab->elf.irelplt)
htab->next_irelative_index = htab->elf.irelplt->reloc_count - 1;
- if (htab->tlsdesc_plt)
+ if (htab->elf.tlsdesc_plt)
{
/* NB: tlsdesc_plt is set only for x86-64. If we're not using
lazy TLS relocations, don't generate the PLT and GOT entries
they require. */
if ((info->flags & DF_BIND_NOW))
- htab->tlsdesc_plt = 0;
+ htab->elf.tlsdesc_plt = 0;
else
{
- htab->tlsdesc_got = htab->elf.sgot->size;
+ htab->elf.tlsdesc_got = htab->elf.sgot->size;
htab->elf.sgot->size += htab->got_entry_size;
/* Reserve room for the initial entry.
FIXME: we could probably do away with it in this case. */
if (htab->elf.splt->size == 0)
htab->elf.splt->size = htab->plt.plt_entry_size;
- htab->tlsdesc_plt = htab->elf.splt->size;
+ htab->elf.tlsdesc_plt = htab->elf.splt->size;
htab->elf.splt->size += htab->plt.plt_entry_size;
}
}
@@ -1395,7 +1395,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd,
return FALSE;
}
- if (htab->tlsdesc_plt
+ if (htab->elf.tlsdesc_plt
&& (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
|| !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
return FALSE;
@@ -1544,13 +1544,13 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd,
case DT_TLSDESC_PLT:
s = htab->elf.splt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
- + htab->tlsdesc_plt;
+ + htab->elf.tlsdesc_plt;
break;
case DT_TLSDESC_GOT:
s = htab->elf.sgot;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
- + htab->tlsdesc_got;
+ + htab->elf.tlsdesc_got;
break;
}