--as-needed handling of shared libraries that fail -Wl,-z,defs

Jakub Jelinek jakub@redhat.com
Thu May 19 16:43:00 GMT 2005


Hi!

--as-needed doesn't seem to try satisfy undefined references in shared
libraries:

ldd -d -r /usr/lib64/libreadline.so.4
undefined symbol: BC    (/usr/lib64/libreadline.so.4)
undefined symbol: PC    (/usr/lib64/libreadline.so.4)
undefined symbol: UP    (/usr/lib64/libreadline.so.4)
undefined symbol: tgetnum       (/usr/lib64/libreadline.so.4)
undefined symbol: tgoto (/usr/lib64/libreadline.so.4)
undefined symbol: tgetflag      (/usr/lib64/libreadline.so.4)
undefined symbol: tputs (/usr/lib64/libreadline.so.4)
undefined symbol: tgetent       (/usr/lib64/libreadline.so.4)
undefined symbol: tgetstr       (/usr/lib64/libreadline.so.4)
        libc.so.6 => /lib64/libc.so.6 (0x0000003a33900000)
        /lib64/ld-linux-x86-64.so.2 (0x0000555555555000)
echo 'int main (void) { return 0; }' | gcc -xc - -o test -lreadline -Wl,--as-needed -ltermcap -Wl,--no-as-needed; ./test
./test: symbol lookup error: /usr/lib64/libreadline.so.4: undefined symbol: BC

Is this desirable or should we change --as-needed to attempt to satisfy even
those?  Particularly for -lreadline, it makes sense to not depend on
libtermcap resp. libncurses, as those symbols can be provided by either
of those libraries and some applications prefer one over the other and vice
versa.

	Jakub



More information about the Binutils mailing list