This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: static archives and search order with start/end groups


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]