public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v6 2/3] Add default implementation of fenv.h and all methods
@ 2019-08-08 16:27 joel
  2019-08-08 19:05 ` Corinna Vinschen
  2019-08-12 18:31 ` Jon Turney
  0 siblings, 2 replies; 10+ messages in thread
From: joel @ 2019-08-08 16:27 UTC (permalink / raw)
  To: newlib; +Cc: Joel Sherrill

From: Joel Sherrill <joel@rtems.org>

	The default implementation of the fenv.h methods return
	-EOPNOTSUP. Some of these have implementations appropriate
        for soft-float.

	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     | 114 +++++++++++++++++++++++++++++++++++++
 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 |  69 ++++++++++++++++++++++
 newlib/libm/fenv/fegetround.c      |  67 ++++++++++++++++++++++
 newlib/libm/fenv/feholdexcept.c    |  71 +++++++++++++++++++++++
 newlib/libm/fenv/feraiseexcept.c   |  68 ++++++++++++++++++++++
 newlib/libm/fenv/fesetenv.c        |  73 ++++++++++++++++++++++++
 newlib/libm/fenv/fesetexceptflag.c |  74 ++++++++++++++++++++++++
 newlib/libm/fenv/fesetround.c      |  68 ++++++++++++++++++++++
 newlib/libm/fenv/fetestexcept.c    |  68 ++++++++++++++++++++++
 newlib/libm/fenv/feupdateenv.c     |  73 ++++++++++++++++++++++++
 17 files changed, 1003 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..1cb1c49
--- /dev/null
+++ b/newlib/libc/include/sys/fenv.h
@@ -0,0 +1,114 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  (c) Copyright 2019 Craig Howlang <craig.howland@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_
+
+/*******************************************************************************
+ * 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 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..79294ab
--- /dev/null
+++ b/newlib/libm/fenv/fe_dfl_env.c
@@ -0,0 +1,39 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@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.
+ */
+static const 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 0000000..534da63
--- /dev/null
+++ b/newlib/libm/fenv/feclearexcept.c
@@ -0,0 +1,67 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@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 (excepts  ?  -ENOTSUP : 0);
+}
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@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..6e8fc23
--- /dev/null
+++ b/newlib/libm/fenv/fegetexceptflag.c
@@ -0,0 +1,69 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@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..fa6b132
--- /dev/null
+++ b/newlib/libm/fenv/fegetround.c
@@ -0,0 +1,67 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@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
+	fegetround
+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, 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 <<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..3c110a3
--- /dev/null
+++ b/newlib/libm/fenv/feholdexcept.c
@@ -0,0 +1,71 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@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..827cdac
--- /dev/null
+++ b/newlib/libm/fenv/feraiseexcept.c
@@ -0,0 +1,68 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@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 (excepts  ?  -ENOTSUP : 0);
+}
+
diff --git a/newlib/libm/fenv/fesetenv.c b/newlib/libm/fenv/fesetenv.c
new file mode 100644
index 0000000..7306be3
--- /dev/null
+++ b/newlib/libm/fenv/fesetenv.c
@@ -0,0 +1,73 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@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>>.
+
+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 <<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@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..554c963
--- /dev/null
+++ b/newlib/libm/fenv/fesetround.c
@@ -0,0 +1,68 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@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]>.  <[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 <<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..d81fb3f
--- /dev/null
+++ b/newlib/libm/fenv/fetestexcept.c
@@ -0,0 +1,68 @@
+
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@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 0;
+}
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@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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 2/3] Add default implementation of fenv.h and all methods
  2019-08-08 16:27 [PATCH v6 2/3] Add default implementation of fenv.h and all methods joel
@ 2019-08-08 19:05 ` Corinna Vinschen
  2019-08-08 20:04   ` Joel Sherrill
  2019-08-12 18:31 ` Jon Turney
  1 sibling, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-08 19:05 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]

On Aug  8 11:27, joel@rtems.org wrote:
> +/*
> + * 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.
> + */
> +static const fenv_t fe_dfl_env = { 0 };
> +const fenv_t *_fe_dfl_env = &fe_dfl_env;

Bummer.  This doesn't work.  The problem is that Cygwin needs to
initialize fe_dfl_env, like this:

  fegetenv (&fe_dfl_env);

However, even if I drop `const' as in Cygwin, if fe_dfl_env is static
I can't access it from the _feinitialise() function at DLL init time.

I'm not quite sure how to fix this.  Any ideas?  Do I have to drop
the idea to reuse this file and we need our own target-specific one?


Corinna


