Skip to content

Illegal Instruction during early init on Armv7 (xcompiled from darwin/amd64) #18483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jdizzle opened this issue Jan 1, 2017 · 8 comments
Closed

Comments

@jdizzle
Copy link

jdizzle commented Jan 1, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.6.3 darwin/amd64

installed via brew

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.6.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.6.3/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

However I am cross compiling for a linux arm7 system

GOARM=7
GOARCH=arm
GOOS=linux

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

// Our first program will print the classic "hello world"
// message. Here's the full source code.
package main

import "fmt"

func main() {
    fmt.Println("hello world")
}

What did you see instead?

The executable immediately crashes due to an illegal instruction signal. Here is the output of gdserver:

Program received signal SIGILL, Illegal instruction.
runtime.check () at /usr/local/Cellar/go/1.6.3/libexec/src/runtime/runtime1.go:152
152	/usr/local/Cellar/go/1.6.3/libexec/src/runtime/runtime1.go: No such file or directory.
(gdb) disass
Dump of assembler code for function runtime.check:
   0x00049f8c <+0>:	ldr	r1, [r10, #8]
   0x00049f90 <+4>:	cmp	sp, r1
   0x00049f94 <+8>:	bls	0x4a53c <runtime.check+1456>
   0x00049f98 <+12>:	str	lr, [sp, #-76]!	; 0xffffffb4
   0x00049f9c <+16>:	mov	r0, #0
   0x00049fa0 <+20>:	mov	r0, #0
   0x00049fa4 <+24>:	mov	r0, #0
   0x00049fa8 <+28>:	mov	r0, #0
   0x00049fac <+32>:	mov	r0, #0
   0x00049fb0 <+36>:	str	r0, [sp, #48]	; 0x30
   0x00049fb4 <+40>:	mov	r0, #0
   0x00049fb8 <+44>:	mov	r0, #0
   0x00049fbc <+48>:	mov	r1, #0
   0x00049fc0 <+52>:	mov	r0, #0
   0x00049fc4 <+56>:	mov	r1, #0
=> 0x00049fc8 <+60>:	vmov.f32	s0, #112	; 0x3f800000  1.0
   0x00049fcc <+64>:	vsub.f32	s0, s0, s0
   0x00049fd0 <+68>:	vstr	s0, [sp, #44]	; 0x2c
   0x00049fd4 <+72>:	vmov.f32	s0, #112	; 0x3f800000  1.0
   0x00049fd8 <+76>:	vsub.f32	s0, s0, s0
   0x00049fdc <+80>:	vstr	s0, [sp, #40]	; 0x28
   0x00049fe0 <+84>:	vmov.f64	d0, #112	; 0x3f800000  1.0
   0x00049fe4 <+88>:	vsub.f64	d0, d0, d0
   0x00049fe8 <+92>:	vstr	d0, [sp, #60]	; 0x3c
   0x00049fec <+96>:	vmov.f64	d0, #112	; 0x3f800000  1.0
   0x00049ff0 <+100>:	vsub.f64	d0, d0, d0
   0x00049ff4 <+104>:	vstr	d0, [sp, #52]	; 0x34
   0x00049ff8 <+108>:	mov	r0, #0
   0x00049ffc <+112>:	str	r0, [sp, #72]	; 0x48
   0x0004a000 <+116>:	mov	r0, #0
   0x0004a004 <+120>:	mov	r0, #0
   0x0004a008 <+124>:	mov	r0, #0
   0x0004a00c <+128>:	strb	r0, [sp, #36]	; 0x24
   0x0004a010 <+132>:	strb	r0, [sp, #37]	; 0x25
   0x0004a014 <+136>:	strb	r0, [sp, #38]	; 0x26
---Type <return> to continue, or q <return> to quit---q
Quit

It appears that the vmov.f32 instruction is not supported? I'm using a Cortex A9 chip, and the datasheet for the SoC shows the FPU. Is this possibly a software configuration issue on my end. I have ARM_THUMB=n in my kernel configuration.

@minux
Copy link
Member

minux commented Jan 1, 2017 via email

@jdizzle
Copy link
Author

jdizzle commented Jan 1, 2017

I tried with GOARM=6. I get the same signal, but on a different instruction. Thanks for the reply!

Program received signal SIGILL, Illegal instruction.
0x0004a084 in runtime.check () at /usr/local/Cellar/go/1.6.3/libexec/src/runtime/runtime1.go:152
152	/usr/local/Cellar/go/1.6.3/libexec/src/runtime/runtime1.go: No such file or directory.
(gdb) disass
Dump of assembler code for function runtime.check:
   0x0004a044 <+0>:	ldr	r1, [r10, #8]
   0x0004a048 <+4>:	cmp	sp, r1
   0x0004a04c <+8>:	bls	0x4a5f4 <runtime.check+1456>
   0x0004a050 <+12>:	str	lr, [sp, #-76]!	; 0xffffffb4
   0x0004a054 <+16>:	mov	r0, #0
   0x0004a058 <+20>:	mov	r0, #0
   0x0004a05c <+24>:	mov	r0, #0
   0x0004a060 <+28>:	mov	r0, #0
   0x0004a064 <+32>:	mov	r0, #0
   0x0004a068 <+36>:	str	r0, [sp, #48]	; 0x30
   0x0004a06c <+40>:	mov	r0, #0
   0x0004a070 <+44>:	mov	r0, #0
   0x0004a074 <+48>:	mov	r1, #0
   0x0004a078 <+52>:	mov	r0, #0
   0x0004a07c <+56>:	mov	r1, #0
   0x0004a080 <+60>:	ldr	r11, [pc, #1404]	; 0x4a604 <runtime.check+1472>
=> 0x0004a084 <+64>:	vldr	s0, [r11]
   0x0004a088 <+68>:	vstr	s0, [sp, #44]	; 0x2c
   0x0004a08c <+72>:	ldr	r11, [pc, #1392]	; 0x4a604 <runtime.check+1472>
   0x0004a090 <+76>:	vldr	s0, [r11]
   0x0004a094 <+80>:	vstr	s0, [sp, #40]	; 0x28
   0x0004a098 <+84>:	ldr	r11, [pc, #1384]	; 0x4a608 <runtime.check+1476>
   0x0004a09c <+88>:	vldr	d0, [r11]
   0x0004a0a0 <+92>:	vstr	d0, [sp, #60]	; 0x3c
   0x0004a0a4 <+96>:	ldr	r11, [pc, #1372]	; 0x4a608 <runtime.check+1476>
   0x0004a0a8 <+100>:	vldr	d0, [r11]
   0x0004a0ac <+104>:	vstr	d0, [sp, #52]	; 0x34
   0x0004a0b0 <+108>:	mov	r0, #0
   0x0004a0b4 <+112>:	str	r0, [sp, #72]	; 0x48
   0x0004a0b8 <+116>:	mov	r0, #0
   0x0004a0bc <+120>:	mov	r0, #0
   0x0004a0c0 <+124>:	mov	r0, #0
   0x0004a0c4 <+128>:	strb	r0, [sp, #36]	; 0x24
   0x0004a0c8 <+132>:	strb	r0, [sp, #37]	; 0x25
   0x0004a0cc <+136>:	strb	r0, [sp, #38]	; 0x26

@davecheney
Copy link
Contributor

davecheney commented Jan 1, 2017 via email

@jdizzle
Copy link
Author

jdizzle commented Jan 1, 2017

:~$ cat /proc/cpuinfo 
Processor	: ARMv7 Processor rev 0 (v7l)
processor	: 0
BogoMIPS	: 2393.70

processor	: 1
BogoMIPS	: 2393.70

Features	: swp half fastmult edsp tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x3
CPU part	: 0xc09
CPU revision	: 0

@minux
Copy link
Member

minux commented Jan 1, 2017 via email

@davecheney
Copy link
Contributor

davecheney commented Jan 1, 2017 via email

@jdizzle
Copy link
Author

jdizzle commented Jan 1, 2017

I'm using a BCM58625. I checked and found my kernel has VFP=n in the config. I switched it to VFP=y, recompiled, and the go code works!

Thank you very much for your prompt and useful assistance.

@davecheney
Copy link
Contributor

Not a problem, I'm glad you got it working.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants