Remove _bfd_elf_link_hash_table_init target_id param

Message ID Z2NDXmSwE4UdOCu_@squeak.grove.modra.org
State New
Headers
Series Remove _bfd_elf_link_hash_table_init target_id param |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Alan Modra Dec. 18, 2024, 9:49 p.m. UTC
  hash_table_id can be set from elf_backend_data, now that all targets
have matching ELF_TARGET_ID and hash_table_init target_id.
  

Patch

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 2f11bc2d2e6..3048d63954d 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2344,7 +2344,7 @@  extern bool _bfd_elf_link_hash_table_init
   (struct elf_link_hash_table *, bfd *,
    struct bfd_hash_entry *(*)
      (struct bfd_hash_entry *, struct bfd_hash_table *, const char *),
-   unsigned int, enum elf_target_id);
+   unsigned int);
 extern bool _bfd_elf_slurp_version_tables
   (bfd *, bool);
 extern bool _bfd_elf_merge_sections
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index aa387fc4130..b412a0c31fe 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -4618,8 +4618,7 @@  elf32_mn10300_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->static_hash_table->root, abfd,
 				      elf32_mn10300_link_hash_newfunc,
-				      sizeof (struct elf32_mn10300_link_hash_entry),
-				      MN10300_ELF_DATA))
+				      sizeof (struct elf32_mn10300_link_hash_entry)))
     {
       free (ret->static_hash_table);
       free (ret);
@@ -4630,8 +4629,7 @@  elf32_mn10300_link_hash_table_create (bfd *abfd)
   abfd->link.hash = NULL;
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      elf32_mn10300_link_hash_newfunc,
-				      sizeof (struct elf32_mn10300_link_hash_entry),
-				      MN10300_ELF_DATA))
+				      sizeof (struct elf32_mn10300_link_hash_entry)))
     {
       abfd->is_linker_output = true;
       abfd->link.hash = &ret->static_hash_table->root.root;
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index bd182996654..d151f047724 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -363,8 +363,7 @@  arc_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
 				      elf_arc_link_hash_newfunc,
-				      sizeof (struct elf_arc_link_hash_entry),
-				      ARC_ELF_DATA))
+				      sizeof (struct elf_arc_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index a4c23216c68..74090d4829c 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -4102,8 +4102,7 @@  elf32_arm_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (& ret->root, abfd,
 				      elf32_arm_link_hash_newfunc,
-				      sizeof (struct elf32_arm_link_hash_entry),
-				      ARM_ELF_DATA))
+				      sizeof (struct elf32_arm_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 12b68ba63f3..12c9c109711 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -877,8 +877,7 @@  elf32_avr_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&htab->etab, abfd,
 				      elf32_avr_link_hash_newfunc,
-				      sizeof (struct elf_link_hash_entry),
-				      AVR_ELF_DATA))
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (htab);
       return NULL;
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index f0e650d7e60..ba605e8afa0 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1742,8 +1742,7 @@  bfinfdpic_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
 				      _bfd_elf_link_hash_newfunc,
