* add-gnu-to-libgo-headers.diff: Add gnu to libgo headers for build.
* add-gnu-to-libgo-test-headers.diff: Add gnu to libgo headers for tests.
* src_libgo_go_go_build_syslist.go.diff: Add gnu to the goosList.
* src_libgo_go_syscall_syscall_gnu_test.go.diff: gnu-specific file for tests
involving struct flock.
* src_libgo_testsuite_gotest.diff: gnu-specific gotest output.
Index: gcc-7-7.2.0-12.1/src/libgo/go/archive/tar/stat_atim.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/archive/tar/stat_atim.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/archive/tar/stat_atim.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux dragonfly openbsd solaris
+// +build gnu linux dragonfly openbsd solaris
 
 package tar
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/cmd/go/signal_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/cmd/go/signal_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/cmd/go/signal_unix.go
@@ -1,8 +1,9 @@
+
 // Copyright 2012 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package main
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/crypto/x509/root_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/crypto/x509/root_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/crypto/x509/root_unix.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build dragonfly freebsd linux nacl netbsd openbsd solaris
+// +build dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package x509
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/fd_poll_runtime.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/fd_poll_runtime.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/fd_poll_runtime.go
@@ -2,7 +2,7 @@
 // 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 windows solaris
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd windows solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/interface_stub.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/interface_stub.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/interface_stub.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build nacl
+// +build nacl gnu
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/internal/socktest/switch_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/internal/socktest/switch_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/internal/socktest/switch_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package socktest
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/port_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/port_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/port_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd solaris nacl
 
 // Read system port mappings from /etc/services
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/dir_largefile.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/dir_largefile.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/dir_largefile.go
@@ -5,7 +5,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux solaris,386 solaris,sparc
+// +build gnu linux solaris,386 solaris,sparc
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/dir_regfile.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/dir_regfile.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/dir_regfile.go
@@ -5,6 +5,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build !gnu
 // +build !linux
 // +build !solaris !386
 // +build !solaris !sparc
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/dir_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/dir_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/dir_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/exec_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/exec_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/exec_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/stat_atim.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/stat_atim.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/stat_atim.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux openbsd solaristag
+// +build gnu linux openbsd solaristag
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/stat.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/stat.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/stat.go
@@ -4,6 +4,7 @@
 
 // +build !darwin
 // +build !freebsd
+// +build !gnu
 // +build !linux
 // +build !netbsd
 // +build !openbsd
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/stat_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/stat_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/stat_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/sys_uname.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/sys_uname.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/sys_uname.go
@@ -4,7 +4,7 @@
 
 // For systems which only store the hostname in uname (Solaris).
 
-// +build solaris irix rtems
+// +build gnu solaris irix rtems
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/user/listgroups_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/user/listgroups_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/user/listgroups_unix.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build dragonfly darwin freebsd !android,linux netbsd openbsd
+// +build dragonfly darwin freebsd gnu !android,linux netbsd openbsd
 
 package user
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/wait_unimp.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/wait_unimp.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/wait_unimp.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build dragonfly nacl netbsd openbsd solaris
+// +build dragonfly gnu nacl netbsd openbsd solaris
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/path/filepath/path_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/path/filepath/path_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/path/filepath/path_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package filepath
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/runtime/env_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/runtime/env_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/runtime/env_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package runtime
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/runtime/lock_sema.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/runtime/lock_sema.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/runtime/lock_sema.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin nacl netbsd openbsd plan9 solaris windows
+// +build darwin gnu nacl netbsd openbsd plan9 solaris windows
 
 package runtime
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/runtime/netpoll.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/runtime/netpoll.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/runtime/netpoll.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package runtime
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/runtime/signal_gccgo.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/runtime/signal_gccgo.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/runtime/signal_gccgo.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package runtime
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/runtime/signal_sighandler.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/runtime/signal_sighandler.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/runtime/signal_sighandler.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package runtime
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/errstr.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/errstr.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/errstr.go
@@ -4,6 +4,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build !gnu
 // +build !linux
 
 package syscall
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/libcall_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/libcall_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/libcall_posix.go
@@ -9,6 +9,8 @@
 // Note that sometimes we use a lowercase //sys name and
 // wrap it in our own nicer implementation.
 
