# What: use the bundled Windows direct linker for `rules_rs` exec toolchains # and preserve the Windows stdlib link flags required by Codex's direct-link path. # Scope: Windows-only linker metadata for the generated `rules_rs` toolchains. # # `rules_rs` 0.0.86 now exposes the bundled rust-lld target itself, so the old # repository-time PATH lookup and lld-link.exe symlink are no longer needed. diff --git a/rs/toolchains/declare_rustc_toolchains.bzl b/rs/toolchains/declare_rustc_toolchains.bzl index bbf383c..7a9e4cd 100644 --- a/rs/toolchains/declare_rustc_toolchains.bzl +++ b/rs/toolchains/declare_rustc_toolchains.bzl @@ -96,7 +96,7 @@ def declare_rustc_toolchains( linker = select({ "@platforms//cpu:wasm32": "{}rust-lld".format(rustc_repo_label), "@platforms//cpu:wasm64": "{}rust-lld".format(rustc_repo_label), - "//conditions:default": None, + "//conditions:default": "{}rust-lld".format(rustc_repo_label) if exec_triple.system == "windows" else None, }), linker_type = "direct", rust_objcopy = "{}rust-objcopy".format(rustc_repo_label), @@ -142,12 +142,18 @@ def declare_rustc_toolchains( "@platforms//os:openbsd": ["-lpthread"], "@platforms//os:ios": ["-lSystem", "-lobjc", "-Wl,-framework,Security", "-Wl,-framework,Foundation", "-lresolv"], "@llvm//constraints/windows/abi:gnu": ["-lws2_32", "-luserenv", "-lbcrypt", "-lntdll", "-lsynchronization"], - "@llvm//constraints/windows/abi:gnullvm": ["-lws2_32", "-luserenv", "-lbcrypt", "-lntdll", "-lsynchronization"], + "@llvm//constraints/windows/abi:gnullvm": [ + "advapi32.lib", + "ws2_32.lib", + "userenv.lib", + "Bcrypt.lib", + ], "@llvm//constraints/windows/abi:msvc": [ "advapi32.lib", "ws2_32.lib", "userenv.lib", "Bcrypt.lib", + "ucrt.lib", ], "//conditions:default": [], }),