This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: How should the GNU linker treat weak references?
On Wed, Jul 04, 2001 at 11:29:16PM -0700, Ulrich Drepper wrote:
> Alan Modra <amodra@bigpond.net.au> writes:
>
> > main.o with an undef ref to foo
> > foo.o with weak define of foo
> > libfoo.so with strong define of foo
> >
> > Linking these should lead to foo being satisfied by the definition in
> > libfoo.so, as I'm sure you'll agree.
>
> No. Since foo.o is linked in its definition is found first. Always.
Really? If this is so, then bfd/elflink.h is currently doing the wrong
thing. See elflink.h:688 and elflink.h:747
> All object files given at the ld command line are unconditionally used.
I was assuming libfoo.so was specified on the command line in this case.