Blame SOURCES/binutils-keep-weak-aliases.patch

6239d0
--- binutils.orig/bfd/elflink.c	2020-02-18 17:32:29.506802884 +0000
6239d0
+++ binutils-2.32/bfd/elflink.c	2020-02-18 17:34:09.783017828 +0000
6239d0
@@ -12988,6 +12988,7 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_i
6239d0
 {
6239d0
   unsigned long r_symndx;
6239d0
   struct elf_link_hash_entry *h;
6239d0
+  struct elf_link_hash_entry *hw;
6239d0
 
6239d0
   r_symndx = cookie->rel->r_info >> cookie->r_sym_shift;
6239d0
   if (r_symndx == STN_UNDEF)
6239d0
@@ -13007,12 +13008,16 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_i
6239d0
 	     || h->root.type == bfd_link_hash_warning)
6239d0
 	h = (struct elf_link_hash_entry *) h->root.u.i.link;
6239d0
       h->mark = 1;
6239d0
-      /* If this symbol is weak and there is a non-weak definition, we
6239d0
-	 keep the non-weak definition because many backends put
6239d0
-	 dynamic reloc info on the non-weak definition for code
6239d0
-	 handling copy relocs.  */
6239d0
-      if (h->is_weakalias)
6239d0
-	weakdef (h)->mark = 1;
6239d0
+      /* Keep all aliases of the symbol too.  If an object symbol
6239d0
+        needs to be copied into .dynbss then all of its aliases
6239d0
+        should be present as dynamic symbols, not just the one used
6239d0
+        on the copy relocation.  */
6239d0
+      hw = h;
6239d0
+      while (hw->is_weakalias)
6239d0
+       {
6239d0
+         hw = hw->u.alias;
6239d0
+         hw->mark = 1;
6239d0
+       }
6239d0
 
6239d0
       if (start_stop != NULL)
6239d0
 	{