-				      sizeof (struct elf_link_hash_entry),
-				      BFIN_ELF_DATA))
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
@@ -4837,8 +4836,7 @@  bfin_link_hash_table_create (bfd * abfd)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (ret, abfd, bfin_link_hash_newfunc,
-				      sizeof (struct elf_link_hash_entry),
-				      BFIN_ELF_DATA))
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index f622fc708fb..26200e6bcfb 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -1617,8 +1617,7 @@  elf32_cr16_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (ret, abfd,
 				      elf32_cr16_link_hash_newfunc,
-				      sizeof (struct elf32_cr16_link_hash_entry),
-				      GENERIC_ELF_DATA))
+				      sizeof (struct elf32_cr16_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 8b10dae21b3..9e5caac08dc 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -898,8 +898,7 @@  elf_cris_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      elf_cris_link_hash_newfunc,
-				      sizeof (struct elf_cris_link_hash_entry),
-				      CRIS_ELF_DATA))
+				      sizeof (struct elf_cris_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 0911a3fd451..0bdb37ff4e6 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -1502,8 +1502,7 @@  csky_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
 				      csky_elf_link_hash_newfunc,
-				      sizeof (struct csky_elf_link_hash_entry),
-				      CSKY_ELF_DATA))
+				      sizeof (struct csky_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 718b7da8d68..d771213ae42 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -951,8 +951,7 @@  frvfdpic_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
 				      _bfd_elf_link_hash_newfunc,
-				      sizeof (struct elf_link_hash_entry),
-				      FRV_ELF_DATA))
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 4d004323e63..38f95695d5d 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -418,8 +418,7 @@  elf32_hppa_link_hash_table_create (bfd *abfd)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (&htab->etab, abfd, hppa_link_hash_newfunc,
-				      sizeof (struct elf32_hppa_link_hash_entry),
-				      HPPA32_ELF_DATA))
+				      sizeof (struct elf32_hppa_link_hash_entry)))
     {
       free (htab);
       return NULL;
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index e62e5fd1d46..d2dfa5b54f7 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -98,8 +98,7 @@  lm32_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      _bfd_elf_link_hash_newfunc,
-				      sizeof (struct elf_link_hash_entry),
-				      LM32_ELF_DATA))
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index a02645a8358..99f4b779c6b 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -1517,8 +1517,7 @@  m32r_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (ret, abfd,
 				      _bfd_elf_link_hash_newfunc,
-				      sizeof (struct elf_link_hash_entry),
-				      M32R_ELF_DATA))
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index 6ac21f496ba..87a3f828a70 100644
--- a/bfd/elf32-m68hc1x.c
+++ b/bfd/elf32-m68hc1x.c
@@ -84,8 +84,7 @@  m68hc11_elf_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      _bfd_elf_link_hash_newfunc,
-				      sizeof (struct elf_link_hash_entry),
-				      M68HC11_ELF_DATA))
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 6355ae92a3c..58583d627e5 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -977,8 +977,7 @@  elf_m68k_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      elf_m68k_link_hash_newfunc,
-				      sizeof (struct elf_m68k_link_hash_entry),
-				      M68K_ELF_DATA))
+				      sizeof (struct elf_m68k_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
index 2821be43c44..1141c7cc5d1 100644
--- a/bfd/elf32-metag.c
+++ b/bfd/elf32-metag.c
@@ -1022,8 +1022,7 @@  elf_metag_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&htab->etab, abfd,
 				      metag_link_hash_newfunc,
-				      sizeof (struct elf_metag_link_hash_entry),
-				      METAG_ELF_DATA))
+				      sizeof (struct elf_metag_link_hash_entry)))
     {
       free (htab);
       return NULL;
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index b500242c9cf..df1241426ae 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -857,8 +857,7 @@  microblaze_elf_link_hash_table_create (bfd *abfd)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
-				      sizeof (struct elf32_mb_link_hash_entry),
-				      MICROBLAZE_ELF_DATA))
+				      sizeof (struct elf32_mb_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index eb3e241acac..def09db7bbe 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -3738,8 +3738,7 @@  nds32_elf_link_hash_table_create (bfd *abfd)
   /* Patch tag.  */
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      nds32_elf_link_hash_newfunc,
-				      sizeof (struct elf_nds32_link_hash_entry),
-				      NDS32_ELF_DATA))
+				      sizeof (struct elf_nds32_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index f6c922016f7..1680e42d757 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -1028,8 +1028,7 @@  or1k_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      or1k_elf_link_hash_newfunc,
-				      sizeof (struct elf_or1k_link_hash_entry),
-				      OR1K_ELF_DATA))
+				      sizeof (struct elf_or1k_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 8c89ae1611f..9b625549a9c 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2279,8 +2279,7 @@  ppc_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
 				      ppc_elf_link_hash_newfunc,
-				      sizeof (struct ppc_elf_link_hash_entry),
-				      PPC32_ELF_DATA))
+				      sizeof (struct ppc_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-pru.c b/bfd/elf32-pru.c
index e76b483b526..e51e8b61069 100644
--- a/bfd/elf32-pru.c
+++ b/bfd/elf32-pru.c
@@ -1559,11 +1559,8 @@  pru_elf32_link_hash_table_create (bfd *abfd)
   if (ret == NULL)
     return NULL;
 
-  if (!_bfd_elf_link_hash_table_init (ret, abfd,
-				      link_hash_newfunc,
-				      sizeof (struct
-					      elf_link_hash_entry),
-				      PRU_ELF_DATA))
+  if (!_bfd_elf_link_hash_table_init (ret, abfd, link_hash_newfunc,
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 702b0239dd5..565ce1f4f88 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -804,8 +804,7 @@  elf_s390_link_hash_table_create (bfd *abfd)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
-				      sizeof (struct elf_s390_link_hash_entry),
-				      S390_ELF_DATA))
+				      sizeof (struct elf_s390_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index 76e8761cf90..34fc5dff7f1 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -4364,8 +4364,7 @@  elf32_score_link_hash_table_create (bfd *abfd)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (ret, abfd, score_elf_link_hash_newfunc,
-				      sizeof (struct score_elf_link_hash_entry),
-				      SCORE_ELF_DATA))
+				      sizeof (struct score_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index ecb46bb616f..18d803dcdda 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -2244,8 +2244,7 @@  sh_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      sh_elf_link_hash_newfunc,
-				      sizeof (struct elf_sh_link_hash_entry),
-				      SH_ELF_DATA))
+				      sizeof (struct elf_sh_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index f65a0081202..fbf5331130e 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -458,8 +458,7 @@  spu_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&htab->elf, abfd,
 				      _bfd_elf_link_hash_newfunc,
-				      sizeof (struct elf_link_hash_entry),
-				      SPU_ELF_DATA))
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (htab);
       return NULL;
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index dee75276d66..e8d04b0e35c 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -1563,8 +1563,7 @@  elf32_tic6x_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
 				      _bfd_elf_link_hash_newfunc,
