public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix remaining libgo testsuite failures on Solaris 2
@ 2011-01-24 14:44 Rainer Orth
  2011-01-24 19:05 ` Ralf Wildenhues
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Rainer Orth @ 2011-01-24 14:44 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ian Lance Taylor

The recent merge of libgo from upstream broke bootstrap with Go on
Solaris: unless _XOPEN_SOURCE is defined as 400 or above, struct msghdr
has no msg_control, msg_controllen, and msg_flags members, but uses
msg_accrights and msg_accrightslen instead.

I've fixed this (and the bootstrap) like this in mksysinfo.sh:

diff -r 77ad95adb9e1 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Sun Jan 23 23:05:50 2011 +0100
+++ b/libgo/mksysinfo.sh	Sun Jan 23 23:08:31 2011 +0100
@@ -57,7 +57,8 @@
 #include <unistd.h>
 EOF
 
-${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
+#${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
+${CC} -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
 
 echo 'package syscall' > ${OUT}
 
I think we really need to introduce the target_triplet arg to
mksysinfo.sh again which I already had in my original Solaris libgo
patch.  I really doubt that we can find macros which make those
parts/versions of libc visible that are needed in libgo, but have no ill
effect on other platforms.

While this restores libgo bootstrap, there are several other issues that
need to be dealt with:

* In go/time/zoneinfo_unix.go, zoneDir is /usr/share/lib/zoneinfo/ on
  Solaris, not /usr/share/zoneinfo/.  Hardcoding this change fixes
  time/check, but of course this isn't appropriate.

* We need to avoid unconditionally using -Wl,--whole-archive, which is
  only available with GNU ld (and, rarely, vendor linkers like the
  Solaris 11 ld that also implement it).

* Currently, go/os/sys_linux.go is used everywhere which doesn't work
  since only Linux has /proc/sys/kernel/hostname.  I wonder what the
  best solution is, though:

  Solaris /bin/hostname uses sysinfo(SI_HOSTNAME), there's also
  gethostname(3C) and of course uname(2).

* There are several more functions that need largefile variants on
  32-bit Solaris:

  readdir_r needs to use readdir64_r and Dirent needs to correspond to
  _dirent64

  stat, fstat and lstat need to use *stat64, and Stat needs to become
  _stat64.

  There may be more instances, but those are the easy ones so far.  I'm
  unsure where best to place those declarations:

  *stat might go into syscalls/sysfile_stat{regfile, largefile}.go

  readdir_r is currently in go/os/dir.go, but the variants obviously
  should go somewhere into syscalls.

There are also a couple of testsuite issues:

* At least the 64-bit compress/gzip/check hangs on Solaris 11/x86, which
  hangs the whole testsuite run.  This is already dealt with nicely by
  DejaGnu.

* The non-DejaGnu make check only prints it output to stdout, so no
  record of the testsuite run is kept that would show up in
  mail-report.log.

* Even a sequential make check run with use_dejagnu=yes is pretty
  useless: the individal tests are all run with they own runtest
  invocation, but inside the same directory (testsuite).  This way,
  libgo.{log,sum} from the next testcase overwrites the previous one.
  Even so, every test is called go, so all you see is

  FAIL: go

  Not very useful ;-(

Thanks.
	Rainer

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fix remaining libgo testsuite failures on Solaris 2
  2011-01-24 14:44 Fix remaining libgo testsuite failures on Solaris 2 Rainer Orth
@ 2011-01-24 19:05 ` Ralf Wildenhues
  2011-01-24 21:19 ` Ian Lance Taylor
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Ralf Wildenhues @ 2011-01-24 19:05 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, Ian Lance Taylor

* Rainer Orth wrote on Mon, Jan 24, 2011 at 02:48:03PM CET:
> * The non-DejaGnu make check only prints it output to stdout, so no
>   record of the testsuite run is kept that would show up in
>   mail-report.log.

You can use the parallel-tests driver.  It creates a test-suite.log file
with a summary of skipped and failed tests, as well as per-test .log
files.  (It also enables parallel tests execution ...)

Cheers,
Ralf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fix remaining libgo testsuite failures on Solaris 2
  2011-01-24 14:44 Fix remaining libgo testsuite failures on Solaris 2 Rainer Orth
  2011-01-24 19:05 ` Ralf Wildenhues
@ 2011-01-24 21:19 ` Ian Lance Taylor
  2011-01-25 18:44   ` Rainer Orth
  2011-01-31 16:48 ` Rainer Orth
  2011-03-31 23:40 ` Ian Lance Taylor
  3 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2011-01-24 21:19 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> The recent merge of libgo from upstream broke bootstrap with Go on
> Solaris: unless _XOPEN_SOURCE is defined as 400 or above, struct msghdr
> has no msg_control, msg_controllen, and msg_flags members, but uses
> msg_accrights and msg_accrightslen instead.
>
> I've fixed this (and the bootstrap) like this in mksysinfo.sh:
>
> diff -r 77ad95adb9e1 libgo/mksysinfo.sh
> --- a/libgo/mksysinfo.sh	Sun Jan 23 23:05:50 2011 +0100
> +++ b/libgo/mksysinfo.sh	Sun Jan 23 23:08:31 2011 +0100
> @@ -57,7 +57,8 @@
>  #include <unistd.h>
>  EOF
>  
> -${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
> +#${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
> +${CC} -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c

Why did you remove the _D_GNU_SOURCE?  Does it hurt?


> I think we really need to introduce the target_triplet arg to
> mksysinfo.sh again which I already had in my original Solaris libgo
> patch.  I really doubt that we can find macros which make those
> parts/versions of libc visible that are needed in libgo, but have no ill
> effect on other platforms.

I agree that we can't make all systems work the same way, but I think
that testing target_triplet is wrong.  We should instead test for the
relevant features in configure.ac, and use those tests in mksysinfo.sh.
E.g., the way mksysinfo.sh already tests HAVE_SYSCALL_H,
HAVE_SYS_EPOLL_H, etc.


> * Currently, go/os/sys_linux.go is used everywhere which doesn't work
>   since only Linux has /proc/sys/kernel/hostname.  I wonder what the
>   best solution is, though:
>
>   Solaris /bin/hostname uses sysinfo(SI_HOSTNAME), there's also
>   gethostname(3C) and of course uname(2).

The best solution here is to grab os/sys_bsd.go from the master library
and use it on Solaris.

Thanks for the list of items to address, and thanks for testing it.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fix remaining libgo testsuite failures on Solaris 2
  2011-01-24 21:19 ` Ian Lance Taylor
@ 2011-01-25 18:44   ` Rainer Orth
  0 siblings, 0 replies; 7+ messages in thread
From: Rainer Orth @ 2011-01-25 18:44 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-patches

Ian Lance Taylor <iant@google.com> writes:

>> I've fixed this (and the bootstrap) like this in mksysinfo.sh:
>>
>> diff -r 77ad95adb9e1 libgo/mksysinfo.sh
>> --- a/libgo/mksysinfo.sh	Sun Jan 23 23:05:50 2011 +0100
>> +++ b/libgo/mksysinfo.sh	Sun Jan 23 23:08:31 2011 +0100
>> @@ -57,7 +57,8 @@
>>  #include <unistd.h>
>>  EOF
>>  
>> -${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
>> +#${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
>> +${CC} -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
>
> Why did you remove the _D_GNU_SOURCE?  Does it hurt?

Probably not, it should have no effect on Solaris, but the rest
(especially _XOPEN_SOURCE=600) will likely hurt on other platforms.
As I (should have) mentioned, this `patch' was just a hack to let me
continue at all.

>> I think we really need to introduce the target_triplet arg to
>> mksysinfo.sh again which I already had in my original Solaris libgo
>> patch.  I really doubt that we can find macros which make those
>> parts/versions of libc visible that are needed in libgo, but have no ill
>> effect on other platforms.
>
> I agree that we can't make all systems work the same way, but I think
> that testing target_triplet is wrong.  We should instead test for the
> relevant features in configure.ac, and use those tests in mksysinfo.sh.
> E.g., the way mksysinfo.sh already tests HAVE_SYSCALL_H,
> HAVE_SYS_EPOLL_H, etc.

That would mean testing for msg_control, msg_controllen in struct msghdr
in this case, and trying various feature test macros until a match is
found (if any).  E.g., Tru64 UNIX seems to use _POSIX_PII_SOCKET for
that.  libjava already has some of that mess.

>> * Currently, go/os/sys_linux.go is used everywhere which doesn't work
>>   since only Linux has /proc/sys/kernel/hostname.  I wonder what the
>>   best solution is, though:
>>
>>   Solaris /bin/hostname uses sysinfo(SI_HOSTNAME), there's also
>>   gethostname(3C) and of course uname(2).
>
> The best solution here is to grab os/sys_bsd.go from the master library
> and use it on Solaris.

At least the version currently in the GCC tree uses sysctl which doesn't
exist on Solaris.  I suppose uname(2) should be most portable, but I'd
have to check.

> Thanks for the list of items to address, and thanks for testing it.

My pleasure.  If you can make some suggestions for the best route to fix
these issues, I can try (some of) this myself, but given the often
trivial nature of the issues, it might just be a wast of time.

	Rainer

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fix remaining libgo testsuite failures on Solaris 2
  2011-01-24 14:44 Fix remaining libgo testsuite failures on Solaris 2 Rainer Orth
  2011-01-24 19:05 ` Ralf Wildenhues
  2011-01-24 21:19 ` Ian Lance Taylor
@ 2011-01-31 16:48 ` Rainer Orth
  2011-02-21 10:09   ` Ian Lance Taylor
  2011-03-31 23:40 ` Ian Lance Taylor
  3 siblings, 1 reply; 7+ messages in thread
From: Rainer Orth @ 2011-01-31 16:48 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ian Lance Taylor

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> The recent merge of libgo from upstream broke bootstrap with Go on
> Solaris: unless _XOPEN_SOURCE is defined as 400 or above, struct msghdr
> has no msg_control, msg_controllen, and msg_flags members, but uses
> msg_accrights and msg_accrightslen instead.
>
> I've fixed this (and the bootstrap) like this in mksysinfo.sh:
>
> diff -r 77ad95adb9e1 libgo/mksysinfo.sh
> --- a/libgo/mksysinfo.sh	Sun Jan 23 23:05:50 2011 +0100
> +++ b/libgo/mksysinfo.sh	Sun Jan 23 23:08:31 2011 +0100
> @@ -57,7 +57,8 @@
>  #include <unistd.h>
>  EOF
>  
> -${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
> +#${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
> +${CC} -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
>  
>  echo 'package syscall' > ${OUT}
>  
> I think we really need to introduce the target_triplet arg to
> mksysinfo.sh again which I already had in my original Solaris libgo
> patch.  I really doubt that we can find macros which make those
> parts/versions of libc visible that are needed in libgo, but have no ill
> effect on other platforms.

I see you've already fixed the problem above, and a few others I had to
work around during the weekend.

In the meantime, I've fixed most of the remaining stuff:

> While this restores libgo bootstrap, there are several other issues that
> need to be dealt with:
>
> * In go/time/zoneinfo_unix.go, zoneDir is /usr/share/lib/zoneinfo/ on
>   Solaris, not /usr/share/zoneinfo/.  Hardcoding this change fixes
>   time/check, but of course this isn't appropriate.

Already handled by you: I have a slightly different patch that iterates
over an array of strings rather than adding a second variable, but
whatever works is fine with me.

> * We need to avoid unconditionally using -Wl,--whole-archive, which is
>   only available with GNU ld (and, rarely, vendor linkers like the
>   Solaris 11 ld that also implement it).

Patch here:

	http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02304.html

> * Currently, go/os/sys_linux.go is used everywhere which doesn't work
>   since only Linux has /proc/sys/kernel/hostname.  I wonder what the
>   best solution is, though:
>
>   Solaris /bin/hostname uses sysinfo(SI_HOSTNAME), there's also
>   gethostname(3C) and of course uname(2).

While your sys_uname.go works on 64-bit Solaris 11/x86, it fails on
32-bit:

--- FAIL: os_test.TestHostname
       Hostname() = "", want "fuego"

syscall.Uname is entered with errno = 4 and left the same, though I
tried various ways to clear errno.  Probably my insufficient
understanding of Go.

> * There are several more functions that need largefile variants on
>   32-bit Solaris:
>
>   readdir_r needs to use readdir64_r and Dirent needs to correspond to
>   _dirent64
>
>   stat, fstat and lstat need to use *stat64, and Stat needs to become
>   _stat64.
>
>   There may be more instances, but those are the easy ones so far.  I'm
>   unsure where best to place those declarations:
>
>   *stat might go into syscalls/sysfile_stat{regfile, largefile}.go
>
>   readdir_r is currently in go/os/dir.go, but the variants obviously
>   should go somewhere into syscalls.

I've fixed this in the patch below.

The testsuite failures are now down to

Sun ld warning:

target/47378	ld warning linking with libgo.so: relocation bound to a symbol with STV_PROTECTED visibility

In DejaGnu this could simply be pruned.

FAIL: flag
flag provided but not defined: -x
--- FAIL: flag_test.TestEverything
	VisitAll misses some flags
	Visit fails after set

Cf. flag/flag.go (parseOne): BUG comment?

FAIL: http
--- FAIL: http.TestClient
	Get http://www.google.com/robots.txt: dial tcp www.google.com:http: dial udp 129.70.160.15:53: Network is unreachable
--- FAIL: http.TestClientHead
	dial tcp www.google.com:http: dial udp 129.70.160.15:53: Network is unreachable
--- FAIL: http.TestRedirect
	Get http://google.com/: dial tcp google.com:http: dial udp 129.70.160.15:53: Network is unreachable

No wonder: I've been running the test without network access, so DNS
queries will fail of course.  The testcase needs to handle this.

FAIL: net
--- FAIL: net.TestDialGoogle
	lookup www.google.com: dial udp 129.70.160.15:53: Network is unreachable
--- FAIL: net.TestGoogleSRV
	failed: dial udp 129.70.160.15:53: Network is unreachable
	no results

Same: no net -> no DNS, from go/net/dialgoogle_test.go, need to handle
Network is unreachable error

--- FAIL: net.TestLookupPort
	LookupPort("tcp", "gopher") = 0, unknown port tcp/gopher; want 70
	LookupPort("tcp", "http") = 0, unknown port tcp/http; want 80

Not in Solaris 11 /etc/services, from go/net/port_test.go.

FAIL: netchan
2011/01/29 22:45:08 netchan export: error decoding client header:EOF
--- FAIL: netchan.TestErrorForIllegalChannel
	new importer: dial tcp 127.0.0.1:61752: Interrupted system call

Strange, works if run individually, perhaps errno uninitialized, same as
TestHostname?

FAIL: os
--- FAIL: os_test.TestChdirAndGetwd
	Getwd returned "/usr/bin" want "/bin"

Expected: /bin is a symlink on Solaris.

--- FAIL: os_test.TestHostname
	Hostname() = "", want "fuego"

See above

FAIL: syslog
--- FAIL: syslog.TestDial
	Dial() failed: Unix syslog delivery error
--- FAIL: syslog.TestNew
	New() failed: Unix syslog delivery error
--- FAIL: syslog.TestNewLogger
	NewLogger() failed

Solaris syslog uses a STREAMS device (/dev/conslog) and putmsg(2) for
communication with syslogd, not /dev/log.  I wonder how best to handle
this, since this is most likely not a public interface, though one can
study the implementation in the OpenSoalaris sources.  It might be better
to simply use the libc openlog/syslog/closelog functions instead of
reimplementing them in Go.

64-bit only:

/bin/ksh: line 1: 23137: Abort
FAIL: websocket
2011/01/29 22:47:53 Test WebSocket server listening on 127.0.0.1:32824
panic: Dial failed: websocket.Dial ws://127.0.0.1:32824/echo: dial tcp 127.0.0.1:32824: Interrupted system call
/vol/gcc/src/hg/trunk/solaris/libgo/testsuite/gotest: line 316: 23205: Abort
make: *** [websocket/check] Error 1

Same as above: PASSes if run individually.

The following patch has been tested on i386-pc-solaris2.11, but before
your recent patches and with a couple of other workarounds which
shouldn't be necessary anymore.

Ok for mainline?

	Rainer


2011-01-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* go/os/dir.go (libc_readdir_r): Move ...
	* go/os/dir_regfile.go: ... here.  New file.
	* go/os/dir_largefile.go: New file.
	* mksysinfo.sh: Handle _dirent64, Solaris 2 d_name.
	* Makefile.am (go_os_dir_file): New variable.
	(go_os_files): Use it.

	* syscalls/sysfile_posix.go (libc_stat, libc_fstat, libc_lstat):
	Move ...
	* syscalls/sysfile_stat_regfile.go: ... here.  New file.
	* syscalls/sysfile_stat_largefile.go: New file.
	* mksysinfo.sh: Handle _stat64.
	* Makefile.am (syscall_stat_file): New variable.
	(go_syscall_files): Use it.
	* Makefile.in: Regenerate.

	* configure.ac: Check for <sys/syscall.h>.
	* mksysinfo.sh (sysinfo.c) [HAVE_SYS_SYSCALL_H]: Include
	<sys/syscall.h>.
	* configure: Regenerate.
	* config.h.in: Regenerate.

diff -r 1364b9899eed libgo/Makefile.am
--- a/libgo/Makefile.am	Sun Jan 30 12:31:01 2011 +0100
+++ b/libgo/Makefile.am	Sun Jan 30 22:58:03 2011 +0100
@@ -1,6 +1,6 @@
 # Makefile.am -- Go library Makefile.
 
-# 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.
 
@@ -657,6 +657,16 @@
 	go/netchan/export.go \
 	go/netchan/import.go
 
+if LIBGO_IS_SOLARIS
+if LIBGO_IS_386
+go_os_dir_file = go/os/dir_largefile.go
+else
+go_os_dir_file = go/os/dir_regfile.go
+endif
+else
+go_os_dir_file = go/os/dir_regfile.go
+endif
+
 if LIBGO_IS_LINUX
 go_os_sys_file = go/os/sys_linux.go
 else
@@ -672,6 +682,7 @@
 endif
 
 go_os_files = \
+	$(go_os_dir_file) \
 	go/os/dir.go \
 	go/os/env.go \
 	go/os/env_unix.go \
@@ -1111,18 +1122,23 @@
 if LIBGO_IS_LINUX
 # Always use lseek64 on GNU/Linux.
 syscall_filesize_file = syscalls/sysfile_largefile.go
+syscall_stat_file = syscalls/sysfile_stat_regfile.go
 else # !LIBGO_IS_LINUX
 if LIBGO_IS_SOLARIS
+# FIXME: Same for sparc vs. sparc64.  Introduce new/additional conditional?
 if LIBGO_IS_386
 # Use lseek64 on 386 Solaris.
 syscall_filesize_file = syscalls/sysfile_largefile.go
+syscall_stat_file = syscalls/sysfile_stat_largefile.go
 else # !LIBGO_IS_LINUX && LIBGO_IS_SOLARIS && !LIBGO_IS_386
 # Use lseek on amd64 Solaris.
 syscall_filesize_file = syscalls/sysfile_regfile.go
+syscall_stat_file = syscalls/sysfile_stat_regfile.go
 endif # !LIBGO_IS_386
 else # !LIBGO_IS_LINUX && !LIBGO_IS_SOLARIS
 # Use lseek by default.
 syscall_filesize_file = syscalls/sysfile_regfile.go
+syscall_stat_file = syscalls/sysfile_stat_regfile.go
 endif # !LIBGO_IS_SOLARIS
 endif # !LIBGO_IS_LINUX
 
@@ -1195,6 +1211,7 @@
 	syscalls/exec_helpers.go \
 	$(syscall_exec_os_file) \
 	$(syscall_filesize_file) \
+	$(syscall_stat_file) \
 	$(syscall_sleep_file) \
 	syscalls/socket.go \
 	$(syscall_socket_os_file) \
diff -r 1364b9899eed libgo/configure.ac
--- a/libgo/configure.ac	Sun Jan 30 12:31:01 2011 +0100
+++ b/libgo/configure.ac	Sun Jan 30 22:58:03 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.
 
@@ -328,7 +328,7 @@
 
 GCC_CHECK_UNWIND_GETIPINFO
 
-AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/user.h sys/utsname.h)
+AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h)
 AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
 AC_CHECK_FUNCS(srandom random strsignal)
 
diff -r 1364b9899eed libgo/go/os/dir.go
--- a/libgo/go/os/dir.go	Sun Jan 30 12:31:01 2011 +0100
+++ b/libgo/go/os/dir.go	Sun Jan 30 22:58:03 2011 +0100
@@ -1,4 +1,4 @@
-// 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.
 
@@ -11,7 +11,6 @@
 
 func libc_dup(fd int) int __asm__ ("dup")
 func libc_opendir(*byte) *syscall.DIR __asm__ ("opendir")
-func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) int __asm__ ("readdir_r")
 func libc_closedir(*syscall.DIR) int __asm__ ("closedir")
 
 // FIXME: pathconf returns long, not int.