+// +build !gnu
+
 package syscall
 
 import "unsafe"
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/libcall_posix_largefile.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/libcall_posix_largefile.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/libcall_posix_largefile.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux solaris,386 solaris,sparc
+// +build gnu linux solaris,386 solaris,sparc
 
 // POSIX library calls on systems which use the largefile interface.
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/libcall_posix_regfile.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/libcall_posix_regfile.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/libcall_posix_regfile.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build !gnu
 // +build !linux
 // +build !solaris !386
 // +build !solaris !sparc
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/libcall_posix_utimesnano.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/libcall_posix_utimesnano.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/libcall_posix_utimesnano.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin dragonfly freebsd openbsd netbsd solaris
+// +build darwin dragonfly freebsd gnu openbsd netbsd solaris
 
 // General POSIX version of UtimesNano.
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/cgo_resnew.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/cgo_resnew.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/cgo_resnew.go
@@ -3,7 +3,7 @@
 // license that can be found in the LICENSE file.
 
 // +build cgo,!netgo
-// +build darwin linux,!android netbsd solaris
+// +build darwin gnu linux,!android netbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/cgo_sockold.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/cgo_sockold.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/cgo_sockold.go
@@ -3,7 +3,7 @@
 // license that can be found in the LICENSE file.
 
 // +build cgo,!netgo
-// +build darwin dragonfly freebsd netbsd openbsd
+// +build darwin dragonfly freebsd gnu netbsd openbsd
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/hook_cloexec.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/hook_cloexec.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/hook_cloexec.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build freebsd linux
+// +build freebsd gnu linux
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/sock_cloexec.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/sock_cloexec.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/sock_cloexec.go
@@ -5,7 +5,7 @@
 // This file implements sysSocket and accept for platforms that
 // provide a fast path for setting SetNonblock and CloseOnExec.
 
