From 0c6ce0ae553a9a73bf4eb27d16ee751167806f8d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 19 Nov 2019 23:04:08 +0000 Subject: libgo: better cmd/cgo handling for '.' in pkgpath Updates cgo's gccgoPkgpathToSymbolNew() to bring it into conformance with the way that gccgo now handles package paths with embedded dots (see CL 200838). See also https://gcc.gnu.org/PR61880, a related bug. This CL is a copy of CL 207957 in the main Go repo. Updates golang/go#35623. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/207977 From-SVN: r278470 --- libgo/go/cmd/cgo/out.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libgo/go') diff --git a/libgo/go/cmd/cgo/out.go b/libgo/go/cmd/cgo/out.go index 7282933..97886e1 100644 --- a/libgo/go/cmd/cgo/out.go +++ b/libgo/go/cmd/cgo/out.go @@ -1318,8 +1318,10 @@ func gccgoPkgpathToSymbolNew(ppath string) string { for _, c := range []byte(ppath) { switch { case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z', - '0' <= c && c <= '9', c == '_', c == '.': + '0' <= c && c <= '9', c == '_': bsl = append(bsl, c) + case c == '.': + bsl = append(bsl, ".x2e"...) default: changed = true encbytes := []byte(fmt.Sprintf("..z%02x", c)) -- cgit v1.1 From 5ec7a413d154508c70cf4570ee8da0a545bd6b4a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 Dec 2019 19:37:39 +0000 Subject: re PR other/29842 ([meta-bug] outstanding patches / issues from STMicroelectronics) PR go/29842 runtime: update HURD support for mOS now being embedded Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210285 From-SVN: r279062 --- libgo/go/runtime/os_hurd.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libgo/go') diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index 5be5a1d..2a09e12 100644 --- a/libgo/go/runtime/os_hurd.go +++ b/libgo/go/runtime/os_hurd.go @@ -39,7 +39,7 @@ func sem_timedwait(sem *_sem_t, timeout *timespec) int32 //go:nosplit func semacreate(mp *m) { - if mp.mos.waitsema != 0 { + if mp.waitsema != 0 { return } @@ -52,7 +52,7 @@ func semacreate(mp *m) { if sem_init(sem, 0, 0) != 0 { throw("sem_init") } - mp.mos.waitsema = uintptr(unsafe.Pointer(sem)) + mp.waitsema = uintptr(unsafe.Pointer(sem)) } //go:nosplit @@ -62,7 +62,7 @@ func semasleep(ns int64) int32 { var ts timespec ts.setNsec(ns) - if sem_timedwait((*_sem_t)(unsafe.Pointer(_m_.mos.waitsema)), &ts) != 0 { + if sem_timedwait((*_sem_t)(unsafe.Pointer(_m_.waitsema)), &ts) != 0 { err := errno() if err == _ETIMEDOUT || err == _EAGAIN || err == _EINTR { return -1 @@ -72,7 +72,7 @@ func semasleep(ns int64) int32 { return 0 } for { - r1 := sem_wait((*_sem_t)(unsafe.Pointer(_m_.mos.waitsema))) + r1 := sem_wait((*_sem_t)(unsafe.Pointer(_m_.waitsema))) if r1 == 0 { break } @@ -86,7 +86,7 @@ func semasleep(ns int64) int32 { //go:nosplit func semawakeup(mp *m) { - if sem_post((*_sem_t)(unsafe.Pointer(mp.mos.waitsema))) != 0 { + if sem_post((*_sem_t)(unsafe.Pointer(mp.waitsema))) != 0 { throw("sem_post") } } -- cgit v1.1 From 9135a6ffc5c878c3ee51242be919cab919e83646 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 9 Dec 2019 03:43:33 +0000 Subject: re PR go/92861 (Passes relative time to sem_timedwait on GNU/Hurd) PR go/92861 runtime: use absolute time for sem_timedwait Patch by Samuel Thibault. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210457 From-SVN: r279106 --- libgo/go/runtime/os_hurd.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'libgo/go') diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index 2a09e12..fab1774 100644 --- a/libgo/go/runtime/os_hurd.go +++ b/libgo/go/runtime/os_hurd.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. -// This file is derived from os_solaris.go. +// This file is derived from os_aix.go. package runtime @@ -37,6 +37,10 @@ func sem_post(sem *_sem_t) int32 //extern sem_timedwait func sem_timedwait(sem *_sem_t, timeout *timespec) int32 +//go:noescape +//extern clock_gettime +func clock_gettime(clock_id int32, timeout *timespec) int32 + //go:nosplit func semacreate(mp *m) { if mp.waitsema != 0 { @@ -60,7 +64,23 @@ func semasleep(ns int64) int32 { _m_ := getg().m if ns >= 0 { var ts timespec - ts.setNsec(ns) + + if clock_gettime(_CLOCK_REALTIME, &ts) != 0 { + throw("clock_gettime") + } + + sec := int64(ts.tv_sec) + ns/1e9 + nsec := int64(ts.tv_nsec) + ns%1e9 + if nsec >= 1e9 { + sec++ + nsec -= 1e9 + } + if sec != int64(timespec_sec_t(sec)) { + // Handle overflows (timespec_sec_t is 32-bit in 32-bit applications) + sec = 1<<31 - 1 + } + ts.tv_sec = timespec_sec_t(sec) + ts.tv_nsec = timespec_nsec_t(nsec) if sem_timedwait((*_sem_t)(unsafe.Pointer(_m_.waitsema)), &ts) != 0 { err := errno() @@ -105,3 +125,7 @@ func osinit() { physPageSize = uintptr(getPageSize()) } } + +const ( + _CLOCK_REALTIME = 0 +) -- cgit v1.1 From 763c9f4a8544318998c7adf04e4c92e9a4b85614 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 9 Dec 2019 18:03:53 +0000 Subject: re PR go/92861 (Passes relative time to sem_timedwait on GNU/Hurd) PR go/92861 runtime: don't define CLOCK_REALTIME in os_hurd.go It's already defined in sysinfo.go. Patch by Samuel Thibault. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210538 From-SVN: r279136 --- libgo/go/runtime/os_hurd.go | 4 ---- 1 file changed, 4 deletions(-) (limited to 'libgo/go') diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index fab1774..bb3e7ff 100644 --- a/libgo/go/runtime/os_hurd.go +++ b/libgo/go/runtime/os_hurd.go @@ -125,7 +125,3 @@ func osinit() { physPageSize = uintptr(getPageSize()) } } - -const ( - _CLOCK_REALTIME = 0 -) -- cgit v1.1