# What: provide MinGW compatibility archives required by Windows gnullvm links. # Why: clang and prebuilt MSVC archives can request these names even though the # hermetic MinGW runtime does not publish them by default. diff --git a/runtimes/mingw/BUILD.bazel b/runtimes/mingw/BUILD.bazel --- a/runtimes/mingw/BUILD.bazel +++ b/runtimes/mingw/BUILD.bazel @@ -386,14 +386,42 @@ 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 = [ + ":libcmt", ":m", ":mingw32", ":mingwex", ":moldname", + ":oldnames", ":pthread", + ":ssp", + ":ssp_nonshared", ":stdc++", ":uuid", ":winpthread",