diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 85388d3b4639e..121ef694868f9 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -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 => {