-// +build freebsd linux
+// +build freebsd gnu linux
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/sockoptip_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/sockoptip_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/sockoptip_posix.go
@@ -2,7 +2,7 @@
 // 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 windows
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/exec_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/exec_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/exec_unix.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 // Fork, exec, wait, etc.
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/exec/lp_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/exec/lp_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/exec/lp_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package exec
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/signal/signal_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/signal/signal_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/signal/signal_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package signal
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/error_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/error_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/error_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/file_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/file_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/file_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/path_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/path_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/path_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/sys_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/sys_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/sys_unix.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build dragonfly linux netbsd openbsd solaris
+// +build dragonfly gnu linux netbsd openbsd solaris
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/user/decls_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/user/decls_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/user/decls_unix.go
@@ -2,7 +2,7 @@
 // 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
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd
 // +build cgo
 
 package user
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/user/lookup_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/user/lookup_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/user/lookup_unix.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin dragonfly freebsd !android,linux netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu !android,linux netbsd openbsd solaris
 // +build cgo
 
 package user
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/env_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/env_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/env_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 // Unix environment variables.
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/exec_bsd.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/exec_bsd.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/exec_bsd.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin dragonfly freebsd netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu netbsd openbsd solaris
 
 package syscall
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/sockcmsg_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/sockcmsg_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/sockcmsg_unix.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 // Socket control messages
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/syscall_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/syscall_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/syscall_unix.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package syscall
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/time/sys_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/time/sys_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/time/sys_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package time
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/time/zoneinfo_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/time/zoneinfo_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/time/zoneinfo_unix.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin,386 darwin,amd64 dragonfly freebsd linux,!android nacl netbsd openbsd solaris
+// +build darwin,386 darwin,amd64 dragonfly freebsd gnu linux,!android nacl netbsd openbsd solaris
 
 // Parse "zoneinfo" time zone file.
 // This is a fairly standard file format used on OS X, Linux, BSD, Sun, and others.
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/addrselect.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/addrselect.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/addrselect.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 // Minimal RFC 6724 address selection.
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/conf.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/conf.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/conf.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/dnsclient_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/dnsclient_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/dnsclient_unix.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 // DNS client: see RFC 1035.
 // Has to be linked into package net for Dial.
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/dnsconfig_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/dnsconfig_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/dnsconfig_unix.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 // Read system DNS config from /etc/resolv.conf
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/fd_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/fd_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/fd_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/fd_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/fd_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/fd_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/file_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/file_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/file_unix.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/hook_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/hook_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/hook_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/iprawsock_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/iprawsock_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/iprawsock_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/ipsock_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/ipsock_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/ipsock_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/lookup_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/lookup_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/lookup_unix.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/nss.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/nss.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/nss.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/sockopt_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/sockopt_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/sockopt_posix.go
@@ -2,7 +2,7 @@
 // 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 windows
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/sock_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/sock_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/sock_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/tcpsockopt_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/tcpsockopt_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/tcpsockopt_posix.go
@@ -2,7 +2,7 @@
 // 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 windows
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/tcpsockopt_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/tcpsockopt_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/tcpsockopt_unix.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build freebsd linux netbsd
+// +build freebsd gnu linux netbsd
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/tcpsock_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/tcpsock_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/tcpsock_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/udpsock_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/udpsock_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/udpsock_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/unixsock_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/unixsock_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/unixsock_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/exec_posix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/exec_posix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/exec_posix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/file_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/file_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/file_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/executable_procfs.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/executable_procfs.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/executable_procfs.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux netbsd openbsd dragonfly nacl
+// +build gnu linux netbsd openbsd dragonfly nacl
 
 package os
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/timestruct.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/timestruct.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/timestruct.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package syscall
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/cgo_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/cgo_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/cgo_unix.go
@@ -3,7 +3,7 @@
 // license that can be found in the LICENSE file.
 
 // +build cgo,!netgo
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/archive/tar/stat_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/archive/tar/stat_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/archive/tar/stat_unix.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux darwin dragonfly freebsd openbsd netbsd solaris
+// +build gnu linux darwin dragonfly freebsd openbsd netbsd solaris
 
 package tar
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/crypto/rand/eagain.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/crypto/rand/eagain.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/crypto/rand/eagain.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package rand
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/crypto/rand/rand_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/crypto/rand/rand_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/crypto/rand/rand_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd plan9 solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd plan9 solaris
 
 // Unix cryptographically secure pseudorandom number
 // generator.
Index: gcc-7-7.2.0-12.1/src/libgo/go/exp/terminal/util.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/exp/terminal/util.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/exp/terminal/util.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux
+// +build gnu linux
 
 // Package terminal provides support functions for dealing with terminals, as
 // commonly found on UNIX systems.
Index: gcc-7-7.2.0-12.1/src/libgo/go/mime/type_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/mime/type_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/mime/type_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package mime
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/plugin/plugin_dlopen.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/plugin/plugin_dlopen.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/plugin/plugin_dlopen.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux,cgo darwin,cgo
+// +build linux,cgo darwin,cgo gnu,cgo
 
 package plugin
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/dirent.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/dirent.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/dirent.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package syscall
 
Index: gcc-7-7.2.0-12.1/src/libgo/runtime/env_posix.c
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/runtime/env_posix.c
+++ gcc-7-7.2.0-12.1/src/libgo/runtime/env_posix.c
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 #include "runtime.h"
 #include "array.h"
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/internal/socktest/sys_unix.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/internal/socktest/sys_unix.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/internal/socktest/sys_unix.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package socktest
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/plugin/plugin_stubs.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/plugin/plugin_stubs.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/plugin/plugin_stubs.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !linux,!darwin !cgo
+// +build !gnu !linux,!darwin !cgo
 
 package plugin
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/internal/socktest/sys_cloexec.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/internal/socktest/sys_cloexec.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/internal/socktest/sys_cloexec.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build freebsd linux
+// +build freebsd gnu linux
 
 package socktest
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/main_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/main_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/main_unix_test.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/exec/lp_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/exec/lp_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/exec/lp_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package exec
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/os_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/os_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/os_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package os_test
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/signal/signal_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/signal/signal_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/signal/signal_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package signal
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/runtime/crash_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/runtime/crash_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/runtime/crash_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package runtime_test
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/exec_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/exec_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/exec_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package syscall_test
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/runtime/runtime_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/runtime/runtime_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/runtime/runtime_unix_test.go
@@ -6,7 +6,7 @@
 // We need a fast system call to provoke the race,
 // and Close(-1) is nearly universally fast.
 
-// +build darwin dragonfly freebsd linux netbsd openbsd plan9
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd plan9
 
 package runtime_test
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/export_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/export_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/export_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package syscall
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/mmap_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/syscall/mmap_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/mmap_unix_test.go
@@ -2,7 +2,7 @@
 // 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
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd
 
 package syscall_test
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/addrselect_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/addrselect_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/addrselect_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/cgo_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/cgo_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/cgo_unix_test.go
@@ -3,7 +3,7 @@
 // license that can be found in the LICENSE file.
 
 // +build cgo,!netgo
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/conf_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/conf_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/conf_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/dnsconfig_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/dnsconfig_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/dnsconfig_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/fd_posix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/fd_posix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/fd_posix_test.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris windows
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris windows
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/nss_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/nss_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/nss_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/cmd/go/go_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/cmd/go/go_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/cmd/go/go_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package main_test
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/dial_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/dial_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/dial_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/main_cloexec_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/main_cloexec_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/main_cloexec_test.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build freebsd linux
+// +build freebsd gnu linux
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/net/dnsclient_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/net/dnsclient_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/net/dnsclient_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package net
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/env_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/env_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/env_unix_test.go
@@ -2,7 +2,7 @@
 // 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 darwin dragonfly freebsd gnu linux netbsd openbsd solaris
 
 package os_test
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/os/error_unix_test.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/os/error_unix_test.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/os/error_unix_test.go
@@ -2,7 +2,7 @@
 // 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 nacl netbsd openbsd solaris
+// +build darwin dragonfly freebsd gnu linux nacl netbsd openbsd solaris
 
 package os_test
 
Index: gcc-7-7.2.0-12.1/src/libgo/go/go/build/syslist.go
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/go/go/build/syslist.go
+++ gcc-7-7.2.0-12.1/src/libgo/go/go/build/syslist.go
@@ -4,5 +4,5 @@
 
 package build
 
-const goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows zos "
+const goosList = "android darwin dragonfly freebsd gnu linux nacl netbsd openbsd plan9 solaris windows zos "
 const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be alpha m68k ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64 "
