Repository: go
Issue: cmd/dist: detect FPUless ARMv7 platforms?
Labels: help wanted,NeedsFix

Hi,
I'm trying to build Go on an FPUless ARMv7 platform:

```
[root@unknown src]$ cat /proc/cpuinfo
Processor       : ARMv7 Processor rev 0 (v7l)
processor       : 0
BogoMIPS        : 1599.07

processor       : 1
BogoMIPS        : 1595.80

Features        : swp half thumb fastmult edsp
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc09
CPU revision    : 0

Hardware        : Northstar Prototype
Revision        : 0000
Serial          : 0000000000000000
```

`gccgo-go` from GCC-7.2.0 is used as the bootstrap toolchain:

```
[root@unknown src]$ go version
go version go1.8.1 arm-buildroot-linux-uclibcgnueabi-gccgo (Buildroot 2017.08-g56f1bab-dirty) 7.2.0 linux/arm
[root@unknown src]$ go env
GOARCH="arm"
GOBIN=""
GOEXE=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/opt"
GOTOOLDIR="/opt/libexec/gcc/arm-buildroot-linux-uclibcgnueabi/7.2.0"
GCCGO="/opt/bin/gccgo"
GOARM=""
CC="/opt/bin/gcc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build935653095=/tmp/go-build -gno-record-gcc-switches"
CXX="/opt/bin/g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
```

I tried both `go1.9.2` and `master` branch. Here's build log for the latter:

```
[root@unknown src]$ GOROOT_FINAL=/opt/local CGO_ENABLED=1 GOROOT_BOOTSTRAP=/opt ./make.bash
Building Go cmd/dist using /opt.
Building Go toolchain1 using /opt.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
go tool dist: FAILED: /opt/src/golang/pkg/tool/linux_arm/go_bootstrap install -gcflags=all= -ldflags=all= -i cmd/asm cmd/cgo cmd/compile cmd/link: signal: Illegal instruction
```

And here's a `gdb` log:

```
[root@unknown src]$ gdb /opt/src/golang/pkg/tool/linux_arm/go_bootstrap
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /opt/src/golang/pkg/tool/linux_arm/go_bootstrap...done.
warning: Unsupported auto-load script at offset 0 in section .debug_gdb_scripts
of file /opt/src/golang/pkg/tool/linux_arm/go_bootstrap.
Use `info auto-load python-scripts [REGEXP]' to list them.
(gdb) run
Starting program: /opt/src/golang/pkg/tool/linux_arm/go_bootstrap

Program received signal SIGILL, Illegal instruction.
runtime.check () at /opt/local/src/runtime/runtime1.go:146
146                     i, i1 float32
(gdb) bt full
#0  runtime.check () at /opt/local/src/runtime/runtime1.go:146
        e = 0
        i = 0
        j = 0
        k = 0x0
        m = "\000\000\000"
        z = 0
#1  0x00062e94 in runtime.rt0_go () at /opt/local/src/runtime/asm_arm.s:149
No locals.
#2  0x00000000 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
```

The line `/opt/local/src/runtime/asm_arm.s:149` is:
```
	BL	runtime·check(SB)
```

In `go1.9.2` it crashes on `BL	runtime·check(SB)` as well.

I should also note that uClibc-ng 1.0.27 is used as the libc.

Regards,
Alex