diff mbox series

[5/5] mesa: Fix a build issue with clang-21

Message ID 20250728032045.2783514-5-raj.khem@gmail.com
State New
Headers show
Series [1/5] spirv-headers,spirv-tools: Upgrade to 1.4.321.0 release | expand

Commit Message

Khem Raj July 28, 2025, 3:20 a.m. UTC
This is a backport, helps compiling with upcoming clang-21

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...itch-to-new-non-owned-TargetOptions-.patch | 39 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc           |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-graphics/mesa/files/0001-fix-FTBFS-clc-switch-to-new-non-owned-TargetOptions-.patch
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/files/0001-fix-FTBFS-clc-switch-to-new-non-owned-TargetOptions-.patch b/meta/recipes-graphics/mesa/files/0001-fix-FTBFS-clc-switch-to-new-non-owned-TargetOptions-.patch
new file mode 100644
index 00000000000..2633869625b
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-fix-FTBFS-clc-switch-to-new-non-owned-TargetOptions-.patch
@@ -0,0 +1,39 @@ 
+From 531c6696d42953cd642dea7bf70153285c7949ae Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Kai=20Wasserb=C3=A4ch?= <kai@dev.carbon-project.org>
+Date: Tue, 6 May 2025 14:36:57 +0200
+Subject: [PATCH] fix(FTBFS): clc: switch to new non-owned `TargetOptions` for
+ LLVM 21
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream hid the `TargetOptions` in commit 985410f87f2d19910a8d327527fd30062b042b63
+
+Use the new `getTargetOpts()` to obtain the `TargetOptions` for
+`setTarget()`.
+
+Upstream-Status: Backport [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34835]
+
+Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
+Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13079
+Reference: https://github.com/llvm/llvm-project/commit/985410f87f2d19910a8d327527fd30062b042b63
+Reviewed-by: Karol Herbst <kherbst@redhat.com>
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34835>
+---
+ src/compiler/clc/clc_helpers.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/src/compiler/clc/clc_helpers.cpp
++++ b/src/compiler/clc/clc_helpers.cpp
+@@ -874,7 +874,11 @@ clc_compile_to_llvm_module(LLVMContext &
+                            diag_opts));
+ 
+    c->setTarget(clang::TargetInfo::CreateTargetInfo(
++#if LLVM_VERSION_MAJOR >= 21
++                   c->getDiagnostics(), c->getInvocation().getTargetOpts()));
++#else
+                    c->getDiagnostics(), c->getInvocation().TargetOpts));
++#endif
+ 
+    c->getFrontendOpts().ProgramAction = clang::frontend::EmitLLVMOnly;
+ 
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 58e3d9f7453..0d6f013ae10 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -18,6 +18,7 @@  SRC_URI = "https://archive.mesa3d.org/mesa-${PV}.tar.xz \
            file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
            file://0001-freedreno-don-t-encode-build-path-into-binaries.patch \
            file://0001-dont-build-clover-frontend.patch \
+           file://0001-fix-FTBFS-clc-switch-to-new-non-owned-TargetOptions-.patch \
 "
 
 SRC_URI[sha256sum] = "9f2b69eb39d2d8717d30a9868fdda3e0c0d3708ba32778bbac8ddb044538ce84"