commit:     0542ab149113f5e74326054f46c733de0fdbc94b
Author:     Andrei Horodniceanu <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Thu Jul  3 19:34:46 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 12 01:01:42 2025 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=0542ab14

14.2.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
Closes: https://github.com/gentoo/gcc-patches/pull/9
Signed-off-by: Sam James <sam <AT> gentoo.org>

 14.2.0/musl/50_all_libdruntime_mmap_definition.patch | 18 ++++++++++++++++++
 14.2.0/musl/README.history                           |  4 ++++
 2 files changed, 22 insertions(+)

diff --git a/14.2.0/musl/50_all_libdruntime_mmap_definition.patch 
b/14.2.0/musl/50_all_libdruntime_mmap_definition.patch
new file mode 100644
index 0000000..18034f5
--- /dev/null
+++ b/14.2.0/musl/50_all_libdruntime_mmap_definition.patch
@@ -0,0 +1,18 @@
+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'
+
+--- i/libphobos/libdruntime/core/sys/posix/config.d
++++ w/libphobos/libdruntime/core/sys/posix/config.d
+@@ -88,7 +88,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/14.2.0/musl/README.history b/14.2.0/musl/README.history
index a93d89b..ab201a5 100644
--- a/14.2.0/musl/README.history
+++ b/14.2.0/musl/README.history
@@ -1,3 +1,7 @@
+3       3 Jul 2025
+
+        + 50_all_libdruntime_mmap_definition.patch
+
 2      ?? ??? 2024
 
        - 50_all_cpu_indicator.patch

Reply via email to