diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-09-12 14:51:21 +0200 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-10-08 10:51:48 -0700 |
| commit | ebd25b48e09544a90cb811ffe4ee5d18cc3ddc47 (patch) | |
| tree | 916c43b5e96e6951d3f65df56113f04ccaf02376 /mesonbuild/compilers/rust.py | |
| parent | 2a6a7a9f14a7eed75efbe0eff6659e57b45c5f3c (diff) | |
| download | meson-ebd25b48e09544a90cb811ffe4ee5d18cc3ddc47.tar.gz | |
rust: query linker in addition to compiler for verbatim support
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/compilers/rust.py')
| -rw-r--r-- | mesonbuild/compilers/rust.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index d0f92668a..c0b01bb3f 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -11,7 +11,7 @@ import re import typing as T from .. import options -from ..mesonlib import EnvironmentException, MesonException, Popen_safe_logged +from ..mesonlib import EnvironmentException, MesonException, Popen_safe_logged, version_compare from ..options import OptionKey from .compilers import Compiler, CompileCheckMode, clike_debug_args @@ -194,6 +194,20 @@ class RustCompiler(Compiler): def get_crt_static(self) -> bool: return 'target_feature="crt-static"' in self.get_cfgs() + @functools.lru_cache(maxsize=None) + def has_verbatim(self) -> bool: + if version_compare(self.version, '< 1.67.0'): + return False + # GNU ld support '-l:PATH' + if 'ld.' in self.linker.id: + return True + # -l:+verbatim does not work (yet?) with MSVC link or Apple ld64 + # (https://github.com/rust-lang/rust/pull/138753). For ld64, it + # works together with -l:+whole_archive because -force_load (the macOS + # equivalent of --whole-archive), receives the full path to the library + # being linked. However, Meson uses "bundle", not "whole_archive". + return False + def get_debug_args(self, is_debug: bool) -> T.List[str]: return clike_debug_args[is_debug] |
