From: mark.yang@lge.com
To: openembedded-core@lists.openembedded.org
Cc: "mark.yang" <mark.yang@lge.com>
Subject: [PATCH] lto.inc: add clang specific LTO configuration
Date: Thu, 22 Jan 2026 14:51:43 +0900 [thread overview]
Message-ID: <20260122055143.2530158-1-mark.yang@lge.com> (raw)
From: "mark.yang" <mark.yang@lge.com>
This commit adds support for Clang-specific LTO options.
1. -fuse-linker-plugin is not supported by Clang.
2. -ffat-lto-objects is used to ensure that object files (.o) are generated as ELF
even when LTO is applied. During the dwarfsrcfiles process, if LTO is used
with the Clang toolchain, static library object files are skipped if they are
LLVM bitcode instead of ELF. Therefore, it is recommended to add this to
LTOEXTRA if necessary.
3. Adding 'thin-lto' to DISTRO_FEATURES enables -flto=thin.
Signed-off-by: mark.yang <mark.yang@lge.com>
---
meta/conf/distro/include/lto.inc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc
index b8193725a1..227f0c5c2a 100644
--- a/meta/conf/distro/include/lto.inc
+++ b/meta/conf/distro/include/lto.inc
@@ -45,6 +45,8 @@ LTOEXTRA ?= ""
# code from .a files to linker
LTO ?= "-flto -ffat-lto-objects -fuse-linker-plugin ${LTOEXTRA}"
+LTO:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', '-flto=thin ${LTOEXTRA}', '-flto ${LTOEXTRA}', d)}"
+
SELECTED_OPTIMIZATION:append = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
TARGET_LDFLAGS:append:class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
reply other threads:[~2026-01-22 5:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260122055143.2530158-1-mark.yang@lge.com \
--to=mark.yang@lge.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox