Auto merge of #47834 - Mark-Simulacrum:no-cgu-release, r=alexcrichton
Do not enable ThinLTO on stable, beta, or nightly builds. Fixes #45444
This commit is contained in:
@@ -235,6 +235,11 @@
|
|||||||
# compiler.
|
# compiler.
|
||||||
#codegen-units = 1
|
#codegen-units = 1
|
||||||
|
|
||||||
|
# Whether to enable ThinLTO (and increase the codegen units to either a default
|
||||||
|
# or the configured value). On by default. If we want the fastest possible
|
||||||
|
# compiler, we should disable this.
|
||||||
|
#thinlto = true
|
||||||
|
|
||||||
# Whether or not debug assertions are enabled for the compiler and standard
|
# Whether or not debug assertions are enabled for the compiler and standard
|
||||||
# library. Also enables compilation of debug! and trace! logging macros.
|
# library. Also enables compilation of debug! and trace! logging macros.
|
||||||
#debug-assertions = false
|
#debug-assertions = false
|
||||||
|
|||||||
@@ -509,10 +509,6 @@ impl<'a> Builder<'a> {
|
|||||||
})
|
})
|
||||||
.env("TEST_MIRI", self.config.test_miri.to_string())
|
.env("TEST_MIRI", self.config.test_miri.to_string())
|
||||||
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
|
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
|
||||||
if let Some(n) = self.config.rust_codegen_units {
|
|
||||||
cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if let Some(host_linker) = self.build.linker(compiler.host) {
|
if let Some(host_linker) = self.build.linker(compiler.host) {
|
||||||
cargo.env("RUSTC_HOST_LINKER", host_linker);
|
cargo.env("RUSTC_HOST_LINKER", host_linker);
|
||||||
@@ -679,6 +675,13 @@ impl<'a> Builder<'a> {
|
|||||||
if self.is_very_verbose() {
|
if self.is_very_verbose() {
|
||||||
cargo.arg("-v");
|
cargo.arg("-v");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This must be kept before the thinlto check, as we set codegen units
|
||||||
|
// to 1 forcibly there.
|
||||||
|
if let Some(n) = self.config.rust_codegen_units {
|
||||||
|
cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
if self.config.rust_optimize {
|
if self.config.rust_optimize {
|
||||||
// FIXME: cargo bench does not accept `--release`
|
// FIXME: cargo bench does not accept `--release`
|
||||||
if cmd != "bench" {
|
if cmd != "bench" {
|
||||||
@@ -686,11 +689,17 @@ impl<'a> Builder<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.config.rust_codegen_units.is_none() &&
|
if self.config.rust_codegen_units.is_none() &&
|
||||||
self.build.is_rust_llvm(compiler.host)
|
self.build.is_rust_llvm(compiler.host) &&
|
||||||
{
|
self.config.rust_thinlto {
|
||||||
cargo.env("RUSTC_THINLTO", "1");
|
cargo.env("RUSTC_THINLTO", "1");
|
||||||
|
} else if self.config.rust_codegen_units.is_none() {
|
||||||
|
// Generally, if ThinLTO has been disabled for some reason, we
|
||||||
|
// want to set the codegen units to 1. However, we shouldn't do
|
||||||
|
// this if the option was specifically set by the user.
|
||||||
|
cargo.env("RUSTC_CODEGEN_UNITS", "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.config.locked_deps {
|
if self.config.locked_deps {
|
||||||
cargo.arg("--locked");
|
cargo.arg("--locked");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ pub struct Config {
|
|||||||
// rust codegen options
|
// rust codegen options
|
||||||
pub rust_optimize: bool,
|
pub rust_optimize: bool,
|
||||||
pub rust_codegen_units: Option<u32>,
|
pub rust_codegen_units: Option<u32>,
|
||||||
|
pub rust_thinlto: bool,
|
||||||
pub rust_debug_assertions: bool,
|
pub rust_debug_assertions: bool,
|
||||||
pub rust_debuginfo: bool,
|
pub rust_debuginfo: bool,
|
||||||
pub rust_debuginfo_lines: bool,
|
pub rust_debuginfo_lines: bool,
|
||||||
@@ -261,6 +262,7 @@ impl Default for StringOrBool {
|
|||||||
struct Rust {
|
struct Rust {
|
||||||
optimize: Option<bool>,
|
optimize: Option<bool>,
|
||||||
codegen_units: Option<u32>,
|
codegen_units: Option<u32>,
|
||||||
|
thinlto: Option<bool>,
|
||||||
debug_assertions: Option<bool>,
|
debug_assertions: Option<bool>,
|
||||||
debuginfo: Option<bool>,
|
debuginfo: Option<bool>,
|
||||||
debuginfo_lines: Option<bool>,
|
debuginfo_lines: Option<bool>,
|
||||||
@@ -412,6 +414,7 @@ impl Config {
|
|||||||
|
|
||||||
// Store off these values as options because if they're not provided
|
// Store off these values as options because if they're not provided
|
||||||
// we'll infer default values for them later
|
// we'll infer default values for them later
|
||||||
|
let mut thinlto = None;
|
||||||
let mut llvm_assertions = None;
|
let mut llvm_assertions = None;
|
||||||
let mut debuginfo_lines = None;
|
let mut debuginfo_lines = None;
|
||||||
let mut debuginfo_only_std = None;
|
let mut debuginfo_only_std = None;
|
||||||
@@ -455,6 +458,7 @@ impl Config {
|
|||||||
optimize = rust.optimize;
|
optimize = rust.optimize;
|
||||||
ignore_git = rust.ignore_git;
|
ignore_git = rust.ignore_git;
|
||||||
debug_jemalloc = rust.debug_jemalloc;
|
debug_jemalloc = rust.debug_jemalloc;
|
||||||
|
thinlto = rust.thinlto;
|
||||||
set(&mut config.rust_optimize_tests, rust.optimize_tests);
|
set(&mut config.rust_optimize_tests, rust.optimize_tests);
|
||||||
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
|
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
|
||||||
set(&mut config.codegen_tests, rust.codegen_tests);
|
set(&mut config.codegen_tests, rust.codegen_tests);
|
||||||
@@ -539,6 +543,7 @@ impl Config {
|
|||||||
"stable" | "beta" | "nightly" => true,
|
"stable" | "beta" | "nightly" => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
config.rust_thinlto = thinlto.unwrap_or(true);
|
||||||
config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default);
|
config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default);
|
||||||
config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default);
|
config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default);
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ o("emscripten", None, "compile the emscripten backend as well as LLVM")
|
|||||||
# Optimization and debugging options. These may be overridden by the release
|
# Optimization and debugging options. These may be overridden by the release
|
||||||
# channel, etc.
|
# channel, etc.
|
||||||
o("optimize", "rust.optimize", "build optimized rust code")
|
o("optimize", "rust.optimize", "build optimized rust code")
|
||||||
|
o("thinlto", "rust.thinlto", "build Rust with ThinLTO enabled")
|
||||||
o("optimize-llvm", "llvm.optimize", "build optimized LLVM")
|
o("optimize-llvm", "llvm.optimize", "build optimized LLVM")
|
||||||
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
|
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
|
||||||
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
|
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export RUST_RELEASE_CHANNEL=nightly
|
|||||||
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
|
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
|
||||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
|
||||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
|
||||||
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-thinlto"
|
||||||
|
|
||||||
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
|
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
|
||||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
|
||||||
|
|||||||
Reference in New Issue
Block a user