-				      sizeof (struct elf_link_hash_entry),
-				      TIC6X_ELF_DATA))
+				      sizeof (struct elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c
index 0c187c07832..eabb45689b3 100644
--- a/bfd/elf32-tilepro.c
+++ b/bfd/elf32-tilepro.c
@@ -1184,8 +1184,7 @@  tilepro_elf_link_hash_table_create (bfd *abfd)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (ret, abfd, link_hash_newfunc,
-				      sizeof (struct tilepro_elf_link_hash_entry),
-				      TILEPRO_ELF_DATA))
+				      sizeof (struct tilepro_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 5107a4aa34e..5d534f8464f 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -476,8 +476,7 @@  elf_vax_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (ret, abfd,
 				      elf_vax_link_hash_newfunc,
-				      sizeof (struct elf_vax_link_hash_entry),
-				      GENERIC_ELF_DATA))
+				      sizeof (struct elf_vax_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 9682438f76a..607b64c3322 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -741,8 +741,7 @@  elf_xtensa_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
 				      elf_xtensa_link_hash_newfunc,
-				      sizeof (struct elf_xtensa_link_hash_entry),
-				      XTENSA_ELF_DATA))
+				      sizeof (struct elf_xtensa_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index a29913d9365..f1ec344151a 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -289,8 +289,7 @@  elf64_alpha_bfd_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      elf64_alpha_link_hash_newfunc,
-				      sizeof (struct alpha_elf_link_hash_entry),
-				      ALPHA_ELF_DATA))
+				      sizeof (struct alpha_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 2d08bf37155..f060cd05bd2 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -296,8 +296,7 @@  elf64_hppa_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&htab->root, abfd,
 				      hppa64_link_hash_newfunc,
-				      sizeof (struct elf64_hppa_link_hash_entry),
-				      HPPA64_ELF_DATA))
+				      sizeof (struct elf64_hppa_link_hash_entry)))
     {
       free (htab);
       return NULL;
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index ea778deeb2a..5abea382a95 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -1062,8 +1062,7 @@  elf64_ia64_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      elf64_ia64_new_elf_hash_entry,
-				      sizeof (struct elf64_ia64_link_hash_entry),
-				      IA64_ELF_DATA))
+				      sizeof (struct elf64_ia64_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index f9964fa93d0..31f25d2c6bc 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -3547,8 +3547,7 @@  ppc64_elf_link_hash_table_create (bfd *abfd)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc,
-				      sizeof (struct ppc_link_hash_entry),
-				      PPC64_ELF_DATA))
+				      sizeof (struct ppc_link_hash_entry)))
     {
       free (htab);
       return NULL;
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index f9d9902651b..db7ca270a28 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -723,8 +723,7 @@  elf_s390_link_hash_table_create (bfd *abfd)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
-				      sizeof (struct elf_s390_link_hash_entry),
-				      S390_ELF_DATA))
+				      sizeof (struct elf_s390_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 2b9e8b9ea30..34048ebb03f 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -8318,11 +8318,11 @@  _bfd_elf_link_hash_table_init
    struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
 				      struct bfd_hash_table *,
 				      const char *),
-   unsigned int entsize,
-   enum elf_target_id target_id)
+   unsigned int entsize)
 {
   bool ret;
-  int can_refcount = get_elf_backend_data (abfd)->can_refcount;
+  const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+  int can_refcount = bed->can_refcount;
 
   table->init_got_refcount.refcount = can_refcount - 1;
   table->init_plt_refcount.refcount = can_refcount - 1;
@@ -8334,8 +8334,8 @@  _bfd_elf_link_hash_table_init
   ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
 
   table->root.type = bfd_link_elf_hash_table;
-  table->hash_table_id = target_id;
-  table->target_os = get_elf_backend_data (abfd)->target_os;
+  table->hash_table_id = bed->target_id;
+  table->target_os = bed->target_os;
 
   return ret;
 }
@@ -8353,8 +8353,7 @@  _bfd_elf_link_hash_table_create (bfd *abfd)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc,
-				       sizeof (struct elf_link_hash_entry),
-				       get_elf_backend_data (abfd)->target_id))
+				       sizeof (struct elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 61aabcafa9a..85f375ac085 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -2916,7 +2916,7 @@  elfNN_aarch64_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init
       (&ret->root, abfd, elfNN_aarch64_link_hash_newfunc,
-       sizeof (struct elf_aarch64_link_hash_entry), AARCH64_ELF_DATA))
+       sizeof (struct elf_aarch64_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index 4dabaa792f6..4244e275eac 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -1460,8 +1460,7 @@  elfNN_ia64_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      elfNN_ia64_new_elf_hash_entry,
-				      sizeof (struct elfNN_ia64_link_hash_entry),
-				      IA64_ELF_DATA))
+				      sizeof (struct elfNN_ia64_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c
index e7028dcee5d..49e98e0ea86 100644
--- a/bfd/elfnn-kvx.c
+++ b/bfd/elfnn-kvx.c
@@ -641,7 +641,7 @@  elfNN_kvx_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init
       (&ret->root, abfd, elfNN_kvx_link_hash_newfunc,
-       sizeof (struct elf_kvx_link_hash_entry), KVX_ELF_DATA))
+       sizeof (struct elf_kvx_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index e3d39163d94..d07813c0c88 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -490,7 +490,7 @@  loongarch_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init
       (&ret->elf, abfd, link_hash_newfunc,
-       sizeof (struct loongarch_elf_link_hash_entry), LARCH_ELF_DATA))
+       sizeof (struct loongarch_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 8bbdd15d552..b120fc6070f 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -503,8 +503,7 @@  riscv_elf_link_hash_table_create (bfd *abfd)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
-				      sizeof (struct riscv_elf_link_hash_entry),
-				      RISCV_ELF_DATA))
+				      sizeof (struct riscv_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 459c98e23d7..f85576337d4 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -14444,8 +14444,7 @@  _bfd_mips_elf_link_hash_table_create (bfd *abfd)
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      mips_elf_link_hash_newfunc,
-				      sizeof (struct mips_elf_link_hash_entry),
-				      MIPS_ELF_DATA))
+				      sizeof (struct mips_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 3f642aefd63..344d10d4aec 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -1178,8 +1178,7 @@  _bfd_sparc_elf_link_hash_table_create (bfd *abfd)
     }
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
-				      sizeof (struct _bfd_sparc_elf_link_hash_entry),
-				      SPARC_ELF_DATA))
+				      sizeof (struct _bfd_sparc_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c
index c829792b253..31e9398018c 100644
--- a/bfd/elfxx-tilegx.c
+++ b/bfd/elfxx-tilegx.c
@@ -1399,8 +1399,7 @@  tilegx_elf_link_hash_table_create (bfd *abfd)
     }
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
-				      sizeof (struct tilegx_elf_link_hash_entry),
-				      TILEGX_ELF_DATA))
+				      sizeof (struct tilegx_elf_link_hash_entry)))
     {
       free (ret);
       return NULL;
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 0843803171b..fb223a5e921 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -720,23 +720,21 @@  struct bfd_link_hash_table *
 _bfd_x86_elf_link_hash_table_create (bfd *abfd)
 {
   struct elf_x86_link_hash_table *ret;
-  const struct elf_backend_data *bed;
   size_t amt = sizeof (struct elf_x86_link_hash_table);
 
   ret = (struct elf_x86_link_hash_table *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
-  bed = get_elf_backend_data (abfd);
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
 				      _bfd_x86_elf_link_hash_newfunc,
-				      sizeof (struct elf_x86_link_hash_entry),
-				      bed->target_id))
+				      sizeof (struct elf_x86_link_hash_entry)))
     {
       free (ret);
       return NULL;
     }
 
+  const struct elf_backend_data *bed = get_elf_backend_data (abfd);
   if (bed->target_id == X86_64_ELF_DATA)
     {
       ret->is_reloc_section = elf_x86_64_is_reloc_section;