-Wl,--as-needed

Panu Matilainen pmatilai at laiskiainen.org
Fri Jun 30 02:20:30 PDT 2006


Inspired by ponderings on fedora-maintainers list, I had a look at what
sort of effect -Wl,--as-needed would have on apt.

Without it, as things are right now:

[pmatilai at weasel]$ ldd -r -u /usr/bin/apt-get
Unused direct dependencies:
        /lib64/libdl.so.2
        /usr/lib64/libxml2.so.2
        /usr/lib64/librpm-4.4.so
        /usr/lib64/librpmdb-4.4.so
        /usr/lib64/librpmio-4.4.so
        /usr/lib64/libpopt.so.0
        /usr/lib64/libz.so.1
        /usr/lib64/libbz2.so.1
        /lib64/libm.so.6
[pmatilai at weasel]$ ldd -r -u /usr/bin/apt-shell
Unused direct dependencies:
        /lib64/libdl.so.2
        /usr/lib64/libxml2.so.2
        /usr/lib64/librpm-4.4.so
        /usr/lib64/librpmdb-4.4.so
        /usr/lib64/librpmio-4.4.so
        /usr/lib64/libpopt.so.0
        /usr/lib64/libncurses.so.5
        /usr/lib64/libz.so.1
        /usr/lib64/libbz2.so.1
        /lib64/libm.so.6
[pmatilai at weasel]$ ldd -r -u /usr/lib64/libapt-pkg-libc6.4-6.so.2
Unused direct dependencies:
        /usr/lib64/libpopt.so.0
        /usr/lib64/libz.so.1
        /usr/lib64/libbz2.so.1

So, certainly quite a bit of unneeded linkage gunk in there. With
"LDFLAGS=-Wl,--as-needed ./configure" those go away, except for
libapt-pkg itself, dunno what's going on in there, Makefile brokenness
or something:
[pmatilai at weasel apt-rpm]$ ldd -r -u cmdline/.libs/apt-get
[pmatilai at weasel apt-rpm]$ ldd -r -u cmdline/.libs/apt-shell
[pmatilai at weasel apt-rpm]$ ldd -r -u
apt-pkg/.libs/libapt-pkg-libc6.4-6.so.2.0.0
Unused direct dependencies:
        /usr/lib64/libpopt.so.0
        /usr/lib64/libz.so.1
        /usr/lib64/libbz2.so.1
[pmatilai at weasel apt-rpm]$

I'm wondering is the --as-needed something we should/could use by
default? For one, I've no idea what toolchain versions support it in the
first place... Thoughts?

	- Panu -





More information about the Apt-Rpm mailing list