re PR go/47515 (Issues porting libgo to IRIX 6.5)

PR go/47515
libgo: Add Irix support.

From Rainer Orth.

From-SVN: r171806
This commit is contained in:
Ian Lance Taylor 2011-03-31 23:55:21 +00:00
parent de90644af8
commit 654d2ec080
7 changed files with 83 additions and 9 deletions

View File

@ -709,6 +709,9 @@ else
if LIBGO_IS_SOLARIS if LIBGO_IS_SOLARIS
go_os_sys_file = go/os/sys_uname.go go_os_sys_file = go/os/sys_uname.go
else else
if LIBGO_IS_IRIX
go_os_sys_file = go/os/sys_uname.go
else
if LIBGO_IS_RTEMS if LIBGO_IS_RTEMS
go_os_sys_file = go/os/sys_uname.go go_os_sys_file = go/os/sys_uname.go
else else
@ -716,6 +719,7 @@ go_os_sys_file = go/os/sys_bsd.go
endif endif
endif endif
endif endif
endif
go_os_files = \ go_os_files = \
$(go_os_dir_file) \ $(go_os_dir_file) \

View File

@ -1072,8 +1072,9 @@ go_netchan_files = \
@LIBGO_IS_386_TRUE@@LIBGO_IS_SOLARIS_TRUE@go_os_dir_file = go/os/dir_largefile.go @LIBGO_IS_386_TRUE@@LIBGO_IS_SOLARIS_TRUE@go_os_dir_file = go/os/dir_largefile.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_dir_file = go/os/dir_regfile.go @LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_dir_file = go/os/dir_regfile.go
@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_dir_file = go/os/dir_largefile.go @LIBGO_IS_LINUX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_dir_file = go/os/dir_largefile.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_bsd.go @LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_bsd.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_uname.go @LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_uname.go
@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_uname.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_sys_file = go/os/sys_uname.go @LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_sys_file = go/os/sys_uname.go
@LIBGO_IS_LINUX_TRUE@go_os_sys_file = go/os/sys_linux.go @LIBGO_IS_LINUX_TRUE@go_os_sys_file = go/os/sys_linux.go
go_os_files = \ go_os_files = \

20
libgo/configure vendored
View File

@ -646,6 +646,8 @@ LIBGO_IS_RTEMS_FALSE
LIBGO_IS_RTEMS_TRUE LIBGO_IS_RTEMS_TRUE
LIBGO_IS_LINUX_FALSE LIBGO_IS_LINUX_FALSE
LIBGO_IS_LINUX_TRUE LIBGO_IS_LINUX_TRUE
LIBGO_IS_IRIX_FALSE
LIBGO_IS_IRIX_TRUE
LIBGO_IS_FREEBSD_FALSE LIBGO_IS_FREEBSD_FALSE
LIBGO_IS_FREEBSD_TRUE LIBGO_IS_FREEBSD_TRUE
LIBGO_IS_DARWIN_FALSE LIBGO_IS_DARWIN_FALSE
@ -10902,7 +10904,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 10905 "configure" #line 10907 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -11008,7 +11010,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11011 "configure" #line 11013 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -13217,6 +13219,7 @@ fi
is_darwin=no is_darwin=no
is_freebsd=no is_freebsd=no
is_irix=no
is_linux=no is_linux=no
is_rtems=no is_rtems=no
is_solaris=no is_solaris=no
@ -13224,6 +13227,7 @@ GOOS=unknown
case ${host} in case ${host} in
*-*-darwin*) is_darwin=yes; GOOS=darwin ;; *-*-darwin*) is_darwin=yes; GOOS=darwin ;;
*-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;; *-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;;
*-*-irix6*) is_irix=yes; GOOS=irix ;;
*-*-linux*) is_linux=yes; GOOS=linux ;; *-*-linux*) is_linux=yes; GOOS=linux ;;
*-*-rtems*) is_rtems=yes; GOOS=rtems ;; *-*-rtems*) is_rtems=yes; GOOS=rtems ;;
*-*-solaris2*) is_solaris=yes; GOOS=solaris ;; *-*-solaris2*) is_solaris=yes; GOOS=solaris ;;
@ -13244,6 +13248,14 @@ else
LIBGO_IS_FREEBSD_FALSE= LIBGO_IS_FREEBSD_FALSE=
fi fi
if test $is_irix = yes; then
LIBGO_IS_IRIX_TRUE=
LIBGO_IS_IRIX_FALSE='#'
else
LIBGO_IS_IRIX_TRUE='#'
LIBGO_IS_IRIX_FALSE=
fi
if test $is_linux = yes; then if test $is_linux = yes; then
LIBGO_IS_LINUX_TRUE= LIBGO_IS_LINUX_TRUE=
LIBGO_IS_LINUX_FALSE='#' LIBGO_IS_LINUX_FALSE='#'
@ -14497,6 +14509,10 @@ if test -z "${LIBGO_IS_FREEBSD_TRUE}" && test -z "${LIBGO_IS_FREEBSD_FALSE}"; th
as_fn_error "conditional \"LIBGO_IS_FREEBSD\" was never defined. as_fn_error "conditional \"LIBGO_IS_FREEBSD\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi fi
if test -z "${LIBGO_IS_IRIX_TRUE}" && test -z "${LIBGO_IS_IRIX_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_IRIX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_LINUX_TRUE}" && test -z "${LIBGO_IS_LINUX_FALSE}"; then if test -z "${LIBGO_IS_LINUX_TRUE}" && test -z "${LIBGO_IS_LINUX_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_LINUX\" was never defined. as_fn_error "conditional \"LIBGO_IS_LINUX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5

