diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-12-09 00:21:08 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-12-09 00:21:08 +0000 |
commit | 0a5bd7fc609d9e73fbe184d8bd7f620491d4af1e (patch) | |
tree | c4c236fc8cd2fb0d7db894d135dabbd3e6503a5f /lib | |
parent | e0936dcbae51267bed59b3c8df619bb250ce4c22 (diff) |
backport from Mesa upstream to fix i386 build with llvm 13
gallivm: fix FTBFS on i386 with LLVM >= 13, StackAlignmentOverride is gone
3a2d317b996f57647da23de7876142be4b9b71f3
gallivm: add new wrapper around Module::setOverrideStackAlignment()
c1b4c64a28d9fc093229eab91a3a7fc4cb4fe29a
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11940
ok sthen@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c | 4 | ||||
-rw-r--r-- | lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 11 | ||||
-rw-r--r-- | lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.h | 3 |
3 files changed, 17 insertions, 1 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c index dd428242c..8694b3923 100644 --- a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/lib/mesa/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/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 4f3e69681..3efa1d911 100644 --- a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/lib/mesa/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 @@ -596,3 +596,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/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.h index f2a15f19e..fa0ce9016 100644 --- a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.h +++ b/lib/mesa/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 |