diff -r 1364b9899eed libgo/go/os/dir_largefile.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/go/os/dir_largefile.go	Sun Jan 30 22:58:03 2011 +0100
@@ -0,0 +1,12 @@
+// dir_largefile.go -- For systems which use the large file interface for
+// readdir_r.
+
+// 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 os
+
+import "syscall"
+
+func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) int __asm__ ("readdir64_r")
diff -r 1364b9899eed libgo/go/os/dir_regfile.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/go/os/dir_regfile.go	Sun Jan 30 22:58:03 2011 +0100
@@ -0,0 +1,12 @@
+// dir_regfile.go -- For systems which do not use the large file interface
+// for readdir_r.
+
+// 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 os
+
+import "syscall"
+
+func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) int __asm__ ("readdir_r")
diff -r 1364b9899eed libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Sun Jan 30 12:31:01 2011 +0100
+++ b/libgo/mksysinfo.sh	Sun Jan 30 22:58:03 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.
 
@@ -42,6 +45,9 @@
 #if defined(HAVE_SYSCALL_H)
 #include <syscall.h>
 #endif
+#if defined(HAVE_SYS_SYSCALL_H)
+#include <sys/syscall.h>
+#endif
 #if defined(HAVE_SYS_EPOLL_H)
 #include <sys/epoll.h>
 #endif
@@ -306,36 +317,47 @@
 fi
 
 # The stat type.
-grep 'type _stat ' gen-sysinfo.go | \
-  sed -e 's/type _stat/type Stat_t/' \
-      -e 's/st_dev/Dev/' \
-      -e 's/st_ino/Ino/' \
-      -e 's/st_nlink/Nlink/' \
-      -e 's/st_mode/Mode/' \
-      -e 's/st_uid/Uid/' \
-      -e 's/st_gid/Gid/' \
-      -e 's/st_rdev/Rdev/' \
-      -e 's/st_size/Size/' \
-      -e 's/st_blksize/Blksize/' \
-      -e 's/st_blocks/Blocks/' \
-      -e 's/st_atim/Atime/' \
-      -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\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-      -e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
-    >> ${OUT}
+# Prefer largefile variant if available.
+stat=`grep '^type _stat64 ' gen-sysinfo.go`
+if test "$stat" != ""; then
+  grep '^type _stat64 ' gen-sysinfo.go
+else
+  grep '^type _stat ' gen-sysinfo.go
+fi | sed -e 's/type _stat\(64\)\?/type Stat_t/' \
+         -e 's/st_dev/Dev/' \
+         -e 's/st_ino/Ino/' \
+         -e 's/st_nlink/Nlink/' \
+         -e 's/st_mode/Mode/' \
+         -e 's/st_uid/Uid/' \
+         -e 's/st_gid/Gid/' \
+         -e 's/st_rdev/Rdev/' \
+         -e 's/st_size/Size/' \
+         -e 's/st_blksize/Blksize/' \
+         -e 's/st_blocks/Blocks/' \
+         -e 's/st_atim/Atime/' \
+         -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\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
+         -e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
+       >> ${OUT}
 
 # The directory searching types.