View File

@ -114,6 +114,7 @@ AC_SUBST(LIBFFIINCS)
is_darwin=no is_darwin=no
is_freebsd=no is_freebsd=no
is_irix=no
is_linux=no is_linux=no
is_rtems=no is_rtems=no
is_solaris=no is_solaris=no
@ -121,12 +122,14 @@ GOOS=unknown
case ${host} in case ${host} in
*-*-darwin*) is_darwin=yes; GOOS=darwin ;; *-*-darwin*) is_darwin=yes; GOOS=darwin ;;
*-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;; *-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;;
*-*-irix6*) is_irix=yes; GOOS=irix ;;
*-*-linux*) is_linux=yes; GOOS=linux ;; *-*-linux*) is_linux=yes; GOOS=linux ;;
*-*-rtems*) is_rtems=yes; GOOS=rtems ;; *-*-rtems*) is_rtems=yes; GOOS=rtems ;;
*-*-solaris2*) is_solaris=yes; GOOS=solaris ;; *-*-solaris2*) is_solaris=yes; GOOS=solaris ;;
esac esac
AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes) AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes)
AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes) AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes)
AM_CONDITIONAL(LIBGO_IS_IRIX, test $is_irix = yes)
AM_CONDITIONAL(LIBGO_IS_LINUX, test $is_linux = yes) AM_CONDITIONAL(LIBGO_IS_LINUX, test $is_linux = yes)
AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes) AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes)
AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes) AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes)

View File

@ -0,0 +1,17 @@
// 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 proc
import "os"
// Process tracing is not supported on IRIX yet.
func Attach(pid int) (Process, os.Error) {
return nil, os.NewError("debug/proc not implemented on IRIX")
}
func ForkExec(argv0 string, argv []string, envv []string, dir string, fd []*os.File) (Process, os.Error) {
return Attach(0)
}

View File

