aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-04-25 19:36:12 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-04-25 19:36:12 +0000
commit9f3b1e6c603e255e87ff8fe087591d795cf2b974 (patch)
tree8c44faa207647f4f8db0f245add06c9ed21e26f5 /libgo
parente5b0dad8fdd72fa4d19343b47546c89f2595c864 (diff)
downloadgcc-9f3b1e6c603e255e87ff8fe087591d795cf2b974.zip
gcc-9f3b1e6c603e255e87ff8fe087591d795cf2b974.tar.gz
gcc-9f3b1e6c603e255e87ff8fe087591d795cf2b974.tar.bz2
libgo: Irix 6 patches.
From Rainer Orth. From-SVN: r172935
Diffstat (limited to 'libgo')
-rw-r--r--libgo/Makefile.am10
-rw-r--r--libgo/Makefile.in8
-rwxr-xr-xlibgo/configure9
-rw-r--r--libgo/configure.ac9
-rw-r--r--libgo/go/syslog/syslog_libc.go (renamed from libgo/go/syslog/syslog_solaris.go)0
-rwxr-xr-xlibgo/mksysinfo.sh18
-rw-r--r--libgo/syscalls/socket_irix.go84
7 files changed, 120 insertions, 18 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index c29d222..05f1c99 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -825,10 +825,14 @@ go_sync_files = \
go/sync/waitgroup.go
if LIBGO_IS_SOLARIS
-go_syslog_file = go/syslog/syslog_solaris.go
+go_syslog_file = go/syslog/syslog_libc.go
+else
+if LIBGO_IS_IRIX
+go_syslog_file = go/syslog/syslog_libc.go
else
go_syslog_file = go/syslog/syslog_unix.go
endif
+endif
go_syslog_files = \
go/syslog/syslog.go \
@@ -1300,9 +1304,13 @@ else
if LIBGO_IS_SOLARIS
syscall_socket_os_file = syscalls/socket_solaris.go
else
+if LIBGO_IS_IRIX
+syscall_socket_os_file = syscalls/socket_irix.go
+else
syscall_socket_os_file = syscalls/socket_bsd.go
endif
endif
+endif
# Support for epoll.
if LIBGO_IS_LINUX
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 1d6f62c..cf84f73 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -1172,8 +1172,9 @@ go_sync_files = \
go/sync/rwmutex.go \
go/sync/waitgroup.go
-@LIBGO_IS_SOLARIS_FALSE@go_syslog_file = go/syslog/syslog_unix.go
-@LIBGO_IS_SOLARIS_TRUE@go_syslog_file = go/syslog/syslog_solaris.go
+@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_syslog_file = go/syslog/syslog_unix.go
+@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_syslog_file = go/syslog/syslog_libc.go
+@LIBGO_IS_SOLARIS_TRUE@go_syslog_file = go/syslog/syslog_libc.go
go_syslog_files = \
go/syslog/syslog.go \
$(go_syslog_file)
@@ -1656,7 +1657,8 @@ go_testing_script_files = \
# Declare libc_strerror_r which is the Go name for strerror_r.
# RTEMS uses newlib in which strerror_r returns char *.
@LIBGO_IS_RTEMS_TRUE@syscall_errstr_decl_file = syscalls/errstr_decl_rtems.go
-@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_socket_os_file = syscalls/socket_bsd.go
+@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_socket_os_file = syscalls/socket_bsd.go
+@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_socket_os_file = syscalls/socket_irix.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_socket_os_file = syscalls/socket_solaris.go
# Define socket sizes and types.
diff --git a/libgo/configure b/libgo/configure
index 611103f..565bc89 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -13295,7 +13295,7 @@ is_386=no
is_alpha=no
is_arm=no
is_m68k=no
-mips_abi=""
+mips_abi=unknown
is_ppc=no
is_ppc64=no
is_sparc=no
@@ -13466,7 +13466,7 @@ else
LIBGO_IS_M68K_FALSE=
fi
- if test $mips_abi != ""; then
+ if test $mips_abi != unknown; then
LIBGO_IS_MIPS_TRUE=
LIBGO_IS_MIPS_FALSE='#'
else
@@ -13561,6 +13561,11 @@ fi
case "$target" in
+ mips-sgi-irix6.5*)
+ # IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct
+ # msghdr in <sys/socket.h>.
+ OSCFLAGS='-D_XOPEN_SOURCE=500'
+ ;;
*-*-solaris2.[89])
# Solaris 8/9 need this so struct msghdr gets the msg_control
# etc. fields in <sys/socket.h> (_XPG4_2).
diff --git a/libgo/configure.ac b/libgo/configure.ac
index e772c2a..2451214 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -140,7 +140,7 @@ is_386=no
is_alpha=no
is_arm=no
is_m68k=no
-mips_abi=""
+mips_abi=unknown
is_ppc=no
is_ppc64=no
is_sparc=no
@@ -233,7 +233,7 @@ AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes)
AM_CONDITIONAL(LIBGO_IS_ALPHA, test $is_alpha = yes)
AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes)
AM_CONDITIONAL(LIBGO_IS_M68K, test $is_m68k = yes)
-AM_CONDITIONAL(LIBGO_IS_MIPS, test $mips_abi != "")
+AM_CONDITIONAL(LIBGO_IS_MIPS, test $mips_abi != unknown)
AM_CONDITIONAL(LIBGO_IS_MIPSO32, test $mips_abi = o32)
AM_CONDITIONAL(LIBGO_IS_MIPSN32, test $mips_abi = n32)
AM_CONDITIONAL(LIBGO_IS_MIPSN64, test $mips_abi = n64)
@@ -260,6 +260,11 @@ AC_SUBST(GO_DEBUG_PROC_REGS_OS_ARCH_FILE)
dnl Some targets need special flags to build sysinfo.go.
case "$target" in
+ mips-sgi-irix6.5*)
+ # IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct
+ # msghdr in <sys/socket.h>.
+ OSCFLAGS='-D_XOPEN_SOURCE=500'
+ ;;
*-*-solaris2.[[89]])
# Solaris 8/9 need this so struct msghdr gets the msg_control
# etc. fields in <sys/socket.h> (_XPG4_2).
diff --git a/libgo/go/syslog/syslog_solaris.go b/libgo/go/syslog/syslog_libc.go
index 044351d..044351d 100644
--- a/libgo/go/syslog/syslog_solaris.go
+++ b/libgo/go/syslog/syslog_libc.go
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 05f4af0..fecaeb6 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -29,12 +29,6 @@ cat > sysinfo.c <<EOF
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
-#ifdef __sgi__
-/* IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct msghdr in
- <sys/socket.h>. */
-#define _XOPEN_SOURCE 500
-#endif
-
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
@@ -93,13 +87,15 @@ echo 'package syscall' > ${OUT}
grep -v '^// ' gen-sysinfo.go | \
grep -v '^func' | \
grep -v '^type _timeval ' | \
- grep -v '^type _timespec\(_t\)\? ' | \
+ grep -v '^type _timespec_t ' | \
+ grep -v '^type _timespec ' | \
grep -v '^type _timestruc_t ' | \
grep -v '^type _epoll_' | \
grep -v 'in6_addr' | \
grep -v 'sockaddr_in6' | \
sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
- -e 's/\([^a-zA-Z0-9_]\)_timespec\(_t\)\?\([^a-zA-Z0-9_]\)/\1Timespec\3/g' \
+ -e 's/\([^a-zA-Z0-9_]\)_timespec_t\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
+ -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
>> ${OUT}
@@ -317,7 +313,8 @@ timespec_nsec=`echo $timespec | sed -n -e 's/^.*tv_nsec \([^ ]*\);.*$/\1/p'`
echo "type Timespec_sec_t $timespec_sec" >> ${OUT}
echo "type Timespec_nsec_t $timespec_nsec" >> ${OUT}
echo $timespec | \
- sed -e 's/^type \(__\)\?_timespec /type Timespec /' \
+ sed -e 's/^type ___timespec /type Timespec /' \
+ -e 's/^type _timespec /type Timespec /' \
-e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timespec_sec_t/' \
-e 's/tv_nsec *[a-zA-Z0-9_]*/Nsec Timespec_nsec_t/' >> ${OUT}
@@ -356,7 +353,8 @@ fi | sed -e 's/type _stat64/type Stat_t/' \
-e 's/st_mtim/Mtime/' \
-e 's/st_ctim/Ctime/' \
-e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
- -e 's/\([^a-zA-Z0-9_]\)_timespec\(_t\)\?\([^a-zA-Z0-9_]\)/\1Timespec\3/g' \
+ -e 's/\([^a-zA-Z0-9_]\)_timespec_t\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
+ -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
>> ${OUT}
diff --git a/libgo/syscalls/socket_irix.go b/libgo/syscalls/socket_irix.go
new file mode 100644
index 0000000..3419036
--- /dev/null
+++ b/libgo/syscalls/socket_irix.go
@@ -0,0 +1,84 @@
+// socket_irix.go -- Socket handling specific to IRIX 6.
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
+
+const SizeofSockaddrInet4 = 16
+const SizeofSockaddrInet6 = 28
+const SizeofSockaddrUnix = 110
+
+type RawSockaddrInet4 struct {
+ Family uint16
+ Port uint16
+ Addr [4]byte /* in_addr */
+ Zero [8]uint8
+}
+
+func (sa *RawSockaddrInet4) setLen() Socklen_t {
+ return SizeofSockaddrInet4
+}
+
+type RawSockaddrInet6 struct {
+ Family uint16
+ Port uint16
+ Flowinfo uint32
+ Addr [16]byte /* in6_addr */
+ Scope_id uint32
+}
+
+func (sa *RawSockaddrInet6) setLen() Socklen_t {
+ return SizeofSockaddrInet6
+}
+
+type RawSockaddrUnix struct {
+ Family uint16
+ Path [108]int8
+}
+
+func (sa *RawSockaddrUnix) setLen(int) {
+}
+
+func (sa *RawSockaddrUnix) getLen() (int, int) {
+ if sa.Path[0] == 0 {
+ // "Abstract" Unix domain socket.
+ // Rewrite leading NUL as @ for textual display.
+ // (This is the standard convention.)
+ // Not friendly to overwrite in place,
+ // but the callers below don't care.
+ sa.Path[0] = '@'
+ }
+
+ // Assume path ends at NUL.
+ // This is not technically the Linux semantics for
+ // abstract Unix domain sockets--they are supposed
+ // to be uninterpreted fixed-size binary blobs--but
+ // everyone uses this convention.
+ n := 0
+ for n < len(sa.Path)-3 && sa.Path[n] != 0 {
+ n++
+ }
+
+ return n, 0
+}
+
+type RawSockaddr struct {
+ Family uint16
+ Data [14]int8
+}
+
+// BindToDevice binds the socket associated with fd to device.
+func BindToDevice(fd int, device string) (errno int) {
+ return ENOSYS
+}
+
+// struct ip_mreg is provived in <netinet/in.h>, but protected with _SGIAPI.
+// This could be enabled with -D_SGI_SOURCE, but conflicts with
+// -D_XOPEN_SOURCE=500 required for msg_control etc. in struct msghgr, so
+// simply provide it here.
+type IpMreq struct {
+ Multiaddr [4]byte
+ Interface [4]byte
+}