]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove bfd_elf_allocate_object object_id param
authorAlan Modra <amodra@gmail.com>
Wed, 18 Dec 2024 08:22:27 +0000 (18:52 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 18 Dec 2024 21:42:07 +0000 (08:12 +1030)
This is another case where the proper object_id can be read from
elf_backend_data.

24 files changed:
bfd/elf-bfd.h
bfd/elf-m10300.c
bfd/elf.c
bfd/elf32-arm.c
bfd/elf32-csky.c
bfd/elf32-nds32.c
bfd/elf32-or1k.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-tic6x.c
bfd/elf32-tilepro.c
bfd/elf32-xtensa.c
bfd/elf64-alpha.c
bfd/elf64-ia64-vms.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elfnn-aarch64.c
bfd/elfnn-kvx.c
bfd/elfnn-loongarch.c
bfd/elfnn-riscv.c
bfd/elfxx-mips.c
bfd/elfxx-sparc.c
bfd/elfxx-x86.c

index 3048d63954d6749f8226d1c1a5c00e3ba38f5b0b..4ca9ad6577c4923d761360894a9008b4d476e0e3 100644 (file)
@@ -2316,7 +2316,7 @@ extern unsigned long bfd_elf_gnu_hash
 extern bfd_reloc_status_type bfd_elf_generic_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 extern bool bfd_elf_allocate_object
-  (bfd *, size_t, enum elf_target_id);
+  (bfd *, size_t);
 extern bool bfd_elf_make_object
   (bfd *);
 extern bool bfd_elf_mkcorefile
index b412a0c31fef4d5faa9e5311efc3d6d1e1726c79..bed44294528e9d39813d57b356c1d394615317be 100644 (file)
@@ -5464,8 +5464,7 @@ _bfd_mn10300_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UN
 static bool
 mn10300_elf_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_mn10300_obj_tdata),
-                                 MN10300_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_mn10300_obj_tdata));
 }
 
 #define bfd_elf32_mkobject     mn10300_elf_mkobject
index 318677df32aa67fc54008dc53a7e3140a7445b21..78394319bf0075f1dcf659830f749420048d2383 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -222,18 +222,17 @@ bfd_elf_gnu_hash (const char *namearg)
 }
 
 /* Create a tdata field OBJECT_SIZE bytes in length, zeroed out and with
-   the object_id field of an elf_obj_tdata field set to OBJECT_ID.  */
+   the object_id field of an elf_obj_tdata field set.  */
 bool
 bfd_elf_allocate_object (bfd *abfd,
-                        size_t object_size,
-                        enum elf_target_id object_id)
+                        size_t object_size)
 {
   BFD_ASSERT (object_size >= sizeof (struct elf_obj_tdata));
   abfd->tdata.any = bfd_zalloc (abfd, object_size);
   if (abfd->tdata.any == NULL)
     return false;
 
-  elf_object_id (abfd) = object_id;
+  elf_object_id (abfd) = get_elf_backend_data (abfd)->target_id;
   if (abfd->direction != read_direction)
     {
       struct output_elf_obj_tdata *o = bfd_zalloc (abfd, sizeof *o);
@@ -249,9 +248,7 @@ bfd_elf_allocate_object (bfd *abfd,
 bool
 bfd_elf_make_object (bfd *abfd)
 {
-  const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata),
-                                 bed->target_id);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata));
 }
 
 bool
index 74090d4829c0baedf12ee56e1b09b9faa08b49d5..77510687150a425e8d2590621bb607c0a5e239a1 100644 (file)
@@ -3207,8 +3207,7 @@ struct elf_arm_obj_tdata
 static bool
 elf32_arm_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_arm_obj_tdata),
-                                 ARM_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_arm_obj_tdata));
 }
 
 #define elf32_arm_hash_entry(ent) ((struct elf32_arm_link_hash_entry *)(ent))
index 0bdb37ff4e615c14582523c26e05035f46a96455..30049b2f05d9d5bb97882f0bf52655baf221034f 100644 (file)
@@ -1521,8 +1521,7 @@ csky_elf_link_hash_table_create (bfd *abfd)
 static bool
 csky_elf_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct csky_elf_obj_tdata),
-                                 CSKY_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct csky_elf_obj_tdata));
 }
 
 /* Adjust a symbol defined by a dynamic object and referenced by a
index def09db7bbe829038605245ff70a0c3c667a8f37..0909964970807b508d59628e8ce0f53a7ec5f157 100644 (file)
@@ -256,8 +256,7 @@ struct elf_nds32_obj_tdata
 static bool
 nds32_elf_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_nds32_obj_tdata),
-                                 NDS32_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_nds32_obj_tdata));
 }
 
 /* Relocations used for relocation.  */
