]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/objabi: assume GOARM=7 on Android
authorElias Naur <mail@eliasnaur.com>
Tue, 24 Nov 2020 16:48:38 +0000 (17:48 +0100)
committerElias Naur <mail@eliasnaur.com>
Wed, 25 Nov 2020 16:10:37 +0000 (16:10 +0000)
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 <mail@eliasnaur.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Elias Naur <mail@eliasnaur.com>

src/cmd/dist/util.go
src/cmd/internal/objabi/util.go

index 0a419e465fe87a7f3b088611aa56c8d7c50e5d5d..9b4f8d2dec734d0dbcfbbfd14dcd993abe278201 100644 (file)
@@ -383,12 +383,6 @@ func xsamefile(f1, f2 string) bool {
 }
 
 func xgetgoarm() string {
-       if goos == "android" {
-               // Assume all android devices have VFPv3.
-               // These ports are also mostly cross-compiled, so it makes little
-               // sense to auto-detect the setting.
-               return "7"
-       }
        if gohostarch != "arm" || goos != gohostos {
                // Conservative default for cross-compilation.
                return "5"
index 9479ab2cd9fc438417ac8e57a68c90e2e703663d..d36e743580696f41b890dd732f316401ab51dfaf 100644 (file)
@@ -40,7 +40,12 @@ const (
 )
 
 func goarm() int {
-       switch v := envOr("GOARM", defaultGOARM); v {
+       def := defaultGOARM
+       if GOOS == "android" {
+               // Android devices always support GOARM=7.
+               def = "7"
+       }
+       switch v := envOr("GOARM", def); v {
        case "5":
                return 5
        case "6":