From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) From: soeren@soeren-tempel.net To: gcc-patches@gcc.gnu.org Cc: gofrontend-dev@googlegroups.com, iant@golang.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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-List-Received-Date: Thu, 28 Jul 2022 18:15:54 -0000 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.