Mesa3D draw module: Unresolved symbols when static linking LLVM 15

I need help fixing these 3 unresolved symbols

ninja: Entering directory `C:\Software\Development\projects\mesa\build\msvc-x64'
[2/40] Linking target src/gallium/drivers/llvmpipe/lp_test_format.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_format.exe src/gallium/drivers/llvmpipe/lp_test_format.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_format.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_format.exe : fatal error LNK1120: 3 unresolved externals
[3/40] Linking target src/gallium/drivers/llvmpipe/lp_test_arit.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_arit.exe src/gallium/drivers/llvmpipe/lp_test_arit.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_arit.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_arit.exe : fatal error LNK1120: 3 unresolved externals
[4/40] Linking target src/gallium/drivers/llvmpipe/lp_test_blend.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_blend.exe src/gallium/drivers/llvmpipe/lp_test_blend.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_blend.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_blend.exe : fatal error LNK1120: 3 unresolved externals
[5/40] Linking target src/gallium/drivers/llvmpipe/lp_test_conv.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_conv.exe src/gallium/drivers/llvmpipe/lp_test_conv.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_conv.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_conv.exe : fatal error LNK1120: 3 unresolved externals
[6/40] Linking target src/gallium/drivers/llvmpipe/lp_test_printf.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_printf.exe src/gallium/drivers/llvmpipe/lp_test_printf.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_printf.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_printf.exe : fatal error LNK1120: 3 unresolved externals
[7/40] Linking target src/gallium/targets/osmesa/osmesa.dll
FAILED: src/gallium/targets/osmesa/osmesa.dll src/gallium/targets/osmesa/osmesa.pdb
"link" @src/gallium/targets/osmesa/osmesa.dll.rsp
   Creating library src\gallium\targets/osmesa\osmesa.lib and object src\gallium\targets/osmesa\osmesa.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\osmesa\osmesa.dll : fatal error LNK1120: 3 unresolved externals
[8/40] Linking target src/gallium/targets/d3d10sw/d3d10sw.dll
FAILED: src/gallium/targets/d3d10sw/d3d10sw.dll src/gallium/targets/d3d10sw/d3d10sw.pdb
"link" @src/gallium/targets/d3d10sw/d3d10sw.dll.rsp
   Creating library src\gallium\targets/d3d10sw\d3d10sw.lib and object src\gallium\targets/d3d10sw\d3d10sw.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\d3d10sw\d3d10sw.dll : fatal error LNK1120: 3 unresolved externals
[9/40] Linking target src/gallium/targets/libgl-d3d12/openglon12.dll
FAILED: src/gallium/targets/libgl-d3d12/openglon12.dll src/gallium/targets/libgl-d3d12/openglon12.pdb
"link" @src/gallium/targets/libgl-d3d12/openglon12.dll.rsp
   Creating library src\gallium\targets/libgl-d3d12\openglon12.lib and object src\gallium\targets/libgl-d3d12\openglon12.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\libgl-d3d12\openglon12.dll : fatal error LNK1120: 3 unresolved externals
[10/40] Linking target src/gallium/targets/wgl/libgallium_wgl.dll
FAILED: src/gallium/targets/wgl/libgallium_wgl.dll src/gallium/targets/wgl/libgallium_wgl.pdb
"link" @src/gallium/targets/wgl/libgallium_wgl.dll.rsp
   Creating library src\gallium\targets/wgl\libgallium_wgl.lib and object src\gallium\targets/wgl\libgallium_wgl.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\wgl\libgallium_wgl.dll : fatal error LNK1120: 3 unresolved externals
[11/40] Linking target src/gallium/targets/graw-gdi/graw.dll
FAILED: src/gallium/targets/graw-gdi/graw.dll src/gallium/targets/graw-gdi/graw.pdb
"link" @src/gallium/targets/graw-gdi/graw.dll.rsp
   Creating library src\gallium\targets/graw-gdi\graw.lib and object src\gallium\targets/graw-gdi\graw.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\graw-gdi\graw.dll : fatal error LNK1120: 3 unresolved externals
[12/40] Linking target src/gallium/targets/lavapipe/vulkan_lvp.dll
FAILED: src/gallium/targets/lavapipe/vulkan_lvp.dll src/gallium/targets/lavapipe/vulkan_lvp.pdb
"link" @src/gallium/targets/lavapipe/vulkan_lvp.dll.rsp
   Creating library src\gallium\targets/lavapipe\vulkan_lvp.lib and object src\gallium\targets/lavapipe\vulkan_lvp.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\lavapipe\vulkan_lvp.dll : fatal error LNK1120: 3 unresolved externals
[13/40] Linking target src/mesa/main/tests/main_test.exe
FAILED: src/mesa/main/tests/main_test.exe src/mesa/main/tests/main_test.pdb
"link" @src/mesa/main/tests/main_test.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\mesa\main\tests\main_test.exe : fatal error LNK1120: 3 unresolved externals
[14/40] Linking target src/mesa/state_tracker/tests/st_format_test.exe
FAILED: src/mesa/state_tracker/tests/st_format_test.exe src/mesa/state_tracker/tests/st_format_test.pdb
"link" @src/mesa/state_tracker/tests/st_format_test.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\mesa\state_tracker\tests\st_format_test.exe : fatal error LNK1120: 3 unresolved externals
ninja: build stopped: cannot make progress due to previous errors.

I know that if Microsoft CLC build is enabled, this issue is worked around, so at least one of these modules is necessary. But which?

if with_clc
  llvm_modules += ['coverage', 'target', 'linker', 'irreader', 'option', 'libdriver', 'lto']
  llvm_optional_modules += ['all-targets']
endif

I want to send a merge request fixing this issue on Mesa3D.
Mesa3D issue tracker: Static linking LLVM 15 fails with unresolved symbols if not building CLC (#7487) · Issues · Mesa / mesa · GitLab