public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ELF: Move tlsdesc_plt to elf_link_hash_table
@ 2020-06-06 23:48 H.J. Lu
  2020-06-07 13:56 ` [PATCH] ELF: Move tlsdesc_plt/tlsdesc_got " H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2020-06-06 23:48 UTC (permalink / raw)
  To: binutils

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;

in symbol hash entry.  Move tlsdesc_plt to struct elf_link_hash_entry
to reduce code duplication.

I'd like to check it into master if there are no objections.

H.J.
---
	* elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt.
	* elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt.
	(elf32_arm_size_dynamic_sections): Updated.
	(elf32_arm_finish_dynamic_sections): Likewise.
	(elf32_arm_output_arch_local_syms): Likewise.
	* elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
	(nds32_elf_finish_dynamic_sections): Likewise.
	* elf32-nds32.h (elf_nds32_link_hash_table): Remove
	dt_tlsdesc_plt.
	* elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated.
	* elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
	tlsdesc_plt.
	(elfNN_aarch64_allocate_dynrelocs): Updated.
	(elfNN_aarch64_size_dynamic_sections): Likewise.
	(elfNN_aarch64_finish_dynamic_sections): Likewise.
	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
	(_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.
---
 bfd/elf-bfd.h       |  6 ++++++
 bfd/elf32-arm.c     | 31 +++++++++++++------------------
 bfd/elf32-nds32.c   | 12 ++++++------
 bfd/elf32-nds32.h   |  6 ------
 bfd/elf64-x86-64.c  | 12 ++++++------
 bfd/elfnn-aarch64.c | 27 +++++++++++----------------
 bfd/elfxx-x86.c     | 14 +++++++-------
 bfd/elfxx-x86.h     |  6 ------
 8 files changed, 49 insertions(+), 65 deletions(-)

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 43f058173f..0da67a01f9 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -654,6 +654,12 @@ struct elf_link_hash_table
   asection *tls_sec;
   bfd_size_type tls_size;  /* Bytes.  */
 
+  /* 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;
+
   /* Target OS for linker output.  */
   enum elf_target_os target_os;
 
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index f2ac094acd..c3ce701d52 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -3380,12 +3380,6 @@ struct elf32_arm_link_hash_table
   /* The (unloaded but important) VxWorks .rela.plt.unloaded section.  */
   asection *srelplt2;
 
-  /* 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 dt_tlsdesc_plt;
-
   /* The offset into sgot of the GOT entry used by the PLT entry
      above.  */
   bfd_vma dt_tlsdesc_got;
@@ -16976,7 +16970,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
 	  htab->dt_tlsdesc_got = htab->root.sgot->size;
 	  htab->root.sgot->size += 4;
 
-	  htab->dt_tlsdesc_plt = htab->root.splt->size;
+	  htab->root.tlsdesc_plt = htab->root.splt->size;
 	  htab->root.splt->size += 4 * ARRAY_SIZE (dl_tlsdesc_lazy_trampoline);
 	}
     }
@@ -17077,7 +17071,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
 	      || !add_dynamic_entry (DT_JMPREL, 0))
 	    return FALSE;
 
-	  if (htab->dt_tlsdesc_plt
+	  if (htab->root.tlsdesc_plt
 	      && (!add_dynamic_entry (DT_TLSDESC_PLT,0)
 		  || !add_dynamic_entry (DT_TLSDESC_GOT,0)))
 	    return FALSE;
@@ -17462,7 +17456,7 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
 	    case DT_TLSDESC_PLT:
 	      s = htab->root.splt;
 	      dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset
-				+ htab->dt_tlsdesc_plt);
+				+ htab->root.tlsdesc_plt);
 	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
@@ -17580,7 +17574,7 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
       if (splt->output_section->owner == output_bfd)
 	elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
 
-      if (htab->dt_tlsdesc_plt)
+      if (htab->root.tlsdesc_plt)
 	{
 	  bfd_vma got_address
 	    = sgot->output_section->vma + sgot->output_offset;
@@ -17590,18 +17584,18 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
 	    = splt->output_section->vma + splt->output_offset;
 
 	  arm_put_trampoline (htab, output_bfd,
-			      splt->contents + htab->dt_tlsdesc_plt,
+			      splt->contents + htab->root.tlsdesc_plt,
 			      dl_tlsdesc_lazy_trampoline, 6);
 
 	  bfd_put_32 (output_bfd,
 		      gotplt_address + htab->dt_tlsdesc_got
-		      - (plt_address + htab->dt_tlsdesc_plt)
+		      - (plt_address + htab->root.tlsdesc_plt)
 		      - dl_tlsdesc_lazy_trampoline[6],
-		      splt->contents + htab->dt_tlsdesc_plt + 24);
+		      splt->contents + htab->root.tlsdesc_plt + 24);
 	  bfd_put_32 (output_bfd,
-		      got_address - (plt_address + htab->dt_tlsdesc_plt)
+		      got_address - (plt_address + htab->root.tlsdesc_plt)
 		      - dl_tlsdesc_lazy_trampoline[7],
-		      splt->contents + htab->dt_tlsdesc_plt + 24 + 4);
+		      splt->contents + htab->root.tlsdesc_plt + 24 + 4);
 	}
 
       if (htab->tls_trampoline)
@@ -18374,14 +18368,15 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
 	    }
 	}
     }
-  if (htab->dt_tlsdesc_plt != 0)
+  if (htab->root.tlsdesc_plt != 0)
     {
       /* Mapping symbols for the lazy tls trampoline.  */
-      if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, htab->dt_tlsdesc_plt))
+      if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM,
+				     htab->root.tlsdesc_plt))
 	return FALSE;
 
       if (!elf32_arm_output_map_sym (&osi, ARM_MAP_DATA,
-				     htab->dt_tlsdesc_plt + 24))
+				     htab->root.tlsdesc_plt + 24))
 	return FALSE;
     }
   if (htab->tls_trampoline != 0)
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 1d3a0f7526..4eb5a3ecf5 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -4396,7 +4396,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
      it's not incremented, so in order to compute the space reserved
      for them, it suffices to multiply the reloc count by the jump
      slot size.  */
-  if (htab->tls_desc_trampoline && htab->root.srelplt)
+  if (htab->root.tlsdesc_plt && htab->root.srelplt)
     htab->sgotplt_jump_table_size = elf32_nds32_compute_jump_table_size (htab);
 
   if (htab->tls_trampoline)
@@ -4410,7 +4410,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
 	  htab->dt_tlsdesc_got = htab->root.sgot->size;
 	  htab->root.sgot->size += 4;
 
-	  htab->dt_tlsdesc_plt = htab->root.splt->size;
+	  htab->root.tlsdesc_plt = htab->root.splt->size;
 	  htab->root.splt->size += 4 * ARRAY_SIZE (dl_tlsdesc_lazy_trampoline);
 	}
     }
@@ -4509,7 +4509,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
 
       if (htab->tls_desc_trampoline && plt)
 	{
-	  if (htab->dt_tlsdesc_plt
+	  if (htab->root.tlsdesc_plt
 	      && (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
 		  || !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
 	    return FALSE;
@@ -6435,7 +6435,7 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
 	    case DT_TLSDESC_PLT:
 	      s = htab->root.splt;
 	      dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset
-				+ htab->dt_tlsdesc_plt);
+				+ htab->root.tlsdesc_plt);
 	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
@@ -6505,7 +6505,7 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
 	    PLT_ENTRY_SIZE;
 	}
 
-      if (htab->dt_tlsdesc_plt)
+      if (htab->root.tlsdesc_plt)
 	{
 	  /* Calculate addresses.  */
 	  asection *sgot = sgot = ehtab->sgot;
@@ -6525,7 +6525,7 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
 	  dl_tlsdesc_lazy_trampoline[5] +=  0xfff & pltgot;
 
 	  /* Insert .plt.  */
-	  nds32_put_trampoline (splt->contents + htab->dt_tlsdesc_plt,
+	  nds32_put_trampoline (splt->contents + htab->root.tlsdesc_plt,
 				dl_tlsdesc_lazy_trampoline,
 				ARRAY_SIZE (dl_tlsdesc_lazy_trampoline));
 	}
diff --git a/bfd/elf32-nds32.h b/bfd/elf32-nds32.h
index 5f683664bf..d23820ab88 100644
--- a/bfd/elf32-nds32.h
+++ b/bfd/elf32-nds32.h
@@ -138,12 +138,6 @@ struct elf_nds32_link_hash_table
   /* Disable if linking a dynamically linked executable.  */
   int load_store_relax;
 
-  /* 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 dt_tlsdesc_plt;
-
   /* The offset into sgot of the GOT entry used by the PLT entry
      above.  */
   bfd_vma dt_tlsdesc_got;
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 6e6c3c38ea..a22b960ff5 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);
 
-	  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
@@ -4699,10 +4699,10 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
 		       + htab->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));
 	}
     }
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 3bbfa05104..2020c2edc2 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -2682,12 +2682,6 @@ struct elf_aarch64_link_hash_table
   /* JUMP_SLOT relocs for variant PCS symbols may be present.  */
   int variant_pcs;
 
-  /* 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 number of bytes in the PLT enty for the TLS descriptor.  */
   bfd_size_type tlsdesc_plt_entry_size;
 
@@ -8682,7 +8676,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 		     type.  */
 
 		  /* TLSDESC PLT is now needed, but not yet determined.  */
-		  htab->tlsdesc_plt = (bfd_vma) - 1;
+		  htab->root.tlsdesc_plt = (bfd_vma) - 1;
 		}
 
 	      if (got_type & GOT_TLS_GD)
@@ -8967,7 +8961,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
 		    {
 		      htab->root.srelplt->size += RELOC_SIZE (htab);
 		      /* Note RELOC_COUNT not incremented here! */
-		      htab->tlsdesc_plt = (bfd_vma) - 1;
+		      htab->root.tlsdesc_plt = (bfd_vma) - 1;
 		    }
 
 		  if (got_type & GOT_TLS_GD)
@@ -9010,7 +9004,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
   if (htab->root.srelplt)
     htab->sgotplt_jump_table_size = aarch64_compute_jump_table_size (htab);
 
-  if (htab->tlsdesc_plt)
+  if (htab->root.tlsdesc_plt)
     {
       if (htab->root.splt->size == 0)
 	htab->root.splt->size += htab->plt_header_size;
@@ -9019,7 +9013,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
 	 GOT and PLT entry required.  */
       if (!(info->flags & DF_BIND_NOW))
 	{
-	  htab->tlsdesc_plt = htab->root.splt->size;
+	  htab->root.tlsdesc_plt = htab->root.splt->size;
 	  htab->root.splt->size += htab->tlsdesc_plt_entry_size;
 
 	  htab->dt_tlsdesc_got = htab->root.sgot->size;
@@ -9128,7 +9122,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
 	      && !add_dynamic_entry (DT_AARCH64_VARIANT_PCS, 0))
 	    return FALSE;
 
-	  if (htab->tlsdesc_plt
+	  if (htab->root.tlsdesc_plt
 	      && !(info->flags & DF_BIND_NOW)
 	      && (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
 		  || !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
@@ -9638,7 +9632,7 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
 	    case DT_TLSDESC_PLT:
 	      s = htab->root.splt;
 	      dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
-		+ htab->tlsdesc_plt;
+		+ htab->root.tlsdesc_plt;
 	      break;
 
 	    case DT_TLSDESC_GOT:
@@ -9663,7 +9657,7 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
 	this_hdr.sh_entsize = htab->plt_entry_size;
 
 
-      if (htab->tlsdesc_plt && !(info->flags & DF_BIND_NOW))
+      if (htab->root.tlsdesc_plt && !(info->flags & DF_BIND_NOW))
 	{
 	  BFD_ASSERT (htab->dt_tlsdesc_got != (bfd_vma)-1);
 	  bfd_put_NN (output_bfd, (bfd_vma) 0,
@@ -9678,13 +9672,14 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
 	      entry = elfNN_aarch64_tlsdesc_small_plt_bti_entry;
 	    }
 
-	  memcpy (htab->root.splt->contents + htab->tlsdesc_plt,
+	  memcpy (htab->root.splt->contents + htab->root.tlsdesc_plt,
 		  entry, htab->tlsdesc_plt_entry_size);
 
 	  {
 	    bfd_vma adrp1_addr =
 	      htab->root.splt->output_section->vma
-	      + htab->root.splt->output_offset + htab->tlsdesc_plt + 4;
+	      + htab->root.splt->output_offset
+	      + htab->root.tlsdesc_plt + 4;
 
 	    bfd_vma adrp2_addr = adrp1_addr + 4;
 
@@ -9699,7 +9694,7 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
 	    bfd_vma dt_tlsdesc_got = got_addr + htab->dt_tlsdesc_got;
 
 	    bfd_byte *plt_entry =
-	      htab->root.splt->contents + htab->tlsdesc_plt;
+	      htab->root.splt->contents + htab->root.tlsdesc_plt;
 
 	   /* First instruction in BTI enabled PLT stub is a BTI
 	      instruction so skip it.  */
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index a189eb20e8..01b8cd2186 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -368,7 +368,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
@@ -1115,7 +1115,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;
 		    }
 		}
 	    }
@@ -1162,13 +1162,13 @@ _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;
@@ -1177,7 +1177,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd,
 	     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;
 	}
     }
@@ -1394,7 +1394,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;
@@ -1543,7 +1543,7 @@ _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:
diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
index 1d5a75744c..736ba2cf8e 100644
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -495,12 +495,6 @@ struct elf_x86_link_hash_table
      is only used for i386.  */
   bfd_vma next_tls_desc_index;
 
-  /* 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.  This is only used for x86-64.  */
-  bfd_vma tlsdesc_plt;
-
    /* Value used to fill the unused bytes of the first PLT entry.  This
       is only used for i386.  */
   bfd_byte plt0_pad_byte;
-- 
2.26.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] ELF: Move tlsdesc_plt/tlsdesc_got to elf_link_hash_table
  2020-06-06 23:48 [PATCH] ELF: Move tlsdesc_plt to elf_link_hash_table H.J. Lu
@ 2020-06-07 13:56 ` H.J. Lu
  2020-06-10  6:29   ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2020-06-07 13:56 UTC (permalink / raw)
  To: Binutils

