packages: binutils/binutils-weakdef.patch (NEW)=?UTF-8?Q?=20?=- upstream patch - http://s...

megabajt megabajt at pld-linux.org
Fri Feb 10 23:45:01 CET 2012


Author: megabajt                     Date: Fri Feb 10 22:45:01 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- upstream patch - http://sourceware.org/git/?p=binutils.git;a=patch;h=f5edd1ac0e79c0356c6a1e2beffcadc0c532be98

---- Files affected:
packages/binutils:
   binutils-weakdef.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/binutils/binutils-weakdef.patch
diff -u /dev/null packages/binutils/binutils-weakdef.patch:1.1
--- /dev/null	Fri Feb 10 23:45:01 2012
+++ packages/binutils/binutils-weakdef.patch	Fri Feb 10 23:44:56 2012
@@ -0,0 +1,65 @@
+From f5edd1ac0e79c0356c6a1e2beffcadc0c532be98 Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra at bigpond.net.au>
+Date: Wed, 8 Feb 2012 10:12:19 +0000
+Subject: [PATCH] 	* elflink.c (_bfd_elf_gc_mark_rsec): Mark weakdef syms too.
+ 	(_bfd_elf_fix_symbol_flags): When a weakdef is def_regular, clear
+ 	the correct h->u.weakdef.
+
+---
+ bfd/ChangeLog |    6 ++++++
+ bfd/elflink.c |   26 +++++++++++++++-----------
+ 2 files changed, 21 insertions(+), 11 deletions(-)
+
+diff --git a/bfd/elflink.c b/bfd/elflink.c
+index 1d1ca0b..7f9ec60 100644
+--- a/bfd/elflink.c
++++ b/bfd/elflink.c
+@@ -2510,23 +2510,21 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
+      over to the real definition.  */
+   if (h->u.weakdef != NULL)
+     {
+-      struct elf_link_hash_entry *weakdef;
+-
+-      weakdef = h->u.weakdef;
+-      while (h->root.type == bfd_link_hash_indirect)
+-	h = (struct elf_link_hash_entry *) h->root.u.i.link;
+-
+-      BFD_ASSERT (h->root.type == bfd_link_hash_defined
+-		  || h->root.type == bfd_link_hash_defweak);
+-      BFD_ASSERT (weakdef->def_dynamic);
+-
+       /* If the real definition is defined by a regular object file,
+ 	 don't do anything special.  See the longer description in
+ 	 _bfd_elf_adjust_dynamic_symbol, below.  */
+-      if (weakdef->def_regular)
++      if (h->u.weakdef->def_regular)
+ 	h->u.weakdef = NULL;
+       else
+ 	{
++	  struct elf_link_hash_entry *weakdef = h->u.weakdef;
++
++	  while (h->root.type == bfd_link_hash_indirect)
++	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
++
++	  BFD_ASSERT (h->root.type == bfd_link_hash_defined
++		      || h->root.type == bfd_link_hash_defweak);
++	  BFD_ASSERT (weakdef->def_dynamic);
+ 	  BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
+ 		      || weakdef->root.type == bfd_link_hash_defweak);
+ 	  (*bed->elf_backend_copy_indirect_symbol) (eif->info, weakdef, h);
+@@ -11575,6 +11573,12 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
+ 	     || h->root.type == bfd_link_hash_warning)
+ 	h = (struct elf_link_hash_entry *) h->root.u.i.link;
+       h->mark = 1;
++      /* If this symbol is weak and there is a non-weak definition, we
++	 keep the non-weak definition because many backends put
++	 dynamic reloc info on the non-weak definition for code
++	 handling copy relocs.  */
++      if (h->u.weakdef != NULL)
++	h->u.weakdef->mark = 1;
+       return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL);
+     }
+ 
+-- 
+1.7.3.4
+
================================================================


More information about the pld-cvs-commit mailing list