diff --git a/math/fromfp.h b/math/fromfp.h
index 9d102a635f..718a5120d8 100644
--- a/math/fromfp.h
+++ b/math/fromfp.h
@@ -22,6 +22,7 @@
 #include <math.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <stdbool.h>
 #include <stdint.h>
 
diff --git a/math/math-narrow.h b/math/math-narrow.h
index c4065e88f7..242b22c8e2 100644
--- a/math/math-narrow.h
+++ b/math/math-narrow.h
@@ -26,6 +26,7 @@
 #include <ieee754.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 /* Carry out a computation using round-to-odd.  The computation is
    EXPR; the union type in which to store the result is UNION and the
diff --git a/math/s_cexp_template.c b/math/s_cexp_template.c
index 5fdab1e5ac..766681a2bb 100644
--- a/math/s_cexp_template.c
+++ b/math/s_cexp_template.c
@@ -21,6 +21,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/math/s_csin_template.c b/math/s_csin_template.c
index 5f95e92ee0..4581852b17 100644
--- a/math/s_csin_template.c
+++ b/math/s_csin_template.c
@@ -21,6 +21,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/math/s_csinh_template.c b/math/s_csinh_template.c
index 95f28c2b66..ad599d67ea 100644
--- a/math/s_csinh_template.c
+++ b/math/s_csinh_template.c
@@ -21,6 +21,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/math/s_ctan_template.c b/math/s_ctan_template.c
index ab11c25299..bd9247c98d 100644
--- a/math/s_ctan_template.c
+++ b/math/s_ctan_template.c
@@ -21,6 +21,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/math/s_ctanh_template.c b/math/s_ctanh_template.c
index bd1292239f..7b1dd9aa67 100644
--- a/math/s_ctanh_template.c
+++ b/math/s_ctanh_template.c
@@ -21,6 +21,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/math/s_iseqsig_template.c b/math/s_iseqsig_template.c
index a4d28d778d..b3a86aea50 100644
--- a/math/s_iseqsig_template.c
+++ b/math/s_iseqsig_template.c
@@ -20,6 +20,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <stdbool.h>
 #include <fix-fp-int-compare-invalid.h>
 
diff --git a/math/w_acos_compat.c b/math/w_acos_compat.c
index 079fdb271f..ff6d163c20 100644
--- a/math/w_acos_compat.c
+++ b/math/w_acos_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
diff --git a/math/w_acosf_compat.c b/math/w_acosf_compat.c
index efc09edb2a..0f38a20564 100644
--- a/math/w_acosf_compat.c
+++ b/math/w_acosf_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-float.h>
 
diff --git a/math/w_acosl_compat.c b/math/w_acosl_compat.c
index d630a10a40..e24fb03b5f 100644
--- a/math/w_acosl_compat.c
+++ b/math/w_acosl_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-ldouble.h>
 
diff --git a/math/w_asin_compat.c b/math/w_asin_compat.c
index c55913d304..43ea34a7dc 100644
--- a/math/w_asin_compat.c
+++ b/math/w_asin_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
diff --git a/math/w_asinf_compat.c b/math/w_asinf_compat.c
index 1fc18c2e91..58c6dcaf27 100644
--- a/math/w_asinf_compat.c
+++ b/math/w_asinf_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-float.h>
 
diff --git a/math/w_asinl_compat.c b/math/w_asinl_compat.c
index 6741138f74..c7ea8358af 100644
--- a/math/w_asinl_compat.c
+++ b/math/w_asinl_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-ldouble.h>
 
diff --git a/math/w_ilogb_template.c b/math/w_ilogb_template.c
index 3e45f33b9c..fd41dc2627 100644
--- a/math/w_ilogb_template.c
+++ b/math/w_ilogb_template.c
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 /* wrapper ilogb */
 int
diff --git a/math/w_j0_compat.c b/math/w_j0_compat.c
index a298353ac4..f8ce3f8d3c 100644
--- a/math/w_j0_compat.c
+++ b/math/w_j0_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
diff --git a/math/w_j0f_compat.c b/math/w_j0f_compat.c
index 41d3a10147..0bee2fb011 100644
--- a/math/w_j0f_compat.c
+++ b/math/w_j0f_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-float.h>
 
diff --git a/math/w_j0l_compat.c b/math/w_j0l_compat.c
index e436cb278b..9d2c5d46a4 100644
--- a/math/w_j0l_compat.c
+++ b/math/w_j0l_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-ldouble.h>
 
diff --git a/math/w_j1_compat.c b/math/w_j1_compat.c
index 3b014b8cfa..11a56889f1 100644
--- a/math/w_j1_compat.c
+++ b/math/w_j1_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
diff --git a/math/w_j1f_compat.c b/math/w_j1f_compat.c
index 5cfb6b9cd5..e59d954626 100644
--- a/math/w_j1f_compat.c
+++ b/math/w_j1f_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-float.h>
 
diff --git a/math/w_j1l_compat.c b/math/w_j1l_compat.c
index fb0adc68cb..400040a0a0 100644
--- a/math/w_j1l_compat.c
+++ b/math/w_j1l_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-ldouble.h>
 
diff --git a/math/w_jn_compat.c b/math/w_jn_compat.c
index 8b546ba4a2..a169c7b210 100644
--- a/math/w_jn_compat.c
+++ b/math/w_jn_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
diff --git a/math/w_jnf_compat.c b/math/w_jnf_compat.c
index 86386700de..11769e2e26 100644
--- a/math/w_jnf_compat.c
+++ b/math/w_jnf_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-float.h>
 
