]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
llvm: add binutils-plugin PACKAGECONFIG for LLVMgold.so
authormark.yang <mark.yang@lge.com>
Tue, 24 Mar 2026 23:27:34 +0000 (08:27 +0900)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 5 Jun 2026 14:50:14 +0000 (15:50 +0100)
Add a 'binutils-plugin' PACKAGECONFIG option to selectively build
LLVMgold.so by passing -DLLVM_BINUTILS_INCDIR and adding binutils
to DEPENDS only when enabled.

LLVMgold.so is the LLVM LTO plugin for GNU ld BFD.
When using lld as the linker, this plugin is not needed since lld has
built-in LTO support. However, for toolchains that rely on BFD
this plugin is required to enable LTO.

binutils-plugin is named after Gentoo's USE flag convention for similar
functionality.

Signed-off-by: mark.yang <mark.yang@lge.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/clang/llvm_git.bb

index 96ea383731d5f54b42ca7e253d141cce12cf2501..e12ac11853b43f65e192d0e40dd8bf1edce8dd33 100644 (file)
@@ -79,6 +79,7 @@ PACKAGECONFIG[opt-viewer] = "-DLLVM_TOOL_OPT_VIEWER_BUILD=ON,-DLLVM_TOOL_OPT_VIE
                              python3-pyyaml python3-pygments,"
 PACKAGECONFIG[lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
 PACKAGECONFIG[thin-lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
+PACKAGECONFIG[binutils-plugin] = "-DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
 
 # LLVM debug symbols are very large (several gigabytes), reduce the debug level
 # so they're just hundreds of megabytes.
@@ -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"