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

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