diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index dbd90b2c0..41b445ec7 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -659,7 +659,18 @@ class LLVMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dyna This is only the posix-like linker. """ - pass + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # Some targets don't seem to support this argument (windows, wasm, ...) + _, _, e = mesonlib.Popen_safe(self.exelist + self._apply_prefix('--allow-shlib-undefined')) + self.has_allow_shlib_undefined = not ('unknown argument: --allow-shlib-undefined' in e) + + def get_allow_undefined_args(self) -> typing.List[str]: + if self.has_allow_shlib_undefined: + return self._apply_prefix('--allow-shlib-undefined') + return [] + class CcrxDynamicLinker(DynamicLinker):