matiasinsaurralde / go-wasm3

Golang wrapper for WASM3 (https://github.com/wasm3/wasm3)
MIT License
77 stars 10 forks source link

I can't run the examples SIGILL: illegal instruction #1

Closed elvus closed 4 years ago

elvus commented 4 years ago

Go Version:

go1.13.6 linux/amd64

CPU /Architecture/S.O

Aspire-E1-531 5.3.0-26-generic #28~18.04.1-Ubuntu SMP Wed Dec 18 16:40:14 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

SIGILL: illegal instruction PC=0x4a8a6d m=0 sigcode=2

goroutine 0 [idle]: runtime: unknown pc 0x4a8a6d stack: frame={sp:0x7fff1d1173c0, fp:0x0} stack=[0x7fff1c918448,0x7fff1d117480) 00007fff1d1172c0: 0000006c0001a0f0 0000000000000007 00007fff1d1172d0: 0000000000000000 0000000000a411a0 00007fff1d1172e0: 0000000000002360 ffffffffffffffa8 00007fff1d1172f0: 000000000000008d 000000bd00000234 00007fff1d117300: 0000000000000011 0000000000000002 00007fff1d117310: 0000000000000000 000000770000007c 00007fff1d117320: 0000006c00000070 000000770000007c 00007fff1d117330: 0000005b0000006e 0000000000020810 00007fff1d117340: 0000000000002330 00007fc8f94858f8 00007fff1d117350: 0000000000a407f0 00007fc8f9480c40 00007fff1d117360: 0000000000000000 00007fc8f912f3a2 00007fff1d117370: 0000000000000000 00007fff1d1173c8 00007fff1d117380: 000000c000049000 0000000000000000 00007fff1d117390: 000000000050c9b4 00000000004a7dbd 00007fff1d1173a0: 0000000000000025 0000000000100000 00007fff1d1173b0: 0000000000a407e0 00000000004a8a63 00007fff1d1173c0: <000000c000048e38 0000000000a40800 00007fff1d1173d0: 00007fc8f9c0b988 000000c000048e40 00007fff1d1173e0: 000000c000048e00 00000000004a501e 00007fff1d1173f0: 000000c000048e40 000000c000048e00 00007fff1d117400: 0000000000000018 00000000004594f0 <runtime.asmcgocall+112> 00007fff1d117410: 000000000045607c <runtime.(mheap).alloc.func1+76> 00000000007afd00 00007fff1d117420: 0000000000000001 00000000004d000c 00007fff1d117430: 00007fc8f9c0b988 0000000000000230 00007fff1d117440: 000000c000000180 0000000000457d16 <runtime.systemstack+102> 00007fff1d117450: 00000000004343c0 <runtime.mstart+0> 0000000000457ba4 <runtime.rt0_go+308> 00007fff1d117460: 00000000004b87c0 00007fff1c918448 00007fff1d117470: 00000000004b87c0 0000000000457bab <runtime.rt0_go+315> runtime: unknown pc 0x4a8a6d stack: frame={sp:0x7fff1d1173c0, fp:0x0} stack=[0x7fff1c918448,0x7fff1d117480) 00007fff1d1172c0: 0000006c0001a0f0 0000000000000007 00007fff1d1172d0: 0000000000000000 0000000000a411a0 00007fff1d1172e0: 0000000000002360 ffffffffffffffa8 00007fff1d1172f0: 000000000000008d 000000bd00000234 00007fff1d117300: 0000000000000011 0000000000000002 00007fff1d117310: 0000000000000000 000000770000007c 00007fff1d117320: 0000006c00000070 000000770000007c 00007fff1d117330: 0000005b0000006e 0000000000020810 00007fff1d117340: 0000000000002330 00007fc8f94858f8 00007fff1d117350: 0000000000a407f0 00007fc8f9480c40 00007fff1d117360: 0000000000000000 00007fc8f912f3a2 00007fff1d117370: 0000000000000000 00007fff1d1173c8 00007fff1d117380: 000000c000049000 0000000000000000 00007fff1d117390: 000000000050c9b4 00000000004a7dbd 00007fff1d1173a0: 0000000000000025 0000000000100000 00007fff1d1173b0: 0000000000a407e0 00000000004a8a63 00007fff1d1173c0: <000000c000048e38 0000000000a40800 00007fff1d1173d0: 00007fc8f9c0b988 000000c000048e40 00007fff1d1173e0: 000000c000048e00 00000000004a501e 00007fff1d1173f0: 000000c000048e40 000000c000048e00 00007fff1d117400: 0000000000000018 00000000004594f0 <runtime.asmcgocall+112> 00007fff1d117410: 000000000045607c <runtime.(mheap).alloc.func1+76> 00000000007afd00 00007fff1d117420: 0000000000000001 00000000004d000c 00007fff1d117430: 00007fc8f9c0b988 0000000000000230 00007fff1d117440: 000000c000000180 0000000000457d16 <runtime.systemstack+102> 00007fff1d117450: 00000000004343c0 <runtime.mstart+0> 0000000000457ba4 <runtime.rt0_go+308> 00007fff1d117460: 00000000004b87c0 00007fff1c918448 00007fff1d117470: 00000000004b87c0 0000000000457bab <runtime.rt0_go+315>

goroutine 1> [sy>scall]:> runtime.cgo>call>(0x4a5000, 0xc000048e40, 0xc000000000)> /usr/lo>cal/>go/src/runtime/cgocall.go:128 +0x5b fp=0xc000048e10 sp=0xc>000>048dd8 pc=0x40896b github.com/>mati>asinsaurralde/go-wasm3._Cfunc_m3_NewRuntime(0xa407e0, 0x10>000>0, 0x0, 0x0) _cgo_go>type>s.go:554 +0x4e fp=0xc000048e40 sp=0xc000048e10 pc=0x4a1b8e> github.com/>mati>asinsaurralde/go-wasm3.NewRuntime(0xc00008c020, 0xc00008c020)> /home/e>lvis>/go/src/github.com/matiasinsaurralde/go-wasm3/wasm3.go:211 +0x46 fp=0xc000048e78 sp=0xc0000>48e40 >pc=0x4a>22d6> main.initRu>ntimeAndModule(0x4f6f76, 0x16)> /home/e>lvis/go/src/github.com/matiasinsaurralde/go-wasm3/examples/boa/boa.go:24 +0x99 fp=0xc000048ed0 >sp=0xc0>00048e78 pc=0x4a3f19> main.main()> /home/elvis/go/src/github.com/matiasinsaurralde/go-wasm3/examples/boa/boa.go:92 +0x34 fp=0xc000048f60 >sp=0xc000048ed0 pc=0x4a4724 runtime.main() /usr/local/go/src/runtime/proc.go:203 +0x21e fp=0xc000048fe0 sp=0xc000048f60 pc=0x4317ae runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000048fe8 sp=0xc000048fe0 pc=0x459d71

rax 0xa40800 rbx 0x100000 rcx 0xa42b00 rdx 0xa42b00 rdi 0xa40800 rsi 0x0 rbp 0xa407e0 rsp 0x7fff1d1173c0 r8 0xa40800 r9 0x0 r10 0xa40010 r11 0x0 r12 0xc000049000 r13 0x0 r14 0x50c9b4 r15 0x0 rip 0x4a8a6d rflags 0x10206 cs 0x33 fs 0x0 gs 0x0

matiasinsaurralde commented 4 years ago

Thanks for the report, I've prepared a different library build to see if it fixes the issue: https://github.com/matiasinsaurralde/go-wasm3/tree/disable-optimizations

To try it out:

$ cd $GOPATH/src/github.com/matiasinsaurralde/go-wasm3
$ git pull
$ git checkout disable-optimizations
$ cd  examples/sum
$ go run sum.go

Also please confirm which samples are failing (from the log you've shared it seems boa is particularly failing?), if you have time to try a few and report back it would be great! You may also run the test script:

$ cd $GOPATH/src/github.com/matiasinsaurralde
$ go test -v ./...
elvus commented 4 years ago

Doesn't work for me. Same error IMG_20200124_090026_273

matiasinsaurralde commented 4 years ago

Fixed in 80653c62fe97364fe7a32f796f8e37de8b3a3087