This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: library dependencies and --as-needed
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Brian Gough <bjg at gnu dot org>
- Cc: binutils at sourceware dot org, bug-gsl at gnu dot org, Sébastien Fabbro <bicatali at gentoo dot org>
- Date: Fri, 30 Jan 2009 15:20:41 +1030
- Subject: Re: library dependencies and --as-needed
- References: <m3zlhap204.wl%bjg@network-theory.co.uk>
On Thu, Jan 29, 2009 at 03:26:19PM +0000, Brian Gough wrote:
> It seems like it would work if the search with --as-needed was
> recursive, is there any conceptual reason for it not to do that?
It just happened that way because that's what we do for libs brought
in only because they are mentioned as dependencies of other libs that
ld is linking against. ie. if we have
app
/\
/ \
libx liby
\
\
libz
and we link app just against libx and liby, you won't get a DT_NEEDED
tag in app for libz unless app references some symbol in libz
directly. The idea is that if app does reference libz, then we want
to protect against some newer liby being installed that no longer
needs libz.
--as-needed is really a different case, and I don't see why we
shouldn't do as you are asking. I've said as much before,
http://www.sourceware.org/ml/binutils/2006-06/msg00017.html,
and a google search turns up at least one bug report about this.
Any dissenting opinions on this issue?
--
Alan Modra
Australia Development Lab, IBM