Skip to content

disable LLD build for cross compiled hosts #71457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,12 @@ impl Build {
self.out.join(&*target).join("lld")
}

fn lld_enabled(&self, target: Interned<String>) -> 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<String>) -> PathBuf {
self.out.join(&*target).join("doc")
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down