aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-08-21 17:45:10 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-08-21 17:45:10 +0000
commit813378e9fe17e029caf627cab76fe23eb46815fa (patch)
treed5dff36004e083dee3b77b25d93ade581ca89e6d
parent4504783c0f65b7074204c6126c6255ed89d6594e (diff)
downloadglibc-813378e9fe17e029caf627cab76fe23eb46815fa.zip
glibc-813378e9fe17e029caf627cab76fe23eb46815fa.tar.gz
glibc-813378e9fe17e029caf627cab76fe23eb46815fa.tar.bz2
Obsolete matherr, _LIB_VERSION, libieee.a.
This patch obsoletes support for SVID libm error handling (the system where a user-defined function matherr is called on a libm function error; only enabled if you also set _LIB_VERSION = _SVID_ or _LIB_VERSION = _XOPEN_) and the use of the _LIB_VERSION global variable to control libm error handling. matherr and _LIB_VERSION are made into compat symbols, not supported for new ports or for static linking. The libieee.a object file (which sets _LIB_VERSION = _IEEE_, so disabling errno setting for some functions) is also removed, and all the related definitions are removed from math.h. The manual already recommends against using matherr, and it's already not supported for _Float128 functions (those use new wrappers that don't support matherr, only errno) - this patch means that it becomes possible to e.g. add sinf32 as an alias to sinf without that resulting in undesired matherr support in sinf32 for existing glibc ports. matherr support is not part of any standard supported by glibc (it was removed in XPG4). Because matherr is a function to be defined by the user, of course user programs defining such a function will still continue to link; it just quietly won't be used. If they try to write to the library's copy of _LIB_VERSION to enable SVID error handling, however, they will get a link error (but if they define their own _LIB_VERSION variable, they won't). I expect the most likely case of build failures from this patch to be programs with unconditional cargo-culted uses of -lieee (based on a notion of "I want IEEE floating point", not any actual requirement for that library). Ideally, the new-port-or-static-linking case would use the new wrappers used for _Float128. This is not implemented in this patch, because of the complication of architecture-specific (powerpc32 and sparc) sqrt wrappers that use _LIB_VERSION and __kernel_standard directly. Thus, the old wrappers and __kernel_standard are still built unconditionally, and _LIB_VERSION still exists in static libm. But when the old wrappers and __kernel_standard are built in the non-compat case, _LIB_VERSION and matherr are defined as macros so code to support those features isn't actually built into static libm or new ports' shared libm after this patch. I intend to move to the new wrappers for static libm and new ports in followup patches. I believe the sqrt wrappers for powerpc32 and sparc can reasonably be removed. GCC already optimizes the normal case of sqrt by generating code that uses a hardware instruction and only calls the sqrt function if the argument was negative (if -fno-math-errno, of course, it just uses the hardware instruction without any check for negative argument being needed). Thus those wrappers will only actually get called in the case of negative arguments, which is not a case it makes sense to optimize for. But even without removing the powerpc32 and sparc wrappers it should still be possible to move to the new wrappers for static libm and new ports, just without having those dubious architecture-specific optimizations in static libm. Everything said about matherr equally applies to matherrf and matherrl (IA64-specific, undocumented), except that the structure of IA64 libm means it won't be converted to using the new wrappers (it doesn't use the old ones either, but its own error-handling code instead). As with other tests of compat symbols, I expect test-matherr and test-matherr-2 to need to become appropriately conditional once we have a system for disabling such tests for ports too new to have the relevant symbols. Tested for x86_64 and x86, and with build-many-glibcs.py. * math/math.h [__USE_MISC] (_LIB_VERSION_TYPE): Remove. [__USE_MISC] (_LIB_VERSION): Likewise. [__USE_MISC] (struct exception): Likewise. [__USE_MISC] (matherr): Likewise. [__USE_MISC] (DOMAIN): Likewise. [__USE_MISC] (SING): Likewise. [__USE_MISC] (OVERFLOW): Likewise. [__USE_MISC] (UNDERFLOW): Likewise. [__USE_MISC] (TLOSS): Likewise. [__USE_MISC] (PLOSS): Likewise. [__USE_MISC] (HUGE): Likewise. [__USE_XOPEN] (MAXFLOAT): Define even if [__USE_MISC]. * math/math-svid-compat.h: New file. * conform/linknamespace.pl (@whitelist): Remove matherr, matherrf and matherrl. * include/math.h [!_ISOMAC] (__matherr): Remove. * manual/arith.texi (FP Exceptions): Do not document matherr. * math/Makefile (tests): Change test-matherr to test-matherr-3. (tests-internal): New variable. (install-lib): Do not add libieee.a. (non-lib.a): Likewise. (extra-objs): Do not add libieee.a and ieee-math.o. (CPPFLAGS-s_lib_version.c): Remove variable. ($(objpfx)libieee.a): Remove rule. ($(addprefix $(objpfx), $(tests-internal)): Depend on $(libm). * math/ieee-math.c: Remove. * math/libm-test-support.c (matherr): Remove. * math/test-matherr.c: Use <support/test-driver.c>. Add copyright and license notices. Include <math-svid-compat.h> and <shlib-compat.h>. (matherr): Undefine as macro. Use compat_symbol_reference. (_LIB_VERSION): Likewise. * math/test-matherr-2.c: New file. * math/test-matherr-3.c: Likewise. * sysdeps/generic/math_private.h (__kernel_standard): Remove declaration. (__kernel_standard_f): Likewise. (__kernel_standard_l): Likewise. * sysdeps/ieee754/s_lib_version.c: Do not include <math.h> or <math_private.h>. Include <math-svid-compat.h>. (_LIB_VERSION): Undefine as macro. (_LIB_VERSION_INTERNAL): Always initialize to _POSIX_. Define only if [LIBM_SVID_COMPAT || !defined SHARED]. If [LIBM_SVID_COMPAT], use compat_symbol. * sysdeps/ieee754/s_matherr.c: Do not include <math.h> or <math_private.h>. Include <math-svid-compat.h>. (matherr): Undefine as macro. (__matherr): Define only if [LIBM_SVID_COMPAT]. Use compat_symbol. * sysdeps/ia64/fpu/libm_error.c: Include <math-svid-compat.h>. [_LIBC && LIBM_SVID_COMPAT] (matherrf): Use compat_symbol_reference. [_LIBC && LIBM_SVID_COMPAT] (matherrl): Likewise. [_LIBC && !LIBM_SVID_COMPAT] (matherrf): Define as macro. [_LIBC && !LIBM_SVID_COMPAT] (matherrl): Likewise. * sysdeps/ia64/fpu/libm_support.h: Include <math-svid-compat.h>. (MATHERR_D): Remove declaration. [!_LIBC] (_LIB_VERSION_TYPE): Likewise [!LIBM_BUILD] (_LIB_VERSIONIMF): Likewise. [LIBM_BUILD] (pmatherrf): Likewise. [LIBM_BUILD] (pmatherr): Likewise. [LIBM_BUILD] (pmatherrl): Likewise. (DOMAIN): Likewise. (SING): Likewise. (OVERFLOW): Likewise. (UNDERFLOW): Likewise. (TLOSS): Likewise. (PLOSS): Likewise. * sysdeps/ia64/fpu/s_matherrf.c: Include <math-svid-compat.h>. (__matherrf): Define only if [LIBM_SVID_COMPAT]. Use compat_symbol. * sysdeps/ia64/fpu/s_matherrl.c: Include <math-svid-compat.h>. (__matherrl): Define only if [LIBM_SVID_COMPAT]. Use compat_symbol. * math/lgamma-compat.h: Include <math-svid-compat.h>. * math/w_acos_compat.c: Likewise. * math/w_acosf_compat.c: Likewise. * math/w_acosh_compat.c: Likewise. * math/w_acoshf_compat.c: Likewise. * math/w_acoshl_compat.c: Likewise. * math/w_acosl_compat.c: Likewise. * math/w_asin_compat.c: Likewise. * math/w_asinf_compat.c: Likewise. * math/w_asinl_compat.c: Likewise. * math/w_atan2_compat.c: Likewise. * math/w_atan2f_compat.c: Likewise. * math/w_atan2l_compat.c: Likewise. * math/w_atanh_compat.c: Likewise. * math/w_atanhf_compat.c: Likewise. * math/w_atanhl_compat.c: Likewise. * math/w_cosh_compat.c: Likewise. * math/w_coshf_compat.c: Likewise. * math/w_coshl_compat.c: Likewise. * math/w_exp10_compat.c: Likewise. * math/w_exp10f_compat.c: Likewise. * math/w_exp10l_compat.c: Likewise. * math/w_exp2_compat.c: Likewise. * math/w_exp2f_compat.c: Likewise. * math/w_exp2l_compat.c: Likewise. * math/w_fmod_compat.c: Likewise. * math/w_fmodf_compat.c: Likewise. * math/w_fmodl_compat.c: Likewise. * math/w_hypot_compat.c: Likewise. * math/w_hypotf_compat.c: Likewise. * math/w_hypotl_compat.c: Likewise. * math/w_j0_compat.c: Likewise. * math/w_j0f_compat.c: Likewise. * math/w_j0l_compat.c: Likewise. * math/w_j1_compat.c: Likewise. * math/w_j1f_compat.c: Likewise. * math/w_j1l_compat.c: Likewise. * math/w_jn_compat.c: Likewise. * math/w_jnf_compat.c: Likewise. * math/w_jnl_compat.c: Likewise. * math/w_lgamma_main.c: Likewise. * math/w_lgamma_r_compat.c: Likewise. * math/w_lgammaf_main.c: Likewise. * math/w_lgammaf_r_compat.c: Likewise. * math/w_lgammal_main.c: Likewise. * math/w_lgammal_r_compat.c: Likewise. * math/w_log10_compat.c: Likewise. * math/w_log10f_compat.c: Likewise. * math/w_log10l_compat.c: Likewise. * math/w_log2_compat.c: Likewise. * math/w_log2f_compat.c: Likewise. * math/w_log2l_compat.c: Likewise. * math/w_log_compat.c: Likewise. * math/w_logf_compat.c: Likewise. * math/w_logl_compat.c: Likewise. * math/w_pow_compat.c: Likewise. * math/w_powf_compat.c: Likewise. * math/w_powl_compat.c: Likewise. * math/w_remainder_compat.c: Likewise. * math/w_remainderf_compat.c: Likewise. * math/w_remainderl_compat.c: Likewise. * math/w_scalb_compat.c: Likewise. * math/w_scalbf_compat.c: Likewise. * math/w_scalbl_compat.c: Likewise. * math/w_sinh_compat.c: Likewise. * math/w_sinhf_compat.c: Likewise. * math/w_sinhl_compat.c: Likewise. * math/w_sqrt_compat.c: Likewise. * math/w_sqrtf_compat.c: Likewise. * math/w_sqrtl_compat.c: Likewise. * math/w_tgamma_compat.c: Likewise. * math/w_tgammaf_compat.c: Likewise. * math/w_tgammal_compat.c: Likewise. * sysdeps/ieee754/dbl-64/w_exp_compat.c: Likewise. * sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise. * sysdeps/ieee754/k_standard.c: Likewise. * sysdeps/ieee754/k_standardf.c: Likewise. * sysdeps/ieee754/k_standardl.c: Likewise. * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise. * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S: Likewise. * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S: Likewise. * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S: Likewise. * sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Likewise. * sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S: Likewise. * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise. * sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise. * sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
-rw-r--r--ChangeLog172
-rw-r--r--NEWS8
-rw-r--r--conform/linknamespace.pl8
-rw-r--r--include/math.h2
-rw-r--r--manual/arith.texi8
-rw-r--r--math/Makefile23
-rw-r--r--math/ieee-math.c6
-rw-r--r--math/lgamma-compat.h1
-rw-r--r--math/libm-test-support.c7
-rw-r--r--math/math-svid-compat.h90
-rw-r--r--math/math.h66
-rw-r--r--math/test-matherr-2.c49
-rw-r--r--math/test-matherr-3.c44
-rw-r--r--math/test-matherr.c28
-rw-r--r--math/w_acos_compat.c1
-rw-r--r--math/w_acosf_compat.c1
-rw-r--r--math/w_acosh_compat.c1
-rw-r--r--math/w_acoshf_compat.c1
-rw-r--r--math/w_acoshl_compat.c1
-rw-r--r--math/w_acosl_compat.c1
-rw-r--r--math/w_asin_compat.c1
-rw-r--r--math/w_asinf_compat.c1
-rw-r--r--math/w_asinl_compat.c1
-rw-r--r--math/w_atan2_compat.c1
-rw-r--r--math/w_atan2f_compat.c1
-rw-r--r--math/w_atan2l_compat.c1
-rw-r--r--math/w_atanh_compat.c1
-rw-r--r--math/w_atanhf_compat.c1
-rw-r--r--math/w_atanhl_compat.c1
-rw-r--r--math/w_cosh_compat.c1
-rw-r--r--math/w_coshf_compat.c1
-rw-r--r--math/w_coshl_compat.c1
-rw-r--r--math/w_exp10_compat.c1
-rw-r--r--math/w_exp10f_compat.c1
-rw-r--r--math/w_exp10l_compat.c1
-rw-r--r--math/w_exp2_compat.c1
-rw-r--r--math/w_exp2f_compat.c1
-rw-r--r--math/w_exp2l_compat.c1
-rw-r--r--math/w_fmod_compat.c1
-rw-r--r--math/w_fmodf_compat.c1
-rw-r--r--math/w_fmodl_compat.c1
-rw-r--r--math/w_hypot_compat.c1
-rw-r--r--math/w_hypotf_compat.c1
-rw-r--r--math/w_hypotl_compat.c1
-rw-r--r--math/w_j0_compat.c1
-rw-r--r--math/w_j0f_compat.c1
-rw-r--r--math/w_j0l_compat.c1
-rw-r--r--math/w_j1_compat.c1
-rw-r--r--math/w_j1f_compat.c1
-rw-r--r--math/w_j1l_compat.c1
-rw-r--r--math/w_jn_compat.c1
-rw-r--r--math/w_jnf_compat.c1
-rw-r--r--math/w_jnl_compat.c1
-rw-r--r--math/w_lgamma_main.c1
-rw-r--r--math/w_lgamma_r_compat.c1
-rw-r--r--math/w_lgammaf_main.c1
-rw-r--r--math/w_lgammaf_r_compat.c1
-rw-r--r--math/w_lgammal_main.c1
-rw-r--r--math/w_lgammal_r_compat.c1
-rw-r--r--math/w_log10_compat.c1
-rw-r--r--math/w_log10f_compat.c1
-rw-r--r--math/w_log10l_compat.c1
-rw-r--r--math/w_log2_compat.c1
-rw-r--r--math/w_log2f_compat.c1
-rw-r--r--math/w_log2l_compat.c1
-rw-r--r--math/w_log_compat.c1
-rw-r--r--math/w_logf_compat.c1
-rw-r--r--math/w_logl_compat.c1
-rw-r--r--math/w_pow_compat.c1
-rw-r--r--math/w_powf_compat.c1
-rw-r--r--math/w_powl_compat.c1
-rw-r--r--math/w_remainder_compat.c2
-rw-r--r--math/w_remainderf_compat.c2
-rw-r--r--math/w_remainderl_compat.c2
-rw-r--r--math/w_scalb_compat.c1
-rw-r--r--math/w_scalbf_compat.c1
-rw-r--r--math/w_scalbl_compat.c1
-rw-r--r--math/w_sinh_compat.c1
-rw-r--r--math/w_sinhf_compat.c1
-rw-r--r--math/w_sinhl_compat.c1
-rw-r--r--math/w_sqrt_compat.c1
-rw-r--r--math/w_sqrtf_compat.c1
-rw-r--r--math/w_sqrtl_compat.c1
-rw-r--r--math/w_tgamma_compat.c1
-rw-r--r--math/w_tgammaf_compat.c1
-rw-r--r--math/w_tgammal_compat.c1
-rw-r--r--sysdeps/generic/math_private.h5
-rw-r--r--sysdeps/ia64/fpu/libm_error.c8
-rw-r--r--sysdeps/ia64/fpu/libm_support.h39
-rw-r--r--sysdeps/ia64/fpu/s_matherrf.c5
-rw-r--r--sysdeps/ia64/fpu/s_matherrl.c5
-rw-r--r--sysdeps/ieee754/dbl-64/w_exp_compat.c1
-rw-r--r--sysdeps/ieee754/flt-32/w_expf_compat.c1
-rw-r--r--sysdeps/ieee754/k_standard.c1
-rw-r--r--sysdeps/ieee754/k_standardf.c1
-rw-r--r--sysdeps/ieee754/k_standardl.c1
-rw-r--r--sysdeps/ieee754/ldbl-128/w_expl_compat.c1
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c1
-rw-r--r--sysdeps/ieee754/ldbl-96/w_expl_compat.c1
-rw-r--r--sysdeps/ieee754/s_lib_version.c22
-rw-r--r--sysdeps/ieee754/s_matherr.c8
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S1
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S1
-rw-r--r--sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S1
-rw-r--r--sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S1
-rw-r--r--sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S1
-rw-r--r--sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S1
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S1
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S1
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S1
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S1
-rw-r--r--sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S1
-rw-r--r--sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S1
113 files changed, 524 insertions, 175 deletions
diff --git a/ChangeLog b/ChangeLog
index 768f235..f1a1e0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,175 @@
+2017-08-21 Joseph Myers <joseph@codesourcery.com>
+
+ * math/math.h [__USE_MISC] (_LIB_VERSION_TYPE): Remove.
+ [__USE_MISC] (_LIB_VERSION): Likewise.
+ [__USE_MISC] (struct exception): Likewise.
+ [__USE_MISC] (matherr): Likewise.
+ [__USE_MISC] (DOMAIN): Likewise.
+ [__USE_MISC] (SING): Likewise.
+ [__USE_MISC] (OVERFLOW): Likewise.
+ [__USE_MISC] (UNDERFLOW): Likewise.
+ [__USE_MISC] (TLOSS): Likewise.
+ [__USE_MISC] (PLOSS): Likewise.
+ [__USE_MISC] (HUGE): Likewise.
+ [__USE_XOPEN] (MAXFLOAT): Define even if [__USE_MISC].
+ * math/math-svid-compat.h: New file.
+ * conform/linknamespace.pl (@whitelist): Remove matherr, matherrf
+ and matherrl.
+ * include/math.h [!_ISOMAC] (__matherr): Remove.
+ * manual/arith.texi (FP Exceptions): Do not document matherr.
+ * math/Makefile (tests): Change test-matherr to test-matherr-3.
+ (tests-internal): New variable.
+ (install-lib): Do not add libieee.a.
+ (non-lib.a): Likewise.
+ (extra-objs): Do not add libieee.a and ieee-math.o.
+ (CPPFLAGS-s_lib_version.c): Remove variable.
+ ($(objpfx)libieee.a): Remove rule.
+ ($(addprefix $(objpfx), $(tests-internal)): Depend on $(libm).
+ * math/ieee-math.c: Remove.
+ * math/libm-test-support.c (matherr): Remove.
+ * math/test-matherr.c: Use <support/test-driver.c>. Add copyright
+ and license notices. Include <math-svid-compat.h> and
+ <shlib-compat.h>.
+ (matherr): Undefine as macro. Use compat_symbol_reference.
+ (_LIB_VERSION): Likewise.
+ * math/test-matherr-2.c: New file.
+ * math/test-matherr-3.c: Likewise.
+ * sysdeps/generic/math_private.h (__kernel_standard): Remove
+ declaration.
+ (__kernel_standard_f): Likewise.
+ (__kernel_standard_l): Likewise.
+ * sysdeps/ieee754/s_lib_version.c: Do not include <math.h> or
+ <math_private.h>. Include <math-svid-compat.h>.
+ (_LIB_VERSION): Undefine as macro.
+ (_LIB_VERSION_INTERNAL): Always initialize to _POSIX_. Define
+ only if [LIBM_SVID_COMPAT || !defined SHARED]. If
+ [LIBM_SVID_COMPAT], use compat_symbol.
+ * sysdeps/ieee754/s_matherr.c: Do not include <math.h> or
+ <math_private.h>. Include <math-svid-compat.h>.
+ (matherr): Undefine as macro.
+ (__matherr): Define only if [LIBM_SVID_COMPAT]. Use
+ compat_symbol.
+ * sysdeps/ia64/fpu/libm_error.c: Include <math-svid-compat.h>.
+ [_LIBC && LIBM_SVID_COMPAT] (matherrf): Use
+ compat_symbol_reference.
+ [_LIBC && LIBM_SVID_COMPAT] (matherrl): Likewise.
+ [_LIBC && !LIBM_SVID_COMPAT] (matherrf): Define as macro.
+ [_LIBC && !LIBM_SVID_COMPAT] (matherrl): Likewise.
+ * sysdeps/ia64/fpu/libm_support.h: Include <math-svid-compat.h>.
+ (MATHERR_D): Remove declaration.
+ [!_LIBC] (_LIB_VERSION_TYPE): Likewise
+ [!LIBM_BUILD] (_LIB_VERSIONIMF): Likewise.
+ [LIBM_BUILD] (pmatherrf): Likewise.
+ [LIBM_BUILD] (pmatherr): Likewise.
+ [LIBM_BUILD] (pmatherrl): Likewise.
+ (DOMAIN): Likewise.
+ (SING): Likewise.
+ (OVERFLOW): Likewise.
+ (UNDERFLOW): Likewise.
+ (TLOSS): Likewise.
+ (PLOSS): Likewise.
+ * sysdeps/ia64/fpu/s_matherrf.c: Include <math-svid-compat.h>.
+ (__matherrf): Define only if [LIBM_SVID_COMPAT]. Use
+ compat_symbol.
+ * sysdeps/ia64/fpu/s_matherrl.c: Include <math-svid-compat.h>.
+ (__matherrl): Define only if [LIBM_SVID_COMPAT]. Use
+ compat_symbol.
+ * math/lgamma-compat.h: Include <math-svid-compat.h>.
+ * math/w_acos_compat.c: Likewise.
+ * math/w_acosf_compat.c: Likewise.
+ * math/w_acosh_compat.c: Likewise.
+ * math/w_acoshf_compat.c: Likewise.
+ * math/w_acoshl_compat.c: Likewise.
+ * math/w_acosl_compat.c: Likewise.
+ * math/w_asin_compat.c: Likewise.
+ * math/w_asinf_compat.c: Likewise.
+ * math/w_asinl_compat.c: Likewise.
+ * math/w_atan2_compat.c: Likewise.
+ * math/w_atan2f_compat.c: Likewise.
+ * math/w_atan2l_compat.c: Likewise.
+ * math/w_atanh_compat.c: Likewise.
+ * math/w_atanhf_compat.c: Likewise.
+ * math/w_atanhl_compat.c: Likewise.
+ * math/w_cosh_compat.c: Likewise.
+ * math/w_coshf_compat.c: Likewise.
+ * math/w_coshl_compat.c: Likewise.
+ * math/w_exp10_compat.c: Likewise.
+ * math/w_exp10f_compat.c: Likewise.
+ * math/w_exp10l_compat.c: Likewise.
+ * math/w_exp2_compat.c: Likewise.
+ * math/w_exp2f_compat.c: Likewise.
+ * math/w_exp2l_compat.c: Likewise.
+ * math/w_fmod_compat.c: Likewise.
+ * math/w_fmodf_compat.c: Likewise.
+ * math/w_fmodl_compat.c: Likewise.
+ * math/w_hypot_compat.c: Likewise.
+ * math/w_hypotf_compat.c: Likewise.
+ * math/w_hypotl_compat.c: Likewise.
+ * math/w_j0_compat.c: Likewise.
+ * math/w_j0f_compat.c: Likewise.
+ * math/w_j0l_compat.c: Likewise.
+ * math/w_j1_compat.c: Likewise.
+ * math/w_j1f_compat.c: Likewise.
+ * math/w_j1l_compat.c: Likewise.
+ * math/w_jn_compat.c: Likewise.
+ * math/w_jnf_compat.c: Likewise.
+ * math/w_jnl_compat.c: Likewise.
+ * math/w_lgamma_main.c: Likewise.
+ * math/w_lgamma_r_compat.c: Likewise.
+ * math/w_lgammaf_main.c: Likewise.
+ * math/w_lgammaf_r_compat.c: Likewise.
+ * math/w_lgammal_main.c: Likewise.
+ * math/w_lgammal_r_compat.c: Likewise.
+ * math/w_log10_compat.c: Likewise.
+ * math/w_log10f_compat.c: Likewise.
+ * math/w_log10l_compat.c: Likewise.
+ * math/w_log2_compat.c: Likewise.
+ * math/w_log2f_compat.c: Likewise.
+ * math/w_log2l_compat.c: Likewise.
+ * math/w_log_compat.c: Likewise.
+ * math/w_logf_compat.c: Likewise.
+ * math/w_logl_compat.c: Likewise.
+ * math/w_pow_compat.c: Likewise.
+ * math/w_powf_compat.c: Likewise.
+ * math/w_powl_compat.c: Likewise.
+ * math/w_remainder_compat.c: Likewise.
+ * math/w_remainderf_compat.c: Likewise.
+ * math/w_remainderl_compat.c: Likewise.
+ * math/w_scalb_compat.c: Likewise.
+ * math/w_scalbf_compat.c: Likewise.
+ * math/w_scalbl_compat.c: Likewise.
+ * math/w_sinh_compat.c: Likewise.
+ * math/w_sinhf_compat.c: Likewise.
+ * math/w_sinhl_compat.c: Likewise.
+ * math/w_sqrt_compat.c: Likewise.
+ * math/w_sqrtf_compat.c: Likewise.
+ * math/w_sqrtl_compat.c: Likewise.
+ * math/w_tgamma_compat.c: Likewise.
+ * math/w_tgammaf_compat.c: Likewise.
+ * math/w_tgammal_compat.c: Likewise.
+ * sysdeps/ieee754/dbl-64/w_exp_compat.c: Likewise.
+ * sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise.
+ * sysdeps/ieee754/k_standard.c: Likewise.
+ * sysdeps/ieee754/k_standardf.c: Likewise.
+ * sysdeps/ieee754/k_standardl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise.
+ * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S: Likewise.
+ * sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Likewise.
+ * sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
+ Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
+ Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
+ * sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
+ * sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
+
2017-08-21 Florian Weimer <fweimer@redhat.com>
[BZ #21864]
diff --git a/NEWS b/NEWS
index 6639633..8fe0879 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,14 @@ Deprecated and removed features, and other changes affecting compatibility:
* On GNU/Linux, the obsolete Linux constant PTRACE_SEIZE_DEVEL is no longer
defined by <sys/ptrace.h>.
+* libm no longer supports SVID error handling (calling a user-provided
+ matherr function on error) or the _LIB_VERSION variable to control error
+ handling. (SVID error handling and the _LIB_VERSION variable still work
+ for binaries linked against older versions of the GNU C Library.) The
+ libieee.a library is no longer provided. math.h no longer defines struct
+ exception, or the macros X_TLOSS, DOMAIN, SING, OVERFLOW, UNDERFLOW,
+ TLOSS, PLOSS and HUGE.
+
Changes to build and runtime requirements:
[Add changes to build and runtime requirements here]
diff --git a/conform/linknamespace.pl b/conform/linknamespace.pl
index 3525730..2ce5388 100644
--- a/conform/linknamespace.pl
+++ b/conform/linknamespace.pl
@@ -47,11 +47,7 @@ close (STDSYMS) || die ("close $stdsyms_file: $!\n");
# * Bug 18442: re_syntax_options wrongly brought in by regcomp and
# used by re_comp.
#
-# * False positive: matherr only used conditionally. matherrf/matherrl are used
-# by IA64 too for the same reason.
-#
-@whitelist = qw(stdin stdout stderr re_syntax_options matherr matherrf
- matherrl);
+@whitelist = qw(stdin stdout stderr re_syntax_options);
foreach my $sym (@whitelist) {
$stdsyms{$sym} = 1;
}
@@ -134,7 +130,7 @@ foreach my $sym (@sym_data) {
# possible that (a) any standard library definition is weak, so can be
# overridden by the user's definition, and (b) the symbol is only used
# conditionally and not if the program is limited to standard
-# functionality. (matherr is an example of such a false positive.)
+# functionality.
#
# * If a symbol reference is only brought in by the user using a data
# symbol rather than a function from the standard library, this will
diff --git a/include/math.h b/include/math.h
index fdb4351..b62a388 100644
--- a/include/math.h
+++ b/include/math.h
@@ -9,8 +9,6 @@
#ifndef _ISOMAC
/* Now define the internal interfaces. */
-extern int __matherr (struct exception *__exc);
-
extern int __signgam;
# if IS_IN (libc) || IS_IN (libm)
diff --git a/manual/arith.texi b/manual/arith.texi
index 28a0e13..d12a6c9 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -514,14 +514,6 @@ signal. The default action for this signal is to terminate the
program. @xref{Signal Handling}, for how you can change the effect of
the signal.
-@findex matherr
-In the System V math library, the user-defined function @code{matherr}
-is called when certain exceptions occur inside math library functions.
-However, the Unix98 standard deprecates this interface. We support it
-for historical compatibility, but recommend that you do not use it in
-new programs. When this interface is used, exceptions may not be
-raised.
-
@noindent
The exceptions defined in @w{IEEE 754} are:
diff --git a/math/Makefile b/math/Makefile
index e09b0c0..25d3e95 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -181,7 +181,7 @@ $(inst_libdir)/libm.a: $(common-objpfx)format.lds \
endif
# Rules for the test suite.
-tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \
+tests = test-matherr-3 test-fenv atest-exp atest-sincos atest-exp2 basic-test \
test-misc test-fpucw test-fpucw-ieee tst-definitions test-tgmath \
test-tgmath-ret bug-nextafter bug-nexttoward bug-tgmath1 \
test-tgmath-int test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan \
@@ -201,6 +201,7 @@ tests-static = test-fpucw-static test-fpucw-ieee-static \
test-signgam-uchar-static test-signgam-uchar-init-static \
test-signgam-uint-static test-signgam-uint-init-static \
test-signgam-ullong-static test-signgam-ullong-init-static
+tests-internal = test-matherr test-matherr-2
ifneq (,$(CXX))
tests += test-math-isinff test-math-iszero
@@ -357,12 +358,6 @@ CFLAGS-test-flt-eval-method.c = -fexcess-precision=standard
CFLAGS-test-fe-snans-always-signal.c = -fsignaling-nans
-# The -lieee module sets the _LIB_VERSION_ switch to IEEE mode
-# for error handling in the -lm functions.
-install-lib += libieee.a
-non-lib.a += libieee.a
-extra-objs += libieee.a ieee-math.o
-
include ../Rules
gen-all-calls = $(gen-libm-calls) $(gen-calls)
@@ -542,10 +537,6 @@ endef
object-suffixes-left := $(all-object-suffixes)
include $(o-iterator)
-# This file defines the default _LIB_VERSION variable that controls
-# the error return conventions for the math functions.
-CPPFLAGS-s_lib_version.c := -D_POSIX_MODE
-
# We don't want the fdlibm code to use the inline math functions,
# only the fdlibm code.
math-CPPFLAGS += -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES
@@ -566,17 +557,9 @@ CFLAGS-s_modff.c += -fsignaling-nans
CFLAGS-s_modfl.c += -fsignaling-nans
CFLAGS-s_modff128.c += -fsignaling-nans
-# The -lieee library is actually an object file.
-# The module just defines the _LIB_VERSION_ variable.
-# It's not a library to make sure it is linked in instead of s_lib_version.o.
-$(objpfx)libieee.a: $(objpfx)ieee-math.o
- rm -f $@
- $(patsubst %/,cd % &&,$(objpfx)) \
- $(LN_S) $(<F) $(@F)
-
$(addprefix $(objpfx),\
$(filter-out $(tests-static) $(libm-tests-vector),\
- $(tests))): $(libm)
+ $(tests) $(tests-internal))): $(libm)
$(addprefix $(objpfx),$(tests-static)): $(objpfx)libm.a
define o-iterator-doit
$(foreach f,$($(o)-funcs),\
diff --git a/math/ieee-math.c b/math/ieee-math.c
deleted file mode 100644
index 99e41a3..0000000
--- a/math/ieee-math.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* Linking in this module forces IEEE error handling rules for math functions.
- The default is POSIX.1 error handling. */
-
-#include <math.h>
-
-_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;
diff --git a/math/lgamma-compat.h b/math/lgamma-compat.h
index 90a4237..189d126 100644
--- a/math/lgamma-compat.h
+++ b/math/lgamma-compat.h
@@ -19,6 +19,7 @@
#ifndef LGAMMA_COMPAT_H
#define LGAMMA_COMPAT_H 1
+#include <math-svid-compat.h>
#include <shlib-compat.h>
/* XSI POSIX requires lgamma to set signgam, but ISO C does not permit
diff --git a/math/libm-test-support.c b/math/libm-test-support.c
index 078d307..9ce3eb1 100644
--- a/math/libm-test-support.c
+++ b/math/libm-test-support.c
@@ -989,13 +989,6 @@ enable_test (int exceptions)
return 1;
}
-/* This is to prevent messages from the SVID libm emulation. */
-int
-matherr (struct exception *x __attribute__ ((unused)))
-{
- return 1;
-}
-
static void
initialize (void)
{
diff --git a/math/math-svid-compat.h b/math/math-svid-compat.h
new file mode 100644
index 0000000..284cc13
--- /dev/null
+++ b/math/math-svid-compat.h
@@ -0,0 +1,90 @@
+/* Declarations for SVID math error handling compatibility.
+ Copyright (C) 1991-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _MATH_SVID_COMPAT_H
+#define _MATH_SVID_COMPAT_H 1
+
+#ifndef __ASSEMBLER__
+/* Support for various different standard error handling behaviors. */
+typedef enum
+{
+ _IEEE_ = -1, /* According to IEEE 754/IEEE 854. */
+ _SVID_, /* According to System V, release 4. */
+ _XOPEN_, /* Nowadays also Unix98. */
+ _POSIX_,
+ _ISOC_ /* Actually this is ISO C99. */
+} _LIB_VERSION_TYPE;
+
+/* This variable can be changed at run-time to any of the values above to
+ affect floating point error handling behavior (it may also be necessary
+ to change the hardware FPU exception settings). */
+extern _LIB_VERSION_TYPE _LIB_VERSION;
+
+/* In SVID error handling, `matherr' is called with this description
+ of the exceptional condition. */
+struct exception
+ {
+ int type;
+ char *name;
+ double arg1;
+ double arg2;
+ double retval;
+ };
+
+extern int matherr (struct exception *__exc);
+extern int __matherr (struct exception *__exc);
+
+# define X_TLOSS 1.41484755040568800000e+16
+
+/* Types of exceptions in the `type' field. */
+# define DOMAIN 1
+# define SING 2
+# define OVERFLOW 3
+# define UNDERFLOW 4
+# define TLOSS 5
+# define PLOSS 6
+
+/* SVID mode specifies returning this large value instead of infinity. */
+# define HUGE 3.40282347e+38F
+#endif
+
+/* The above definitions may be used in testcases. The following code
+ is only used in the implementation. */
+
+#ifdef _LIBC
+# ifndef __ASSEMBLER__
+/* fdlibm kernel function */
+extern double __kernel_standard (double, double, int);
+extern float __kernel_standard_f (float, float, int);
+extern long double __kernel_standard_l (long double, long double, int);
+# endif
+
+# include <shlib-compat.h>
+# define LIBM_SVID_COMPAT SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_27)
+# if LIBM_SVID_COMPAT
+compat_symbol_reference (libm, matherr, matherr, GLIBC_2_0);
+compat_symbol_reference (libm, _LIB_VERSION, _LIB_VERSION, GLIBC_2_0);
+# elif !defined __ASSEMBLER__
+/* Except when building compat code, optimize out references to
+ _LIB_VERSION and matherr. */
+# define _LIB_VERSION _POSIX_
+# define matherr(EXC) ((void) (EXC), 0)
+# endif
+#endif
+
+#endif /* math-svid-compat.h. */
diff --git a/math/math.h b/math/math.h
index dea8dbe..275534b 100644
--- a/math/math.h
+++ b/math/math.h
@@ -501,70 +501,10 @@ iszero (__T __val)
# endif /* __cplusplus */
#endif /* Use IEC_60559_BFP_EXT. */
-#ifdef __USE_MISC
-/* Support for various different standard error handling behaviors. */
-typedef enum
-{
- _IEEE_ = -1, /* According to IEEE 754/IEEE 854. */
- _SVID_, /* According to System V, release 4. */
- _XOPEN_, /* Nowadays also Unix98. */
- _POSIX_,
- _ISOC_ /* Actually this is ISO C99. */
-} _LIB_VERSION_TYPE;
-
-/* This variable can be changed at run-time to any of the values above to
- affect floating point error handling behavior (it may also be necessary
- to change the hardware FPU exception settings). */
-extern _LIB_VERSION_TYPE _LIB_VERSION;
-#endif
-
-
-#ifdef __USE_MISC
-/* In SVID error handling, `matherr' is called with this description
- of the exceptional condition.
-
- We have a problem when using C++ since `exception' is a reserved
- name in C++. */
-# ifdef __cplusplus
-struct __exception
-# else
-struct exception
-# endif
- {
- int type;
- char *name;
- double arg1;
- double arg2;
- double retval;
- };
-
-# ifdef __cplusplus
-extern int matherr (struct __exception *__exc) throw ();
-# else
-extern int matherr (struct exception *__exc);
-# endif
-
-# define X_TLOSS 1.41484755040568800000e+16
-
-/* Types of exceptions in the `type' field. */
-# define DOMAIN 1
-# define SING 2
-# define OVERFLOW 3
-# define UNDERFLOW 4
-# define TLOSS 5
-# define PLOSS 6
-
-/* SVID mode specifies returning this large value instead of infinity. */
-# define HUGE 3.40282347e+38F
-
-#else /* !Misc. */
-
-# ifdef __USE_XOPEN
+#ifdef __USE_XOPEN
/* X/Open wants another strange constant. */
-# define MAXFLOAT 3.40282347e+38F
-# endif
-
-#endif /* Misc. */
+# define MAXFLOAT 3.40282347e+38F
+#endif
/* Some useful constants. */
diff --git a/math/test-matherr-2.c b/math/test-matherr-2.c
new file mode 100644
index 0000000..c2fc5e6
--- /dev/null
+++ b/math/test-matherr-2.c
@@ -0,0 +1,49 @@
+/* Test matherr (compat symbols, binary defines own _LIB_VERSION).
+ Copyright (C) 1997-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <math-svid-compat.h>
+#include <shlib-compat.h>
+#undef matherr
+#undef _LIB_VERSION
+compat_symbol_reference (libm, matherr, matherr, GLIBC_2_0);
+compat_symbol_reference (libm, _LIB_VERSION, _LIB_VERSION, GLIBC_2_0);
+
+_LIB_VERSION_TYPE _LIB_VERSION = _SVID_;
+
+static int fail = 1;
+
+int
+matherr (struct exception *s)
+{
+ printf ("matherr is working\n");
+ fail = 0;
+ return 1;
+}
+
+static int
+do_test (void)
+{
+ acos (2.0);
+ return fail;
+}
+
+#include <support/test-driver.c>
diff --git a/math/test-matherr-3.c b/math/test-matherr-3.c
new file mode 100644
index 0000000..c81a04f
--- /dev/null
+++ b/math/test-matherr-3.c
@@ -0,0 +1,44 @@
+/* Test matherr not supported for new binaries.
+ Copyright (C) 1997-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <math-svid-compat.h>
+
+_LIB_VERSION_TYPE _LIB_VERSION = _SVID_;
+
+static int fail = 0;
+
+int
+matherr (struct exception *s)
+{
+ printf ("matherr is working, but should not be\n");
+ fail = 1;
+ return 1;
+}
+
+static int
+do_test (void)
+{
+ acos (2.0);
+ return fail;
+}
+
+#include <support/test-driver.c>
diff --git a/math/test-matherr.c b/math/test-matherr.c
index 6983879..34856f1 100644
--- a/math/test-matherr.c
+++ b/math/test-matherr.c
@@ -1,7 +1,32 @@
+/* Test matherr (compat symbols, binary modifies library's _LIB_VERSION).
+ Copyright (C) 1997-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+#include <math-svid-compat.h>
+#include <shlib-compat.h>
+#undef matherr
+#undef _LIB_VERSION
+compat_symbol_reference (libm, matherr, matherr, GLIBC_2_0);
+compat_symbol_reference (libm, _LIB_VERSION, _LIB_VERSION, GLIBC_2_0);
+
static int fail = 1;
int
@@ -20,5 +45,4 @@ do_test (void)
return fail;
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/math/w_acos_compat.c b/math/w_acos_compat.c
index e6fbdf1..5115732 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 <math-svid-compat.h>
/* wrapper acos */
diff --git a/math/w_acosf_compat.c b/math/w_acosf_compat.c
index f389da1..0bf557c 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 <math-svid-compat.h>
/* wrapper acosf */
diff --git a/math/w_acosh_compat.c b/math/w_acosh_compat.c
index 286ea86..31251ce 100644
--- a/math/w_acosh_compat.c
+++ b/math/w_acosh_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper acosh */
diff --git a/math/w_acoshf_compat.c b/math/w_acoshf_compat.c
index 801a52e..6a4482e 100644
--- a/math/w_acoshf_compat.c
+++ b/math/w_acoshf_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper acoshf */
diff --git a/math/w_acoshl_compat.c b/math/w_acoshl_compat.c
index 310f3c9..b9f66c5 100644
--- a/math/w_acoshl_compat.c
+++ b/math/w_acoshl_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper acosl */
diff --git a/math/w_acosl_compat.c b/math/w_acosl_compat.c
index eaccc66..66600b5 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 <math-svid-compat.h>
/* wrapper acosl */
diff --git a/math/w_asin_compat.c b/math/w_asin_compat.c
index b2ad632..59beea8 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 <math-svid-compat.h>
/* wrapper asin */
diff --git a/math/w_asinf_compat.c b/math/w_asinf_compat.c
index 0d0ee98..0eb20b1 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 <math-svid-compat.h>
/* wrapper asinf */
diff --git a/math/w_asinl_compat.c b/math/w_asinl_compat.c
index a02fa1e..c8f4d15 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 <math-svid-compat.h>
/* wrapper asinl */
diff --git a/math/w_atan2_compat.c b/math/w_atan2_compat.c
index cceb602..fa098ff 100644
--- a/math/w_atan2_compat.c
+++ b/math/w_atan2_compat.c
@@ -23,6 +23,7 @@
#include <errno.h>
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
double
diff --git a/math/w_atan2f_compat.c b/math/w_atan2f_compat.c
index 8343893..15e05d8 100644
--- a/math/w_atan2f_compat.c
+++ b/math/w_atan2f_compat.c
@@ -23,6 +23,7 @@
#include <errno.h>
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
float
diff --git a/math/w_atan2l_compat.c b/math/w_atan2l_compat.c
index b7b29ff..87b7394 100644
--- a/math/w_atan2l_compat.c
+++ b/math/w_atan2l_compat.c
@@ -23,6 +23,7 @@
#include <errno.h>
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double
diff --git a/math/w_atanh_compat.c b/math/w_atanh_compat.c
index 456dcb3..f7a43be 100644
--- a/math/w_atanh_compat.c
+++ b/math/w_atanh_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper atanh */
diff --git a/math/w_atanhf_compat.c b/math/w_atanhf_compat.c
index dd14145..c9d2c3a 100644
--- a/math/w_atanhf_compat.c
+++ b/math/w_atanhf_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper atanhf */
diff --git a/math/w_atanhl_compat.c b/math/w_atanhl_compat.c
index 37e8da5..56f9f1e 100644
--- a/math/w_atanhl_compat.c
+++ b/math/w_atanhl_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper atanhl */
diff --git a/math/w_cosh_compat.c b/math/w_cosh_compat.c
index 0771434..fd16436 100644
--- a/math/w_cosh_compat.c
+++ b/math/w_cosh_compat.c
@@ -16,6 +16,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
double
__cosh (double x)
diff --git a/math/w_coshf_compat.c b/math/w_coshf_compat.c
index dc7fb53..dd62281 100644
--- a/math/w_coshf_compat.c
+++ b/math/w_coshf_compat.c
@@ -20,6 +20,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
float
__coshf (float x)
diff --git a/math/w_coshl_compat.c b/math/w_coshl_compat.c
index 27f0a4f..5fa32be 100644
--- a/math/w_coshl_compat.c
+++ b/math/w_coshl_compat.c
@@ -21,6 +21,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double
__coshl (long double x)
diff --git a/math/w_exp10_compat.c b/math/w_exp10_compat.c
index 1ba9279..64f1d19 100644
--- a/math/w_exp10_compat.c
+++ b/math/w_exp10_compat.c
@@ -23,6 +23,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
double
__exp10 (double x)
diff --git a/math/w_exp10f_compat.c b/math/w_exp10f_compat.c
index 7993945..5cf926a 100644
--- a/math/w_exp10f_compat.c
+++ b/math/w_exp10f_compat.c
@@ -23,6 +23,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
float
__exp10f (float x)
diff --git a/math/w_exp10l_compat.c b/math/w_exp10l_compat.c
index 2734468..06f5267 100644
--- a/math/w_exp10l_compat.c
+++ b/math/w_exp10l_compat.c
@@ -23,6 +23,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double
__exp10l (long double x)
diff --git a/math/w_exp2_compat.c b/math/w_exp2_compat.c
index ca17f9e..a4d4653 100644
--- a/math/w_exp2_compat.c
+++ b/math/w_exp2_compat.c
@@ -4,6 +4,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
double
__exp2 (double x)
diff --git a/math/w_exp2f_compat.c b/math/w_exp2f_compat.c
index 61cbd6c..b21fe36 100644
--- a/math/w_exp2f_compat.c
+++ b/math/w_exp2f_compat.c
@@ -4,6 +4,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
float
__exp2f (float x)
diff --git a/math/w_exp2l_compat.c b/math/w_exp2l_compat.c
index 47aed3c..04cd666 100644
--- a/math/w_exp2l_compat.c
+++ b/math/w_exp2l_compat.c
@@ -4,6 +4,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double
__exp2l (long double x)
diff --git a/math/w_fmod_compat.c b/math/w_fmod_compat.c
index 746550a..1079d3a 100644
--- a/math/w_fmod_compat.c
+++ b/math/w_fmod_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper fmod */
double
diff --git a/math/w_fmodf_compat.c b/math/w_fmodf_compat.c
index 45ece58..88b64a2 100644
--- a/math/w_fmodf_compat.c
+++ b/math/w_fmodf_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper fmodf */
float
diff --git a/math/w_fmodl_compat.c b/math/w_fmodl_compat.c
index 1f385bd..23422fa 100644
--- a/math/w_fmodl_compat.c
+++ b/math/w_fmodl_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper fmodl */
long double
diff --git a/math/w_hypot_compat.c b/math/w_hypot_compat.c
index 7c662c8..ff3774c 100644
--- a/math/w_hypot_compat.c
+++ b/math/w_hypot_compat.c
@@ -16,6 +16,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
double
diff --git a/math/w_hypotf_compat.c b/math/w_hypotf_compat.c
index 0ecacae..0a43d90 100644
--- a/math/w_hypotf_compat.c
+++ b/math/w_hypotf_compat.c
@@ -19,6 +19,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
float
diff --git a/math/w_hypotl_compat.c b/math/w_hypotl_compat.c
index c784fa2..13060f7 100644
--- a/math/w_hypotl_compat.c
+++ b/math/w_hypotl_compat.c
@@ -20,6 +20,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double
diff --git a/math/w_j0_compat.c b/math/w_j0_compat.c
index e7b56f2..80d21ac 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 <math-svid-compat.h>
/* wrapper j0 */
diff --git a/math/w_j0f_compat.c b/math/w_j0f_compat.c
index 34220b9..36fc4f9 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 <math-svid-compat.h>
/* wrapper j0f */
diff --git a/math/w_j0l_compat.c b/math/w_j0l_compat.c
index e03fa1d..ff7e1b1 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 <math-svid-compat.h>
/* wrapper j0l */
diff --git a/math/w_j1_compat.c b/math/w_j1_compat.c
index efbe8df..f7a76c1 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 <math-svid-compat.h>
/* wrapper j1 */
diff --git a/math/w_j1f_compat.c b/math/w_j1f_compat.c
index 7558685..9aa5c8c 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 <math-svid-compat.h>
/* wrapper j1f */
diff --git a/math/w_j1l_compat.c b/math/w_j1l_compat.c
index f35261d..7e6d9f5 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 <math-svid-compat.h>
/* wrapper j1l */
diff --git a/math/w_jn_compat.c b/math/w_jn_compat.c
index 9321bf5..7c49992 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 <math-svid-compat.h>
/* wrapper jn */
diff --git a/math/w_jnf_compat.c b/math/w_jnf_compat.c
index 9752b2a..ead40e7 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 <math-svid-compat.h>
/* wrapper jnf */
diff --git a/math/w_jnl_compat.c b/math/w_jnl_compat.c
index d17b047..bc41635 100644
--- a/math/w_jnl_compat.c
+++ b/math/w_jnl_compat.c
@@ -46,6 +46,7 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double __jnl(int n, long double x) /* wrapper jnl */
{
diff --git a/math/w_lgamma_main.c b/math/w_lgamma_main.c
index cdea331..7dbba22 100644
--- a/math/w_lgamma_main.c
+++ b/math/w_lgamma_main.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
#include <lgamma-compat.h>
diff --git a/math/w_lgamma_r_compat.c b/math/w_lgamma_r_compat.c
index 6578b2c..3f7fbce 100644
--- a/math/w_lgamma_r_compat.c
+++ b/math/w_lgamma_r_compat.c
@@ -16,6 +16,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
double
diff --git a/math/w_lgammaf_main.c b/math/w_lgammaf_main.c
index ba7ff0e..a3d7e1a 100644
--- a/math/w_lgammaf_main.c
+++ b/math/w_lgammaf_main.c
@@ -15,6 +15,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
#include <lgamma-compat.h>
diff --git a/math/w_lgammaf_r_compat.c b/math/w_lgammaf_r_compat.c
index d7d2cb8..d9601f4 100644
--- a/math/w_lgammaf_r_compat.c
+++ b/math/w_lgammaf_r_compat.c
@@ -19,6 +19,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
float
diff --git a/math/w_lgammal_main.c b/math/w_lgammal_main.c
index c3c41f6..447fb97 100644
--- a/math/w_lgammal_main.c
+++ b/math/w_lgammal_main.c
@@ -22,6 +22,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
#include <lgamma-compat.h>
diff --git a/math/w_lgammal_r_compat.c b/math/w_lgammal_r_compat.c
index 7caeb12..d1b58e4 100644
--- a/math/w_lgammal_r_compat.c
+++ b/math/w_lgammal_r_compat.c
@@ -20,6 +20,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double
diff --git a/math/w_log10_compat.c b/math/w_log10_compat.c
index 9704ba9..6f3eb34 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 <math-svid-compat.h>
/* wrapper log10(x) */
diff --git a/math/w_log10f_compat.c b/math/w_log10f_compat.c
index f8921fe..2cb5c9a 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 <math-svid-compat.h>
/* wrapper log10f(x) */
diff --git a/math/w_log10l_compat.c b/math/w_log10l_compat.c
index cfb514a..0063c50 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 <math-svid-compat.h>
/* wrapper log10l(x) */
diff --git a/math/w_log2_compat.c b/math/w_log2_compat.c
index b8e842d..252fc0d 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 <math-svid-compat.h>
/* wrapper log2(x) */
diff --git a/math/w_log2f_compat.c b/math/w_log2f_compat.c
index 357cc0a..6adaff6 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 <math-svid-compat.h>
/* wrapper log2f(x) */
diff --git a/math/w_log2l_compat.c b/math/w_log2l_compat.c
index 3d9994e..f496c36 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 <math-svid-compat.h>
/* wrapper log2l(x) */
diff --git a/math/w_log_compat.c b/math/w_log_compat.c
index 4b47069..82f3ff4 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 <math-svid-compat.h>
/* wrapper log(x) */
diff --git a/math/w_logf_compat.c b/math/w_logf_compat.c
index 8b0f4fc..ac18b65 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 <math-svid-compat.h>
/* wrapper logf(x) */
diff --git a/math/w_logl_compat.c b/math/w_logl_compat.c
index 12afbe5..ba65830 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 <math-svid-compat.h>
/* wrapper logl(x) */
diff --git a/math/w_pow_compat.c b/math/w_pow_compat.c
index 0e24b75..367f609 100644
--- a/math/w_pow_compat.c
+++ b/math/w_pow_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper pow */
diff --git a/math/w_powf_compat.c b/math/w_powf_compat.c
index 7e3b015..afc3fce 100644
--- a/math/w_powf_compat.c
+++ b/math/w_powf_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper powf */
diff --git a/math/w_powl_compat.c b/math/w_powl_compat.c
index 60a89c2..b25dad8 100644
--- a/math/w_powl_compat.c
+++ b/math/w_powl_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper powl */
diff --git a/math/w_remainder_compat.c b/math/w_remainder_compat.c
index 6644590..27fa14f 100644
--- a/math/w_remainder_compat.c
+++ b/math/w_remainder_compat.c
@@ -18,6 +18,8 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
+#include <math-svid-compat.h>
/* wrapper remainder */
diff --git a/math/w_remainderf_compat.c b/math/w_remainderf_compat.c
index 1db246a..627b4f1 100644
--- a/math/w_remainderf_compat.c
+++ b/math/w_remainderf_compat.c
@@ -18,6 +18,8 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
+#include <math-svid-compat.h>
/* wrapper remainderf */
diff --git a/math/w_remainderl_compat.c b/math/w_remainderl_compat.c
index 2fc40f1..9858475 100644
--- a/math/w_remainderl_compat.c
+++ b/math/w_remainderl_compat.c
@@ -18,6 +18,8 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
+#include <math-svid-compat.h>
/* wrapper remainderl */
diff --git a/math/w_scalb_compat.c b/math/w_scalb_compat.c
index 8354115..a31e54d 100644
--- a/math/w_scalb_compat.c
+++ b/math/w_scalb_compat.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
static double
diff --git a/math/w_scalbf_compat.c b/math/w_scalbf_compat.c
index fe93f0a..2b96df0 100644
--- a/math/w_scalbf_compat.c
+++ b/math/w_scalbf_compat.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
static float
diff --git a/math/w_scalbl_compat.c b/math/w_scalbl_compat.c
index 62645d4..a4a0f8e 100644
--- a/math/w_scalbl_compat.c
+++ b/math/w_scalbl_compat.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
static long double
diff --git a/math/w_sinh_compat.c b/math/w_sinh_compat.c
index 51daf2f..121edfc 100644
--- a/math/w_sinh_compat.c
+++ b/math/w_sinh_compat.c
@@ -16,6 +16,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
double
__sinh (double x)
diff --git a/math/w_sinhf_compat.c b/math/w_sinhf_compat.c
index 0e530b1..2103b06 100644
--- a/math/w_sinhf_compat.c
+++ b/math/w_sinhf_compat.c
@@ -19,6 +19,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
float
__sinhf (float x)
diff --git a/math/w_sinhl_compat.c b/math/w_sinhl_compat.c
index 7df7c06..57f08e7 100644
--- a/math/w_sinhl_compat.c
+++ b/math/w_sinhl_compat.c
@@ -20,6 +20,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double
__sinhl (long double x)
diff --git a/math/w_sqrt_compat.c b/math/w_sqrt_compat.c
index 018da82..743df32 100644
--- a/math/w_sqrt_compat.c
+++ b/math/w_sqrt_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper sqrt */
diff --git a/math/w_sqrtf_compat.c b/math/w_sqrtf_compat.c
index de5b42d..0689b4b 100644
--- a/math/w_sqrtf_compat.c
+++ b/math/w_sqrtf_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper sqrtf */
diff --git a/math/w_sqrtl_compat.c b/math/w_sqrtl_compat.c
index b4663b7..43e81ac 100644
--- a/math/w_sqrtl_compat.c
+++ b/math/w_sqrtl_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper sqrtl */
diff --git a/math/w_tgamma_compat.c b/math/w_tgamma_compat.c
index 99b6029..93bd48f 100644
--- a/math/w_tgamma_compat.c
+++ b/math/w_tgamma_compat.c
@@ -18,6 +18,7 @@
#include <errno.h>
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
double
__tgamma(double x)
diff --git a/math/w_tgammaf_compat.c b/math/w_tgammaf_compat.c
index dfce894..e6ae48c 100644
--- a/math/w_tgammaf_compat.c
+++ b/math/w_tgammaf_compat.c
@@ -16,6 +16,7 @@
#include <errno.h>
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
float
__tgammaf(float x)
diff --git a/math/w_tgammal_compat.c b/math/w_tgammal_compat.c
index 50de8cf..306f672 100644
--- a/math/w_tgammal_compat.c
+++ b/math/w_tgammal_compat.c
@@ -21,6 +21,7 @@
#include <errno.h>
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double
__tgammal(long double x)
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index 4d962e1..80c7c92 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -249,11 +249,6 @@ fabsf128 (_Float128 x)
-/* fdlibm kernel function */
-extern double __kernel_standard (double,double,int);
-extern float __kernel_standard_f (float,float,int);
-extern long double __kernel_standard_l (long double,long double,int);
-
/* Prototypes for functions of the IBM Accurate Mathematical Library. */
extern double __exp1 (double __x, double __xx, double __error);
extern double __sin (double __x);
diff --git a/sysdeps/ia64/fpu/libm_error.c b/sysdeps/ia64/fpu/libm_error.c
index a9307dd..34d1466 100644
--- a/sysdeps/ia64/fpu/libm_error.c
+++ b/sysdeps/ia64/fpu/libm_error.c
@@ -91,11 +91,19 @@
#include <stdio.h>
#include <stdlib.h>
#include "libm_support.h"
+#include <math-svid-compat.h>
#ifdef _LIBC
# define pmatherr matherr
# define pmatherrf matherrf
# define pmatherrl matherrl
+# if LIBM_SVID_COMPAT
+compat_symbol_reference (libm, matherrf, matherrf, GLIBC_2_2_3);
+compat_symbol_reference (libm, matherrl, matherrl, GLIBC_2_2_3);
+# else
+# define matherrf(EXC) ((void) (EXC), 0)
+# define matherrl(EXC) ((void) (EXC), 0)
+# endif
#else
_LIB_VERSION_TYPE
#if defined( __POSIX__ )
diff --git a/sysdeps/ia64/fpu/libm_support.h b/sysdeps/ia64/fpu/libm_support.h
index dc9c0a2..4e7a667 100644
--- a/sysdeps/ia64/fpu/libm_support.h
+++ b/sysdeps/ia64/fpu/libm_support.h
@@ -83,6 +83,8 @@
#ifndef __LIBM_SUPPORT_H_INCLUDED__
#define __LIBM_SUPPORT_H_INCLUDED__
+#include <math-svid-compat.h>
+
#ifndef _LIBC
#if !(defined(_WIN32) || defined(_WIN64))
# pragma const_seg(".rodata") /* place constant data in text (code) section */
@@ -156,36 +158,8 @@ struct exceptionl
#endif
extern int MATHERR_F(struct exceptionf*);
-extern int MATHERR_D(struct EXC_DECL_D*);
extern int matherrl(struct exceptionl*);
-#ifndef _LIBC
-// Add code to support _LIB_VERSIONIMF
-typedef enum
-{
- _IEEE_ = -1, // IEEE-like behavior
- _SVID_, // SysV, Rel. 4 behavior
- _XOPEN_, // Unix98
- _POSIX_, // Posix
- _ISOC_ // ISO C9X
-} _LIB_VERSION_TYPE;
-#endif
-
-// This is a run-time variable and may affect
-// floating point behavior of the libm functions
-
-#if !defined( LIBM_BUILD )
-#if defined( _DLL )
-extern _LIB_VERSION_TYPE __declspec(dllimport) _LIB_VERSIONIMF;
-#else
-extern _LIB_VERSION_TYPE _LIB_VERSIONIMF;
-#endif /* _DLL */
-#else
-extern int (*pmatherrf)(struct exceptionf*);
-extern int (*pmatherr)(struct EXC_DECL_D*);
-extern int (*pmatherrl)(struct exceptionl*);
-#endif /* LIBM_BUILD */
-
/* memory format definitions (LITTLE_ENDIAN only) */
#if !(defined(SIZE_INT_32) || defined(SIZE_INT_64))
@@ -1031,15 +1005,6 @@ struct ker80 {
#endif
-/* error codes */
-
-#define DOMAIN 1 /* argument domain error */
-#define SING 2 /* argument singularity */
-#define OVERFLOW 3 /* overflow range error */
-#define UNDERFLOW 4 /* underflow range error */
-#define TLOSS 5 /* total loss of precision */
-#define PLOSS 6 /* partial loss of precision */
-
/* */
#define VOLATILE_32 /*volatile*/
diff --git a/sysdeps/ia64/fpu/s_matherrf.c b/sysdeps/ia64/fpu/s_matherrf.c
index a47d4b8..5808c04 100644
--- a/sysdeps/ia64/fpu/s_matherrf.c
+++ b/sysdeps/ia64/fpu/s_matherrf.c
@@ -13,8 +13,10 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
#include "libm_support.h"
+#if LIBM_SVID_COMPAT
int
weak_function
__matherrf(struct exceptionf *x)
@@ -23,4 +25,5 @@ __matherrf(struct exceptionf *x)
if(x->arg1!=x->arg1) return 0;
return n;
}
-weak_alias (__matherrf, matherrf)
+compat_symbol (libm, __matherrf, matherrf, GLIBC_2_2_3);
+#endif
diff --git a/sysdeps/ia64/fpu/s_matherrl.c b/sysdeps/ia64/fpu/s_matherrl.c
index 6fe92d7..dc64b31 100644
--- a/sysdeps/ia64/fpu/s_matherrl.c
+++ b/sysdeps/ia64/fpu/s_matherrl.c
@@ -13,8 +13,10 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
#include "libm_support.h"
+#if LIBM_SVID_COMPAT
int
weak_function
__matherrl(struct exceptionl *x)
@@ -23,4 +25,5 @@ __matherrl(struct exceptionl *x)
if(x->arg1!=x->arg1) return 0;
return n;
}
-weak_alias (__matherrl, matherrl)
+compat_symbol (libm, __matherrl, matherrl, GLIBC_2_2_3);
+#endif
diff --git a/sysdeps/ieee754/dbl-64/w_exp_compat.c b/sysdeps/ieee754/dbl-64/w_exp_compat.c
index e61e03b..69ec0a1 100644
--- a/sysdeps/ieee754/dbl-64/w_exp_compat.c
+++ b/sysdeps/ieee754/dbl-64/w_exp_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper exp */
double
diff --git a/sysdeps/ieee754/flt-32/w_expf_compat.c b/sysdeps/ieee754/flt-32/w_expf_compat.c
index b2be6aa..8a1fa51 100644
--- a/sysdeps/ieee754/flt-32/w_expf_compat.c
+++ b/sysdeps/ieee754/flt-32/w_expf_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper expf */
float
diff --git a/sysdeps/ieee754/k_standard.c b/sysdeps/ieee754/k_standard.c
index b100b3e..0a0201f 100644
--- a/sysdeps/ieee754/k_standard.c
+++ b/sysdeps/ieee754/k_standard.c
@@ -16,6 +16,7 @@ static char rcsid[] = "$NetBSD: k_standard.c,v 1.6 1995/05/10 20:46:35 jtc Exp $
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
#include <errno.h>
#include <assert.h>
diff --git a/sysdeps/ieee754/k_standardf.c b/sysdeps/ieee754/k_standardf.c
index 678b38d..85b2003 100644
--- a/sysdeps/ieee754/k_standardf.c
+++ b/sysdeps/ieee754/k_standardf.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* Handle errors for a libm function as specified by TYPE (see
diff --git a/sysdeps/ieee754/k_standardl.c b/sysdeps/ieee754/k_standardl.c
index 08d789f..783fd0b 100644
--- a/sysdeps/ieee754/k_standardl.c
+++ b/sysdeps/ieee754/k_standardl.c
@@ -32,6 +32,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
#include <fenv.h>
#include <float.h>
#include <errno.h>
diff --git a/sysdeps/ieee754/ldbl-128/w_expl_compat.c b/sysdeps/ieee754/ldbl-128/w_expl_compat.c
index c32616e..e0fa9e3 100644
--- a/sysdeps/ieee754/ldbl-128/w_expl_compat.c
+++ b/sysdeps/ieee754/ldbl-128/w_expl_compat.c
@@ -24,6 +24,7 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
long double __expl(long double x) /* wrapper exp */
{
diff --git a/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c b/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c
index c9d44b6..019a48f 100644
--- a/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c
+++ b/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c
@@ -1,5 +1,6 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
#include <math_ldbl_opt.h>
long double __expl(long double x) /* wrapper exp */
diff --git a/sysdeps/ieee754/ldbl-96/w_expl_compat.c b/sysdeps/ieee754/ldbl-96/w_expl_compat.c
index a0b852a..c9e6003 100644
--- a/sysdeps/ieee754/ldbl-96/w_expl_compat.c
+++ b/sysdeps/ieee754/ldbl-96/w_expl_compat.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-svid-compat.h>
/* wrapper expl */
long double
diff --git a/sysdeps/ieee754/s_lib_version.c b/sysdeps/ieee754/s_lib_version.c
index bb59300..f11d1c3 100644
--- a/sysdeps/ieee754/s_lib_version.c
+++ b/sysdeps/ieee754/s_lib_version.c
@@ -18,24 +18,18 @@ static char rcsid[] = "$NetBSD: s_lib_version.c,v 1.6 1995/05/10 20:47:44 jtc Ex
* MACRO for standards
*/
-#include <math.h>
-#include <math_private.h>
+#include <math-svid-compat.h>
/*
* define and initialize _LIB_VERSION
*/
-#ifdef _POSIX_MODE
+#undef _LIB_VERSION
+#if LIBM_SVID_COMPAT || !defined SHARED
_LIB_VERSION_TYPE _LIB_VERSION_INTERNAL = _POSIX_;
-#else
-#ifdef _XOPEN_MODE
-_LIB_VERSION_TYPE _LIB_VERSION_INTERNAL = _XOPEN_;
-#else
-#ifdef _SVID3_MODE
-_LIB_VERSION_TYPE _LIB_VERSION_INTERNAL = _SVID_;
-#else /* default _IEEE_MODE */
-_LIB_VERSION_TYPE _LIB_VERSION_INTERNAL = _IEEE_;
#endif
-#endif
-#endif
-
+#if LIBM_SVID_COMPAT
+compat_symbol (libm, _LIB_VERSION_INTERNAL, _LIB_VERSION, GLIBC_2_0);
+#elif !defined SHARED
+/* For use in .S wrappers. */
weak_alias (_LIB_VERSION_INTERNAL, _LIB_VERSION)
+#endif
diff --git a/sysdeps/ieee754/s_matherr.c b/sysdeps/ieee754/s_matherr.c
index d5dc6f1..5eacdd5 100644
--- a/sysdeps/ieee754/s_matherr.c
+++ b/sysdeps/ieee754/s_matherr.c
@@ -14,9 +14,10 @@
static char rcsid[] = "$NetBSD: s_matherr.c,v 1.6 1995/05/10 20:47:53 jtc Exp $";
#endif
-#include <math.h>
-#include <math_private.h>
+#include <math-svid-compat.h>
+#undef matherr
+#if LIBM_SVID_COMPAT
int
weak_function
__matherr(struct exception *x)
@@ -25,4 +26,5 @@ __matherr(struct exception *x)
if(x->arg1!=x->arg1) return 0;
return n;
}
-weak_alias (__matherr, matherr)
+compat_symbol (libm, __matherr, matherr, GLIBC_2_0);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S
index bb896a3..82e3baf 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S
@@ -18,6 +18,7 @@
#include <sysdep.h>
#include <math_ldbl_opt.h>
+#include <math-svid-compat.h>
/* double [fp1] sqrt (double x [fp1])
Power4 (ISA V2.0) and above implement sqrt in hardware (not optional).
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S
index c304ab5..0c66352 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S
@@ -18,6 +18,7 @@
#include <sysdep.h>
#include <math_ldbl_opt.h>
+#include <math-svid-compat.h>
/* float [fp1] sqrts (float x [fp1])
Power4 (ISA V2.0) and above implement sqrt in hardware (not optional).
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S
index 93625c5..ecefdc3 100644
--- a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S
+++ b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S
@@ -18,6 +18,7 @@
#include <sysdep.h>
#include <math_ldbl_opt.h>
+#include <math-svid-compat.h>
/* double [fp1] sqrt (double x [fp1])
Power4 (ISA V2.0) and above implement sqrt in hardware (not optional).
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S
index 2ca86b6..9ae0c5f 100644
--- a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S
+++ b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S
@@ -18,6 +18,7 @@
#include <sysdep.h>
#include <math_ldbl_opt.h>
+#include <math-svid-compat.h>
/* float [fp1] sqrts (float x [fp1])
Power4 (ISA V2.0) and above implement sqrt in hardware (not optional).
diff --git a/sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S b/sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S
index 703f228..cca7654 100644
--- a/sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S
+++ b/sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <math-svid-compat.h>
ENTRY (__sqrt)
clr %g1
diff --git a/sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S b/sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S
index 05d1160..34f6113 100644
--- a/sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S
+++ b/sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <math-svid-compat.h>
ENTRY (__sqrtf)
st %g0, [%sp + 68]
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S
index 06ff449..a3a642f 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <math-svid-compat.h>
ENTRY (__sqrt_vis3)
movwtos %o0, %f0
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S
index 5b21523..8cd1607 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <math-svid-compat.h>
ENTRY (__sqrtf_vis3)
movwtos %o0, %f0
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S
index 4415a82..f3003da 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <math-svid-compat.h>
ENTRY (__sqrt)
std %o0, [%sp + 80]
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S
index 1c3c97f..7a102de 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <math-svid-compat.h>
ENTRY (__sqrtf)
st %o0, [%sp + 72]
diff --git a/sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S b/sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S
index de95e52..937e150 100644
--- a/sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S
+++ b/sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <math-svid-compat.h>
ENTRY (__sqrt)
fzero %f8
diff --git a/sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S b/sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S
index 0c253fe..875ed3b 100644
--- a/sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S
+++ b/sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <math-svid-compat.h>
ENTRY (__sqrtf)
fzeros %f8