This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Fix generic linker symbol output when weak is overridden by strong
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Wed, 24 Dec 2014 15:22:03 +1030
- Subject: Fix generic linker symbol output when weak is overridden by strong
- Authentication-results: sourceware.org; auth=none
This fixes defined6 failures for ELF targets using the generic linker.
When a weak symbol is overridden by a strong one, we want the output
symbol to be strong rather than weak. Yes, I know this also affects
bfd_link_hash_indirect due to the fall through, but output of indirect
and warning symbols looks quite broken anyway. Presumably no one
cares about such things.
* linker.c (_bfd_generic_link_output_symbols): Remove BSF_WEAK
flag from bfd_link_hash_defined symbols.
diff --git a/bfd/linker.c b/bfd/linker.c
index 9223810..083a250 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -2136,7 +2136,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
/* fall through */
case bfd_link_hash_defined:
sym->flags |= BSF_GLOBAL;
- sym->flags &=~ BSF_CONSTRUCTOR;
+ sym->flags &=~ (BSF_WEAK | BSF_CONSTRUCTOR);
sym->value = h->root.u.def.value;
sym->section = h->root.u.def.section;
break;
--
Alan Modra
Australia Development Lab, IBM