This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix DT_NEEDED search with --as-needed libraries (PR ld/2721)
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 2 Jun 2006 14:43:44 +0930
- Subject: Re: [PATCH] Fix DT_NEEDED search with --as-needed libraries (PR ld/2721)
- References: <20060601150907.GD3823@sunsite.mff.cuni.cz>
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