diff --git a/mesonbuild/compilers/asm.py b/mesonbuild/compilers/asm.py index d04fbd293..0cf8cffd3 100644 --- a/mesonbuild/compilers/asm.py +++ b/mesonbuild/compilers/asm.py @@ -27,6 +27,7 @@ nasm_optimization_args: T.Dict[str, T.List[str]] = { class NasmCompiler(Compiler): language = 'nasm' id = 'nasm' + links_with_msvc = False # https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features crt_args: T.Dict[str, T.List[str]] = { @@ -44,6 +45,7 @@ class NasmCompiler(Compiler): super().__init__(ccache, exelist, version, for_machine, info, linker, full_version, is_cross) if 'link' in self.linker.id: self.base_options.add(OptionKey('b_vscrt')) + self.links_with_msvc = True def needs_static_linker(self) -> bool: return True @@ -83,9 +85,7 @@ class NasmCompiler(Compiler): def get_debug_args(self, is_debug: bool) -> T.List[str]: if is_debug: - if self.info.is_windows(): - return [] - return ['-g', '-F', 'dwarf'] + return ['-g'] return [] def get_depfile_suffix(self) -> str: @@ -138,9 +138,12 @@ class YasmCompiler(NasmCompiler): def get_debug_args(self, is_debug: bool) -> T.List[str]: if is_debug: - if self.info.is_windows(): + if self.info.is_windows() and self.links_with_msvc: + return ['-g', 'cv8'] + elif self.info.is_darwin(): return ['-g', 'null'] - return ['-g', 'dwarf2'] + else: + return ['-g', 'dwarf2'] return [] def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]: