Skip to content

Commit a100d94

Browse files
authored
Rollup merge of rust-lang#126701 - onur-ozkan:build-lld-if-enabled, r=Kobzol
ignore `llvm::Lld` if lld is not enabled People are having trouble ([ref. zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/MSVC.20Runtime.20mismatch.20when.20building.20LLD)) when they don't want to build `lld` for their custom distribution tarballs even with `lld = false` in their config.toml. This is because it is not controlled by `lld_enabled` flag. This change ensures that `llvm:Lld` is controlled by lld configuration. Additionally, `lld = true` is set by default for dist profile, because we have been building it all along and this maintains that behavior.
2 parents b08a0cf + b1b473e commit a100d94

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

src/bootstrap/defaults/config.dist.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ download-ci-llvm = false
1616
# Make sure they don't get set when installing from source.
1717
channel = "nightly"
1818
download-rustc = false
19+
lld = true
1920
# Build the llvm-bitcode-linker
2021
llvm-bitcode-linker = true
2122

src/bootstrap/src/core/build_steps/dist.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -2270,9 +2270,6 @@ impl Step for RustDev {
22702270

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

2273-
// We want to package `lld` to use it with `download-ci-llvm`.
2274-
builder.ensure(crate::core::build_steps::llvm::Lld { target });
2275-
22762273
let src_bindir = builder.llvm_out(target).join("bin");
22772274
// If updating this, you likely want to change
22782275
// src/bootstrap/download-ci-llvm-stamp as well, otherwise local users
@@ -2289,10 +2286,15 @@ impl Step for RustDev {
22892286
}
22902287
}
22912288

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

22982300
tarball.add_file(builder.llvm_filecheck(target), "bin", 0o755);

src/bootstrap/src/utils/change_tracker.rs

+5
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
195195
severity: ChangeSeverity::Warning,
196196
summary: "Removed `dist.missing-tools` configuration as it was deprecated long time ago.",
197197
},
198+
ChangeInfo {
199+
change_id: 126701,
200+
severity: ChangeSeverity::Warning,
201+
summary: "`llvm.lld` is enabled by default for the dist profile. If set to false, `lld` will not be included in the dist build.",
202+
},
198203
];

src/ci/run.sh

+4
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ fi
8585
# space required for CI artifacts.
8686
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --dist-compression-formats=xz"
8787

88+
if [ "$EXTERNAL_LLVM" = "1" ]; then
89+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.lld=false"
90+
fi
91+
8892
# Enable the `c` feature for compiler_builtins, but only when the `compiler-rt` source is available
8993
# (to avoid spending a lot of time cloning llvm)
9094
if [ "$EXTERNAL_LLVM" = "" ]; then

0 commit comments

Comments
 (0)