Skip to content

Commit fd626e3

Browse files
William Tooheymon
authored andcommitted
Basic support for TI ARM-CLANG toolchain
1 parent 675b47b commit fd626e3

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Basic support for TI Arm Clang (tiarmclang)
2+
3+
Support for TI's newer [Clang-based ARM toolchain](https://www.ti.com/tool/ARM-CGT).

mesonbuild/linkers/detect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty
138138

139139
v = search_version(o + e)
140140
linker: DynamicLinker
141-
if 'LLD' in o.split('\n', maxsplit=1)[0]:
141+
if 'LLD' in o.split('\n', maxsplit=1)[0] or 'tiarmlnk' in e:
142142
if isinstance(comp_class.LINKER_PREFIX, str):
143143
cmd = compiler + override + [comp_class.LINKER_PREFIX + '-v'] + extra_args
144144
else:

mesonbuild/linkers/linkers.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -885,15 +885,36 @@ def __init__(self, exelist: T.List[str],
885885
super().__init__(exelist, for_machine, prefix_arg, always_args, version=version)
886886

887887
# Some targets don't seem to support this argument (windows, wasm, ...)
888-
_, _, e = mesonlib.Popen_safe(self.exelist + always_args + self._apply_prefix('--allow-shlib-undefined'))
889-
# Versions < 9 do not have a quoted argument
890-
self.has_allow_shlib_undefined = ('unknown argument: --allow-shlib-undefined' not in e) and ("unknown argument: '--allow-shlib-undefined'" not in e)
888+
self.has_allow_shlib_undefined = self._supports_flag('--allow-shlib-undefined', always_args)
889+
# These aren't supported by TI Arm Clang
890+
self.has_as_needed = self._supports_flag('--as-needed', always_args)
891+
self.has_no_undefined = self._supports_flag('--no-undefined', always_args)
892+
893+
def _supports_flag(self, flag: str, always_args: T.List[str]) -> bool:
894+
_, _, e = mesonlib.Popen_safe(self.exelist + always_args + self._apply_prefix(flag))
895+
return (
896+
# Versions < 9 do not have a quoted argument
897+
(f'unknown argument: {flag}' not in e) and
898+
(f"unknown argument: '{flag}'" not in e) and
899+
# TI Arm Clang uses a different message
900+
(f'invalid option: {flag}' not in e)
901+
)
891902

892903
def get_allow_undefined_args(self) -> T.List[str]:
893904
if self.has_allow_shlib_undefined:
894905
return self._apply_prefix('--allow-shlib-undefined')
895906
return []
896907

908+
def get_asneeded_args(self) -> T.List[str]:
909+
if self.has_as_needed:
910+
return self._apply_prefix('--as-needed')
911+
return []
912+
913+
def no_undefined_args(self) -> T.List[str]:
914+
if self.has_no_undefined:
915+
return self._apply_prefix('--no-undefined')
916+
return []
917+
897918
def get_thinlto_cache_args(self, path: str) -> T.List[str]:
898919
return ['-Wl,--thinlto-cache-dir=' + path]
899920

0 commit comments

Comments
 (0)