[PATCH v3 2/3] Add default implementation of fenv.h and all methods

Joel Sherrill joel at rtems.org
Tue Aug 6 14:05:17 UTC 2019


	The default implementation of the fenv.h methods return
	-EOPNOTSUPP.

	The intention of the new fenv.h is that it be portable
	and that architectures provide their own implementation
	of sys/fenv.h.
---
 newlib/libc/include/fenv.h         |  42 ++++++++++++++
 newlib/libc/include/sys/fenv.h     | 115 +++++++++++++++++++++++++++++++++++++
 newlib/libm/Makefile.am            |  10 ++--
 newlib/libm/configure.in           |   2 +-
 newlib/libm/fenv/Makefile.am       |  36 ++++++++++++
 newlib/libm/fenv/fe_dfl_env.c      |  39 +++++++++++++
 newlib/libm/fenv/feclearexcept.c   |  67 +++++++++++++++++++++
 newlib/libm/fenv/fegetenv.c        |  67 +++++++++++++++++++++
 newlib/libm/fenv/fegetexceptflag.c |  70 ++++++++++++++++++++++
 newlib/libm/fenv/fegetround.c      |  67 +++++++++++++++++++++
 newlib/libm/fenv/feholdexcept.c    |  72 +++++++++++++++++++++++
 newlib/libm/fenv/feraiseexcept.c   |  69 ++++++++++++++++++++++
 newlib/libm/fenv/fesetenv.c        |  70 ++++++++++++++++++++++
 newlib/libm/fenv/fesetexceptflag.c |  74 ++++++++++++++++++++++++
 newlib/libm/fenv/fesetround.c      |  68 ++++++++++++++++++++++
 newlib/libm/fenv/fetestexcept.c    |  69 ++++++++++++++++++++++
 newlib/libm/fenv/feupdateenv.c     |  73 +++++++++++++++++++++++
 17 files changed, 1005 insertions(+), 5 deletions(-)
 create mode 100644 newlib/libc/include/fenv.h
 create mode 100644 newlib/libc/include/sys/fenv.h
 create mode 100644 newlib/libm/fenv/Makefile.am
 create mode 100644 newlib/libm/fenv/fe_dfl_env.c
 create mode 100644 newlib/libm/fenv/feclearexcept.c
 create mode 100644 newlib/libm/fenv/fegetenv.c
 create mode 100644 newlib/libm/fenv/fegetexceptflag.c
 create mode 100644 newlib/libm/fenv/fegetround.c
 create mode 100644 newlib/libm/fenv/feholdexcept.c
 create mode 100644 newlib/libm/fenv/feraiseexcept.c
 create mode 100644 newlib/libm/fenv/fesetenv.c
 create mode 100644 newlib/libm/fenv/fesetexceptflag.c
 create mode 100644 newlib/libm/fenv/fesetround.c
 create mode 100644 newlib/libm/fenv/fetestexcept.c
 create mode 100644 newlib/libm/fenv/feupdateenv.c

