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 <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Yuval Pavel Zholkover 2018-03-23 17:53:26 +03:00 committed by Ian Lance Taylor
parent 41402b59bd
commit 6f47fa2d6c
2 changed files with 3 additions and 3 deletions

View File

@ -380,7 +380,7 @@ func sysargs(argc int32, argv **byte) {
const ( const (
_AT_NULL = 0 // Terminates the vector _AT_NULL = 0 // Terminates the vector
_AT_PAGESZ = 6 // Page size in bytes _AT_PAGESZ = 6 // Page size in bytes
_AT_HWCAP = 16 // CPU feature flags _AT_HWCAP = 26 // CPU feature flags
) )
func sysauxv(auxv []uintptr) { func sysauxv(auxv []uintptr) {

View File

@ -10,8 +10,8 @@ const (
_HWCAP_IDIVA = 1 << 17 _HWCAP_IDIVA = 1 << 17
) )
var hwcap uint32 // set by archauxv var hwcap = ^uint32(0) // set by archauxv
var hardDiv bool // set if a hardware divider is available var hardDiv bool // set if a hardware divider is available
func checkgoarm() { func checkgoarm() {
if goarm > 5 && hwcap&_HWCAP_VFP == 0 { if goarm > 5 && hwcap&_HWCAP_VFP == 0 {