diff -r 779b637a1983 libgo/Makefile.am
--- a/libgo/Makefile.am	Wed Jan 05 14:33:43 2011 +0100
+++ b/libgo/Makefile.am	Wed Jan 05 14:38:06 2011 +0100
@@ -1,6 +1,6 @@
 # Makefile.am -- Go library Makefile.
 
-# Copyright 2009, 2010 The Go Authors. All rights reserved.
+# Copyright 2009, 2010, 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.
 
@@ -592,12 +592,19 @@
 	go/mime/mediatype.go \
 	go/mime/type.go
 
-if LIBGO_IS_RTEMS
-go_net_fd_os_file = go/net/fd_rtems.go
-go_net_newpollserver_file = go/net/newpollserver_rtems.go
-else
+if LIBGO_IS_LINUX
+# Uses epoll(2), probably Linux-specfic.
 go_net_fd_os_file = go/net/fd_linux.go
 go_net_newpollserver_file = go/net/newpollserver.go
+else
+# Uses select(2), probably portable.
+go_net_fd_os_file = go/net/fd_rtems.go
+if LIBGO_IS_SOLARIS
+# Solaris doesn't support self-connected sockets, it seems.
+go_net_newpollserver_file = go/net/newpollserver.go
+else
+go_net_newpollserver_file = go/net/newpollserver_rtems.go
+endif
 endif
 
 go_net_files = \
@@ -684,34 +691,41 @@
 if LIBGO_IS_386
 GOARCH = 386
 else
+if LIBGO_IS_ARM
+GOARCH = arm
+else
+if LIBGO_IS_SPARC
+GOARCH = sparc
 if LIBGO_IS_X86_64
 GOARCH = amd64
 else
-if LIBGO_IS_ARM
-GOARCH = arm
-else
 GOARCH = unknown
 endif
 endif
 endif
+endif
 
-if LIBGO_IS_LINUX
-GOOS = linux
-else
 if LIBGO_IS_DARWIN
 GOOS = darwin
 else
 if LIBGO_IS_FREEBSD
 GOOS = freebsd
 else
+if LIBGO_IS_LINUX
+GOOS = linux
+else
 if LIBGO_IS_RTEMS
 GOOS = rtems
 else
+if LIBGO_IS_SOLARIS
+GOOS = solaris
+else
 GOOS = unknown
 endif
 endif
 endif
 endif
+endif
 
 version.go: s-version; @true
 s-version: Makefile
@@ -929,18 +943,6 @@
 	go/debug/pe/file.go \
 	go/debug/pe/pe.go
 
-if LIBGO_IS_LINUX
-proc_file = go/debug/proc/proc_linux.go
-if LIBGO_IS_386
-regs_file = go/debug/proc/regs_linux_386.go
-else
-if LIBGO_IS_X86_64
-regs_file = go/debug/proc/regs_linux_amd64.go
-else
-regs_file =
-endif
-endif
-else
 if LIBGO_IS_DARWIN
 proc_file = go/debug/proc/proc_darwin.go
 if LIBGO_IS_386
@@ -965,6 +967,18 @@
 endif
 endif
 else
+if LIBGO_IS_LINUX
+proc_file = go/debug/proc/proc_linux.go
+if LIBGO_IS_386
+regs_file = go/debug/proc/regs_linux_386.go
+else
+if LIBGO_IS_X86_64
+regs_file = go/debug/proc/regs_linux_amd64.go
+else
+regs_file =
+endif
+endif
+else
 proc_file =
 regs_file =
 endif
@@ -1104,9 +1118,13 @@
 endif
 endif
 else
+if LIBGO_IS_SOLARIS
+syscall_os_file = syscalls/syscall_solaris.go
+else
 syscall_os_file =
 syscall_arch_file =
 endif
+endif
 
 if LIBGO_IS_RTEMS
 syscall_exec_os_file = syscalls/exec_stubs.go
@@ -1118,8 +1136,18 @@
 syscall_errstr_decl_file = syscalls/errstr_decl_rtems.go
 else
 syscall_exec_os_file = syscalls/exec.go
+if LIBGO_IS_LINUX
+syscall_socket_epoll_file = syscalls/socket_epoll.go
 syscall_socket_os_file = syscalls/socket_linux.go
