Among the problems that the gold linker brings: - The debugging section gets dropped, making the /usr/lib/debug/ files useless. - The .eh_frame section is bogus[1], resulting in crashes in libunwind[2] and a truncated backtrace in gdb. The issue "fixed" in that commit is gone as IFUNC is not used anymore since version 210), so in theory we could drop the -Wl,-fuse-ld=gold line... ...but in practice we run into problems because GNU ld sees that symbols appear twice, once in the libsystemd-{internal,shared}.la, and once in the compatibility library (libsystemd-id128.la). I tried to remove libsystemd-internal.la from libsystemd_id128_LIBADD, but then all symbols would disappear, leaving a pretty empty libsystemd-id128.so file. (This presumably happens because there were missing references.) Now I would like to revert to the state before v208-1653-g39c4ead, but meanwhile there have been a lot of other changes to the build system. What would it take to avoid linking two archives with the same symbol? That would also avoid problems such as https://sourceware.org/bugzilla/show_bug.cgi?id=16504 since then there would only be one symbol. [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=17639 [2]: http://lists.nongnu.org/archive/html/libunwind-devel/2014-11/msg00009.html
Proposed workaround patch: http://lists.freedesktop.org/archives/systemd-devel/2014-November/025501.html
(In reply to Peter Wu from comment #0) > Among the problems that the gold linker brings: > > - The .eh_frame section is bogus[1], resulting in crashes in > libunwind[2] and a truncated backtrace in gdb. The consensus on the ml seems to be to ignore this, since the bug is already fixed in binutils. > - The debugging section gets dropped, making the /usr/lib/debug/ files > useless. What about this? What are the symptoms?
(In reply to Zbigniew Jedrzejewski-Szmek from comment #2) > (In reply to Peter Wu from comment #0) > > - The debugging section gets dropped, making the /usr/lib/debug/ files > > useless. > What about this? What are the symptoms? This is a bug different from the .eh_frame gold linker issue but also hurts the debugging experience: The cause was mentioned in the IRC channel. For some reason, libtool does not keep the -g option during linking (rm libgudev-1.0.la .libs/libgudev-1.0.so* && make libgudev-1.0.la V=1): /bin/sh ./libtool --tag=CC --mode=link gcc -std=gnu99 -pipe [-W, -I, etc.] -g -O2 -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,--print-gc-sections -Wl,-z,relro -Wl,-z,now -pie -Wl,-fuse-ld=gold -version-info 2:0:2 -export-dynamic -no-undefined -Wl,--version-script=../src/gudev/libgudev-1.0.sym -o libgudev-1.0.la -rpath /usr/lib src/gudev/libgudev_1_0_la-gudevclient.lo src/gudev/libgudev_1_0_la-gudevdevice.lo src/gudev/libgudev_1_0_la-gudevenumerator.lo src/gudev/libgudev_1_0_la-gudevmarshal.lo src/gudev/libgudev_1_0_la-gudevenumtypes.lo libudev.la -lgio-2.0 -lgobject-2.0 -lglib-2.0 -ldl libtool: link: gcc -shared -fPIC -DPIC src/gudev/.libs/libgudev_1_0_la-gudevclient.o src/gudev/.libs/libgudev_1_0_la-gudevdevice.o src/gudev/.libs/libgudev_1_0_la-gudevenumerator.o src/gudev/.libs/libgudev_1_0_la-gudevmarshal.o src/gudev/.libs/libgudev_1_0_la-gudevenumtypes.o -Wl,-rpath -Wl,/tmp/systemd/build/.libs ./.libs/libudev.so -lrt -lcap -lgio-2.0 -lgobject-2.0 -lglib-2.0 -ldl -flto -pthread -O2 -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,--print-gc-sections -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-fuse-ld=gold -Wl,--version-script=../src/gudev/libgudev-1.0.sym -pthread -Wl,-soname -Wl,libgudev-1.0.so.0 -o .libs/libgudev-1.0.so.0.2.0 After the above steps, there are no debug sections: objdump -h .libs/libgudev-1.0.so.0 | grep debug With '-g' appended to the libtool command above, the output is non-empty: 27 .debug_info 0000b5be 0000000000000000 0000000000000000 0000a01a 2**0 28 .debug_abbrev 00000d5b 0000000000000000 0000000000000000 000155d8 2**0 29 .debug_loc 00007f25 0000000000000000 0000000000000000 00016333 2**0 30 .debug_aranges 00000090 0000000000000000 0000000000000000 0001e258 2**0 31 .debug_ranges 00000460 0000000000000000 0000000000000000 0001e2e8 2**0 32 .debug_line 00000e11 0000000000000000 0000000000000000 0001e748 2**0 33 .debug_str 00002b19 0000000000000000 0000000000000000 0001f559 2**0 This is with GCC 4.9.2.
I get the debug sections (with gcc 4.9.1 and 4.9.2). -g not *not* passed, but it does not seem to matter. It also doesn't seem to have anything to do with debug level: I get the same output for the grep command you provided for -O0, -Og, and -O3.
(In reply to Zbigniew Jedrzejewski-Szmek from comment #4) > I get the debug sections (with gcc 4.9.1 and 4.9.2). -g not *not* passed, > but it does not seem to matter. It also doesn't seem to have anything to do > with debug level: I get the same output for the grep command you provided > for -O0, -Og, and -O3. What are your configure options? What do you get for: rm libgudev-1.0.la .libs/libgudev-1.0.so* && make libgudev-1.0.la V=1
% rm libgudev-1.0.la .libs/libgudev-1.0.so* && make libgudev-1.0.la V=1 /bin/sh ./libtool --tag=CC --mode=link gcc -std=gnu99 -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -fvisibility=default -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -g -O0 -ftrapv -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,relro -Wl,-z,now -pie -Wl,-fuse-ld=gold -version-info 2:0:2 -export-dynamic -no-undefined -Wl,--version-script=./src/gudev/libgudev-1.0.sym -o libgudev-1.0.la -rpath /usr/lib64 src/gudev/libgudev_1_0_la-gudevclient.lo src/gudev/libgudev_1_0_la-gudevdevice.lo src/gudev/libgudev_1_0_la-gudevenumerator.lo src/gudev/libgudev_1_0_la-gudevmarshal.lo src/gudev/libgudev_1_0_la-gudevenumtypes.lo libudev.la -lgio-2.0 -lgobject-2.0 -lglib-2.0 -ldw -ldl libtool: link: rm -fr .libs/libgudev-1.0.la .libs/libgudev-1.0.lai libtool: link: gcc -shared -fPIC -DPIC src/gudev/.libs/libgudev_1_0_la-gudevclient.o src/gudev/.libs/libgudev_1_0_la-gudevdevice.o src/gudev/.libs/libgudev_1_0_la-gudevenumerator.o src/gudev/.libs/libgudev_1_0_la-gudevmarshal.o src/gudev/.libs/libgudev_1_0_la-gudevenumtypes.o -Wl,-rpath -Wl,/home/zbyszek/src/systemd-tmp/.libs ./.libs/libudev.so -lrt -lcap -lgio-2.0 -lgobject-2.0 -lglib-2.0 -ldw -ldl -pthread -O0 -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-fuse-ld=gold -Wl,--version-script=./src/gudev/libgudev-1.0.sym -pthread -Wl,-soname -Wl,libgudev-1.0.so.0 -o .libs/libgudev-1.0.so.0.2.0 libtool: link: (cd ".libs" && rm -f "libgudev-1.0.so.0" && ln -s "libgudev-1.0.so.0.2.0" "libgudev-1.0.so.0") libtool: link: (cd ".libs" && rm -f "libgudev-1.0.so" && ln -s "libgudev-1.0.so.0.2.0" "libgudev-1.0.so") libtool: link: ( cd ".libs" && rm -f "libgudev-1.0.la" && ln -s "../libgudev-1.0.la" "libgudev-1.0.la" ) % objdump -h .libs/libgudev-1.0.so.0 | grep debug 26 .debug_info 000055d3 0000000000000000 0000000000000000 0000b059 2**0 27 .debug_abbrev 000008ac 0000000000000000 0000000000000000 0001062c 2**0 28 .debug_aranges 00000570 0000000000000000 0000000000000000 00010ed8 2**0 29 .debug_ranges 00000520 0000000000000000 0000000000000000 00011448 2**0 30 .debug_line 00001a53 0000000000000000 0000000000000000 00011968 2**0 31 .debug_str 00001cb4 0000000000000000 0000000000000000 000133bb 2**0 libtool-2.4.2-29.fc21.x86_64
I am not sure there's anything to fix here in systemd. These are bugs to fix in binutils (which I think are already fixed, if I am not mistaken). Also, you can override what systemd uses easil when building. However, I am pretty sure we should stick to gold for linking by default.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.