Files
codex/patches/rules_rs_windows_msvc_linker.patch
felixxia-oai 3470b807b4 Use rust-lld for Bazel Windows MSVC Rust links (#40438)
## What changed

- Configure x86_64 Windows MSVC `rules_rs` toolchains to use the bundled
  `rust-lld` linker.
- Make `rules_rust` select the configured direct linker for that target unless
  the toolchain explicitly prefers the C compiler driver.

GitOrigin-RevId: 941a1ca42b931cbb9e1c2d68300b8a82a5250be8
2026-08-24 17:17:25 +00:00

15 lines
868 B
Diff

# What: use Rust's bundled direct linker for Windows x86_64 MSVC toolchains.
# Scope: standard and bootstrap rules_rs Rust toolchains targeting x86_64 MSVC.
diff --git a/rs/toolchains/declare_rustc_toolchains.bzl b/rs/toolchains/declare_rustc_toolchains.bzl
--- a/rs/toolchains/declare_rustc_toolchains.bzl
+++ b/rs/toolchains/declare_rustc_toolchains.bzl
@@ -88,6 +88,7 @@ def declare_rustc_toolchains(
llvm_cov = "@llvm//tools:llvm-cov",
llvm_profdata = "@llvm//tools:llvm-profdata",
linker = select({
+ "@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": "{}rust-lld".format(rustc_repo_label),
"@platforms//cpu:wasm32": "{}rust-lld".format(rustc_repo_label),
"@platforms//cpu:wasm64": "{}rust-lld".format(rustc_repo_label),
"//conditions:default": None,