From a2c7e17e2c7da20015f832e884769a373d42a77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 14 Oct 2025 21:09:43 +0200 Subject: [PATCH] Do not enable LLD if we don't build host code for targets that opt into it --- src/bootstrap/src/core/config/config.rs | 9 +++++++++ 1 file changed, 9 insertions(+) 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 => {