[PATCH] bfin: Check bfd_link_hash_indirect

Alan Modra amodra@gmail.com
Wed Jan 6 23:36:36 GMT 2021


On Wed, Jan 06, 2021 at 05:24:33AM -0800, H.J. Lu via Binutils wrote:
> Add bfd_link_hash_indirect check to bfinfdpic_check_relocs.  This fixed:
> 
> FAIL: ld-elf/pr26979a
> FAIL: ld-elf/pr26979b
> FAIL: Symbol export class test (final shared object)
> 
> 	* elf32-bfin.c (bfinfdpic_check_relocs): Don't call
> 	bfd_elf_link_record_dynamic_symbol.

Changelog needs fixing, and bfin_check_relocs needs a similar patch as
follows:

diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 0d8050f99c..6dbdfa53cf 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1197,6 +1197,9 @@ bfin_check_relocs (bfd * abfd,
       else
 	{
 	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
@@ -4523,7 +4526,12 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info,
       if (r_symndx < symtab_hdr->sh_info)
 	h = NULL;
       else
-	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	{
+	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+	}
 
       switch (ELF32_R_TYPE (rel->r_info))
 	{

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list