From: Alan Modra Date: Wed, 18 Dec 2024 08:22:27 +0000 (+1030) Subject: Remove bfd_elf_allocate_object object_id param X-Git-Tag: gdb-16-branchpoint~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa7a348b2fe0e851467e543653d9c2bf0314b8ca;p=thirdparty%2Fbinutils-gdb.git Remove bfd_elf_allocate_object object_id param This is another case where the proper object_id can be read from elf_backend_data. --- diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 3048d63954d..4ca9ad6577c 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -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 diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index b412a0c31fe..bed44294528 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -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 diff --git a/bfd/elf.c b/bfd/elf.c index 318677df32a..78394319bf0 100644 --- 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 diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 74090d4829c..77510687150 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -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)) diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index 0bdb37ff4e6..30049b2f05d 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -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 diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index def09db7bbe..09099649708 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -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. */ diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index 1680e42d757..d1a9d5ad712 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -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. */ diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 9b625549a9c..8b396729b7b 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -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. */ diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 565ce1f4f88..3b08c14c17b 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -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 diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 18d803dcdda..4e9367cf86f 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -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. */ diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index e8d04b0e35c..a3dd3f0df4d 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -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; diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index eabb45689b3..79bf6c79c3f 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -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" diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 607b64c3322..f078cbde714 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -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. */ diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index f1ec344151a..f3869af3e8f 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -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 diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index 5abea382a95..3e60a392b42 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -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)); } diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 31f25d2c6bc..f2ae14fb1f0 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -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 diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index db7ca270a28..c87be975e6c 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -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 diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 85f375ac085..bcec9897110 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -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) \ diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c index 49e98e0ea86..fa0b7d55824 100644 --- a/bfd/elfnn-kvx.c +++ b/bfd/elfnn-kvx.c @@ -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) \ diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index d07813c0c88..995d67c0b78 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -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 diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index b120fc6070f..85c9c7deb50 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -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" diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index f85576337d4..b80375baab7 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -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 diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 344d10d4aec..63cb3b4ec9d 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -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 diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index fb223a5e921..4c4ba07c01d 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -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