]> code.ossystems Code Review - openembedded-core.git/commitdiff
lto: Introduce LTOEXTRA variable
authorKhem Raj <raj.khem@gmail.com>
Mon, 9 Nov 2020 00:02:10 +0000 (16:02 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 11 Nov 2020 10:04:34 +0000 (10:04 +0000)
Certain packages may need additional flags to enable LTO, therefore
LTOEXTRA can be used to pass those flags

Add -flto-partition=none for alsa-lib

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/conf/distro/include/lto.inc

index d7fea26c642ced6e49341b66921c20dbb2b3589c..eb36b892ca93edab27320bba2a1dd916eda6e375 100644 (file)
@@ -18,6 +18,13 @@ LTO_pn-libcap = ""
 LTO_pn-libproxy = ""
 LTO_pn-libbsd = ""
 
+# Custom LTO flags
+# disable partitioning/streaming algorithm since its uses ASM
+# constructs not compatible with lto
+LTOEXTRA_pn-alsa-lib = "-flto-partition=none"
+
+LTOEXTRA ?= ""
+
 # Override it for additional or different options if needed e.g.
 # with clang thin-lto might be better for compile speed
 #
@@ -29,9 +36,9 @@ LTO_pn-libbsd = ""
 # -fuse-linker-plugin
 # ensures that libraries participate in LTO by supplying intermediate
 # code from .a files to linker
-LTO ?= "-flto -ffat-lto-objects -fuse-linker-plugin "
+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"
+SELECTED_OPTIMIZATION[vardeps] += "LTO LTOEXTRA"