Rollup merge of #143175 - Kobzol:bootstrap-lld-external-llvm-config, r=Jieyouxu

Make combining LLD with external LLVM config a hard error

Younger me made this only a warning in https://github.com/rust-lang/rust/pull/139853, because our post-dist tests were relying on this. But that was not a good idea, because there are a bunch of places in bootstrap that outright try to build LLD/copy LLD to sysroot when `lld_enabled` is true (rightfully so), which is causing issues (https://github.com/rust-lang/rust/issues/143076). Instead of piling more hacks, I'd like to just disallow this, and if we need to use a hack, do it only for our CI.

If this breaks the CI post-dist tests, I'll either add some special environment variable for it, or, as an alternative, make the error back into a warning, but also disable `lld_enabled` when this situation happens.

try-job: dist-x86_64-linux

Fixes: https://github.com/rust-lang/rust/pull/143175
This commit is contained in:
Matthias Krüger 2025-06-30 20:49:41 +02:00 committed by GitHub
commit 1be0c62069
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View file

@ -2241,7 +2241,7 @@ impl Step for Assemble {
debug!("copying codegen backends to sysroot");
copy_codegen_backends_to_sysroot(builder, build_compiler, target_compiler);
if builder.config.lld_enabled && !builder.config.is_system_llvm(target_compiler.host) {
if builder.config.lld_enabled {
builder.ensure(crate::core::build_steps::tool::LldWrapper {
build_compiler,
target_compiler,

View file

@ -1003,9 +1003,7 @@ impl Config {
}
if config.lld_enabled && config.is_system_llvm(config.host_target) {
eprintln!(
"Warning: LLD is enabled when using external llvm-config. LLD will not be built and copied to the sysroot."
);
panic!("Cannot enable LLD with `rust.lld = true` when using external llvm-config.");
}
config.optimized_compiler_builtins =

View file

@ -431,4 +431,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
severity: ChangeSeverity::Warning,
summary: "It is no longer possible to `x build` with stage 0. All build commands have to be on stage 1+.",
},
ChangeInfo {
change_id: 143175,
severity: ChangeSeverity::Info,
summary: "It is no longer possible to combine `rust.lld = true` with configuring external LLVM using `llvm.llvm-config`.",
},
];

View file

@ -72,6 +72,8 @@ change-id = 115898
[rust]
channel = "{channel}"
verbose-tests = true
# rust-lld cannot be combined with an external LLVM
lld = false
[build]
rustc = "{rustc}"