Repository: go
Issue: runtime: SIGSEGV when building on freebsd ARM
Labels: OS-FreeBSD,NeedsInvestigation,compiler/runtime

Trying to build go on freebsd-arm. I've tried both 1.10.2 and master branch from git. Both have the same issue.

I was able to bootstrap with go14 just fine, and the output of go env is
```
GOARCH="arm"
GOBIN=""
GOCHAR="5"
GOEXE=""
GOHOSTARCH="arm"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go14"
GOTOOLDIR="/usr/local/go14/pkg/tool/freebsd_arm"
CC="/nxb-bin/usr/bin/cc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
```

### What did you do?

I built a new jail on my freebsd 11.1 machine as follows
`poudriere jail -c -j 111armv6 -a arm.armv6 -x -m git -U https://github.com/freebsd/freebsd.git -v releng/11.1`

To build go I ran:
`poudriere bulk -j 111armv6 -i -v lang/go`

To further troubleshoot from inside the jail I ran make.bash directly via:
`GOROOT_BOOTSTRAP=/usr/local/go14 ./make.bash`

### What did you expect to see?
I expected it to build. And it does build if everything else is equal and all I do is make the jail amd64 instead of arm, everything is fine.

### What did you see instead?

Build output below. I've been able to reproduce this on both a physical server running freebsd 11.1 bare metal and also on a virtual machine.
```
Building Go cmd/dist using /usr/local/go14.
Building Go toolchain1 using /usr/local/go14.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x0 addr=0x0 pc=0x3714c]

runtime stack:
runtime.throw(0x2ade9a, 0x2a)
        /root/go/src/runtime/panic.go:589 +0x4c
runtime.sigpanic()
        /root/go/src/runtime/signal_unix.go:374 +0x22c
runtime.netpollunblock(0x0, 0x77, 0x1, 0x0)
        /root/go/src/runtime/netpoll.go:377 +0x14
runtime.netpollready(0x83fa10, 0x0, 0x77)
        /root/go/src/runtime/netpoll.go:301 +0x74
runtime.netpoll(0x488600, 0x255bfa99)
        /root/go/src/runtime/netpoll_kqueue.go:111 +0xc4
runtime.sysmon()
        /root/go/src/runtime/proc.go:4375 +0x55c
runtime.mstart1()
        /root/go/src/runtime/proc.go:1275 +0xbc
runtime.mstart()
        /root/go/src/runtime/proc.go:1241 +0x60

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0x874664)
        /root/go/src/runtime/sema.go:56 +0x2c
sync.(*WaitGroup).Wait(0x874664)
        /root/go/src/sync/waitgroup.go:130 +0x84
cmd/go/internal/work.(*Builder).Do(0x8ad620, 0xb55810)
        /root/go/src/cmd/go/internal/work/exec.go:174 +0x304
cmd/go/internal/work.InstallPackages(0x80e078, 0x4, 0x5, 0x0)
        /root/go/src/cmd/go/internal/work/build.go:481 +0x9e0
cmd/go/internal/work.runInstall(0x484f30, 0x80e078, 0x4, 0x5)
        /root/go/src/cmd/go/internal/work/build.go:412 +0x38
main.main()
        /root/go/src/cmd/go/main.go:140 +0x660

goroutine 4 [syscall]:
os/signal.signal_recv(0x0)
        /root/go/src/runtime/sigqueue.go:139 +0x130
os/signal.loop()
        /root/go/src/os/signal/signal_unix.go:23 +0x14
created by os/signal.init.0
        /root/go/src/os/signal/signal_unix.go:29 +0x30

goroutine 8 [runnable]:
syscall.BytePtrFromString(0xa96030, 0x25, 0x3, 0x9720e0, 0x3)
        /root/go/src/syscall/syscall.go:71 +0x80
syscall.SlicePtrFromStrings(0x8e8010, 0x2, 0x2, 0x0, 0x0, 0x4f86c, 0x822008, 0x2)
        /root/go/src/syscall/exec_unix.go:87 +0x9c
syscall.forkExec(0xa96030, 0x25, 0x8e8010, 0x2, 0x2, 0xc934b0, 0x10, 0x0, 0x994040)
        /root/go/src/syscall/exec_unix.go:155 +0xa4
syscall.StartProcess(0xa96030, 0x25, 0x8e8010, 0x2, 0x2, 0xc934b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0xa96030, 0x25, 0x8e8010, 0x2, 0x2, 0xc93570, 0x9c0780, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0xa96030, 0x25, 0x8e8010, 0x2, 0x2, 0xc93570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xb51080, 0x29f201, 0x91a060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xb51080, 0x91a060, 0x91e000)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xbec974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc41a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc41a20, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc41a20)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 9 [runnable]:
syscall.forkExecPipe(0xc59420, 0x2, 0x2, 0xb9c000, 0x30)
        /root/go/src/syscall/forkpipe2.go:9 +0x50
syscall.forkExec(0xade000, 0x25, 0xb16010, 0x2, 0x2, 0xc594b0, 0x10, 0x0, 0x8e2110)
        /root/go/src/syscall/exec_unix.go:189 +0x1b8
syscall.StartProcess(0xade000, 0x25, 0xb16010, 0x2, 0x2, 0xc594b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0xade000, 0x25, 0xb16010, 0x2, 0x2, 0xc59570, 0x92e480, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0xade000, 0x25, 0xb16010, 0x2, 0x2, 0xc59570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xc40580, 0x29f201, 0xa86060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xc40580, 0xa86060, 0x92e180)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xb38974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc41080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc41080, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc41080)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 10 [runnable]:
os.startProcess(0xa78060, 0x25, 0xc6e010, 0x2, 0x2, 0xa0b570, 0x956480, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:43 +0xf4
os.StartProcess(0xa78060, 0x25, 0xc6e010, 0x2, 0x2, 0xa0b570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xbc2e70, 0x29f201, 0x8ac2a0)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xbc2e70, 0x8ac2a0, 0x956180)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xb66974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc418c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc418c0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc418c0)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 11 [runnable]:
syscall.SetNonblock(0x1a, 0x2c3a00, 0x9400c0, 0x4)
        /root/go/src/syscall/exec_unix.go:98 +0x98
internal/poll.(*FD).SetBlocking(0x9400c0, 0x0, 0x0)
        /root/go/src/internal/poll/fd_unix.go:128 +0x80
os.(*File).Fd(0xbe2050, 0x0)
        /root/go/src/os/file_unix.go:70 +0x44
os.startProcess(0xa08030, 0x25, 0xcde010, 0x2, 0x2, 0x899570, 0x94e600, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:43 +0xb8
os.StartProcess(0xa08030, 0x25, 0xcde010, 0x2, 0x2, 0x899570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0x9ec8f0, 0x29f201, 0x9e8060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0x9ec8f0, 0x9e8060, 0x94e300)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xb3c974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xb52630, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xb52630, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xb52630)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 12 [runnable]:
sync.runtime_canSpin(0x0, 0x0)
        /root/go/src/runtime/proc.go:5050 +0x64
sync.(*Mutex).Lock(0x498678)
        /root/go/src/sync/mutex.go:89 +0x2c0
sync.(*RWMutex).Lock(0x498678)
        /root/go/src/sync/rwmutex.go:93 +0x20
syscall.forkExec(0x8f42a0, 0x25, 0x972030, 0x2, 0x2, 0xa0f4b0, 0x10, 0x0, 0xb18040)
        /root/go/src/syscall/exec_unix.go:186 +0x1a0
syscall.StartProcess(0x8f42a0, 0x25, 0x972030, 0x2, 0x2, 0xa0f4b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0x8f42a0, 0x25, 0x972030, 0x2, 0x2, 0xa0f570, 0x91ec00, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0x8f42a0, 0x25, 0x972030, 0x2, 0x2, 0xa0f570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xb53d90, 0x29f201, 0xa5e060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xb53d90, 0xa5e060, 0x9c0480)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xbe8974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xbc0b00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xbc0b00, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xbc0b00)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 13 [runnable]:
syscall.BytePtrFromString(0x8f0030, 0x25, 0xca3e5201, 0xb, 0x8015e0)
        /root/go/src/syscall/syscall.go:71 +0x80
syscall.forkExec(0x8f0030, 0x25, 0xb88010, 0x2, 0x2, 0xc554b0, 0x10, 0x0, 0xa88040)
        /root/go/src/syscall/exec_unix.go:151 +0x70
syscall.StartProcess(0x8f0030, 0x25, 0xb88010, 0x2, 0x2, 0xc554b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0x8f0030, 0x25, 0xb88010, 0x2, 0x2, 0xc55570, 0x93ea80, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0x8f0030, 0x25, 0xb88010, 0x2, 0x2, 0xc55570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xc088f0, 0x29f201, 0x9fe060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xc088f0, 0x9fe060, 0x93e000)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xbcc974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc40c60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc40c60, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc40c60)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 14 [runnable]:
os.(*File).Fd(0xa6e078, 0x14)
        /root/go/src/os/file_unix.go:59 +0x60
os.startProcess(0xb60030, 0x25, 0x8ca020, 0x2, 0x2, 0xcab570, 0x9d6300, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:43 +0xb8
os.StartProcess(0xb60030, 0x25, 0x8ca020, 0x2, 0x2, 0xcab570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xb55600, 0x29f201, 0xa70060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xb55600, 0xa70060, 0x9d6000)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xbd0974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc40a50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc40a50, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc40a50)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 15 [runnable]:
syscall.SlicePtrFromStrings(0x938480, 0x2f, 0x2f, 0x8e0930, 0x3, 0x3, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:85 +0x2c
syscall.forkExec(0xc52360, 0x25, 0x8e08c0, 0x2, 0x2, 0xca54b0, 0x10, 0x0, 0x874820)
        /root/go/src/syscall/exec_unix.go:159 +0xec
syscall.StartProcess(0xc52360, 0x25, 0x8e08c0, 0x2, 0x2, 0xca54b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0xc52360, 0x25, 0x8e08c0, 0x2, 0x2, 0xca5570, 0x938480, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0xc52360, 0x25, 0x8e08c0, 0x2, 0x2, 0xca5570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0x9bba20, 0x29f201, 0x946060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0x9bba20, 0x946060, 0x938000)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xb6a974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc41340, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc41340, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc41340)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4
go tool dist: FAILED: /root/go/pkg/tool/freebsd_arm/go_bootstrap install -gcflags=all= -ldflags=all= -i cmd/asm cmd/cgo cmd/compile cmd/link: exit status 2
# 
```