diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 06ab0a9c310af..90e8f23c46e00 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -733,7 +733,7 @@ impl Step for Assemble { // when not performing a full bootstrap). builder.ensure(Rustc { compiler: build_compiler, target: target_compiler.host }); - let lld_install = if builder.config.lld_enabled { + let lld_install = if builder.lld_enabled(target_compiler.host) { Some(builder.ensure(native::Lld { target: target_compiler.host })) } else { None diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 8215211ea1c9d..534007265b34f 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -519,7 +519,7 @@ impl Step for Rustc { maybe_install_llvm_dylib(builder, host, image); // Copy over lld if it's there - if builder.config.lld_enabled { + if builder.lld_enabled(compiler.host) { let exe = exe("rust-lld", &compiler.host); let src = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin").join(&exe); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 31bbd92cd6205..27cb9ce5a588a 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -561,6 +561,12 @@ impl Build { self.out.join(&*target).join("lld") } + fn lld_enabled(&self, target: Interned) -> bool { + // LLD does not currently cross compile correctly, so build it only for + // the native toolchain: + self.config.lld_enabled && self.config.build == target + } + /// Output directory for all documentation for a target fn doc_out(&self, target: Interned) -> PathBuf { self.out.join(&*target).join("doc") diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 0c87695ff7cae..c5f02815cf414 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -440,7 +440,7 @@ impl Step for Lld { run.builder.ensure(Lld { target: run.target }); } - /// Compile LLVM for `target`. + /// Compile LLD for `target`. fn run(self, builder: &Builder<'_>) -> PathBuf { if builder.config.dry_run { return PathBuf::from("lld-out-dir-test-gen");