Files
codex/patches/rules_rust_windows_bootstrap_process_wrapper_linker.patch
2026-04-03 14:47:20 -07:00

22 lines
823 B
Diff

--- a/rust/private/rustc.bzl
+++ b/rust/private/rustc.bzl
@@ -472,7 +472,17 @@
)
ld_is_direct_driver = False
- if not ld or toolchain.linker_preference == "rust":
+ # Windows MSVC Rust targets can inherit a GNU-flavored C++ linker path
+ # (`clang++`) alongside MSVC-style arguments. Prefer the toolchain linker
+ # there so both exec helpers and ordinary MSVC Rust targets link through
+ # the Windows direct linker instead.
+ use_windows_rust_linker = (
+ toolchain.target_os.startswith("windows") and
+ toolchain.target_abi == "msvc" and
+ toolchain.linker != None
+ )
+
+ if not ld or toolchain.linker_preference == "rust" or use_windows_rust_linker:
ld = toolchain.linker.path
ld_is_direct_driver = toolchain.linker_type == "direct"