From: Yuval Pavel Zholkover Date: Fri, 23 Mar 2018 14:53:26 +0000 (+0300) Subject: runtime: fix AT_HWCAP auxv parsing on freebsd X-Git-Tag: go1.11beta1~1131 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6f47fa2d6c6b2d4fdfc5b3a98fa8e3cd8469ca16;p=gostls13.git runtime: fix AT_HWCAP auxv parsing on freebsd AT_HWCAP is not available on FreeBSD-11.1-RELEASE or earlier and the wrong const was used. Use the correct value, and initialize hwcap with ^uint32(0) inorder not to fail the VFP tests. Fixes #24507. Change-Id: I5c3eed57bb53bf992b7de0eec88ea959806306b9 Reviewed-on: https://go-review.googlesource.com/102355 Reviewed-by: Tobias Klauser Reviewed-by: Ian Lance Taylor Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot --- diff --git a/src/runtime/os_freebsd.go b/src/runtime/os_freebsd.go index b09dc04433..fafe7f470b 100644 --- a/src/runtime/os_freebsd.go +++ b/src/runtime/os_freebsd.go @@ -380,7 +380,7 @@ func sysargs(argc int32, argv **byte) { const ( _AT_NULL = 0 // Terminates the vector _AT_PAGESZ = 6 // Page size in bytes - _AT_HWCAP = 16 // CPU feature flags + _AT_HWCAP = 26 // CPU feature flags ) func sysauxv(auxv []uintptr) { diff --git a/src/runtime/os_freebsd_arm.go b/src/runtime/os_freebsd_arm.go index a8581b1c8e..f0d04244f3 100644 --- a/src/runtime/os_freebsd_arm.go +++ b/src/runtime/os_freebsd_arm.go @@ -10,8 +10,8 @@ const ( _HWCAP_IDIVA = 1 << 17 ) -var hwcap uint32 // set by archauxv -var hardDiv bool // set if a hardware divider is available +var hwcap = ^uint32(0) // set by archauxv +var hardDiv bool // set if a hardware divider is available func checkgoarm() { if goarm > 5 && hwcap&_HWCAP_VFP == 0 {