From patchwork Mon Sep 29 17:11:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 71255 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 718E3CAC5B0 for ; Mon, 29 Sep 2025 17:11:33 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.3968.1759165892692396944 for ; Mon, 29 Sep 2025 10:11:32 -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 251D7150C for ; Mon, 29 Sep 2025 10:11:24 -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 C51423F59E for ; Mon, 29 Sep 2025 10:11:31 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/4] linux-firmware: skip ldflags sanity check Date: Mon, 29 Sep 2025 18:11:22 +0100 Message-ID: <20250929171125.2170364-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, 29 Sep 2025 17:11:33 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/224159 Some of the firmware blobs, for example qcom/apq8016/modem.mbn, are actually ELF files. We don't want to hold these to our exacting standard for link flags because we're not building them and they don't run on the target directly. Note that as this check parses the output of ${OBJDUMP} -p it behaves differently with binutils vs llvm. It looks like binutils bails early as it doesn't know what the target architecture is, whereas LLVM is more comprehensive in its support. Signed-off-by: Ross Burton --- .../recipes-kernel/linux-firmware/linux-firmware_20250917.bb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta/recipes-kernel/linux-firmware/linux-firmware_20250917.bb b/meta/recipes-kernel/linux-firmware/linux-firmware_20250917.bb index 5d5a5c8caee..1b9d1571042 100644 --- a/meta/recipes-kernel/linux-firmware/linux-firmware_20250917.bb +++ b/meta/recipes-kernel/linux-firmware/linux-firmware_20250917.bb @@ -2352,7 +2352,10 @@ python populate_packages:prepend () { # Firmware files are generally not ran on the CPU, so they can be # allarch despite being architecture specific -INSANE_SKIP = "arch" +INSANE_SKIP += "arch" + +# They can also be ELF files, but obviously won't have the linkage we expect +INSANE_SKIP += "ldflags" # Don't warn about already stripped files INSANE_SKIP:${PN} = "already-stripped" From patchwork Mon Sep 29 17:11:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 71256 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 602EACAC5B0 for ; Mon, 29 Sep 2025 17:11:43 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.3799.1759165893280483055 for ; Mon, 29 Sep 2025 10:11:33 -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 BFF00150C for ; Mon, 29 Sep 2025 10:11:24 -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 6D16B3F59E for ; Mon, 29 Sep 2025 10:11:32 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/4] clang: use EXTRA_OECMAKE += Date: Mon, 29 Sep 2025 18:11:23 +0100 Message-ID: <20250929171125.2170364-2-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250929171125.2170364-1-ross.burton@arm.com> References: <20250929171125.2170364-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, 29 Sep 2025 17:11:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/224160 Don't assign EXTRA_OECMAKE so that the include files can set defaults. Signed-off-by: Ross Burton --- meta/recipes-devtools/clang/libclc_git.bb | 2 +- meta/recipes-devtools/clang/lld_git.bb | 6 +++--- meta/recipes-devtools/clang/lldb_git.bb | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/meta/recipes-devtools/clang/libclc_git.bb b/meta/recipes-devtools/clang/libclc_git.bb index e56cf2eb6c0..60909339e70 100644 --- a/meta/recipes-devtools/clang/libclc_git.bb +++ b/meta/recipes-devtools/clang/libclc_git.bb @@ -21,7 +21,7 @@ B_NATIVE = "${B}-native" # Semicolon-separated list of targets to build LIBCLC_TARGETS ?= "all" -EXTRA_OECMAKE = "-DLIBCLC_TARGETS_TO_BUILD=${LIBCLC_TARGETS}" +EXTRA_OECMAKE += "-DLIBCLC_TARGETS_TO_BUILD=${LIBCLC_TARGETS}" EXTRA_OECMAKE:append:class-target = " -DPREPARE_BUILTINS=${B_NATIVE}/prepare_builtins" EXTRA_OECMAKE:append:class-nativesdk = " -DPREPARE_BUILTINS=${B_NATIVE}/prepare_builtins" diff --git a/meta/recipes-devtools/clang/lld_git.bb b/meta/recipes-devtools/clang/lld_git.bb index 02006e0edc9..b0261ad2cb6 100644 --- a/meta/recipes-devtools/clang/lld_git.bb +++ b/meta/recipes-devtools/clang/lld_git.bb @@ -19,8 +19,8 @@ OECMAKE_SOURCEPATH = "${S}/lld" # # Explicitly enable symlinks as the lld build doesn't call into the llvm setup # and turn that on. -EXTRA_OECMAKE = "-DCMAKE_SKIP_BUILD_RPATH=ON \ - -DLLVM_INCLUDE_TESTS=OFF -DLLVM_USE_SYMLINKS=ON \ - -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen" +EXTRA_OECMAKE += "-DCMAKE_SKIP_BUILD_RPATH=ON \ + -DLLVM_INCLUDE_TESTS=OFF -DLLVM_USE_SYMLINKS=ON \ + -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen" BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/clang/lldb_git.bb b/meta/recipes-devtools/clang/lldb_git.bb index eafc3cb3128..ecab8c09a75 100644 --- a/meta/recipes-devtools/clang/lldb_git.bb +++ b/meta/recipes-devtools/clang/lldb_git.bb @@ -16,15 +16,15 @@ DEPENDS = "llvm-tblgen-native clang" OECMAKE_SOURCEPATH = "${S}/lldb" -EXTRA_OECMAKE = "-DLLDB_INCLUDE_TESTS=OFF \ - -DLLDB_ENABLE_LUA=OFF \ - -DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \ - -DLLDB_PYTHON_EXE_RELATIVE_PATH=${PYTHON_PN} \ - -DLLDB_PYTHON_EXT_SUFFIX=${SOLIBSDEV} \ - -DLLVM_DIR=${STAGING_LIBDIR}/cmake/llvm/ \ - -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ - -DLLDB_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/lldb-tblgen \ - -DLLDB_NO_INSTALL_DEFAULT_RPATH=ON \ +EXTRA_OECMAKE += "-DLLDB_INCLUDE_TESTS=OFF \ + -DLLDB_ENABLE_LUA=OFF \ + -DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \ + -DLLDB_PYTHON_EXE_RELATIVE_PATH=${PYTHON_PN} \ + -DLLDB_PYTHON_EXT_SUFFIX=${SOLIBSDEV} \ + -DLLVM_DIR=${STAGING_LIBDIR}/cmake/llvm/ \ + -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ + -DLLDB_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/lldb-tblgen \ + -DLLDB_NO_INSTALL_DEFAULT_RPATH=ON \ " PACKAGECONFIG ??= "libedit libxml2 lzma" From patchwork Mon Sep 29 17:11:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 71258 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 607B3CCA46F for ; Mon, 29 Sep 2025 17:11:43 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.3801.1759165893947543369 for ; Mon, 29 Sep 2025 10:11:34 -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 67A7E150C for ; Mon, 29 Sep 2025 10:11:25 -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 14E7D3F59E for ; Mon, 29 Sep 2025 10:11:32 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/4] clang: fix reproducibility issue in LLVMConfig.cmake Date: Mon, 29 Sep 2025 18:11:24 +0100 Message-ID: <20250929171125.2170364-3-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250929171125.2170364-1-ross.burton@arm.com> References: <20250929171125.2170364-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, 29 Sep 2025 17:11:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/224161 The LLVMConfig.cmake file is mostly LLVM configuration, but it also specifies if some Python modules (needed by the opt-viewer tool) were present on the build host. This is host contamination and a source of non-determinism, so remove it from the installed file. A ticket has been filed upstream to resolve this: https://github.com/llvm/llvm-project/issues/161199 Signed-off-by: Ross Burton --- ...-expose-LLVM_HAVE_OPT_VIEWER_MODULES.patch | 29 +++++++++++++++++++ meta/recipes-devtools/clang/common.inc | 1 + 2 files changed, 30 insertions(+) create mode 100644 meta/recipes-devtools/clang/clang/0001-dont-expose-LLVM_HAVE_OPT_VIEWER_MODULES.patch diff --git a/meta/recipes-devtools/clang/clang/0001-dont-expose-LLVM_HAVE_OPT_VIEWER_MODULES.patch b/meta/recipes-devtools/clang/clang/0001-dont-expose-LLVM_HAVE_OPT_VIEWER_MODULES.patch new file mode 100644 index 00000000000..4f6ab6d00f5 --- /dev/null +++ b/meta/recipes-devtools/clang/clang/0001-dont-expose-LLVM_HAVE_OPT_VIEWER_MODULES.patch @@ -0,0 +1,29 @@ +From b6af0a5b42adfbebaca1ee673d4c1d9d10fbacfb Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Mon, 29 Sep 2025 14:44:05 +0100 +Subject: [PATCH] Don't expose LLVM_HAVE_OPT_VIEWER_MODULES externally + +This variable states whether at build-time some python modules were present, +which is meaningless and simply introduces non-deterministic behaviour. + +Upstream-Status: Pending [https://github.com/llvm/llvm-project/issues/161199] +Signed-off-by: Ross Burton +--- + llvm/cmake/modules/LLVMConfig.cmake.in | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in +index c15b9576cd5d..9cff70e4ef8e 100644 +--- a/llvm/cmake/modules/LLVMConfig.cmake.in ++++ b/llvm/cmake/modules/LLVMConfig.cmake.in +@@ -135,7 +135,6 @@ set(LLVM_DEFINITIONS "@LLVM_DEFINITIONS@") + set(LLVM_BINARY_DIR "@LLVM_CONFIG_BINARY_DIR@") + set(LLVM_CMAKE_DIR "@LLVM_CONFIG_CMAKE_DIR@") + set(LLVM_TOOLS_BINARY_DIR "@LLVM_CONFIG_TOOLS_BINARY_DIR@") +-set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@) + set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@) + set(LLVM_ENABLE_SHARED_LIBS @BUILD_SHARED_LIBS@) + +-- +2.43.0 + diff --git a/meta/recipes-devtools/clang/common.inc b/meta/recipes-devtools/clang/common.inc index 512bf1dd028..b8f7d410899 100644 --- a/meta/recipes-devtools/clang/common.inc +++ b/meta/recipes-devtools/clang/common.inc @@ -61,6 +61,7 @@ SRC_URI = "\ file://0038-Prevent-revisiting-block-when-searching-for-noreturn.patch \ file://0039-Only-build-c-index-test-when-clang-tests-are-include.patch \ file://0001-Install-lldb-tblgen.patch \ + file://0001-dont-expose-LLVM_HAVE_OPT_VIEWER_MODULES.patch \ " # Fallback to no-PIE if not set GCCPIE ??= "" From patchwork Mon Sep 29 17:11:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 71257 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 5DAE7CAC5B9 for ; Mon, 29 Sep 2025 17:11:43 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.3971.1759165894497101274 for ; Mon, 29 Sep 2025 10:11:34 -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 0F859150C for ; Mon, 29 Sep 2025 10:11:26 -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 B0E873F59E for ; Mon, 29 Sep 2025 10:11:33 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 4/4] clang: build with MinSizeRel Date: Mon, 29 Sep 2025 18:11:25 +0100 Message-ID: <20250929171125.2170364-4-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250929171125.2170364-1-ross.burton@arm.com> References: <20250929171125.2170364-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, 29 Sep 2025 17:11:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/224162 This is the recommended build configuration upstream unless speed is the ultimate goal. They say it's almost as fast as Release (-O3) but a lot smaller on disk: clang-libclang-cpp: PKGSIZE changed from 71729568 to 49368816 (-31%) clang-libllvm: PKGSIZE changed from 83015559 to 56662823 (-32%) clang-tidy: PKGSIZE changed from 15861679 to 9956175 (-37%) clang-tools: PKGSIZE changed from 6865635 to 5374691 (-22%) clang: PKGSIZE changed from 29693308 to 22697548 (-24%) libclang: PKGSIZE changed from 40087018 to 26966218 (-33%) Signed-off-by: Ross Burton --- meta/recipes-devtools/clang/clang_git.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/recipes-devtools/clang/clang_git.bb b/meta/recipes-devtools/clang/clang_git.bb index 53bca1c24f8..f25633a5861 100644 --- a/meta/recipes-devtools/clang/clang_git.bb +++ b/meta/recipes-devtools/clang/clang_git.bb @@ -112,7 +112,7 @@ EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \ -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \ -DCMAKE_SYSTEM_NAME=Linux \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ -DLLVM_ENABLE_PROJECTS='${LLVM_PROJECTS}' \ -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR} \ -DLLVM_VERSION_SUFFIX='${VER_SUFFIX}' \ @@ -175,7 +175,7 @@ do_install:append() { do_install:append:class-target () { # Allow bin path to change based on YOCTO_ALTERNATE_EXE_PATH - sed -i 's;${_IMPORT_PREFIX}/bin;${_IMPORT_PREFIX_BIN};g' ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake + sed -i 's;${_IMPORT_PREFIX}/bin;${_IMPORT_PREFIX_BIN};g' ${D}${libdir}/cmake/llvm/LLVMExports-*.cmake # Insert function to populate Import Variables sed -i "4i\ @@ -183,7 +183,7 @@ if(DEFINED ENV{YOCTO_ALTERNATE_EXE_PATH})\n\ execute_process(COMMAND \"llvm-config\" \"--bindir\" OUTPUT_VARIABLE _IMPORT_PREFIX_BIN OUTPUT_STRIP_TRAILING_WHITESPACE)\n\ else()\n\ set(_IMPORT_PREFIX_BIN \"\${_IMPORT_PREFIX}/bin\")\n\ -endif()\n" ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake +endif()\n" ${D}${libdir}/cmake/llvm/LLVMExports-*.cmake if [ -n "${LLVM_LIBDIR_SUFFIX}" ]; then mkdir -p ${D}${nonarch_libdir}