| # 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-libgcc-initial = "" |
| # webkit is not linking properly with LTO, disable until next time |
| # disable partitioning/streaming algorithm since its uses ASM |
| # constructs not compatible with lto |
| LTOEXTRA:pn-alsa-lib = "-flto-partition=none" |
| # Override it for additional or different options if needed e.g. |
| # with clang thin-lto might be better for compile speed |
| # object files that contain both the intermediate |
| # language and the object code. This makes them |
| # usable for both LTO linking and normal linking |
| # ensures that libraries participate in LTO by supplying intermediate |
| # code from .a files to linker |
| LTO ?= "-flto -ffat-lto-objects -fuse-linker-plugin ${LTOEXTRA}" |
| 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 LTOEXTRA" |