diff options
| author | Nomura <nomura.rh@gmail.com> | 2023-04-26 21:29:59 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2023-05-06 19:57:06 +0300 |
| commit | c1fce8f60f3cbbdf72fb3b987f1d07c86b292c82 (patch) | |
| tree | 3914f5a723613bc1e6bf1e2631c1705c1870d586 /mesonbuild/compilers/asm.py | |
| parent | 1958ded04f2f072571e86bbd5e805c06a4b89704 (diff) | |
| download | meson-c1fce8f60f3cbbdf72fb3b987f1d07c86b292c82.tar.gz | |
Initial support for Metrowerks Assembler
Diffstat (limited to 'mesonbuild/compilers/asm.py')
| -rw-r--r-- | mesonbuild/compilers/asm.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mesonbuild/compilers/asm.py b/mesonbuild/compilers/asm.py index a156a17ba..17b11ba4c 100644 --- a/mesonbuild/compilers/asm.py +++ b/mesonbuild/compilers/asm.py @@ -3,6 +3,7 @@ import typing as T from ..mesonlib import EnvironmentException, OptionKey, get_meson_command from .compilers import Compiler +from .mixins.metrowerks import MetrowerksCompiler, mwasmarm_instruction_set_args, mwasmeppc_instruction_set_args if T.TYPE_CHECKING: from ..environment import Environment @@ -282,3 +283,48 @@ class MasmARMCompiler(Compiler): def depfile_for_object(self, objfile: str) -> T.Optional[str]: return None + + +class MetrowerksAsmCompiler(MetrowerksCompiler, Compiler): + language = 'nasm' + + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, + for_machine: 'MachineChoice', info: 'MachineInfo', + linker: T.Optional['DynamicLinker'] = None, + full_version: T.Optional[str] = None, is_cross: bool = False): + Compiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross) + MetrowerksCompiler.__init__(self) + + self.warn_args = {'0': [], '1': [], '2': [], '3': [], 'everything': []} # type: T.Dict[str, T.List[str]] + self.can_compile_suffixes.add('s') + + def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]: + return [] + + def get_pic_args(self) -> T.List[str]: + return [] + + def needs_static_linker(self) -> bool: + return True + + +class MetrowerksAsmCompilerARM(MetrowerksAsmCompiler): + id = 'mwasmarm' + + def get_instruction_set_args(self, instruction_set: str) -> T.Optional[T.List[str]]: + return mwasmarm_instruction_set_args.get(instruction_set, None) + + def sanity_check(self, work_dir: str, environment: 'Environment') -> None: + if self.info.cpu_family not in {'arm'}: + raise EnvironmentException(f'ASM compiler {self.id!r} does not support {self.info.cpu_family} CPU family') + + +class MetrowerksAsmCompilerEmbeddedPowerPC(MetrowerksAsmCompiler): + id = 'mwasmeppc' + + def get_instruction_set_args(self, instruction_set: str) -> T.Optional[T.List[str]]: + return mwasmeppc_instruction_set_args.get(instruction_set, None) + + def sanity_check(self, work_dir: str, environment: 'Environment') -> None: + if self.info.cpu_family not in {'ppc'}: + raise EnvironmentException(f'ASM compiler {self.id!r} does not support {self.info.cpu_family} CPU family') |
