Re: [PATCH] Cygwin: Adapt math functions to use 64bit long double on aarch64
Jon Turney <[email protected]> Sat, 30 May 2026 15:48:37 +0100
| Newsgroups | gmane.os.cygwin.patches |
|---|---|
| Message-ID | <[email protected]> |
On 29/04/2026 12:33, Chandru Kumaresan wrote: > Hi Corinna, > The previously mentioned changes are not the only ones required. A few additional files also need to be modified to ensure that Cygwin works correctly on aarch64. > The approach taken is consistent with mingw-w64. mingw-w64 uses the __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__ macro to implement aarch64-specific code for math functions. > For reference, a similar approach is used in this upstream mingw-w64 commit: > https://github.com/mingw-w64/mingw-w64/commit/dbb60ad07c2983027cd09f0f7221505400391caa > [...] > diff --git a/winsup/cygwin/math/remainderl.S b/winsup/cygwin/math/remainderl.S > index a69e38296..f05724e94 100644 > --- a/winsup/cygwin/math/remainderl.S > +++ b/winsup/cygwin/math/remainderl.S > @@ -7,15 +7,15 @@ > > .file "remainderl.S" > .text > -#ifdef __x86_64__ > +#if defined(__x86_64__) > .align 8 > -#else > +#elif defined(__i386__) > .align 4 > #endif > .globl __MINGW_USYMBOL(remainderl) > .def __MINGW_USYMBOL(remainderl); .scl 2; .type 32; .endef > __MINGW_USYMBOL(remainderl): > -#ifdef __x86_64__ > +#if defined(__x86_64__) > fldt (%r8) > fldt (%rdx) > 1: fprem1 > @@ -27,7 +27,7 @@ __MINGW_USYMBOL(remainderl): > movq $0,8(%rcx) > fstpt (%rcx) > ret > -#else > +#elif defined(__i386__) > fldt 16(%esp) > fldt 4(%esp) > 1: fprem1 > @@ -36,4 +36,9 @@ __MINGW_USYMBOL(remainderl): > jp 1b > fstp %st(1) > ret > +#elif _defined(__aarch64__) Now I have a (minimal) ability to compile this, I've noticed that there seems to be typo here. I'm assuming the attached trivial patch is what's needed. > + bl remainder > + ret > +#else > + .error "Not supported on your platform yet" > #endif
0001-Cygwin-Fix-typo-in-aarch64-preprocessor-conditional-.patch
(text/plain, 1.1 KB)
From 3156c3c350eb0e9e1a1b65e86414f94ba1b4b7e4 Mon Sep 17 00:00:00 2001 From: Jon Turney <[email protected]> Date: Thu, 28 May 2026 22:17:29 +0100 Subject: [PATCH] Cygwin: Fix typo in aarch64 preprocessor conditional in remainderl.S MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a typo in the aarch64 preprocessor conditional used in remainderl.S. > ../../../../src/winsup/cygwin/math/remainderl.S:39:15: error: missing binary operator before token ‘(’ > 39 | #elif _defined(__aarch64__) > | ^ Fixes: a1f347c0d5b8 ("Cygwin: Adapt math functions to use 64bit long double on aarch64") --- winsup/cygwin/math/remainderl.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/math/remainderl.S b/winsup/cygwin/math/remainderl.S index f05724e94..9b079eca3 100644 --- a/winsup/cygwin/math/remainderl.S +++ b/winsup/cygwin/math/remainderl.S @@ -36,7 +36,7 @@ __MINGW_USYMBOL(remainderl): jp 1b fstp %st(1) ret -#elif _defined(__aarch64__) +#elif defined(__aarch64__) bl remainder ret #else -- 2.51.0