diff --git a/src/bootstrap/defaults/config.dist.toml b/src/bootstrap/defaults/config.dist.toml index d06930f2b9d9..d4feffe02271 100644 --- a/src/bootstrap/defaults/config.dist.toml +++ b/src/bootstrap/defaults/config.dist.toml @@ -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 diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 2dc7cd7de6a0..0f24e91d81d6 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -2270,9 +2270,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 @@ -2289,10 +2286,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); diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index bfe3622e40d3..ccab25e55a9c 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -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.", + }, ]; diff --git a/src/ci/run.sh b/src/ci/run.sh index efaf70078c4a..869f75e923d2 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -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