Loving ld with --as-needed

Mike Hearn mike at navi.cx
Mon Feb 28 12:25:54 CST 2005


On Mon, 28 Feb 2005 15:13:20 +0000, Scott James Remnant wrote:
> What it's done is only linked the shared libraries that gnome-gpg
> _actually_ uses; if the GNOME people built their apps properly, this
> wouldn't be a problem, but they tend to take a "link everything just in
> case" attitude to things <g>

No, it's a problem for virtually all libraries, the GNOME guys (especially
the GTK+ team) are much more careful about this than usual. See the
--explicit-deps option to the Pango configure script.

This is actually a bit of a swamp: it's to do with portability to Solaris
and older GNU toolchains, as well as supporting static linking. It's been
discussed on xdg-list.

If --as-needed really *is* robust and can work with all libs (I've been
trying to break it recently and not yet succeeded) then I don't see any
reason why it shouldn't be in the gcc specfiles and therefore be applied
to every lib, as it seems to be all gain and no pain.

But it's not, so I'm guessing there is some reason why it's got to be
enabled explicitly. If you like I'll ask the binutils guys, otherwise you
can do it. I would like to know for other reasons anyway.

thanks -mike




More information about the ubuntu-devel mailing list