commit 470381d40e6804b9c5de13556c9e60a6b9685a89 from: shrub date: Tue Mar 31 12:29:36 2026 UTC orcjit + stop dlopening commit - ac9b16a522f0c2fb288fd3c55d10b58f95f7be84 commit + 470381d40e6804b9c5de13556c9e60a6b9685a89 blob - ec37b14710614e0f31d454727768b4533db211e9 blob + 1583df7c5ad89ffbbc1674d99a20661f1f47555e --- lib/mesa/0001-static-lavapipe.patch +++ lib/mesa/0001-static-lavapipe.patch @@ -1,5 +1,5 @@ diff --git a/meson.build b/meson.build -index 5eaae977f67..f9023c9b402 100644 +index 5eaae97..f9023c9 100644 --- a/meson.build +++ b/meson.build @@ -1928,8 +1928,7 @@ if dep_llvm.found() @@ -48,21 +48,48 @@ index 5eaae977f67..f9023c9b402 100644 endif # Even if we find OpenMP, Gitlab CI fails to link with gcc/i386 and clang/anyarch. -diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c -index 6bd9f58a1d1..c09dd709eb4 100644 ---- a/src/gallium/auxiliary/draw/draw_context.c -+++ b/src/gallium/auxiliary/draw/draw_context.c -@@ -57,7 +57,7 @@ bool - draw_get_option_use_llvm(void) - { - #if DRAW_LLVM_AVAILABLE -- return debug_get_bool_option("DRAW_USE_LLVM", true); -+ return debug_get_bool_option("DRAW_USE_LLVM", false); - #else - return false; - #endif +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp +index 16357fb..0e1f520 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp ++++ b/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp +@@ -320,6 +320,26 @@ LLVMErrorRef module_transform_wrapper( + return LLVMOrcThreadSafeModuleWithModuleDo(*ModInOut, *module_transform, Ctx); + } + ++static llvm::Expected ++lpjit_create_static_process_symbols_jd(llvm::orc::LLJIT &J) ++{ ++ using llvm::orc::JITDylibSP; ++ ++ auto &ES = J.getExecutionSession(); ++ auto &JD = ES.createBareJITDylib("process_symbols"); ++ ++ /* ok, so lljit normally wires the process-symbols jitdylib to a ++ * DynamicLibrarySearchGenerator, which resolves the symbold through dlopen(NULL) ++ * for static we still need the process symbols jitdylib itself ++ * but we need definitions to come from explicit add_mapping_to_jd() ++ * calls instead of the host process loader ++ * ++ * this might mean we have to defin some external symbols in the future, ++ * if some new helper is called, and no one maps it ++ */ ++ return JITDylibSP(&JD); ++} ++ + LPJit::LPJit() :jit_dylib_count(0) { + using namespace llvm::orc; + +@@ -337,6 +357,8 @@ LPJit::LPJit() :jit_dylib_count(0) { + lljit = ExitOnErr( + LLJITBuilder() + .setJITTargetMachineBuilder(std::move(JTMB)) ++ .setLinkProcessSymbolsByDefault(true) ++ .setProcessSymbolsJITDylibSetup(*lpjit_create_static_process_symbols_jd) + #ifdef USE_JITLINK + .setObjectLinkingLayerCreator( + #if LLVM_VERSION_MAJOR >= 21 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp -index ce8ca02bf74..5689dcfeb4a 100644 +index ce8ca02..5689dcf 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -599,6 +599,9 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, @@ -96,21 +123,8 @@ index ce8ca02bf74..5689dcfeb4a 100644 *OutError = strdup(Error.c_str()); return 1; } -diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c -index 2b71e1bfffb..4a23ff7dd05 100644 ---- a/src/gallium/drivers/llvmpipe/lp_screen.c -+++ b/src/gallium/drivers/llvmpipe/lp_screen.c -@@ -140,7 +140,7 @@ llvmpipe_init_shader_caps(struct pipe_screen *screen) - case MESA_SHADER_GEOMETRY: - draw_init_shader_caps(caps); - -- if (debug_get_bool_option("DRAW_USE_LLVM", true)) { -+ if (debug_get_bool_option("DRAW_USE_LLVM", false)) { - caps->max_const_buffers = LP_MAX_TGSI_CONST_BUFFERS; - } else { - /* At this time, the draw module and llvmpipe driver only diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c -index 187f17ccf1b..51b67409311 100644 +index 187f17c..42de27a 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -27,6 +27,7 @@ @@ -179,17 +193,7 @@ index 187f17ccf1b..51b67409311 100644 result = vk_physical_device_init(&device->vk, &instance->vk, NULL, NULL, NULL, &dispatch_table); if (result != VK_SUCCESS) { -@@ -1598,9 +1644,6 @@ static struct drisw_loader_funcs lvp_sw_lf = { - static VkResult - lvp_enumerate_physical_devices(struct vk_instance *vk_instance) - { -- if (!draw_get_option_use_llvm()) -- return VK_SUCCESS; -- - struct lvp_instance *instance = - container_of(vk_instance, struct lvp_instance, vk); - -@@ -1642,6 +1685,13 @@ lvp_device_get_cache_uuid(void *uuid) +@@ -1642,6 +1688,13 @@ lvp_device_get_cache_uuid(void *uuid) memcpy(uuid, PACKAGE_VERSION, MIN2(strlen(PACKAGE_VERSION), VK_UUID_SIZE)); } @@ -203,7 +207,7 @@ index 187f17ccf1b..51b67409311 100644 VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceQueueFamilyProperties2( VkPhysicalDevice physicalDevice, uint32_t* pCount, -@@ -1745,6 +1795,41 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL lvp_GetInstanceProcAddr( +@@ -1745,6 +1798,41 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL lvp_GetInstanceProcAddr( pName); } @@ -245,7 +249,7 @@ index 187f17ccf1b..51b67409311 100644 /* The loader wants us to expose a second GetInstanceProcAddr function * to work around certain LD_PRELOAD issues seen in apps. */ -@@ -1756,6 +1841,14 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr( +@@ -1756,6 +1844,14 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr( return lvp_GetInstanceProcAddr(instance, pName); } @@ -260,7 +264,7 @@ index 187f17ccf1b..51b67409311 100644 static void destroy_pipelines(struct lvp_queue *queue) { -@@ -1887,12 +1980,43 @@ VKAPI_ATT