Blame SOURCES/binutils-elf-add-objects.patch

3dad3f
--- binutils.orig/bfd/elflink.c	2020-07-31 10:45:48.747912761 +0100
3dad3f
+++ binutils-2.35/bfd/elflink.c	2020-07-31 10:47:26.336262770 +0100
3dad3f
@@ -505,6 +505,16 @@ bfd_elf_link_record_dynamic_symbol (stru
3dad3f
       const char *name;
3dad3f
       size_t indx;
3dad3f
 
3dad3f
+      if (h->root.type == bfd_link_hash_defined
3dad3f
+	  || h->root.type == bfd_link_hash_defweak)
3dad3f
+	{
3dad3f
+	  /* An IR symbol should not be made dynamic.  */
3dad3f
+	  if (h->root.u.def.section != NULL
3dad3f
+	      && h->root.u.def.section->owner != NULL
3dad3f
+	      && (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0)
3dad3f
+	    return TRUE;
3dad3f
+	}
3dad3f
+
3dad3f
       /* XXX: The ABI draft says the linker must turn hidden and
3dad3f
 	 internal symbols into STB_LOCAL symbols when producing the
3dad3f
 	 DSO. However, if ld.so honors st_other in the dynamic table,
3dad3f
@@ -5199,15 +5209,11 @@ elf_link_add_object_symbols (bfd *abfd,
3dad3f
 		break;
3dad3f
 	      }
3dad3f
 
3dad3f
-	  /* Don't add DT_NEEDED for references from the dummy bfd nor
3dad3f
-	     for unmatched symbol.  */
3dad3f
 	  if (!add_needed
3dad3f
 	      && matched
3dad3f
 	      && definition
3dad3f
 	      && ((dynsym
3dad3f
-		   && h->ref_regular_nonweak
3dad3f
-		   && (old_bfd == NULL
3dad3f
-		       || (old_bfd->flags & BFD_PLUGIN) == 0))
3dad3f
+		   && h->ref_regular_nonweak)
3dad3f
 		  || (h->ref_dynamic_nonweak
3dad3f
 		      && (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0
3dad3f
 		      && !on_needed_list (elf_dt_name (abfd),