-grep '^type _dirent ' gen-sysinfo.go | \
-  sed -e 's/type _dirent/type Dirent/' \
-      -e 's/d_name/Name/' \
-      -e 's/]int8/]byte/' \
-      -e 's/d_ino/Ino/' \
-      -e 's/d_off/Off/' \
-      -e 's/d_reclen/Reclen/' \
-      -e 's/d_type/Type/' \
-    >> ${OUT}
+# Prefer largefile variant if available.
+dirent=`grep '^type _dirent64 ' gen-sysinfo.go`
+if test "$dirent" != ""; then
+  grep '^type _dirent64 ' gen-sysinfo.go
+else
+  grep '^type _dirent ' gen-sysinfo.go
+fi | sed -e 's/type _dirent\(64\)\?/type Dirent/' \
+         -e 's/d_name \[0+1\]/d_name [0+256]/' \
+         -e 's/d_name/Name/' \
+         -e 's/]int8/]byte/' \
+         -e 's/d_ino/Ino/' \
+         -e 's/d_off/Off/' \
+         -e 's/d_reclen/Reclen/' \
+         -e 's/d_type/Type/' \
+      >> ${OUT}
 echo "type DIR _DIR" >> ${OUT}
 
 # The rusage struct.
diff -r 1364b9899eed libgo/syscalls/sysfile_posix.go
--- a/libgo/syscalls/sysfile_posix.go	Sun Jan 30 12:31:01 2011 +0100
+++ b/libgo/syscalls/sysfile_posix.go	Sun Jan 30 22:58:03 2011 +0100
@@ -1,6 +1,6 @@
 // sysfile_posix.go -- POSIX File handling.
 
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010, 2010 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.
 
@@ -18,9 +18,6 @@
 func libc_write(fd int, buf *byte, count Size_t) Ssize_t __asm__ ("write");
 func libc_fsync(fd int) int __asm__ ("fsync")
 func libc_pipe(filedes *int) int __asm__("pipe");
-func libc_stat(name *byte, buf *Stat_t) int __asm__ ("stat");
-func libc_fstat(fd int, buf *Stat_t) int __asm__ ("fstat");
-func libc_lstat(name *byte, buf *Stat_t) int __asm__ ("lstat");
 func libc_unlink(name *byte) int __asm__ ("unlink");
 func libc_rmdir(name *byte) int __asm__ ("rmdir");
 func libc_fcntl(fd int, cmd int, arg int) int __asm__ ("fcntl");
