cmd/gomobile: handle NDK path for darwin/arm64

This change allows TestBindAndroid to pass.

Fixes golang/go#46464

Change-Id: I8cc3edb21fe9ae9efdc0c8c243a4098553b06e5e
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346153
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
diff --git a/cmd/gomobile/env.go b/cmd/gomobile/env.go
index 6dacc63..13b0ab0 100644
--- a/cmd/gomobile/env.go
+++ b/cmd/gomobile/env.go
@@ -294,6 +294,15 @@
 			arch = "x86"
 		case "amd64":
 			arch = "x86_64"
+		case "arm64":
+			// Android NDK does not contain arm64 toolchains (until and
+			// including NDK 23), use use x86_64 instead. See:
+			// https://github.com/android/ndk/issues/1299
+			if runtime.GOOS == "darwin" {
+				arch = "x86_64"
+				break
+			}
+			fallthrough
 		default:
 			panic("unsupported GOARCH: " + runtime.GOARCH)
 		}