authorbors <bors@rust-lang.org> 2024-06-28 19:52:56 UTC
committerbors <bors@rust-lang.org> 2024-06-28 19:52:56 UTC
loge9e6e2e444c30c23a9c878a88fbc3978c2acad95
tree75f1cbc8abb76cbeae02e32aa20c8cc18ef48bd1
parentc4c0897a262d42f26f89aaca16ed52457f6a4f05
parent17b843bc2cc2db2bf86f2c93ec3bade5f358ba57

Auto merge of #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. try-job: x86_64-mingw

6 files changed, 22 insertions(+), 8 deletions(-)

src/bootstrap/defaults/config.dist.toml+1
......@@ -16,6 +16,7 @@ download-ci-llvm = false
1616# Make sure they don't get set when installing from source.
1717channel = "nightly"
1818download-rustc = false
19lld = true
1920# Build the llvm-bitcode-linker
2021llvm-bitcode-linker = true
2122
src/bootstrap/src/core/build_steps/dist.rs+9-7
......@@ -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
......@@ -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
......@@ -85,6 +85,10 @@ fi
8585# space required for CI artifacts.
8686RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --dist-compression-formats=xz"
8787
88if [ "$EXTERNAL_LLVM" = "1" ]; then
89 RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.lld=false"
90fi
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)
9094if [ "$EXTERNAL_LLVM" = "" ]; then
tests/run-make/rust-lld-by-default/rmake.rs+2
......@@ -2,6 +2,8 @@
22// also be turned off with a CLI flag.
33
44//@ needs-rust-lld
5//@ ignore-beta
6//@ ignore-stable
57//@ only-x86_64-unknown-linux-gnu
68
79use run_make_support::regex::Regex;
tests/run-make/windows-safeseh/rmake.rs+1-1
......@@ -1,4 +1,4 @@
1//@ only-windows
1//@ only-x86_64-pc-windows-msvc
22//@ needs-rust-lld
33
44use run_make_support::rustc;