packages/mesa/llvm-19.patch

85 lines
3.7 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# --- T2-COPYRIGHT-NOTE-BEGIN ---
# T2 SDE: package/*/mesa/llvm-19.patch
# Copyright (C) 2024 The T2 SDE Project
#
# This Copyright note is generated by scripts/Create-CopyPatch,
# more information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License version 2 as used by the T2 SDE.
# --- T2-COPYRIGHT-NOTE-END ---
commit 5a9c052ba78e5d1b0020b8f8320d211d2205a958
Author: Khem Raj <raj.khem@gmail.com>
Date: Mon Jul 1 23:09:29 2024 -0700
amd: Include missing llvm IR header Module.h
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
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11424
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29993>
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>
commit fa9cd89a85b904615ebc11da609445b5b751e68d
Author: Satadru Pramanik <satadru@umich.edu>
Date: Sat Oct 5 13:35:52 2024 +0000
Update lp_bld_misc.cpp to support llvm-19+.
Fixes #11896.
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31533>
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 7975fcf1ac9..5b615d627ff 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -329,8 +329,14 @@ lp_build_fill_mattrs(std::vector<std::string> &MAttrs)
* which allows us to enable/disable code generation based
* on the results of cpuid on these architectures.
*/
- llvm::StringMap<bool> features;
- llvm::sys::getHostCPUFeatures(features);
+ #if LLVM_VERSION_MAJOR >= 19
+ /* llvm-19+ returns StringMap from getHostCPUFeatures.
+ */
+ auto features = llvm::sys::getHostCPUFeatures();
+ #else
+ llvm::StringMap<bool> features;
+ llvm::sys::getHostCPUFeatures(features);
+ #endif
for (llvm::StringMapIterator<bool> f = features.begin();
f != features.end();