From 2c51202a2a803853cf9844c6169087628d098955 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 22 Aug 2024 13:56:21 +0200 Subject: gnu: make-bootstrap: Ensure libm.a provides ‘fmod’ on i686. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . * gnu/packages/make-bootstrap.scm (glibc-for-bootstrap)[arguments]: Add ‘apply-libm-patch’ on i686. * gnu/packages/patches/glibc-2.39-fmod-libm-a.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Reported-by: Ricardo Wurmus Change-Id: Iaffba0a9f424d8d80a8a5611df2d285d7d632d99 --- gnu/local.mk | 1 + gnu/packages/make-bootstrap.scm | 13 ++- gnu/packages/patches/glibc-2.39-fmod-libm-a.patch | 98 +++++++++++++++++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/glibc-2.39-fmod-libm-a.patch (limited to 'gnu') diff --git a/gnu/local.mk b/gnu/local.mk index 4998db682c..0c4ab96bf3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1394,6 +1394,7 @@ dist_patch_DATA = \ %D%/packages/patches/glib-skip-failing-test.patch \ %D%/packages/patches/glibc-2.33-riscv64-miscompilation.patch \ %D%/packages/patches/glibc-2.39-git-updates.patch \ + %D%/packages/patches/glibc-2.39-fmod-libm-a.patch \ %D%/packages/patches/glibc-CVE-2019-7309.patch \ %D%/packages/patches/glibc-CVE-2019-9169.patch \ %D%/packages/patches/glibc-CVE-2019-19126.patch \ diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 679aa46d60..91796efd0f 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -85,7 +85,18 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ;; and can use statically-linked NSS modules. `(cons* "--disable-nscd" "--disable-build-nscd" "--enable-static-nss" - ,flags)))) + ,flags)) + ((#:phases phases #~%standard-phases) + ;; Apply i686-linux-specific patch. + (if (target-x86-32?) + #~(modify-phases #$phases + (add-after 'unpack 'apply-libm-patch + (lambda _ + (define patch + #$(local-file + (search-patch "glibc-2.39-fmod-libm-a.patch"))) + (invoke "patch" "--force" "-p1" "-i" patch)))) + phases)))) ;; Remove the 'debug' output to allow bit-reproducible builds (when the ;; 'debug' output is used, ELF files end up with a .gnu_debuglink, which diff --git a/gnu/packages/patches/glibc-2.39-fmod-libm-a.patch b/gnu/packages/patches/glibc-2.39-fmod-libm-a.patch new file mode 100644 index 0000000000..91b1871bee --- /dev/null +++ b/gnu/packages/patches/glibc-2.39-fmod-libm-a.patch @@ -0,0 +1,98 @@ +Fixes lack of 'fmod' in libm.a on i686-linux: + + https://sourceware.org/bugzilla/show_bug.cgi?id=31488 + https://issues.guix.gnu.org/72725 + +commit 0b716305dfb48c2d13ed4f7d06c082b90c1d226f +Author: Adhemerval Zanella +Date: Thu Mar 14 14:59:35 2024 -0300 + + math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) + +diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c +index 5ac9995ffd..528bfc2a13 100644 +--- a/sysdeps/i386/fpu/w_fmod_compat.c ++++ b/sysdeps/i386/fpu/w_fmod_compat.c +@@ -7,8 +7,9 @@ + # define LIBM_SVID_COMPAT 1 + # undef compat_symbol + # define compat_symbol(a, b, c, d) +-#endif +-#include +-#ifdef SHARED ++# include + libm_alias_double (__fmod_compat, fmod) ++#else ++#include ++#include + #endif +diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c +index cc417e07d3..5a61693e51 100644 +--- a/sysdeps/i386/fpu/w_fmodf_compat.c ++++ b/sysdeps/i386/fpu/w_fmodf_compat.c +@@ -7,8 +7,9 @@ + # define LIBM_SVID_COMPAT 1 + # undef compat_symbol + # define compat_symbol(a, b, c, d) +-#endif +-#include +-#ifdef SHARED ++# include + libm_alias_float (__fmod_compat, fmod) ++#else ++#include ++#include + #endif +diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c +index 1afbe7d8ad..932cc4341c 100644 +--- a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c ++++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c +@@ -17,13 +17,13 @@ + License along with the GNU C Library; if not, see + . */ + +-#if IS_IN (libc) ++#if IS_IN (libc) && defined SHARED + # define declare_mgen_alias(f,t) + #endif + #include + #include + +-#if IS_IN (libc) ++#if IS_IN (libc) && defined SHARED + long_double_symbol (libc, __ldexpl, ldexpl); + long_double_symbol (libc, __wrap_scalbnl, scalbnl); + #endif +diff --git a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c +index 527d4fbed2..57f38091e6 100644 +--- a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c ++++ b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c +@@ -7,8 +7,9 @@ + # define LIBM_SVID_COMPAT 1 + # undef compat_symbol + # define compat_symbol(a, b, c, d) +-#endif + #include +-#ifdef SHARED + libm_alias_double (__fmod_compat, fmod) ++#else ++#include ++#include + #endif +diff --git a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c +index 5043586b91..88db07f443 100644 +--- a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c ++++ b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c +@@ -7,8 +7,9 @@ + # define LIBM_SVID_COMPAT 1 + # undef compat_symbol + # define compat_symbol(a, b, c, d) +-#endif +-#include +-#ifdef SHARED ++# include + libm_alias_float (__fmod_compat, fmod) ++#else ++#include ++#include + #endif -- cgit v1.2.3