* [PATCH v2] llvm: enable LLVMgold.so build by adding binutils dependency
@ 2026-01-15 4:24 mark.yang
2026-01-19 18:12 ` [OE-core] " Ross Burton
0 siblings, 1 reply; 4+ messages in thread
From: mark.yang @ 2026-01-15 4:24 UTC (permalink / raw)
To: openembedded-core; +Cc: mark.yang
From: "mark.yang" <mark.yang@lge.com>
Currently, LLVMgold.so is not built because the binutils headers
are missing during the build process.
This allows LLVM to find the necessary headers and build the LLVMgold.so,
which is required for Link Time Optimization (LTO) support properly.
Signed-off-by: mark.yang <mark.yang@lge.com>
---
changes in v2:
- Add llvm-linker-tools package to include LLVMgold.so and libLTO.so
---
meta/recipes-devtools/clang/llvm_git.bb | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/clang/llvm_git.bb b/meta/recipes-devtools/clang/llvm_git.bb
index 96ea383731..108e884a6f 100644
--- a/meta/recipes-devtools/clang/llvm_git.bb
+++ b/meta/recipes-devtools/clang/llvm_git.bb
@@ -11,7 +11,7 @@ require common-source.inc
LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe"
-DEPENDS = "llvm-tblgen-native libffi libxml2 zlib zstd"
+DEPENDS = "llvm-tblgen-native libffi libxml2 zlib zstd binutils"
inherit cmake pkgconfig lib_package multilib_header
@@ -50,6 +50,7 @@ EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=MinSizeRel \
-DLLVM_TOOL_YAML2OBJ_BUILD=OFF \
-DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \
-DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
+ -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR} \
-DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain-native.cmake' \
"
@@ -126,6 +127,10 @@ llvm_sysroot_preprocess() {
install -m 0755 ${S}/llvm/tools/llvm-config/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
}
+PACKAGES =+ "llvm-linker-tools"
+
+FILES:llvm-linker-tools = "${libdir}/LLVMgold* ${libdir}/libLTO.so.*"
+
FILES:${PN}-dev += "${libdir}/llvm-config"
BBCLASSEXTEND = "native nativesdk"
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH v2] llvm: enable LLVMgold.so build by adding binutils dependency
2026-01-15 4:24 [PATCH v2] llvm: enable LLVMgold.so build by adding binutils dependency mark.yang
@ 2026-01-19 18:12 ` Ross Burton
2026-01-19 22:23 ` mark.yang
0 siblings, 1 reply; 4+ messages in thread
From: Ross Burton @ 2026-01-19 18:12 UTC (permalink / raw)
To: mark.yang@lge.com; +Cc: openembedded-core@lists.openembedded.org
On 15 Jan 2026, at 04:24, mark.yang via lists.openembedded.org <mark.yang=lge.com@lists.openembedded.org> wrote:
> -DEPENDS = "llvm-tblgen-native libffi libxml2 zlib zstd"
> +DEPENDS = "llvm-tblgen-native libffi libxml2 zlib zstd binutils"
This recipe already has an ‘lto’ PACKAGECONFIG that pulls in a dependency on binutils, so you shouldn’t need this line if you’d enabled the LTO distro-feature (or if not, the packageconfig).
Can you verify what is actually needed to enable the library build?
Ross
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] llvm: enable LLVMgold.so build by adding binutils dependency
2026-01-19 18:12 ` [OE-core] " Ross Burton
@ 2026-01-19 22:23 ` mark.yang
2026-03-03 10:37 ` Varatharajan, Deepesh
0 siblings, 1 reply; 4+ messages in thread
From: mark.yang @ 2026-01-19 22:23 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 982 bytes --]
Ross Burton, thank you for the review.
The build reproduction steps and the intention for this patch can be found in the v1 patch at https://lists.openembedded.org/g/openembedded-core/topic/117252728.
PACKAGECONFIG:remove:class-native = "lto thin-lto"
Due to the configuration, llvm-native cannot enable lto in PACKAGECONFIG in any way.
When attempting to use clang + lto, components that cannot use the lld linker (and instead use the bfd linker) require the LLVMgold.so plugin.
To achieve this, binutils and the -DLLVM_BINUTILS_INCDIR flag in CMake are required.
( https://github.com/llvm/llvm-project/blob/main/clang/docs/ThinLTO.rst#basic )
Anyway, llvm-native cannot have LTO enabled due to the `remove`.
-DLLVM_ENABLE_LTO=Full determines whether LLVM itself will be built with LTO applied.
However, even if LLVM is not built using LTO, I think the environment should still be configured so that other components using the LLVM/clang toolchain can use LTO.
[-- Attachment #2: Type: text/html, Size: 1404 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] llvm: enable LLVMgold.so build by adding binutils dependency
2026-01-19 22:23 ` mark.yang
@ 2026-03-03 10:37 ` Varatharajan, Deepesh
0 siblings, 0 replies; 4+ messages in thread
From: Varatharajan, Deepesh @ 2026-03-03 10:37 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]
On Tue, Jan 20, 2026 at 03:53 AM, mark.yang wrote:
>
> The build reproduction steps and the intention for this patch can be found
> in the v1 patch at https://lists.openembedded.org/g/openembedded-core/topic/117252728
> .
>
> PACKAGECONFIG:remove:class-native = "lto thin-lto"
> Due to the configuration, llvm-native cannot enable lto in PACKAGECONFIG
> in any way.
>
>
> When attempting to use clang + lto, components that cannot use the lld
> linker (and instead use the bfd linker) require the LLVMgold.so plugin.
> To achieve this, binutils and the -DLLVM_BINUTILS_INCDIR flag in CMake are
> required.
> ( https://github.com/llvm/llvm-project/blob/main/clang/docs/ThinLTO.rst#basic
> )
>
> Anyway, llvm-native cannot have LTO enabled due to the `remove`.
> -DLLVM_ENABLE_LTO=Full determines whether LLVM itself will be built with
> LTO applied.
>
> However, even if LLVM is not built using LTO, I think the environment
> should still be configured so that other components using the LLVM/clang
> toolchain can use LTO.
>
Hi Mark,
Thanks for the explanation. However, LTO builds are not part of the default workflow,
and adding binutils to DEPENDS would increase build time for all LLVM builds. I guess
passing -DLLVM_BINUTILS_INCDIR via a new PACKAGECONFIG is a better option without
impacting default builds.
Regards,
Deepesh
>
>
>
[-- Attachment #2: Type: text/html, Size: 1896 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-03 10:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-15 4:24 [PATCH v2] llvm: enable LLVMgold.so build by adding binutils dependency mark.yang
2026-01-19 18:12 ` [OE-core] " Ross Burton
2026-01-19 22:23 ` mark.yang
2026-03-03 10:37 ` Varatharajan, Deepesh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox