blob: 20895ad40da99d21537d0609f4ddaa58bf4dd36b [file] [log] [blame]
Andrew Geissler6ce62a22020-11-30 19:58:47 -06001# 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 = ""
25
26# Custom LTO flags
27# disable partitioning/streaming algorithm since its uses ASM
28# constructs not compatible with lto
29LTOEXTRA_pn-alsa-lib = "-flto-partition=none"
30
31LTOEXTRA ?= ""
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
44LTO ?= "-flto -ffat-lto-objects -fuse-linker-plugin ${LTOEXTRA}"
45
46SELECTED_OPTIMIZATION_append = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
47TARGET_LDFLAGS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
48
49SELECTED_OPTIMIZATION[vardeps] += "LTO LTOEXTRA"