diff --git a/patches/abseil_windows_gnullvm_thread_identity.patch b/patches/abseil_windows_gnullvm_thread_identity.patch new file mode 100644 index 0000000000..27c4ecf71f --- /dev/null +++ b/patches/abseil_windows_gnullvm_thread_identity.patch @@ -0,0 +1,16 @@ +# What: avoid MinGW pthread TLS linkage in Abseil thread identity selection. +# Scope: one MinGW-specific preprocessor branch in Abseil's internal +# thread-identity mode selection; no other Abseil behavior changes. + +diff --git a/absl/base/internal/thread_identity.h b/absl/base/internal/thread_identity.h +--- a/absl/base/internal/thread_identity.h ++++ b/absl/base/internal/thread_identity.h +@@ -217,6 +217,8 @@ + #error ABSL_THREAD_IDENTITY_MODE cannot be directly set + #elif defined(ABSL_FORCE_THREAD_IDENTITY_MODE) + #define ABSL_THREAD_IDENTITY_MODE ABSL_FORCE_THREAD_IDENTITY_MODE ++#elif defined(__MINGW32__) ++#define ABSL_THREAD_IDENTITY_MODE ABSL_THREAD_IDENTITY_MODE_USE_CPP11 + #elif defined(_WIN32) && !defined(__MINGW32__) + #define ABSL_THREAD_IDENTITY_MODE ABSL_THREAD_IDENTITY_MODE_USE_CPP11 + #elif defined(__APPLE__) && defined(ABSL_HAVE_THREAD_LOCAL) diff --git a/patches/llvm_windows_symlink_extract.patch b/patches/llvm_windows_symlink_extract.patch new file mode 100644 index 0000000000..9f548636b2 --- /dev/null +++ b/patches/llvm_windows_symlink_extract.patch @@ -0,0 +1,64 @@ +diff --git a/extensions/llvm_source.bzl b/extensions/llvm_source.bzl +index 89dcf81..cf27c92 100644 +--- a/extensions/llvm_source.bzl ++++ b/extensions/llvm_source.bzl +@@ -83,6 +83,13 @@ def _llvm_source_archive_excludes(): + "offload", + "libc/docs", + "libc/utils/gn", ++ # These entries are unix symlinks in the upstream source tarball. ++ # Windows tar.exe cannot materialize them during repository extraction, ++ # but nothing in our Bazel usage needs the symlink entrypoints. ++ "llvm/utils/mlgo-utils/extract_ir.py", ++ "llvm/utils/mlgo-utils/make_corpus.py", ++ "llvm/utils/mlgo-utils/combine_training_corpus.py", ++ "llvm/docs/_themes/llvm-theme", + ] + + test_docs_subprojects = [ +diff --git a/runtimes/mingw/BUILD.bazel b/runtimes/mingw/BUILD.bazel +index ebd99db..9eb5d5b 100644 +--- a/runtimes/mingw/BUILD.bazel ++++ b/runtimes/mingw/BUILD.bazel +@@ -334,6 +334,30 @@ stub_library( + name = "stdc++", + ) + ++# Clang may inject -lssp and -lssp_nonshared for windows-gnu links. ++# Provide compatibility archives in the MinGW runtime search directory. ++stub_library( ++ name = "ssp", ++) ++ ++stub_library( ++ name = "ssp_nonshared", ++) ++ ++# Prebuilt MSVC archives can carry /DEFAULTLIB:libcmt.lib and ++# /DEFAULTLIB:oldnames.lib directives. Provide MinGW-compatible stand-ins so ++# lld can satisfy the lookup under windows-gnullvm. ++stub_library( ++ name = "libcmt", ++) ++ ++copy_file( ++ name = "oldnames", ++ src = ":moldname", ++ out = "liboldnames.a", ++ visibility = ["//visibility:public"], ++) ++ + copy_to_directory( + name = "mingw_crt_library_search_directory", + srcs = [ +@@ -344,6 +364,10 @@ copy_to_directory( + ":moldname", ++ ":oldnames", + ":pthread", + ":stdc++", ++ ":ssp", ++ ":ssp_nonshared", ++ ":libcmt", + ":ucrt", + ":ucrtbase", + ":ucrtbased",