Patchwork Go patch committed: Update to current Go library

login
register
mail settings
Submitter Rainer Orth
Date May 20, 2011, 4:44 p.m.
Message ID <ydd7h9lxqxr.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/96652/
State New
Headers show

Comments

Rainer Orth - May 20, 2011, 4:44 p.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> IRIX might have similar issues, I'm currently checking.

It didn't, but there are two others:

/vol/gcc/src/hg/trunk/local/libgo/runtime/go-setenv.c: In function 'setenv_c':
/vol/gcc/src/hg/trunk/local/libgo/runtime/go-setenv.c:44:3: error: implicit declaration of function 'setenv' [-Werror=implicit-function-declaration]

One needs to check for putenv vs. setenv and handle that in
go-setenv.c.  I've hacked around the issue for the moment to at least
let bootstrap succeed.

Besides, there are many errors compiling cgo_unix.go and cgo_linux.go:

/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:23:57: error: expected type
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:23:81: error: expected type
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:24:29: error: expected type
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:36:11: error: expected type
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:37:12: error: expected type
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:82:11: error: expected type
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:83:12: error: expected type

sysinfo.go lacks Addrinfo here.

/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:91:34: error: reference to undefined identifier 'syscall.AI_ALL'
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:91:51: error: reference to undefined identifier 'syscall.AI_V4MAPPED'
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:91:73: error: reference to undefined identifier 'syscall.AI_CANONNAME'
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:97:24: error: reference to undefined identifier 'syscall.EAI_NONAME'
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_unix.go:99:31: error: reference to undefined identifier 'syscall.EAI_SYSTEM'
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_linux.go:14:17: error: reference to undefined identifier 'syscall.AI_CANONNAME'
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_linux.go:14:40: error: reference to undefined identifier 'syscall.AI_V4MAPPED'
/vol/gcc/src/hg/trunk/local/libgo/go/net/cgo_linux.go:14:62: error: reference to undefined identifier 'syscall.AI_ALL'

All those errors are caused by the fact that <netdb.h> only exposes
struct addrinfo and the AI_* and EAI_* defines if _NO_XOPEN4 &&
_NO_XOPEN5, but we need _XOPEN_SOURCE=500 for other reasons.  So I've
again chosen to hardcode them in socket_irix.go.

With this patch (and the setenv/putenv hack), I've been able to
successfully build libgo.so on IRIX 6.5.

	Rainer


2011-05-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libgo:
	* syscalls/socket_irix.go (Addrinfo): Define.
        Declare AI_*, EAI_* constants.
Ian Taylor - May 24, 2011, 9:45 p.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> 2011-05-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
> 	libgo:
> 	* syscalls/socket_irix.go (Addrinfo): Define.
>         Declare AI_*, EAI_* constants.

Committed.

Thanks.

Ian

Patch

diff --git a/libgo/syscalls/socket_irix.go b/libgo/syscalls/socket_irix.go
--- a/libgo/syscalls/socket_irix.go
+++ b/libgo/syscalls/socket_irix.go
@@ -82,3 +82,44 @@  type IpMreq struct {
 	Multiaddr [4]byte
 	Interface [4]byte
 }
+
+// Similarly, <netdb.h> only provides struct addrinfo, AI_* and EAI_* if
+// _NO_XOPEN4 && _NO_XOPEN5.
+type Addrinfo struct {
+	Ai_flags int32
+	Ai_family int32
+	Ai_socktype int32
+	Ai_protocol int32
+	Ai_addrlen int32
+	Ai_canonname *uint8
+	Ai_addr *_sockaddr
+	Ai_next *Addrinfo
+}
+
+const (
+	AI_PASSIVE	= 0x00000001
+	AI_CANONNAME	= 0x00000002
+	AI_NUMERICHOST	= 0x00000004
+	AI_NUMERICSERV	= 0x00000008
+	AI_ALL		= 0x00000100
+	AI_ADDRCONFIG	= 0x00000400
+	AI_V4MAPPED	= 0x00000800
+	AI_DEFAULT	= (AI_V4MAPPED | AI_ADDRCONFIG)
+)
+
+const (
+	EAI_ADDRFAMILY	=  1
+	EAI_AGAIN	=  2
+	EAI_BADFLAGS	=  3
+	EAI_FAIL	=  4
+	EAI_FAMILY	=  5
+	EAI_MEMORY	=  6
+	EAI_NODATA	=  7
+	EAI_NONAME	=  8
+	EAI_SERVICE	=  9
+	EAI_SOCKTYPE	= 10
+	EAI_SYSTEM	= 11
+	EAI_BADHINTS	= 12
+	EAI_OVERFLOW	= 13
+	EAI_MAX		= 14
+)