]> code.ossystems Code Review - openembedded-core.git/commitdiff
lto: Add global LTO distro policy file
authorKhem Raj <raj.khem@gmail.com>
Mon, 9 Nov 2020 00:02:07 +0000 (16:02 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 11 Nov 2020 10:04:34 +0000 (10:04 +0000)
Distros which want to enable LTO can utilize this file, it only covers
packages from OE-Core, other layers should include there own exclusion
list for recipe which dont work with LTO

Document the needed changes in local.conf.extended

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/conf/distro/include/lto.inc [new file with mode: 0644]
meta/conf/local.conf.sample.extended

diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc
new file mode 100644 (file)
index 0000000..fe0f6c9
--- /dev/null
@@ -0,0 +1,28 @@
+# To enable LTO, add following in local.conf
+# require conf/distro/include/lto.inc
+# DISTRO_FEATURES_append = " lto"
+#
+
+# Disable LTO for following packages
+LTO_pn-glibc = ""
+LTO_pn-gcc-runtime = ""
+LTO_pn-libgcc-initial = ""
+LTO_pn-libgcc = ""
+LTO_pn-libpam = ""
+LTO_pn-elfutils = ""
+LTO_pn-perl = ""
+LTO_pn-busybox = ""
+LTO_pn-libxcrypt = ""
+LTO_pn-curl = ""
+LTO_pn-libcap = ""
+LTO_pn-libproxy = ""
+LTO_pn-libbsd = ""
+
+# Override it for additional or different options if needed e.g.
+# with clang thin-lto might be better for compile speed
+LTO ?= "-flto"
+
+SELECTED_OPTIMIZATION_append = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
+TARGET_LDFLAGS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
+
+SELECTED_OPTIMIZATION[vardeps] += "LTO"
index 420b09b7d730d4f63cd40ab883d7fb76afd0bf34..5ece522fa85ea5ffa669908d965dc184a5884529 100644 (file)
 #VIRTUAL-RUNTIME_base-utils = "packagegroup-core-base-utils"
 #VIRTUAL-RUNTIME_base-utils-hwclock = "util-linux-hwclock"
 #VIRTUAL-RUNTIME_base-utils-syslog = "syslog"
+
+#
+# Enable LTO system-wide
+#
+#require conf/distro/include/lto.inc
+#DISTRO_FEATURES_append = " lto"