P.S.: Apart from this problem we can use this now.  We should just add
the GNU specific FE_NOMASK_ENV soon, too.

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 2/3] Add default implementation of fenv.h and all methods
  2019-08-08 19:05 ` Corinna Vinschen
@ 2019-08-08 20:04   ` Joel Sherrill
  2019-08-09  7:50     ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Joel Sherrill @ 2019-08-08 20:04 UTC (permalink / raw)
  To: Newlib

On Thu, Aug 8, 2019 at 2:05 PM Corinna Vinschen <vinschen@redhat.com> wrote:

> On Aug  8 11:27, joel@rtems.org wrote:
> > +/*
> > + * 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.
> > + */
> > +static const fenv_t fe_dfl_env = { 0 };
> > +const fenv_t *_fe_dfl_env = &fe_dfl_env;
>
> Bummer.  This doesn't work.  The problem is that Cygwin needs to
> initialize fe_dfl_env, like this:
>
>   fegetenv (&fe_dfl_env);
>
> However, even if I drop `const' as in Cygwin, if fe_dfl_env is static
> I can't access it from the _feinitialise() function at DLL init time.
>
> I'm not quite sure how to fix this.  Any ideas?  Do I have to drop
> the idea to reuse this file and we need our own target-specific one?
>

I'm not opposed to making it non-const and not static. Whatever it
takes to make it work on Cygwin.

>
>
> Corinna
>
>
> P.S.: Apart from this problem we can use this now.  We should just add
> the GNU specific FE_NOMASK_ENV soon, too.
>

I'm not disagreeing but can that be added after this bulk is pushed?

It would be easier to address the Cygwin issue as you see fit and add this
if you could just change it in git. :)

--joel


>
> --
> Corinna Vinschen
> Cygwin Maintainer
> Red Hat
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 2/3] Add default implementation of fenv.h and all methods
  2019-08-08 20:04   ` Joel Sherrill
@ 2019-08-09  7:50     ` Corinna Vinschen
  2019-08-09  7:56       ` Corinna Vinschen
  2019-08-12  8:21       ` Corinna Vinschen
  0 siblings, 2 replies; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-09  7:50 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

On Aug  8 15:04, Joel Sherrill wrote:
> On Thu, Aug 8, 2019 at 2:05 PM Corinna Vinschen <vinschen@redhat.com> wrote:
> 
> > On Aug  8 11:27, joel@rtems.org wrote:
> > > +/*
> > > + * 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.
> > > + */
> > > +static const fenv_t fe_dfl_env = { 0 };
> > > +const fenv_t *_fe_dfl_env = &fe_dfl_env;
> >
> > Bummer.  This doesn't work.  The problem is that Cygwin needs to
> > initialize fe_dfl_env, like this:
> >
> >   fegetenv (&fe_dfl_env);
> >
> > However, even if I drop `const' as in Cygwin, if fe_dfl_env is static
> > I can't access it from the _feinitialise() function at DLL init time.
> >
> > I'm not quite sure how to fix this.  Any ideas?  Do I have to drop
> > the idea to reuse this file and we need our own target-specific one?
> >
> 
> I'm not opposed to making it non-const and not static. Whatever it
> takes to make it work on Cygwin.

Ok, if nobody else disagrees.  I'll wait over the weekend.

I think, if the variable is non-static it should start with two
underscores.  This was no problem in Cygwin which only exports symbols
we add to a linker definition file, but in case of a "normal" lib, it
makes probably sense not to pollute the namespace.

You don't have to create another patch in that case, I care for it.

> > P.S.: Apart from this problem we can use this now.  We should just add
> > the GNU specific FE_NOMASK_ENV soon, too.
> >
> 
> I'm not disagreeing but can that be added after this bulk is pushed?

Sure!  I wrote "soon" not "now" :)


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 2/3] Add default implementation of fenv.h and all methods
  2019-08-09  7:50     ` Corinna Vinschen
@ 2019-08-09  7:56       ` Corinna Vinschen
  2019-08-12  8:21       ` Corinna Vinschen
  1 sibling, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-09  7:56 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]

On Aug  9 09:50, Corinna Vinschen wrote:
> On Aug  8 15:04, Joel Sherrill wrote:
> > On Thu, Aug 8, 2019 at 2:05 PM Corinna Vinschen <vinschen@redhat.com> wrote:
> > 
> > > On Aug  8 11:27, joel@rtems.org wrote:
> > > > +/*
> > > > + * 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.
> > > > + */
> > > > +static const fenv_t fe_dfl_env = { 0 };
> > > > +const fenv_t *_fe_dfl_env = &fe_dfl_env;
> > >
> > > Bummer.  This doesn't work.  The problem is that Cygwin needs to
> > > initialize fe_dfl_env, like this:
> > >
> > >   fegetenv (&fe_dfl_env);
> > >
> > > However, even if I drop `const' as in Cygwin, if fe_dfl_env is static
> > > I can't access it from the _feinitialise() function at DLL init time.
> > >
> > > I'm not quite sure how to fix this.  Any ideas?  Do I have to drop
> > > the idea to reuse this file and we need our own target-specific one?
> > >
> > 
> > I'm not opposed to making it non-const and not static. Whatever it
> > takes to make it work on Cygwin.
> 
> Ok, if nobody else disagrees.  I'll wait over the weekend.

