repo/testing/firefox/patches/rust-1.45.patch
2020-07-28 07:41:23 +03:00

28 lines
1.0 KiB
Diff

From cb5b4585486a52d06315a800f9e4ed96f2677898 Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh+mozilla@glandium.org>
Date: Mon, 20 Jul 2020 16:05:36 +0000
Subject: [PATCH] Bug 1640982 - Set CARGO_PROFILE_RELEASE_LTO=true when
enabling rust LTO. r=firefox-build-system-reviewers,rstewart
Differential Revision: https://phabricator.services.mozilla.com/D84098
---
config/makefiles/rust.mk | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk
index 82182ffdf30fe..4b4a679593377 100644
--- a/config/makefiles/rust.mk
+++ b/config/makefiles/rust.mk
@@ -61,7 +61,11 @@ ifndef MOZ_DEBUG_RUST
# Enable link-time optimization for release builds, but not when linking
# gkrust_gtest.
ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE)))
+# Pass -Clto for older versions of rust, and CARGO_PROFILE_RELEASE_LTO=true
+# for newer ones that support it. Combining the latter with -Clto works, so
+# set both everywhere.
cargo_rustc_flags += -Clto
+export CARGO_PROFILE_RELEASE_LTO=true
endif
endif
endif