diff '--color=auto' -Naur a/config/makefiles/rust.mk b/config/makefiles/rust.mk
--- a/config/makefiles/rust.mk	2026-10-12 17:21:50.315996077 +0300
+++ b/config/makefiles/rust.mk	2026-10-12 17:23:48.665727741 +0300
@@ -55,9 +55,11 @@
 # invocation (i.e., only the top-level crate, not its dependencies).
 cargo_rustc_flags = $(CARGO_RUSTCFLAGS)
 # Enable link-time optimization for release builds.
+ifdef MOZ_LTO
 ifdef RUST_LIBRARY_LTO
 cargo_rustc_flags += -Clto
 endif
+endif
 
 ifdef CARGO_INCREMENTAL
 export CARGO_INCREMENTAL
