On Tue, Aug 06, 2019 at 09:34:36AM +0200, Michael Biebl wrote: > Am Di., 6. Aug. 2019 um 09:26 Uhr schrieb Zbigniew Jędrzejewski-Szmek > <zbyszek@xxxxxxxxx>: > > > > On Sat, Aug 03, 2019 at 07:03:47PM +0200, Michael Biebl wrote: > > > Hi, > > > > > > today I tried compiling systemd v242 (on Debian sid) once using lto > > > (-Db_lto=true) and once without lto (-Db_lto=false). > > > > > > The lto build took approximately twice as long on my laptop (using > > > dpkg-buildpackage, which introduces a bit of overhead): > > > > > > lto: > > > real 11m22,605s > > > user 37m9,675s > > > sys 2m51,041s > > > > > > nolto: > > > real 6m35,615s > > > user 18m51,782s > > > sys 2m12,934s > > > > > > That's kinda expected. What suprised me though is that using lto > > > produced larger binaries: > > > > I built systemd in F31 (-Doptimization=2 -Db_lto=true/false, and I saw > > a big increase in binary sizes *before stripping*. After stripping, > > binaries with lto=true are smaller: > > > > $ ls -l build-rawhide{,-lto}/{systemd,src/shared/libsystemd-shared-243.so} > > 7116384 Aug 6 09:08 build-rawhide/systemd* > > 11951256 Aug 6 09:07 build-rawhide/src/shared/libsystemd-shared-243.so* > > 1594912 Aug 6 09:12 build-rawhide-lto/systemd* > > 3167096 Aug 6 09:11 build-rawhide-lto/src/shared/libsystemd-shared-243.so* > > $ strip build-rawhide{,-lto}/{systemd,src/shared/libsystemd-shared-243.so} > > $ ls -l build-rawhide{,-lto}/{systemd,src/shared/libsystemd-shared-243.so} > > 1439640 Aug 6 09:19 build-rawhide/systemd* > > 2806456 Aug 6 09:19 build-rawhide/src/shared/libsystemd-shared-243.so* > > 1370008 Aug 6 09:19 build-rawhide-lto/systemd* > > 2806288 Aug 6 09:19 build-rawhide-lto/src/shared/libsystemd-shared-243.so* > > > The sizes I posted i.e. the debdiff is after stripping. > > gcc --version > gcc (Debian 8.3.0-19) 8.3.0 > Copyright (C) 2018 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > ld --version > GNU ld (GNU Binutils for Debian) 2.32.51.20190727 > Copyright (C) 2019 Free Software Foundation, Inc. > This program is free software; you may redistribute it under the terms of > the GNU General Public License version 3 or (at your option) a later version. > > So with the toolchain I have, mostly has downsides. The only benefit > it seems to have is that it optimizes unnecessary library dependencies > away (see how the udev subpackage does not depend on libcap2 (>= > 1:2.10), libidn2-0 (>= 0.6) In Fedora, lto seems to have good returns. The final package size was ~10% smaller. We disabled it for a while because there were linking failures, but I think it's all resolved now. I forgot to mention. In my test: gcc-9.1.1-2.fc31.1.x86_64 binutils-2.32-19.fc31.x86_64 Zbyszek _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel