Skip to content

Commit 888bac1

Browse files
committed
cmd/dist: detect GOHOSTARCH on iOS
cmd/dist defaults to GOHOSTARCH=amd64 on darwin because no other darwin host could build Go. With the upcoming self-hosted iOS builders, GOHOSTARCH=arm64 is also possible. Updates #31722 Change-Id: I9af47d9f8c57ea45475ce498acefbfe6bf4815b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/174306 Run-TryBot: Elias Naur <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent d7edc91 commit 888bac1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/cmd/dist/main.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ func main() {
6060
// uname -m doesn't work under AIX
6161
gohostarch = "ppc64"
6262
case "darwin":
63-
// Even on 64-bit platform, darwin uname -m prints i386.
64-
// We don't support any of the OS X versions that run on 32-bit-only hardware anymore.
65-
gohostarch = "amd64"
6663
// macOS 10.9 and later require clang
6764
defaultclang = true
6865
case "freebsd":
@@ -107,6 +104,11 @@ func main() {
107104
gohostarch = "amd64"
108105
case strings.Contains(out, "86"):
109106
gohostarch = "386"
107+
if gohostos == "darwin" {
108+
// Even on 64-bit platform, some versions of macOS uname -m prints i386.
109+
// We don't support any of the OS X versions that run on 32-bit-only hardware anymore.
110+
gohostarch = "amd64"
111+
}
110112
case strings.Contains(out, "aarch64"), strings.Contains(out, "arm64"):
111113
gohostarch = "arm64"
112114
case strings.Contains(out, "arm"):
@@ -128,8 +130,8 @@ func main() {
128130
case strings.Contains(out, "s390x"):
129131
gohostarch = "s390x"
130132
case gohostos == "darwin":
131-
if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM_") {
132-
gohostarch = "arm"
133+
if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM64_") {
134+
gohostarch = "arm64"
133135
}
134136
default:
135137
fatalf("unknown architecture: %s", out)

0 commit comments

Comments
 (0)