From: Russ Cox Date: Mon, 13 Mar 2023 17:14:35 +0000 (-0400) Subject: cmd/dist: add needCC comment, fix needCC X-Git-Tag: go1.21rc1~1292 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8b3dc5399d507f168128f7102ddb300f9b14895d;p=gostls13.git cmd/dist: add needCC comment, fix needCC This was missed in CL 475377. Change-Id: I4e8c4c0459a92029a3f448c1e4172d3343280c57 Reviewed-on: https://go-review.googlesource.com/c/go/+/475958 TryBot-Result: Gopher Robot Run-TryBot: Russ Cox Reviewed-by: Bryan Mills --- diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 25f75804e0..4dc14b9501 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1742,8 +1742,10 @@ var firstClass = map[string]bool{ "windows/amd64": true, } +// We only need CC if cgo is forced on, or if the platform requires external linking. +// Otherwise the go command will automatically disable it. func needCC() bool { - return os.Getenv("CGO_ENABLED") == "1" + return os.Getenv("CGO_ENABLED") == "1" || mustLinkExternal(gohostos, gohostarch, false) } func checkCC() {