mesa/src/compiler/clc
Antoine Coutant 445aacb421 clc: retrieve libclang path at runtime.
LLVM_LIB_DIR is a variable used for runtime compilations.
When cross compiling, LLVM_LIB_DIR must be set to the
libclang path on the target. So, this path should not
be retrieved during compilation but at runtime.

dladdr uses an address to search for a loaded library.
If a library is found, it returns information about it.
The path to the libclang library can therefore be
retrieved using one of its functions. This is useful
because we don't know the name of the libclang library
(libclang.so.X or libclang-cpp.so.X)

v2 (Karol): use clang::CompilerInvocation::CreateFromArgs for dladdr
v3 (Karol): follow symlinks to fix errors on debian

Fixes: e22491c832 ("clc: fetch clang resource dir at runtime")
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by (v1): Jesse Natalie <jenatali@microsoft.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
2024-01-31 12:23:49 +00:00
..
clc.c treewide: Replace the include of nir_types.h with glsl_types.h 2023-12-30 15:08:11 +00:00
clc.h clc: add support for the native spir-v backend 2024-01-12 21:58:37 +00:00
clc_helpers.cpp clc: retrieve libclang path at runtime. 2024-01-31 12:23:49 +00:00
clc_helpers.h clc: silence a warn_unused_result 2024-01-18 15:20:46 +00:00
meson.build clc: force fPIC for every user when using shared LLVM 2024-01-31 12:23:49 +00:00
nir_clc_helpers.h nir: move the libclc lowering over to functions file. 2023-09-12 01:57:50 +00:00
nir_load_libclc.c nir/load_libclc: fix libclc memory leak 2023-10-11 03:05:23 +00:00