-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
1 What version of Go are you using (go version)?
Go 1.4 and Go 1.5 (maybe Go 1.3, too)
2 What operating system and processor architecture are you using?
- Host:
-
Linux(CentOS7) go version go1.4.2 linux/amd64
-
NetBSD/amd64 7.0 go version go1.5.1 netbsd/amd64
-
NetBSD/amd64 7.0 go version go1.4.3 netbsd/amd64
This problem occurs on all host environments.
-
- Target:
- NetBSD/evbarm 7.0 (EABI, PAGE_SIZE=4K kernel)
3 What did you do?
Simple test program
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}
$ GOOS=netbsd GOARCH=arm go build .hello.go
$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (NetBSD), statically linked, for NetBSD 5.99, not stripped
4 What did you expect to see?
$ ./hello
Hello World
5 What did you see instead?
When run on NetBSD/arm
$ ./hello
(no response, send KILL signal from another tty)
[1] Killed ./hello
$ gdb ./hello
(gdb) r
Starting program: /tmp/hello
Program received signal SIGSEGV, Segmentation fault.
0x000383c4 in runtime.newosproc ()
at /usr/lib/golang/src/runtime/os_netbsd.c:228
The reason of this is because the EABI support is insufficient.
Previous changes (at Mar 2014) are only in syscall packages:
30d6093
However runtime package is also a need to be changed.
Go1.5: src/runtime/defs1_netbsd_arm.go
Go1.4: src/runtime/defs_netbsd_arm.h
I think some types need padding bytes - timespec, timeval, mcontextt, ucontextt, keventt,
In addition, ELF header is also required EABI flag as same as Linux / FreeBSD.
I attached these patch for go1.5.
go_netbsd_earm_diff.txt