Don't pass --allow-shlib-undefined to lld if it's not supported
Fixes builds with llvm-mingw
@@ -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):
