ports/compat-32 (3.6): mesa-32: fix build on llvm-13 https://gitlab.freedesktop.org/mesa/mesa/-/issues/4906
commit a55e538620df3589fc1c772fd4d91282dec2b902 Author: Danny Rawlins <contact@romster.me> Date: Sun Sep 26 19:40:07 2021 +1000 mesa-32: fix build on llvm-13 https://gitlab.freedesktop.org/mesa/mesa/-/issues/4906 diff --git a/mesa-32/.signature b/mesa-32/.signature index 2d1a69d..cd07eb1 100644 --- a/mesa-32/.signature +++ b/mesa-32/.signature @@ -1,6 +1,7 @@ untrusted comment: verify with /etc/ports/compat-32.pub -RWSwxGo/zH7eXRCwC6tgHrZBwT94l6c14ocFbSDJISncFJxqh1InL7yk5jZ5K3PB6s+8Js3k613k+m+XAJMJC0w5LAB3WOcaJQM= -SHA256 (Pkgfile) = 32dd97a77588c8e233740ac709f7de4f48c4a755f20a1159410bf7bb248a6140 +RWSwxGo/zH7eXUsEHA5gz2vMpqAE3HBNlIBfoTFmSgL0A5438cqNV2+dvr2qJN0MIhCDBaDQU+5F5Jy1mJBRrLDuA+K7mazaggs= +SHA256 (Pkgfile) = 16f2c1bc7db6c24bc25002bbd02be9b4dee37388156e31b80a6f37b723bf57db SHA256 (.footprint) = 780b1525e8bf8a789c2aa204c5970636473be4cc1a6eb1925996af6df2842b84 SHA256 (mesa-21.2.2.tar.xz) = c4aaf1bf974217ed825e1c536de6ab72a4e266d44bcf69fc4ec499039f99e5c4 SHA256 (x86-linux-gnu) = 448877bbe3efe8bdfe6282c8e730fe8a8b6bf3c07f659e71b7292aceca22d8bd +SHA256 (gallium-llvm13.patch) = 78a877aed2965ba1bfb0bb9cb81dd176c84f7609c6a20ac76803df37532ccec5 diff --git a/mesa-32/Pkgfile b/mesa-32/Pkgfile index 1d54688..e9be69b 100644 --- a/mesa-32/Pkgfile +++ b/mesa-32/Pkgfile @@ -8,12 +8,15 @@ name=mesa-32 version=21.2.2 release=1 source=(https://archive.mesa3d.org/mesa-$version.tar.xz - x86-linux-gnu) + x86-linux-gnu + gallium-llvm13.patch) build() { prt-get isinst wayland-32 wayland-protocols && PKGMK_MESA_PLATFORMS+=',wayland' prt-get isinst glslang && PKGMK_MESA_PLATFORMS+=' -D vulkan-overlay-layer=true -D vulkan-device-select-layer=true' + patch -d mesa-$version -p1 -i $SRC/gallium-llvm13.patch + meson setup mesa-$version build $PKGMK_MESA3D \ --cross-file=$SRC/x86-linux-gnu \ --prefix=/usr \ diff --git a/mesa-32/gallium-llvm13.patch b/mesa-32/gallium-llvm13.patch new file mode 100644 index 0000000..6d168a2 --- /dev/null +++ b/mesa-32/gallium-llvm13.patch @@ -0,0 +1,113 @@ +From c1b4c64a28d9fc093229eab91a3a7fc4cb4fe29a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kai=20Wasserb=C3=A4ch?= <kai@dev.carbon-project.org> +Date: Thu, 22 Jul 2021 07:34:09 +0200 +Subject: [PATCH 1/2] gallivm: add new wrapper around + Module::setOverrideStackAlignment() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We need it in the next commit to replace setting the stack alignment on +i386 with LLVM >= 13 through the TargetOption::StackAlignmentOverride, +which was removed in the upstream commit +<https://github.com/llvm/llvm-project/commit/3787ee457173c3612aac4c9b1a2b6d6ab0202616>. + +Unfortunately Module::setOverrideStackAlignment() is not available +through the C API and we need to wrap it ourselves. + +Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org> +Reference: mesa/mesa#4906 +Reviewed-by: Roland Scheidegger <sroland@vmware.com> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11940> +--- + src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 9 +++++++++ + src/gallium/auxiliary/gallivm/lp_bld_misc.h | 3 +++ + 2 files changed, 12 insertions(+) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +index 44d07fe69c6..5f52ed08fae 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp ++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +@@ -615,3 +615,12 @@ lp_is_function(LLVMValueRef v) + { + return LLVMGetValueKind(v) == LLVMFunctionValueKind; + } ++ ++extern "C" void ++lp_set_module_stack_alignment_override(LLVMModuleRef MRef, unsigned align) ++{ ++#if LLVM_VERSION_MAJOR >= 13 ++ llvm::Module *M = llvm::unwrap(MRef); ++ M->setOverrideStackAlignment(align); ++#endif ++} +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h +index f2a15f19e47..fa0ce90162e 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h ++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h +@@ -91,6 +91,9 @@ lp_is_function(LLVMValueRef v); + + void + lp_free_objcache(void *objcache); ++ ++void ++lp_set_module_stack_alignment_override(LLVMModuleRef M, unsigned align); + #ifdef __cplusplus + } + #endif +-- +GitLab + + +From 3a2d317b996f57647da23de7876142be4b9b71f3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kai=20Wasserb=C3=A4ch?= <kai@dev.carbon-project.org> +Date: Thu, 22 Jul 2021 07:42:12 +0200 +Subject: [PATCH 2/2] gallivm: fix FTBFS on i386 with LLVM >= 13, + StackAlignmentOverride is gone +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the newly added wrapper lp_set_module_stack_alignment_override() to +achieve the same end result. + +Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org> +Closes: mesa/mesa#4906 +Reviewed-by: Roland Scheidegger <sroland@vmware.com> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11940> +--- + src/gallium/auxiliary/gallivm/lp_bld_init.c | 4 ++++ + src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c +index 8e5fe6f24dc..d2d049ace5e 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c ++++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c +@@ -347,6 +347,10 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name, + if (!gallivm->module) + goto fail; + ++#if defined(PIPE_ARCH_X86) ++ lp_set_module_stack_alignment_override(gallivm->module, 4); ++#endif ++ + gallivm->builder = LLVMCreateBuilderInContext(gallivm->context); + if (!gallivm->builder) + goto fail; +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +index 5f52ed08fae..be288ab02e2 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp ++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +@@ -350,7 +350,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, + * friends for configuring code generation options, like stack alignment. + */ + TargetOptions options; +-#if defined(PIPE_ARCH_X86) ++#if defined(PIPE_ARCH_X86) && LLVM_VERSION_MAJOR < 13 + options.StackAlignmentOverride = 4; + #endif + +-- +GitLab +
participants (1)
-
crux@crux.nu