diff mbox

Go patch committed: Implement new syscall package

Message ID mcrk47tc5e1.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Oct. 25, 2011, 6:06 p.m. UTC
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> it did (as expected :-), but in easy to fix ways (at least for getting
> libgo to compile again):

Thanks.  I committed your patch.


> Unfortunately, testsuite results are a mess: all link tests fail like
> this:
>
> Undefined			first referenced
>  symbol  			    in file
> flock                               /var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/libgo/.libs/libgo.so
> ld: fatal: symbol referencing errors. No output written to a.out
> collect2: error: ld returned 1 exit status
> FAIL: asn1
>
> The 64-bit tests are even worse:
>
> Undefined			first referenced
>  symbol  			    in file
> flock                               /var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/amd64/libgo/.libs/libgo.so
> ptrace                              /var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/amd64/libgo/.libs/libgo.so
> ld: fatal: symbol referencing errors. No output written to a.out
> collect2: error: ld returned 1 exit status
> FAIL: asn1
>
> I've not yet checked how to avoid this, but at least the ptrace stuff
> worked (as in: didn't try to use 64-bit ptrace which doesn't exist)
> before.

I committed this patch to mainline to try to fix these problems.  Thanks
for testing.  For this patch I bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.

Ian

Comments

Rainer Orth Oct. 26, 2011, 12:27 p.m. UTC | #1
Ian,

> I committed this patch to mainline to try to fix these problems.  Thanks
> for testing.  For this patch I bootstrapped and ran Go testsuite on
> x86_64-unknown-linux-gnu.

with this patch, go and libgo results on Solaris 10 and 11/x86 are back
to normal, and Solaris 10 and 11/SPARC bootstraps are currently
running.  Thanks.

There's one problem left: with Solaris nawk, building libcalls.go fails
(from Solaris 8 to 11 inclusive):

nawk -f /vol/gcc/src/hg/trunk/local/libgo/go/syscall/mksyscall.awk ${files} > li
bcalls.go.tmp
nawk: syntax error at source line 47
 context is
            if (match($0, "//sys(nb)?[  ]*([a-zA-Z0-9_]+)\\(([^()]*)\\) >>>  *(\
\(([^()]+)\\))?", <<<  gosig) == 0) {
nawk: illegal statement at source line 47
nawk: syntax error at source line 58
        missing }
make[4]: *** [s-libcalls] Error 2

I don't yet see what's wrong with the pattern, and gawk does accept it.

	Rainer
Ian Lance Taylor Oct. 26, 2011, 1:26 p.m. UTC | #2
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> There's one problem left: with Solaris nawk, building libcalls.go fails
> (from Solaris 8 to 11 inclusive):
>
> nawk -f /vol/gcc/src/hg/trunk/local/libgo/go/syscall/mksyscall.awk ${files} > li
> bcalls.go.tmp
> nawk: syntax error at source line 47
>  context is
>             if (match($0, "//sys(nb)?[  ]*([a-zA-Z0-9_]+)\\(([^()]*)\\) >>>  *(\
> \(([^()]+)\\))?", <<<  gosig) == 0) {
> nawk: illegal statement at source line 47
> nawk: syntax error at source line 58
>         missing }
> make[4]: *** [s-libcalls] Error 2
>
> I don't yet see what's wrong with the pattern, and gawk does accept it.

Hmmm, I don't have a copy of nawk.  Is it possible that it doesn't like
" *" == <space>*?  You could try "[ ]*".

Ian
Rainer Orth Oct. 26, 2011, 3:15 p.m. UTC | #3
Ian,

> Hmmm, I don't have a copy of nawk.  Is it possible that it doesn't like
> " *" == <space>*?  You could try "[ ]*".

the problem is another one: using /usr/xpg4/bin/awk, I find:

/usr/xpg4/bin/awk: line 47 (NR=32): wrong number of arguments to function "m"

nawk(1) only documents match(s,ere) (i.e. two args), and the gawk docs
state:

`match(STRING, REGEXP [, ARRAY])'
[...]
     The ARRAY argument to `match' is a `gawk' extension.  In
     compatibility mode (*note Options::), using a third argument is a
     fatal error.

	Rainer
Ian Lance Taylor Oct. 26, 2011, 3:40 p.m. UTC | #4
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> the problem is another one: using /usr/xpg4/bin/awk, I find:
>
> /usr/xpg4/bin/awk: line 47 (NR=32): wrong number of arguments to function "m"
>
> nawk(1) only documents match(s,ere) (i.e. two args), and the gawk docs
> state:
>
> `match(STRING, REGEXP [, ARRAY])'
> [...]
>      The ARRAY argument to `match' is a `gawk' extension.  In
>      compatibility mode (*note Options::), using a third argument is a
>      fatal error.

Ah.  I took a look at the nawk man page, and I don't see any evidence
that it supports submatches at all.  How annoying.

Ian
diff mbox

Patch

diff -r f02b62d1dcea libgo/go/syscall/exec_stubs.go
--- a/libgo/go/syscall/exec_stubs.go	Tue Oct 25 10:45:29 2011 -0700
+++ b/libgo/go/syscall/exec_stubs.go	Tue Oct 25 10:56:37 2011 -0700
@@ -17,3 +17,7 @@ 
 func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, errno int) {
 	return -1, ENOSYS;
 }
