pmaports/cross/gcc-armv7/0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
2022-08-13 11:17:36 -04:00

36 lines
1.4 KiB
Diff

From 3825632cf4007ac93d8e44705a6da042c496318b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 18 Jul 2022 20:34:39 +0200
Subject: [PATCH] libgo: Explicitly define SYS_timer_settime for 32-bit musl
arches
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 defining SYS_timer_settime to
SYS_timer_settime32 if the latter is defined.
---
libgo/sysinfo.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
index b85add15a7b..ff04706a993 100644
--- a/libgo/sysinfo.c
+++ b/libgo/sysinfo.c
@@ -343,6 +343,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
+
// musl libc has both off64_t and loff_t. However, both of these types
// are defined as CPP macros, not as C typedefs. Unfortunately, the GCC
// -fdump-go-spec option, which is responsible for generating type