-syscall_socket_epoll_file = syscalls/socket_epoll.go
+else
+if LIBGO_IS_SOLARIS
+syscall_socket_os_file = syscalls/socket_solaris.go
+else
+# FIXME: Really everywhere else?
+syscall_socket_os_file = syscalls/socket_bsd.go
+endif
+endif
+# FIXME: Works beyond Linux?
 syscall_sysfile_os_file = syscalls/sysfile_linux.go
 syscall_syscall_file = syscalls/syscall.go
 syscall_errstr_file = syscalls/errstr.go
@@ -1268,7 +1296,8 @@
 
 libgo_la_SOURCES = $(runtime_files)
 
-libgo_la_LIBADD = $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS)
+libgo_la_LIBADD = $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) \
+	$(NET_LIBS)
 
 libgobegin_a_SOURCES = \
 	runtime/go-main.c
@@ -1284,7 +1313,7 @@
 
 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) \
-	$(PTHREAD_LIBS) $(MATH_LIBS) -o $@
+	$(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) -o $@
 
 # Build a package.
 BUILDARCHIVE = \
@@ -1300,6 +1329,7 @@
 .a.la:
 	$(LINK) $<.lo
 
+# FIXME: Should be configure option, why not use DejaGnu by default?
 if LIBGO_IS_RTEMS
 use_dejagnu = yes
 else
diff -r 779b637a1983 libgo/configure.ac
--- a/libgo/configure.ac	Wed Jan 05 14:33:43 2011 +0100
+++ b/libgo/configure.ac	Wed Jan 05 14:38:06 2011 +0100
@@ -1,6 +1,6 @@
 # configure.ac -- Go library configure script.
 
-# Copyright 2009 The Go Authors. All rights reserved.
+# Copyright 2009, 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.
 
@@ -116,26 +116,36 @@
 is_freebsd=no
 is_linux=no
 is_rtems=no
+is_solaris=no
 case ${host} in
-  *-*-darwin*) is_darwin=yes ;;
-  *-*-freebsd*) is_freebsd=yes ;;
-  *-*-linux*)  is_linux=yes  ;;
-  *-*-rtems*)  is_rtems=yes  ;;
+  *-*-darwin*)   is_darwin=yes  ;;
+  *-*-freebsd*)  is_freebsd=yes ;;
+  *-*-linux*)    is_linux=yes   ;;
+  *-*-rtems*)    is_rtems=yes   ;;
+  *-*-solaris2*) is_solaris=yes ;;
 esac
 AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes)
 AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes)
 AM_CONDITIONAL(LIBGO_IS_LINUX, test $is_linux = yes)
 AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes)
+AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes)
 
 is_386=no
+is_arm=no
+is_sparc=no
 is_x86_64=no
-is_arm=no
 case ${host} in
+  arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
+    is_arm=yes
+    ;;
 changequote(,)dnl
   i[34567]86-*-*)
 changequote([,])dnl
     is_386=yes
     ;;
+  sparc*-*-*)
+    is_sparc=yes
+    ;;
   x86_64-*-*)
     if test "$with_multisubdir" = "32"; then
       is_386=yes
@@ -143,13 +153,11 @@
       is_x86_64=yes
     fi
     ;;
-  arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
-    is_arm=yes
-    ;;
 esac
 AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes)
 AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes)
 AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes)
