commit:     dea52c14ebf93f3c926431d3358e431903d0a9de
Author:     Andrei Horodniceanu <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Thu Jul  3 19:28:55 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=dea52c14

11.5.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>

 11.5.0/musl/50_all_libdruntime_mmap_definition.patch | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/11.5.0/musl/50_all_libdruntime_mmap_definition.patch 
b/11.5.0/musl/50_all_libdruntime_mmap_definition.patch
new file mode 100644
index 0000000..dedbbe4
--- /dev/null
+++ b/11.5.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 causing the generation of an 
invalid libdruntime and libphobos. Trying to use the standard library would 
lead to errors like:
+
+/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;

Reply via email to