From patchwork Mon Jul 28 15:55:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 67565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69FA1C83F17 for ; Mon, 28 Jul 2025 15:56:08 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.84733.1753718160180804176 for ; Mon, 28 Jul 2025 08:56:00 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F6BA152B for ; Mon, 28 Jul 2025 08:55:51 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 30D8E3F5A1 for ; Mon, 28 Jul 2025 08:55:59 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/3] classes/toolchain/clang: compiler-rt and libcxx are not target-specific Date: Mon, 28 Jul 2025 16:55:52 +0100 Message-ID: <20250728155554.2624191-1-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 28 Jul 2025 15:56:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/221009 This file can be used for nativesdk builds, which if they are using the clang toolchain will also need compiler-rt and libcxx. Signed-off-by: Ross Burton --- meta/classes/toolchain/clang.bbclass | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/meta/classes/toolchain/clang.bbclass b/meta/classes/toolchain/clang.bbclass index 7c6ed57fb31..00cf6230408 100644 --- a/meta/classes/toolchain/clang.bbclass +++ b/meta/classes/toolchain/clang.bbclass @@ -26,8 +26,7 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-crosssdk = "clang-crosssdk- PREFERRED_PROVIDER_virtual/nativesdk-cross-cc:class-cross-canadian = "clang-crosssdk-${SDK_SYS}" PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-cross-canadian = "clang-crosssdk-${SDK_SYS}" - -BASE_DEFAULT_DEPS:append:class-target = " compiler-rt libcxx" +BASE_DEFAULT_DEPS:append = " compiler-rt libcxx" TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-prefix=/usr", "", d)}" From patchwork Mon Jul 28 15:55:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 67567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71C33C87FCE for ; Mon, 28 Jul 2025 15:56:08 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.84734.1753718160690424160 for ; Mon, 28 Jul 2025 08:56:00 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B5D4153B for ; Mon, 28 Jul 2025 08:55:52 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D8A313F5A1 for ; Mon, 28 Jul 2025 08:55:59 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/3] clang-cross: trim the recipe Date: Mon, 28 Jul 2025 16:55:53 +0100 Message-ID: <20250728155554.2624191-2-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250728155554.2624191-1-ross.burton@arm.com> References: <20250728155554.2624191-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 28 Jul 2025 15:56:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/221010 As a single clang-native build is a cross-compiler for all targets, this recipe should simply create target-prefixed symlinks. As such, it doesn't need to pull in the common clang include files, or set TOOLCHAIN. Unsetting PACKAGES isn't needed as cross inherits nopackages. The sysroot preprocessing is used to stage bindir, but cross recipes already stage this directory. There doesn't appear to be a need to copy clang, so these are now linked too. Signed-off-by: Ross Burton --- .../recipes-devtools/clang/clang-cross_git.bb | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/meta/recipes-devtools/clang/clang-cross_git.bb b/meta/recipes-devtools/clang/clang-cross_git.bb index 99e48522a0b..aef08c65e31 100644 --- a/meta/recipes-devtools/clang/clang-cross_git.bb +++ b/meta/recipes-devtools/clang/clang-cross_git.bb @@ -3,39 +3,22 @@ SUMMARY = "Cross compiler wrappers for LLVM based C/C++ compiler" HOMEPAGE = "http://clang.llvm.org/" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" SECTION = "devel" PN = "clang-cross-${TARGET_ARCH}" -BPN = "clang" -require common-clang.inc -require common-source.inc inherit cross -TOOLCHAIN = "clang" -DEPENDS += "clang-native virtual/cross-binutils" -#INHIBIT_PACKAGE_STRIP = "1" -INHIBIT_SYSROOT_STRIP = "1" +DEPENDS += "clang-native" + do_install() { install -d ${D}${bindir} - for tool in clang-tidy lld ld.lld llvm-profdata \ + for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata \ llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \ llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov do ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool done - install -m 0755 ${STAGING_BINDIR_NATIVE}/clang ${D}${bindir}/${TARGET_PREFIX}clang - install -m 0755 ${STAGING_BINDIR_NATIVE}/clang ${D}${bindir}/${TARGET_PREFIX}clang++ } -SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-lld *-ld.lld \ - *-llvm-nm *-llvm-ar *-llvm-as *-llvm-ranlib *-llvm-strip \ - *-llvm-objcopy *-llvm-objdump *-llvm-readelf *-llvm-addr2line \ - *-llvm-dwp *-llvm-size *-llvm-strings *-llvm-cov" - -SYSROOT_PREPROCESS_FUNCS += "clangcross_sysroot_preprocess" - -clangcross_sysroot_preprocess () { - sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir} -} -PACKAGES = "" From patchwork Mon Jul 28 15:55:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 67566 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B4EBC83F26 for ; Mon, 28 Jul 2025 15:56:08 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.85115.1753718161185407694 for ; Mon, 28 Jul 2025 08:56:01 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E487F152B for ; Mon, 28 Jul 2025 08:55:52 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 826903F5A1 for ; Mon, 28 Jul 2025 08:56:00 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/3] clang: split lld into a separate lld recipe Date: Mon, 28 Jul 2025 16:55:54 +0100 Message-ID: <20250728155554.2624191-3-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250728155554.2624191-1-ross.burton@arm.com> References: <20250728155554.2624191-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 28 Jul 2025 15:56:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/221011 The lld linker is a standalone project under the LLVM umbrella that just depends on libLLVM and nothing else, such as clang. To reduce the build time of clang if lld is not being used, split it out into a separate recipe. To ensure that lld is present if needed, the clang-cross recipe will depend on lld-native if ld-is-lld is enable. Signed-off-by: Ross Burton --- meta/conf/distro/include/maintainers.inc | 1 + .../recipes-devtools/clang/clang-cross_git.bb | 2 +- meta/recipes-devtools/clang/clang_git.bb | 8 +++----- meta/recipes-devtools/clang/lld_git.bb | 20 +++++++++++++++++++ 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 meta/recipes-devtools/clang/lld_git.bb diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index 927aac16d6d..5260bde36bc 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc @@ -480,6 +480,7 @@ RECIPE_MAINTAINER:pn-linux-yocto = "Bruce Ashfield " RECIPE_MAINTAINER:pn-linux-yocto-dev = "Bruce Ashfield " RECIPE_MAINTAINER:pn-linux-yocto-rt = "Bruce Ashfield " RECIPE_MAINTAINER:pn-linux-yocto-tiny = "Bruce Ashfield " +RECIPE_MAINTAINER:pn-lld = "Khem Raj " RECIPE_MAINTAINER:pn-lldb = "Khem Raj " RECIPE_MAINTAINER:pn-llvm-project-source-20.1.8 = "Khem Raj " RECIPE_MAINTAINER:pn-llvm-tblgen-native = "Khem Raj " diff --git a/meta/recipes-devtools/clang/clang-cross_git.bb b/meta/recipes-devtools/clang/clang-cross_git.bb index aef08c65e31..e60eccdc771 100644 --- a/meta/recipes-devtools/clang/clang-cross_git.bb +++ b/meta/recipes-devtools/clang/clang-cross_git.bb @@ -11,7 +11,7 @@ PN = "clang-cross-${TARGET_ARCH}" inherit cross -DEPENDS += "clang-native" +DEPENDS += "clang-native ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', 'lld-native', '', d)}" do_install() { install -d ${D}${bindir} diff --git a/meta/recipes-devtools/clang/clang_git.bb b/meta/recipes-devtools/clang/clang_git.bb index 830c0282cd6..60eb256e1ad 100644 --- a/meta/recipes-devtools/clang/clang_git.bb +++ b/meta/recipes-devtools/clang/clang_git.bb @@ -83,7 +83,7 @@ PACKAGECONFIG[eh] = "-DLLVM_ENABLE_EH=ON,-DLLVM_ENABLE_EH=OFF,," PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,," PACKAGECONFIG[libedit] = "-DLLVM_ENABLE_LIBEDIT=ON,-DLLVM_ENABLE_LIBEDIT=OFF,libedit libedit-native" PACKAGECONFIG[libomp] = "-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp,," -PACKAGECONFIG[lld] = "-DCLANG_DEFAULT_LINKER=lld,," +PACKAGECONFIG[lld] = "-DCLANG_DEFAULT_LINKER=lld,,,lld" PACKAGECONFIG[lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," PACKAGECONFIG[pfm] = "-DLLVM_ENABLE_LIBPFM=ON,-DLLVM_ENABLE_LIBPFM=OFF,libpfm," PACKAGECONFIG[rtti] = "-DLLVM_ENABLE_RTTI=ON,-DLLVM_ENABLE_RTTI=OFF,," @@ -133,7 +133,7 @@ HF[vardepvalue] = "${HF}" # Ensure that LLVM_PROJECTS does not contain compiler runtime components e.g. libcxx etc # they are enabled via LLVM_ENABLE_RUNTIMES -LLVM_PROJECTS ?= "clang;clang-tools-extra;lld" +LLVM_PROJECTS ?= "clang;clang-tools-extra" # linux hosts (.so) on Windows .pyd SOLIBSDEV:mingw32 = ".pyd" @@ -419,10 +419,8 @@ clang_sysroot_preprocess() { install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ install -m 0755 ${S}/llvm/tools/llvm-config/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV} - # LLDTargets.cmake references the lld executable(!) that some modules/plugins link to - install -d ${SYSROOT_DESTDIR}${bindir} - binaries="lld diagtool clang-${MAJOR_VER} clang-format clang-offload-packager + binaries="diagtool clang-${MAJOR_VER} clang-format clang-offload-packager clang-offload-bundler clang-scan-deps clang-repl clang-refactor clang-check clang-extdef-mapping clang-apply-replacements clang-reorder-fields clang-tidy clang-change-namespace clang-doc clang-include-fixer diff --git a/meta/recipes-devtools/clang/lld_git.bb b/meta/recipes-devtools/clang/lld_git.bb new file mode 100644 index 00000000000..6c8ba03c052 --- /dev/null +++ b/meta/recipes-devtools/clang/lld_git.bb @@ -0,0 +1,20 @@ +SUMMARY = "LLD - the LLVM Linker" +DESCRIPTION = "LLD is a linker from the LLVM project that is a drop-in replacement for system linkers and runs much faster than them." +HOMEPAGE = "https://lld.llvm.org" +SECTION = "devel" + +require common-clang.inc +require common-source.inc + +LIC_FILES_CHKSUM = "file://lld/LICENSE.TXT;md5=ae7dc7c027b1fa89b5b013d391d3ee2b" + +inherit cmake pkgconfig + +DEPENDS = "llvm-tblgen-native llvm" + +OECMAKE_SOURCEPATH = "${S}/lld" + +EXTRA_OECMAKE = "-DLLVM_INCLUDE_TESTS=OFF \ + -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen" + +BBCLASSEXTEND = "native nativesdk"