+AM_CONDITIONAL(LIBGO_IS_SPARC, test $is_sparc = yes)
 
 dnl Use -fsplit-stack when compiling C code if available.
 AC_CACHE_CHECK([whether -fsplit-stack is supported],
@@ -192,6 +200,13 @@
 AC_CHECK_LIB([m], [sqrt], MATH_LIBS=-lm)
 AC_SUBST(MATH_LIBS)
 
+dnl Test for the -lsocket library.
+NET_LIBS=
+dnl FIXME: How to do this properly?
+dnl There's code in libjava/configure.ac to handle this.
+NET_LIBS=-lsocket
+AC_SUBST(NET_LIBS)
+
 dnl Test whether the compiler supports the -pthread option.
 AC_CACHE_CHECK([whether -pthread is supported],
 [ac_cv_libgo_pthread_supported],
diff -r 779b637a1983 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Wed Jan 05 14:33:43 2011 +0100
+++ b/libgo/mksysinfo.sh	Wed Jan 05 14:38:06 2011 +0100
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright 2009 The Go Authors. All rights reserved.
+# Copyright 2009, 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.
 
@@ -19,7 +19,7 @@
 CC=${CC:-gcc}
 OUT=tmp-sysinfo.go
 
-set -e
+#set -e
 
 rm -f sysinfo.go
 
diff -r 779b637a1983 libgo/syscalls/socket.go
--- a/libgo/syscalls/socket.go	Wed Jan 05 14:33:43 2011 +0100
+++ b/libgo/syscalls/socket.go	Wed Jan 05 14:38:06 2011 +0100
@@ -1,6 +1,6 @@
 // socket.go -- Socket handling.
 
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009, 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.
 
@@ -12,6 +12,7 @@
 
 import "unsafe"
 
+// FIXME: Partially Linux-specific, at least SizeofSockaddrInet6.
 const SizeofSockaddrInet4 = 16
 const SizeofSockaddrInet6 = 28
 const SizeofSockaddrUnix = 110
diff -r 779b637a1983 libgo/syscalls/socket_solaris.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/syscalls/socket_solaris.go	Wed Jan 05 14:38:06 2011 +0100
@@ -0,0 +1,144 @@
+// socket_linux.go -- Socket handling specific to Solaris.
+
+// 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.
+
+// Low-level socket interface.
+// Only for implementing net package.
+
+// DO NOT USE DIRECTLY.
+
+package syscall
+
+import "unsafe"
+
+type RawSockaddrInet4 struct {
+	Family uint16;
+	Port uint16;
+	Addr [4]byte /* in_addr */;
+	Zero [8]uint8;
+}
+
+type RawSockaddrInet6 struct {
+	Family uint16;
+	Port uint16;
+	Flowinfo uint32;
+	Addr [16]byte /* in6_addr */;
+	Scope_id uint32;
+	__Src_id uint32;
+}
+
+type RawSockaddrUnix struct {
+	Family uint16;
+	Path [108]int8;
+}
+
+type RawSockaddr struct {
+	Family uint16;
+	Data [14]int8;
+}
+
+func (sa *SockaddrInet4) sockaddr() (*RawSockaddrAny, Socklen_t, int) {
+	if sa.Port < 0 || sa.Port > 0xFFFF {
+		return nil, 0, EINVAL;
+	}
+	sa.raw.Family = AF_INET;
+	p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port));
+	p[0] = byte(sa.Port>>8);
+	p[1] = byte(sa.Port);
+	for i := 0; i < len(sa.Addr); i++ {
+		sa.raw.Addr[i] = sa.Addr[i];
+	}
+	return (*RawSockaddrAny)(unsafe.Pointer(&sa.raw)), SizeofSockaddrInet4, 0;
+}
+
+func (sa *SockaddrInet6) sockaddr() (*RawSockaddrAny, Socklen_t, int) {
+	if sa.Port < 0 || sa.Port > 0xFFFF {
+		return nil, 0, EINVAL;
+	}
+	sa.raw.Family = AF_INET6;
+	p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port));
+	p[0] = byte(sa.Port>>8);
+	p[1] = byte(sa.Port);
+	for i := 0; i < len(sa.Addr); i++ {
+		sa.raw.Addr[i] = sa.Addr[i];
+	}
+	// FIXME: socket.go SizeofSockaddrInet6 is wrong on Solaris due to
+	// __sin6_src_id member.
+	//return (*RawSockaddrAny)(unsafe.Pointer(&sa.raw)), SizeofSockaddrInet6, 0;
+	return (*RawSockaddrAny)(unsafe.Pointer(&sa.raw)), SizeofSockaddrInet6 + 4, 0;
+}
+
+func (sa *SockaddrUnix) sockaddr() (*RawSockaddrAny, Socklen_t, int) {
+	name := sa.Name;
+	n := len(name);
+	if n >= len(sa.raw.Path) || n == 0 {
+		return nil, 0, EINVAL;
+	}
+	sa.raw.Family = AF_UNIX;
+	for i := 0; i < n; i++ {
+		sa.raw.Path[i] = int8(name[i]);
+	}
+	if sa.raw.Path[0] == '@' {
+		sa.raw.Path[0] = 0;
+	}
+
+	// length is family, name, NUL.
+	return (*RawSockaddrAny)(unsafe.Pointer(&sa.raw)), 1 + Socklen_t(n) + 1, 0;
+}
+
+func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, int) {
+	switch rsa.Addr.Family {
+	case AF_UNIX:
+		pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa));
+		sa := new(SockaddrUnix);
+		if pp.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.
+			pp.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(pp.Path) - 3 && pp.Path[n] != 0 {
+			n++;
+		}
+		bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]));
+		sa.Name = string(bytes[0:n]);
+		return sa, 0;
+
+	case AF_INET:
+		pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa));
+		sa := new(SockaddrInet4);
+		p := (*[2]byte)(unsafe.Pointer(&pp.Port));
+		sa.Port = int(p[0])<<8 + int(p[1]);
+		for i := 0; i < len(sa.Addr); i++ {
+			sa.Addr[i] = pp.Addr[i];
+		}
+		return sa, 0;
+
+	case AF_INET6:
+		pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa));
+		sa := new(SockaddrInet6);
+		p := (*[2]byte)(unsafe.Pointer(&pp.Port));
+		sa.Port = int(p[0])<<8 + int(p[1]);
+		for i := 0; i < len(sa.Addr); i++ {
+			sa.Addr[i] = pp.Addr[i];
+		}
+		return sa, 0;
+	}
+	return nil, EAFNOSUPPORT;
+}
+
+// BindToDevice binds the socket associated with fd to device.
+func BindToDevice(fd int, device string) (errno int) {
+	return ENOSYS
+}
diff -r 779b637a1983 libgo/syscalls/syscall_solaris.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/syscalls/syscall_solaris.go	Wed Jan 05 14:38:06 2011 +0100
@@ -0,0 +1,17 @@
+// syscall_solaris.go -- Solaris 2 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))
diff -r 779b637a1983 libgo/testsuite/gotest
--- a/libgo/testsuite/gotest	Wed Jan 05 14:33:43 2011 +0100
+++ b/libgo/testsuite/gotest	Wed Jan 05 14:38:06 2011 +0100
@@ -272,7 +272,7 @@
 	# the grep -v eliminates methods and other special names
 	# that have multiple dots.
 	pattern='Test([^a-z].*)?'
