From 04d26ceb0a87ca9e05a00405e2544f256e8e046c Mon Sep 17 00:00:00 2001 From: Lepton Wu Date: Thu, 8 Feb 2024 14:41:06 -0800 Subject: [PATCH] llvmpipe: Set "+64bit" for X86_64 Without this, on some "buggy" qemu cpu setup, LLVM could crash if LLVM detects the wrong CPU type. Fixes: f92cadccc65 ("llvmpipe: Always using util_get_cpu_caps to get cpu caps for llvm on x86") Signed-off-by: Lepton Wu Reviewed-by: Yonggang Luo Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index a5e84d708f2..9cb213bb9e4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -416,6 +416,13 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, * so we do not use llvm::sys::getHostCPUFeatures to detect cpu features * but using util_get_cpu_caps() instead. */ +#if DETECT_ARCH_X86_64 + /* + * Without this, on some "buggy" qemu cpu setup, LLVM could crash + * if LLVM detects the wrong CPU type. + */ + MAttrs.push_back("+64bit"); +#endif MAttrs.push_back(util_get_cpu_caps()->has_sse ? "+sse" : "-sse" ); MAttrs.push_back(util_get_cpu_caps()->has_sse2 ? "+sse2" : "-sse2" ); MAttrs.push_back(util_get_cpu_caps()->has_sse3 ? "+sse3" : "-sse3" );