From patchwork Thu Jul 28 18:14:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:b5d6:b0:2b9:3548:2db5 with SMTP id v22csp384343pxt; Thu, 28 Jul 2022 11:16:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vY4cRNe3M7EF8Dp3/DasNWfHPPJc8+HtKJ/obWgqer0e3sKOjUNA19+FZRrkuwVyUNeCPW X-Received: by 2002:a17:906:4fd6:b0:70c:9284:cc01 with SMTP id i22-20020a1709064fd600b0070c9284cc01mr111246ejw.553.1659032196431; Thu, 28 Jul 2022 11:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659032196; cv=none; d=google.com; s=arc-20160816; b=zjgoDfPvOvCOnQdXCvOBIZvpPUjcH8BgCZnRLWY8ddYXvGQnpwFJFLrn+WvDywNrpn jf9XPQR8XzSk+yA2d9DasaT20b779IYneRh9uMSOer12uihN9HkrIldkXo7xo6G/tIaW kgcKGAbeiPgyTBlZSphbG7XzhRnMqtWuGWc+92UJn6/FPGKgP2n/JhHiLErYe23HE66F oUrQaPMYetnjuCt2eOcxwzDF+B6wJEsE0ZLorFPeMiFeNi+hbjvHOXChHTKZSUyJK3lv u05ERR3eulvg3R8CfRPmsVtFMCKxjSC5ndus9IrU055UueFND2UT7CEP9K5VG2KpoHPd uT0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=fS3VH+K31ms8P7hjiW2AdMQVpMK5RrqyfA6/TRn73mg=; b=QDaKsCJxpCS7LsW5vTSH4dK46Py3KhnsUNbxkgMmf7ANol1gHRxSv2lL51M8g/5n03 0cXSPf/DYs9xawRa/wvSSIIvB7WXTEZry9zefji1NnhlZC++jyLS5l3P3Z3J8VcPjBWI IrcCBLR/5Bgpz3bPHg2MvoJPmJnwHddFAzqcxENnIY0u3zJM/bmeBedCdztkRQ6zy3yT qvRxKp33fne+NCzJF5pFGw5kQzBCIDPX9z4Stru50kBC+zc2Wks//OWMWY2FvT8eqwIA BQ36+e9oW0L7spatwGz5F5c47sq4QXd5sIvm1LWRThT7ndLWdxXHRhqd0Oh+diKGP+lL ZSwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=QsiqXjV6; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id uz12-20020a170907118c00b0072b30e2e4a1si261145ejb.538.2022.07.28.11.16.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 11:16:36 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=QsiqXjV6; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2EB563856DF0 for ; Thu, 28 Jul 2022 18:16:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EB563856DF0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1659032195; bh=fS3VH+K31ms8P7hjiW2AdMQVpMK5RrqyfA6/TRn73mg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=QsiqXjV6mrVIcI3ROKE3tRruo/hUXn/Fbz0LpiOOAn1fyy7KMgc0PyM2svHtfjjIc KxslgxBCl7HPH9eeWRItxRfax6pgCSxHtFk6T8o0EDal3gYFci1j8UoRdXilutcJxH /lOkVHdkegkI35LUmhm2OlA0ui4FRnPoUngNIcl8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from magnesium.8pit.net (magnesium.8pit.net [45.76.88.171]) by sourceware.org (Postfix) with ESMTPS id 434743858D33; Thu, 28 Jul 2022 18:15:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 434743858D33 Received: from localhost (ipb218e4db.dynamic.kabel-deutschland.de [178.24.228.219]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 918c6b1a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Thu, 28 Jul 2022 20:15:49 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] libgo: Explicitly define SYS_timer_settime for 32-bit musl targets Date: Thu, 28 Jul 2022 20:14:23 +0200 Message-Id: <20220728181422.6959-1-soeren@soeren-tempel.net> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: soeren--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: soeren@soeren-tempel.net Cc: iant@golang.org, gofrontend-dev@googlegroups.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1739621344095315860?= X-GMAIL-MSGID: =?utf-8?q?1739621344095315860?= From: Sören Tempel On 32-bit systems, musl only defines SYS_timer_settime32 not SYS_timer_settime. This causes the following compilation error: os_linux.go:251:30: error: reference to undefined name '_SYS_timer_settime' 251 | return int32(syscall(_SYS_timer_settime, uintptr(timerid), uintptr(flags), uintptr(unsafe.Pointer(new)), uintptr(unsafe.Pointer(old)), 0, 0)) | ^ This commit fixes this error by "aliasing" SYS_timer_settime to SYS_timer_settime32 if the latter is defined. This is also what musl does internally [1]. [1]: https://git.musl-libc.org/cgit/musl/tree/src/internal/syscall.h?h=v1.2.3#n212 --- libgo/sysinfo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c index fc021099..6848fba5 100644 --- a/libgo/sysinfo.c +++ b/libgo/sysinfo.c @@ -354,6 +354,12 @@ enum { }; #endif +// musl libc does not have SYS_timer_settime on 32-bit platforms +// but defines SYS_timer_settime32 instead, alias accordingly. +#ifdef SYS_timer_settime32 +#define SYS_timer_settime SYS_timer_settime32 +#endif + #if defined(HAVE_LOFF_T) // loff_t can be defined as a macro; for -fgo-dump-spec make sure we // see a typedef.