@ -35,11 +35,23 @@ cat > sysinfo.c <<EOF
#define __EXTENSIONS__ #define __EXTENSIONS__
#endif #endif
#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 <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <netinet/in.h> #include <netinet/in.h>
/* <netinet/tcp.h> needs u_char/u_short, but <sys/bsd_types> is only
included by <netinet/in.h> if _SGIAPI (i.e. _SGI_SOURCE
&& !_XOPEN_SOURCE. */
#ifdef __sgi__
#include <sys/bsd_types.h>
#endif
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <signal.h> #include <signal.h>
#if defined(HAVE_SYSCALL_H) #if defined(HAVE_SYSCALL_H)
@ -81,13 +93,13 @@ echo 'package syscall' > ${OUT}
grep -v '^// ' gen-sysinfo.go | \ grep -v '^// ' gen-sysinfo.go | \
grep -v '^func' | \ grep -v '^func' | \
grep -v '^type _timeval ' | \ grep -v '^type _timeval ' | \
grep -v '^type _timespec ' | \ grep -v '^type _timespec\(_t\)\? ' | \
grep -v '^type _timestruc_t ' | \ grep -v '^type _timestruc_t ' | \
grep -v '^type _epoll_' | \ grep -v '^type _epoll_' | \
grep -v 'in6_addr' | \ grep -v 'in6_addr' | \
grep -v 'sockaddr_in6' | \ grep -v 'sockaddr_in6' | \
sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \ sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \ -e 's/\([^a-zA-Z0-9_]\)_timespec\(_t\)\?\([^a-zA-Z0-9_]\)/\1Timespec\3/g' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \ -e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
>> ${OUT} >> ${OUT}
@ -289,13 +301,17 @@ echo $timeval | \
sed -e 's/type _timeval /type Timeval /' \ sed -e 's/type _timeval /type Timeval /' \
-e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timeval_sec_t/' \ -e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timeval_sec_t/' \
-e 's/tv_usec *[a-zA-Z0-9_]*/Usec Timeval_usec_t/' >> ${OUT} -e 's/tv_usec *[a-zA-Z0-9_]*/Usec Timeval_usec_t/' >> ${OUT}
timespec=`grep '^type _timespec ' gen-sysinfo.go` timespec=`grep '^type _timespec ' gen-sysinfo.go || true`
if test "$timespec" = ""; then
# IRIX 6.5 has __timespec instead.
timespec=`grep '^type ___timespec ' gen-sysinfo.go || true`
fi
timespec_sec=`echo $timespec | sed -n -e 's/^.*tv_sec \([^ ]*\);.*$/\1/p'` timespec_sec=`echo $timespec | sed -n -e 's/^.*tv_sec \([^ ]*\);.*$/\1/p'`
timespec_nsec=`echo $timespec | sed -n -e 's/^.*tv_nsec \([^ ]*\);.*$/\1/p'` timespec_nsec=`echo $timespec | sed -n -e 's/^.*tv_nsec \([^ ]*\);.*$/\1/p'`
echo "type Timespec_sec_t $timespec_sec" >> ${OUT} echo "type Timespec_sec_t $timespec_sec" >> ${OUT}
echo "type Timespec_nsec_t $timespec_nsec" >> ${OUT} echo "type Timespec_nsec_t $timespec_nsec" >> ${OUT}
echo $timespec | \ echo $timespec | \
sed -e 's/^type _timespec /type Timespec /' \ sed -e 's/^type \(__\)\?_timespec /type Timespec /' \
-e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timespec_sec_t/' \ -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} -e 's/tv_nsec *[a-zA-Z0-9_]*/Nsec Timespec_nsec_t/' >> ${OUT}
@ -333,7 +349,7 @@ fi | sed -e 's/type _stat\(64\)\?/type Stat_t/' \
-e 's/st_mtim/Mtime/' \ -e 's/st_mtim/Mtime/' \
-e 's/st_ctim/Ctime/' \ -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_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \ -e 's/\([^a-zA-Z0-9_]\)_timespec\(_t\)\?\([^a-zA-Z0-9_]\)/\1Timespec\3/g' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \ -e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
>> ${OUT} >> ${OUT}

View File

@ -0,0 +1,17 @@
// syscall_irix.go -- IRIX 6 specific syscall interface.
// 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
import "unsafe"
// FIXME: ptrace(3C) has this, but exec.go expects the next.
//func libc_ptrace(request int, pid Pid_t, addr int, data int) int __asm__ ("ptrace")
func libc_ptrace(request int, pid Pid_t, addr uintptr, data *byte) int __asm__ ("ptrace")
var dummy *byte
const sizeofPtr uintptr = uintptr(unsafe.Sizeof(dummy))