Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::core::build_steps::{compile, llvm};
use crate::core::builder;
use crate::core::builder::{
Builder, Cargo as CargoCommand, CommandLineStep, RunConfig, ShouldRun, Step, StepMetadata,
apply_pgo, cargo_profile_var,
apply_pgo,
};
use crate::core::config::{DebuginfoLevel, OverrideAllocator, RustcLto, TargetSelection};
use crate::utils::exec::{BootstrapCommand, command};
Expand Down Expand Up @@ -123,14 +123,20 @@ impl Step for ToolBuild {
if is_lto_stage(&self.build_compiler)
&& (self.mode == Mode::ToolRustcPrivate || self.path == "src/tools/cargo")
{
let lto = match builder.config.rust_lto {
RustcLto::Off => Some("off"),
RustcLto::Thin => Some("thin"),
RustcLto::Fat => Some("fat"),
RustcLto::ThinLocal => None,
};
if let Some(lto) = lto {
cargo.env(cargo_profile_var("LTO", &builder.config, self.mode), lto);
// We don't use Cargo's LTO setting here to workaround https://github.com/rust-lang/cargo/issues/14575
match builder.config.rust_lto {
RustcLto::Thin => {
cargo.rustflag("-Clto=thin");
cargo.rustflag("-Cembed-bitcode=yes");
}
RustcLto::Fat => {
cargo.rustflag("-Clto=fat");
cargo.rustflag("-Cembed-bitcode=yes");
}
RustcLto::ThinLocal => { /* Do nothing, this is the default */ }
RustcLto::Off => {
cargo.rustflag("-Clto=off");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use clap::ValueEnum;
#[cfg(feature = "tracing")]
use tracing::instrument;

pub use self::cargo::{Cargo, apply_pgo, cargo_profile_var};
pub use self::cargo::{Cargo, apply_pgo};
pub use crate::Compiler;
use crate::core::build_steps::compile::{Std, StdLink};
use crate::core::build_steps::tool::RustcPrivateCompilers;
Expand Down
1 change: 1 addition & 0 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ auto:
--target=x86_64-pc-windows-msvc
--enable-full-tools
--enable-profiler
--set rust.lto=thin
--set rust.codegen-units=1
SCRIPT: python x.py build --set rust.debug=true opt-dist && PGO_HOST=x86_64-pc-windows-msvc ./build/x86_64-pc-windows-msvc/stage1-tools-bin/opt-dist windows-ci -- python x.py dist bootstrap --include-default-paths
DIST_REQUIRE_ALL_TOOLS: 1
Expand Down
Loading