diff --git a/newlib/libc/include/fenv.h b/newlib/libc/include/fenv.h
new file mode 100644
index 0000000..4795cc9
--- /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 <sys/fenv.h>
+
+#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 0000000..20f918d
--- /dev/null
+++ b/newlib/libc/include/sys/fenv.h
@@ -0,0 +1,115 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  (c) Copyright 2019 Craig Howlang <craig.howland at caci.com>
+  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_
+
+#include <stddef.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. See the C and POSIX standards for
+ * details:
+ *
+ *	fenv_t
+ *	fexcept_t
+ */
+typedef size_t fenv_t;
+typedef size_t 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_p;
+#define FE_DFL_ENV fe_dfl_env_p
+
+#endif /* _SYS_FENV_H_ */
+
diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am
index 8bc2c2c..3f8beed 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 9bd107c..aec22bd 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 0000000..fef5c36
--- /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 0000000..103908d
--- /dev/null
+++ b/newlib/libm/fenv/fe_dfl_env.c
@@ -0,0 +1,39 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+
+/*
+ * This is a non-functional implementation that should be overridden
+ * by an architecture specific implementation in newlib/libm/machine/ARCH.
+ *
+ * The implmentation must defined FE_DFL_ENV to point to a default
+ * environment of type fenv_t.
+ */
+const fenv_t fe_dfl_env = { 0 };
+const fenv_t *fe_dfl_env_p = &fe_dfl_env;
diff --git a/newlib/libm/fenv/feclearexcept.c b/newlib/libm/fenv/feclearexcept.c
new file mode 100644
index 0000000..f6ca306
--- /dev/null
+++ b/newlib/libm/fenv/feclearexcept.c
@@ -0,0 +1,67 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+/*
+FUNCTION
+<<feclearexcept>>---clear floating-point exception
+
+INDEX
+	feclearexcept
+SYNOPSIS
+	#include <fenv.h>
+	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 <<feclearexcept>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> to see the status for your target.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+ * 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 -ENOTSUP;
+}
diff --git a/newlib/libm/fenv/fegetenv.c b/newlib/libm/fenv/fegetenv.c
new file mode 100644
index 0000000..489cca6
--- /dev/null
+++ b/newlib/libm/fenv/fegetenv.c
@@ -0,0 +1,67 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<fegetenv>>---get current floating-point environment
+
+INDEX
+	fegetenv
+
+SYNOPSIS
+	#include <fenv.h>
+	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 <<fegetenv>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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 0000000..668f30f
--- /dev/null
+++ b/newlib/libm/fenv/fegetexceptflag.c
@@ -0,0 +1,70 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<fegetexceptflag>>---get floating-point status flags
+
+INDEX
+	fegetexceptflag
+
+SYNOPSIS
+	#include <fenv.h>
+	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 <<fegetexceptflag>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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 0000000..541dd6d
--- /dev/null
+++ b/newlib/libm/fenv/fegetround.c
@@ -0,0 +1,67 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<fegetround>>---get current rounding direction
+
+INDEX
+	feclearexcept
+SYNOPSIS
+	#include <fenv.h>
+	int fegetround(void);
+
+	Link with -lm.
+
+DESCRIPTION
+This method returns the current rounding direction.
+
+RETURNS
+This method returns the rounding direction. If the current rounding
+direction cannot be determined, then a negative value is returned.
+
+PORTABILITY
+ANSI C requires <<fegetround>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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 0000000..a673121
--- /dev/null
+++ b/newlib/libm/fenv/feholdexcept.c
@@ -0,0 +1,72 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<feholdexcept>>---save current floating-point environment
+
+INDEX
+	feholdexcept
+
+SYNOPSIS
+	#include <fenv.h>
+	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 <<feholdexcept>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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 0000000..8a372dd
--- /dev/null
+++ b/newlib/libm/fenv/feraiseexcept.c
@@ -0,0 +1,69 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<feraiseexcept>>---raise floating-point exception
+
+INDEX
+	feraiseexcept
+SYNOPSIS
+	#include <fenv.h>
+	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 <<feraiseexcept>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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 -ENOTSUP;
+}
+
diff --git a/newlib/libm/fenv/fesetenv.c b/newlib/libm/fenv/fesetenv.c
new file mode 100644
index 0000000..a1e8cdc
--- /dev/null
+++ b/newlib/libm/fenv/fesetenv.c
@@ -0,0 +1,70 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<fesetenv>>---set current floating-point environment
+
+INDEX
+	fesetenv
+
+SYNOPSIS
+	#include <fenv.h>
+	int fesetenv(const fenv_t *[<envp>]);
+
+	Link with -lm.
+
+DESCRIPTION
+This method attempts to establish the floating-point environment
+pointed to by <[envp]>. The argument [<envp>] must point to a
+floating-point environment obtained via <<fegetenv>> or <<feholdexcept>>
+or a floating-point environment macro such as <<FE_DFL_ENV>>.
+
+RETURNS
+If floating-point environment was successfully established, then 
+this method returns zero. Otherwise, a non-zero value is returned.
+
+PORTABILITY
+ANSI C requires <<fesetenv>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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 0000000..491d48f
--- /dev/null
+++ b/newlib/libm/fenv/fesetexceptflag.c
@@ -0,0 +1,74 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<fesetexceptflag>>---set floating-point status flags
+
+INDEX
+	fesetexceptflag
+
+SYNOPSIS
+	#include <fenv.h>
+	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
+[<flagp>] must point to an fexcept_t instance obtained via calling
+<<fegetexceptflag>> 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 <<fesetexceptflag>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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 0000000..d6ab163
--- /dev/null
+++ b/newlib/libm/fenv/fesetround.c
@@ -0,0 +1,68 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<fesetround>>---set current rounding direction
+
+INDEX
+	fesetround
+SYNOPSIS
+	#include <fenv.h>
+	int fesetround(int <[round]>);
+
+	Link with -lm.
+
+DESCRIPTION
+This method attempts to set the current rounding direction represented
+by <[round]>.
+
+RETURNS
+If the rounding mode was successfully established, this method returns
+zero. Otherwise, a non-zero value is returned.
+
+PORTABILITY
+ANSI C requires <<fesetround>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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 0000000..3bc76fa
--- /dev/null
+++ b/newlib/libm/fenv/fetestexcept.c
@@ -0,0 +1,69 @@
+
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<fetestexcept>>---test floating-point exception flags
+
+INDEX
+	fetestexcept
+SYNOPSIS
+	#include <fenv.h>
+	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 <<fetestexcept>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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 -ENOTSUP;
+}
diff --git a/newlib/libm/fenv/feupdateenv.c b/newlib/libm/fenv/feupdateenv.c
new file mode 100644
index 0000000..a5cf872
--- /dev/null
+++ b/newlib/libm/fenv/feupdateenv.c
@@ -0,0 +1,73 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel at rtems.org
+  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.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+/*
+FUNCTION
+<<feupdateenv>>---update current floating-point environment
+
+INDEX
+	feupdateenv
+
+SYNOPSIS
+	#include <fenv.h>
+	int feupdateenv(const fenv_t *[<envp>]);
+
+	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 [<envp]>, and raise the saved floating
+point exceptions.
+
+The argument [<envp>] must point to a floating-point environment
+obtained via <<fegetenv>> or <<feholdexcept>>.
+
+RETURNS
+If all actions are completed successfully, then this method returns zero.
+Otherwise, a non-zero value is returned.
+
+PORTABILITY
+ANSI C requires <<feupdateenv>>.
+
+Not all Newlib targets have a working implementation.  Refer to
+the file <<sys/fenv.h>> 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;
+}
+
-- 
1.8.3.1




More information about the devel mailing list