Skip to content

cmd/compile: go1.x.x.linux-386: crashes with older 32-bit processors #11631

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
gknauf opened this issue Jul 8, 2015 · 2 comments
Closed

cmd/compile: go1.x.x.linux-386: crashes with older 32-bit processors #11631

gknauf opened this issue Jul 8, 2015 · 2 comments

Comments

@gknauf
Copy link

gknauf commented Jul 8, 2015

Background: I tried to compile gdrive since the provided 386-binary crashed on my embedded platform.
When I tried with go from any go1.x.x.linux-386.tar.gz archives I found that this already crashes exactly the same way; then tried same go1.x.x.linux-386.tar.gz on same 32-bit Linux distro but with a 64-bit-capable processor (Pentium D Dualcore) and it works without crash. 1st I thought it might be an issue with AMD processors, but just also tested a Pentium 3 which is classified as i686 but crashes too:

root@voyage:~# go
SIGILL: illegal instruction
PC=0x81f4ea9

goroutine 1 [running, locked to thread]:
math.init·1()
/usr/local/go/src/math/pow10.go:34 +0x19 fp=0x1872df4c sp=0x1872df48
math.init()
/usr/local/go/src/math/unsafe.go:21 +0x3f fp=0x1872df50 sp=0x1872df4c
strconv.init()
/usr/local/go/src/strconv/quote.go:455 +0x45 fp=0x1872df6c sp=0x1872df50
go/parser.init()
/usr/local/go/src/go/parser/parser.go:2462 +0x4a fp=0x1872df78 sp=0x1872df6c
main.init()
/usr/local/go/src/cmd/go/zdefaultcc.go:6 +0x45 fp=0x1872dfcc sp=0x1872df78
runtime.main()
/usr/local/go/src/runtime/proc.go:58 +0xbd fp=0x1872dff0 sp=0x1872dfcc
runtime.goexit()
/usr/local/go/src/runtime/asm_386.s:2287 +0x1 fp=0x1872dff4 sp=0x1872dff0

goroutine 2 [runnable]:
runtime.forcegchelper()
/usr/local/go/src/runtime/proc.go:90
runtime.goexit()
/usr/local/go/src/runtime/asm_386.s:2287 +0x1

goroutine 3 [runnable]:
runtime.bgsweep()
/usr/local/go/src/runtime/mgc0.go:82
runtime.goexit()
/usr/local/go/src/runtime/asm_386.s:2287 +0x1

eax 0x187360a0
ebx 0x8570650
ecx 0x187000a0
edx 0x42ba5bf3
edi 0x7
esi 0x2af0
ebp 0x187360a0
esp 0x1872df48
eip 0x81f4ea9
eflags 0x10206
cs 0x73
fs 0x0
gs 0x33

root@voyage:# uname -a
Linux voyage 3.16.7-ckt9-voyage #1 SMP Thu Apr 23 11:10:44 HKT 2015 i686 GNU/Linux
root@voyage:
# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Pentium III (Coppermine)
stepping : 3
cpu MHz : 701.588
cache size : 256 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pse36 mmx fxsr sse
bogomips : 1403.17
clflush size : 32
cache_alignment : 32
address sizes : 36 bits physical, 32 bits virtual
power management:

root@voyage:# uname -a
Linux voyage 3.16.7-ckt9-voyage #1 SMP Thu Apr 23 11:10:44 HKT 2015 i586 GNU/Linux
root@voyage:
# cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 5
model : 8
model name : AMD-K6(tm) 3D processor
stepping : 12
cpu MHz : 400.907
cache size : 64 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr cx8 pge mmx syscall 3dnow k6_mtrr vmmcall
bogomips : 801.81
clflush size : 32
cache_alignment : 32
address sizes : 32 bits physical, 32 bits virtual
power management:

root@voyage:# uname -a
Linux voyage 3.16.7-ckt9-voyage #1 SMP Thu Apr 23 11:10:44 HKT 2015 i586 GNU/Linux
root@voyage:
# cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 5
model : 10
model name : Geode(TM) Integrated Processor by AMD PCS
stepping : 2
cpu MHz : 498.061
cache size : 128 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu de pse tsc msr cx8 sep pge cmov clflush mmx mmxext 3dnowext 3dnow vmmcall
bogomips : 996.12
clflush size : 32
cache_alignment : 32
address sizes : 32 bits physical, 32 bits virtual
power management:

Finally I was able to create a gdrive binary which works with all 3 processors above when I use gccgo (on the Pentium D box):
go build -compiler gccgo -gccgoflags '-static-libgo' drive.go

It seems to me that probably something with the toolchain wrongly uses 64-bit instructions (asm stuff?) when using gc ...

@bradfitz
Copy link
Contributor

bradfitz commented Jul 8, 2015

Go assumes SSE2 by default in our official binaries. Set GO386=387 when building from source, per instructions at http://golang.org/doc/install/source.

@bradfitz bradfitz closed this as completed Jul 8, 2015
@mikioh mikioh changed the title go1.x.x.linux-386: crashes with older 32-bit processors cmd/compile: go1.x.x.linux-386: crashes with older 32-bit processors Jul 9, 2015
@gknauf
Copy link
Author

gknauf commented Jul 9, 2015

I tried already to use this var when I compiled gdrive but that didnt work ...
I followed the advice and did build the Go toolchain from source with GO386=387 and that works now fine: the toolchain itself runs on my 32-bit processors (without SSE2 support), and so does the gdrive binary. Thanks!

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

3 participants