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

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