-	tests=$(nm -s _gotest_.o $xofile | egrep ' T .*\.'$pattern'$' | grep -v '\..*\..*\.' | sed 's/.* //' | sed 's/.*\.\(.*\.\)/\1/')
+	tests=$(nm -ps _gotest_.o $xofile | egrep ' T .*\.'$pattern'$' | grep -v '\..*\..*\.' | sed 's/.* //' | sed 's/.*\.\(.*\.\)/\1/')
 	if [ "x$tests" = x ]; then
 		echo 'gotest: warning: no tests matching '$pattern in _gotest_.o $xofile 1>&2
 		exit 2
diff -r 779b637a1983 libgo/testsuite/lib/libgo.exp
--- a/libgo/testsuite/lib/libgo.exp	Wed Jan 05 14:33:43 2011 +0100
+++ b/libgo/testsuite/lib/libgo.exp	Wed Jan 05 14:38:06 2011 +0100
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 if {$gccdir != ""} {
     set gccdir [file dirname $gccdir]
 }
-set GO_UNDER_TEST "$gccdir/gccgo -B$gccdir/"
+set GOC_UNDER_TEST "$gccdir/gccgo -B$gccdir/"
 set TESTING_IN_BUILD_TREE 1
 
 proc go_maybe_build_wrapper { args } {
diff -r 779b637a1983 libgo/testsuite/libgo.testmain/testmain.exp
--- a/libgo/testsuite/libgo.testmain/testmain.exp	Wed Jan 05 14:33:43 2011 +0100
+++ b/libgo/testsuite/libgo.testmain/testmain.exp	Wed Jan 05 14:38:06 2011 +0100
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -44,7 +44,8 @@
 }
 
 set object_files [glob -nocomplain "*.o"]
-regsub $gluefile $object_files "" object_files
+# FIXME: Not found, even with global gluefile!?
+#regsub $gluefile $object_files "" object_files
 
 lappend options $ld_options
 
