On Fri, Nov 8, 2013 at 4:01 AM, Rainer Orth <r...@cebitec.uni-bielefeld.de> wrote: > The recent Go patch (couldn't find the submission on gcc-patches) broke > Solaris bootstrap: on Solaris 10/x86 I get > > /vol/gcc/src/hg/trunk/local/libgo/go/net/fd_unix.go:414:72: error: reference > to undefined identifier 'syscall.F_DUPFD_CLOEXEC' > r0, _, e1 := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), > syscall.F_DUPFD_CLOEXEC, 0)
Fixed with appended patch. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu, for whatever that is worth. Committed to mainline. Ian
diff -r c8530fb78751 libgo/go/net/fd_unix.go --- a/libgo/go/net/fd_unix.go Mon Nov 11 11:40:23 2013 -0800 +++ b/libgo/go/net/fd_unix.go Mon Nov 11 13:19:04 2013 -0800 @@ -410,7 +410,7 @@ var tryDupCloexec = int32(1) func dupCloseOnExec(fd int) (newfd int, err error) { - if atomic.LoadInt32(&tryDupCloexec) == 1 { + if atomic.LoadInt32(&tryDupCloexec) == 1 && syscall.F_DUPFD_CLOEXEC != 0 { r0, _, e1 := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), syscall.F_DUPFD_CLOEXEC, 0) if runtime.GOOS == "darwin" && e1 == syscall.EBADF { // On OS X 10.6 and below (but we only support diff -r c8530fb78751 libgo/mksysinfo.sh --- a/libgo/mksysinfo.sh Mon Nov 11 11:40:23 2013 -0800 +++ b/libgo/mksysinfo.sh Mon Nov 11 13:19:04 2013 -0800 @@ -220,6 +220,11 @@ echo "const O_CLOEXEC = 0" >> ${OUT} fi +# The os package requires F_DUPFD_CLOEXEC to be defined. +if ! grep '^const F_DUPFD_CLOEXEC' ${OUT} >/dev/null 2>&1; then + echo "const F_DUPFD_CLOEXEC = 0" >> ${OUT} +fi + # These flags can be lost on i386 GNU/Linux when using # -D_FILE_OFFSET_BITS=64, because we see "#define F_SETLK F_SETLK64" # before we see the definition of F_SETLK64.