mirror of
https://github.com/golang/go
synced 2024-11-05 12:06:15 -07:00
cmd/dist: reactivate vfp detection on linux/arm
Fixes #9732 Fixes #9819 Rather than detecting vfp support via catching SIGILL signals, parse the contents of /proc/cpuinfo. As the GOARM values for NaCl and freebsd are hard coded, this parsing logic only needs to support linux/arm. This change also fixes the nacl/arm build which is broken because the first stage of nacltest.bash is executed with GOARM=5, embedding that into 5g. The second stage of nacltest.bash correctly detects GOARM=7, but this is ignored as we pass --no-clean at that point, and thus do not replace the compiler. Lastyly, include a fix to error message in nacltest.bash Change-Id: I13f306ff07a99b44b493fade72ac00d0d5097e1c Reviewed-on: https://go-review.googlesource.com/3981 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
0661143447
commit
e6fbce3596
48
src/cmd/dist/util.go
vendored
48
src/cmd/dist/util.go
vendored
@ -471,24 +471,38 @@ func xgetgoarm() string {
|
|||||||
// FreeBSD has broken VFP support.
|
// FreeBSD has broken VFP support.
|
||||||
return "5"
|
return "5"
|
||||||
}
|
}
|
||||||
if xtryexecfunc(useVFPv3) {
|
if goos != "linux" {
|
||||||
|
// All other arm platforms that we support
|
||||||
|
// require ARMv7.
|
||||||
return "7"
|
return "7"
|
||||||
}
|
}
|
||||||
if xtryexecfunc(useVFPv1) {
|
cpuinfo := readfile("/proc/cpuinfo")
|
||||||
return "6"
|
goarm := "5"
|
||||||
|
for _, line := range splitlines(cpuinfo) {
|
||||||
|
line := strings.SplitN(line, ":", 2)
|
||||||
|
if len(line) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if strings.TrimSpace(line[0]) != "Features" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
features := splitfields(line[1])
|
||||||
|
sort.Strings(features) // so vfpv3 sorts after vfp
|
||||||
|
|
||||||
|
// Infer GOARM value from the vfp features available
|
||||||
|
// on this host. Values of GOARM detected are:
|
||||||
|
// 5: no vfp support was found
|
||||||
|
// 6: vfp (v1) support was detected, but no higher
|
||||||
|
// 7: vfpv3 support was detected.
|
||||||
|
// This matches the assertions in runtime.checkarm.
|
||||||
|
for _, f := range features {
|
||||||
|
switch f {
|
||||||
|
case "vfp":
|
||||||
|
goarm = "6"
|
||||||
|
case "vfpv3":
|
||||||
|
goarm = "7"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return "5"
|
return goarm
|
||||||
}
|
}
|
||||||
|
|
||||||
func xtryexecfunc(f func()) bool {
|
|
||||||
// TODO(rsc): Implement.
|
|
||||||
// The C cmd/dist used this to test whether certain assembly
|
|
||||||
// sequences could be executed properly. It used signals and
|
|
||||||
// timers and sigsetjmp, which is basically not possible in Go.
|
|
||||||
// We probably have to invoke ourselves as a subprocess instead,
|
|
||||||
// to contain the fault/timeout.
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func useVFPv1()
|
|
||||||
func useVFPv3()
|
|
||||||
|
15
src/cmd/dist/vfp_arm.s
vendored
15
src/cmd/dist/vfp_arm.s
vendored
@ -1,15 +0,0 @@
|
|||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
// try to run "vmov.f64 d0, d0" instruction
|
|
||||||
TEXT ·useVFPv1(SB),NOSPLIT,$0
|
|
||||||
WORD $0xeeb00b40 // vmov.f64 d0, d0
|
|
||||||
RET
|
|
||||||
|
|
||||||
// try to run VFPv3-only "vmov.f64 d0, #112" instruction
|
|
||||||
TEXT ·useVFPv3(SB),NOSPLIT,$0
|
|
||||||
WORD $0xeeb70b00 // vmov.f64 d0, #112
|
|
||||||
RET
|
|
14
src/cmd/dist/vfp_default.s
vendored
14
src/cmd/dist/vfp_default.s
vendored
@ -1,14 +0,0 @@
|
|||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !arm
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
TEXT ·useVFPv1(SB),NOSPLIT,$0
|
|
||||||
RET
|
|
||||||
|
|
||||||
TEXT ·useVFPv3(SB),NOSPLIT,$0
|
|
||||||
RET
|
|
||||||
|
|
@ -62,7 +62,7 @@ fi
|
|||||||
# Run host build to get toolchain for running zip generator.
|
# Run host build to get toolchain for running zip generator.
|
||||||
unset GOOS GOARCH
|
unset GOOS GOARCH
|
||||||
if [ ! -f make.bash ]; then
|
if [ ! -f make.bash ]; then
|
||||||
echo 'nacl.bash must be run from $GOROOT/src' 1>&2
|
echo 'nacltest.bash must be run from $GOROOT/src' 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH ./make.bash
|
GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH ./make.bash
|
||||||
|
Loading…
Reference in New Issue
Block a user