lto.inc: Add -ffat-lto-objects and -fuse-linker-plugin

This helps to improve LTO and ensure the libs can be linked with non-LTO
objects too

(From OE-Core rev: 770c69c51f87223eee7bd968fd28a5dc15a955d6)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2020-11-08 16:02:09 -08:00
committed by Richard Purdie
parent 3487d920f6
commit d20e270ecc

View File

@@ -20,7 +20,16 @@ LTO_pn-libbsd = ""
# Override it for additional or different options if needed e.g.
# with clang thin-lto might be better for compile speed
LTO ?= "-flto"
#
# ffat-lto-objects
# object files that contain both the intermediate
# language and the object code. This makes them
# usable for both LTO linking and normal linking
#
# -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 "
SELECTED_OPTIMIZATION_append = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
TARGET_LDFLAGS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"