From be5d72129e33d2cadb7fa003395eccd986447833 Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Sun, 11 Apr 2021 14:02:28 +0100 Subject: [PATCH] bootstrap: check local_rebuild before adding --cfg=bootstrap, closes #84057 --- src/bootstrap/compile.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 8244c7710ab7..66a88e85fea3 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -462,11 +462,13 @@ impl Step for StartupObjects { let dst_file = &dst_dir.join(file.to_string() + ".o"); if !up_to_date(src_file, dst_file) { let mut cmd = Command::new(&builder.initial_rustc); + cmd.env("RUSTC_BOOTSTRAP", "1"); + if !builder.local_rebuild { + // a local_rebuild compiler already has stage1 features + cmd.arg("--cfg").arg("bootstrap"); + } builder.run( - cmd.env("RUSTC_BOOTSTRAP", "1") - .arg("--cfg") - .arg("bootstrap") - .arg("--target") + cmd.arg("--target") .arg(target.rustc_target_arg()) .arg("--emit=obj") .arg("-o")