aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/linkers
diff options
context:
space:
mode:
authorWilliam Toohey <wtoohey@tritium.com.au>2023-02-20 15:57:27 +1000
committerWill Toohey <will@mon.im>2024-03-13 15:58:38 +1000
commitfd626e345a0e0f25eead718aa08586554244349d (patch)
tree798dafc9f5607c3dc69f036a50ee85b7322e22c1 /mesonbuild/linkers
parent675b47b0692131fae974298829ba807d730ab098 (diff)
downloadmeson-fd626e345a0e0f25eead718aa08586554244349d.zip
meson-fd626e345a0e0f25eead718aa08586554244349d.tar.gz
meson-fd626e345a0e0f25eead718aa08586554244349d.tar.bz2
Basic support for TI ARM-CLANG toolchain
Diffstat (limited to 'mesonbuild/linkers')
-rw-r--r--mesonbuild/linkers/detect.py2
-rw-r--r--mesonbuild/linkers/linkers.py27
2 files changed, 25 insertions, 4 deletions
diff --git a/mesonbuild/linkers/detect.py b/mesonbuild/linkers/detect.py
index 1bce413..15ce6cb 100644
--- a/mesonbuild/linkers/detect.py
+++ b/mesonbuild/linkers/detect.py
@@ -138,7 +138,7 @@ def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty
v = search_version(o + e)
linker: DynamicLinker
- if 'LLD' in o.split('\n', maxsplit=1)[0]:
+ if 'LLD' in o.split('\n', maxsplit=1)[0] or 'tiarmlnk' in e:
if isinstance(comp_class.LINKER_PREFIX, str):
cmd = compiler + override + [comp_class.LINKER_PREFIX + '-v'] + extra_args
else:
diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py
index 657e361..ca98d01 100644
--- a/mesonbuild/linkers/linkers.py
+++ b/mesonbuild/linkers/linkers.py
@@ -885,15 +885,36 @@ class LLVMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dyna
super().__init__(exelist, for_machine, prefix_arg, always_args, version=version)
# Some targets don't seem to support this argument (windows, wasm, ...)
- _, _, e = mesonlib.Popen_safe(self.exelist + always_args + self._apply_prefix('--allow-shlib-undefined'))
- # Versions < 9 do not have a quoted argument
- self.has_allow_shlib_undefined = ('unknown argument: --allow-shlib-undefined' not in e) and ("unknown argument: '--allow-shlib-undefined'" not in e)
+ self.has_allow_shlib_undefined = self._supports_flag('--allow-shlib-undefined', always_args)
+ # These aren't supported by TI Arm Clang
+ self.has_as_needed = self._supports_flag('--as-needed', always_args)
+ self.has_no_undefined = self._supports_flag('--no-undefined', always_args)
+
+ def _supports_flag(self, flag: str, always_args: T.List[str]) -> bool:
+ _, _, e = mesonlib.Popen_safe(self.exelist + always_args + self._apply_prefix(flag))
+ return (
+ # Versions < 9 do not have a quoted argument
+ (f'unknown argument: {flag}' not in e) and
+ (f"unknown argument: '{flag}'" not in e) and
+ # TI Arm Clang uses a different message
+ (f'invalid option: {flag}' not in e)
+ )
def get_allow_undefined_args(self) -> T.List[str]:
if self.has_allow_shlib_undefined:
return self._apply_prefix('--allow-shlib-undefined')
return []
+ def get_asneeded_args(self) -> T.List[str]:
+ if self.has_as_needed:
+ return self._apply_prefix('--as-needed')
+ return []
+
+ def no_undefined_args(self) -> T.List[str]:
+ if self.has_no_undefined:
+ return self._apply_prefix('--no-undefined')
+ return []
+
def get_thinlto_cache_args(self, path: str) -> T.List[str]:
return ['-Wl,--thinlto-cache-dir=' + path]