On Tuesday 20 October 2026 17:27:31 Peter0x44 wrote:
> On 2026-10-20 12:40, Pali Rohár wrote:
> > +#if defined(__i386__)
> > +  /* msvcrt _fpreset() on i386 changes the x87 precision to 53-bit,
> > +   * so no change is needed */
> > +#elif defined(__x86_64__)
> 
> This breaks the arm64ec build. arm64ec defines __x86_64__, and CRT_fp8.o
> is built for arm64ec too (it's in the libarm64 object list), so the x87
> asm ends up being compiled as ARM64 code:
> 
>   CRT_fp8.c:23:5: error: unrecognized instruction mnemonic

Ou, that is bad. Because _fpreset function is automatically generated
and provided by dlltool for all arm platforms when processing every CRT
DLL library's def file. For i386 and amd64 platforms the _fpreset symbol
has DATA keyword which omits generating of the function.

> Using the same check as fesetenv.c and mingw_setfp.c fixes it:
> 
>   #elif defined(__x86_64__) && !defined(__arm64ec__)

Instead we should fix the Makefile.am build system to avoid compiling
CRT_fp8.c and CRT_fp10.c files on all arm systems.

> > +  /* msvcrt _fpreset() on x86-64 does not touch the x87 FPU unit all,
> 
> Typo: "at all".

I see.

> Otherwise it does the right thing on x86_64. I tested it with the
> t_fesetenv tests and FE_DFL_ENV gives 0x027f.

Ok, thanks for testing. I did only direct tests not via C99 functions.


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to