Skip to content
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

ignore llvm::Lld if lld is not enabled #126701

Merged
merged 6 commits into from
Jun 28, 2024
Merged
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
1 change: 1 addition & 0 deletions src/bootstrap/defaults/config.dist.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ download-ci-llvm = false
# Make sure they don't get set when installing from source.
channel = "nightly"
download-rustc = false
lld = true
# Build the llvm-bitcode-linker
llvm-bitcode-linker = true

Expand Down
16 changes: 9 additions & 7 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2261,9 +2261,6 @@ impl Step for RustDev {

builder.ensure(crate::core::build_steps::llvm::Llvm { target });

// We want to package `lld` to use it with `download-ci-llvm`.
builder.ensure(crate::core::build_steps::llvm::Lld { target });

let src_bindir = builder.llvm_out(target).join("bin");
// If updating this, you likely want to change
// src/bootstrap/download-ci-llvm-stamp as well, otherwise local users
Expand All @@ -2280,10 +2277,15 @@ impl Step for RustDev {
}
}

// We don't build LLD on some platforms, so only add it if it exists
let lld_path = builder.lld_out(target).join("bin").join(exe("lld", target));
if lld_path.exists() {
tarball.add_file(lld_path, "bin", 0o755);
if builder.config.lld_enabled {
// We want to package `lld` to use it with `download-ci-llvm`.
let lld_out = builder.ensure(crate::core::build_steps::llvm::Lld { target });

// We don't build LLD on some platforms, so only add it if it exists
let lld_path = lld_out.join("bin").join(exe("lld", target));
if lld_path.exists() {
tarball.add_file(lld_path, "bin", 0o755);
}
}

tarball.add_file(builder.llvm_filecheck(target), "bin", 0o755);
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/src/utils/change_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
severity: ChangeSeverity::Warning,
summary: "Removed `dist.missing-tools` configuration as it was deprecated long time ago.",
},
ChangeInfo {
change_id: 126701,
severity: ChangeSeverity::Warning,
summary: "`llvm.lld` is enabled by default for the dist profile. If set to false, `lld` will not be included in the dist build.",
},
];
4 changes: 4 additions & 0 deletions src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ fi
# space required for CI artifacts.
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --dist-compression-formats=xz"

if [ "$EXTERNAL_LLVM" = "1" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.lld=false"
fi

# Enable the `c` feature for compiler_builtins, but only when the `compiler-rt` source is available
# (to avoid spending a lot of time cloning llvm)
if [ "$EXTERNAL_LLVM" = "" ]; then
Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/rust-lld-by-default/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// also be turned off with a CLI flag.

//@ needs-rust-lld
//@ ignore-beta
//@ ignore-stable
//@ only-x86_64-unknown-linux-gnu

use run_make_support::regex::Regex;
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/windows-safeseh/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ only-windows
//@ only-x86_64-pc-windows-msvc
//@ needs-rust-lld

use run_make_support::rustc;
Expand Down