[systemd-devel] [PATCH] build-sys: remove --gc-sections to fix debugging
Peter Wu
peter at lekensteyn.nl
Wed Nov 26 06:28:15 PST 2014
(cc'ing Zbigniew because he introduced gold, cc'ing Gustavo because he
added --gc-sections)
On Monday 24 November 2014 20:00:58 Peter Wu wrote:
> 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
> 83432 with-gc-sections/install
> 25796 without-gc-sections/install-strip
> 25752 with-gc-sections/install-strip
The above tests were done with binutils 2.24-8 on Arch Linux x86_64
(installation media, so a pretty pristine packages list).
Meanwhile the bug has been fixed in binutils git (which will also end up
in binutils 2.25). The numbers for binutils commit
c924eb67e143722e4098d84c1cb91123a51c988f ("Fix corrupted .eh_frame
section with LTO and --gc-sections.") and the same configure options:
84024 new-binutils-without-gc-sections/install
83988 new-binutils-with-gc-sections/install
26384 new-binutils-without-gc-sections/install-strip
26380 new-binutils-with-gc-sections/install-strip
For clarity on how I got these numbers, I ran 'makepkg' to build
systemd (based on 217-7), then executed 'make install(-strip)
DESTDIR=$PWD/fs' and counted the size with `du -sk`.
The gains were pretty small, so what about removing the option and
improve the debugging experience?
> [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 \
>
More information about the systemd-devel
mailing list