This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: static archives and search order with start/end groups
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sourceware dot org
- Cc: Mike Frysinger <vapier at gentoo dot org>
- Date: Tue, 29 Jan 2008 02:07:52 +0000
- Subject: Re: static archives and search order with start/end groups
- References: <200801282051.08133.vapier@gentoo.org>
On Tuesday 29 January 2008, Mike Frysinger wrote:
> am i wrong in assuming that the start/end group options should cause the
> list of archives to be treated as one archive ?
Your incorrect assumption is even more fundamental. You appear to have
misunderstood how objects are linked form archives. The same will occur with
a single archive.
> the idea is that the strong symbol should override the weak one, and since
> they're in the same group, this should just work. unfortunately, in the
> aforementioned case, the weak foo() is picked over the strong foo().
--start-group effects library search order. i.e. which archives the linker
considers when looking for a symbol. However once that symbol has been
satisfied (by pulling in the first object that defines it), it will not pull
in additional objects that happen to define the same symbol.
If both objects happen to be linked the linker will choose the strong
definition. However it will not go looking for a strong definition if it
already has a weak one.
If you want to pull in a whole archive you need to use --whole-archive.
Paul