This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
weakdefs in adjust_dynamic_symbol
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 14 Jul 2011 13:26:47 +0930
- Subject: weakdefs in adjust_dynamic_symbol
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