public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* weakdefs in adjust_dynamic_symbol
@ 2011-07-14  6:22 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2011-07-14  6:22 UTC (permalink / raw)
  To: binutils

A tiny fix to _bfd_elf_fix_symbol_flags, and removal of an old FIXME.

The traversal can indeed find H->U.WEAKDEF and H in any order but that
doesn't matter as up to that point we haven't done a great deal
besides call _bfd_elf_fix_symbol_flags.  What matters is that the
backend adjust_dynamic_symbol function always sees H->U.WEAKDEF before
H.

	* elflink.c (_bfd_elf_fix_symbol_flags): Loop on indirect syms.
	(_bfd_elf_adjust_dynamic_symbol): Remove FIXME.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.415
diff -u -p -r1.415 elflink.c
--- bfd/elflink.c	11 Jul 2011 18:39:13 -0000	1.415
+++ bfd/elflink.c	14 Jul 2011 02:52:10 -0000
@@ -2517,7 +2517,7 @@ _bfd_elf_fix_symbol_flags (struct elf_li
       struct elf_link_hash_entry *weakdef;
 
       weakdef = h->u.weakdef;
-      if (h->root.type == bfd_link_hash_indirect)
+      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
@@ -2621,12 +2621,12 @@ _bfd_elf_adjust_dynamic_symbol (struct e
 
   if (h->u.weakdef != NULL)
     {
-      /* If we get to this point, we know there is an implicit
-	 reference by a regular object file via the weak symbol H.
-	 FIXME: Is this really true?  What if the traversal finds
-	 H->U.WEAKDEF before it finds H?  */
+      /* If we get to this point, there is an implicit reference to
+	 H->U.WEAKDEF by a regular object file via the weak symbol H.  */
       h->u.weakdef->ref_regular = 1;
 
+      /* Ensure that the backend adjust_dynamic_symbol function sees
+	 H->U.WEAKDEF before H by recursively calling ourselves.  */
       if (! _bfd_elf_adjust_dynamic_symbol (h->u.weakdef, eif))
 	return FALSE;
     }

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-14  3:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-14  6:22 weakdefs in adjust_dynamic_symbol Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).