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 Monday 28 January 2008, Paul Brook wrote:
> 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.

so the basic limitation is that weak/strong arent resolved with archives 
unless the entire archive is forced into the final object.  ld will stop as 
soon as it satisfies its undefined reference.

> > 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.

unfortunately, that is not feasible as there are plenty of dead objects that 
should be culled and --gc-sections cannot be relied upon (due to need for 
supporting older binutils)

thanks for the info
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


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