diff --git a/newlib/libc/include/fenv.h b/newlib/libc/include/fenv.h new file mode 100644 index 000000000..4795cc925 --- /dev/null +++ b/newlib/libc/include/fenv.h @@ -0,0 +1,42 @@ +/* Copyright (c) 2017 SiFive Inc. All rights reserved. + + This copyrighted material is made available to anyone wishing to use, + modify, copy, or redistribute it subject to the terms and conditions + of the FreeBSD License. This program is distributed in the hope that + it will be useful, but WITHOUT ANY WARRANTY expressed or implied, + including the implied warranties of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. A copy of this license is available at + http://www.opensource.org/licenses. +*/ + +#ifndef _FENV_H +#define _FENV_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exception */ +int feclearexcept(int excepts); +int fegetexceptflag(fexcept_t *flagp, int excepts); +int feraiseexcept(int excepts); +int fesetexceptflag(const fexcept_t *flagp, int excepts); +int fetestexcept(int excepts); + +/* Rounding mode */ +int fegetround(void); +int fesetround(int rounding_mode); + +/* Float environment */ +int fegetenv(fenv_t *envp); +int feholdexcept(fenv_t *envp); +int fesetenv(const fenv_t *envp); +int feupdateenv(const fenv_t *envp); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/newlib/libc/include/sys/fenv.h b/newlib/libc/include/sys/fenv.h new file mode 100644 index 000000000..e0983fa2c --- /dev/null +++ b/newlib/libc/include/sys/fenv.h @@ -0,0 +1,113 @@ +/* + (c) Copyright 2019 Joel Sherrill + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _SYS_FENV_H_ +#define _SYS_FENV_H_ + +/******************************************************************************* + * THIS FILE IS A TEMPLATE, INTENDED TO BE USED AS A STARTING POINT FOR + * TARGET-SPECIFIC FLOATING-POINT IMPLEMENTATIONS. NOTES BELOW HIGHLIGHT THE + * BASICS OF WHAT NEEDS TO BE DEFINED. THE DEFAULT IMPLEMTATION IS + * DEGENERATE, WITH ALL FUNCTIONS RETURNING ERROR AND NO EXCEPTIONS AND NO + * ROUNDING MODES DEFINED (SINCE NONE ARE SUPPORTED). + * THE MACRO VALUES ARE EXAMPLES ONLY, ALTHOUGH TAKEN FROM A WORKING + * IMPLEMENTATION. + * REMOVE THIS NOTICE WHEN COPYING TO A REAL IMPLEMENTATION, REPLACING IT WITH + * ANY TARGET-SPECIFIC NOTES OF INTEREST. THE FENV FUNCTION MAN PAGES POINT TO + * THIS FILE AS A MEANS OF DETERMINING A FUNCTIONAL VS. NON-FUNCTIONAL + * IMPLEMENTATION. + ******************************************************************************/ +/* + * The following macros are to be defined if the respective exception is + * supported by the implementation, each with a unique bit mask: + * + * FE_DIVBYZERO + * FE_INEXACT + * FE_INVALID + * FE_OVERFLOW + * FE_UNDERFLOW + * + * Other implementation-specific exceptions may be defined, and must start + * with FE_ followed by a capital letter. + * + * FE_ALL_EXCEPT must be defined as the logical OR of all exceptions. + */ +//#define FE_DIVBYZERO 0x00000001 +//#define FE_INEXACT 0x00000002 +//#define FE_INVALID 0x00000004 +//#define FE_OVERFLOW 0x00000008 +//#define FE_UNDERFLOW 0x00000010 + +//#define FE_ALL_EXCEPT \ + //(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW) +#define FE_ALL_EXCEPT 0 /* NONE SUPPORTED IN PLACEHOLDER TEMPLATE */ + +/* + * The following macros are to be defined if the respective rounding + * direction is supported by the implementation via the fegetround() and + * fesetround() functions, each with a unique positive value. + * + * FE_DOWNWARD + * FE_TONEAREST + * FE_TOWARDZERO + * FE_UPWARD + * + * Other implementation-specific rounding modes may be defined, and must start + * with FE_ followed by a capital letter. + */ +//#define FE_DOWNWARD 1 +//#define FE_TONEAREST 2 +//#define FE_TOWARDZERO 3 +//#define FE_UPWARD 4 + +/* + * The following typedefs are required. These should be defined properly + * to support the architecture specific implementation. See the C and + * POSIX standards for details: + * + * fenv_t + * fexcept_t + */ +typedef int fenv_t; +typedef int fexcept_t; + +/* + * Lastly, a FE_DFL_ENV macro must be defined, representing a pointer + * to const fenv_t that contains the value of the default floating point + * environment. + * + * NOTE: The extern'ed variable fe_default_env_p is an implementation + * detail of this stub. FE_DFL_ENV must point to an instance of + * fenv_t with the default fenv_t. The format of fenv_t and where + * FE_DFL_ENV is are implementation specific. + */ +extern const fenv_t *_fe_dfl_env; +#define FE_DFL_ENV _fe_dfl_env + +#endif /* _SYS_FENV_H_ */ diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am index 8bc2c2cfe..05afcbffc 100644 --- a/newlib/libm/Makefile.am +++ b/newlib/libm/Makefile.am @@ -8,17 +8,17 @@ else MATHDIR = math endif -SUBDIRS = $(MATHDIR) common complex machine +SUBDIRS = $(MATHDIR) common complex fenv machine libm_la_LDFLAGS = -Xcompiler -nostdlib if USE_LIBTOOL -SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext) $(LIBM_MACHINE_LIB) +SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext) fenv/libfenv.$(aext) $(LIBM_MACHINE_LIB) noinst_LTLIBRARIES = libm.la libm_la_SOURCES = libm_la_LIBADD = $(SUBLIBS) else -SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) $(LIBM_MACHINE_LIB) +SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) fenv/lib.$(aext) $(LIBM_MACHINE_LIB) noinst_LIBRARIES = libm.a libm.a: $(SUBLIBS) rm -f $@ @@ -39,7 +39,7 @@ info_TEXINFOS = libm.texinfo libm_TEXINFOS = targetdep.tex -libm.dvi: targetdep.tex math/stmp-def complex/stmp-def +libm.dvi: targetdep.tex math/stmp-def complex/stmp-def fenv/stmp-def stmp-targetdep: force rm -f tmp.texi @@ -58,6 +58,8 @@ math/stmp-def: stmp-targetdep ; @true complex/stmp-def: stmp-targetdep ; @true +fenv/stmp-def: stmp-targetdep ; @true + docbook-recursive: force for d in $(SUBDIRS); do \ if test "$$d" != "."; then \ diff --git a/newlib/libm/configure.in b/newlib/libm/configure.in index 9bd107c59..aec22bd4e 100644 --- a/newlib/libm/configure.in +++ b/newlib/libm/configure.in @@ -62,5 +62,5 @@ fi AC_SUBST(LIBM_MACHINE_LIB) -AC_CONFIG_FILES([Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile]) +AC_CONFIG_FILES([Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile fenv/Makefile]) AC_OUTPUT diff --git a/newlib/libm/fenv/Makefile.am b/newlib/libm/fenv/Makefile.am new file mode 100644 index 000000000..fef5c3609 --- /dev/null +++ b/newlib/libm/fenv/Makefile.am @@ -0,0 +1,36 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +src = feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \ + fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \ + fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c + +libcommon_la_LDFLAGS = -Xcompiler -nostdlib +lib_a_CFLAGS = -fbuiltin -fno-math-errno + +if USE_LIBTOOL +noinst_LTLIBRARIES = libcommon.la +libcommon_la_SOURCES = $(src) +noinst_DATA = objectlist.awk.in +else +noinst_LIBRARIES = lib.a +lib_a_SOURCES = $(src) +lib_a_CFLAGS += $(AM_CFLAGS) +noinst_DATA = +endif # USE_LIBTOOL + +include $(srcdir)/../../Makefile.shared + +CHEWOUT_FILES = feclearexcept.def fe_dfl_env.def fegetenv.def \ + fegetexceptflag.def fegetround.def feholdexcept.def \ + feraiseexcept.def fesetenv.def fesetexceptflag.def fesetround.def \ + fetestexcept.def feupdateenv.def + +CHAPTERS = + +# A partial dependency list. + +$(lib_a_OBJECTS): $(srcdir)/../../libc/include/fenv.h diff --git a/newlib/libm/fenv/fe_dfl_env.c b/newlib/libm/fenv/fe_dfl_env.c new file mode 100644 index 000000000..0606327fa --- /dev/null +++ b/newlib/libm/fenv/fe_dfl_env.c @@ -0,0 +1,42 @@ +/* + (c) Copyright 2019 Joel Sherrill + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + * + * The implementation must defined FE_DFL_ENV to point to a default + * environment of type fenv_t. + */ + +/* Non-static and writable to allow initialization at startup. */ +fenv_t __fe_dfl_env = { 0 }; + +const fenv_t *_fe_dfl_env = &__fe_dfl_env; diff --git a/newlib/libm/fenv/feclearexcept.c b/newlib/libm/fenv/feclearexcept.c new file mode 100644 index 000000000..534da63d3 --- /dev/null +++ b/newlib/libm/fenv/feclearexcept.c @@ -0,0 +1,67 @@ +/* + (c) Copyright 2019 Joel Sherrill >---clear floating-point exception + +INDEX + feclearexcept +SYNOPSIS + #include + int feclearexcept(int <[except]>); + + Link with -lm. + +DESCRIPTION +This method attempts to clear the floating-point exceptions specified +in <[except]>. + +RETURNS +If the <[except]> argument is zero or all requested exceptions were +successfully cleared, this method returns zero. Otherwise, a non-zero +value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +#include +#include + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int feclearexcept(int excepts) +{ + return (excepts ? -ENOTSUP : 0); +} diff --git a/newlib/libm/fenv/fegetenv.c b/newlib/libm/fenv/fegetenv.c new file mode 100644 index 000000000..67ebb3f0d --- /dev/null +++ b/newlib/libm/fenv/fegetenv.c @@ -0,0 +1,67 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---get current floating-point environment + +INDEX + fegetenv + +SYNOPSIS + #include + int fegetenv(fenv_t *<[envp]>); + + Link with -lm. + +DESCRIPTION +This method attempts to return the floating-point environment +in the area specified by <[envp]>. + +RETURNS +If floating-point environment was successfully returned, then +this method returns zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fegetenv(fenv_t *envp) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fegetexceptflag.c b/newlib/libm/fenv/fegetexceptflag.c new file mode 100644 index 000000000..e0e20b926 --- /dev/null +++ b/newlib/libm/fenv/fegetexceptflag.c @@ -0,0 +1,68 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---get floating-point status flags + +INDEX + fegetexceptflag + +SYNOPSIS + #include + int fegetexceptflag(fexcept_t *<[flagp]>, int <[excepts]>); + + Link with -lm. + +DESCRIPTION +This method attempts to store an implementation-defined representation +of the states of the floating-point status flags specified by <[excepts]> +in the memory pointed to by <[flagp>]. + +RETURNS +If the information was successfully returned, this method returns +zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fegetexceptflag(fexcept_t *flagp, int excepts) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fegetround.c b/newlib/libm/fenv/fegetround.c new file mode 100644 index 000000000..1a7c2fd34 --- /dev/null +++ b/newlib/libm/fenv/fegetround.c @@ -0,0 +1,66 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---get current rounding direction + +INDEX + fegetround +SYNOPSIS + #include + int fegetround(void); + + Link with -lm. + +DESCRIPTION +This method returns the current rounding direction. + +RETURNS +This method returns the rounding direction, corresponding to the value +of the respective rouding macro. If the current rounding direction cannot +be determined, then a negative value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fegetround(void) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/feholdexcept.c b/newlib/libm/fenv/feholdexcept.c new file mode 100644 index 000000000..7d066a7fb --- /dev/null +++ b/newlib/libm/fenv/feholdexcept.c @@ -0,0 +1,70 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---save current floating-point environment + +INDEX + feholdexcept + +SYNOPSIS + #include + int feholdexcept(fenv_t *<[envp]>); + + Link with -lm. + +DESCRIPTION +This method attempts to save the current floating-point environment +in the fenv_t instance pointed to by <[envp]>, clear the floating +point status flags, and then, if supported by the target architecture, +install a "non-stop" (e.g. continue on floating point exceptions) mode +for all floating-point exceptions. + +RETURNS +This method will return zero if the non-stop floating-point exception +handler was installed. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int feholdexcept(fenv_t *envp) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/feraiseexcept.c b/newlib/libm/fenv/feraiseexcept.c new file mode 100644 index 000000000..c8f4b2efb --- /dev/null +++ b/newlib/libm/fenv/feraiseexcept.c @@ -0,0 +1,67 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---raise floating-point exception + +INDEX + feraiseexcept +SYNOPSIS + #include + int feraiseexcept(int <[excepts]>); + + Link with -lm. + +DESCRIPTION +This method attempts to raise the floating-point exceptions specified +in <[except]>. + +RETURNS +If the <[excepts]> argument is zero or all requested exceptions were +successfully raised, this method returns zero. Otherwise, a non-zero +value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int feraiseexcept(int excepts) +{ + return (excepts ? -ENOTSUP : 0); +} diff --git a/newlib/libm/fenv/fesetenv.c b/newlib/libm/fenv/fesetenv.c new file mode 100644 index 000000000..410abcc4f --- /dev/null +++ b/newlib/libm/fenv/fesetenv.c @@ -0,0 +1,72 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---set current floating-point environment + +INDEX + fesetenv + +SYNOPSIS + #include + int fesetenv(const fenv_t *[]); + + Link with -lm. + +DESCRIPTION +This method attempts to establish the floating-point environment +pointed to by <[envp]>. The argument [] must point to a +floating-point environment obtained via <> or <> +or a floating-point environment macro such as <>. + +It only sets the states of the flags as recorded in its argument, and +does not actually raise the associated floating-point exceptions. + +RETURNS +If floating-point environment was successfully established, then +this method returns zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fesetenv(const fenv_t *envp) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fesetexceptflag.c b/newlib/libm/fenv/fesetexceptflag.c new file mode 100644 index 000000000..1f350933c --- /dev/null +++ b/newlib/libm/fenv/fesetexceptflag.c @@ -0,0 +1,73 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---set floating-point status flags + +INDEX + fesetexceptflag + +SYNOPSIS + #include + int fesetexceptflag(const fexcept_t *<[flagp]>, int <[excepts]>); + + Link with -lm. + +DESCRIPTION +This method attempts to set the floating-point status flags specified +by <[excepts]> to the states indicated by <[flagp>]. The argument +[] must point to an fexcept_t instance obtained via calling +<> with at least the floating-point exceptions specified +by the argument <[excepts]>. + +This method does not raise any floating-point exceptions. It only +sets the state of the flags. + +RETURNS +If the information was successfully returned, this method returns +zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fesetexceptflag(const fexcept_t *flagp, int excepts) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fesetround.c b/newlib/libm/fenv/fesetround.c new file mode 100644 index 000000000..d07efe86d --- /dev/null +++ b/newlib/libm/fenv/fesetround.c @@ -0,0 +1,67 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---set current rounding direction + +INDEX + fesetround +SYNOPSIS + #include + int fesetround(int <[round]>); + + Link with -lm. + +DESCRIPTION +This method attempts to set the current rounding direction represented +by <[round]>. <[round]> must be the value of one of the +rounding-direction macros. + +RETURNS +If the rounding mode was successfully established, this method returns +zero. Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fesetround(int round) +{ + return -ENOTSUP; +} diff --git a/newlib/libm/fenv/fetestexcept.c b/newlib/libm/fenv/fetestexcept.c new file mode 100644 index 000000000..d81fb3f6a --- /dev/null +++ b/newlib/libm/fenv/fetestexcept.c @@ -0,0 +1,68 @@ + +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---test floating-point exception flags + +INDEX + fetestexcept +SYNOPSIS + #include + int fetestexcept(int <[except]>); + + Link with -lm. + +DESCRIPTION +This method test the current floating-point exceptions to determine +which of those specified in <[except]> are currently set. + +RETURNS +This method returns the bitwise-inclusive OR of the floating point +exception macros which correspond to the currently set floating point +exceptions. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int fetestexcept(int excepts) +{ + return 0; +} diff --git a/newlib/libm/fenv/feupdateenv.c b/newlib/libm/fenv/feupdateenv.c new file mode 100644 index 000000000..e1dd9657f --- /dev/null +++ b/newlib/libm/fenv/feupdateenv.c @@ -0,0 +1,72 @@ +/* + (c) Copyright 2019 Joel Sherrill +#include + +/* +FUNCTION +<>---update current floating-point environment + +INDEX + feupdateenv + +SYNOPSIS + #include + int feupdateenv(const fenv_t *[]); + + Link with -lm. + +DESCRIPTION +This method attempts to save the currently raised floating point +exceptions in its automatic storage, install the floating point +environment specified by [, and raise the saved floating +point exceptions. + +The argument [] must point to a floating-point environment +obtained via <> or <>. + +RETURNS +If all actions are completed successfully, then this method returns zero. +Otherwise, a non-zero value is returned. + +PORTABILITY +ANSI C requires <>. + +Not all Newlib targets have a working implementation. Refer to +the file <> to see the status for your target. +*/ + +/* + * This is a non-functional implementation that should be overridden + * by an architecture specific implementation in newlib/libm/machine/ARCH. + */ +int feupdateenv(const fenv_t *envp) +{ + return -ENOTSUP; +} diff --git a/winsup/cygwin/fenv.cc b/winsup/cygwin/fenv.cc index ebd93e8b4..69304b513 100644 --- a/winsup/cygwin/fenv.cc +++ b/winsup/cygwin/fenv.cc @@ -37,11 +37,9 @@ details. */ #define FE_SSE_EXCEPT_MASK_SHIFT (7) /* These are writable so we can initialise them at startup. */ -static fenv_t fe_dfl_env; static fenv_t fe_nomask_env; /* These pointers provide the outside world with read-only access to them. */ -const fenv_t *_fe_dfl_env = &fe_dfl_env; const fenv_t *_fe_nomask_env = &fe_nomask_env; /* Although Cygwin assumes i686 or above (hence SSE available) these @@ -435,6 +433,7 @@ void _feinitialise (void) { unsigned int edx, eax; + extern fenv_t __fe_dfl_env; /* Check for presence of SSE: invoke CPUID #1, check EDX bit 25. */ eax = 1; @@ -462,6 +461,6 @@ _feinitialise (void) fedisableexcept (FE_ALL_EXCEPT); /* Finally cache state as default environment. */ - fegetenv (&fe_dfl_env); + fegetenv (&__fe_dfl_env); }