diff options
author | Ryan Eatmon <reatmon@ti.com> | 2024-11-04 15:15:31 -0600 |
---|---|---|
committer | Ryan Eatmon <reatmon@ti.com> | 2024-11-06 13:48:12 -0600 |
commit | 64ee95d661eebb5b09d00c86cd09d4a2c3c5971b (patch) | |
tree | ac99c90e0b8520e35e4e6c0440fd9b2a024fa465 | |
parent | 3881f1381e735cdbf3d66fb1539c296128f01afe (diff) | |
download | meta-ti-64ee95d661eebb5b09d00c86cd09d4a2c3c5971b.tar.gz |
mesa-pvr-22.3.5: Fix build issues with llvm 18+
Backport two fixes from the latest mesa project to fix two builds issues
related to newer llvm versions.
Signed-off-by: Ryan Eatmon <reatmon@ti.com>
3 files changed, 120 insertions, 0 deletions
diff --git a/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr-22.3.5/0001-fix-gallivm-fix-LLVM-include-of-Host-h-moved-to-TargetParser.patch b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr-22.3.5/0001-fix-gallivm-fix-LLVM-include-of-Host-h-moved-to-TargetParser.patch new file mode 100644 index 00000000..7d4fe078 --- /dev/null +++ b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr-22.3.5/0001-fix-gallivm-fix-LLVM-include-of-Host-h-moved-to-TargetParser.patch | |||
@@ -0,0 +1,65 @@ | |||
1 | From bb2db56ffec6e527d88751f75117ae690227cd6c Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Kai=20Wasserb=C3=A4ch?= <kai@dev.carbon-project.org> | ||
3 | Date: Sat, 11 Feb 2023 18:38:01 +0100 | ||
4 | Subject: [PATCH] fix: gallivm: fix LLVM #include of Host.h, moved to | ||
5 | TargetParser | ||
6 | |||
7 | Upstream moved Host.h from Support to TargetParser in LLVM 17. | ||
8 | |||
9 | This shouldn't lead to a FTBFS, since there is a forwarding include left | ||
10 | behind. Sadly the added deprecation warning #pragma is invalid and thus | ||
11 | causes a build failure right away. But since we would have to follow the | ||
12 | move anyway in the future, just do it right away. | ||
13 | |||
14 | Reference: https://github.com/llvm/llvm-project/commit/d768bf994f508d7eaf9541a568be3d71096febf5 | ||
15 | Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> | ||
16 | Closes: #8275 | ||
17 | Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21263> | ||
18 | |||
19 | Upstream-Status: Backport [https://gitlab.freedesktop.org/mesa/mesa/-/commit/bb2db56ffec6e527d88751f75117ae690227cd6c] | ||
20 | |||
21 | --- | ||
22 | src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 7 ++++++- | ||
23 | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 4 +++- | ||
24 | 2 files changed, 9 insertions(+), 2 deletions(-) | ||
25 | |||
26 | diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | ||
27 | index 54bc5d5ada36c..f78f04f042be8 100644 | ||
28 | --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | ||
29 | +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | ||
30 | @@ -35,9 +35,14 @@ | ||
31 | #include <llvm-c/Disassembler.h> | ||
32 | #include <llvm/Support/raw_ostream.h> | ||
33 | #include <llvm/Support/Format.h> | ||
34 | -#include <llvm/Support/Host.h> | ||
35 | #include <llvm/IR/Module.h> | ||
36 | |||
37 | +#if LLVM_VERSION_MAJOR >= 17 | ||
38 | +#include <llvm/TargetParser/Host.h> | ||
39 | +#else | ||
40 | +#include <llvm/Support/Host.h> | ||
41 | +#endif | ||
42 | + | ||
43 | #include "util/u_math.h" | ||
44 | #include "util/u_debug.h" | ||
45 | |||
46 | diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | ||
47 | index 334c13530394b..5e7a30a6cc2e3 100644 | ||
48 | --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | ||
49 | +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | ||
50 | @@ -60,7 +60,11 @@ | ||
51 | #include <llvm/Analysis/TargetLibraryInfo.h> | ||
52 | #include <llvm/ExecutionEngine/SectionMemoryManager.h> | ||
53 | #include <llvm/Support/CommandLine.h> | ||
54 | +#if LLVM_VERSION_MAJOR >= 17 | ||
55 | +#include <llvm/TargetParser/Host.h> | ||
56 | +#else | ||
57 | #include <llvm/Support/Host.h> | ||
58 | +#endif | ||
59 | #include <llvm/Support/PrettyStackTrace.h> | ||
60 | #include <llvm/ExecutionEngine/ObjectCache.h> | ||
61 | #include <llvm/Support/TargetSelect.h> | ||
62 | |||
63 | -- | ||
64 | GitLab | ||
65 | |||
diff --git a/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr-22.3.5/0001-gallium-Fix-build-with-llvm-18-and-19.patch b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr-22.3.5/0001-gallium-Fix-build-with-llvm-18-and-19.patch new file mode 100644 index 00000000..37888c34 --- /dev/null +++ b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr-22.3.5/0001-gallium-Fix-build-with-llvm-18-and-19.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 6c5033bb01a3a1341d4db5007586a5f2e2727b0a Mon Sep 17 00:00:00 2001 | ||
2 | From: Ryan Eatmon <reatmon@ti.com> | ||
3 | Date: Mon, 4 Nov 2024 13:37:29 -0600 | ||
4 | Subject: [PATCH] gallium: Fix build with llvm 18 and 19 | ||
5 | |||
6 | - CodeGenOpt::Level changed to CodeGenOoptLevel. [1] | ||
7 | - llvm::sys::getHostCPUFeatures() now returns the features instead of | ||
8 | modifying the passed in argument. [2] | ||
9 | |||
10 | Upstream-Status: Backport [1][https://gitlab.freedesktop.org/mesa/mesa/-/commit/f79617fe804ea6524651ff1bc3a91098d3199179] | ||
11 | Upstream-Status: Backport [2][https://gitlab.freedesktop.org/mesa/mesa/-/commit/fa9cd89a85b904615ebc11da609445b5b751e68d] | ||
12 | |||
13 | Signed-off-by: Ryan Eatmon <reatmon@ti.com> | ||
14 | --- | ||
15 | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 14 ++++++++++++-- | ||
16 | 1 file changed, 12 insertions(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | ||
19 | index 5e7a30a6cc2..dbc777e3096 100644 | ||
20 | --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | ||
21 | +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | ||
22 | @@ -368,7 +368,11 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, | ||
23 | builder.setEngineKind(EngineKind::JIT) | ||
24 | .setErrorStr(&Error) | ||
25 | .setTargetOptions(options) | ||
26 | +#if LLVM_VERSION_MAJOR >= 18 | ||
27 | + .setOptLevel((CodeGenOptLevel)OptLevel); | ||
28 | +#else | ||
29 | .setOptLevel((CodeGenOpt::Level)OptLevel); | ||
30 | +#endif | ||
31 | |||
32 | #ifdef _WIN32 | ||
33 | /* | ||
34 | @@ -392,8 +396,14 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, | ||
35 | * which allows us to enable/disable code generation based | ||
36 | * on the results of cpuid on these architectures. | ||
37 | */ | ||
38 | - llvm::StringMap<bool> features; | ||
39 | - llvm::sys::getHostCPUFeatures(features); | ||
40 | + #if LLVM_VERSION_MAJOR >= 19 | ||
41 | + /* llvm-19+ returns StringMap from getHostCPUFeatures. | ||
42 | + */ | ||
43 | + auto features = llvm::sys::getHostCPUFeatures(); | ||
44 | + #else | ||
45 | + llvm::StringMap<bool> features; | ||
46 | + llvm::sys::getHostCPUFeatures(features); | ||
47 | + #endif | ||
48 | |||
49 | for (StringMapIterator<bool> f = features.begin(); | ||
50 | f != features.end(); | ||
51 | -- | ||
52 | 2.17.1 | ||
53 | |||
diff --git a/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb index c93d01f9..bdc9ce16 100644 --- a/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb +++ b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb | |||
@@ -19,6 +19,8 @@ SRC_URI = " \ | |||
19 | file://0001-freedreno-pm4-Use-unsigned-instead-of-uint-to-fix-mu.patch \ | 19 | file://0001-freedreno-pm4-Use-unsigned-instead-of-uint-to-fix-mu.patch \ |
20 | file://0001-gallium-Fix-build-with-llvm-17.patch \ | 20 | file://0001-gallium-Fix-build-with-llvm-17.patch \ |
21 | file://0001-fix-gallivm-limit-usage-of-LLVMContextSetOpaquePoint.patch \ | 21 | file://0001-fix-gallivm-limit-usage-of-LLVMContextSetOpaquePoint.patch \ |
22 | file://0001-fix-gallivm-fix-LLVM-include-of-Host-h-moved-to-TargetParser.patch \ | ||
23 | file://0001-gallium-Fix-build-with-llvm-18-and-19.patch \ | ||
22 | " | 24 | " |
23 | 25 | ||
24 | S = "${WORKDIR}/git" | 26 | S = "${WORKDIR}/git" |