diff options
author | Radek Bartoň <radek.barton@microsoft.com> | 2025-07-03 12:02:03 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2025-07-21 12:00:01 +0200 |
commit | e29e1cf75e9209bef7394402f817a050e101281d (patch) | |
tree | 6f394f3c0d80911ee6a1b35122c3b9b5c086e82c | |
parent | a0634931f181e9b46818f6fda15d6c28583dccbb (diff) | |
download | newlib-e29e1cf75e9209bef7394402f817a050e101281d.zip newlib-e29e1cf75e9209bef7394402f817a050e101281d.tar.gz newlib-e29e1cf75e9209bef7394402f817a050e101281d.tar.bz2 |
newlib: add dummy implementations of fe{get,set}prec for Aarch64 Cygwin
This patch introduces dummy implementation of fegetprec and fsetprec for Cygwin
build as those symbols are being exported by cygwin1.dll and AArch64 do not support
changing floating point precision at runtime.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
-rw-r--r-- | newlib/Makefile.in | 40 | ||||
-rw-r--r-- | newlib/libc/machine/aarch64/sys/fenv.h | 15 | ||||
-rw-r--r-- | newlib/libm/machine/aarch64/Makefile.inc | 2 | ||||
-rw-r--r-- | newlib/libm/machine/aarch64/fegetprec.c | 17 | ||||
-rw-r--r-- | newlib/libm/machine/aarch64/fesetprec.c | 22 |
5 files changed, 96 insertions, 0 deletions
diff --git a/newlib/Makefile.in b/newlib/Makefile.in index f98c806..c5492c6 100644 --- a/newlib/Makefile.in +++ b/newlib/Makefile.in @@ -3251,11 +3251,13 @@ am__objects_159 = libm/fenv/libm_a-feclearexcept.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-feclearexcept.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-fegetenv.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-fegetexceptflag.$(OBJEXT) \ +@HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-fegetprec.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-fegetround.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-feholdexcept.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-feraiseexcept.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-fesetenv.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-fesetexceptflag.$(OBJEXT) \ +@HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-fesetprec.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-fesetround.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-fetestexcept.$(OBJEXT) \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/libm_a-feupdateenv.$(OBJEXT) @@ -5086,11 +5088,13 @@ libm_test_test_LDADD = $(CRT0) libm.a libc.a @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/feclearexcept.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/fegetenv.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/fegetexceptflag.c \ +@HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/fegetprec.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/fegetround.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/feholdexcept.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/feraiseexcept.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/fesetenv.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/fesetexceptflag.c \ +@HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/fesetprec.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/fesetround.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/fetestexcept.c \ @HAVE_LIBM_MACHINE_AARCH64_TRUE@ libm/machine/aarch64/feupdateenv.c @@ -11081,6 +11085,9 @@ libm/machine/aarch64/libm_a-fegetenv.$(OBJEXT): \ libm/machine/aarch64/libm_a-fegetexceptflag.$(OBJEXT): \ libm/machine/aarch64/$(am__dirstamp) \ libm/machine/aarch64/$(DEPDIR)/$(am__dirstamp) +libm/machine/aarch64/libm_a-fegetprec.$(OBJEXT): \ + libm/machine/aarch64/$(am__dirstamp) \ + libm/machine/aarch64/$(DEPDIR)/$(am__dirstamp) libm/machine/aarch64/libm_a-fegetround.$(OBJEXT): \ libm/machine/aarch64/$(am__dirstamp) \ libm/machine/aarch64/$(DEPDIR)/$(am__dirstamp) @@ -11096,6 +11103,9 @@ libm/machine/aarch64/libm_a-fesetenv.$(OBJEXT): \ libm/machine/aarch64/libm_a-fesetexceptflag.$(OBJEXT): \ libm/machine/aarch64/$(am__dirstamp) \ libm/machine/aarch64/$(DEPDIR)/$(am__dirstamp) +libm/machine/aarch64/libm_a-fesetprec.$(OBJEXT): \ + libm/machine/aarch64/$(am__dirstamp) \ + libm/machine/aarch64/$(DEPDIR)/$(am__dirstamp) libm/machine/aarch64/libm_a-fesetround.$(OBJEXT): \ libm/machine/aarch64/$(am__dirstamp) \ libm/machine/aarch64/$(DEPDIR)/$(am__dirstamp) @@ -14544,12 +14554,14 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-feclearexcept.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fegetenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fegetexceptflag.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fegetprec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fegetround.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-feholdexcept.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-feraiseexcept.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fesetenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fesetexceptflag.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fesetprec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fesetround.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-fetestexcept.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libm/machine/aarch64/$(DEPDIR)/libm_a-feupdateenv.Po@am__quote@ @@ -44362,6 +44374,20 @@ libm/machine/aarch64/libm_a-fegetexceptflag.obj: libm/machine/aarch64/fegetexcep @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/machine/aarch64/libm_a-fegetexceptflag.obj `if test -f 'libm/machine/aarch64/fegetexceptflag.c'; then $(CYGPATH_W) 'libm/machine/aarch64/fegetexceptflag.c'; else $(CYGPATH_W) '$(srcdir)/libm/machine/aarch64/fegetexceptflag.c'; fi` +libm/machine/aarch64/libm_a-fegetprec.o: libm/machine/aarch64/fegetprec.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/aarch64/libm_a-fegetprec.o -MD -MP -MF libm/machine/aarch64/$(DEPDIR)/libm_a-fegetprec.Tpo -c -o libm/machine/aarch64/libm_a-fegetprec.o `test -f 'libm/machine/aarch64/fegetprec.c' || echo '$(srcdir)/'`libm/machine/aarch64/fegetprec.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libm/machine/aarch64/$(DEPDIR)/libm_a-fegetprec.Tpo libm/machine/aarch64/$(DEPDIR)/libm_a-fegetprec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libm/machine/aarch64/fegetprec.c' object='libm/machine/aarch64/libm_a-fegetprec.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/machine/aarch64/libm_a-fegetprec.o `test -f 'libm/machine/aarch64/fegetprec.c' || echo '$(srcdir)/'`libm/machine/aarch64/fegetprec.c + +libm/machine/aarch64/libm_a-fegetprec.obj: libm/machine/aarch64/fegetprec.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/aarch64/libm_a-fegetprec.obj -MD -MP -MF libm/machine/aarch64/$(DEPDIR)/libm_a-fegetprec.Tpo -c -o libm/machine/aarch64/libm_a-fegetprec.obj `if test -f 'libm/machine/aarch64/fegetprec.c'; then $(CYGPATH_W) 'libm/machine/aarch64/fegetprec.c'; else $(CYGPATH_W) '$(srcdir)/libm/machine/aarch64/fegetprec.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libm/machine/aarch64/$(DEPDIR)/libm_a-fegetprec.Tpo libm/machine/aarch64/$(DEPDIR)/libm_a-fegetprec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libm/machine/aarch64/fegetprec.c' object='libm/machine/aarch64/libm_a-fegetprec.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/machine/aarch64/libm_a-fegetprec.obj `if test -f 'libm/machine/aarch64/fegetprec.c'; then $(CYGPATH_W) 'libm/machine/aarch64/fegetprec.c'; else $(CYGPATH_W) '$(srcdir)/libm/machine/aarch64/fegetprec.c'; fi` + libm/machine/aarch64/libm_a-fegetround.o: libm/machine/aarch64/fegetround.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/aarch64/libm_a-fegetround.o -MD -MP -MF libm/machine/aarch64/$(DEPDIR)/libm_a-fegetround.Tpo -c -o libm/machine/aarch64/libm_a-fegetround.o `test -f 'libm/machine/aarch64/fegetround.c' || echo '$(srcdir)/'`libm/machine/aarch64/fegetround.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libm/machine/aarch64/$(DEPDIR)/libm_a-fegetround.Tpo libm/machine/aarch64/$(DEPDIR)/libm_a-fegetround.Po @@ -44432,6 +44458,20 @@ libm/machine/aarch64/libm_a-fesetexceptflag.obj: libm/machine/aarch64/fesetexcep @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/machine/aarch64/libm_a-fesetexceptflag.obj `if test -f 'libm/machine/aarch64/fesetexceptflag.c'; then $(CYGPATH_W) 'libm/machine/aarch64/fesetexceptflag.c'; else $(CYGPATH_W) '$(srcdir)/libm/machine/aarch64/fesetexceptflag.c'; fi` +libm/machine/aarch64/libm_a-fesetprec.o: libm/machine/aarch64/fesetprec.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/aarch64/libm_a-fesetprec.o -MD -MP -MF libm/machine/aarch64/$(DEPDIR)/libm_a-fesetprec.Tpo -c -o libm/machine/aarch64/libm_a-fesetprec.o `test -f 'libm/machine/aarch64/fesetprec.c' || echo '$(srcdir)/'`libm/machine/aarch64/fesetprec.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libm/machine/aarch64/$(DEPDIR)/libm_a-fesetprec.Tpo libm/machine/aarch64/$(DEPDIR)/libm_a-fesetprec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libm/machine/aarch64/fesetprec.c' object='libm/machine/aarch64/libm_a-fesetprec.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/machine/aarch64/libm_a-fesetprec.o `test -f 'libm/machine/aarch64/fesetprec.c' || echo '$(srcdir)/'`libm/machine/aarch64/fesetprec.c + +libm/machine/aarch64/libm_a-fesetprec.obj: libm/machine/aarch64/fesetprec.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/aarch64/libm_a-fesetprec.obj -MD -MP -MF libm/machine/aarch64/$(DEPDIR)/libm_a-fesetprec.Tpo -c -o libm/machine/aarch64/libm_a-fesetprec.obj `if test -f 'libm/machine/aarch64/fesetprec.c'; then $(CYGPATH_W) 'libm/machine/aarch64/fesetprec.c'; else $(CYGPATH_W) '$(srcdir)/libm/machine/aarch64/fesetprec.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libm/machine/aarch64/$(DEPDIR)/libm_a-fesetprec.Tpo libm/machine/aarch64/$(DEPDIR)/libm_a-fesetprec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libm/machine/aarch64/fesetprec.c' object='libm/machine/aarch64/libm_a-fesetprec.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/machine/aarch64/libm_a-fesetprec.obj `if test -f 'libm/machine/aarch64/fesetprec.c'; then $(CYGPATH_W) 'libm/machine/aarch64/fesetprec.c'; else $(CYGPATH_W) '$(srcdir)/libm/machine/aarch64/fesetprec.c'; fi` + libm/machine/aarch64/libm_a-fesetround.o: libm/machine/aarch64/fesetround.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/aarch64/libm_a-fesetround.o -MD -MP -MF libm/machine/aarch64/$(DEPDIR)/libm_a-fesetround.Tpo -c -o libm/machine/aarch64/libm_a-fesetround.o `test -f 'libm/machine/aarch64/fesetround.c' || echo '$(srcdir)/'`libm/machine/aarch64/fesetround.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libm/machine/aarch64/$(DEPDIR)/libm_a-fesetround.Tpo libm/machine/aarch64/$(DEPDIR)/libm_a-fesetround.Po diff --git a/newlib/libc/machine/aarch64/sys/fenv.h b/newlib/libc/machine/aarch64/sys/fenv.h index 1f97791..369cc48 100644 --- a/newlib/libc/machine/aarch64/sys/fenv.h +++ b/newlib/libc/machine/aarch64/sys/fenv.h @@ -123,6 +123,21 @@ fegetexcept(void) #endif /* __BSD_VISIBLE */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __CYGWIN__ + +#if __MISC_VISIBLE +int fegetprec (void); +int fesetprec (int __prec); +#endif + +#endif /* __CYGWIN__ */ +#ifdef __cplusplus +} +#endif #endif /* !_FENV_H_ */ diff --git a/newlib/libm/machine/aarch64/Makefile.inc b/newlib/libm/machine/aarch64/Makefile.inc index 478aaee..0064363 100644 --- a/newlib/libm/machine/aarch64/Makefile.inc +++ b/newlib/libm/machine/aarch64/Makefile.inc @@ -33,11 +33,13 @@ %D%/feclearexcept.c \ %D%/fegetenv.c \ %D%/fegetexceptflag.c \ + %D%/fegetprec.c \ %D%/fegetround.c \ %D%/feholdexcept.c \ %D%/feraiseexcept.c \ %D%/fesetenv.c \ %D%/fesetexceptflag.c \ + %D%/fesetprec.c \ %D%/fesetround.c \ %D%/fetestexcept.c \ %D%/feupdateenv.c diff --git a/newlib/libm/machine/aarch64/fegetprec.c b/newlib/libm/machine/aarch64/fegetprec.c new file mode 100644 index 0000000..82e08fb --- /dev/null +++ b/newlib/libm/machine/aarch64/fegetprec.c @@ -0,0 +1,17 @@ +#if defined(__CYGWIN__) + +/* Returns the currently selected precision, represented by one of the + values of the defined precision macros. */ +int +fegetprec (void) +{ + /* AArch64 doesn't have configurable precision. + Return a fixed value indicating double precision (most common). */ + return -1; +} + +#else + +#include "../../fenv/fenv_stub.c" + +#endif diff --git a/newlib/libm/machine/aarch64/fesetprec.c b/newlib/libm/machine/aarch64/fesetprec.c new file mode 100644 index 0000000..dd50700 --- /dev/null +++ b/newlib/libm/machine/aarch64/fesetprec.c @@ -0,0 +1,22 @@ +#if defined(__CYGWIN__) + +/* http://www.open-std.org/jtc1/sc22//WG14/www/docs/n752.htm: + + The fesetprec function establishes the precision represented by its + argument prec. If the argument does not match a precision macro, the + precision is not changed. + + The fesetprec function returns a nonzero value if and only if the + argument matches a precision macro (that is, if and only if the requested + precision can be established). */ +int +fesetprec (int prec) +{ + /* Aarch64 doesn't support changing precision at runtime. */ + return 0; // return failure +} +#else + +#include "../../fenv/fenv_stub.c" + +#endif |