diff --git a/math/w_llogb_template.c b/math/w_llogb_template.c
index 8315ccd072..76f2557677 100644
--- a/math/w_llogb_template.c
+++ b/math/w_llogb_template.c
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 long int
 M_DECL_FUNC (__llogb) (FLOAT x)
diff --git a/math/w_log10_compat.c b/math/w_log10_compat.c
index 87c155d256..996139dc7c 100644
--- a/math/w_log10_compat.c
+++ b/math/w_log10_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
diff --git a/math/w_log10f_compat.c b/math/w_log10f_compat.c
index fd1861a6ab..9cee2185d2 100644
--- a/math/w_log10f_compat.c
+++ b/math/w_log10f_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-float.h>
 
diff --git a/math/w_log10l_compat.c b/math/w_log10l_compat.c
index d2387c225a..b4b404822e 100644
--- a/math/w_log10l_compat.c
+++ b/math/w_log10l_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-ldouble.h>
 
diff --git a/math/w_log2_compat.c b/math/w_log2_compat.c
index 61e7170ae1..7b34a991e6 100644
--- a/math/w_log2_compat.c
+++ b/math/w_log2_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
diff --git a/math/w_log2f_compat.c b/math/w_log2f_compat.c
index 7b4b545c81..c9d99be07a 100644
--- a/math/w_log2f_compat.c
+++ b/math/w_log2f_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-float.h>
 
diff --git a/math/w_log2l_compat.c b/math/w_log2l_compat.c
index ba74ed2576..c40016532d 100644
--- a/math/w_log2l_compat.c
+++ b/math/w_log2l_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-ldouble.h>
 
diff --git a/math/w_log_compat.c b/math/w_log_compat.c
index 5413b8e8df..4ed4eea6e8 100644
--- a/math/w_log_compat.c
+++ b/math/w_log_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-double.h>
 
diff --git a/math/w_logf_compat.c b/math/w_logf_compat.c
index 9810d30c52..7e8c124c4d 100644
--- a/math/w_logf_compat.c
+++ b/math/w_logf_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-float.h>
 
diff --git a/math/w_logl_compat.c b/math/w_logl_compat.c
index 991251a7c5..f47d792a16 100644
--- a/math/w_logl_compat.c
+++ b/math/w_logl_compat.c
@@ -19,6 +19,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <libm-alias-ldouble.h>
 
diff --git a/sysdeps/aarch64/fpu/feholdexcpt.c b/sysdeps/aarch64/fpu/feholdexcpt.c
index 4f7a58e379..3cd1642a68 100644
--- a/sysdeps/aarch64/fpu/feholdexcpt.c
+++ b/sysdeps/aarch64/fpu/feholdexcpt.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __feholdexcept (fenv_t *envp)
diff --git a/sysdeps/aarch64/fpu/fesetround.c b/sysdeps/aarch64/fpu/fesetround.c
index 4c2ed3d7ac..42a70d6fd5 100644
--- a/sysdeps/aarch64/fpu/fesetround.c
+++ b/sysdeps/aarch64/fpu/fesetround.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <fpu_control.h>
 
 int
diff --git a/sysdeps/aarch64/fpu/fgetexcptflg.c b/sysdeps/aarch64/fpu/fgetexcptflg.c
index cfc7113e04..472a525a7d 100644
--- a/sysdeps/aarch64/fpu/fgetexcptflg.c
+++ b/sysdeps/aarch64/fpu/fgetexcptflg.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 fegetexceptflag (fexcept_t *flagp, int excepts)
diff --git a/sysdeps/aarch64/fpu/ftestexcept.c b/sysdeps/aarch64/fpu/ftestexcept.c
index 84223259c8..ae04fb74d5 100644
--- a/sysdeps/aarch64/fpu/ftestexcept.c
+++ b/sysdeps/aarch64/fpu/ftestexcept.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 fetestexcept (int excepts)
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index 936e3af568..220367b9de 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -261,6 +261,4 @@ extern double __mpsin (double __x, double __dx, bool __range_reduce);
 extern double __mpcos (double __x, double __dx, bool __range_reduce);
 extern void __docos (double __x, double __dx, double __v[]);
 
-#include <fenv_private.h>
-
 #endif /* _MATH_PRIVATE_H_ */
diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c
index 7295067507..c3e1b2218c 100644
--- a/sysdeps/ieee754/dbl-64/e_atan2.c
+++ b/sysdeps/ieee754/dbl-64/e_atan2.c
@@ -46,6 +46,7 @@
 #include <math.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <stap-probe.h>
 
 #ifndef SECTION
diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c
index ddd2bcb1c2..7d8b414034 100644
--- a/sysdeps/ieee754/dbl-64/e_exp.c
+++ b/sysdeps/ieee754/dbl-64/e_exp.c
@@ -39,6 +39,7 @@
 #include "uexp.tbl"
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <fenv.h>
 #include <float.h>
 #include "eexp.tbl"
diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c
index c45bb44744..d07e787ec8 100644
--- a/sysdeps/ieee754/dbl-64/e_exp2.c
+++ b/sysdeps/ieee754/dbl-64/e_exp2.c
@@ -31,6 +31,7 @@
 #include <inttypes.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 
 #include "t_exp2.h"
diff --git a/sysdeps/ieee754/dbl-64/e_gamma_r.c b/sysdeps/ieee754/dbl-64/e_gamma_r.c
index 2744549cbd..e7b6dfecd7 100644
--- a/sysdeps/ieee754/dbl-64/e_gamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_gamma_r.c
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c
index 9181b22bb8..cb7c6cf266 100644
--- a/sysdeps/ieee754/dbl-64/e_jn.c
+++ b/sysdeps/ieee754/dbl-64/e_jn.c
@@ -41,6 +41,7 @@
 #include <math.h>
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 
 static const double
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index 96d5b23ccc..5577aa3f40 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -38,6 +38,7 @@
 #include "MathLib.h"
 #include "upow.tbl"
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <fenv.h>
 
diff --git a/sysdeps/ieee754/dbl-64/e_remainder.c b/sysdeps/ieee754/dbl-64/e_remainder.c
index 2e7f0ac1f4..683c24ff07 100644
--- a/sysdeps/ieee754/dbl-64/e_remainder.c
+++ b/sysdeps/ieee754/dbl-64/e_remainder.c
@@ -35,6 +35,7 @@
 #include "MathLib.h"
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 /**************************************************************************/
 /* An ultimate remainder routine. Given two IEEE double machine numbers x */
diff --git a/sysdeps/ieee754/dbl-64/e_sqrt.c b/sysdeps/ieee754/dbl-64/e_sqrt.c
index f70623e17b..85f39b9937 100644
--- a/sysdeps/ieee754/dbl-64/e_sqrt.c
+++ b/sysdeps/ieee754/dbl-64/e_sqrt.c
@@ -39,6 +39,7 @@
 #include "root.tbl"
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 /*********************************************************************/
 /* An ultimate sqrt routine. Given an IEEE double machine number x   */
diff --git a/sysdeps/ieee754/dbl-64/gamma_product.c b/sysdeps/ieee754/dbl-64/gamma_product.c
index 3300b5139c..adae40c63b 100644
--- a/sysdeps/ieee754/dbl-64/gamma_product.c
+++ b/sysdeps/ieee754/dbl-64/gamma_product.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <mul_split.h>
 
 /* Compute the product of X + X_EPS, X + X_EPS + 1, ..., X + X_EPS + N
diff --git a/sysdeps/ieee754/dbl-64/lgamma_neg.c b/sysdeps/ieee754/dbl-64/lgamma_neg.c
index 5bb2f10c71..eaa6f641eb 100644
--- a/sysdeps/ieee754/dbl-64/lgamma_neg.c
+++ b/sysdeps/ieee754/dbl-64/lgamma_neg.c
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 static const double lgamma_zeros[][2] =
   {
diff --git a/sysdeps/ieee754/dbl-64/s_atan.c b/sysdeps/ieee754/dbl-64/s_atan.c
index 38db092d04..311c28fe13 100644
--- a/sysdeps/ieee754/dbl-64/s_atan.c
+++ b/sysdeps/ieee754/dbl-64/s_atan.c
@@ -46,6 +46,7 @@
 #include <libm-alias-double.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <stap-probe.h>
 
diff --git a/sysdeps/ieee754/dbl-64/s_fma.c b/sysdeps/ieee754/dbl-64/s_fma.c
index 57c7b5dfc2..3f8976394d 100644
--- a/sysdeps/ieee754/dbl-64/s_fma.c
+++ b/sysdeps/ieee754/dbl-64/s_fma.c
@@ -23,6 +23,7 @@
 #include <ieee754.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <tininess.h>
 
diff --git a/sysdeps/ieee754/dbl-64/s_fmaf.c b/sysdeps/ieee754/dbl-64/s_fmaf.c
index 5c8b22ac16..630798c13e 100644
--- a/sysdeps/ieee754/dbl-64/s_fmaf.c
+++ b/sysdeps/ieee754/dbl-64/s_fmaf.c
@@ -22,6 +22,7 @@
 #include <ieee754.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 
 /* This implementation relies on double being more than twice as
diff --git a/sysdeps/ieee754/dbl-64/s_llrint.c b/sysdeps/ieee754/dbl-64/s_llrint.c
index 8159706f90..1c5f17a21a 100644
--- a/sysdeps/ieee754/dbl-64/s_llrint.c
+++ b/sysdeps/ieee754/dbl-64/s_llrint.c
@@ -24,6 +24,7 @@
 
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/dbl-64/s_llround.c b/sysdeps/ieee754/dbl-64/s_llround.c
index 1067d19859..6cb03a0d20 100644
--- a/sysdeps/ieee754/dbl-64/s_llround.c
+++ b/sysdeps/ieee754/dbl-64/s_llround.c
@@ -22,6 +22,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/dbl-64/s_lrint.c b/sysdeps/ieee754/dbl-64/s_lrint.c
index 0e64ae1260..9b77403063 100644
--- a/sysdeps/ieee754/dbl-64/s_lrint.c
+++ b/sysdeps/ieee754/dbl-64/s_lrint.c
@@ -24,6 +24,7 @@
 
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/dbl-64/s_lround.c b/sysdeps/ieee754/dbl-64/s_lround.c
index 70f624eea1..44de8df952 100644
--- a/sysdeps/ieee754/dbl-64/s_lround.c
+++ b/sysdeps/ieee754/dbl-64/s_lround.c
@@ -22,6 +22,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/dbl-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/s_nearbyint.c
index 903121d456..4ce570ac7f 100644
--- a/sysdeps/ieee754/dbl-64/s_nearbyint.c
+++ b/sysdeps/ieee754/dbl-64/s_nearbyint.c
@@ -28,6 +28,7 @@ static char rcsid[] = "$NetBSD: s_rint.c,v 1.8 1995/05/10 20:48:04 jtc Exp $";
 #include <math.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 
 static const double
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index b369ac9f5b..db1687edd5 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -41,6 +41,7 @@
 #include "MathLib.h"
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <libm-alias-double.h>
 #include <fenv.h>
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c
index 1d8d44befe..6dc1609fa4 100644
--- a/sysdeps/ieee754/dbl-64/s_sincos.c
+++ b/sysdeps/ieee754/dbl-64/s_sincos.c
@@ -21,6 +21,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <libm-alias-double.h>
 
diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c
index 04ff8b6717..52f275a686 100644
--- a/sysdeps/ieee754/dbl-64/s_tan.c
+++ b/sysdeps/ieee754/dbl-64/s_tan.c
@@ -41,6 +41,7 @@
 #include "MathLib.h"
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <libm-alias-double.h>
 #include <fenv.h>
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
index a88c6c8788..5e77af309e 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
@@ -21,6 +21,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 
 /* For LP64, lround is an alias for llround.  */
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
index a4a081724e..2bb59de30b 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
@@ -24,6 +24,7 @@
 #include <math.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 
 static const double
diff --git a/sysdeps/ieee754/dbl-64/x2y2m1.c b/sysdeps/ieee754/dbl-64/x2y2m1.c
index aa0d9703fa..d55296f8a1 100644
--- a/sysdeps/ieee754/dbl-64/x2y2m1.c
+++ b/sysdeps/ieee754/dbl-64/x2y2m1.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <mul_split.h>
 #include <stdlib.h>
 
diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
index 9dd15601e6..6c90195b6b 100644
--- a/sysdeps/ieee754/float128/float128_private.h
+++ b/sysdeps/ieee754/float128/float128_private.h
@@ -29,6 +29,7 @@
 
 /* Renames derived from math_private.h.  */
 #include <math_private.h>
+#include <fenv_private.h>
 #include <ieee754_float128.h>
 #define ieee854_long_double_shape_type ieee854_float128_shape_type
 #define ieee854_long_double ieee854_float128
diff --git a/sysdeps/ieee754/flt-32/e_gammaf_r.c b/sysdeps/ieee754/flt-32/e_gammaf_r.c
index 8b23add347..ddc268e8fc 100644
--- a/sysdeps/ieee754/flt-32/e_gammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_gammaf_r.c
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c
index 887b5f7d1e..09b2296483 100644
--- a/sysdeps/ieee754/flt-32/e_j1f.c
+++ b/sysdeps/ieee754/flt-32/e_j1f.c
@@ -18,6 +18,7 @@
 #include <math.h>
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 
 static float ponef(float), qonef(float);
diff --git a/sysdeps/ieee754/flt-32/e_jnf.c b/sysdeps/ieee754/flt-32/e_jnf.c
index cd15ed7d4b..e8b9425ee0 100644
--- a/sysdeps/ieee754/flt-32/e_jnf.c
+++ b/sysdeps/ieee754/flt-32/e_jnf.c
@@ -18,6 +18,7 @@
 #include <math.h>
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 
 static const float
diff --git a/sysdeps/ieee754/flt-32/lgamma_negf.c b/sysdeps/ieee754/flt-32/lgamma_negf.c
index 01edb0b8de..7951cde5c7 100644
--- a/sysdeps/ieee754/flt-32/lgamma_negf.c
+++ b/sysdeps/ieee754/flt-32/lgamma_negf.c
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 static const float lgamma_zeros[][2] =
   {
diff --git a/sysdeps/ieee754/flt-32/s_llrintf.c b/sysdeps/ieee754/flt-32/s_llrintf.c
index 7c64bb2db4..c6b39b64df 100644
--- a/sysdeps/ieee754/flt-32/s_llrintf.c
+++ b/sysdeps/ieee754/flt-32/s_llrintf.c
@@ -24,6 +24,7 @@
 
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/flt-32/s_llroundf.c b/sysdeps/ieee754/flt-32/s_llroundf.c
index 5457f9fa88..abbdafbc1d 100644
--- a/sysdeps/ieee754/flt-32/s_llroundf.c
+++ b/sysdeps/ieee754/flt-32/s_llroundf.c
@@ -22,6 +22,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/flt-32/s_lrintf.c b/sysdeps/ieee754/flt-32/s_lrintf.c
index 5171377a4e..c45bdc1858 100644
--- a/sysdeps/ieee754/flt-32/s_lrintf.c
+++ b/sysdeps/ieee754/flt-32/s_lrintf.c
@@ -24,6 +24,7 @@
 
 #include <math-narrow-eval.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/flt-32/s_lroundf.c b/sysdeps/ieee754/flt-32/s_lroundf.c
index 20e7216640..7f18239376 100644
--- a/sysdeps/ieee754/flt-32/s_lroundf.c
+++ b/sysdeps/ieee754/flt-32/s_lroundf.c
@@ -22,6 +22,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c
index 4dfe491f27..acedf34c90 100644
--- a/sysdeps/ieee754/flt-32/s_nearbyintf.c
+++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c
@@ -19,6 +19,7 @@
 #include <math.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 
 static const float
diff --git a/sysdeps/ieee754/k_standardl.c b/sysdeps/ieee754/k_standardl.c
index 58abc22b6e..1368553bf1 100644
--- a/sysdeps/ieee754/k_standardl.c
+++ b/sysdeps/ieee754/k_standardl.c
@@ -33,6 +33,7 @@
 #include <math.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-svid-compat.h>
 #include <fenv.h>
 #include <float.h>
diff --git a/sysdeps/ieee754/ldbl-128/e_expl.c b/sysdeps/ieee754/ldbl-128/e_expl.c
index b4b21c4957..237622d9a8 100644
--- a/sysdeps/ieee754/ldbl-128/e_expl.c
+++ b/sysdeps/ieee754/ldbl-128/e_expl.c
@@ -66,6 +66,7 @@
 #include <inttypes.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <stdlib.h>
 #include "t_expl.h"
diff --git a/sysdeps/ieee754/ldbl-128/e_gammal_r.c b/sysdeps/ieee754/ldbl-128/e_gammal_r.c
index e2730b8fc2..bf3c81ca14 100644
--- a/sysdeps/ieee754/ldbl-128/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-128/e_gammal_r.c
@@ -20,6 +20,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c
index e6f46f52e9..0ef3611473 100644
--- a/sysdeps/ieee754/ldbl-128/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j1l.c
@@ -98,6 +98,7 @@
 #include <errno.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c
index 7739eec291..540b95ca58 100644
--- a/sysdeps/ieee754/ldbl-128/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-128/e_jnl.c
@@ -60,6 +60,7 @@
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 
 static const _Float128
diff --git a/sysdeps/ieee754/ldbl-128/gamma_productl.c b/sysdeps/ieee754/ldbl-128/gamma_productl.c
index 2c1a03a915..8e8d9d331e 100644
--- a/sysdeps/ieee754/ldbl-128/gamma_productl.c
+++ b/sysdeps/ieee754/ldbl-128/gamma_productl.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <mul_splitl.h>
 
 /* Compute the product of X + X_EPS, X + X_EPS + 1, ..., X + X_EPS + N
diff --git a/sysdeps/ieee754/ldbl-128/lgamma_negl.c b/sysdeps/ieee754/ldbl-128/lgamma_negl.c
index f5043719ad..cb64d4b0a9 100644
--- a/sysdeps/ieee754/ldbl-128/lgamma_negl.c
+++ b/sysdeps/ieee754/ldbl-128/lgamma_negl.c
@@ -19,6 +19,7 @@
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 static const _Float128 lgamma_zeros[][2] =
   {
diff --git a/sysdeps/ieee754/ldbl-128/s_fmal.c b/sysdeps/ieee754/ldbl-128/s_fmal.c
index 4eba9253df..8b4875b25d 100644
--- a/sysdeps/ieee754/ldbl-128/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-128/s_fmal.c
@@ -23,6 +23,7 @@
 #include <ieee754.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 #include <tininess.h>
 
diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c
index ce17cf962a..3ea7bcff8a 100644
--- a/sysdeps/ieee754/ldbl-128/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c
@@ -24,6 +24,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/ldbl-128/s_llroundl.c b/sysdeps/ieee754/ldbl-128/s_llroundl.c
index 1973e1bffd..5ab774b375 100644
--- a/sysdeps/ieee754/ldbl-128/s_llroundl.c
+++ b/sysdeps/ieee754/ldbl-128/s_llroundl.c
@@ -23,6 +23,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/ldbl-128/s_lrintl.c b/sysdeps/ieee754/ldbl-128/s_lrintl.c
index c1233a45dc..7d5a5ecc51 100644
--- a/sysdeps/ieee754/ldbl-128/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_lrintl.c
@@ -24,6 +24,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/ldbl-128/s_lroundl.c b/sysdeps/ieee754/ldbl-128/s_lroundl.c
index f109157d67..9aafbea32a 100644
--- a/sysdeps/ieee754/ldbl-128/s_lroundl.c
+++ b/sysdeps/ieee754/ldbl-128/s_lroundl.c
@@ -23,6 +23,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 #include <fix-fp-int-convert-overflow.h>
 
diff --git a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
index f044cb4334..44bd6e1340 100644
--- a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
@@ -27,6 +27,7 @@
 #include <math.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 
 static const _Float128
diff --git a/sysdeps/ieee754/ldbl-128/x2y2m1l.c b/sysdeps/ieee754/ldbl-128/x2y2m1l.c
index 390163fbc4..ee7fa75c43 100644
--- a/sysdeps/ieee754/ldbl-128/x2y2m1l.c
+++ b/sysdeps/ieee754/ldbl-128/x2y2m1l.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <mul_splitl.h>
 #include <stdlib.h>
 
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_expl.c b/sysdeps/ieee754/ldbl-128ibm/e_expl.c
index 16d4205465..a5024559dc 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_expl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_expl.c
@@ -65,6 +65,7 @@
 #include <fenv.h>
 #include <inttypes.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 
 #include "t_expl.h"
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
index 84ea7ee0f5..5d36cf87d2 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
@@ -20,6 +20,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j1l.c b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c
index 5126900f96..fada0c226e 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
index 71b3addfba..208def09c9 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
@@ -60,6 +60,7 @@
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 
 static const long double
diff --git a/sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c b/sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c
index e00f7b9889..c96b641e02 100644
--- a/sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c
@@ -19,6 +19,7 @@
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 static const long double lgamma_zeros[][2] =
   {
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fmal.c b/sysdeps/ieee754/ldbl-128ibm/s_fmal.c
index e72a3e4d59..bc61e9049c 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_fmal.c
@@ -22,6 +22,7 @@
 #include <math.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <math_ldbl_opt.h>
 #include <mul_split.h>
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
index 9d4535103e..174b6db551 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
index de6a7b5be2..c99caec817 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
index 05fe7fefdf..7990cbfa17 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
index bc8dda4c1d..44dc6cf4d1 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
index f003609d95..e356b633dc 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
@@ -24,6 +24,7 @@
 #include <fenv.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
diff --git a/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c b/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c
index e299c48748..0726302958 100644
--- a/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c
+++ b/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <mul_split.h>
 #include <stdlib.h>
 
diff --git a/sysdeps/ieee754/ldbl-96/e_gammal_r.c b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
index fc7a5c55dc..8af9d7ca2b 100644
--- a/sysdeps/ieee754/ldbl-96/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
@@ -19,6 +19,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 #include <float.h>
 
diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c
index 394921f564..fd28f6ae91 100644
--- a/sysdeps/ieee754/ldbl-96/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-96/e_jnl.c
@@ -60,6 +60,7 @@
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <math-underflow.h>
 
 static const long double
diff --git a/sysdeps/ieee754/ldbl-96/gamma_productl.c b/sysdeps/ieee754/ldbl-96/gamma_productl.c
index ed0c166d78..6b34d293e0 100644
--- a/sysdeps/ieee754/ldbl-96/gamma_productl.c
+++ b/sysdeps/ieee754/ldbl-96/gamma_productl.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <mul_splitl.h>
 
 /* Compute the product of X + X_EPS, X + X_EPS + 1, ..., X + X_EPS + N
diff --git a/sysdeps/ieee754/ldbl-96/lgamma_negl.c b/sysdeps/ieee754/ldbl-96/lgamma_negl.c
index 6d2e0b7165..90bb8345a0 100644
--- a/sysdeps/ieee754/ldbl-96/lgamma_negl.c
+++ b/sysdeps/ieee754/ldbl-96/lgamma_negl.c
@@ -19,6 +19,7 @@
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 static const long double lgamma_zeros[][2] =
   {
diff --git a/sysdeps/ieee754/ldbl-96/s_fma.c b/sysdeps/ieee754/ldbl-96/s_fma.c
index 986879cda5..736db65d10 100644
--- a/sysdeps/ieee754/ldbl-96/s_fma.c
+++ b/sysdeps/ieee754/ldbl-96/s_fma.c
@@ -23,6 +23,7 @@
 #include <ieee754.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 
 /* This implementation uses rounding to odd to avoid problems with
diff --git a/sysdeps/ieee754/ldbl-96/s_fmal.c b/sysdeps/ieee754/ldbl-96/s_fmal.c
index 0b261fd17a..5129e84954 100644
--- a/sysdeps/ieee754/ldbl-96/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-96/s_fmal.c
@@ -23,6 +23,7 @@
 #include <ieee754.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 #include <tininess.h>
 
diff --git a/sysdeps/ieee754/ldbl-96/s_llrintl.c b/sysdeps/ieee754/ldbl-96/s_llrintl.c
index d45a69a1f7..58571e973e 100644
--- a/sysdeps/ieee754/ldbl-96/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-96/s_llrintl.c
@@ -23,6 +23,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 
 static const long double two63[2] =
diff --git a/sysdeps/ieee754/ldbl-96/s_llroundl.c b/sysdeps/ieee754/ldbl-96/s_llroundl.c
index 601fd0e644..3c4597f8ee 100644
--- a/sysdeps/ieee754/ldbl-96/s_llroundl.c
+++ b/sysdeps/ieee754/ldbl-96/s_llroundl.c
@@ -22,6 +22,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 
 
diff --git a/sysdeps/ieee754/ldbl-96/s_lrintl.c b/sysdeps/ieee754/ldbl-96/s_lrintl.c
index df3222c7f2..42b9303b3d 100644
--- a/sysdeps/ieee754/ldbl-96/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-96/s_lrintl.c
@@ -23,6 +23,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 
 static const long double two63[2] =
diff --git a/sysdeps/ieee754/ldbl-96/s_lroundl.c b/sysdeps/ieee754/ldbl-96/s_lroundl.c
index 0cc9f9c5d6..aead3aadb7 100644
--- a/sysdeps/ieee754/ldbl-96/s_lroundl.c
+++ b/sysdeps/ieee754/ldbl-96/s_lroundl.c
@@ -22,6 +22,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 
 
diff --git a/sysdeps/ieee754/ldbl-96/x2y2m1l.c b/sysdeps/ieee754/ldbl-96/x2y2m1l.c
index 392830c1b0..a63cd67f5c 100644
--- a/sysdeps/ieee754/ldbl-96/x2y2m1l.c
+++ b/sysdeps/ieee754/ldbl-96/x2y2m1l.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <mul_splitl.h>
 #include <stdlib.h>
 
diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c
index 7dfb609565..a8bf2001a6 100644
--- a/sysdeps/powerpc/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/fpu/e_sqrt.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <fenv_libc.h>
 #include <inttypes.h>
 #include <stdint.h>
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c
index be934c26a1..c12b15b3cc 100644
--- a/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <fenv_libc.h>
 #include <inttypes.h>
 #include <stdint.h>
diff --git a/sysdeps/riscv/rv64/rvd/s_ceil.c b/sysdeps/riscv/rv64/rvd/s_ceil.c
index af99ecca3d..30caa96869 100644
--- a/sysdeps/riscv/rv64/rvd/s_ceil.c
+++ b/sysdeps/riscv/rv64/rvd/s_ceil.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rv64/rvd/s_floor.c b/sysdeps/riscv/rv64/rvd/s_floor.c
index f34af98cce..da3b11cdb4 100644
--- a/sysdeps/riscv/rv64/rvd/s_floor.c
+++ b/sysdeps/riscv/rv64/rvd/s_floor.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rv64/rvd/s_nearbyint.c b/sysdeps/riscv/rv64/rvd/s_nearbyint.c
index e17f038429..c99fa83e38 100644
--- a/sysdeps/riscv/rv64/rvd/s_nearbyint.c
+++ b/sysdeps/riscv/rv64/rvd/s_nearbyint.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rv64/rvd/s_round.c b/sysdeps/riscv/rv64/rvd/s_round.c
index 22cff63e09..b3e5bc4f0d 100644
--- a/sysdeps/riscv/rv64/rvd/s_round.c
+++ b/sysdeps/riscv/rv64/rvd/s_round.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rv64/rvd/s_roundeven.c b/sysdeps/riscv/rv64/rvd/s_roundeven.c
index 26a0b2ded3..484eb81888 100644
--- a/sysdeps/riscv/rv64/rvd/s_roundeven.c
+++ b/sysdeps/riscv/rv64/rvd/s_roundeven.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rv64/rvd/s_trunc.c b/sysdeps/riscv/rv64/rvd/s_trunc.c
index a0f78e6cd1..ec28090ca0 100644
--- a/sysdeps/riscv/rv64/rvd/s_trunc.c
+++ b/sysdeps/riscv/rv64/rvd/s_trunc.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rvd/s_finite.c b/sysdeps/riscv/rvd/s_finite.c
index 402ae3fa3a..3f45e99aa7 100644
--- a/sysdeps/riscv/rvd/s_finite.c
+++ b/sysdeps/riscv/rvd/s_finite.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __finite (double x)
diff --git a/sysdeps/riscv/rvd/s_fmax.c b/sysdeps/riscv/rvd/s_fmax.c
index 22e91bfc4b..29b278d097 100644
--- a/sysdeps/riscv/rvd/s_fmax.c
+++ b/sysdeps/riscv/rvd/s_fmax.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 
 double
diff --git a/sysdeps/riscv/rvd/s_fmin.c b/sysdeps/riscv/rvd/s_fmin.c
index 7b35230cac..e153b87c37 100644
--- a/sysdeps/riscv/rvd/s_fmin.c
+++ b/sysdeps/riscv/rvd/s_fmin.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-double.h>
 
 double
diff --git a/sysdeps/riscv/rvd/s_fpclassify.c b/sysdeps/riscv/rvd/s_fpclassify.c
index fe693c2f4a..c7621f1f8c 100644
--- a/sysdeps/riscv/rvd/s_fpclassify.c
+++ b/sysdeps/riscv/rvd/s_fpclassify.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __fpclassify (double x)
diff --git a/sysdeps/riscv/rvd/s_isinf.c b/sysdeps/riscv/rvd/s_isinf.c
index 1b9767a718..48c9ba3767 100644
--- a/sysdeps/riscv/rvd/s_isinf.c
+++ b/sysdeps/riscv/rvd/s_isinf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __isinf (double x)
diff --git a/sysdeps/riscv/rvd/s_isnan.c b/sysdeps/riscv/rvd/s_isnan.c
index 3739de7ec7..0fc24df08e 100644
--- a/sysdeps/riscv/rvd/s_isnan.c
+++ b/sysdeps/riscv/rvd/s_isnan.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __isnan (double x)
diff --git a/sysdeps/riscv/rvd/s_issignaling.c b/sysdeps/riscv/rvd/s_issignaling.c
index 1b65206e9a..aca3387df7 100644
--- a/sysdeps/riscv/rvd/s_issignaling.c
+++ b/sysdeps/riscv/rvd/s_issignaling.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __issignaling (double x)
diff --git a/sysdeps/riscv/rvf/fegetround.c b/sysdeps/riscv/rvf/fegetround.c
index f7692a827b..05397b10e7 100644
--- a/sysdeps/riscv/rvf/fegetround.c
+++ b/sysdeps/riscv/rvf/fegetround.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __fegetround (void)
diff --git a/sysdeps/riscv/rvf/feholdexcpt.c b/sysdeps/riscv/rvf/feholdexcpt.c
index ea9060f3dc..96ac46583c 100644
--- a/sysdeps/riscv/rvf/feholdexcpt.c
+++ b/sysdeps/riscv/rvf/feholdexcpt.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __feholdexcept (fenv_t *envp)
diff --git a/sysdeps/riscv/rvf/fesetenv.c b/sysdeps/riscv/rvf/fesetenv.c
index 5d02d80101..95ca4fe97b 100644
--- a/sysdeps/riscv/rvf/fesetenv.c
+++ b/sysdeps/riscv/rvf/fesetenv.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __fesetenv (const fenv_t *envp)
diff --git a/sysdeps/riscv/rvf/fesetround.c b/sysdeps/riscv/rvf/fesetround.c
index bf705ef0c9..5bb237a365 100644
--- a/sysdeps/riscv/rvf/fesetround.c
+++ b/sysdeps/riscv/rvf/fesetround.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __fesetround (int round)
diff --git a/sysdeps/riscv/rvf/feupdateenv.c b/sysdeps/riscv/rvf/feupdateenv.c
index 133d7eca11..27ffa7716b 100644
--- a/sysdeps/riscv/rvf/feupdateenv.c
+++ b/sysdeps/riscv/rvf/feupdateenv.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __feupdateenv (const fenv_t *envp)
diff --git a/sysdeps/riscv/rvf/fgetexcptflg.c b/sysdeps/riscv/rvf/fgetexcptflg.c
index 367f0135d4..f4742693af 100644
--- a/sysdeps/riscv/rvf/fgetexcptflg.c
+++ b/sysdeps/riscv/rvf/fgetexcptflg.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 fegetexceptflag (fexcept_t *flagp, int excepts)
diff --git a/sysdeps/riscv/rvf/ftestexcept.c b/sysdeps/riscv/rvf/ftestexcept.c
index a248bd6319..66bc9f9c5b 100644
--- a/sysdeps/riscv/rvf/ftestexcept.c
+++ b/sysdeps/riscv/rvf/ftestexcept.c
@@ -18,6 +18,7 @@
 
 #include <fenv.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 fetestexcept (int excepts)
diff --git a/sysdeps/riscv/rvf/s_ceilf.c b/sysdeps/riscv/rvf/s_ceilf.c
index d7e291acf8..a56f362610 100644
--- a/sysdeps/riscv/rvf/s_ceilf.c
+++ b/sysdeps/riscv/rvf/s_ceilf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rvf/s_finitef.c b/sysdeps/riscv/rvf/s_finitef.c
index 04ce08719b..4fd33b6ebb 100644
--- a/sysdeps/riscv/rvf/s_finitef.c
+++ b/sysdeps/riscv/rvf/s_finitef.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __finitef (float x)
diff --git a/sysdeps/riscv/rvf/s_floorf.c b/sysdeps/riscv/rvf/s_floorf.c
index 3c9c625e2f..560553ffba 100644
--- a/sysdeps/riscv/rvf/s_floorf.c
+++ b/sysdeps/riscv/rvf/s_floorf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rvf/s_fmaxf.c b/sysdeps/riscv/rvf/s_fmaxf.c
index 63f7e3d664..0496f7ed9d 100644
--- a/sysdeps/riscv/rvf/s_fmaxf.c
+++ b/sysdeps/riscv/rvf/s_fmaxf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 
 float
diff --git a/sysdeps/riscv/rvf/s_fminf.c b/sysdeps/riscv/rvf/s_fminf.c
index 82cca4e37d..f9639935c2 100644
--- a/sysdeps/riscv/rvf/s_fminf.c
+++ b/sysdeps/riscv/rvf/s_fminf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 
 float
diff --git a/sysdeps/riscv/rvf/s_fpclassifyf.c b/sysdeps/riscv/rvf/s_fpclassifyf.c
index 4abcf3edac..ae4c492362 100644
--- a/sysdeps/riscv/rvf/s_fpclassifyf.c
+++ b/sysdeps/riscv/rvf/s_fpclassifyf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __fpclassifyf (float x)
diff --git a/sysdeps/riscv/rvf/s_isinff.c b/sysdeps/riscv/rvf/s_isinff.c
index 1c7413190c..621cdca5db 100644
--- a/sysdeps/riscv/rvf/s_isinff.c
+++ b/sysdeps/riscv/rvf/s_isinff.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __isinff (float x)
diff --git a/sysdeps/riscv/rvf/s_isnanf.c b/sysdeps/riscv/rvf/s_isnanf.c
index 30a88bb23c..cca3809b70 100644
--- a/sysdeps/riscv/rvf/s_isnanf.c
+++ b/sysdeps/riscv/rvf/s_isnanf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __isnanf (float x)
diff --git a/sysdeps/riscv/rvf/s_issignalingf.c b/sysdeps/riscv/rvf/s_issignalingf.c
index e67efc794b..846a7b75d2 100644
--- a/sysdeps/riscv/rvf/s_issignalingf.c
+++ b/sysdeps/riscv/rvf/s_issignalingf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 
 int
 __issignalingf (float x)
diff --git a/sysdeps/riscv/rvf/s_nearbyintf.c b/sysdeps/riscv/rvf/s_nearbyintf.c
index d653794d71..80ff8a8b88 100644
--- a/sysdeps/riscv/rvf/s_nearbyintf.c
+++ b/sysdeps/riscv/rvf/s_nearbyintf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rvf/s_roundevenf.c b/sysdeps/riscv/rvf/s_roundevenf.c
index 48086c28ee..afeebf2c66 100644
--- a/sysdeps/riscv/rvf/s_roundevenf.c
+++ b/sysdeps/riscv/rvf/s_roundevenf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rvf/s_roundf.c b/sysdeps/riscv/rvf/s_roundf.c
index dedf57cbb3..87839de3fb 100644
--- a/sysdeps/riscv/rvf/s_roundf.c
+++ b/sysdeps/riscv/rvf/s_roundf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <stdint.h>
 
diff --git a/sysdeps/riscv/rvf/s_truncf.c b/sysdeps/riscv/rvf/s_truncf.c
index e23926a2ae..ad5c2e217c 100644
--- a/sysdeps/riscv/rvf/s_truncf.c
+++ b/sysdeps/riscv/rvf/s_truncf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-float.h>
 #include <stdint.h>
 
