diff mbox series

systemd: Build with LTO

Message ID 20181009193340.26242-1-abrodkin@synopsys.com
State Changes Requested
Headers show
Series systemd: Build with LTO | expand

Commit Message

Alexey Brodkin Oct. 9, 2018, 7:33 p.m. UTC
Usage of LTO allows to shave off some size of the binaries.
For example libsystemd for Aarch64:
  libsystemd.so.0.23.0-LTO	- 467K
  libsystemd.so.0.23.0-no-LTO	- 523K

Build-tetsed for ARC and ARM, run-tested on ARC.

Prerequisite is fix for Meson:
https://patchwork.ozlabs.org/patch/981496/

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Romain Naour <romain.naour@gmail.com>
Cc: Jeremy Rosen <jeremy.rosen@smile.fr>

---
 package/systemd/systemd.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni Oct. 9, 2018, 7:49 p.m. UTC | #1
Hello,

On Tue,  9 Oct 2018 22:33:40 +0300, Alexey Brodkin wrote:

> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index 4813496670..ebd29c89b0 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -38,7 +38,8 @@ SYSTEMD_CONF_OPTS += \
>  	-Dsulogin-path=/usr/sbin/sulogin \
>  	-Dmount-path=/usr/bin/mount \
>  	-Dumount-path=/usr/bin/umount \
> -	-Dnobody-group=nogroup
> +	-Dnobody-group=nogroup \
> +	-Db_lto=true

I don't think we can do this unconditionally. We have a bunch of
options such as BR2_BINUTILS_ENABLE_LTO and BR2_GCC_ENABLE_LTO to
enable LTO support in the internal toolchain, and we don't today have a
way to know if the external toolchain provided supports LTO or not.

So this needs a much more generic solution:

 - A global Config.in option to enable/disable usage of LTO. It will
   have to interact with the toolchain LTO support.

 - An option that tells whether the toolchain supports LTO. For
   internal toolchains, it's simply selected by BR2_GCC_ENABLE_LTO. For
   external toolchains, we need a check to verify that the toolchain is
   LTO + a visible option for custom external toolchains.

So: yes for using LTO, but we need something more generic.

Best regards,

Thomas
diff mbox series

Patch

diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 4813496670..ebd29c89b0 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -38,7 +38,8 @@  SYSTEMD_CONF_OPTS += \
 	-Dsulogin-path=/usr/sbin/sulogin \
 	-Dmount-path=/usr/bin/mount \
 	-Dumount-path=/usr/bin/umount \
-	-Dnobody-group=nogroup
+	-Dnobody-group=nogroup \
+	-Db_lto=true
 
 # disable unsupported features for non-glibc toolchains
 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)