[PATCH] newlib: Disable ld128 math library build for aarch64 windows

Thirumalai Nagalingam thirumalai.nagalingam@multicorewareinc.com
Tue Feb 24 08:56:05 GMT 2026


Hello,
On AArch64 Windows targets (Cygwin and MinGW), long double has the same
representation & precision as double. The _fpmath.h header and the
ld128 libm implementation assume extended precision long double
semantics, which is not valid for these targets.

This patch detects AArch64 Windows targets and disables HAVE_FPMATH_H
accordingly, preventing inclusion of incompatible ld128 math routines.
This fixes build & ABI issues in libm for Cygwin AArch64.

Patch is attached & In-lined for reference.

Thanks & regards,
Thirumalai N
In-lined patch:
---
 newlib/configure         |  8 ++++++++
 newlib/libc/acinclude.m4 | 11 ++++++++++-
 newlib/libm/Makefile.inc |  2 ++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/newlib/configure b/newlib/configure
index ab31510aa..2211598ef 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -6186,6 +6186,14 @@ else
 fi


+ case $host in
+  aarch64-*-mingw* | aarch64-*-cygwin*)
+    IS_AARCH64_WINDOWS=yes ;;
+  *)
+    IS_AARCH64_WINDOWS=no ;;
+esac
+
+
  if test -r "${srcdir}/libc/machine/${machine_dir}/machine/_fpmath.h"; then
   HAVE_FPMATH_H_TRUE=
   HAVE_FPMATH_H_FALSE='#'
diff --git a/newlib/libc/acinclude.m4 b/newlib/libc/acinclude.m4
index 52a6c57cf..a1040386b 100644
--- a/newlib/libc/acinclude.m4
+++ b/newlib/libc/acinclude.m4
@@ -63,7 +63,16 @@ m4_foreach_w([MACHINE], [
   z8k
 ], [AM_CONDITIONAL([HAVE_LIBC_MACHINE_]m4_toupper(MACHINE), test "${machine_dir}" = MACHINE)])

-AM_CONDITIONAL(HAVE_FPMATH_H, test -r "${srcdir}/libc/machine/${machine_dir}/machine/_fpmath.h")
+case $host in
+  aarch64-*-cygwin* | aarch64-*-mingw*)
+    IS_AARCH64_WINDOWS=yes ;;
+  *)
+    IS_AARCH64_WINDOWS=no ;;
+esac
+
+AM_CONDITIONAL([HAVE_FPMATH_H],
+  [test -r "${srcdir}/libc/machine/${machine_dir}/machine/_fpmath.h" &&
+   test "$IS_AARCH64_WINDOWS" = no])


 AM_CONDITIONAL(MACH_ADD_SETJMP, test "x$mach_add_setjmp" = "xtrue")
diff --git a/newlib/libm/Makefile.inc b/newlib/libm/Makefile.inc
index bf31b1be7..a0147f0a2 100644
--- a/newlib/libm/Makefile.inc
+++ b/newlib/libm/Makefile.inc
@@ -55,8 +55,10 @@ include %D%/test/Makefile.inc

 if HAVE_LIBM_MACHINE_AARCH64
 include %D%/machine/aarch64/Makefile.inc
+if HAVE_FPMATH_H
 include %D%/ld128/Makefile.inc
 endif
+endif
 if HAVE_LIBM_MACHINE_AMDGCN
 include %D%/machine/amdgcn/Makefile.inc
 endif
--

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/newlib/attachments/20260224/e9478e4c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newlib-Disable-ld128-math-library-build-for-aarch64-.patch
Type: application/octet-stream
Size: 2594 bytes
Desc: newlib-Disable-ld128-math-library-build-for-aarch64-.patch
URL: <https://sourceware.org/pipermail/newlib/attachments/20260224/e9478e4c/attachment-0001.obj>


More information about the Newlib mailing list