Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue, 24 Feb 2026 14:16:25 +0530

Backported for glibc 2.42.

This fixes the "undefined reference to `__trunc'` / `__truncf'`" error
on x86 when building glibc 2.42.

Upstream commit reference:
https://github.com/bminor/glibc/commit/422c3a5baf3cbe5d212c240bce99dbafed55d4ef


---
 sysdeps/ieee754/dbl-64/s_modf.c  | 4 +++-
 sysdeps/ieee754/flt-32/s_modff.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sysdeps/ieee754/dbl-64/s_modf.c b/sysdeps/ieee754/dbl-64/s_modf.c
index 90cd8e8c..0a128419 100644
--- a/sysdeps/ieee754/dbl-64/s_modf.c
+++ b/sysdeps/ieee754/dbl-64/s_modf.c
@@ -19,13 +19,15 @@
 #include <math.h>
 #include <libm-alias-double.h>
 #include "math_config.h"
-#include <math-use-builtins-trunc.h>
 
 double
 __modf (double x, double *iptr)
 {
   uint64_t t = asuint64 (x);
 #if USE_TRUNC_BUILTIN
+# ifndef TRUNC
+#  define TRUNC trunc
+# endif
   if (is_inf (t))
     {
       *iptr = x;
diff --git a/sysdeps/ieee754/flt-32/s_modff.c b/sysdeps/ieee754/flt-32/s_modff.c
index 965136ba..48e53cbc 100644
--- a/sysdeps/ieee754/flt-32/s_modff.c
+++ b/sysdeps/ieee754/flt-32/s_modff.c
@@ -19,13 +19,15 @@
 #include <math.h>
 #include <libm-alias-float.h>
 #include "math_config.h"
-#include <math-use-builtins-trunc.h>
 
 float
 __modff (float x, float *iptr)
 {
   uint32_t t = asuint (x);
 #if USE_TRUNCF_BUILTIN
+# ifndef TRUNCF
+#  define TRUNCF truncf
+# endif
   if (is_inf (t))
     {
       *iptr = x;
-- 
2.34.1

