File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,15 @@ def emit_link(
77
77
if ((go .mode .static and not go .mode .pure ) or
78
78
go .mode .link != LINKMODE_NORMAL or
79
79
go .mode .goos == "windows" and (go .mode .race or go .mode .msan )):
80
+ # Force external linking for the following conditions:
81
+ # * Mode is static but not pure: -static must be passed to the C
82
+ # linker if the binary contains cgo code. See #2168, #2216.
83
+ # * Non-normal build mode: may not be strictly necessary, especially
84
+ # for modes like "pie".
85
+ # * Race or msan build for Windows: Go linker has pairwise
86
+ # incompatibilities with mingw, and we get link errors in race mode.
87
+ # Using the C linker avoids that. Race and msan always require a
88
+ # a C toolchain. See #2614.
80
89
tool_args .add ("-linkmode" , "external" )
81
90
if go .mode .static :
82
91
extldflags .append ("-static" )
You can’t perform that action at this time.
0 commit comments