On 16/03/14 15:52, Zbigniew Jędrzejewski-Szmek wrote: > On Sun, Mar 16, 2014 at 10:10:15AM +0200, Samuli Suominen wrote: >> Since -Wl,-fuse-ld=gold addition, this happens on IA64 arch where binutils's >> ld gold doesn't support --gc-sections yet: > Maybe you should just use bfd linker then? Gold was only necessary for the > ifunc stuff, which is gone anyway. This might to be a better solution, since > otherwise everything gets an extra lib.
-lresolv is used elsewhere in Makefile.am too, like in libsystemd_la_LIBADD and test_resolve_LDADD src/libsystemd/sd-resolve/sd-resolve.c: ret = res_search at line 432 src/libsystemd/sd-resolve/sd-resolve.c: ret = res_query at line 430 then sd-resolve.c is in libsystemd_internal_la_SOURCES, so adding -lresolv to libsystemd_internal_la_LIBADD is not a workaround, but the correct thing to do > > LDFLAGS=-Wl,-fuse=bfd ? we can do that too, but the underlinking issue should still be fixed... gold is just a more strict linker, which is good, and relying upon --gc-sections to 'accidentally' bring in correct libs, is bad practise > > Zbyszek > >> libtool: link: ia64-unknown-linux-gnu-gcc -shared -fPIC -DPIC >> src/libudev/.libs/libudev_la-libudev.o >> src/libudev/.libs/libudev_la-libudev-list.o src/libudev/.libs/libudev_la-libu >> dev-util.o src/libudev/.libs/libudev_la-libudev-device.o >> src/libudev/.libs/libudev_la-libudev-enumerate.o >> src/libudev/.libs/libudev_la-libudev-monitor.o src/libudev/.libs/libudev_l >> a-libudev-queue.o src/libudev/.libs/libudev_la-libudev-hwdb.o >> -Wl,--whole-archive ./.libs/libsystemd-internal.a >> ./.libs/libsystemd-shared.a -Wl,--no-whole-archive -Wl,--as-needed >> -lrt -ldl -O2 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z -Wl,relro -Wl,-z >> -Wl,now -Wl,-fuse-ld=gold >> -Wl,--version-script=/tmp/systemd-211/src/libudev/libudev.sym -Wl,-O1 >> -pthread -Wl,-soname -Wl,libudev.so.1 -o .libs/libudev.so.1.4.0 >> cc1: warning: ./src/core: No such file or directory [enabled by default] >> /usr/lib/gcc/ia64-unknown-linux-gnu/4.7.3/../../../../ia64-unknown-linux-gnu/bin/ld: >> Warning: gc-sections option ignored >> ./.libs/libsystemd-internal.a(libsystemd_internal_la-sd-resolve.o): In >> function `handle_request': >> /tmp/systemd-211/src/libsystemd/sd-resolve/sd-resolve.c:432: undefined >> reference to `__res_search' >> /tmp/systemd-211/src/libsystemd/sd-resolve/sd-resolve.c:430: undefined >> reference to `__res_query' >> collect2: error: ld returned 1 exit status >> make: *** [libudev.la] Error 1 >> >> Patch adds -lresolv to libsystemd_internal_la_LIBADD = accordingly, so >> building works with or without --gc-sections working properly. >> >> See also, http://bugs.gentoo.org/show_bug.cgi?id=504700 >> >> >> From 2b9ae40d830596eda80cc5bc5252c6685cb75eaa Mon Sep 17 00:00:00 2001 >> From: Samuli Suominen <ssuomi...@gentoo.org> >> Date: Sat, 15 Mar 2014 20:40:24 +0200 >> Subject: [PATCH] Link against -lresolv to prevent linker errors like: >> /usr/lib/gcc/ia64-unknown-linux-gnu/4.7.3/../../../../ia64-unknown- >> linux-gnu/bin/ld: Warning: gc-sections option ignored >> ./.libs/libsystemd-internal.a(libsystemd_internal_la-sd-resolve.o): >> In function `handle_request': >> /tmp/systemd-211/src/libsystemd/sd-resolve/sd-resolve.c:432: undefined >> reference to '__res_search' >> /tmp/systemd-211/src/libsystemd/sd-resolve/sd-resolve.c:430: undefined >> reference to '__res_query' >> >> IA64 arch with -fuse-ld=gold doesn't support --gc-sections, which >> revealed the underlinking. See Gentoo bug 504700. >> >> --- >> Makefile.am | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/Makefile.am b/Makefile.am >> index 9e01cd5..4b8a081 100644 >> --- a/Makefile.am >> +++ b/Makefile.am >> @@ -2121,7 +2121,8 @@ libsystemd_internal_la_CFLAGS = \ >> -pthread >> >> libsystemd_internal_la_LIBADD = \ >> - $(RT_LIBS) >> + $(RT_LIBS) \ >> + -lresolv >> >> noinst_LTLIBRARIES += \ >> libsystemd-internal.la >> -- _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel