aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Naur <elias.naur@gmail.com>2016-12-22 18:31:17 +0100
committerElias Naur <elias.naur@gmail.com>2016-12-22 19:31:15 +0000
commitf419b56354aee87c5173253e2d19cc51cc269f3c (patch)
treed951cacb4117eadf757fde1e30a2bcd5e7834fa6
parent17190343e3db72a3f299e5a4359ae6bc3e5ed194 (diff)
downloadgo-f419b56354aee87c5173253e2d19cc51cc269f3c.tar.gz
go-f419b56354aee87c5173253e2d19cc51cc269f3c.zip
runtime: skip floating point hardware check on Android
CL 33652 removed the fake auxv for Android, and replaced it with a /proc/self/auxv fallback. When /proc/self/auxv is unreadable, however, hardware capabilities detection won't work and the runtime will mistakenly think that floating point hardware is unavailable. Fix this by always assuming floating point hardware on Android. Manually tested on a Nexus 5 running Android 6.0.1. I suspect the android/arm builder has a readable /proc/self/auxv and therefore does not trigger the failure mode. Change-Id: I95c3873803f9e17333c6cb8b9ff2016723104085 Reviewed-on: https://go-review.googlesource.com/34641 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Minux Ma <minux@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/runtime/os_linux_arm.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/os_linux_arm.go b/src/runtime/os_linux_arm.go
index 2b0834a5aa..896ec15e6a 100644
--- a/src/runtime/os_linux_arm.go
+++ b/src/runtime/os_linux_arm.go
@@ -18,6 +18,12 @@ var armArch uint8 = 6 // we default to ARMv6
var hwcap uint32 // set by setup_auxv
func checkgoarm() {
+ // On Android, /proc/self/auxv might be unreadable and hwcap won't
+ // reflect the CPU capabilities. Assume that every Android arm device
+ // has the necessary floating point hardware available.
+ if GOOS == "android" {
+ return
+ }
if goarm > 5 && hwcap&_HWCAP_VFP == 0 {
print("runtime: this CPU has no floating point hardware, so it cannot run\n")
print("this GOARM=", goarm, " binary. Recompile using GOARM=5.\n")