File size: 1,352 Bytes
2ee40b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 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",