From 351eda4dbb2eb630d20e63ed58452df559817b3c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 8 Nov 2025 16:48:27 +0100 Subject: rust: add get_lto_compile_args Signed-off-by: Paolo Bonzini --- mesonbuild/compilers/rust.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index fadf9772f..54b3da91a 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -341,6 +341,11 @@ class RustCompiler(Compiler): args.extend(['-C', f'link-arg={a}']) return args + def get_lto_compile_args(self, *, threads: int = 0, mode: str = 'default') -> T.List[str]: + # TODO: what about -Clinker-plugin-lto? + rustc_lto = 'lto=thin' if mode == 'thin' else 'lto' + return ['-C', rustc_lto] + def get_werror_args(self) -> T.List[str]: # Use -D warnings, which makes every warning not explicitly allowed an # error -- cgit v1.2.3