1# To enable LTO, add following in local.conf 2# require conf/distro/include/lto.inc 3# DISTRO_FEATURES:append = " lto" 4# 5 6# Disable LTO for following packages 7LTO:pn-glibc = "" 8LTO:pn-gcc-runtime = "" 9LTO:pn-libgcc-initial = "" 10LTO:pn-libgcc = "" 11LTO:pn-libaio = "" 12LTO:pn-libpam = "" 13LTO:pn-elfutils = "" 14LTO:pn-perl = "" 15LTO:pn-busybox = "" 16LTO:pn-libxcrypt = "" 17LTO:pn-curl = "" 18LTO:pn-libcap = "" 19LTO:pn-libproxy = "" 20LTO:pn-libbsd = "" 21LTO:pn-perf = "" 22# webkit is not linking properly with LTO, disable until next time 23LTO:pn-webkitgtk = "" 24LTO:pn-xserver-xorg = "" 25LTO:pn-grub = "" 26LTO:pn-grub-efi = "" 27 28# Custom LTO flags 29# disable partitioning/streaming algorithm since its uses ASM 30# constructs not compatible with lto 31LTOEXTRA:pn-alsa-lib = "-flto-partition=none" 32 33LTOEXTRA ?= "" 34 35# Override it for additional or different options if needed e.g. 36# with clang thin-lto might be better for compile speed 37# 38# ffat-lto-objects 39# object files that contain both the intermediate 40# language and the object code. This makes them 41# usable for both LTO linking and normal linking 42# 43# -fuse-linker-plugin 44# ensures that libraries participate in LTO by supplying intermediate 45# code from .a files to linker 46LTO ?= "-flto -ffat-lto-objects -fuse-linker-plugin ${LTOEXTRA}" 47 48SELECTED_OPTIMIZATION:append = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}" 49TARGET_LDFLAGS:append:class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}" 50 51SELECTED_OPTIMIZATION[vardeps] += "LTO LTOEXTRA" 52