From 0eb298aaa9b2ae438056f5535199f4ea40d003a9 Mon Sep 17 00:00:00 2001 From: Joseph Ryan Date: Mon, 2 Oct 2023 16:50:23 -0700 Subject: [PATCH] bootstrap: make copying linker binaries conditional --- src/bootstrap/compile.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index daf0798357b87..9afc4c22746ae 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -161,14 +161,15 @@ impl Step for Std { // The LLD wrappers and `rust-lld` are self-contained linking components that can be // necessary to link the stdlib on some targets. We'll also need to copy these binaries to // the `stage0-sysroot` to ensure the linker is found when bootstrapping on such a target. - if compiler.stage == 0 && compiler.host == builder.config.build { + let src_sysroot_bin = builder + .rustc_snapshot_sysroot() + .join("lib") + .join("rustlib") + .join(compiler.host.triple) + .join("bin"); + if compiler.stage == 0 && compiler.host == builder.config.build && src_sysroot_bin.exists() + { // We want to copy the host `bin` folder within the `rustlib` folder in the sysroot. - let src_sysroot_bin = builder - .rustc_snapshot_sysroot() - .join("lib") - .join("rustlib") - .join(&compiler.host.triple) - .join("bin"); let target_sysroot_bin = builder.sysroot_libdir(compiler, target).parent().unwrap().join("bin"); t!(fs::create_dir_all(&target_sysroot_bin));