score and mmix target_id
Alan Modra
amodra@gmail.com
Tue Dec 17 03:58:47 GMT 2024
On Mon, Dec 16, 2024 at 09:03:03PM -0500, Hans-Peter Nilsson wrote:
> On Mon, 16 Dec 2024, Alan Modra wrote:
>
> > These targets currently use GENERIC_ELF_DATA as their target_id, but
> > that isn't exactly correct. While their bfd tdata is generic elf,
> > their elf_section_data is extended with extra target data. Add
> > MMIX_ELF_DATA and SCORE_ELF_DATA.
>
> This patch broke 29 ld-mmix tests, the first being
> ld-mmix/bpo-1.
Huh, so it did. elflink.c compares the hash table and object ids in a
number of places. The patch below fixes commit 64a91215cd, but you
might like to look into the segfaults due to mmix_final_link_relocate
being called from mmix_elf_relocate_section with a NULL error_message.
I'll likely commit another fix on top of this one, because it occurs
to me that it would be better to remove the last param of
_bfd_elf_link_hash_table_init. The target_id can then be retrieved
inside _bfd_elf_link_hash_table_init from elf_backend_data.
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index d22d92d1748..6c6de3488f3 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -4366,7 +4366,7 @@ elf32_score_link_hash_table_create (bfd *abfd)
if (!_bfd_elf_link_hash_table_init (ret, abfd, score_elf_link_hash_newfunc,
sizeof (struct score_elf_link_hash_entry),
- GENERIC_ELF_DATA))
+ SCORE_ELF_DATA))
{
free (ret);
return NULL;
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ef159dafd55..2b9e8b9ea30 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -8354,7 +8354,7 @@ _bfd_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),
- GENERIC_ELF_DATA))
+ get_elf_backend_data (abfd)->target_id))
{
free (ret);
return NULL;
--
Alan Modra
More information about the Binutils
mailing list