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

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