[systemd-devel] [PATCH v2] build-sys: remove --gc-sections to fix debugging
Peter Wu
peter at lekensteyn.nl
Wed Nov 26 14:40:17 PST 2014
On Wednesday 26 November 2014 21:41:48 Zbigniew Jędrzejewski-Szmek wrote:
> On Wed, Nov 26, 2014 at 05:24:37PM -0300, Cristian Rodríguez wrote:
> > El 26/11/14 a las 15:31, Peter Wu escribió:
> >
> > > [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=17639
> > >
> > >https://bugs.freedesktop.org/show_bug.cgi?id=86666
> > >---
> > > v2: removed -ffunction-sections and -fdata-sections too, mention
> > > that binutils fixed the bug.
> > >---
> >
> > -1 Just fix the linker and move along... not our bug IMHO.
Now that this bug is fixed, there is less need for this patch, but the
options themselves do not seem to bring great benefit so might as well
remove it. See also below.
> Hm, with this patch the build fails for me with
>
> ../src/shared/ptyfwd.c:117: error: undefined reference to 'sd_event_source_unref'
> ../src/shared/ptyfwd.c:120: error: undefined reference to 'sd_event_exit'
[..]
>
> (and many repeats for other libraries).
>
> $ rpm -q gcc binutils
> gcc-4.9.2-1.fc21.x86_64
> binutils-2.24-21.fc21.x86_64
>
> ../configure CFLAGS='-g -Og -ftrapv' CPPFLAGS=-DVALDGRIND=1 --disable-compat-libs --disable-kdbus --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib64 --enable-lz4 --enable-xz --enable-terminal
Reproduced. I built with --enable-compat-libs. Isn't a real bug being
hidden by the -Wl,--gc-sections option? id128.so uses the
sd_event_source_unref symbol which is provided by libsystemd-internal,
but id128 only links to libsystemd-shared. When linking with
-Wl,--gc-sections, I get:
$ readelf -s .libs/id128.so | grep sd_event_source_unref
1913: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND sd_event_source_unref
> I think I'm with Christian here... let sleeping dogs lie.
Now that a bug is released in binutils (I did not expect such a quick
response, kudos to them!), I can live with this patch not being applied.
But the reasoning is wrong, something was actually broken and you cannot
just ignore that.
As an aside, none of the files in /usr/{lib,bin} on my system were
compiled with this fatal combination of flags, except for systemd. It is
apparently not a common option.
I was also thinking about other adopters of systemd, like Debian. They
just disable gold[1] which would overcome the issue without this patch.
Though if they upgrade systemd in the future they will either have to
disable compat libs or otherwise run in the problem described at
https://bugs.freedesktop.org/show_bug.cgi?id=86666. Hmm, strange folks,
they use --enable-compat-libs but then remove[2] the libraries...?
--
Kind regards,
Peter
https://lekensteyn.nl
[1]: http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/patches/buildsys-Don-t-default-to-gold-as-the-linker.patch
[2]: http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/rules#n129
More information about the systemd-devel
mailing list