public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gcc-patches:master commit in: 12.4.0/musl/
@ 2025-07-12  1:03 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2025-07-12  1:03 UTC (permalink / raw
  To: gentoo-commits

commit:     918e93a4d4f8d21b272c74706b47644442e25095
Author:     Andrei Horodniceanu <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Thu Jul  3 19:29:08 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 12 01:01:41 2025 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=918e93a4

12.4.0: add musl fix for libdruntime mmap definition

Signed-off-by: Andrei Horodniceanu <a.horodniceanu <AT> proton.me>
Part-of: https://github.com/gentoo/gcc-patches/pull/9
Signed-off-by: Sam James <sam <AT> gentoo.org>

 12.4.0/musl/50_all_libdruntime_mmap_definition.patch | 17 +++++++++++++++++
 12.4.0/musl/README.history                           |  4 ++++
 2 files changed, 21 insertions(+)

diff --git a/12.4.0/musl/50_all_libdruntime_mmap_definition.patch b/12.4.0/musl/50_all_libdruntime_mmap_definition.patch
new file mode 100644
index 0000000..516f7d4
--- /dev/null
+++ b/12.4.0/musl/50_all_libdruntime_mmap_definition.patch
@@ -0,0 +1,17 @@
+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 06330d5..677ef9d 100644
--- a/12.4.0/musl/README.history
+++ b/12.4.0/musl/README.history
@@ -1,3 +1,7 @@
+3       3 Jul 2025
+
+        + 50_all_libdruntime_mmap_definition.patch
+
 2	????
 
 	- 50_all_cpu_indicator.patch


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/gcc-patches:master commit in: 12.4.0/musl/
@ 2025-10-01 20:37 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2025-10-01 20:37 UTC (permalink / raw
  To: gentoo-commits

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-01 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-12  1:03 [gentoo-commits] proj/gcc-patches:master commit in: 12.4.0/musl/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2025-10-01 20:37 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox