Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 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 |
| 7 | LTO_pn-glibc = "" |
| 8 | LTO_pn-gcc-runtime = "" |
| 9 | LTO_pn-libgcc-initial = "" |
| 10 | LTO_pn-libgcc = "" |
| 11 | LTO_pn-libaio = "" |
| 12 | LTO_pn-libpam = "" |
| 13 | LTO_pn-elfutils = "" |
| 14 | LTO_pn-perl = "" |
| 15 | LTO_pn-busybox = "" |
| 16 | LTO_pn-libxcrypt = "" |
| 17 | LTO_pn-curl = "" |
| 18 | LTO_pn-libcap = "" |
| 19 | LTO_pn-libproxy = "" |
| 20 | LTO_pn-libbsd = "" |
| 21 | LTO_pn-perf = "" |
| 22 | # webkit is not linking properly with LTO, disable until next time |
| 23 | LTO_pn-webkitgtk = "" |
| 24 | LTO_pn-xserver-xorg = "" |
| 25 | |
| 26 | # Custom LTO flags |
| 27 | # disable partitioning/streaming algorithm since its uses ASM |
| 28 | # constructs not compatible with lto |
| 29 | LTOEXTRA_pn-alsa-lib = "-flto-partition=none" |
| 30 | |
| 31 | LTOEXTRA ?= "" |
| 32 | |
| 33 | # Override it for additional or different options if needed e.g. |
| 34 | # with clang thin-lto might be better for compile speed |
| 35 | # |
| 36 | # ffat-lto-objects |
| 37 | # object files that contain both the intermediate |
| 38 | # language and the object code. This makes them |
| 39 | # usable for both LTO linking and normal linking |
| 40 | # |
| 41 | # -fuse-linker-plugin |
| 42 | # ensures that libraries participate in LTO by supplying intermediate |
| 43 | # code from .a files to linker |
| 44 | LTO ?= "-flto -ffat-lto-objects -fuse-linker-plugin ${LTOEXTRA}" |
| 45 | |
| 46 | SELECTED_OPTIMIZATION_append = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}" |
| 47 | TARGET_LDFLAGS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}" |
| 48 | |
| 49 | SELECTED_OPTIMIZATION[vardeps] += "LTO LTOEXTRA" |