This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Fix assertion failure on aliases of dynamic weak symbols
- From: "H.J. Lu" <hjl at lucon dot org>
- To: binutils at sourceware dot org, richard at codesourcery dot com
- Cc: rth at redhat dot com
- Date: Mon, 16 Jul 2007 13:35:05 -0700
- Subject: Re: Fix assertion failure on aliases of dynamic weak symbols
- References: <87k5t0ff65.fsf@firetop.home>
On Mon, Jul 16, 2007 at 06:10:10PM +0100, Richard Sandiford wrote:
> The attached testcase fails on GNU/Linux targets with:
>
> BFD (GNU Binutils) 2.17.50.20070716 assertion fail .../bfd/elflink.c:2496
>
> A shared library has a weak symbol "foo", and bfd determines that the
> strong symbol "data_start" is an alias for "foo" (it has the same section
> and value). The shared library is then involved in another link, and the
> script for that link defines "data_start" via a PROVIDE statement.
That piece of code was added by Richard on May 3, 1999 with
comments:
/* Now set the weakdefs field correctly for all the weak defined
symbols we found. The only way to do this is to search all the
symbols. Since we only need the information for non functions in
dynamic objects, that's the only time we actually put anything on
the list WEAKS. We need this information so that if a regular
object refers to a symbol defined weakly in a dynamic object, the
real symbol in the dynamic object is also put in the dynamic
symbols; we also must arrange for both symbols to point to the
same memory location. We could handle the general case of symbol
aliasing, but a general symbol alias can only be generated in
assembler code, handling it correctly would be very time
consuming, and other ELF linkers don't handle general aliasing
either. */
It no longer applies today since there is no difference between
weak def and strong def in a shared library. Richard, do you
remember if there is a testcase for your change? Can we remove
the whole u.weakdef thing now? It will make linker simpler and
faster.
Thanks.
H.J.