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: [PATCH] Fix DT_NEEDED search with --as-needed libraries (PR ld/2721)


On Thu, Jun 01, 2006 at 05:09:07PM +0200, Jakub Jelinek wrote:
> If some --as-needed library mentioned on the command line isn't directly
> needed by executable being linked, but it is mentioned in DT_NEEDED of some
> needed library, then without this patch ld will disregard the library
> mentioned on the command line and look for a different one (e.g. in system
> paths).

According to the current specification of --as-needed, isn't that
exactly what ld should do?  --as-needed is supposed to cause ld to only
link a lib if it satisfies some reference from a regular object
(ie. non-dynamic) at that point in the link process.  This patch makes
--as-needed have another meaning entirely.

I'm willing to consider a behaviour change for --as-needed, eg. that
references from other dynamic libs cause a lib to be linked, but this
particular change seems a little odd.  Why should a library that you
decide isn't needed be considered again, unless it is also found by the
normal search mechanism?

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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