From 8419c85eaa014a6b8f3485a4e27520a3acd31601 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 20 Oct 2016 20:37:28 -0400 Subject: [PATCH] runtime, cmd/link: fix netbsd/arm EABI support Fixes reported by oshimaya (see #13806). Fixes #13806. Change-Id: I9b659ab918a34bc5f7c58f3d7f59058115b7f776 Reviewed-on: https://go-review.googlesource.com/31651 Reviewed-by: Minux Ma --- src/cmd/link/internal/ld/elf.go | 5 ++--- src/runtime/defs1_netbsd_arm.go | 11 ++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go index 636900e6eb..c331944ecb 100644 --- a/src/cmd/link/internal/ld/elf.go +++ b/src/cmd/link/internal/ld/elf.go @@ -945,11 +945,10 @@ func Elfinit(ctxt *Link) { ehdr.phentsize = ELF64PHDRSIZE /* Must be ELF64PHDRSIZE */ ehdr.shentsize = ELF64SHDRSIZE /* Must be ELF64SHDRSIZE */ - // we use EABI on both linux/arm and freebsd/arm. // 32-bit architectures case sys.ARM: - // we use EABI on both linux/arm and freebsd/arm. - if Headtype == obj.Hlinux || Headtype == obj.Hfreebsd { + // we use EABI on linux/arm, freebsd/arm, netbsd/arm. + if Headtype == obj.Hlinux || Headtype == obj.Hfreebsd || Headtype == obj.Hnetbsd { // We set a value here that makes no indication of which // float ABI the object uses, because this is information // used by the dynamic linker to compare executables and diff --git a/src/runtime/defs1_netbsd_arm.go b/src/runtime/defs1_netbsd_arm.go index a67dd8ac95..db8e4c63fc 100644 --- a/src/runtime/defs1_netbsd_arm.go +++ b/src/runtime/defs1_netbsd_arm.go @@ -104,6 +104,7 @@ type stackt struct { type timespec struct { tv_sec int64 tv_nsec int32 + _ [4]byte // EABI } func (ts *timespec) set_sec(x int32) { @@ -117,6 +118,7 @@ func (ts *timespec) set_nsec(x int32) { type timeval struct { tv_sec int64 tv_usec int32 + _ [4]byte // EABI } func (tv *timeval) set_usec(x int32) { @@ -129,10 +131,11 @@ type itimerval struct { } type mcontextt struct { - __gregs [17]uint32 - __fpu [4 + 8*32 + 4]byte // EABI - // __fpu [4+4*33+4]byte // not EABI + __gregs [17]uint32 + _ [4]byte // EABI + __fpu [272]byte // EABI _mc_tlsbase uint32 + _ [4]byte // EABI } type ucontextt struct { @@ -140,6 +143,7 @@ type ucontextt struct { uc_link *ucontextt uc_sigmask sigset uc_stack stackt + _ [4]byte // EABI uc_mcontext mcontextt __uc_pad [2]int32 } @@ -151,6 +155,7 @@ type keventt struct { fflags uint32 data int64 udata *byte + _ [4]byte // EABI } // created by cgo -cdefs and then converted to Go