[patch] Weak definition operrides strong definition
Alan Modra
amodra@bigpond.net.au
Mon May 2 02:38:00 GMT 2005
On Mon, May 02, 2005 at 02:44:36AM +0100, Paul Brook wrote:
> * elflink.c (_bfd_elf_merge_symbol): Skip weak definitions if a strong
> definition has already been seen.
I think you probably want to return immediately when setting *skip, and
there's no need to bother with *type_change_ok and *size_change_ok.
Please test the following and commit if OK. No need to mention me in
the changelog, it's your patch after all..
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.151
diff -u -p -r1.151 elflink.c
--- bfd/elflink.c 28 Apr 2005 10:31:24 -0000 1.151
+++ bfd/elflink.c 2 May 2005 02:31:54 -0000
@@ -1061,6 +1061,13 @@ _bfd_elf_merge_symbol (bfd *abfd,
if (olddef && newdyn)
oldweak = FALSE;
+ /* Skip weak definitions of symbols that are already defined. */
+ if (newdef && olddef && newweak && !oldweak)
+ {
+ *skip = TRUE;
+ return TRUE;
+ }
+
/* It's OK to change the type if either the existing symbol or the
new symbol is weak. A type change is also OK if the old symbol
is undefined and the new symbol is defined. */
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list