index 1680e42d7575863024cd4f64d114eaed0d41a67c..d1a9d5ad712e280e51c77f9662e1391f7c46a17d 100644 (file)
@@ -977,8 +977,7 @@ elf_or1k_plt_entry_size (bfd_vma plt_index)
 static bool
 elf_or1k_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_or1k_obj_tdata),
-                                 OR1K_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_or1k_obj_tdata));
 }
 
 /* Create an entry in an or1k ELF linker hash table.  */
index 9b625549a9c6af7c2375cc1eb476e9b33ff7bb87..8b396729b7b321f8efe50a3bc2efe72ef5d8bacc 100644 (file)
@@ -1052,8 +1052,7 @@ struct ppc_elf_obj_tdata
 static bool
 ppc_elf_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct ppc_elf_obj_tdata),
-                                 PPC32_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct ppc_elf_obj_tdata));
 }
 
 /* When defaulting arch/mach, decode apuinfo to find a better match.  */
index 565ce1f4f88f0d15e6dc5a89129b5511c6a7e515..3b08c14c17b4ea005bf88e953a709983b6184ee7 100644 (file)
@@ -721,8 +721,7 @@ struct elf_s390_obj_tdata
 static bool
 elf_s390_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_s390_obj_tdata),
-                                 S390_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_s390_obj_tdata));
 }
 
 static bool
index 18d803dcddad2a06ea7526dbceeaa1cc73377e88..4e9367cf86fae6a1fca3e7605d150b214468990b 100644 (file)
@@ -2149,8 +2149,7 @@ struct sh_elf_obj_tdata
 static bool
 sh_elf_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct sh_elf_obj_tdata),
-                                 SH_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct sh_elf_obj_tdata));
 }
 
 /* sh ELF linker hash table.  */
index e8d04b0e35ca88c661db6c3d8153f5c70b176569..a3dd3f0df4de7f80304918ef4ef9943b11cd5f6a 100644 (file)
@@ -1655,8 +1655,7 @@ elf32_tic6x_mkobject (bfd *abfd)
 {
   bool ret;
 
-  ret = bfd_elf_allocate_object (abfd, sizeof (struct elf32_tic6x_obj_tdata),
-                                TIC6X_ELF_DATA);
+  ret = bfd_elf_allocate_object (abfd, sizeof (struct elf32_tic6x_obj_tdata));
   if (ret)
     elf32_tic6x_set_use_rela_p (abfd, true);
   return ret;
index eabb45689b3a0e6b338e85b6c0e3a5ff7eb745ab..79bf6c79c3ff957bb4918fc2ac2495bf0d83c291 100644 (file)
@@ -720,8 +720,7 @@ static bool
 tilepro_elf_mkobject (bfd *abfd)
 {
   return bfd_elf_allocate_object (abfd,
-                                 sizeof (struct _bfd_tilepro_elf_obj_tdata),
-                                 TILEPRO_ELF_DATA);
+                                 sizeof (struct _bfd_tilepro_elf_obj_tdata));
 }
 
 #include "elf/common.h"
index 607b64c332207d9d2fba05732e5074984d6398f7..f078cbde7146675fd2ed82eb5102ae2596c20775 100644 (file)
@@ -665,8 +665,7 @@ struct elf_xtensa_obj_tdata
 static bool
 elf_xtensa_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_xtensa_obj_tdata),
-                                 XTENSA_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_xtensa_obj_tdata));
 }
 
 /* Xtensa ELF linker hash table.  */
index f1ec344151a71d9c9bb8fae6038a0182efcea2db..f3869af3e8f18d0a4d67a64aff7b9ab767890462 100644 (file)
@@ -353,8 +353,7 @@ struct alpha_elf_obj_tdata
 static bool
 elf64_alpha_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct alpha_elf_obj_tdata),
-                                 ALPHA_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct alpha_elf_obj_tdata));
 }
 
 static bool
index 5abea382a9552f785902f4c874460f47f524b82f..3e60a392b4203b12e06198eb04827d1e248e6286 100644 (file)
@@ -5412,8 +5412,8 @@ elf64_vms_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
 static bool
 elf64_ia64_vms_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object
-    (abfd, sizeof (struct elf64_ia64_vms_obj_tdata), IA64_ELF_DATA);
+  return bfd_elf_allocate_object (abfd,
+                                 sizeof (struct elf64_ia64_vms_obj_tdata));
 }
 
 
