mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
24 lines
1.1 KiB
Diff
24 lines
1.1 KiB
Diff
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl
|
|
index f9dea5f45..fcf620abd 100644
|
|
--- a/rust/private/rustc.bzl
|
|
+++ b/rust/private/rustc.bzl
|
|
@@ -419,7 +419,17 @@ def get_linker_and_args(ctx, crate_type, toolchain, cc_toolchain, feature_config
|
|
ld_is_direct_driver = False
|
|
|
|
use_bpf_linker = toolchain.target_arch in ("bpfeb", "bpfel") and toolchain.linker
|
|
- if not ld or toolchain.linker_preference == "rust" or use_bpf_linker:
|
|
+ # 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_bpf_linker or use_windows_rust_linker:
|
|
ld = toolchain.linker.path
|
|
ld_is_direct_driver = toolchain.linker_type == "direct"
|
|
|