[systemd-devel] [PATCH] build-sys: remove --gc-sections to fix debugging

Peter Wu peter at lekensteyn.nl
Mon Nov 24 11:00:58 PST 2014


The --gc-sections linker option triggers a bug in the gold linker[1] which
results in a bogus .eh_frame section making debugging harder: gdb backtraces
stop at a library built by systemd and libunwind simply segfaults.

Workaround by that bug by removing the option. The additional disk space
saved by this option is marginal anyway (less than 1%). To illustrate this, see
this `du -ks` on the installed files:

    83548   without-gc-sections/install
    25796   without-gc-sections/install-strip
    83432   with-gc-sections/install
    25752   with-gc-sections/install-strip

 [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=17639

https://bugs.freedesktop.org/show_bug.cgi?id=86666
---
 configure.ac | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index bd3cc0e..8d926be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -219,7 +219,6 @@ AC_SUBST([OUR_CPPFLAGS], "$with_cppflags $sanitizer_cppflags")
 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
         -Wl,--as-needed \
         -Wl,--no-undefined \
-        -Wl,--gc-sections \
         -Wl,-z,relro \
         -Wl,-z,now \
         -pie \
-- 
1.9.1



More information about the systemd-devel mailing list