index 31f25d2c6bcdfb82284c067d41a478ab1e71db02..f2ae14fb1f0272db766caf570a509856f1ffc77b 100644 (file)
@@ -1843,8 +1843,7 @@ struct ppc64_elf_obj_tdata
 static bool
 ppc64_elf_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct ppc64_elf_obj_tdata),
-                                 PPC64_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct ppc64_elf_obj_tdata));
 }
 
 /* Fix bad default arch selected for a 64 bit input bfd when the
index db7ca270a2896c085a5c80a840d068855d3de87c..c87be975e6c03faadbc492da290e61cf16bc1e3d 100644 (file)
@@ -638,8 +638,7 @@ struct elf_s390_obj_tdata
 static bool
 elf_s390_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_s390_obj_tdata),
-                                 S390_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_s390_obj_tdata));
 }
 
 static bool
index 85f375ac08534b3fad8926f9923ebf980170ae27..bcec989711043dcca50622255136744b709337d1 100644 (file)
@@ -2536,8 +2536,7 @@ struct elf_aarch64_local_symbol
 static bool
 elfNN_aarch64_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_aarch64_obj_tdata),
-                                 AARCH64_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_aarch64_obj_tdata));
 }
 
 #define elf_aarch64_hash_entry(ent) \
index 49e98e0ea86d1ae6b51b9fabcc66eb9bf0c20466..fa0b7d55824e7d6cba0efaea5ffcac62148101ac 100644 (file)
@@ -421,8 +421,7 @@ struct elf_kvx_obj_tdata
 static bool
 elfNN_kvx_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct elf_kvx_obj_tdata),
-                                 KVX_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_kvx_obj_tdata));
 }
 
 #define elf_kvx_hash_entry(ent) \
index d07813c0c885ac89e158aed6d88b0d3abef4e1c3..995d67c0b781816006d094652278ecb67e100fba 100644 (file)
@@ -88,8 +88,7 @@ static bool
 elfNN_loongarch_object (bfd *abfd)
 {
   return bfd_elf_allocate_object (abfd,
-                                 sizeof (struct _bfd_loongarch_elf_obj_tdata),
-                                 LARCH_ELF_DATA);
+                                 sizeof (struct _bfd_loongarch_elf_obj_tdata));
 }
 
 struct relr_entry
index b120fc6070f9265d9d933418c66f5d8166fc7b79..85c9c7deb50240649b0ba72ad5aa3747cd60b522 100644 (file)
@@ -197,8 +197,7 @@ static bool
 elfNN_riscv_mkobject (bfd *abfd)
 {
   return bfd_elf_allocate_object (abfd,
-                                 sizeof (struct _bfd_riscv_elf_obj_tdata),
-                                 RISCV_ELF_DATA);
+                                 sizeof (struct _bfd_riscv_elf_obj_tdata));
 }
 
 #include "elf/common.h"
index f85576337d4cb2706ce49f41acd12b157c5c3062..b80375baab79082dba332c4b0b6fb6687696e653 100644 (file)
@@ -1374,8 +1374,7 @@ mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
 bool
 _bfd_mips_elf_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct mips_elf_obj_tdata),
-                                 MIPS_ELF_DATA);
+  return bfd_elf_allocate_object (abfd, sizeof (struct mips_elf_obj_tdata));
 }
 
 /* MIPS ELF uses a special find_nearest_line routine in order the
index 344d10d4aeccd04475c38904e5e56b2c413b9d3d..63cb3b4ec9d9cb25493345d60b40cd15f06ab4c0 100644 (file)
@@ -734,8 +734,8 @@ struct _bfd_sparc_elf_obj_tdata
 bool
 _bfd_sparc_elf_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd, sizeof (struct _bfd_sparc_elf_obj_tdata),
-                                 SPARC_ELF_DATA);
+  return bfd_elf_allocate_object (abfd,
+                                 sizeof (struct _bfd_sparc_elf_obj_tdata));
 }
 
 static void
index fb223a5e9213c7ce8eefed480d0362e6f690c1db..4c4ba07c01d475f2dbb17bab72d1e0578cec768a 100644 (file)
@@ -32,9 +32,7 @@
 bool
 _bfd_x86_elf_mkobject (bfd *abfd)
 {
-  return bfd_elf_allocate_object (abfd,
-                                 sizeof (struct elf_x86_obj_tdata),
-                                 get_elf_backend_data (abfd)->target_id);
+  return bfd_elf_allocate_object (abfd, sizeof (struct elf_x86_obj_tdata));
 }
 
 /* _TLS_MODULE_BASE_ needs to be treated especially when linking