diff mbox series

mesa: Including missing LLVM header

Message ID 20240702062619.1072589-1-raj.khem@gmail.com
State New
Headers show
Series mesa: Including missing LLVM header | expand

Commit Message

Khem Raj July 2, 2024, 6:26 a.m. UTC
This issue happens with LLVM trunk

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...lude-missing-llvm-IR-header-Module.h.patch | 41 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc           |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch b/meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch
new file mode 100644
index 00000000000..82ad88a079c
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch
@@ -0,0 +1,41 @@ 
+From 777d69cf15b80ab1f109a4936d6e4801c4b0e0f3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 1 Jul 2024 23:09:29 -0700
+Subject: [PATCH] amd: Include missing llvm IR header Module.h
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+With LLVM-19, Module.h header is not being pulled, which results in
+compile errors e.g.
+
+src/amd/llvm/ac_llvm_helper.cpp:102:10: error: no matching function for call to ‘unwrap(LLVMOpaqueModule*&)’
+  102 |    unwrap(module)->setTargetTriple(TM->getTargetTriple().getTriple());
+      |    ~~~~~~^~~~~~~~
+In file included from /mnt/b/yoe/master/build/tmp/work/x86_64-linux/mesa-native/24.0.7/recipe-sysroot-native/usr/include/llvm/IR/Type.h:18,
+                 from /mnt/b/yoe/master/build/tmp/work/x86_64-linux/mesa-native/24.0.7/recipe-sysroot-native/usr/include/llvm/IR/DerivedTypes.h:23,
+                 from /mnt/b/yoe/master/build/tmp/work/x86_64-linux/mesa-native/24.0.7/recipe-sysroot-native/usr/include/llvm/IR/InstrTypes.h:26,
+                 from /mnt/b/yoe/master/build/tmp/work/x86_64-linux/mesa-native/24.0.7/recipe-sysroot-native/usr/include/llvm/Analysis/TargetLibraryInfo.h:14,
+                 from ../mesa-24.0.7/src/amd/llvm/ac_llvm_helper.cpp:8:
+
+Its getting the definition from llvm/IR/Type.h instead of Module.h and caused
+confusion to compiler
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29993]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/amd/llvm/ac_llvm_helper.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp
+index 5d065279ad1..af4a50f8409 100644
+--- a/src/amd/llvm/ac_llvm_helper.cpp
++++ b/src/amd/llvm/ac_llvm_helper.cpp
+@@ -8,6 +8,7 @@
+ #include <llvm/Analysis/TargetLibraryInfo.h>
+ #include <llvm/IR/IRBuilder.h>
+ #include <llvm/IR/LegacyPassManager.h>
++#include <llvm/IR/Module.h>
+ #include <llvm/IR/Verifier.h>
+ #include <llvm/Target/TargetMachine.h>
+ #include <llvm/MC/MCSubtargetInfo.h>
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 2581ccb1202..272d57c7496 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -19,6 +19,7 @@  SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
            file://0001-drisw-fix-build-without-dri3.patch \
            file://0002-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch \
            file://0001-Revert-meson-do-not-pull-in-clc-for-clover.patch \
+           file://0001-amd-Include-missing-llvm-IR-header-Module.h.patch \
 "
 
 SRC_URI[sha256sum] = "7454425f1ed4a6f1b5b107e1672b30c88b22ea0efea000ae2c7d96db93f6c26a"