Module: Mesa
Branch: main
Commit: 949b5787eec0c8903897b90cf2b4b2611c6407b8
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=949b5787eec0c8903897b90cf2b4b2611c6407b8

Author: Simon McVittie <[email protected]>
Date:   Mon Nov  8 13:14:59 2021 +0000

meson: Try to link all-targets module if Gallium OpenCL is enabled

If we don't do this, and we are statically linking LLVM
(-Dshared-llvm=disabled) while using a version of LLVM compiled for a
general-purpose distribution, then the link fails with undefined
references to the functions called by LLVMInitializeAllTargets().

Using a version of LLVM that was built specifically for Mesa will
sometimes mask this: if the only backends built into LLVM are backends
that we specifically link anyway, then the link will succeed.

According to commit 80817b6e "meson: Adjust Clover's required LLVM
modules", all-targets is not available when using CMake to locate LLVM,
so make it optional rather than mandatory.

This partially reverts commit 80817b6e344258ac9b955f824ebf9019a0fc1610.

Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3962
Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5609
Signed-off-by: Simon McVittie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13720>

---

 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 07f681ad5d8..94bbfd35940 100644
--- a/meson.build
+++ b/meson.build
@@ -1634,7 +1634,7 @@ if with_gallium_opencl
     'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',
     'lto', 'option', 'objcarcopts', 'profiledata'
   ]
-  llvm_optional_modules += ['frontendopenmp']
+  llvm_optional_modules += ['all-targets', 'frontendopenmp']
 endif
 if with_clc
   llvm_modules += ['coverage', 'target', 'linker', 'irreader', 'option', 
'libdriver', 'lto']

Reply via email to