Auto merge of #147698 - Kobzol:lld-target, r=jieyouxu

Do not enable LLD if we don't build host code for targets that opt into it

Should fix the problem mentioned in https://github.com/rust-lang/rust/pull/147626#issuecomment-3402635247.

r? `@jieyouxu`
This commit is contained in:
bors
2025-10-19 11:55:04 +00:00

View File

@@ -1016,6 +1016,15 @@ impl Config {
continue;
}
// The rust.lld option is global, and not target specific, so if we enable it, it will
// be applied to all targets being built.
// So we only apply an override if we're building a compiler/host code for the given
// override target.
// Note: we could also make the LLD config per-target, but that would complicate things
if !hosts.contains(&TargetSelection::from_user(&target)) {
continue;
}
let default_linux_linker_override = match linker_override {
DefaultLinuxLinkerOverride::Off => continue,
DefaultLinuxLinkerOverride::SelfContainedLldCc => {