From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 12.4.0/musl/
Date: Wed, 01 Oct 2025 20:37:08 +0000 (UTC) [thread overview]
Message-ID: <1759351018.d3b223fe9d7ea3aa013e45ac7824b38a71c7b7b3.sam@gentoo> (raw)
commit: d3b223fe9d7ea3aa013e45ac7824b38a71c7b7b3
Author: Andrei Horodniceanu <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Sat Sep 20 18:13:27 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 1 20:36:58 2025 +0000
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d3b223fe
12.4.0: Improve libdruntime 32-bit musl fixes
Signed-off-by: Andrei Horodniceanu <a.horodniceanu <AT> proton.me>
Part-of: https://github.com/gentoo/gcc-patches/pull/10
Signed-off-by: Sam James <sam <AT> gentoo.org>
12.4.0/musl/50_all_libdruntime_32bit.patch | 186 +++++++++++++++++++++
.../musl/50_all_libdruntime_mmap_definition.patch | 17 --
12.4.0/musl/README.history | 5 +
3 files changed, 191 insertions(+), 17 deletions(-)
diff --git a/12.4.0/musl/50_all_libdruntime_32bit.patch b/12.4.0/musl/50_all_libdruntime_32bit.patch
new file mode 100644
index 0000000..596fb76
--- /dev/null
+++ b/12.4.0/musl/50_all_libdruntime_32bit.patch
@@ -0,0 +1,186 @@
+These changes are meant to fix gcc-12 for some musl-32 bit platforms.
+They involve fixing some declarations (e.g define readdir, not
+readdir64) and forcing the usage of 32-bit time_t. This latter choice
+is because libdruntime in <gcc-13 doesn't have the definitions for the
+time64 variants of the functions (e.g. __clock_getres_time64).
+
+Most of these changes come from https://github.com/dlang/dmd/pull/21639
+#######################################################################
+
+From f86a7ea815856bc66d2e6d6cc5b12293763e0445 Mon Sep 17 00:00:00 2001
+From: Iain Buclaw <ibuclaw@gdcproject.org>
+Date: Sun, 3 Aug 2025 12:42:14 +0200
+Subject: [PR-21639] [PATCH] druntime, musl: Remove unused __USE_FILE_OFFSET64 bindings
+
+As pointed out in #21249, Musl doesn't implement *64 versions of these
+functions because off_t is always 64 bits. However there are aliases
+defined if `_USE_LARGEFILE64_SOURCE` is true.
+
+--- a/libphobos/libdruntime/core/sys/posix/dirent.d
++++ b/libphobos/libdruntime/core/sys/posix/dirent.d
+@@ -384,16 +384,14 @@ else version (CRuntime_Musl)
+
+ struct DIR
+ {
++ // Managed by OS
+ }
+
+- static if ( __USE_FILE_OFFSET64 )
++ dirent* readdir(DIR*);
++
++ static if (__USE_LARGEFILE64)
+ {
+- dirent* readdir64(DIR*);
+- alias readdir64 readdir;
+- }
+- else
+- {
+- dirent* readdir(DIR*);
++ alias readdir64 = readdir;
+ }
+ }
+ else version (CRuntime_UClibc)
+--- a/libphobos/libdruntime/core/sys/posix/stdio.d
++++ b/libphobos/libdruntime/core/sys/posix/stdio.d
+@@ -183,33 +183,20 @@ else version (CRuntime_UClibc)
+ }
+ else version (CRuntime_Musl)
+ {
+- static if ( __USE_FILE_OFFSET64 )
++ int fgetpos(FILE*, fpos_t *);
++ FILE* fopen(const scope char*, const scope char*);
++ FILE* freopen(const scope char*, const scope char*, FILE*);
++ int fseek(FILE*, c_long, int);
++ int fsetpos(FILE*, const scope fpos_t*);
++ FILE* tmpfile();
++
++ static if (__USE_LARGEFILE64)
+ {
+- int fgetpos64(FILE*, fpos_t *);
+- alias fgetpos64 fgetpos;
+-
+- FILE* fopen64(const scope char*, const scope char*);
+- alias fopen64 fopen;
+-
+- FILE* freopen64(const scope char*, const scope char*, FILE*);
+- alias freopen64 freopen;
+-
+- int fseek(FILE*, c_long, int);
+-
+- int fsetpos64(FILE*, const scope fpos_t*);
+- alias fsetpos64 fsetpos;
+-
+- FILE* tmpfile64();
+- alias tmpfile64 tmpfile;
+- }
+- else
+- {
+- int fgetpos(FILE*, fpos_t *);
+- FILE* fopen(const scope char*, const scope char*);
+- FILE* freopen(const scope char*, const scope char*, FILE*);
+- int fseek(FILE*, c_long, int);
+- int fsetpos(FILE*, const scope fpos_t*);
+- FILE* tmpfile();
++ alias fgetpos64 = fgetpos;
++ alias fopen64 = fopen;
++ alias freopen64 = freopen;
++ alias fsetpos64 = fsetpos;
++ alias tmpfile64 = tmpfile;
+ }
+ }
+ else version (Solaris)
+@@ -321,24 +308,13 @@ else version (CRuntime_Musl)
+ {
+ enum L_ctermid = 20;
+
+- static if ( __USE_FILE_OFFSET64 )
+- {
+- int fseeko64(FILE*, off_t, int);
+- alias fseeko64 fseeko;
+- }
+- else
+- {
+- int fseeko(FILE*, off_t, int);
+- }
++ int fseeko(FILE*, off_t, int);
++ off_t ftello(FILE*);
+
+- static if ( __USE_FILE_OFFSET64 )
++ static if (__USE_LARGEFILE64)
+ {
+- off_t ftello64(FILE*);
+- alias ftello64 ftello;
+- }
+- else
+- {
+- off_t ftello(FILE*);
++ alias fseeko64 = fseeko;
++ alias ftello64 = ftello;
+ }
+
+ ssize_t getdelim(char**, size_t*, int, FILE*);
+--- a/libphobos/libdruntime/core/sys/posix/stdlib.d
++++ b/libphobos/libdruntime/core/sys/posix/stdlib.d
+@@ -604,17 +604,12 @@ else version (CRuntime_Musl)
+ void srand48(c_long);
+ void srandom(uint);
+ int unlockpt(int);
+-
+- static if ( __USE_LARGEFILE64 )
+- {
+- int mkstemp64(char*);
+- alias mkstemp64 mkstemp;
+- }
+- else
+- {
+ int mkstemp(char*);
+- }
+
++ static if (__USE_LARGEFILE64)
++ {
++ alias mkstemp64 = mkstemp;
++ }
+ }
+ else version (Solaris)
+ {
+--- a/libphobos/libdruntime/core/sys/posix/sys/mman.d
++++ b/libphobos/libdruntime/core/sys/posix/sys/mman.d
+@@ -294,12 +294,13 @@ else version (CRuntime_Bionic)
+ }
+ else version (CRuntime_Musl)
+ {
+- static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t);
+- static if (__USE_FILE_OFFSET64)
+- alias mmap = mmap64;
+- else
+- void* mmap(void*, size_t, int, int, int, off_t);
++ void* mmap(void*, size_t, int, int, int, off_t);
+ int munmap(void*, size_t);
++
++ static if (__USE_LARGEFILE64)
++ {
++ alias mmap64 = mmap;
++ }
+ }
+ else version (CRuntime_UClibc)
+ {
+
+Author: Andrei Horodniceanu <a.horodniceanu@proton.me>
+Subject: druntime: force pre-time64 Musl
+
+--- a/libphobos/libdruntime/core/sys/posix/sys/types.d
++++ b/libphobos/libdruntime/core/sys/posix/sys/types.d
+@@ -131,12 +131,7 @@ version (linux)
+ * 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 version (CRuntime_Musl_Pre_Time64)
+- alias c_long time_t;
+- else
+- alias long time_t;
++ alias time_t = c_long;
+ }
+ else
+ {
diff --git a/12.4.0/musl/50_all_libdruntime_mmap_definition.patch b/12.4.0/musl/50_all_libdruntime_mmap_definition.patch
deleted file mode 100644
index 516f7d4..0000000
--- a/12.4.0/musl/50_all_libdruntime_mmap_definition.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-https://github.com/dlang/dmd/pull/16361
-
-Fixes erroneous mmap64 declarations on musl preventing a successful build.
-
-/usr/lib/gcc/x86_64-pc-linux-musl/11/../../../../x86_64-pc-linux-musl/bin/ld: /usr/lib/gcc/x86_64-pc-linux-musl/11/libgphobos.a(os.o): in function `gc.os.os_mem_map(ulong)':
-(.text._D2gc2os10os_mem_mapFNbmZPv+0x1d): undefined reference to `mmap64'
-
---- a/libphobos/libdruntime/core/sys/posix/config.d
-+++ b/libphobos/libdruntime/core/sys/posix/config.d
-@@ -75,7 +75,7 @@ else version (CRuntime_Musl)
- enum __REDIRECT = false;
-
- // Those three are irrelevant for Musl as it always uses 64 bits off_t
-- enum __USE_FILE_OFFSET64 = _FILE_OFFSET_BITS == 64;
-+ enum __USE_FILE_OFFSET64 = false;
- enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT;
- enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT;
diff --git a/12.4.0/musl/README.history b/12.4.0/musl/README.history
index 677ef9d..79a3402 100644
--- a/12.4.0/musl/README.history
+++ b/12.4.0/musl/README.history
@@ -1,3 +1,8 @@
+4 20 Sep 2025
+
+ - 50_all_libdruntime_mmap_definition.patch
+ + 50_all_libdruntime_32bit.patch
+
3 3 Jul 2025
+ 50_all_libdruntime_mmap_definition.patch
next reply other threads:[~2025-10-01 20:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 20:37 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-07-12 1:03 [gentoo-commits] proj/gcc-patches:master commit in: 12.4.0/musl/ Sam James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1759351018.d3b223fe9d7ea3aa013e45ac7824b38a71c7b7b3.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox