diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-03-19 14:00:59 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-03-19 14:00:59 +0000 |
commit | 9195aa172bbc20627f23bfb1612180c83a0a7bab (patch) | |
tree | e42ecb2ffbddc6bf438c711494028bc3b86f527c /libgo/go/syscall | |
parent | 3b595ecaeda647070c6c4ede0c09be78dfc4f763 (diff) | |
download | gcc-9195aa172bbc20627f23bfb1612180c83a0a7bab.zip gcc-9195aa172bbc20627f23bfb1612180c83a0a7bab.tar.gz gcc-9195aa172bbc20627f23bfb1612180c83a0a7bab.tar.bz2 |
libgo: fix build on AIX
Since aix/ppc64 has been added to GC toolchain, a mix between new and
old files were created in gcc toolchain.
This commit corrects this merge for aix/ppc64 and aix/ppc.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/167658
From-SVN: r269797
Diffstat (limited to 'libgo/go/syscall')
-rw-r--r-- | libgo/go/syscall/exec_aix_test.go | 37 | ||||
-rw-r--r-- | libgo/go/syscall/exec_unix.go | 6 | ||||
-rw-r--r-- | libgo/go/syscall/flock_aix.go | 18 | ||||
-rw-r--r-- | libgo/go/syscall/libcall_aix.go | 6 | ||||
-rw-r--r-- | libgo/go/syscall/syscall_funcs.go | 45 | ||||
-rw-r--r-- | libgo/go/syscall/syscall_funcs_stubs.go | 29 | ||||
-rw-r--r-- | libgo/go/syscall/syscall_stubs.go | 29 | ||||
-rw-r--r-- | libgo/go/syscall/syscall_unix.go | 38 |
8 files changed, 81 insertions, 127 deletions
diff --git a/libgo/go/syscall/exec_aix_test.go b/libgo/go/syscall/exec_aix_test.go deleted file mode 100644 index 22b752c..0000000 --- a/libgo/go/syscall/exec_aix_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 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. - -// +build aix - -package syscall - -import "unsafe" - -//go:cgo_import_dynamic libc_Getpgid getpgid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_Getpgrp getpgrp "libc.a/shr_64.o" - -//go:linkname libc_Getpgid libc_Getpgid -//go:linkname libc_Getpgrp libc_Getpgrp - -var ( - libc_Getpgid, - libc_Getpgrp libcFunc -) - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_Getpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0) - pgid = int(r0) - if e1 != 0 { - err = e1 - } - return -} - -func Getpgrp() (pgrp int) { - r0, _, _ := syscall6(uintptr(unsafe.Pointer(&libc_Getpgrp)), 0, 0, 0, 0, 0, 0, 0) - pgrp = int(r0) - return -} - -var Ioctl = ioctl diff --git a/libgo/go/syscall/exec_unix.go b/libgo/go/syscall/exec_unix.go index bad2ce4..ec21f80 100644 --- a/libgo/go/syscall/exec_unix.go +++ b/libgo/go/syscall/exec_unix.go @@ -299,7 +299,6 @@ func runtime_AfterExec() // execveLibc is non-nil on OS using libc syscall, set to execve in exec_libc.go; this // avoids a build dependency for other platforms. -var execveLibc func(path uintptr, argv uintptr, envp uintptr) Errno var execveDarwin func(path *byte, argv **byte, envp **byte) error // Exec invokes the execve(2) system call. @@ -321,10 +320,7 @@ func Exec(argv0 string, argv []string, envv []string) (err error) { var err1 error if runtime.GOOS == "solaris" || runtime.GOOS == "aix" || runtime.GOOS == "hurd" { // RawSyscall should never be used on Solaris or AIX. - err1 = execveLibc( - uintptr(unsafe.Pointer(argv0p)), - uintptr(unsafe.Pointer(&argvp[0])), - uintptr(unsafe.Pointer(&envvp[0]))) + err1 = raw_execve(argv0p, &argvp[0], &envvp[0]) } else if runtime.GOOS == "darwin" { // Similarly on Darwin. err1 = execveDarwin(argv0p, &argvp[0], &envvp[0]) diff --git a/libgo/go/syscall/flock_aix.go b/libgo/go/syscall/flock_aix.go deleted file mode 100644 index c9eab43..0000000 --- a/libgo/go/syscall/flock_aix.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 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" - -// On AIX, there is no flock() system call. - -// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. -func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) { - _, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_fcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/libgo/go/syscall/libcall_aix.go b/libgo/go/syscall/libcall_aix.go index 072f92a..8d9f59e 100644 --- a/libgo/go/syscall/libcall_aix.go +++ b/libgo/go/syscall/libcall_aix.go @@ -10,6 +10,9 @@ import ( "unsafe" ) +// For exec_unix.go. +const SYS_EXECVE = 0 + //sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) //open64at(dirfd _C_int, path *byte, flags _C_int, mode Mode_t) _C_int @@ -139,3 +142,6 @@ func ReadDirent(fd int, buf []byte) (n int, err error) { func Unlinkat(dirfd int, path string) (err error) { return unlinkat(dirfd, path, 0) } + +//sys Getkerninfo(op int32, where uintptr, size uintptr, arg int64) (i int32, err error) +//getkerninfo(op _C_int, where *byte, size *byte, arg _C_long) _C_int diff --git a/libgo/go/syscall/syscall_funcs.go b/libgo/go/syscall/syscall_funcs.go new file mode 100644 index 0000000..4b1ee32 --- /dev/null +++ b/libgo/go/syscall/syscall_funcs.go @@ -0,0 +1,45 @@ +// Copyright 2009 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. + +// +build darwin dragonfly freebsd hurd linux netbsd openbsd solaris + +package syscall + +//extern __go_syscall6 +func syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) uintptr + +// Do a system call. We look at the size of uintptr to see how to pass +// the arguments, so that we don't pass a 64-bit value when the function +// expects a 32-bit one. +func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { + Entersyscall() + SetErrno(0) + r := syscall6(trap, a1, a2, a3, 0, 0, 0) + err = GetErrno() + Exitsyscall() + return r, 0, err +} + +func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { + Entersyscall() + SetErrno(0) + r := syscall6(trap, a1, a2, a3, a4, a5, a6) + err = GetErrno() + Exitsyscall() + return r, 0, err +} + +func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { + SetErrno(0) + r := syscall6(trap, a1, a2, a3, 0, 0, 0) + err = GetErrno() + return r, 0, err +} + +func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { + SetErrno(0) + r := syscall6(trap, a1, a2, a3, a4, a5, a6) + err = GetErrno() + return r, 0, err +} diff --git a/libgo/go/syscall/syscall_funcs_stubs.go b/libgo/go/syscall/syscall_funcs_stubs.go new file mode 100644 index 0000000..c68ab26 --- /dev/null +++ b/libgo/go/syscall/syscall_funcs_stubs.go @@ -0,0 +1,29 @@ +// Copyright 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. + +// +build aix rtems + +// These are stubs. + +package syscall + +func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { + z := -1 + return uintptr(z), 0, ENOSYS +} + +func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { + z := -1 + return uintptr(z), 0, ENOSYS +} + +func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { + z := -1 + return uintptr(z), 0, ENOSYS +} + +func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { + z := -1 + return uintptr(z), 0, ENOSYS +} diff --git a/libgo/go/syscall/syscall_stubs.go b/libgo/go/syscall/syscall_stubs.go deleted file mode 100644 index 00288ee..0000000 --- a/libgo/go/syscall/syscall_stubs.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 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. - -// +build rtems - -// These are stubs. - -package syscall - -func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) { - z := -1 - return uintptr(z), 0, uintptr(ENOSYS) -} - -func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) { - z := -1 - return uintptr(z), 0, uintptr(ENOSYS) -} - -func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) { - z := -1 - return uintptr(z), 0, uintptr(ENOSYS) -} - -func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) { - z := -1 - return uintptr(z), 0, uintptr(ENOSYS) -} diff --git a/libgo/go/syscall/syscall_unix.go b/libgo/go/syscall/syscall_unix.go index b786dc5..ec8f343 100644 --- a/libgo/go/syscall/syscall_unix.go +++ b/libgo/go/syscall/syscall_unix.go @@ -19,9 +19,6 @@ var ( Stderr = 2 ) -//extern __go_syscall6 -func syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) uintptr - const ( darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8 dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8 @@ -29,41 +26,6 @@ const ( solaris64Bit = runtime.GOOS == "solaris" && sizeofPtr == 8 ) -// Do a system call. We look at the size of uintptr to see how to pass -// the arguments, so that we don't pass a 64-bit value when the function -// expects a 32-bit one. -func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { - Entersyscall() - SetErrno(0) - r := syscall6(trap, a1, a2, a3, 0, 0, 0) - err = GetErrno() - Exitsyscall() - return r, 0, err -} - -func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { - Entersyscall() - SetErrno(0) - r := syscall6(trap, a1, a2, a3, a4, a5, a6) - err = GetErrno() - Exitsyscall() - return r, 0, err -} - -func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { - SetErrno(0) - r := syscall6(trap, a1, a2, a3, 0, 0, 0) - err = GetErrno() - return r, 0, err -} - -func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { - SetErrno(0) - r := syscall6(trap, a1, a2, a3, a4, a5, a6) - err = GetErrno() - return r, 0, err -} - // clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte. func clen(n []byte) int { for i := 0; i < len(n); i++ { |