From patchwork Mon Dec 9 03:43:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1205874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515468-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=golang.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="NAf7Aq1r"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=golang-org.20150623.gappssmtp.com header.i=@golang-org.20150623.gappssmtp.com header.b="1nJc/gRE"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47WTZl4887z9s4Y for ; Mon, 9 Dec 2019 14:44:13 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=IN7B9jUCiosmdRqhxWJpIiA5QVYpiLSyfOhy5sPQmcx60c BuZv81MeeUO6vcPAKvBk3vXrtP17vDH95PhxXF1qVneCnwfJC6+CJ/nBsKo34Rki LfyofLpMLOMiRgYrmoEhyF7tIUxKB4OIR8GhNwrmg8t8koWKaLbl/E59hBSWo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=BauM9XT+8TeQ4iqODsBBOIqswh4=; b=NAf7Aq1rqRTpIcNylsst OIy1m67MvSV3tOJO+oMnfZM6lOTVVfMDJmG03fIlL3KNKtaza+x5fVbA49s20yF8 /BzUXmluHidLLf81VV26GNgCsbxChNvL5hukPPu1tc3ZxiUvP/TWLctYFpFSfVjs 2PJWWZ0OlIuudwxrYexLUfg= Received: (qmail 77213 invoked by alias); 9 Dec 2019 03:44:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 77105 invoked by uid 89); 9 Dec 2019 03:43:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=err, HTo:D*googlegroups.com, H*Ad:D*googlegroups.com, holds X-HELO: mail-ed1-f43.google.com Received: from mail-ed1-f43.google.com (HELO mail-ed1-f43.google.com) (209.85.208.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Dec 2019 03:43:55 +0000 Received: by mail-ed1-f43.google.com with SMTP id j17so11459327edp.3 for ; Sun, 08 Dec 2019 19:43:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=IbuBdJbJN/RJGOWC3KzjdgXWwXJepqjydHSipNBngS4=; b=1nJc/gREdLpZmsoHAoPnK3HHRo4bID2gV1Qyf6rRJ6HXnb8AfdFtzX3xk9JWQi39k6 dGKt5DAt/EpKexJhjbOvqKbhJ/nOCdEtXJQidqU9nmTWIApcsBAHO1XwT4+0XVqClhdH vxYx88BCFMxJtG2xlX8JTl0jijUYbPtr+NORoZyo7t1wZE6gt9DDlZ3cqKJ5xv0o4nfy VcmYbgmy4OC/Q/hBR8tijBrMmswd58YuSNCAzqsLgZ9iHsYlzDdMqaggZ54It5LlgqZT yIDYQEiPBNrqQcV4sNpYgNI2dG4LZQHbAlQx4FctBGrxFDLW7zlLh+UhJItjAvVG32nw 5bDw== MIME-Version: 1.0 From: Ian Lance Taylor Date: Sun, 8 Dec 2019 19:43:41 -0800 Message-ID: Subject: libgo patch committed: Hurd fix To: gcc-patches , gofrontend-dev I've committed this Hurd fix by Samuel Thibault for GCC PR 92861. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 279063) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -15c7bc9f0a432bc09716758412ea41d6caa6491b +1da5ceb8daaab7a243fffd6a647554cf674716f8 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/go/runtime/os_hurd.go =================================================================== --- libgo/go/runtime/os_hurd.go (revision 279062) +++ libgo/go/runtime/os_hurd.go (working copy) @@ -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 +)