Skip to content

Commit b936548

Browse files
committed
cmd/internal/objabi: assume GOARM=7 on Android
CL 34641 changed the Go runtime to assume GOARM=7 support on Android. This change completes that by assuming GOARM=7 in the toolchain, fixing the gotcha of inexplicably slow performance on non-arm64 Android devices. There is already code in cmd/dist to force GOARM to 7 on GOOS=android. However, dist is most likely run with GOOS != android. Change-Id: I5e2bf11c3ecd0f6c193229eaa8ddc570722799d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/272846 Run-TryBot: Elias Naur <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]> Trust: Elias Naur <[email protected]>
1 parent df68e01 commit b936548

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/cmd/dist/util.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,6 @@ func xsamefile(f1, f2 string) bool {
383383
}
384384

385385
func xgetgoarm() string {
386-
if goos == "android" {
387-
// Assume all android devices have VFPv3.
388-
// These ports are also mostly cross-compiled, so it makes little
389-
// sense to auto-detect the setting.
390-
return "7"
391-
}
392386
if gohostarch != "arm" || goos != gohostos {
393387
// Conservative default for cross-compilation.
394388
return "5"

src/cmd/internal/objabi/util.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ const (
4040
)
4141

4242
func goarm() int {
43-
switch v := envOr("GOARM", defaultGOARM); v {
43+
def := defaultGOARM
44+
if GOOS == "android" {
45+
// Android devices always support GOARM=7.
46+
def = "7"
47+
}
48+
switch v := envOr("GOARM", def); v {
4449
case "5":
4550
return 5
4651
case "6":

0 commit comments

Comments
 (0)