--as-needed compile option?

Jakub Jelinek jakub at redhat.com
Thu Mar 31 15:10:12 UTC 2005


On Thu, Mar 31, 2005 at 04:04:17PM +0100, Joe Orton wrote:
> So when I link httpd using -lssl -lcrypto, despite the fact that httpd
> itself does not use any symbols from those libraries, I *must* get an
> httpd with DT_NEEDED of libssl and libcrypto to ensure both stay mapped
> for the lifetime of the process.  That's why use of --as-needed must
> only be done as directed by the application.

Well, perhaps it could be added also by the tools that carelessly
insert dozens of libraries on link command line although they aren't
really needed (I mean libtool and pkg-config), but it certainly shouldn't
be the linker's default.
I.e. if you add libfoo.la on libtools link line, it would add -lfoo without
--as-needed and whatever other libraries that .la would add in would be
linked between --as-needed and --no-as-needed.

FYI, ldd -u -r /path/to/program/or/library
reports unneeded libraries.

	Jakub




More information about the fedora-test-list mailing list