[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#950188: gcc-snapshot: FTBFS on hurd-i386



reassign 950188 gcc-10-10-20200129
thanks!

> 
> The patches have now been committed upstream by Ian.
> 
> > They don't apply to gcc-10 in experimental. Close this issue?
> 
> They might not apply to gcc-10, but they apply fine to 1:20200124-1.
> I'm still confused why you have both gcc-10 and gcc-snapshot? 

They do apply to 10_10-20200129-1 as well as 1:20200124-1. I'm
attaching them now for completeness, but they should not be needed
anymore. The upstream bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93468
was closed by Ian on January 30.
I have now test-built gcc-10 as well as gcc-snapshot with successful
outcome.

> > > Or is gcc-10 release upstream already (I don't think so)?
> > they are the same, there's some overlap.  it's easier to provide
> > current trunk in just a single package during development.

Thanks!
--- a/src/libgo/go/runtime/nbpipe_pipe2.go	2020-01-23 21:11:38.000000000 +0100
+++ b/src/libgo/go/runtime/nbpipe_pipe2.go	2020-01-27 17:31:31.000000000 +0100
@@ -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 openbsd solaris
+// +build freebsd hurd linux netbsd openbsd solaris
 
 package runtime
 
--- a/src/libgo/go/runtime/netpoll_hurd.go	2020-01-18 16:14:17.000000000 +0100
+++ b/src/libgo/go/runtime/netpoll_hurd.go	2020-01-27 16:23:00.000000000 +0100
@@ -85,6 +85,10 @@
 	return uintptr(rdwake<<16 | wrwake)
 }
 
+func netpollIsPollDescriptor(fd uintptr) bool {
+	return fd == uintptr(rdwake) || fd == uintptr(wrwake)
+}
+
 // netpollwakeup writes on wrwake to wakeup poll before any changes.
 func netpollwakeup() {
 	if pendingUpdates == 0 {
@@ -158,17 +162,32 @@
 	unlock(&mtxset)
 }
 
-// polls for ready network connections
-// returns list of goroutines that become runnable
+// netpollBreak interrupts an epollwait.
+func netpollBreak() {
+	netpollwakeup()
+}
+
+// netpoll checks for ready network connections.
+// Returns list of goroutines that become runnable.
+// delay < 0: blocks indefinitely
+// delay == 0: does not block, just polls
+// delay > 0: block for up to that many nanoseconds
 //go:nowritebarrierrec
-func netpoll(block bool) gList {
-	timeout := int32(0)
-	if !block {
-		timeout = 0
+func netpoll(delay int64) gList {
+	timeout:= int32(0)
+	if delay < 0 {
+		timeout = 0
+	} else if delay == 0 {
+		// TODO: call poll with timeout == 0
 		return gList{}
-	}
-	if pollVerbose {
-		println("*** netpoll", block)
+	} else if delay < 1e6 {
+		timeout = 1
+	} else if delay < 1e15 {
+		timeout = int32(delay / 1e6)
+	} else {
+		// An arbitrary cap on how long to wait for a timer.
+		// 1e9 ms == ~11.5 days.
+		timeout = 1e9
 	}
 retry:
 	lock(&mtxpoll)
@@ -176,40 +195,37 @@
 	pendingUpdates = 0
 	unlock(&mtxpoll)
 
-	if pollVerbose {
-		println("*** netpoll before poll")
-	}
-	n := libc_poll(&pfds[0], int32(len(pfds)), timeout)
-	if pollVerbose {
-		println("*** netpoll after poll", n)
-	}
+	n := libc_poll(&pfds[0], int32(len(pfds)), timeout)
 	if n < 0 {
 		e := errno()
 		if e != _EINTR {
 			println("errno=", e, " len(pfds)=", len(pfds))
 			throw("poll failed")
 		}
-		if pollVerbose {
-			println("*** poll failed")
-		}
 		unlock(&mtxset)
+		// If a timed sleep was interrupted, just return to
+		// recalculate how long we should sleep now.
+		if timeout > 0 {
+			return gList{}
+		}
 		goto retry
 	}
 	// Check if some descriptors need to be changed
 	if n != 0 && pfds[0].revents&(_POLLIN|_POLLHUP|_POLLERR) != 0 {
-		var b [1]byte
-		for read(rdwake, unsafe.Pointer(&b[0]), 1) == 1 {
-			if pollVerbose {
-				println("*** read 1 byte from pipe")
+		if delay != 0 {
+			// A netpollwakeup could be picked up by a
+			// non-blocking poll. Only clear the wakeup
+			// if blocking.
+			var b [1]byte
+			for read(rdwake, unsafe.Pointer(&b[0]), 1) == 1 {
 			}
 		}
-		// Do not look at the other fds in this case as the mode may have changed
-		// XXX only additions of flags are made, so maybe it is ok
-		unlock(&mtxset)
-		goto retry
+		// Still look at the other fds even if the mode may have
+		// changed, as netpollBreak might have been called.
+		n--
 	}
 	var toRun gList
-	for i := 0; i < len(pfds) && n > 0; i++ {
+	for i := 1; i < len(pfds) && n > 0; i++ {
 		pfd := &pfds[i]
 
 		var mode int32
@@ -222,19 +238,14 @@
 			pfd.events &= ^_POLLOUT
 		}
 		if mode != 0 {
-			if pollVerbose {
-				println("*** netpollready i=", i, "revents=", pfd.revents, "events=", pfd.events, "pd=", pds[i])
+			pds[i].everr = false
+			if pfd.revents == _POLLERR {
+				pds[i].everr = true
 			}
 			netpollready(&toRun, pds[i], mode)
 			n--
 		}
 	}
 	unlock(&mtxset)
-	if block && toRun.empty() {
-		goto retry
-	}
-	if pollVerbose {
-		println("*** netpoll returning end")
-	}
 	return toRun
 }
--- a/src/libgo/go/syscall/sockcmsg_unix_other.go	2020-01-23 21:11:38.000000000 +0100
+++ b/src/libgo/go/syscall/sockcmsg_unix_other.go	2020-01-27 16:49:55.000000000 +0100
@@ -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 aix darwin freebsd linux netbsd openbsd solaris
+// +build aix darwin freebsd hurd linux netbsd openbsd solaris
 
 package syscall
 

Reply to: