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

Signed-off-by: Khem Raj <[email protected]>
---
 meta/conf/distro/include/lto.inc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc
index fe0f6c9f44..d7fea26c64 100644
--- a/meta/conf/distro/include/lto.inc
+++ b/meta/conf/distro/include/lto.inc
@@ -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)}"
-- 
2.29.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#144375): 
https://lists.openembedded.org/g/openembedded-core/message/144375
Mute This Topic: https://lists.openembedded.org/mt/78125454/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to