]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: add needCC comment, fix needCC
authorRuss Cox <rsc@golang.org>
Mon, 13 Mar 2023 17:14:35 +0000 (13:14 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 14 Mar 2023 03:09:31 +0000 (03:09 +0000)
This was missed in CL 475377.

Change-Id: I4e8c4c0459a92029a3f448c1e4172d3343280c57
Reviewed-on: https://go-review.googlesource.com/c/go/+/475958
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/dist/build.go

index 25f75804e04550f25ebdd0559b8e2e0553134a84..4dc14b9501fbcc73485fa812bbb9b9f12ea244fc 100644 (file)
@@ -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() {