]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
clang: fix reproducibility issue in LLVMConfig.cmake
authorRoss Burton <ross.burton@arm.com>
Mon, 29 Sep 2025 17:11:24 +0000 (18:11 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 2 Oct 2025 10:27:31 +0000 (11:27 +0100)
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 <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
meta/recipes-devtools/clang/clang/0001-dont-expose-LLVM_HAVE_OPT_VIEWER_MODULES.patch [new file with mode: 0644]
meta/recipes-devtools/clang/common.inc

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 (file)
index 0000000..4f6ab6d
--- /dev/null
@@ -0,0 +1,29 @@
+From b6af0a5b42adfbebaca1ee673d4c1d9d10fbacfb Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+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 <ross.burton@arm.com>
+---
+ 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
+
index 512bf1dd02848f45bbd0cbc25828782417897f71..b8f7d410899ccc0e115db81350681754df9959f2 100644 (file)
@@ -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 ??= ""