pmaports/cross/gcc-armv7/0039-CRuntime_Musl-Support-v1.2.0-for-32-bits.patch

54 lines
1.9 KiB
Diff
Raw Normal View History

From 7b2278e6d857f68c9cb956865c5037d73be69fc6 Mon Sep 17 00:00:00 2001
2020-11-18 13:31:13 +00:00
From: Geod24 <pro.mathias.lang@gmail.com>
Date: Mon, 16 Nov 2020 18:40:46 +0100
Subject: [PATCH] CRuntime_Musl: Support v1.2.0 for 32 bits
As explained in the comment, `time_t` on Musl is now always 64 bits,
but used to be 32 bits on 32 bits systems.
---
2020-12-03 23:13:25 +00:00
.../libdruntime/core/sys/posix/sys/types.d | 25 ++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
2020-11-18 13:31:13 +00:00
diff --git a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d
2020-12-03 23:13:25 +00:00
index 451c8b4fccc..ca654fbe424 100644
2020-11-18 13:31:13 +00:00
--- a/libphobos/libdruntime/core/sys/posix/sys/types.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/types.d
2020-12-03 23:13:25 +00:00
@@ -139,10 +139,33 @@ else version (CRuntime_Musl)
2020-11-18 13:31:13 +00:00
alias int pid_t;
alias uint uid_t;
alias uint gid_t;
+
+ /**
+ * Musl versions before v1.2.0 (up to v1.1.24) had different
+ * definitions for `time_t` for 32 bits.
+ * This was changed to always be 64 bits in v1.2.0:
+ * https://musl.libc.org/time64.html
+ * This change was only for 32 bits system and
+ * didn't affect 64 bits systems
+ *
+ * To check previous definitions, `grep` for `time_t` in `arch/`,
+ * and the result should be (in v1.1.24):
+ * ---
+ * // arch/riscv64/bits/alltypes.h.in:20:TYPEDEF long time_t;
+ * // arch/s390x/bits/alltypes.h.in:17:TYPEDEF long time_t;
+ * // arch/sh/bits/alltypes.h.in:21:TYPEDEF long time_t;
+ * ---
+ *
+ * In order to be compatible with old versions of Musl,
+ * one can recompile druntime with `CRuntime_Musl_Pre_Time64`.
+ */
version (D_X32)
alias long time_t;
- else
+ else version (CRuntime_Musl_Pre_Time64)
alias c_long time_t;
+ else
+ alias long time_t;
+
alias c_long clock_t;
alias c_ulong pthread_t;
version (D_LP64)
2020-12-03 23:13:25 +00:00
--
2.31.0
2020-12-03 23:13:25 +00:00