summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/rust.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-10-14 09:36:17 +0200
committerDylan Baker <dylan@pnwbakers.com>2025-10-14 09:22:08 -0700
commit5cc1ee7f90da50f40a3263f9e63d9e356dda197c (patch)
tree25e1a1d6eaca83f09f55a3deab4ea5dbb6f03385 /mesonbuild/compilers/rust.py
parent15d3909695520850b6b587544a01971b6d34be43 (diff)
downloadmeson-5cc1ee7f90da50f40a3263f9e63d9e356dda197c.tar.gz
compilers: make link/lld-link check homogeneous
Use the same check for all of clang, nasm and rustc. This also avoids the following warning: Sanity check compiler command line: clang++ sanitycheckobjcpp.mm -o sanitycheckobjcpp.exe -D_MT -D_DLL -D_DEBUG -D_FILE_OFFSET_BITS=64 -Wl,-fms-runtime-lib=dll_dbg Sanity check compile stdout: LINK : warning LNK4044: unrecognized option /fms-runtime-lib=dll_dbg; ignored iWhat happens is that -fms-runtime-lib sets up an automatic dependency from the .o files to the final link product, and therefore must be passed as a compiler argument. But the constructor for ClangCompiler was incorrectly allowing b_vscrt for MINGW, so I messed up the logic. With this change, MINGW won't get the b_vscrt option. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/compilers/rust.py')
-rw-r--r--mesonbuild/compilers/rust.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py
index 8f8febdb0..7e6c31096 100644
--- a/mesonbuild/compilers/rust.py
+++ b/mesonbuild/compilers/rust.py
@@ -12,6 +12,7 @@ import typing as T
from .. import options
from ..mesonlib import EnvironmentException, MesonException, Popen_safe_logged, version_compare
+from ..linkers.linkers import VisualStudioLikeLinkerMixin
from ..options import OptionKey
from .compilers import Compiler, CompileCheckMode, clike_debug_args, is_library
@@ -98,7 +99,7 @@ class RustCompiler(Compiler):
linker=linker)
self.rustup_run_and_args: T.Optional[T.Tuple[T.List[str], T.List[str]]] = get_rustup_run_and_args(exelist)
self.base_options.update({OptionKey(o) for o in ['b_colorout', 'b_ndebug']})
- if 'link' in self.linker.id:
+ if isinstance(self.linker, VisualStudioLikeLinkerMixin):
self.base_options.add(OptionKey('b_vscrt'))
self.native_static_libs: T.List[str] = []
self.is_beta = '-beta' in full_version
@@ -307,7 +308,7 @@ class RustCompiler(Compiler):
return []
def get_crt_link_args(self, crt_val: str, buildtype: str) -> T.List[str]:
- if self.linker.id not in {'link', 'lld-link'}:
+ if not isinstance(self.linker, VisualStudioLikeLinkerMixin):
return []
return self.MSVCRT_ARGS[self.get_crt_val(crt_val, buildtype)]