Date: Wed, 12 Apr 2006 23:52:07 +0200 From: Jeremie Le Hen <jeremie@le-hen.org> To: freebsd-questions@FreeBSD.org Cc: Jeremie Le Hen <jeremie@le-hen.org> Subject: linker mysteries Message-ID: <20060412215207.GK71412@obiwan.tataz.chchile.org>
next in thread | raw e-mail | index | archive | help
Hi list, [ Please Cc: me in your replies as I am not subscribed to this list. ] I was doing some testing on shared dependencies and fiddling libfetch's Makefile for this aim. I set LDFLAGS to "-v" in order to see the command executed for th linking. In the standard Makefile, we have this : % .if !defined(NO_CRYPT) && !defined(NO_OPENSSL) % CFLAGS+= -DWITH_SSL % DPADD= ${LIBSSL} ${LIBCRYPTO} % LDADD= -lssl -lcrypto % .endif And the resulting linker command is : % /usr/bin/ld -V -Bshareable -o libfetch.so.4 /usr/lib/crti.o /usr/lib/crtbeginS.o -L/usr/lib -x -soname libfetch.so.4 file.So http.So ftp.So common.So fetch.So -lssl -lcrypto -lgcc_pic -lgcc_pic /usr/lib/crtendS.o /usr/lib/crtn.o Dependencies are normal : % jarjarbinks# cd /usr/obj/usr/src/lib/libfetch % jarjarbinks# ldd libfetch.so % libfetch.so: % libssl.so.4 => /usr/lib/libssl.so.4 (0x3277d000) % libcrypto.so.4 => /lib/libcrypto.so.4 (0x3215f000) If I comment out the variable assignements : % .if !defined(NO_CRYPT) && !defined(NO_OPENSSL) % #CFLAGS+= -DWITH_SSL % #DPADD= ${LIBSSL} ${LIBCRYPTO} % #LDADD= -lssl -lcrypto % .endif The resulting linker command is now : /usr/bin/ld -V -Bshareable -o libfetch.so.4 /usr/lib/crti.o /usr/lib/crtbeginS.o -L/usr/lib -x -soname libfetch.so.4 file.So http.So ftp.So common.So fetch.So -lgcc_pic -lgcc_pic /usr/lib/crtendS.o /usr/lib/crtn.o As you can see, we don't have "-lssl -lcrypto" any more. However, ldd(1) still says that libfetch.so is linked against those libraries : % jarjarbinks# ldd libfetch.so % libfetch.so: % libssl.so.4 => /usr/lib/libssl.so.4 (0x2c72e000) % libcrypto.so.4 => /lib/libcrypto.so.4 (0x2cd74000) Only linking addresses change, but they do at every compilation. I would be glad if someone could explain why this happens. Thank you, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060412215207.GK71412>