aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-12-18 18:52:27 +1030
committerAlan Modra <amodra@gmail.com>2024-12-19 08:12:07 +1030
commitaa7a348b2fe0e851467e543653d9c2bf0314b8ca (patch)
tree3c9a06c0b6b2b1c9b61579e7c957de52d0258004
parentf92b077ee7d43b2b344e6942ffed6667c60ede0d (diff)
downloadgdb-aa7a348b2fe0e851467e543653d9c2bf0314b8ca.zip
gdb-aa7a348b2fe0e851467e543653d9c2bf0314b8ca.tar.gz
gdb-aa7a348b2fe0e851467e543653d9c2bf0314b8ca.tar.bz2
Remove bfd_elf_allocate_object object_id param
This is another case where the proper object_id can be read from elf_backend_data.
-rw-r--r--bfd/elf-bfd.h2
-rw-r--r--bfd/elf-m10300.c3
-rw-r--r--bfd/elf.c11
-rw-r--r--bfd/elf32-arm.c3
-rw-r--r--bfd/elf32-csky.c3
-rw-r--r--bfd/elf32-nds32.c3
-rw-r--r--bfd/elf32-or1k.c3
-rw-r--r--bfd/elf32-ppc.c3
-rw-r--r--bfd/elf32-s390.c3
-rw-r--r--bfd/elf32-sh.c3
-rw-r--r--bfd/elf32-tic6x.c3
-rw-r--r--bfd/elf32-tilepro.c3
-rw-r--r--bfd/elf32-xtensa.c3
-rw-r--r--bfd/elf64-alpha.c3
-rw-r--r--bfd/elf64-ia64-vms.c4
-rw-r--r--bfd/elf64-ppc.c3
-rw-r--r--bfd/elf64-s390.c3
-rw-r--r--bfd/elfnn-aarch64.c3
-rw-r--r--bfd/elfnn-kvx.c3
-rw-r--r--bfd/elfnn-loongarch.c3
-rw-r--r--bfd/elfnn-riscv.c3
-rw-r--r--bfd/elfxx-mips.c3
-rw-r--r--bfd/elfxx-sparc.c4
-rw-r--r--bfd/elfxx-x86.c4
24 files changed, 29 insertions, 53 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 3048d63..4ca9ad6 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 b412a0c..bed4429 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 318677d..7839431 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 74090d4..7751068 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 0bdb37f..30049b2 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 def09db..0909964 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 1680e42..d1a9d5a 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 9b62554..8b39672 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 565ce1f..3b08c14 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 18d803d..4e9367c 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 e8d04b0..a3dd3f0 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 eabb456..79bf6c7 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 607b64c..f078cbd 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 f1ec344..f3869af 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 5abea38..3e60a39 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 31f25d2..f2ae14f 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 db7ca27..c87be97 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 85f375a..bcec989 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 49e98e0..fa0b7d5 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 d07813c..995d67c 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 b120fc6..85c9c7d 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 f855763..b80375b 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 344d10d..63cb3b4 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 fb223a5..4c4ba07 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