Checks
Commit Message
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.
Comments
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.
brgds, H-P
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;
@@ -556,6 +556,7 @@ enum elf_target_id
METAG_ELF_DATA,
MICROBLAZE_ELF_DATA,
MIPS_ELF_DATA,
+ MMIX_ELF_DATA,
MN10300_ELF_DATA,
NDS32_ELF_DATA,
OR1K_ELF_DATA,
@@ -563,6 +564,7 @@ enum elf_target_id
PPC64_ELF_DATA,
PRU_ELF_DATA,
S390_ELF_DATA,
+ SCORE_ELF_DATA,
SH_ELF_DATA,
SPARC_ELF_DATA,
SPU_ELF_DATA,
@@ -4447,6 +4447,7 @@ _bfd_score_elf_common_definition (Elf_Internal_Sym *sym)
#define ELF_ARCH bfd_arch_score
#define ELF_MACHINE_CODE EM_SCORE
#define ELF_MACHINE_ALT1 EM_SCORE_OLD
+#define ELF_TARGET_ID SCORE_ELF_DATA
#define ELF_MAXPAGESIZE 0x8000
#define elf_info_to_howto NULL
@@ -2861,6 +2861,7 @@ mmix_elf_relax_section (bfd *abfd,
#define ELF_ARCH bfd_arch_mmix
#define ELF_MACHINE_CODE EM_MMIX
+#define ELF_TARGET_ID MMIX_ELF_DATA
/* According to mmix-doc page 36 (paragraph 45), this should be (1LL << 48LL).
However, that's too much for something somewhere in the linker part of