[-- Attachment #1: Type: text/plain, Size: 2263 bytes --]

On Sat, Jun 6, 2020 at 4:48 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> 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;
>
> in symbol hash entry.  Move tlsdesc_plt to struct elf_link_hash_entry
> to reduce code duplication.
>
> I'd like to check it into master if there are no objections.
>
> H.J.
> ---
>         * elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt.
>         * elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt.
>         (elf32_arm_size_dynamic_sections): Updated.
>         (elf32_arm_finish_dynamic_sections): Likewise.
>         (elf32_arm_output_arch_local_syms): Likewise.
>         * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
>         (nds32_elf_finish_dynamic_sections): Likewise.
>         * elf32-nds32.h (elf_nds32_link_hash_table): Remove
>         dt_tlsdesc_plt.
>         * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated.
>         * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
>         tlsdesc_plt.
>         (elfNN_aarch64_allocate_dynrelocs): Updated.
>         (elfNN_aarch64_size_dynamic_sections): Likewise.
>         (elfNN_aarch64_finish_dynamic_sections): Likewise.
>         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
>         (_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.

tlsdesc_plt and tlsdesc_plt are together:

  /* 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;

Here is the updated patch to move them together.   I'd like to check it
into master if there are no objections.

-- 
H.J.

[-- Attachment #2: 0001-ELF-Move-tlsdesc_plt-tlsdesc_got-to-elf_link_hash_ta.patch --]
[-- Type: application/x-patch, Size: 21969 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ELF: Move tlsdesc_plt/tlsdesc_got to elf_link_hash_table
  2020-06-07 13:56 ` [PATCH] ELF: Move tlsdesc_plt/tlsdesc_got " H.J. Lu
@ 2020-06-10  6:29   ` Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2020-06-10  6:29 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils

On Sun, Jun 07, 2020 at 06:56:51AM -0700, H.J. Lu via Binutils wrote:
> tlsdesc_plt and tlsdesc_plt are together:
> 
>   /* 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;
> 
> Here is the updated patch to move them together.   I'd like to check it
> into master if there are no objections.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-10  6:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-06 23:48 [PATCH] ELF: Move tlsdesc_plt to elf_link_hash_table H.J. Lu
2020-06-07 13:56 ` [PATCH] ELF: Move tlsdesc_plt/tlsdesc_got " H.J. Lu
2020-06-10  6:29   ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).