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 80817b6e34.

Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3962
Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5609
Signed-off-by: Simon McVittie <smcv@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13720>
This commit is contained in:
Simon McVittie 2021-11-08 13:14:59 +00:00 committed by Marge Bot
parent cac6f633b2
commit 949b5787ee
1 changed files with 1 additions and 1 deletions

View File

@ -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']