diff -r 1364b9899eed libgo/syscalls/sysfile_stat_largefile.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/syscalls/sysfile_stat_largefile.go	Sun Jan 30 22:58:03 2011 +0100
@@ -0,0 +1,12 @@
+// sysfile_stat_largefile.go -- For systems which use the large file interface
+// for *stat.
+
+// 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
+
+func libc_stat(name *byte, buf *Stat_t) int __asm__ ("stat64");
+func libc_fstat(fd int, buf *Stat_t) int __asm__ ("fstat64");
+func libc_lstat(name *byte, buf *Stat_t) int __asm__ ("lstat64");
diff -r 1364b9899eed libgo/syscalls/sysfile_stat_regfile.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/syscalls/sysfile_stat_regfile.go	Sun Jan 30 22:58:03 2011 +0100
@@ -0,0 +1,12 @@
+// sysfile_stat_regfile.go -- For systems which do not use the large file
+// interface for *stat.
+
+// 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
+
+func libc_stat(name *byte, buf *Stat_t) int __asm__ ("stat");
+func libc_fstat(fd int, buf *Stat_t) int __asm__ ("fstat");
+func libc_lstat(name *byte, buf *Stat_t) int __asm__ ("lstat");

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fix remaining libgo testsuite failures on Solaris 2
  2011-01-31 16:48 ` Rainer Orth
@ 2011-02-21 10:09   ` Ian Lance Taylor
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2011-02-21 10:09 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> The following patch has been tested on i386-pc-solaris2.11, but before
> your recent patches and with a couple of other workarounds which
> shouldn't be necessary anymore.
>
> 2011-01-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
> 	* go/os/dir.go (libc_readdir_r): Move ...
> 	* go/os/dir_regfile.go: ... here.  New file.
> 	* go/os/dir_largefile.go: New file.
> 	* mksysinfo.sh: Handle _dirent64, Solaris 2 d_name.
> 	* Makefile.am (go_os_dir_file): New variable.
> 	(go_os_files): Use it.
>
> 	* syscalls/sysfile_posix.go (libc_stat, libc_fstat, libc_lstat):
> 	Move ...
> 	* syscalls/sysfile_stat_regfile.go: ... here.  New file.
> 	* syscalls/sysfile_stat_largefile.go: New file.
> 	* mksysinfo.sh: Handle _stat64.
> 	* Makefile.am (syscall_stat_file): New variable.
> 	(go_syscall_files): Use it.
> 	* Makefile.in: Regenerate.
>
> 	* configure.ac: Check for <sys/syscall.h>.
> 	* mksysinfo.sh (sysinfo.c) [HAVE_SYS_SYSCALL_H]: Include
> 	<sys/syscall.h>.
> 	* configure: Regenerate.
> 	* config.h.in: Regenerate.


Thanks, and sorry for the slow review.  These patches broke 32-bit
GNU/Linux.  I fixed them by changing GNU/Linux to use the 64-bit
functions as well.  To make that work I added

#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64

to mksysinfo.sh, which I hope won't break anything on Solaris.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 9194 bytes --]

diff -r 74db354b09f4 libgo/Makefile.am
--- a/libgo/Makefile.am	Fri Feb 18 21:03:23 2011 -0800
+++ b/libgo/Makefile.am	Sun Feb 20 20:08:45 2011 -0800
@@ -657,6 +657,20 @@
 	go/netchan/export.go \
 	go/netchan/import.go
 
+if LIBGO_IS_SOLARIS
+if LIBGO_IS_386
+go_os_dir_file = go/os/dir_largefile.go
+else
+go_os_dir_file = go/os/dir_regfile.go
+endif
+else
+if LIBGO_IS_LINUX
+go_os_dir_file = go/os/dir_largefile.go
+else
+go_os_dir_file = go/os/dir_regfile.go
+endif
+endif
+
 if LIBGO_IS_LINUX
 go_os_sys_file = go/os/sys_linux.go
 else
@@ -672,6 +686,7 @@
 endif
 
 go_os_files = \
+	$(go_os_dir_file) \
 	go/os/dir.go \
 	go/os/env.go \
 	go/os/env_unix.go \
@@ -1111,18 +1126,23 @@
 if LIBGO_IS_LINUX
 # Always use lseek64 on GNU/Linux.
 syscall_filesize_file = syscalls/sysfile_largefile.go
+syscall_stat_file = syscalls/sysfile_stat_largefile.go
 else # !LIBGO_IS_LINUX
 if LIBGO_IS_SOLARIS
+# FIXME: Same for sparc vs. sparc64.  Introduce new/additional conditional?
 if LIBGO_IS_386
 # Use lseek64 on 386 Solaris.
 syscall_filesize_file = syscalls/sysfile_largefile.go
+syscall_stat_file = syscalls/sysfile_stat_largefile.go
 else # !LIBGO_IS_LINUX && LIBGO_IS_SOLARIS && !LIBGO_IS_386
 # Use lseek on amd64 Solaris.
 syscall_filesize_file = syscalls/sysfile_regfile.go
+syscall_stat_file = syscalls/sysfile_stat_regfile.go
 endif # !LIBGO_IS_386
 else # !LIBGO_IS_LINUX && !LIBGO_IS_SOLARIS
 # Use lseek by default.
 syscall_filesize_file = syscalls/sysfile_regfile.go
+syscall_stat_file = syscalls/sysfile_stat_regfile.go
 endif # !LIBGO_IS_SOLARIS
 endif # !LIBGO_IS_LINUX
 
@@ -1195,6 +1215,7 @@
 	syscalls/exec_helpers.go \
 	$(syscall_exec_os_file) \
 	$(syscall_filesize_file) \
+	$(syscall_stat_file) \
 	$(syscall_sleep_file) \
 	syscalls/socket.go \
 	$(syscall_socket_os_file) \
diff -r 74db354b09f4 libgo/configure.ac
--- a/libgo/configure.ac	Fri Feb 18 21:03:23 2011 -0800
+++ b/libgo/configure.ac	Sun Feb 20 20:08:45 2011 -0800
@@ -378,7 +378,7 @@
   ;;
 esac
 
-AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/user.h sys/utsname.h)
+AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h)
 AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
 AC_CHECK_FUNCS(srandom random strsignal)
 
diff -r 74db354b09f4 libgo/go/os/dir.go
--- a/libgo/go/os/dir.go	Fri Feb 18 21:03:23 2011 -0800
+++ b/libgo/go/os/dir.go	Sun Feb 20 20:08:45 2011 -0800
@@ -11,7 +11,6 @@
 
 func libc_dup(fd int) int __asm__ ("dup")
 func libc_opendir(*byte) *syscall.DIR __asm__ ("opendir")
-func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) int __asm__ ("readdir_r")
 func libc_closedir(*syscall.DIR) int __asm__ ("closedir")
 
 // FIXME: pathconf returns long, not int.