+
+func raw_ptrace(request int, pid int, addr *byte, data *byte) int {
+	return ENOSYS
+}
diff -r f02b62d1dcea libgo/go/syscall/exec_unix.go
--- a/libgo/go/syscall/exec_unix.go	Tue Oct 25 10:45:29 2011 -0700
+++ b/libgo/go/syscall/exec_unix.go	Tue Oct 25 10:56:37 2011 -0700
@@ -16,9 +16,6 @@ 
 //sysnb	raw_fork() (pid Pid_t, errno int)
 //fork() Pid_t
 
-//sysnb raw_ptrace(request int, pid int, addr *byte, data *byte) (errno int)
-//ptrace(request int, pid Pid_t, addr *byte, data *byte) _C_long
-
 //sysnb raw_setsid() (errno int)
 //setsid() Pid_t
 
diff -r f02b62d1dcea libgo/go/syscall/libcall_irix.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/go/syscall/libcall_irix.go	Tue Oct 25 10:56:37 2011 -0700
@@ -0,0 +1,8 @@ 
+// 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
+
+//sysnb raw_ptrace(request int, pid int, addr *byte, data *byte) (errno int)
+//ptrace(request int, pid Pid_t, addr *byte, data *byte) _C_long
diff -r f02b62d1dcea libgo/go/syscall/libcall_linux.go
--- a/libgo/go/syscall/libcall_linux.go	Tue Oct 25 10:45:29 2011 -0700
+++ b/libgo/go/syscall/libcall_linux.go	Tue Oct 25 10:56:37 2011 -0700
@@ -29,6 +29,9 @@ 
 //sys	ptrace(request int, pid int, addr uintptr, data uintptr) (errno int)
 //ptrace(request int, pid Pid_t, addr *byte, data *byte) _C_long
 
+//sysnb raw_ptrace(request int, pid int, addr *byte, data *byte) (errno int)
+//ptrace(request int, pid Pid_t, addr *byte, data *byte) _C_long
+
 func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, errno int) {
 	// The peek requests are machine-size oriented, so we wrap it
 	// to retrieve arbitrary-length data.
@@ -192,6 +195,9 @@ 
 //sys	Fchownat(dirfd int, path string, uid int, gid int, flags int) (errno int)
 //fchownat(dirfd int, path *byte, owner Uid_t, group Gid_t, flags int) int
 
+//sys	Flock(fd int, how int) (errno int)
+//flock(fd int, how int) int
+
 // FIXME: mksysinfo statfs
 // //sys	Fstatfs(fd int, buf *Statfs_t) (errno int)
 // //fstatfs(fd int, buf *Statfs_t) int
diff -r f02b62d1dcea libgo/go/syscall/libcall_posix.go
--- a/libgo/go/syscall/libcall_posix.go	Tue Oct 25 10:45:29 2011 -0700
+++ b/libgo/go/syscall/libcall_posix.go	Tue Oct 25 10:56:37 2011 -0700
@@ -199,9 +199,6 @@ 
 //sys	Fdatasync(fd int) (errno int)
 //fdatasync(fd int) int
 
-//sys	Flock(fd int, how int) (errno int)
-//flock(fd int, how int) int
-
 //sys	Fsync(fd int) (errno int)
 //fsync(fd int) int
 
diff -r f02b62d1dcea libgo/go/syscall/libcall_solaris_386.go
--- a/libgo/go/syscall/libcall_solaris_386.go	Tue Oct 25 10:45:29 2011 -0700
+++ b/libgo/go/syscall/libcall_solaris_386.go	Tue Oct 25 10:56:37 2011 -0700
@@ -7,3 +7,6 @@ 
 // 32-bit Solaris 2/x86 needs to use _nuname internally, cf. <sys/utsname.h>.
 //sysnb	Uname(buf *Utsname) (errno int)
 //_nuname(buf *Utsname) int
+
+//sysnb raw_ptrace(request int, pid int, addr *byte, data *byte) (errno int)
+//ptrace(request int, pid Pid_t, addr *byte, data *byte) _C_long
diff -r f02b62d1dcea libgo/go/syscall/libcall_solaris_amd64.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/go/syscall/libcall_solaris_amd64.go	Tue Oct 25 10:56:37 2011 -0700
@@ -0,0 +1,10 @@ 
+// 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
+
+// 64-bit ptrace(3C) doesn't exist
+func raw_ptrace(request int, pid int, addr *byte, data *byte) int {
+	return ENOSYS
+}
diff -r f02b62d1dcea libgo/go/syscall/libcall_solaris_sparc.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/go/syscall/libcall_solaris_sparc.go	Tue Oct 25 10:56:37 2011 -0700
@@ -0,0 +1,8 @@ 
+// 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
+
+//sysnb raw_ptrace(request int, pid int, addr *byte, data *byte) (errno int)
+//ptrace(request int, pid Pid_t, addr *byte, data *byte) _C_long
diff -r f02b62d1dcea libgo/go/syscall/libcall_solaris_sparc64.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/go/syscall/libcall_solaris_sparc64.go	Tue Oct 25 10:56:37 2011 -0700
@@ -0,0 +1,10 @@ 
+// 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
+
+// 64-bit ptrace(3C) doesn't exist
+func raw_ptrace(request int, pid int, addr *byte, data *byte) int {
+	return ENOSYS
+}