diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-12-13 22:10:44 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-12-13 22:10:44 +0000 |
commit | 51426017f8fe0f18295ca467feba3fbb5aad3fa8 (patch) | |
tree | 2f686f2d4657aa570473986e7d0924794093c67b /libgo/go | |
parent | 0cec14923830569b8727d461bcf64adaf965de83 (diff) | |
parent | c926fd82bbd336b317266d43b9fa67a83397b06b (diff) | |
download | gcc-51426017f8fe0f18295ca467feba3fbb5aad3fa8.zip gcc-51426017f8fe0f18295ca467feba3fbb5aad3fa8.tar.gz gcc-51426017f8fe0f18295ca467feba3fbb5aad3fa8.tar.bz2 |
Merge from trunk revision 279830.
From-SVN: r279387
Diffstat (limited to 'libgo/go')
-rw-r--r-- | libgo/go/cmd/cgo/out.go | 4 | ||||
-rw-r--r-- | libgo/go/runtime/os_hurd.go | 34 |
2 files changed, 30 insertions, 8 deletions
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)) diff --git a/libgo/go/runtime/os_hurd.go b/libgo/go/runtime/os_hurd.go index 5be5a1d..bb3e7ff 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,9 +37,13 @@ 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.mos.waitsema != 0 { + if mp.waitsema != 0 { return } @@ -52,7 +56,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 @@ -60,9 +64,25 @@ func semasleep(ns int64) int32 { _m_ := getg().m if ns >= 0 { var ts timespec - ts.setNsec(ns) - if sem_timedwait((*_sem_t)(unsafe.Pointer(_m_.mos.waitsema)), &ts) != 0 { + 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() if err == _ETIMEDOUT || err == _EAGAIN || err == _EINTR { return -1 @@ -72,7 +92,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 +106,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") } } |