Oh, btw., this is not exactly Cygwin only.  As I wrote before,
the code should be usable for other x86{_64} targets as well.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 2/3] Add default implementation of fenv.h and all methods
  2019-08-09  7:50     ` Corinna Vinschen
  2019-08-09  7:56       ` Corinna Vinschen
@ 2019-08-12  8:21       ` Corinna Vinschen
  2019-08-12 13:50         ` Joel Sherrill
  1 sibling, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-12  8:21 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]

On Aug  9 09:50, Corinna Vinschen wrote:
> On Aug  8 15:04, Joel Sherrill wrote:
> > On Thu, Aug 8, 2019 at 2:05 PM Corinna Vinschen <vinschen@redhat.com> wrote:
> > 
> > > On Aug  8 11:27, joel@rtems.org wrote:
> > > > +/*
> > > > + * 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.
> > > > + */
> > > > +static const fenv_t fe_dfl_env = { 0 };
> > > > +const fenv_t *_fe_dfl_env = &fe_dfl_env;
> > >
> > > Bummer.  This doesn't work.  The problem is that Cygwin needs to
> > > initialize fe_dfl_env, like this:
> > >
> > >   fegetenv (&fe_dfl_env);
> > >
> > > However, even if I drop `const' as in Cygwin, if fe_dfl_env is static
> > > I can't access it from the _feinitialise() function at DLL init time.
> > >
> > > I'm not quite sure how to fix this.  Any ideas?  Do I have to drop
> > > the idea to reuse this file and we need our own target-specific one?
> > >
> > 
> > I'm not opposed to making it non-const and not static. Whatever it
> > takes to make it work on Cygwin.
> 
> Ok, if nobody else disagrees.  I'll wait over the weekend.
> 
> I think, if the variable is non-static it should start with two
> underscores.  This was no problem in Cygwin which only exports symbols
> we add to a linker definition file, but in case of a "normal" lib, it
> makes probably sense not to pollute the namespace.
> 
> You don't have to create another patch in that case, I care for it.

Pushed with the req. changes for Cygwin.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 2/3] Add default implementation of fenv.h and all methods
  2019-08-12  8:21       ` Corinna Vinschen
@ 2019-08-12 13:50         ` Joel Sherrill
  0 siblings, 0 replies; 10+ messages in thread
From: Joel Sherrill @ 2019-08-12 13:50 UTC (permalink / raw)
  To: Newlib, Joel Sherrill

On Mon, Aug 12, 2019 at 3:21 AM Corinna Vinschen <vinschen@redhat.com>
wrote:

> On Aug  9 09:50, Corinna Vinschen wrote:
> > On Aug  8 15:04, Joel Sherrill wrote:
> > > On Thu, Aug 8, 2019 at 2:05 PM Corinna Vinschen <vinschen@redhat.com>
> wrote:
> > >
> > > > On Aug  8 11:27, joel@rtems.org wrote:
> > > > > +/*
> > > > > + * 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.
> > > > > + */
> > > > > +static const fenv_t fe_dfl_env = { 0 };
> > > > > +const fenv_t *_fe_dfl_env = &fe_dfl_env;
> > > >
> > > > Bummer.  This doesn't work.  The problem is that Cygwin needs to
> > > > initialize fe_dfl_env, like this:
> > > >
> > > >   fegetenv (&fe_dfl_env);
> > > >
> > > > However, even if I drop `const' as in Cygwin, if fe_dfl_env is static
> > > > I can't access it from the _feinitialise() function at DLL init time.
> > > >
> > > > I'm not quite sure how to fix this.  Any ideas?  Do I have to drop
> > > > the idea to reuse this file and we need our own target-specific one?
> > > >
> > >
> > > I'm not opposed to making it non-const and not static. Whatever it
> > > takes to make it work on Cygwin.
> >
> > Ok, if nobody else disagrees.  I'll wait over the weekend.
> >
> > I think, if the variable is non-static it should start with two
> > underscores.  This was no problem in Cygwin which only exports symbols
> > we add to a linker definition file, but in case of a "normal" lib, it
> > makes probably sense not to pollute the namespace.
> >
> > You don't have to create another patch in that case, I care for it.
>
> Pushed with the req. changes for Cygwin.
>

