diff --git a/MODULE.bazel b/MODULE.bazel index fe03597ef5..33cd672b4f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -13,6 +13,7 @@ single_version_override( "//patches:llvm_rusty_v8_custom_libcxx.patch", "//patches:llvm_windows_arm64_powl.patch", "//patches:llvm_windows_symlink_extract.patch", + "//patches:llvm_windows_msvcrt_ucrt_compat.patch", ], ) # Abseil picks a MinGW pthread TLS path that does not match our hermetic diff --git a/patches/BUILD.bazel b/patches/BUILD.bazel index f24f059197..4aaff9b6e9 100644 --- a/patches/BUILD.bazel +++ b/patches/BUILD.bazel @@ -6,6 +6,7 @@ exports_files([ "bzip2_windows_stack_args.patch", "llvm_rusty_v8_custom_libcxx.patch", "llvm_windows_arm64_powl.patch", + "llvm_windows_msvcrt_ucrt_compat.patch", "llvm_windows_symlink_extract.patch", "rules_rust_windows_bootstrap_process_wrapper_linker.patch", "rules_rust_windows_build_script_runner_paths.patch", diff --git a/patches/llvm_windows_msvcrt_ucrt_compat.patch b/patches/llvm_windows_msvcrt_ucrt_compat.patch new file mode 100644 index 0000000000..24a49b13e8 --- /dev/null +++ b/patches/llvm_windows_msvcrt_ucrt_compat.patch @@ -0,0 +1,29 @@ +# What: retain the UCRT compatibility archive when targeting Windows MSVCRT. +# Why: rules_rs correctly models windows-gnullvm as MSVCRT, while V8 and libc++ +# still reference a small set of UCRT compatibility symbols. + +diff --git a/runtimes/mingw/BUILD.bazel b/runtimes/mingw/BUILD.bazel +index 12f3507..a93d4e7 100644 +--- a/runtimes/mingw/BUILD.bazel ++++ b/runtimes/mingw/BUILD.bazel +@@ -429,6 +429,7 @@ copy_to_directory( + "//constraints/windows/crt:msvcrt": [ + ":msvcrt_common", + ":msvcrt_extra", ++ ":ucrt", + ], + "//constraints/windows/crt:ucrt": [ + ":ucrt", +diff --git a/toolchain/args/windows/BUILD.bazel b/toolchain/args/windows/BUILD.bazel +index f8f6d49..edcedf0 100644 +--- a/toolchain/args/windows/BUILD.bazel ++++ b/toolchain/args/windows/BUILD.bazel +@@ -54,6 +54,8 @@ cc_args( + "-lmsvcrt_common", + "-lmsvcrt_extra", + "-lmsvcrt", ++ # V8 and libc++ still reference UCRT compatibility symbols. ++ "-lucrt", + ], + "//constraints/windows/crt:ucrt": [ + "-lucrt",