-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Description
rust-lang/cargo#10395 made it possible to apply RUSTFLAGS to build scripts and proc-macros. Bootstrap currently special-cases this in fake rustc:
rust/src/bootstrap/bin/rustc.rs
Lines 110 to 135 in 06460fe
// FIXME(rust-lang/cargo#5754) we shouldn't be using special env vars | |
// here, but rather Cargo should know what flags to pass rustc itself. | |
// Override linker if necessary. | |
if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") { | |
cmd.arg(format!("-Clinker={}", host_linker)); | |
} | |
if env::var_os("RUSTC_HOST_FUSE_LD_LLD").is_some() { | |
cmd.arg("-Clink-args=-fuse-ld=lld"); | |
} | |
if let Ok(s) = env::var("RUSTC_HOST_CRT_STATIC") { | |
if s == "true" { | |
cmd.arg("-C").arg("target-feature=+crt-static"); | |
} | |
if s == "false" { | |
cmd.arg("-C").arg("target-feature=-crt-static"); | |
} | |
} | |
if stage == "0" { | |
// Cargo doesn't pass RUSTFLAGS to proc_macros: | |
// https://github.com/rust-lang/cargo/issues/4423 | |
// Set `--cfg=bootstrap` explicitly instead. | |
cmd.arg("--cfg=bootstrap"); | |
} |
We should switch to using
-Ztarget-applies-to-host=true
on the next cargo update.cc @Mark-Simulacrum @ehuss @jonhoo (thank you again @jonhoo for fixing this! ❤️)
@rustbot label: +A-rustbuild +C-enhancement
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)