Thank you. I am glad you found the magic for Cygwin and pushed it.




>
> Thanks,
> Corinna
>
> --
> Corinna Vinschen
> Cygwin Maintainer
> Red Hat
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 2/3] Add default implementation of fenv.h and all methods
  2019-08-08 16:27 [PATCH v6 2/3] Add default implementation of fenv.h and all methods joel
  2019-08-08 19:05 ` Corinna Vinschen
@ 2019-08-12 18:31 ` Jon Turney
  2019-08-12 18:50   ` Joel Sherrill
  1 sibling, 1 reply; 10+ messages in thread
From: Jon Turney @ 2019-08-12 18:31 UTC (permalink / raw)
  To: newlib; +Cc: joel

On 08/08/2019 17:27, joel@rtems.org wrote:
> 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
[...]
> +
> +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 =
[...]

I'm not sure it totally makes sense to write this.

This defines a bunch of source files which are chewed on with makedoc to 
produce some texinfo fragments, but because there is no chapter which 
includes them (not sure if that should be a new fenv.tex included by 
libm.tex, or one of the existing chapters), the nodes defined by those 
fragments are not navigable to from the libm root node (and I think 
likewise in the html documentation)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 2/3] Add default implementation of fenv.h and all methods
  2019-08-12 18:31 ` Jon Turney
@ 2019-08-12 18:50   ` Joel Sherrill
  2019-08-12 20:37     ` Jon Turney
  0 siblings, 1 reply; 10+ messages in thread
From: Joel Sherrill @ 2019-08-12 18:50 UTC (permalink / raw)
  To: Jon Turney; +Cc: newlib

On Mon, Aug 12, 2019 at 1:31 PM Jon Turney <jon.turney@dronecode.org.uk>
wrote:

> On 08/08/2019 17:27, joel@rtems.org wrote:
> > 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
> [...]
> > +
> > +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 =
> [...]
>
> I'm not sure it totally makes sense to write this.
>
> This defines a bunch of source files which are chewed on with makedoc to
> produce some texinfo fragments, but because there is no chapter which
> includes them (not sure if that should be a new fenv.tex included by
> libm.tex, or one of the existing chapters), the nodes defined by those
> fragments are not navigable to from the libm root node (and I think
> likewise in the html documentation)
>

Using complex.h as precedence, I would lean to making an fenv.tex file.

Do you mind adding it or do you want me to take a stab and it and email it
to you privately to test?

Thanks.

--joel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 2/3] Add default implementation of fenv.h and all methods
  2019-08-12 18:50   ` Joel Sherrill
@ 2019-08-12 20:37     ` Jon Turney
  0 siblings, 0 replies; 10+ messages in thread
From: Jon Turney @ 2019-08-12 20:37 UTC (permalink / raw)
  To: joel; +Cc: newlib

On 12/08/2019 19:50, Joel Sherrill wrote:
> On Mon, Aug 12, 2019 at 1:31 PM Jon Turney <jon.turney@dronecode.org.uk>
> wrote:
> 
>> On 08/08/2019 17:27, joel@rtems.org wrote:
>>> 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
>> [...]
>>> +
>>> +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 =
>> [...]
>>
>> I'm not sure it totally makes sense to write this.
>>
>> This defines a bunch of source files which are chewed on with makedoc to
>> produce some texinfo fragments, but because there is no chapter which
>> includes them (not sure if that should be a new fenv.tex included by
>> libm.tex, or one of the existing chapters), the nodes defined by those
>> fragments are not navigable to from the libm root node (and I think

I think I should have written 'the nodes defined by those fragments are 
not included in the generated libm.info file'

>> likewise in the html documentation)
>>
> 
> Using complex.h as precedence, I would lean to making an fenv.tex file.
> 
> Do you mind adding it or do you want me to take a stab and it and email it
> to you privately to test?

Please go ahead.

I don't mind testing it, but it will just involve running 'make info' or 
'make html' and reading the generated files :)

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-08-12 20:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08 16:27 [PATCH v6 2/3] Add default implementation of fenv.h and all methods joel
2019-08-08 19:05 ` Corinna Vinschen
2019-08-08 20:04   ` Joel Sherrill
2019-08-09  7:50     ` Corinna Vinschen
2019-08-09  7:56       ` Corinna Vinschen
2019-08-12  8:21       ` Corinna Vinschen
2019-08-12 13:50         ` Joel Sherrill
2019-08-12 18:31 ` Jon Turney
2019-08-12 18:50   ` Joel Sherrill
2019-08-12 20:37     ` Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).