summaryrefslogtreecommitdiff
blob: 8aee245ef18fba62ec37eeb5cc9074b590ce7b52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- a/mozilla/config/rules.mk
+++ b/mozilla/config/rules.mk
@@ -870,16 +870,20 @@ endif
 
 # These flags are passed via `cargo rustc` and only apply to the final rustc
 # invocation (i.e., only the top-level crate, not its dependencies).
 cargo_rustc_flags = $(CARGO_RUSTCFLAGS)
 ifndef DEVELOPER_OPTIONS
 ifndef MOZ_DEBUG_RUST
 # Enable link-time optimization for release builds.
 cargo_rustc_flags += -C lto
+# Versions of rust >= 1.45 need -Cembed-bitcode=yes for all crates when using -Clto.
+ifeq (,$(filter 1.3% 1.40.% 1.41.% 1.42.% 1.43.% 1.44.%,$(RUSTC_VERSION)))
+RUSTFLAGS += -Cembed-bitcode=yes
+endif
 endif
 endif
 
 rustflags_override = RUSTFLAGS='$(MOZ_RUST_DEFAULT_FLAGS) $(RUSTFLAGS)'
 
 ifdef MOZ_MSVCBITS
 # If we are building a MozillaBuild shell, we want to clear out the
 # vcvars.bat environment variables for cargo builds. This is because