diff -r 74db354b09f4 libgo/go/os/dir_largefile.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/go/os/dir_largefile.go	Sun Feb 20 20:08:45 2011 -0800
@@ -0,0 +1,12 @@
+// dir_largefile.go -- For systems which use the large file interface for
+// readdir_r.
+
+// 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 os
+
+import "syscall"
+
+func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) int __asm__ ("readdir64_r")
diff -r 74db354b09f4 libgo/go/os/dir_regfile.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/go/os/dir_regfile.go	Sun Feb 20 20:08:45 2011 -0800
@@ -0,0 +1,12 @@
+// dir_regfile.go -- For systems which do not use the large file interface
+// for readdir_r.
+
+// 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 os
+
+import "syscall"
+
+func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) int __asm__ ("readdir_r")
diff -r 74db354b09f4 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Fri Feb 18 21:03:23 2011 -0800
+++ b/libgo/mksysinfo.sh	Sun Feb 20 20:08:45 2011 -0800
@@ -26,6 +26,9 @@
 #include "config.h"
 
 #define _GNU_SOURCE
+#define _LARGEFILE_SOURCE
+#define _FILE_OFFSET_BITS 64
+
 #if defined(__sun__) && defined(__svr4__)
 /* Needed by Solaris header files.  */
 #define _XOPEN_SOURCE 600
@@ -42,6 +45,9 @@
 #if defined(HAVE_SYSCALL_H)
 #include <syscall.h>
 #endif
+#if defined(HAVE_SYS_SYSCALL_H)
+#include <sys/syscall.h>
+#endif
 #if defined(HAVE_SYS_EPOLL_H)
 #include <sys/epoll.h>
 #endif
@@ -306,36 +312,47 @@
 fi
 
 # The stat type.
-grep 'type _stat ' gen-sysinfo.go | \
-  sed -e 's/type _stat/type Stat_t/' \
-      -e 's/st_dev/Dev/' \
-      -e 's/st_ino/Ino/' \
-      -e 's/st_nlink/Nlink/' \
-      -e 's/st_mode/Mode/' \
-      -e 's/st_uid/Uid/' \
-      -e 's/st_gid/Gid/' \
-      -e 's/st_rdev/Rdev/' \
-      -e 's/st_size/Size/' \
-      -e 's/st_blksize/Blksize/' \
-      -e 's/st_blocks/Blocks/' \
-      -e 's/st_atim/Atime/' \
-      -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\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-      -e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
-    >> ${OUT}
+# Prefer largefile variant if available.
+stat=`grep '^type _stat64 ' gen-sysinfo.go || true`
+if test "$stat" != ""; then
+  grep '^type _stat64 ' gen-sysinfo.go
+else
+  grep '^type _stat ' gen-sysinfo.go
+fi | sed -e 's/type _stat\(64\)\?/type Stat_t/' \
+         -e 's/st_dev/Dev/' \
+         -e 's/st_ino/Ino/g' \
+         -e 's/st_nlink/Nlink/' \
+         -e 's/st_mode/Mode/' \
+         -e 's/st_uid/Uid/' \
+         -e 's/st_gid/Gid/' \
+         -e 's/st_rdev/Rdev/' \
+         -e 's/st_size/Size/' \
+         -e 's/st_blksize/Blksize/' \
+         -e 's/st_blocks/Blocks/' \
+         -e 's/st_atim/Atime/' \
+         -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\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
+         -e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
+       >> ${OUT}
 
 # The directory searching types.
-grep '^type _dirent ' gen-sysinfo.go | \
-  sed -e 's/type _dirent/type Dirent/' \
-      -e 's/d_name/Name/' \
-      -e 's/]int8/]byte/' \
-      -e 's/d_ino/Ino/' \
-      -e 's/d_off/Off/' \
-      -e 's/d_reclen/Reclen/' \
-      -e 's/d_type/Type/' \
-    >> ${OUT}
+# Prefer largefile variant if available.
+dirent=`grep '^type _dirent64 ' gen-sysinfo.go || true`
+if test "$dirent" != ""; then
+  grep '^type _dirent64 ' gen-sysinfo.go
+else
+  grep '^type _dirent ' gen-sysinfo.go
+fi | sed -e 's/type _dirent\(64\)\?/type Dirent/' \
+         -e 's/d_name \[0+1\]/d_name [0+256]/' \
+         -e 's/d_name/Name/' \
+         -e 's/]int8/]byte/' \
+         -e 's/d_ino/Ino/' \
+         -e 's/d_off/Off/' \
+         -e 's/d_reclen/Reclen/' \
+         -e 's/d_type/Type/' \
+      >> ${OUT}
 echo "type DIR _DIR" >> ${OUT}
 
 # The rusage struct.
diff -r 74db354b09f4 libgo/syscalls/sysfile_posix.go
--- a/libgo/syscalls/sysfile_posix.go	Fri Feb 18 21:03:23 2011 -0800
+++ b/libgo/syscalls/sysfile_posix.go	Sun Feb 20 20:08:45 2011 -0800
@@ -18,9 +18,6 @@
 func libc_write(fd int, buf *byte, count Size_t) Ssize_t __asm__ ("write");
 func libc_fsync(fd int) int __asm__ ("fsync")
 func libc_pipe(filedes *int) int __asm__("pipe");
-func libc_stat(name *byte, buf *Stat_t) int __asm__ ("stat");
-func libc_fstat(fd int, buf *Stat_t) int __asm__ ("fstat");
-func libc_lstat(name *byte, buf *Stat_t) int __asm__ ("lstat");
 func libc_unlink(name *byte) int __asm__ ("unlink");
 func libc_rmdir(name *byte) int __asm__ ("rmdir");
 func libc_fcntl(fd int, cmd int, arg int) int __asm__ ("fcntl");
