Skip to content

Commit eaf2125

Browse files
committed
cmd/go: default to "exe" build mode for windows -race
This patch changes the default build mode from "pie" to "exe" when building programs on windows with "-race" in effect. The Go command already issues an error if users explicitly ask for -buildmode=pie in combination with -race on windows, but wasn't revising the default "pie" build mode if a specific buildmode was not requested. Updates #53539. Updates #35006. Change-Id: I2f81a41a1d15a0b4f5ae943146175c5a1202cbe0 Reviewed-on: https://go-review.googlesource.com/c/go/+/416174 Reviewed-by: Alex Brainman <[email protected]> Reviewed-by: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Than McIntosh <[email protected]>
1 parent 1243ec9 commit eaf2125

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cmd/go/internal/work/init.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ func buildModeInit() {
211211
codegenArg = "-shared"
212212
ldBuildmode = "pie"
213213
case "windows":
214-
ldBuildmode = "pie"
214+
if cfg.BuildRace {
215+
ldBuildmode = "exe"
216+
} else {
217+
ldBuildmode = "pie"
218+
}
215219
case "ios":
216220
codegenArg = "-shared"
217221
ldBuildmode = "pie"

0 commit comments

Comments
 (0)