x/sys/unix: move gccgo redeclared functions to separate files
These functions are redeclared in gccgo builds, so move them
to separate files with the "!gccgo" build constraint.
Fixes golang/go#18312
Change-Id: I868cfb77fc394e5e96cee78af0f3abf43db6082a
Reviewed-on: https://go-review.googlesource.com/34379
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/unix/syscall_linux_amd64.go b/unix/syscall_linux_amd64.go
index 18911c2..9516a3f 100644
--- a/unix/syscall_linux_amd64.go
+++ b/unix/syscall_linux_amd64.go
@@ -6,8 +6,6 @@
package unix
-import "syscall"
-
//sys Dup2(oldfd int, newfd int) (err error)
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
@@ -63,9 +61,6 @@
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-//go:noescape
-func gettimeofday(tv *Timeval) (err syscall.Errno)
-
func Gettimeofday(tv *Timeval) (err error) {
errno := gettimeofday(tv)
if errno != 0 {
diff --git a/unix/syscall_linux_amd64_gc.go b/unix/syscall_linux_amd64_gc.go
new file mode 100644
index 0000000..21a4946
--- /dev/null
+++ b/unix/syscall_linux_amd64_gc.go
@@ -0,0 +1,13 @@
+// Copyright 2016 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 amd64,linux
+// +build !gccgo
+
+package unix
+
+import "syscall"
+
+//go:noescape
+func gettimeofday(tv *Timeval) (err syscall.Errno)
diff --git a/unix/syscall_unix.go b/unix/syscall_unix.go
index b46b250..8a5237d 100644
--- a/unix/syscall_unix.go
+++ b/unix/syscall_unix.go
@@ -49,11 +49,6 @@
return e
}
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
-
// Mmap manager, for use by operating system-specific implementations.
type mmapper struct {
diff --git a/unix/syscall_unix_gc.go b/unix/syscall_unix_gc.go
new file mode 100644
index 0000000..4cb8e8e
--- /dev/null
+++ b/unix/syscall_unix_gc.go
@@ -0,0 +1,15 @@
+// Copyright 2016 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 linux netbsd openbsd solaris
+// +build !gccgo
+
+package unix
+
+import "syscall"
+
+func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
+func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
+func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
+func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)