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 <[email protected]> --- meta/conf/distro/include/lto.inc | 28 ++++++++++++++++++++++++++++ meta/conf/local.conf.sample.extended | 4 ++++ 2 files changed, 32 insertions(+) create mode 100644 meta/conf/distro/include/lto.inc diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc new file mode 100644 index 0000000000..fe0f6c9f44 --- /dev/null +++ b/meta/conf/distro/include/lto.inc @@ -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" diff --git a/meta/conf/local.conf.sample.extended b/meta/conf/local.conf.sample.extended index 9aa226a2d0..2c4b8ad8cb 100644 --- a/meta/conf/local.conf.sample.extended +++ b/meta/conf/local.conf.sample.extended @@ -417,3 +417,7 @@ # ERR_REPORT_UPLOAD_ALL = "1" # # INHERIT += "report-error" + +# Enable LTO Distro-wide +# require conf/distro/include/lto.inc +# DISTRO_FEATURES_append = " lto" -- 2.29.2
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#144373): https://lists.openembedded.org/g/openembedded-core/message/144373 Mute This Topic: https://lists.openembedded.org/mt/78125452/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
