| author | bors <bors@rust-lang.org> 2024-06-28 19:52:56 UTC |
| committer | bors <bors@rust-lang.org> 2024-06-28 19:52:56 UTC |
| log | e9e6e2e444c30c23a9c878a88fbc3978c2acad95 |
| tree | 75f1cbc8abb76cbeae02e32aa20c8cc18ef48bd1 |
| parent | c4c0897a262d42f26f89aaca16ed52457f6a4f05 |
| parent | 17b843bc2cc2db2bf86f2c93ec3bade5f358ba57 |
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-mingw6 files changed, 22 insertions(+), 8 deletions(-)
src/bootstrap/defaults/config.dist.toml+1| ... | ... | @@ -16,6 +16,7 @@ download-ci-llvm = false |
| 16 | 16 | # Make sure they don't get set when installing from source. |
| 17 | 17 | channel = "nightly" |
| 18 | 18 | download-rustc = false |
| 19 | lld = true | |
| 19 | 20 | # Build the llvm-bitcode-linker |
| 20 | 21 | llvm-bitcode-linker = true |
| 21 | 22 |
src/bootstrap/src/core/build_steps/dist.rs+9-7| ... | ... | @@ -2270,9 +2270,6 @@ impl Step for RustDev { |
| 2270 | 2270 | |
| 2271 | 2271 | builder.ensure(crate::core::build_steps::llvm::Llvm { target }); |
| 2272 | 2272 | |
| 2273 | // We want to package `lld` to use it with `download-ci-llvm`. | |
| 2274 | builder.ensure(crate::core::build_steps::llvm::Lld { target }); | |
| 2275 | ||
| 2276 | 2273 | let src_bindir = builder.llvm_out(target).join("bin"); |
| 2277 | 2274 | // If updating this, you likely want to change |
| 2278 | 2275 | // src/bootstrap/download-ci-llvm-stamp as well, otherwise local users |
| ... | ... | @@ -2289,10 +2286,15 @@ impl Step for RustDev { |
| 2289 | 2286 | } |
| 2290 | 2287 | } |
| 2291 | 2288 | |
| 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 | } | |
| 2296 | 2298 | } |
| 2297 | 2299 | |
| 2298 | 2300 | 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] = &[ |
| 195 | 195 | severity: ChangeSeverity::Warning, |
| 196 | 196 | summary: "Removed `dist.missing-tools` configuration as it was deprecated long time ago.", |
| 197 | 197 | }, |
| 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 | }, | |
| 198 | 203 | ]; |
src/ci/run.sh+4| ... | ... | @@ -85,6 +85,10 @@ fi |
| 85 | 85 | # space required for CI artifacts. |
| 86 | 86 | RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --dist-compression-formats=xz" |
| 87 | 87 | |
| 88 | if [ "$EXTERNAL_LLVM" = "1" ]; then | |
| 89 | RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.lld=false" | |
| 90 | fi | |
| 91 | ||
| 88 | 92 | # Enable the `c` feature for compiler_builtins, but only when the `compiler-rt` source is available |
| 89 | 93 | # (to avoid spending a lot of time cloning llvm) |
| 90 | 94 | if [ "$EXTERNAL_LLVM" = "" ]; then |
tests/run-make/rust-lld-by-default/rmake.rs+2| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | // also be turned off with a CLI flag. |
| 3 | 3 | |
| 4 | 4 | //@ needs-rust-lld |
| 5 | //@ ignore-beta | |
| 6 | //@ ignore-stable | |
| 5 | 7 | //@ only-x86_64-unknown-linux-gnu |
| 6 | 8 | |
| 7 | 9 | use 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 | |
| 2 | 2 | //@ needs-rust-lld |
| 3 | 3 | |
| 4 | 4 | use run_make_support::rustc; |