diff --git a/MODULE.bazel b/MODULE.bazel index 015e4369a5..61ed91ca33 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,6 +4,7 @@ single_version_override( module_name = "toolchains_llvm_bootstrapped", patch_strip = 1, patches = [ + "//patches:toolchains_llvm_bootstrapped_mingw_cfguard.patch", "//patches:toolchains_llvm_bootstrapped_resource_dir.patch", ], ) @@ -39,6 +40,10 @@ bazel_dep(name = "rules_rs", version = "0.0.23") archive_override( module_name = "rules_rs", integrity = "sha256-C5nTK7oyhrP+qWGx+AXHlWk4hz6PlC2F9sTvO/gM77g=", + patch_strip = 1, + patches = [ + "//patches:rules_rs_windows_gnullvm_exec.patch", + ], strip_prefix = "rules_rs-7a47423f9f52de881b82beda8b1d8a76968775aa", url = "https://github.com/dzbarsky/rules_rs/archive/7a47423f9f52de881b82beda8b1d8a76968775aa.tar.gz", ) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 07415816f9..ff6b423748 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1503,16 +1503,18 @@ }, "@@rules_rs+//rs/experimental/toolchains:module_extension.bzl%toolchains": { "cargo-1.93.0-aarch64-apple-darwin.tar.xz": "6443909350322ad07f09bb5edfd9ff29268e6fe88c7d78bfba7a5e254248dc25", - "cargo-1.93.0-aarch64-pc-windows-gnullvm.tar.xz": "387832b989c8eb96c9ebd66402a87962167633bc6d91a49ffb8c7903c45f3476", + "cargo-1.93.0-aarch64-pc-windows-msvc.tar.xz": "155bff7a16aa7054e7ed7c3a82e362d4b302b3882d751b823e06ff63ae3f103d", "cargo-1.93.0-aarch64-unknown-linux-gnu.tar.xz": "5998940b8b97286bb67facb1a85535eeb3d4d7a61e36a85e386e5c0c5cfe5266", "cargo-1.93.0-x86_64-apple-darwin.tar.xz": "95a47c5ed797c35419908f04188d8b7de09946e71073c4b72632b16f5b10dfae", "cargo-1.93.0-x86_64-pc-windows-gnullvm.tar.xz": "f19766837559f90476508140cb95cc708220012ec00a854fa9f99187b1f246b6", + "cargo-1.93.0-x86_64-pc-windows-msvc.tar.xz": "e59c5e2baa9ec17261f2cda6676ebf7b68b21a860e3f7451c4d964728951da75", "cargo-1.93.0-x86_64-unknown-linux-gnu.tar.xz": "c23de3ae709ff33eed5e4ae59d1f9bcd75fa4dbaa9fb92f7b06bfb534b8db880", "clippy-1.93.0-aarch64-apple-darwin.tar.xz": "0b6e943a8d12be0e68575acf59c9ea102daf795055fcbbf862b0bfd35ec40039", - "clippy-1.93.0-aarch64-pc-windows-gnullvm.tar.xz": "296949f49be2de77ce9d1c5023a5f0a58e28e329eec03642a3da0e175a67beeb", + "clippy-1.93.0-aarch64-pc-windows-msvc.tar.xz": "07bcf2edb88cdf5ead2f02e4a8493e9b0ef935a31253fac6f9f3378d8023f113", "clippy-1.93.0-aarch64-unknown-linux-gnu.tar.xz": "872ae6d68d625946d281b91d928332e6b74f6ab269b6af842338df4338805a60", "clippy-1.93.0-x86_64-apple-darwin.tar.xz": "e6d0b1afb9607c14a1172d09ee194a032bbb3e48af913d55c5a473e0559eddde", "clippy-1.93.0-x86_64-pc-windows-gnullvm.tar.xz": "b6f1f7264ed6943c59dedfb9531fbadcc3c0fcf273c940a63d58898b14a1060f", + "clippy-1.93.0-x86_64-pc-windows-msvc.tar.xz": "25fb103390bf392980b4689ac09b2ec2ab4beefb7022a983215b613ad05eab57", "clippy-1.93.0-x86_64-unknown-linux-gnu.tar.xz": "793108977514b15c0f45ade28ae35c58b05370cb0f22e89bd98fdfa61eabf55d", "rust-std-1.93.0-aarch64-apple-darwin.tar.xz": "8603c63715349636ed85b4fe716c4e827a727918c840e54aff5b243cedadf19b", "rust-std-1.93.0-aarch64-apple-ios-macabi.tar.xz": "24d47e615ce101869ff452a572a6b77ed7cf70f2454d0b50892ac849e8c7ac4d", @@ -1580,16 +1582,18 @@ "rust-std-1.93.0-x86_64-unknown-none.tar.xz": "01dcca7ae4b7e82fbfa399adb5e160afaa13143e5a17e1e0737c38cf07365fb3", "rust-std-1.93.0-x86_64-unknown-uefi.tar.xz": "ec4e439d9485ce752b56999e8e41ed82373fc833a005cf2531c6f7ef7e785392", "rustc-1.93.0-aarch64-apple-darwin.tar.xz": "092be03c02b44c405dab1232541c84f32b2d9e8295747568c3d531dd137221dc", - "rustc-1.93.0-aarch64-pc-windows-gnullvm.tar.xz": "d3bc0cdaf157e20b1f23e510b5e3c4c6e9117d08f5284c04dee60aecff1bc851", + "rustc-1.93.0-aarch64-pc-windows-msvc.tar.xz": "a3ac1a8e411de8470f71b366f89d187718c431526912b181692ed0a18c56c7ad", "rustc-1.93.0-aarch64-unknown-linux-gnu.tar.xz": "1a9045695892ec08d8e9751bf7cf7db71fe27a6202dd12ce13aca48d0602dbde", "rustc-1.93.0-x86_64-apple-darwin.tar.xz": "594bb293f0a4f444656cf8dec2149fcb979c606260efee9e09bcf8c9c6ed6ae7", "rustc-1.93.0-x86_64-pc-windows-gnullvm.tar.xz": "0cdaa8de66f5ce21d1ea73917efc5c64f408bda49f678ddde19465ced9d5ec63", + "rustc-1.93.0-x86_64-pc-windows-msvc.tar.xz": "fa17677eee0d83eb055b309953184bf87ba634923d8897f860cda65d55c6e350", "rustc-1.93.0-x86_64-unknown-linux-gnu.tar.xz": "00c6e6740ea6a795e33568cd7514855d58408a1180cd820284a7bbf7c46af715", "rustfmt-1.93.0-aarch64-apple-darwin.tar.xz": "0dd1faedf0768ef362f4aae4424b34e8266f2b9cf5e76ea4fcaf780220b363a0", - "rustfmt-1.93.0-aarch64-pc-windows-gnullvm.tar.xz": "5888827e7fbd7d59930870b4856fce8d6d8fca5e02f6535f8ae3d7ad0ccf2d4a", + "rustfmt-1.93.0-aarch64-pc-windows-msvc.tar.xz": "24eed108489567133bbfe40c8eacda1567be55fae4c526911b39eb33eb27a6cb", "rustfmt-1.93.0-aarch64-unknown-linux-gnu.tar.xz": "92e1acb45ae642136258b4dabb39302af2d53c83e56ebd5858bc969f9e5c141a", "rustfmt-1.93.0-x86_64-apple-darwin.tar.xz": "c8453b4c5758eb39423042ffa9c23ed6128cbed2b15b581e5e1192c9cc0b1d4e", "rustfmt-1.93.0-x86_64-pc-windows-gnullvm.tar.xz": "47167e9e78db9be4503a060dee02f4df2cda252da32175dbf44331f965a747b9", + "rustfmt-1.93.0-x86_64-pc-windows-msvc.tar.xz": "5becc7c2dba4b9ab5199012cad30829235a7f7fb5d85a238697e8f0e44cbd9af", "rustfmt-1.93.0-x86_64-unknown-linux-gnu.tar.xz": "7f81f6c17d11a7fda5b4e1b111942fb3b23d30dcec767e13e340ebfb762a5e33" } } diff --git a/patches/rules_rs_windows_gnullvm_exec.patch b/patches/rules_rs_windows_gnullvm_exec.patch new file mode 100644 index 0000000000..a5c02a86db --- /dev/null +++ b/patches/rules_rs_windows_gnullvm_exec.patch @@ -0,0 +1,115 @@ +diff --git a/rs/experimental/platforms/triples.bzl b/rs/experimental/platforms/triples.bzl +index d4892e922..e4a3cd534 100644 +--- a/rs/experimental/platforms/triples.bzl ++++ b/rs/experimental/platforms/triples.bzl +@@ -30,6 +30,7 @@ SUPPORTED_EXEC_TRIPLES = [ + "x86_64-unknown-linux-gnu", + "aarch64-unknown-linux-gnu", + "x86_64-pc-windows-msvc", ++ "x86_64-pc-windows-gnullvm", + "aarch64-pc-windows-msvc", + "x86_64-apple-darwin", + "aarch64-apple-darwin", +diff --git a/rs/experimental/toolchains/declare_toolchains.bzl b/rs/experimental/toolchains/declare_toolchains.bzl +index 377e758eb..ab2908d14 100644 +--- a/rs/experimental/toolchains/declare_toolchains.bzl ++++ b/rs/experimental/toolchains/declare_toolchains.bzl +@@ -12,6 +12,11 @@ def _channel(version): + return "beta" + return "stable" + ++def _exec_triple_suffix(exec_triple): ++ if exec_triple.system == "windows": ++ return "{}_{}_{}".format(exec_triple.system, exec_triple.arch, exec_triple.abi) ++ return "{}_{}".format(exec_triple.system, exec_triple.arch) ++ + def declare_toolchains( + *, + version, +@@ -26,13 +31,12 @@ def declare_toolchains( + # Rustfmt + for triple in execs: + exec_triple = _parse_triple(triple) +- triple_suffix = exec_triple.system + "_" + exec_triple.arch ++ triple_suffix = _exec_triple_suffix(exec_triple) + + repo_label = "@rust_toolchain_artifacts_{}_{}//:".format(triple_suffix, version_key) + +- rustfmt_toolchain_name = "{}_{}_{}_rustfmt_toolchain".format( +- exec_triple.system, +- exec_triple.arch, ++ rustfmt_toolchain_name = "{}_{}_rustfmt_toolchain".format( ++ triple_suffix, + version_key, + ) + +@@ -46,11 +50,8 @@ def declare_toolchains( + ) + + native.toolchain( +- name = "{}_{}_rustfmt_{}".format(exec_triple.system, exec_triple.arch, version_key), +- exec_compatible_with = [ +- "@platforms//os:" + exec_triple.system, +- "@platforms//cpu:" + exec_triple.arch, +- ], ++ name = "{}_rustfmt_{}".format(triple_suffix, version_key), ++ exec_compatible_with = triple_to_constraint_set(triple), + target_compatible_with = [], + target_settings = [ + "@rules_rust//rust/toolchain/channel:" + channel, +@@ -63,13 +64,12 @@ def declare_toolchains( + # Rustc + for triple in execs: + exec_triple = _parse_triple(triple) +- triple_suffix = exec_triple.system + "_" + exec_triple.arch ++ triple_suffix = _exec_triple_suffix(exec_triple) + + repo_label = "@rust_toolchain_artifacts_{}_{}//:".format(triple_suffix, version_key) + +- rust_toolchain_name = "{}_{}_{}_rust_toolchain".format( +- exec_triple.system, +- exec_triple.arch, ++ rust_toolchain_name = "{}_{}_rust_toolchain".format( ++ triple_suffix, + version_key, + ) + +@@ -130,11 +130,8 @@ def declare_toolchains( + target_key = sanitize_triple(target_triple) + + native.toolchain( +- name = "{}_{}_to_{}_{}".format(exec_triple.system, exec_triple.arch, target_key, version_key), +- exec_compatible_with = [ +- "@platforms//os:" + exec_triple.system, +- "@platforms//cpu:" + exec_triple.arch, +- ], ++ name = "{}_to_{}_{}".format(triple_suffix, target_key, version_key), ++ exec_compatible_with = triple_to_constraint_set(triple), + target_compatible_with = triple_to_constraint_set(target_triple), + target_settings = [ + "@rules_rust//rust/toolchain/channel:" + channel, +diff --git a/rs/experimental/toolchains/module_extension.bzl b/rs/experimental/toolchains/module_extension.bzl +index 04477fefa..55fe0fce0 100644 +--- a/rs/experimental/toolchains/module_extension.bzl ++++ b/rs/experimental/toolchains/module_extension.bzl +@@ -37,6 +37,11 @@ def _normalize_arch_name(arch): + return "aarch64" + return arch + ++def _exec_triple_suffix(exec_triple): ++ if exec_triple.system == "windows": ++ return "{}_{}_{}".format(exec_triple.system, exec_triple.arch, exec_triple.abi) ++ return "{}_{}".format(exec_triple.system, exec_triple.arch) ++ + def _sanitize_path_fragment(path): + return path.replace("/", "_").replace(":", "_") + +@@ -230,7 +235,7 @@ def _toolchains_impl(mctx): + if cargo_sha == None: + fail("Could not determine cargo sha for {}".format(triple)) + +- triple_suffix = exec_triple.system + "_" + exec_triple.arch ++ triple_suffix = _exec_triple_suffix(exec_triple) + + rust_toolchain_artifacts( + name = "rust_toolchain_artifacts_{}_{}".format(triple_suffix, version_key), diff --git a/patches/toolchains_llvm_bootstrapped_mingw_cfguard.patch b/patches/toolchains_llvm_bootstrapped_mingw_cfguard.patch new file mode 100644 index 0000000000..67cabb0f71 --- /dev/null +++ b/patches/toolchains_llvm_bootstrapped_mingw_cfguard.patch @@ -0,0 +1,12 @@ +diff --git a/runtimes/mingw/crt_sources.bzl b/runtimes/mingw/crt_sources.bzl +index 744f076..1a8a204 100644 +--- a/runtimes/mingw/crt_sources.bzl ++++ b/runtimes/mingw/crt_sources.bzl +@@ -336,6 +336,7 @@ MINGWEX_TEXTUAL_SRCS = [ + ] + + MINGWEX_X86_SRCS = [ ++ "cfguard/guard_dispatch.S", + "math/cbrtl.c", + "math/erfl.c", + "math/fdiml.c",