Auto merge of #107241 - clubby789:bootstrap-lto-off, r=simulacrum
Add `rust.lto=off` to bootstrap and set as compiler/library default
Closes #107202
The issue mentions `embed-bitcode=on`, but here c8e6a9e8b6/src/bootstrap/compile.rs (L379-L381)
it appears that this is always set for std stage 1+, so I'm unsure if changes are needed here.
`@rustbot` label +A-bootstrap
This commit is contained in:
@@ -662,7 +662,8 @@ changelog-seen = 2
|
|||||||
|
|
||||||
# Select LTO mode that will be used for compiling rustc. By default, thin local LTO
|
# Select LTO mode that will be used for compiling rustc. By default, thin local LTO
|
||||||
# (LTO within a single crate) is used (like for any Rust crate). You can also select
|
# (LTO within a single crate) is used (like for any Rust crate). You can also select
|
||||||
# "thin" or "fat" to apply Thin/Fat LTO to the `rustc_driver` dylib.
|
# "thin" or "fat" to apply Thin/Fat LTO to the `rustc_driver` dylib, or "off" to disable
|
||||||
|
# LTO entirely.
|
||||||
#lto = "thin-local"
|
#lto = "thin-local"
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|||||||
@@ -379,6 +379,9 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
|
|||||||
if stage >= 1 {
|
if stage >= 1 {
|
||||||
cargo.rustflag("-Cembed-bitcode=yes");
|
cargo.rustflag("-Cembed-bitcode=yes");
|
||||||
}
|
}
|
||||||
|
if builder.config.rust_lto == RustcLto::Off {
|
||||||
|
cargo.rustflag("-Clto=off");
|
||||||
|
}
|
||||||
|
|
||||||
// By default, rustc does not include unwind tables unless they are required
|
// By default, rustc does not include unwind tables unless they are required
|
||||||
// for a particular target. They are not required by RISC-V targets, but
|
// for a particular target. They are not required by RISC-V targets, but
|
||||||
@@ -722,6 +725,13 @@ impl Step for Rustc {
|
|||||||
cargo.rustflag("-Cembed-bitcode=yes");
|
cargo.rustflag("-Cembed-bitcode=yes");
|
||||||
}
|
}
|
||||||
RustcLto::ThinLocal => { /* Do nothing, this is the default */ }
|
RustcLto::ThinLocal => { /* Do nothing, this is the default */ }
|
||||||
|
RustcLto::Off => {
|
||||||
|
cargo.rustflag("-Clto=off");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if builder.config.rust_lto == RustcLto::Off {
|
||||||
|
cargo.rustflag("-Clto=off");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -333,8 +333,9 @@ impl SplitDebuginfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// LTO mode used for compiling rustc itself.
|
/// LTO mode used for compiling rustc itself.
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone, PartialEq)]
|
||||||
pub enum RustcLto {
|
pub enum RustcLto {
|
||||||
|
Off,
|
||||||
#[default]
|
#[default]
|
||||||
ThinLocal,
|
ThinLocal,
|
||||||
Thin,
|
Thin,
|
||||||
@@ -349,6 +350,7 @@ impl std::str::FromStr for RustcLto {
|
|||||||
"thin-local" => Ok(RustcLto::ThinLocal),
|
"thin-local" => Ok(RustcLto::ThinLocal),
|
||||||
"thin" => Ok(RustcLto::Thin),
|
"thin" => Ok(RustcLto::Thin),
|
||||||
"fat" => Ok(RustcLto::Fat),
|
"fat" => Ok(RustcLto::Fat),
|
||||||
|
"off" => Ok(RustcLto::Off),
|
||||||
_ => Err(format!("Invalid value for rustc LTO: {}", s)),
|
_ => Err(format!("Invalid value for rustc LTO: {}", s)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ debug-logging = true
|
|||||||
incremental = true
|
incremental = true
|
||||||
# Print backtrace on internal compiler errors during bootstrap
|
# Print backtrace on internal compiler errors during bootstrap
|
||||||
backtrace-on-ice = true
|
backtrace-on-ice = true
|
||||||
|
# Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
|
||||||
|
lto = "off"
|
||||||
|
|
||||||
[llvm]
|
[llvm]
|
||||||
# Will download LLVM from CI if available on your platform.
|
# Will download LLVM from CI if available on your platform.
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ bench-stage = 0
|
|||||||
[rust]
|
[rust]
|
||||||
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
|
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
|
||||||
incremental = true
|
incremental = true
|
||||||
|
# Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
|
||||||
|
lto = "off"
|
||||||
|
|
||||||
[llvm]
|
[llvm]
|
||||||
# Will download LLVM from CI if available on your platform.
|
# Will download LLVM from CI if available on your platform.
|
||||||
|
|||||||
Reference in New Issue
Block a user