On Sun, Feb 25, 2018 at 04:55:55PM +0100, Thomas Haller wrote:
Hi,
On Sun, 2018-02-25 at 12:30 +0000, Zbigniew Jędrzejewski-Szmek wrote:
> On Sun, Feb 25, 2018 at 01:19:24PM +0100, Florian Weimer wrote:
> > On 02/25/2018 12:45 PM, Zbigniew Jędrzejewski-Szmek wrote:
> > > > What's our current take on using LTO for Fedora package builds?
> > > systemd would like to use it.
> >
> > Why? What are the benefits?
>
> There's a small change in size. When I tested recently it was ~7%,
> but
> it was higher in the past. Fedora builds usually enable almost all
> optional
> code, but if some parts are disabled (which happens also in RHEL), I
> think
> the gains are bigger.
(you probably are aware, sorry for saying something trivial).
But we like to build NetworkManager with
-fdata-sections -ffunction-sections -Wl,--gc-sections
Yeah, we do that to. We autodetect during configuration if the
compiler supports that (the answer is yes almost always), and enable that.
That's probably what removed most of the gains from lto, because when
we initially enabled lto, we didn't do -f{data,function}-sections.
and let the linker figure out which static functions can be removed.
(we have unused static functions, because we build a static library
that is used by several binaries).
(you also need a linker script to hide static functions so that the
linker recognizes them as unused).
Yeah.
With this, the binary size savings are considerable and similar to
what
we'd get with LTO.
Yes, the ~7% savings I mentioned above are on top of that in
our case.
Zbyszek