I've written a small go program to be run on a MIPS 32-bit router. I'm able to get a basic hello world program running on the router using the go build toolchain.
env GOOS=linux GOARCH=mips GOMIPS=softfloat go build -a
The program I'm trying to compile uses a the go-ethereum library and throws the following error when I try build
go build github.com/ethereum/go-ethereum/crypto/secp256k1: build constraints exclude all Go files in ~/go/src/github.com/ethereum/go-ethereum/crypto/secp256k1
I found the go cross-compilation tool xgo and have been successful in building a binary with that tool (https://github.com/karalabe/xgo). When I try to run the binary though I get the following 'Program terminated with signal SIGILL, Illegal instruction'. I was able to get a core dump from the file but I don't have much experience with GDB.
Program terminated with signal SIGILL, Illegal instruction.
#0 0x008274a8 in __sigsetjmp_aux ()
Running layout asm I get the following:
0x8274a4 <__sigsetjmp_aux+4> addiu gp,gp,-19312 │
>│0x8274a8 <__sigsetjmp_aux+8> sdc1 $f20,56(a0) │
│0x8274ac <__sigsetjmp_aux+12> sdc1 $f22,64(a0)
I'm unsure how to interpret this any help would be much appreciated.
Here it he output of cat /proc/cpuinfo :
system type : Qualcomm Atheros QCA9533 ver 2 rev 0
machine : GL.iNet GL-AR750
processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 432.53
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
and the output of the file util on the binary:
ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=83c74323a279af9cba50869671ef03d5ad497db8, not stripped
I've spent quite a lot of time trying to get this program to run, even forking the xgo tool so it can accept the softfloat parameter. Any help or direction on this problem would be greatly appreciated, thanks.