tl;dr summary: Is there a reason why sys_openbsd_386.s has a lot of "// crash" comments? My "hello world" application crashes at one of these lines. Is go on OpenBSD 386 broken?.
Longer version:
I would quite like to be able to run go programs on my Soekris net6501, which I use as a firewall appliance. It is running OpenBSD 5.1. I'm a bit new to cross-compiling, but have an environment setup on CentOS 6 which cross-compiles to OpenBSD 386. (I'm using tip).
When I attempt to run a simple Hello World app on the OpenBSD target I get the following:
$ ./hello
SIGSYS: bad system call
PC=0x8065c17
runtime.sigprocmask(0x3, 0x0)
/home/go/src/pkg/runtime/sys_openbsd_386.s:163 +0x7 fp=0x 545cef44
runtime.newosproc(0x1840f000, 0x545ecfcc)
/home//go/src/pkg/runtime/os_openbsd.c:151 +0xb0 fp=0x545c ef7c
newm(0x805c0a0, 0x0)
/home//go/src/pkg/runtime/proc.c:911 +0x9d fp=0x545cef98
runtime.main()
/home/go/src/pkg/runtime/proc.c:191 +0x38 fp=0x545cefcc
runtime.goexit()
/home/go/src/pkg/runtime/proc.c:1394 fp=0x545cefd0
eax 0xfffefeff
ebx 0x0
ecx 0xffffffb2
edx 0x184011e0
edi 0x545ed000
esi 0x80591d0
ebp 0x0
esp 0x545cef40
eip 0x8065c17
eflags 0x212
cs 0x2b
fs 0x5b
gs 0x63
$
OK, so I go and have a look at sys_openbsd_386.s at line 163 and see the following:
160: TEXT runtime·sigprocmask(SB),NOSPLIT,$-4
161: MOVL $48, AX // sys_sigprocmask
162: INT $0x80
163: JAE 2(PC)
164: MOVL $0xf1, 0xf1 // crash
165: MOVL AX, oset+0(FP)
166: RET
I have read that Go on OpenBSD requires version 5.4 and I'm running 5.1, but 5.1 does have the sigprocmask system call, so I thought I'd get a little further than this. I am a bit suspicious about the "// crash" comment on line 164, as that is exactly what is happening on my device.
Thanks in advance for any help on this.