Loving ld with --as-needed

Scott James Remnant scott at ubuntu.com
Mon Feb 28 09:13:20 CST 2005

On Mon, 2005-02-28 at 05:20 +1100, Jeff Waugh wrote:

>So, in the tradition of weight-loss propaganda everywhere, let's look at the
>benefits of a bold new linker option...
-Wl,--as-needed ?

>gnome-gpg AFTER:
>Depends: libc6 (>= 2.3.2.ds1-4), libglib2.0-0 (>= 2.6.0), libgnome-keyring0
>(>= 0.4.0), libgnome2-0 (>= 2.8.0), libgnomeui-0 (>= 2.8.0), libgtk2.0-0 (>=
>2.6.0), gnupg
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>

>Similarly, gnome-panel goes from 43 to 28 shlibdeps. On the face of it, this
>will help us avoid massive rebuilds when deep-down dependencies change (such
>as gnutls) and hopefully Scott can give us an idea about performance impact,
>if applicable.
Indeed, it massively helps the rebuild problem (like the Libtool change
to do similar does); and would boost performance as you're performing
far fewer relocations on application load.

>If this is regarded as safe (Scott?), we could begin building GNOME with it
>now (or immediately after hoary) and perhaps put it into the buildd settings
>once we're completely happy with it.
I've not heard of any problems with it, except where apps perform
strange tricks to obtain symbols (such as dl_sym on themselves).

Scott James Remnant     Linux.Ars: Best Community, Best Distribution and
scott at ubuntu.com                   Best Newcomer 2004:  Ubuntu Linux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.ubuntu.com/archives/ubuntu-devel/attachments/20050228/60402843/attachment-0001.pgp

More information about the ubuntu-devel mailing list