Ian Lance Taylor <i...@golang.org> writes:

> On Fri, Nov 6, 2015 at 5:01 AM, Rainer Orth <r...@cebitec.uni-bielefeld.de> 
> wrote:
>> Ian Lance Taylor <i...@golang.org> writes:
>>
>>> I have committed a patch to libgo to update it to the Go 1.5 release.
>>>
>>> As usual for libgo updates, the actual patch is too large to attach to
>>> this e-mail message.  I've attached the changes to the gccgo-specific
>>> files.
>>>
>>> Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
>>> to mainline.
>>>
>>> This may cause trouble on non-GNU/Linux operating systems.  Please let
>>> me know about any problems you encounter.
>>
>> It does indeed (first tried on i386-pc-solaris2.10):
>>
>> *
>>
>> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-varargs.c: In function 
>> '__go_ioctl':
>> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-varargs.c:63:10: error: 
>> implicit declaration of function 'ioctl' 
>> [-Werror=implicit-function-declaration]
>>    return ioctl (d, request, arg);
>>           ^
>>
>>   Needs <unistd.h>, the following patch works:
>>
>>
>>
>> *
>>
>> /vol/gcc/src/hg/trunk/local/libgo/go/syscall/exec_bsd.go:107:7: error: 
>> incompatible types in assignment (cannot use type int as type Pid_t)
>>     r1 = raw_getpid()
>>        ^
>>
>> I can cast to Pid_t and this works.  The underlying error to me seems
>> that raw_getpid the in the generated libcalls.go is wrong, casting
>> c_getpid return value to int while pid_t can be long.
>>
>> *
>>
>> /vol/gcc/src/hg/trunk/local/libgo/go/net/hook_cloexec.go:13:70: error: 
>> reference to undefined identifier 'syscall.Accept4'
>>   accept4Func func(int, int) (int, syscall.Sockaddr, error) = syscall.Accept4
>>                                                                       ^
>>
>> No accept4 on Solaris (and certainly other systems, thence configure
>> test), but used unconditionally.
>>
>> *
>>
>> /vol/gcc/src/hg/trunk/local/libgo/go/net/sendfile_solaris.go:78:22: error: 
>> reference to undefined identifier 'syscall.Sendfile'
>>    n, err1 := syscall.Sendfile(dst, src, &pos1, n)
>>                       ^
>>
>> Only in go/syscall/libcall_linux.go!?
>>
>> *
>>
>> /vol/gcc/src/hg/trunk/local/libgo/go/net/tcpsockopt_solaris.go:34:103: 
>> error: reference to undefined identifier 'syscall.TCP_KEEPALIVE_THRESHOLD'
>>   return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, 
>> syscall.IPPROTO_TCP, syscall.TCP_KEEPALIVE_THRESHOLD, msecs))
>>
>>                        ^
>>
>> Not in Solaris 10, only Solaris 11 and 12 have it.
>
> Thanks for the notes.  I committed this patch to address these problems.

Worked like a charm, thanks.

There were two remaining problems:

* Before Solaris 12, sendfile only lives in libsendfile.  This lead to
  link failures in gotools.

* Solaris 12 introduced a couple more types that use _in6_addr_t, which
  are filtered out by mksysinfo.sh, leading to compilation failues.

The following patch addresses both issues.  Solaris 10 and 11 bootstraps
have completed, a Solaris 12 bootstrap is still running make check.

diff --git a/libgo/configure.ac b/libgo/configure.ac
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -482,6 +482,9 @@ AC_CACHE_CHECK([for socket libraries], l
 		 [AC_CHECK_LIB(nsl, main,
 		 	[libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lnsl"])])
    unset ac_cv_func_gethostbyname
+   AC_CHECK_FUNC(sendfile, ,
+		 [AC_CHECK_LIB(sendfile, main,
+		 	[libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lsendfile"])])
    LIBS=$libgo_old_libs
 ])
 NET_LIBS="$libgo_cv_lib_sockets"
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -1488,4 +1488,24 @@ grep '^type _zone_net_addr_t ' gen-sysin
     sed -e 's/_in6_addr/[16]byte/' \
     >> ${OUT}
 
+# The Solaris 12 _flow_arp_desc_t struct.
+grep '^type _flow_arp_desc_t ' gen-sysinfo.go | \
+    sed -e 's/_in6_addr_t/[16]byte/g' \
+    >> ${OUT}
+
+# The Solaris 12 _flow_l3_desc_t struct.
+grep '^type _flow_l3_desc_t ' gen-sysinfo.go | \
+    sed -e 's/_in6_addr_t/[16]byte/g' \
+    >> ${OUT}
+
+# The Solaris 12 _mac_ipaddr_t struct.
+grep '^type _mac_ipaddr_t ' gen-sysinfo.go | \
+    sed -e 's/_in6_addr_t/[16]byte/g' \
+    >> ${OUT}
+
+# The Solaris 12 _mactun_info_t struct.
+grep '^type _mactun_info_t ' gen-sysinfo.go | \
+    sed -e 's/_in6_addr_t/[16]byte/g' \
+    >> ${OUT}
+
 exit $?
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to