diff -r 74db354b09f4 libgo/syscalls/sysfile_stat_largefile.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/syscalls/sysfile_stat_largefile.go	Sun Feb 20 20:08:45 2011 -0800
@@ -0,0 +1,12 @@
+// sysfile_stat_largefile.go -- For systems which use the large file interface
+// for *stat.
+
+// 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
+
+func libc_stat(name *byte, buf *Stat_t) int __asm__ ("stat64");
+func libc_fstat(fd int, buf *Stat_t) int __asm__ ("fstat64");
+func libc_lstat(name *byte, buf *Stat_t) int __asm__ ("lstat64");
diff -r 74db354b09f4 libgo/syscalls/sysfile_stat_regfile.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/syscalls/sysfile_stat_regfile.go	Sun Feb 20 20:08:45 2011 -0800
@@ -0,0 +1,12 @@
+// sysfile_stat_regfile.go -- For systems which do not use the large file
+// interface for *stat.
+
+// 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
+
+func libc_stat(name *byte, buf *Stat_t) int __asm__ ("stat");
+func libc_fstat(fd int, buf *Stat_t) int __asm__ ("fstat");
+func libc_lstat(name *byte, buf *Stat_t) int __asm__ ("lstat");

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fix remaining libgo testsuite failures on Solaris 2
  2011-01-24 14:44 Fix remaining libgo testsuite failures on Solaris 2 Rainer Orth
                   ` (2 preceding siblings ...)
  2011-01-31 16:48 ` Rainer Orth
@ 2011-03-31 23:40 ` Ian Lance Taylor
  3 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2011-03-31 23:40 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

I believe that all of these issues have now been fixed.  Thanks.

Ian

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> The recent merge of libgo from upstream broke bootstrap with Go on
> Solaris: unless _XOPEN_SOURCE is defined as 400 or above, struct msghdr
> has no msg_control, msg_controllen, and msg_flags members, but uses
> msg_accrights and msg_accrightslen instead.
>
> I've fixed this (and the bootstrap) like this in mksysinfo.sh:
>
> diff -r 77ad95adb9e1 libgo/mksysinfo.sh
> --- a/libgo/mksysinfo.sh	Sun Jan 23 23:05:50 2011 +0100
> +++ b/libgo/mksysinfo.sh	Sun Jan 23 23:08:31 2011 +0100
> @@ -57,7 +57,8 @@
>  #include <unistd.h>
>  EOF
>  
> -${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
> +#${CC} -D_GNU_SOURCE -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
> +${CC} -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ -fdump-go-spec=gen-sysinfo.go -S -o sysinfo.s sysinfo.c
>  
>  echo 'package syscall' > ${OUT}
>  
> I think we really need to introduce the target_triplet arg to
> mksysinfo.sh again which I already had in my original Solaris libgo
> patch.  I really doubt that we can find macros which make those
> parts/versions of libc visible that are needed in libgo, but have no ill
> effect on other platforms.
>
> While this restores libgo bootstrap, there are several other issues that
> need to be dealt with:
>
> * In go/time/zoneinfo_unix.go, zoneDir is /usr/share/lib/zoneinfo/ on
>   Solaris, not /usr/share/zoneinfo/.  Hardcoding this change fixes
>   time/check, but of course this isn't appropriate.
>
> * We need to avoid unconditionally using -Wl,--whole-archive, which is
>   only available with GNU ld (and, rarely, vendor linkers like the
>   Solaris 11 ld that also implement it).
>
> * Currently, go/os/sys_linux.go is used everywhere which doesn't work
>   since only Linux has /proc/sys/kernel/hostname.  I wonder what the
>   best solution is, though:
>
>   Solaris /bin/hostname uses sysinfo(SI_HOSTNAME), there's also
>   gethostname(3C) and of course uname(2).
>
> * There are several more functions that need largefile variants on
>   32-bit Solaris:
>
>   readdir_r needs to use readdir64_r and Dirent needs to correspond to
>   _dirent64
>
>   stat, fstat and lstat need to use *stat64, and Stat needs to become
>   _stat64.
>
>   There may be more instances, but those are the easy ones so far.  I'm
>   unsure where best to place those declarations:
>
>   *stat might go into syscalls/sysfile_stat{regfile, largefile}.go
>
>   readdir_r is currently in go/os/dir.go, but the variants obviously
>   should go somewhere into syscalls.
>
> There are also a couple of testsuite issues:
>
> * At least the 64-bit compress/gzip/check hangs on Solaris 11/x86, which
>   hangs the whole testsuite run.  This is already dealt with nicely by
>   DejaGnu.
>
> * The non-DejaGnu make check only prints it output to stdout, so no
>   record of the testsuite run is kept that would show up in
>   mail-report.log.
>
> * Even a sequential make check run with use_dejagnu=yes is pretty
>   useless: the individal tests are all run with they own runtest
>   invocation, but inside the same directory (testsuite).  This way,
>   libgo.{log,sum} from the next testcase overwrites the previous one.
>   Even so, every test is called go, so all you see is
>
>   FAIL: go
>
>   Not very useful ;-(
>
> Thanks.
> 	Rainer

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-03-31 23:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-24 14:44 Fix remaining libgo testsuite failures on Solaris 2 Rainer Orth
2011-01-24 19:05 ` Ralf Wildenhues
2011-01-24 21:19 ` Ian Lance Taylor
2011-01-25 18:44   ` Rainer Orth
2011-01-31 16:48 ` Rainer Orth
2011-02-21 10:09   ` Ian Lance Taylor
2011-03-31 23:40 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).