Index: gcc-7-7.2.0-12.1/src/libgo/go/syscall/syscall_gnu_test.go
===================================================================
--- /dev/null
+++ gcc-7-7.2.0-12.1/src/libgo/go/syscall/syscall_gnu_test.go
@@ -0,0 +1,356 @@
+// Copyright 2013 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 gnu
+
+package syscall_test
+
+import (
+	"flag"
+	"fmt"
+	"internal/testenv"
+	"io/ioutil"
+	"net"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"runtime"
+	"syscall"
+	"testing"
+	"time"
+)
+
+// Tests that below functions, structures and constants are consistent
+// on all Unix-like systems.
+func _() {
+	// program scheduling priority functions and constants
+	var (
+		_ func(int, int, int) error   = syscall.Setpriority
+		_ func(int, int) (int, error) = syscall.Getpriority
+	)
+	const (
+		_ int = syscall.PRIO_USER
+		_ int = syscall.PRIO_PROCESS
+		_ int = syscall.PRIO_PGRP
+	)
+
+	// termios constants
+	const (
+		_ int = syscall.TCIFLUSH
+		_ int = syscall.TCIOFLUSH
+		_ int = syscall.TCOFLUSH
+	)
+
+	// fcntl file locking structure and constants
+	var (
+		_ = syscall.Flock_t{
+			Type:   int32(0),
+			Whence: int32(0),
+			Start:  int64(0),
+			Len:    int64(0),
+			Pid:    int32(0),
+		}
+	)
+	const (
+		_ = syscall.F_GETLK
+		_ = syscall.F_SETLK
+		_ = syscall.F_SETLKW
+	)
+}
+
+// TestFcntlFlock tests whether the file locking structure matches
+// the calling convention of each kernel.
+// On some Linux systems, glibc uses another set of values for the
+// commands and translates them to the correct value that the kernel
+// expects just before the actual fcntl syscall. As Go uses raw
+// syscalls directly, it must use the real value, not the glibc value.
+// Thus this test also verifies that the Flock_t structure can be
+// roundtripped with F_SETLK and F_GETLK.
+func TestFcntlFlock(t *testing.T) {
+	if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
+		t.Skip("skipping; no child processes allowed on iOS")
+	}
+	flock := syscall.Flock_t{
+		Type:  syscall.F_WRLCK,
+		Start: 31415, Len: 271828, Whence: 1,
+	}
+	if os.Getenv("GO_WANT_HELPER_PROCESS") == "" {
+		// parent
+		name := filepath.Join(os.TempDir(), "TestFcntlFlock")
+		fd, err := syscall.Open(name, syscall.O_CREAT|syscall.O_RDWR|syscall.O_CLOEXEC, 0)
+		if err != nil {
+			t.Fatalf("Open failed: %v", err)
+		}
+		defer syscall.Unlink(name)
+		defer syscall.Close(fd)
+		if err := syscall.Ftruncate(fd, 1<<20); err != nil {
+			t.Fatalf("Ftruncate(1<<20) failed: %v", err)
+		}
+		if err := syscall.FcntlFlock(uintptr(fd), syscall.F_SETLK, &flock); err != nil {
+			t.Fatalf("FcntlFlock(F_SETLK) failed: %v", err)
+		}
+		cmd := exec.Command(os.Args[0], "-test.run=^TestFcntlFlock$")
+		cmd.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=1")
+		cmd.ExtraFiles = []*os.File{os.NewFile(uintptr(fd), name)}
+		out, err := cmd.CombinedOutput()
+		if len(out) > 0 || err != nil {
+			t.Fatalf("child process: %q, %v", out, err)
+		}
+	} else {
+		// child
+		got := flock
+		// make sure the child lock is conflicting with the parent lock
+		got.Start--
+		got.Len++
+		if err := syscall.FcntlFlock(3, syscall.F_GETLK, &got); err != nil {
+			t.Fatalf("FcntlFlock(F_GETLK) failed: %v", err)
+		}
+		flock.Pid = int32(syscall.Getppid())
+		// Linux kernel always set Whence to 0
+		flock.Whence = 0
+		if got.Type == flock.Type && got.Start == flock.Start && got.Len == flock.Len && got.Pid == flock.Pid && got.Whence == flock.Whence {
+			os.Exit(0)
+		}
+		t.Fatalf("FcntlFlock got %v, want %v", got, flock)
+	}
+}
+
+// TestPassFD tests passing a file descriptor over a Unix socket.
+//
+// This test involved both a parent and child process. The parent
+// process is invoked as a normal test, with "go test", which then
+// runs the child process by running the current test binary with args
+// "-test.run=^TestPassFD$" and an environment variable used to signal
+// that the test should become the child process instead.
+func TestPassFD(t *testing.T) {
+	switch runtime.GOOS {
+	case "dragonfly":
+		// TODO(jsing): Figure out why sendmsg is returning EINVAL.
+		t.Skip("skipping test on dragonfly")
+	case "solaris":
+		// TODO(aram): Figure out why ReadMsgUnix is returning empty message.
+		t.Skip("skipping test on solaris, see issue 7402")
+	}
+
+	testenv.MustHaveExec(t)
+
+	if os.Getenv("GO_WANT_HELPER_PROCESS") == "1" {
+		passFDChild()
+		return
+	}
+
+	tempDir, err := ioutil.TempDir("", "TestPassFD")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer os.RemoveAll(tempDir)
+
+	fds, err := syscall.Socketpair(syscall.AF_LOCAL, syscall.SOCK_STREAM, 0)
+	if err != nil {
+		t.Fatalf("Socketpair: %v", err)
+	}
+	defer syscall.Close(fds[0])
+	defer syscall.Close(fds[1])
+	writeFile := os.NewFile(uintptr(fds[0]), "child-writes")
+	readFile := os.NewFile(uintptr(fds[1]), "parent-reads")
+	defer writeFile.Close()
+	defer readFile.Close()
+
+	cmd := exec.Command(os.Args[0], "-test.run=^TestPassFD$", "--", tempDir)
+	cmd.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=1")
+	cmd.ExtraFiles = []*os.File{writeFile}
+
+	out, err := cmd.CombinedOutput()
+	if len(out) > 0 || err != nil {
+		t.Fatalf("child process: %q, %v", out, err)
+	}
+
+	c, err := net.FileConn(readFile)
+	if err != nil {
+		t.Fatalf("FileConn: %v", err)
+	}
+	defer c.Close()
+
+	uc, ok := c.(*net.UnixConn)
+	if !ok {
+		t.Fatalf("unexpected FileConn type; expected UnixConn, got %T", c)
+	}
+
+	buf := make([]byte, 32) // expect 1 byte
+	oob := make([]byte, 32) // expect 24 bytes
+	closeUnix := time.AfterFunc(5*time.Second, func() {
+		t.Logf("timeout reading from unix socket")
+		uc.Close()
+	})
+	_, oobn, _, _, err := uc.ReadMsgUnix(buf, oob)
+	closeUnix.Stop()
+
+	scms, err := syscall.ParseSocketControlMessage(oob[:oobn])
+	if err != nil {
+		t.Fatalf("ParseSocketControlMessage: %v", err)
+	}
+	if len(scms) != 1 {
+		t.Fatalf("expected 1 SocketControlMessage; got scms = %#v", scms)
+	}
+	scm := scms[0]
+	gotFds, err := syscall.ParseUnixRights(&scm)
+	if err != nil {
+		t.Fatalf("syscall.ParseUnixRights: %v", err)
+	}
+	if len(gotFds) != 1 {
+		t.Fatalf("wanted 1 fd; got %#v", gotFds)
+	}
+
+	f := os.NewFile(uintptr(gotFds[0]), "fd-from-child")
+	defer f.Close()
+
+	got, err := ioutil.ReadAll(f)
+	want := "Hello from child process!\n"
+	if string(got) != want {
+		t.Errorf("child process ReadAll: %q, %v; want %q", got, err, want)
+	}
+}
+
+// passFDChild is the child process used by TestPassFD.
+func passFDChild() {
+	defer os.Exit(0)
+
+	// Look for our fd. It should be fd 3, but we work around an fd leak
+	// bug here (https://golang.org/issue/2603) to let it be elsewhere.
+	var uc *net.UnixConn
+	for fd := uintptr(3); fd <= 10; fd++ {
+		f := os.NewFile(fd, "unix-conn")
+		var ok bool
+		netc, _ := net.FileConn(f)
+		uc, ok = netc.(*net.UnixConn)
+		if ok {
+			break
+		}
+	}
+	if uc == nil {
+		fmt.Println("failed to find unix fd")
+		return
+	}
+
+	// Make a file f to send to our parent process on uc.
+	// We make it in tempDir, which our parent will clean up.
+	flag.Parse()
+	tempDir := flag.Arg(0)
+	f, err := ioutil.TempFile(tempDir, "")
+	if err != nil {
+		fmt.Printf("TempFile: %v", err)
+		return
+	}
+
+	f.Write([]byte("Hello from child process!\n"))
+	f.Seek(0, 0)
+
+	rights := syscall.UnixRights(int(f.Fd()))
+	dummyByte := []byte("x")
+	n, oobn, err := uc.WriteMsgUnix(dummyByte, rights, nil)
+	if err != nil {
+		fmt.Printf("WriteMsgUnix: %v", err)
+		return
+	}
+	if n != 1 || oobn != len(rights) {
+		fmt.Printf("WriteMsgUnix = %d, %d; want 1, %d", n, oobn, len(rights))
+		return
+	}
+}
+
+// TestUnixRightsRoundtrip tests that UnixRights, ParseSocketControlMessage,
+// and ParseUnixRights are able to successfully round-trip lists of file descriptors.
+func TestUnixRightsRoundtrip(t *testing.T) {
+	testCases := [...][][]int{
+		{{42}},
+		{{1, 2}},
+		{{3, 4, 5}},
+		{{}},
+		{{1, 2}, {3, 4, 5}, {}, {7}},
+	}
+	for _, testCase := range testCases {
+		b := []byte{}
+		var n int
+		for _, fds := range testCase {
+			// Last assignment to n wins
+			n = len(b) + syscall.CmsgLen(4*len(fds))
+			b = append(b, syscall.UnixRights(fds...)...)
+		}
+		// Truncate b
+		b = b[:n]
+
+		scms, err := syscall.ParseSocketControlMessage(b)
+		if err != nil {
+			t.Fatalf("ParseSocketControlMessage: %v", err)
+		}
+		if len(scms) != len(testCase) {
+			t.Fatalf("expected %v SocketControlMessage; got scms = %#v", len(testCase), scms)
+		}
+		for i, scm := range scms {
+			gotFds, err := syscall.ParseUnixRights(&scm)
+			if err != nil {
+				t.Fatalf("ParseUnixRights: %v", err)
+			}
+			wantFds := testCase[i]
+			if len(gotFds) != len(wantFds) {
+				t.Fatalf("expected %v fds, got %#v", len(wantFds), gotFds)
+			}
+			for j, fd := range gotFds {
+				if fd != wantFds[j] {
+					t.Fatalf("expected fd %v, got %v", wantFds[j], fd)
+				}
+			}
+		}
+	}
+}
+
+func TestRlimit(t *testing.T) {
+	var rlimit, zero syscall.Rlimit
+	err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
+	if err != nil {
+		t.Fatalf("Getrlimit: save failed: %v", err)
+	}
+	if zero == rlimit {
+		t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit)
+	}
+	set := rlimit
+	set.Cur = set.Max - 1
+	err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &set)
+	if err != nil {
+		t.Fatalf("Setrlimit: set failed: %#v %v", set, err)
+	}
+	var get syscall.Rlimit
+	err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &get)
+	if err != nil {
+		t.Fatalf("Getrlimit: get failed: %v", err)
+	}
+	set = rlimit
+	set.Cur = set.Max - 1
+	if set != get {
+		// Seems like Darwin requires some privilege to
+		// increase the soft limit of rlimit sandbox, though
+		// Setrlimit never reports an error.
+		switch runtime.GOOS {
+		case "darwin":
+		default:
+			t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get)
+		}
+	}
+	err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlimit)
+	if err != nil {
+		t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err)
+	}
+}
+
+func TestSeekFailure(t *testing.T) {
+	_, err := syscall.Seek(-1, 0, 0)
+	if err == nil {
+		t.Fatalf("Seek(-1, 0, 0) did not fail")
+	}
+	str := err.Error() // used to crash on Linux
+	t.Logf("Seek: %v", str)
+	if str == "" {
+		t.Fatalf("Seek(-1, 0, 0) return error with empty message")
+	}
+}
Index: gcc-7-7.2.0-12.1/src/libgo/testsuite/gotest
===================================================================
--- gcc-7-7.2.0-12.1.orig/src/libgo/testsuite/gotest
+++ gcc-7-7.2.0-12.1/src/libgo/testsuite/gotest
@@ -624,7 +624,11 @@ xno)
 		wait $pid
 		status=$?
 		if ! test -f gotest-timeout; then
-		    sleeppid=`ps -o pid,ppid,comm | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		    if test "$goos" = "gnu"; then
+			sleeppid=`ps -o pid,ppid | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		    else
+			sleeppid=`ps -o pid,ppid,comm | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		    fi
 		    kill $alarmpid
 		    wait $alarmpid
 		    if test "$sleeppid" != ""; then

Reply via email to