[systemd-devel] [PATCH] build-sys: remove --gc-sections to fix debugging
Gustavo Sverzut Barbieri
gustavo.barbieri at intel.com
Wed Nov 26 09:16:02 PST 2014
On Wed, Nov 26, 2014 at 03:28:15PM +0100, Peter Wu wrote:
> (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?
I'm okay with the change to remove gc-sections.
systemd is pretty good at not leaving crap in its code, then results
are pretty small as we saw.
My only comment is that we should also remove:
-ffunction-sections
-fdata-sections
those are only useful to enable gc-sections.
>From time to time someone should run a build with
-ffunction-sections
-fdata-sections
-Wl,--gc-sections
-Wl,--print-gc-sections
so we print out sections that are dangling and then we could remove
them from source code if needed.
BR,
--
Gustavo Sverzut Barbieri
Intel Open source Technology Center
More information about the systemd-devel
mailing list