summaryrefslogtreecommitdiffstats
path: root/modules/fdlibm/patches
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /modules/fdlibm/patches
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'modules/fdlibm/patches')
-rw-r--r--modules/fdlibm/patches/01_remove_unused_declarations_from_fdlibm_h.patch504
-rw-r--r--modules/fdlibm/patches/02_change_include_guard_in_fdlibm_h.patch35
-rw-r--r--modules/fdlibm/patches/03_put_fdlibm_functions_into_fdlibm_namespace.patch34
-rw-r--r--modules/fdlibm/patches/04_include_fdlibm_h_from_math_private_h.patch716
-rw-r--r--modules/fdlibm/patches/05_include_stdint_h_in_math_private_h.patch21
-rw-r--r--modules/fdlibm/patches/06_use_mfbt_endian_h_in_math_private_h.patch74
-rw-r--r--modules/fdlibm/patches/07_add_fdlibm_namespace_to_functions_defined_and_used_in_fdlibm.patch55
-rw-r--r--modules/fdlibm/patches/08_remove_weak_reference_macro.patch393
-rw-r--r--modules/fdlibm/patches/09_comment_out_rcsid_variable.patch849
-rw-r--r--modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch55
-rw-r--r--modules/fdlibm/patches/11_include_cfloat_to_use_flt_eval_method.patch21
-rw-r--r--modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch25
-rw-r--r--modules/fdlibm/patches/13_define_strict_assign_even_if_flt_eval_method_is_not_defined.patch31
-rw-r--r--modules/fdlibm/patches/14_do_not_use_hexadecimal_floating_point_number.patch47
-rw-r--r--modules/fdlibm/patches/15_remove_unused_rintl_function_from_s_nearbyint_cpp.patch13
-rw-r--r--modules/fdlibm/patches/15_use_safer_strict_assign_on_visual_studio.patch23
16 files changed, 2896 insertions, 0 deletions
diff --git a/modules/fdlibm/patches/01_remove_unused_declarations_from_fdlibm_h.patch b/modules/fdlibm/patches/01_remove_unused_declarations_from_fdlibm_h.patch
new file mode 100644
index 000000000..2d89d08ef
--- /dev/null
+++ b/modules/fdlibm/patches/01_remove_unused_declarations_from_fdlibm_h.patch
@@ -0,0 +1,504 @@
+diff --git a/modules/fdlibm/src/fdlibm.h b/modules/fdlibm/src/fdlibm.h
+--- a/modules/fdlibm/src/fdlibm.h
++++ b/modules/fdlibm/src/fdlibm.h
+@@ -12,496 +12,50 @@
+ /*
+ * from: @(#)fdlibm.h 5.1 93/09/24
+ * $FreeBSD$
+ */
+
+ #ifndef _MATH_H_
+ #define _MATH_H_
+
+-#include <sys/cdefs.h>
+-#include <sys/_types.h>
+-#include <machine/_limits.h>
+-
+-/*
+- * ANSI/POSIX
+- */
+-extern const union __infinity_un {
+- unsigned char __uc[8];
+- double __ud;
+-} __infinity;
+-
+-extern const union __nan_un {
+- unsigned char __uc[sizeof(float)];
+- float __uf;
+-} __nan;
+-
+-#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
+-#define __MATH_BUILTIN_CONSTANTS
+-#endif
+-
+-#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)
+-#define __MATH_BUILTIN_RELOPS
+-#endif
+-
+-#ifdef __MATH_BUILTIN_CONSTANTS
+-#define HUGE_VAL __builtin_huge_val()
+-#else
+-#define HUGE_VAL (__infinity.__ud)
+-#endif
+-
+-#if __ISO_C_VISIBLE >= 1999
+-#define FP_ILOGB0 (-__INT_MAX)
+-#define FP_ILOGBNAN __INT_MAX
+-
+-#ifdef __MATH_BUILTIN_CONSTANTS
+-#define HUGE_VALF __builtin_huge_valf()
+-#define HUGE_VALL __builtin_huge_vall()
+-#define INFINITY __builtin_inff()
+-#define NAN __builtin_nanf("")
+-#else
+-#define HUGE_VALF (float)HUGE_VAL
+-#define HUGE_VALL (long double)HUGE_VAL
+-#define INFINITY HUGE_VALF
+-#define NAN (__nan.__uf)
+-#endif /* __MATH_BUILTIN_CONSTANTS */
+-
+-#define MATH_ERRNO 1
+-#define MATH_ERREXCEPT 2
+-#define math_errhandling MATH_ERREXCEPT
+-
+-#define FP_FAST_FMAF 1
+-
+-/* Symbolic constants to classify floating point numbers. */
+-#define FP_INFINITE 0x01
+-#define FP_NAN 0x02
+-#define FP_NORMAL 0x04
+-#define FP_SUBNORMAL 0x08
+-#define FP_ZERO 0x10
+-
+-#if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \
+- __has_extension(c_generic_selections)
+-#define __fp_type_select(x, f, d, ld) _Generic((x), \
+- float: f(x), \
+- double: d(x), \
+- long double: ld(x), \
+- volatile float: f(x), \
+- volatile double: d(x), \
+- volatile long double: ld(x), \
+- volatile const float: f(x), \
+- volatile const double: d(x), \
+- volatile const long double: ld(x), \
+- const float: f(x), \
+- const double: d(x), \
+- const long double: ld(x))
+-#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
+-#define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \
+- __builtin_types_compatible_p(__typeof(x), long double), ld(x), \
+- __builtin_choose_expr( \
+- __builtin_types_compatible_p(__typeof(x), double), d(x), \
+- __builtin_choose_expr( \
+- __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
+-#else
+-#define __fp_type_select(x, f, d, ld) \
+- ((sizeof(x) == sizeof(float)) ? f(x) \
+- : (sizeof(x) == sizeof(double)) ? d(x) \
+- : ld(x))
+-#endif
+-
+-#define fpclassify(x) \
+- __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl)
+-#define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
+-#define isinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
+-#define isnan(x) \
+- __fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl)
+-#define isnormal(x) __fp_type_select(x, __isnormalf, __isnormal, __isnormall)
+-
+-#ifdef __MATH_BUILTIN_RELOPS
+-#define isgreater(x, y) __builtin_isgreater((x), (y))
+-#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))
+-#define isless(x, y) __builtin_isless((x), (y))
+-#define islessequal(x, y) __builtin_islessequal((x), (y))
+-#define islessgreater(x, y) __builtin_islessgreater((x), (y))
+-#define isunordered(x, y) __builtin_isunordered((x), (y))
+-#else
+-#define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y))
+-#define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y))
+-#define isless(x, y) (!isunordered((x), (y)) && (x) < (y))
+-#define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y))
+-#define islessgreater(x, y) (!isunordered((x), (y)) && \
+- ((x) > (y) || (y) > (x)))
+-#define isunordered(x, y) (isnan(x) || isnan(y))
+-#endif /* __MATH_BUILTIN_RELOPS */
+-
+-#define signbit(x) __fp_type_select(x, __signbitf, __signbit, __signbitl)
+-
+-typedef __double_t double_t;
+-typedef __float_t float_t;
+-#endif /* __ISO_C_VISIBLE >= 1999 */
+-
+-/*
+- * XOPEN/SVID
+- */
+-#if __BSD_VISIBLE || __XSI_VISIBLE
+-#define M_E 2.7182818284590452354 /* e */
+-#define M_LOG2E 1.4426950408889634074 /* log 2e */
+-#define M_LOG10E 0.43429448190325182765 /* log 10e */
+-#define M_LN2 0.69314718055994530942 /* log e2 */
+-#define M_LN10 2.30258509299404568402 /* log e10 */
+-#define M_PI 3.14159265358979323846 /* pi */
+-#define M_PI_2 1.57079632679489661923 /* pi/2 */
+-#define M_PI_4 0.78539816339744830962 /* pi/4 */
+-#define M_1_PI 0.31830988618379067154 /* 1/pi */
+-#define M_2_PI 0.63661977236758134308 /* 2/pi */
+-#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
+-#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
+-#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
+-
+-#define MAXFLOAT ((float)3.40282346638528860e+38)
+-extern int signgam;
+-#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
+-
+-#if __BSD_VISIBLE
+-#if 0
+-/* Old value from 4.4BSD-Lite math.h; this is probably better. */
+-#define HUGE HUGE_VAL
+-#else
+-#define HUGE MAXFLOAT
+-#endif
+-#endif /* __BSD_VISIBLE */
+-
+-/*
+- * Most of these functions depend on the rounding mode and have the side
+- * effect of raising floating-point exceptions, so they are not declared
+- * as __pure2. In C99, FENV_ACCESS affects the purity of these functions.
+- */
+-__BEGIN_DECLS
+-/*
+- * ANSI/POSIX
+- */
+-int __fpclassifyd(double) __pure2;
+-int __fpclassifyf(float) __pure2;
+-int __fpclassifyl(long double) __pure2;
+-int __isfinitef(float) __pure2;
+-int __isfinite(double) __pure2;
+-int __isfinitel(long double) __pure2;
+-int __isinff(float) __pure2;
+-int __isinf(double) __pure2;
+-int __isinfl(long double) __pure2;
+-int __isnormalf(float) __pure2;
+-int __isnormal(double) __pure2;
+-int __isnormall(long double) __pure2;
+-int __signbit(double) __pure2;
+-int __signbitf(float) __pure2;
+-int __signbitl(long double) __pure2;
+-
+-static __inline int
+-__inline_isnan(__const double __x)
+-{
+-
+- return (__x != __x);
+-}
+-
+-static __inline int
+-__inline_isnanf(__const float __x)
+-{
+-
+- return (__x != __x);
+-}
+-
+-static __inline int
+-__inline_isnanl(__const long double __x)
+-{
+-
+- return (__x != __x);
+-}
+-
+-/*
+- * Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and
+- * isinf() as functions taking double. C99, and the subsequent POSIX revisions
+- * (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating
+- * point type. If we are targeting SUSv2 and C99 or C11 (or C++11) then we
+- * expose the newer definition, assuming that the language spec takes
+- * precedence over the operating system interface spec.
+- */
+-#if __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999
+-#undef isinf
+-#undef isnan
+-int isinf(double);
+-int isnan(double);
+-#endif
+-
+ double acos(double);
+ double asin(double);
+ double atan(double);
+ double atan2(double, double);
+-double cos(double);
+-double sin(double);
+-double tan(double);
+
+ double cosh(double);
+ double sinh(double);
+ double tanh(double);
+
+ double exp(double);
+-double frexp(double, int *); /* fundamentally !__pure2 */
+-double ldexp(double, int);
+ double log(double);
+ double log10(double);
+-double modf(double, double *); /* fundamentally !__pure2 */
+
+ double pow(double, double);
+ double sqrt(double);
++double fabs(double);
+
++double floor(double);
++double trunc(double);
+ double ceil(double);
+-double fabs(double) __pure2;
+-double floor(double);
+-double fmod(double, double);
+
+-/*
+- * These functions are not in C90.
+- */
+-#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE
+ double acosh(double);
+ double asinh(double);
+ double atanh(double);
+ double cbrt(double);
+-double erf(double);
+-double erfc(double);
+-double exp2(double);
+ double expm1(double);
+-double fma(double, double, double);
+ double hypot(double, double);
+-int ilogb(double) __pure2;
+-double lgamma(double);
+-long long llrint(double);
+-long long llround(double);
+ double log1p(double);
+ double log2(double);
+-double logb(double);
+-long lrint(double);
+-long lround(double);
+-double nan(const char *) __pure2;
+-double nextafter(double, double);
+-double remainder(double, double);
+-double remquo(double, double, int *);
+ double rint(double);
+-#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
+-
+-#if __BSD_VISIBLE || __XSI_VISIBLE
+-double j0(double);
+-double j1(double);
+-double jn(int, double);
+-double y0(double);
+-double y1(double);
+-double yn(int, double);
+-
+-#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
+-double gamma(double);
+-#endif
+-
+-#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
+-double scalb(double, double);
+-#endif
+-#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
+-
+-#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
+-double copysign(double, double) __pure2;
+-double fdim(double, double);
+-double fmax(double, double) __pure2;
+-double fmin(double, double) __pure2;
++double copysign(double, double);
+ double nearbyint(double);
+-double round(double);
+-double scalbln(double, long);
+ double scalbn(double, int);
+-double tgamma(double);
+-double trunc(double);
+-#endif
+-
+-/*
+- * BSD math library entry points
+- */
+-#if __BSD_VISIBLE
+-double drem(double, double);
+-int finite(double) __pure2;
+-int isnanf(float) __pure2;
+-
+-/*
+- * Reentrant version of gamma & lgamma; passes signgam back by reference
+- * as the second argument; user must allocate space for signgam.
+- */
+-double gamma_r(double, int *);
+-double lgamma_r(double, int *);
+-
+-/*
+- * IEEE Test Vector
+- */
+-double significand(double);
+-#endif /* __BSD_VISIBLE */
+-
+-/* float versions of ANSI/POSIX functions */
+-#if __ISO_C_VISIBLE >= 1999
+-float acosf(float);
+-float asinf(float);
+-float atanf(float);
+-float atan2f(float, float);
+-float cosf(float);
+-float sinf(float);
+-float tanf(float);
+-
+-float coshf(float);
+-float sinhf(float);
+-float tanhf(float);
+-
+-float exp2f(float);
+-float expf(float);
+-float expm1f(float);
+-float frexpf(float, int *); /* fundamentally !__pure2 */
+-int ilogbf(float) __pure2;
+-float ldexpf(float, int);
+-float log10f(float);
+-float log1pf(float);
+-float log2f(float);
+-float logf(float);
+-float modff(float, float *); /* fundamentally !__pure2 */
+-
+-float powf(float, float);
+-float sqrtf(float);
+
+ float ceilf(float);
+-float fabsf(float) __pure2;
+ float floorf(float);
+-float fmodf(float, float);
+-float roundf(float);
+
+-float erff(float);
+-float erfcf(float);
+-float hypotf(float, float);
+-float lgammaf(float);
+-float tgammaf(float);
+-
+-float acoshf(float);
+-float asinhf(float);
+-float atanhf(float);
+-float cbrtf(float);
+-float logbf(float);
+-float copysignf(float, float) __pure2;
+-long long llrintf(float);
+-long long llroundf(float);
+-long lrintf(float);
+-long lroundf(float);
+-float nanf(const char *) __pure2;
+ float nearbyintf(float);
+-float nextafterf(float, float);
+-float remainderf(float, float);
+-float remquof(float, float, int *);
+ float rintf(float);
+-float scalblnf(float, long);
+-float scalbnf(float, int);
+ float truncf(float);
+
+-float fdimf(float, float);
+-float fmaf(float, float, float);
+-float fmaxf(float, float) __pure2;
+-float fminf(float, float) __pure2;
+-#endif
+-
+-/*
+- * float versions of BSD math library entry points
+- */
+-#if __BSD_VISIBLE
+-float dremf(float, float);
+-int finitef(float) __pure2;
+-float gammaf(float);
+-float j0f(float);
+-float j1f(float);
+-float jnf(int, float);
+-float scalbf(float, float);
+-float y0f(float);
+-float y1f(float);
+-float ynf(int, float);
+-
+-/*
+- * Float versions of reentrant version of gamma & lgamma; passes
+- * signgam back by reference as the second argument; user must
+- * allocate space for signgam.
+- */
+-float gammaf_r(float, int *);
+-float lgammaf_r(float, int *);
+-
+-/*
+- * float version of IEEE Test Vector
+- */
+-float significandf(float);
+-#endif /* __BSD_VISIBLE */
+-
+-/*
+- * long double versions of ISO/POSIX math functions
+- */
+-#if __ISO_C_VISIBLE >= 1999
+-long double acoshl(long double);
+-long double acosl(long double);
+-long double asinhl(long double);
+-long double asinl(long double);
+-long double atan2l(long double, long double);
+-long double atanhl(long double);
+-long double atanl(long double);
+-long double cbrtl(long double);
+-long double ceill(long double);
+-long double copysignl(long double, long double) __pure2;
+-long double coshl(long double);
+-long double cosl(long double);
+-long double erfcl(long double);
+-long double erfl(long double);
+-long double exp2l(long double);
+-long double expl(long double);
+-long double expm1l(long double);
+-long double fabsl(long double) __pure2;
+-long double fdiml(long double, long double);
+-long double floorl(long double);
+-long double fmal(long double, long double, long double);
+-long double fmaxl(long double, long double) __pure2;
+-long double fminl(long double, long double) __pure2;
+-long double fmodl(long double, long double);
+-long double frexpl(long double, int *); /* fundamentally !__pure2 */
+-long double hypotl(long double, long double);
+-int ilogbl(long double) __pure2;
+-long double ldexpl(long double, int);
+-long double lgammal(long double);
+-long long llrintl(long double);
+-long long llroundl(long double);
+-long double log10l(long double);
+-long double log1pl(long double);
+-long double log2l(long double);
+-long double logbl(long double);
+-long double logl(long double);
+-long lrintl(long double);
+-long lroundl(long double);
+-long double modfl(long double, long double *); /* fundamentally !__pure2 */
+-long double nanl(const char *) __pure2;
+-long double nearbyintl(long double);
+-long double nextafterl(long double, long double);
+-double nexttoward(double, long double);
+-float nexttowardf(float, long double);
+-long double nexttowardl(long double, long double);
+-long double powl(long double, long double);
+-long double remainderl(long double, long double);
+-long double remquol(long double, long double, int *);
+-long double rintl(long double);
+-long double roundl(long double);
+-long double scalblnl(long double, long);
+-long double scalbnl(long double, int);
+-long double sinhl(long double);
+-long double sinl(long double);
+-long double sqrtl(long double);
+-long double tanhl(long double);
+-long double tanl(long double);
+-long double tgammal(long double);
+-long double truncl(long double);
+-#endif /* __ISO_C_VISIBLE >= 1999 */
+-
+-#if __BSD_VISIBLE
+-long double lgammal_r(long double, int *);
+-#endif
+-
+-__END_DECLS
+-
+ #endif /* !_MATH_H_ */
diff --git a/modules/fdlibm/patches/02_change_include_guard_in_fdlibm_h.patch b/modules/fdlibm/patches/02_change_include_guard_in_fdlibm_h.patch
new file mode 100644
index 000000000..e96333bfa
--- /dev/null
+++ b/modules/fdlibm/patches/02_change_include_guard_in_fdlibm_h.patch
@@ -0,0 +1,35 @@
+diff --git a/modules/fdlibm/src/fdlibm.h b/modules/fdlibm/src/fdlibm.h
+--- a/modules/fdlibm/src/fdlibm.h
++++ b/modules/fdlibm/src/fdlibm.h
+@@ -9,18 +9,18 @@
+ * ====================================================
+ */
+
+ /*
+ * from: @(#)fdlibm.h 5.1 93/09/24
+ * $FreeBSD$
+ */
+
+-#ifndef _MATH_H_
+-#define _MATH_H_
++#ifndef mozilla_imported_fdlibm_h
++#define mozilla_imported_fdlibm_h
+
+ double acos(double);
+ double asin(double);
+ double atan(double);
+ double atan2(double, double);
+
+ double cosh(double);
+ double sinh(double);
+@@ -53,9 +53,9 @@ double scalbn(double, int);
+
+ float ceilf(float);
+ float floorf(float);
+
+ float nearbyintf(float);
+ float rintf(float);
+ float truncf(float);
+
+-#endif /* !_MATH_H_ */
++#endif /* mozilla_imported_fdlibm_h */
diff --git a/modules/fdlibm/patches/03_put_fdlibm_functions_into_fdlibm_namespace.patch b/modules/fdlibm/patches/03_put_fdlibm_functions_into_fdlibm_namespace.patch
new file mode 100644
index 000000000..66ae4525f
--- /dev/null
+++ b/modules/fdlibm/patches/03_put_fdlibm_functions_into_fdlibm_namespace.patch
@@ -0,0 +1,34 @@
+diff --git a/modules/fdlibm/src/fdlibm.h b/modules/fdlibm/src/fdlibm.h
+--- a/modules/fdlibm/src/fdlibm.h
++++ b/modules/fdlibm/src/fdlibm.h
+@@ -12,16 +12,18 @@
+ /*
+ * from: @(#)fdlibm.h 5.1 93/09/24
+ * $FreeBSD$
+ */
+
+ #ifndef mozilla_imported_fdlibm_h
+ #define mozilla_imported_fdlibm_h
+
++namespace fdlibm {
++
+ double acos(double);
+ double asin(double);
+ double atan(double);
+ double atan2(double, double);
+
+ double cosh(double);
+ double sinh(double);
+ double tanh(double);
+@@ -53,9 +55,11 @@ double scalbn(double, int);
+
+ float ceilf(float);
+ float floorf(float);
+
+ float nearbyintf(float);
+ float rintf(float);
+ float truncf(float);
+
++} /* namespace fdlibm */
++
+ #endif /* mozilla_imported_fdlibm_h */
diff --git a/modules/fdlibm/patches/04_include_fdlibm_h_from_math_private_h.patch b/modules/fdlibm/patches/04_include_fdlibm_h_from_math_private_h.patch
new file mode 100644
index 000000000..9c0569e27
--- /dev/null
+++ b/modules/fdlibm/patches/04_include_fdlibm_h_from_math_private_h.patch
@@ -0,0 +1,716 @@
+diff --git a/modules/fdlibm/src/e_acos.cpp b/modules/fdlibm/src/e_acos.cpp
+--- a/modules/fdlibm/src/e_acos.cpp
++++ b/modules/fdlibm/src/e_acos.cpp
+@@ -35,17 +35,16 @@
+ * if x is NaN, return x itself;
+ * if |x|>1, return NaN with invalid signal.
+ *
+ * Function needed: sqrt
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
+ pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */
+ pio2_hi = 1.57079632679489655800e+00; /* 0x3FF921FB, 0x54442D18 */
+ static volatile double
+ pio2_lo = 6.12323399573676603587e-17; /* 0x3C91A626, 0x33145C07 */
+diff --git a/modules/fdlibm/src/e_acosh.cpp b/modules/fdlibm/src/e_acosh.cpp
+--- a/modules/fdlibm/src/e_acosh.cpp
++++ b/modules/fdlibm/src/e_acosh.cpp
+@@ -26,17 +26,16 @@
+ *
+ * Special cases:
+ * acosh(x) is NaN with signal if x<1.
+ * acosh(NaN) is NaN without signal.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ one = 1.0,
+ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
+
+ double
+ __ieee754_acosh(double x)
+diff --git a/modules/fdlibm/src/e_asin.cpp b/modules/fdlibm/src/e_asin.cpp
+--- a/modules/fdlibm/src/e_asin.cpp
++++ b/modules/fdlibm/src/e_asin.cpp
+@@ -41,17 +41,16 @@
+ * Special cases:
+ * if x is NaN, return x itself;
+ * if |x|>1, return NaN with invalid signal.
+ *
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
+ huge = 1.000e+300,
+ pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */
+ pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */
+ pio4_hi = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */
+diff --git a/modules/fdlibm/src/e_atan2.cpp b/modules/fdlibm/src/e_atan2.cpp
+--- a/modules/fdlibm/src/e_atan2.cpp
++++ b/modules/fdlibm/src/e_atan2.cpp
+@@ -39,17 +39,16 @@
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static volatile double
+ tiny = 1.0e-300;
+ static const double
+ zero = 0.0,
+ pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */
+ pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */
+diff --git a/modules/fdlibm/src/e_atanh.cpp b/modules/fdlibm/src/e_atanh.cpp
+--- a/modules/fdlibm/src/e_atanh.cpp
++++ b/modules/fdlibm/src/e_atanh.cpp
+@@ -30,17 +30,16 @@
+ * atanh(x) is NaN if |x| > 1 with signal;
+ * atanh(NaN) is that NaN with no signal;
+ * atanh(+-1) is +-INF with signal.
+ *
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double one = 1.0, huge = 1e300;
+ static const double zero = 0.0;
+
+ double
+ __ieee754_atanh(double x)
+ {
+diff --git a/modules/fdlibm/src/e_cosh.cpp b/modules/fdlibm/src/e_cosh.cpp
+--- a/modules/fdlibm/src/e_cosh.cpp
++++ b/modules/fdlibm/src/e_cosh.cpp
+@@ -32,17 +32,16 @@
+ *
+ * Special cases:
+ * cosh(x) is |x| if x is +INF, -INF, or NaN.
+ * only cosh(0)=1 is exact for finite x.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double one = 1.0, half=0.5, huge = 1.0e300;
+
+ double
+ __ieee754_cosh(double x)
+ {
+ double t,w;
+diff --git a/modules/fdlibm/src/e_exp.cpp b/modules/fdlibm/src/e_exp.cpp
+--- a/modules/fdlibm/src/e_exp.cpp
++++ b/modules/fdlibm/src/e_exp.cpp
+@@ -73,17 +73,16 @@
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ one = 1.0,
+ halF[2] = {0.5,-0.5,},
+ o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
+ u_threshold= -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */
+ ln2HI[2] ={ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
+diff --git a/modules/fdlibm/src/e_hypot.cpp b/modules/fdlibm/src/e_hypot.cpp
+--- a/modules/fdlibm/src/e_hypot.cpp
++++ b/modules/fdlibm/src/e_hypot.cpp
+@@ -43,17 +43,16 @@
+ *
+ * Accuracy:
+ * hypot(x,y) returns sqrt(x^2+y^2) with error less
+ * than 1 ulps (units in the last place)
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ double
+ __ieee754_hypot(double x, double y)
+ {
+ double a,b,t1,t2,y1,y2,w;
+ int32_t j,k,ha,hb;
+
+diff --git a/modules/fdlibm/src/e_log.cpp b/modules/fdlibm/src/e_log.cpp
+--- a/modules/fdlibm/src/e_log.cpp
++++ b/modules/fdlibm/src/e_log.cpp
+@@ -62,17 +62,16 @@
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
+ ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
+ two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */
+ Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */
+ Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
+diff --git a/modules/fdlibm/src/e_log10.cpp b/modules/fdlibm/src/e_log10.cpp
+--- a/modules/fdlibm/src/e_log10.cpp
++++ b/modules/fdlibm/src/e_log10.cpp
+@@ -19,17 +19,16 @@
+ * comments.
+ *
+ * log10(x) = (f - 0.5*f*f + k_log1p(f)) / ln10 + k * log10(2)
+ * in not-quite-routine extra precision.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+ #include "k_log.h"
+
+ static const double
+ two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+ ivln10hi = 4.34294481878168880939e-01, /* 0x3fdbcb7b, 0x15200000 */
+ ivln10lo = 2.50829467116452752298e-11, /* 0x3dbb9438, 0xca9aadd5 */
+ log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
+diff --git a/modules/fdlibm/src/e_log2.cpp b/modules/fdlibm/src/e_log2.cpp
+--- a/modules/fdlibm/src/e_log2.cpp
++++ b/modules/fdlibm/src/e_log2.cpp
+@@ -21,17 +21,16 @@
+ * This reduces x to {k, 1+f} exactly as in e_log.c, then calls the kernel,
+ * then does the combining and scaling steps
+ * log2(x) = (f - 0.5*f*f + k_log1p(f)) / ln2 + k
+ * in not-quite-routine extra precision.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+ #include "k_log.h"
+
+ static const double
+ two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+ ivln2hi = 1.44269504072144627571e+00, /* 0x3ff71547, 0x65200000 */
+ ivln2lo = 1.67517131648865118353e-10; /* 0x3de705fc, 0x2eefa200 */
+
+diff --git a/modules/fdlibm/src/e_pow.cpp b/modules/fdlibm/src/e_pow.cpp
+--- a/modules/fdlibm/src/e_pow.cpp
++++ b/modules/fdlibm/src/e_pow.cpp
+@@ -52,17 +52,16 @@
+ *
+ * Constants :
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ bp[] = {1.0, 1.5,},
+ dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
+ dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
+ zero = 0.0,
+ one = 1.0,
+diff --git a/modules/fdlibm/src/e_sinh.cpp b/modules/fdlibm/src/e_sinh.cpp
+--- a/modules/fdlibm/src/e_sinh.cpp
++++ b/modules/fdlibm/src/e_sinh.cpp
+@@ -29,17 +29,16 @@
+ *
+ * Special cases:
+ * sinh(x) is |x| if x is +INF, -INF, or NaN.
+ * only sinh(0)=0 is exact for finite x.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double one = 1.0, shuge = 1.0e307;
+
+ double
+ __ieee754_sinh(double x)
+ {
+ double t,h;
+diff --git a/modules/fdlibm/src/e_sqrt.cpp b/modules/fdlibm/src/e_sqrt.cpp
+--- a/modules/fdlibm/src/e_sqrt.cpp
++++ b/modules/fdlibm/src/e_sqrt.cpp
+@@ -81,17 +81,16 @@
+ * sqrt(NaN) = NaN ... with invalid signal for signaling NaN
+ *
+ * Other methods : see the appended file at the end of the program below.
+ *---------------
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double one = 1.0, tiny=1.0e-300;
+
+ double
+ __ieee754_sqrt(double x)
+ {
+ double z;
+diff --git a/modules/fdlibm/src/k_exp.cpp b/modules/fdlibm/src/k_exp.cpp
+--- a/modules/fdlibm/src/k_exp.cpp
++++ b/modules/fdlibm/src/k_exp.cpp
+@@ -24,17 +24,16 @@
+ * SUCH DAMAGE.
+ */
+
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD$");
+
+ #include <complex.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const uint32_t k = 1799; /* constant for reduction */
+ static const double kln2 = 1246.97177782734161156; /* k * ln2 */
+
+ /*
+ * Compute exp(x), scaled to avoid spurious overflow. An exponent is
+ * returned separately in 'expt'.
+diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -15,16 +15,18 @@
+ */
+
+ #ifndef _MATH_PRIVATE_H_
+ #define _MATH_PRIVATE_H_
+
+ #include <sys/types.h>
+ #include <machine/endian.h>
+
++#include "fdlibm.h"
++
+ /*
+ * The original fdlibm code used statements like:
+ * n0 = ((*(int*)&one)>>29)^1; * index of high word *
+ * ix0 = *(n0+(int*)&x); * high word of x *
+ * ix1 = *((1-n0)+(int*)&x); * low word of x *
+ * to dig two 32 bit words out of the 64 bit IEEE floating point
+ * value. That is non-ANSI, and, moreover, the gcc instruction
+ * scheduler gets it wrong. We instead use the following macros.
+diff --git a/modules/fdlibm/src/s_asinh.cpp b/modules/fdlibm/src/s_asinh.cpp
+--- a/modules/fdlibm/src/s_asinh.cpp
++++ b/modules/fdlibm/src/s_asinh.cpp
+@@ -21,17 +21,16 @@
+ * asinh(x) := x if 1+x*x=1,
+ * := sign(x)*(log(x)+ln2)) for large |x|, else
+ * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
+ * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
+ ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
+ huge= 1.00000000000000000000e+300;
+
+ double
+diff --git a/modules/fdlibm/src/s_atan.cpp b/modules/fdlibm/src/s_atan.cpp
+--- a/modules/fdlibm/src/s_atan.cpp
++++ b/modules/fdlibm/src/s_atan.cpp
+@@ -30,17 +30,16 @@
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double atanhi[] = {
+ 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */
+ 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */
+ 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */
+ 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */
+ };
+diff --git a/modules/fdlibm/src/s_cbrt.cpp b/modules/fdlibm/src/s_cbrt.cpp
+--- a/modules/fdlibm/src/s_cbrt.cpp
++++ b/modules/fdlibm/src/s_cbrt.cpp
+@@ -10,17 +10,16 @@
+ * ====================================================
+ *
+ * Optimized by Bruce D. Evans.
+ */
+
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD$");
+
+-#include "math.h"
+ #include "math_private.h"
+
+ /* cbrt(x)
+ * Return cube root of x
+ */
+ static const u_int32_t
+ B1 = 715094163, /* B1 = (1023-1023/3-0.03306235651)*2**20 */
+ B2 = 696219795; /* B2 = (1023-1023/3-54/3-0.03306235651)*2**20 */
+diff --git a/modules/fdlibm/src/s_ceil.cpp b/modules/fdlibm/src/s_ceil.cpp
+--- a/modules/fdlibm/src/s_ceil.cpp
++++ b/modules/fdlibm/src/s_ceil.cpp
+@@ -19,17 +19,16 @@
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to ceil(x).
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double huge = 1.0e300;
+
+ double
+ ceil(double x)
+ {
+ int32_t i0,i1,j0;
+diff --git a/modules/fdlibm/src/s_ceilf.cpp b/modules/fdlibm/src/s_ceilf.cpp
+--- a/modules/fdlibm/src/s_ceilf.cpp
++++ b/modules/fdlibm/src/s_ceilf.cpp
+@@ -11,17 +11,16 @@
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD$");
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const float huge = 1.0e30;
+
+ float
+ ceilf(float x)
+ {
+ int32_t i0,j0;
+diff --git a/modules/fdlibm/src/s_copysign.cpp b/modules/fdlibm/src/s_copysign.cpp
+--- a/modules/fdlibm/src/s_copysign.cpp
++++ b/modules/fdlibm/src/s_copysign.cpp
+@@ -14,17 +14,16 @@
+ __FBSDID("$FreeBSD$");
+
+ /*
+ * copysign(double x, double y)
+ * copysign(x,y) returns a value with the magnitude of x and
+ * with the sign bit of y.
+ */
+
+-#include "math.h"
+ #include "math_private.h"
+
+ double
+ copysign(double x, double y)
+ {
+ u_int32_t hx,hy;
+ GET_HIGH_WORD(hx,x);
+ GET_HIGH_WORD(hy,y);
+diff --git a/modules/fdlibm/src/s_expm1.cpp b/modules/fdlibm/src/s_expm1.cpp
+--- a/modules/fdlibm/src/s_expm1.cpp
++++ b/modules/fdlibm/src/s_expm1.cpp
+@@ -105,17 +105,16 @@
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ one = 1.0,
+ tiny = 1.0e-300,
+ o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */
+ ln2_hi = 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */
+ ln2_lo = 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */
+diff --git a/modules/fdlibm/src/s_fabs.cpp b/modules/fdlibm/src/s_fabs.cpp
+--- a/modules/fdlibm/src/s_fabs.cpp
++++ b/modules/fdlibm/src/s_fabs.cpp
+@@ -13,17 +13,16 @@
+ #ifndef lint
+ static char rcsid[] = "$FreeBSD$";
+ #endif
+
+ /*
+ * fabs(x) returns the absolute value of x.
+ */
+
+-#include "math.h"
+ #include "math_private.h"
+
+ double
+ fabs(double x)
+ {
+ u_int32_t high;
+ GET_HIGH_WORD(high,x);
+ SET_HIGH_WORD(x,high&0x7fffffff);
+diff --git a/modules/fdlibm/src/s_floor.cpp b/modules/fdlibm/src/s_floor.cpp
+--- a/modules/fdlibm/src/s_floor.cpp
++++ b/modules/fdlibm/src/s_floor.cpp
+@@ -19,17 +19,16 @@
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to floor(x).
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double huge = 1.0e300;
+
+ double
+ floor(double x)
+ {
+ int32_t i0,i1,j0;
+diff --git a/modules/fdlibm/src/s_floorf.cpp b/modules/fdlibm/src/s_floorf.cpp
+--- a/modules/fdlibm/src/s_floorf.cpp
++++ b/modules/fdlibm/src/s_floorf.cpp
+@@ -20,17 +20,16 @@
+ * floorf(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to floorf(x).
+ */
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const float huge = 1.0e30;
+
+ float
+ floorf(float x)
+ {
+ int32_t i0,j0;
+diff --git a/modules/fdlibm/src/s_log1p.cpp b/modules/fdlibm/src/s_log1p.cpp
+--- a/modules/fdlibm/src/s_log1p.cpp
++++ b/modules/fdlibm/src/s_log1p.cpp
+@@ -75,17 +75,16 @@
+ * if(u==1.0) return x ; else
+ * return log(u)*(x/(u-1.0));
+ *
+ * See HP-15C Advanced Functions Handbook, p.193.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
+ ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
+ two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */
+ Lp1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */
+ Lp2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
+diff --git a/modules/fdlibm/src/s_nearbyint.cpp b/modules/fdlibm/src/s_nearbyint.cpp
+--- a/modules/fdlibm/src/s_nearbyint.cpp
++++ b/modules/fdlibm/src/s_nearbyint.cpp
+@@ -23,17 +23,17 @@
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD$");
+
+ #include <fenv.h>
+-#include <math.h>
++#include "math_private.h"
+
+ /*
+ * We save and restore the floating-point environment to avoid raising
+ * an inexact exception. We can get away with using fesetenv()
+ * instead of feclearexcept()/feupdateenv() to restore the environment
+ * because the only exception defined for rint() is overflow, and
+ * rounding can't overflow as long as emax >= p.
+ *
+diff --git a/modules/fdlibm/src/s_rint.cpp b/modules/fdlibm/src/s_rint.cpp
+--- a/modules/fdlibm/src/s_rint.cpp
++++ b/modules/fdlibm/src/s_rint.cpp
+@@ -20,17 +20,16 @@
+ * Method:
+ * Using floating addition.
+ * Exception:
+ * Inexact flag raised if x not equal to rint(x).
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ TWO52[2]={
+ 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
+ -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
+ };
+
+diff --git a/modules/fdlibm/src/s_rintf.cpp b/modules/fdlibm/src/s_rintf.cpp
+--- a/modules/fdlibm/src/s_rintf.cpp
++++ b/modules/fdlibm/src/s_rintf.cpp
+@@ -14,17 +14,16 @@
+ */
+
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD$");
+
+ #include <float.h>
+ #include <stdint.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const float
+ TWO23[2]={
+ 8.3886080000e+06, /* 0x4b000000 */
+ -8.3886080000e+06, /* 0xcb000000 */
+ };
+
+diff --git a/modules/fdlibm/src/s_scalbn.cpp b/modules/fdlibm/src/s_scalbn.cpp
+--- a/modules/fdlibm/src/s_scalbn.cpp
++++ b/modules/fdlibm/src/s_scalbn.cpp
+@@ -19,17 +19,16 @@ static char rcsid[] = "$FreeBSD$";
+ * scalbn(x,n) returns x* 2**n computed by exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+ #include <sys/cdefs.h>
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double
+ two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+ twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+ huge = 1.0e+300,
+ tiny = 1.0e-300;
+
+diff --git a/modules/fdlibm/src/s_tanh.cpp b/modules/fdlibm/src/s_tanh.cpp
+--- a/modules/fdlibm/src/s_tanh.cpp
++++ b/modules/fdlibm/src/s_tanh.cpp
+@@ -34,17 +34,16 @@
+ *
+ * Special cases:
+ * tanh(NaN) is NaN;
+ * only tanh(0)=0 is exact for finite argument.
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const volatile double tiny = 1.0e-300;
+ static const double one = 1.0, two = 2.0, huge = 1.0e300;
+
+ double
+ tanh(double x)
+ {
+diff --git a/modules/fdlibm/src/s_trunc.cpp b/modules/fdlibm/src/s_trunc.cpp
+--- a/modules/fdlibm/src/s_trunc.cpp
++++ b/modules/fdlibm/src/s_trunc.cpp
+@@ -19,17 +19,16 @@
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to trunc(x).
+ */
+
+ #include <float.h>
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const double huge = 1.0e300;
+
+ double
+ trunc(double x)
+ {
+ int32_t i0,i1,j0;
+diff --git a/modules/fdlibm/src/s_truncf.cpp b/modules/fdlibm/src/s_truncf.cpp
+--- a/modules/fdlibm/src/s_truncf.cpp
++++ b/modules/fdlibm/src/s_truncf.cpp
+@@ -17,17 +17,16 @@
+ * truncf(x)
+ * Return x rounded toward 0 to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to truncf(x).
+ */
+
+-#include "math.h"
+ #include "math_private.h"
+
+ static const float huge = 1.0e30F;
+
+ float
+ truncf(float x)
+ {
+ int32_t i0,j0;
diff --git a/modules/fdlibm/patches/05_include_stdint_h_in_math_private_h.patch b/modules/fdlibm/patches/05_include_stdint_h_in_math_private_h.patch
new file mode 100644
index 000000000..46355478f
--- /dev/null
+++ b/modules/fdlibm/patches/05_include_stdint_h_in_math_private_h.patch
@@ -0,0 +1,21 @@
+diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -12,16 +12,17 @@
+ /*
+ * from: @(#)fdlibm.h 5.1 93/09/24
+ * $FreeBSD$
+ */
+
+ #ifndef _MATH_PRIVATE_H_
+ #define _MATH_PRIVATE_H_
+
++#include <stdint.h>
+ #include <sys/types.h>
+ #include <machine/endian.h>
+
+ #include "fdlibm.h"
+
+ /*
+ * The original fdlibm code used statements like:
+ * n0 = ((*(int*)&one)>>29)^1; * index of high word *
diff --git a/modules/fdlibm/patches/06_use_mfbt_endian_h_in_math_private_h.patch b/modules/fdlibm/patches/06_use_mfbt_endian_h_in_math_private_h.patch
new file mode 100644
index 000000000..c8b30f20e
--- /dev/null
+++ b/modules/fdlibm/patches/06_use_mfbt_endian_h_in_math_private_h.patch
@@ -0,0 +1,74 @@
+diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -14,20 +14,21 @@
+ * $FreeBSD$
+ */
+
+ #ifndef _MATH_PRIVATE_H_
+ #define _MATH_PRIVATE_H_
+
+ #include <stdint.h>
+ #include <sys/types.h>
+-#include <machine/endian.h>
+
+ #include "fdlibm.h"
+
++#include "mozilla/EndianUtils.h"
++
+ /*
+ * The original fdlibm code used statements like:
+ * n0 = ((*(int*)&one)>>29)^1; * index of high word *
+ * ix0 = *(n0+(int*)&x); * high word of x *
+ * ix1 = *((1-n0)+(int*)&x); * low word of x *
+ * to dig two 32 bit words out of the 64 bit IEEE floating point
+ * value. That is non-ANSI, and, moreover, the gcc instruction
+ * scheduler gets it wrong. We instead use the following macros.
+@@ -36,27 +37,17 @@
+ * endianness at run time.
+ */
+
+ /*
+ * A union which permits us to convert between a double and two 32 bit
+ * ints.
+ */
+
+-#ifdef __arm__
+-#if defined(__VFP_FP__) || defined(__ARM_EABI__)
+-#define IEEE_WORD_ORDER BYTE_ORDER
+-#else
+-#define IEEE_WORD_ORDER BIG_ENDIAN
+-#endif
+-#else /* __arm__ */
+-#define IEEE_WORD_ORDER BYTE_ORDER
+-#endif
+-
+-#if IEEE_WORD_ORDER == BIG_ENDIAN
++#if MOZ_BIG_ENDIAN
+
+ typedef union
+ {
+ double value;
+ struct
+ {
+ u_int32_t msw;
+ u_int32_t lsw;
+@@ -64,17 +55,17 @@ typedef union
+ struct
+ {
+ u_int64_t w;
+ } xparts;
+ } ieee_double_shape_type;
+
+ #endif
+
+-#if IEEE_WORD_ORDER == LITTLE_ENDIAN
++#if MOZ_LITTLE_ENDIAN
+
+ typedef union
+ {
+ double value;
+ struct
+ {
+ u_int32_t lsw;
+ u_int32_t msw;
diff --git a/modules/fdlibm/patches/07_add_fdlibm_namespace_to_functions_defined_and_used_in_fdlibm.patch b/modules/fdlibm/patches/07_add_fdlibm_namespace_to_functions_defined_and_used_in_fdlibm.patch
new file mode 100644
index 000000000..b2f95f978
--- /dev/null
+++ b/modules/fdlibm/patches/07_add_fdlibm_namespace_to_functions_defined_and_used_in_fdlibm.patch
@@ -0,0 +1,55 @@
+diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -724,16 +724,51 @@ irintl(long double x)
+ #define __ieee754_j1f j1f
+ #define __ieee754_y0f y0f
+ #define __ieee754_y1f y1f
+ #define __ieee754_jnf jnf
+ #define __ieee754_ynf ynf
+ #define __ieee754_remainderf remainderf
+ #define __ieee754_scalbf scalbf
+
++#define acos fdlibm::acos
++#define asin fdlibm::asin
++#define atan fdlibm::atan
++#define atan2 fdlibm::atan2
++#define cosh fdlibm::cosh
++#define sinh fdlibm::sinh
++#define tanh fdlibm::tanh
++#define exp fdlibm::exp
++#define log fdlibm::log
++#define log10 fdlibm::log10
++#define pow fdlibm::pow
++#define sqrt fdlibm::sqrt
++#define ceil fdlibm::ceil
++#define ceilf fdlibm::ceilf
++#define fabs fdlibm::fabs
++#define floor fdlibm::floor
++#define acosh fdlibm::acosh
++#define asinh fdlibm::asinh
++#define atanh fdlibm::atanh
++#define cbrt fdlibm::cbrt
++#define expm1 fdlibm::expm1
++#define hypot fdlibm::hypot
++#define log1p fdlibm::log1p
++#define log2 fdlibm::log2
++#define scalb fdlibm::scalb
++#define copysign fdlibm::copysign
++#define scalbn fdlibm::scalbn
++#define trunc fdlibm::trunc
++#define truncf fdlibm::truncf
++#define floorf fdlibm::floorf
++#define nearbyint fdlibm::nearbyint
++#define nearbyintf fdlibm::nearbyintf
++#define rint fdlibm::rint
++#define rintf fdlibm::rintf
++
+ /* fdlibm kernel function */
+ int __kernel_rem_pio2(double*,double*,int,int,int);
+
+ /* double precision kernel functions */
+ #ifndef INLINE_REM_PIO2
+ int __ieee754_rem_pio2(double,double*);
+ #endif
+ double __kernel_sin(double,double,int);
diff --git a/modules/fdlibm/patches/08_remove_weak_reference_macro.patch b/modules/fdlibm/patches/08_remove_weak_reference_macro.patch
new file mode 100644
index 000000000..99f14cdfa
--- /dev/null
+++ b/modules/fdlibm/patches/08_remove_weak_reference_macro.patch
@@ -0,0 +1,393 @@
+diff --git a/modules/fdlibm/src/e_acos.cpp b/modules/fdlibm/src/e_acos.cpp
+--- a/modules/fdlibm/src/e_acos.cpp
++++ b/modules/fdlibm/src/e_acos.cpp
+@@ -99,12 +99,8 @@ double
+ c = (z-df*df)/(s+df);
+ p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5)))));
+ q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4)));
+ r = p/q;
+ w = r*s+c;
+ return 2.0*(df+w);
+ }
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(acos, acosl);
+-#endif
+diff --git a/modules/fdlibm/src/e_acosh.cpp b/modules/fdlibm/src/e_acosh.cpp
+--- a/modules/fdlibm/src/e_acosh.cpp
++++ b/modules/fdlibm/src/e_acosh.cpp
+@@ -56,12 +56,8 @@ double
+ } else if (hx > 0x40000000) { /* 2**28 > x > 2 */
+ t=x*x;
+ return __ieee754_log(2.0*x-one/(x+sqrt(t-one)));
+ } else { /* 1<x<2 */
+ t = x-one;
+ return log1p(t+sqrt(2.0*t+t*t));
+ }
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(acosh, acoshl);
+-#endif
+diff --git a/modules/fdlibm/src/e_asin.cpp b/modules/fdlibm/src/e_asin.cpp
+--- a/modules/fdlibm/src/e_asin.cpp
++++ b/modules/fdlibm/src/e_asin.cpp
+@@ -105,12 +105,8 @@ double
+ c = (t-w*w)/(s+w);
+ r = p/q;
+ p = 2.0*s*r-(pio2_lo-2.0*c);
+ q = pio4_hi-2.0*w;
+ t = pio4_hi-(p-q);
+ }
+ if(hx>0) return t; else return -t;
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(asin, asinl);
+-#endif
+diff --git a/modules/fdlibm/src/e_atan2.cpp b/modules/fdlibm/src/e_atan2.cpp
+--- a/modules/fdlibm/src/e_atan2.cpp
++++ b/modules/fdlibm/src/e_atan2.cpp
+@@ -117,12 +117,8 @@ double
+ switch (m) {
+ case 0: return z ; /* atan(+,+) */
+ case 1: return -z ; /* atan(-,+) */
+ case 2: return pi-(z-pi_lo);/* atan(+,-) */
+ default: /* case 3 */
+ return (z-pi_lo)-pi;/* atan(-,-) */
+ }
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(atan2, atan2l);
+-#endif
+diff --git a/modules/fdlibm/src/e_atanh.cpp b/modules/fdlibm/src/e_atanh.cpp
+--- a/modules/fdlibm/src/e_atanh.cpp
++++ b/modules/fdlibm/src/e_atanh.cpp
+@@ -56,12 +56,8 @@ double
+ SET_HIGH_WORD(x,ix);
+ if(ix<0x3fe00000) { /* x < 0.5 */
+ t = x+x;
+ t = 0.5*log1p(t+t*x/(one-x));
+ } else
+ t = 0.5*log1p((x+x)/(one-x));
+ if(hx>=0) return t; else return -t;
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(atanh, atanhl);
+-#endif
+diff --git a/modules/fdlibm/src/e_cosh.cpp b/modules/fdlibm/src/e_cosh.cpp
+--- a/modules/fdlibm/src/e_cosh.cpp
++++ b/modules/fdlibm/src/e_cosh.cpp
+@@ -73,12 +73,8 @@ double
+
+ /* |x| in [log(maxdouble), overflowthresold] */
+ if (ix<=0x408633CE)
+ return __ldexp_exp(fabs(x), -1);
+
+ /* |x| > overflowthresold, cosh(x) overflow */
+ return huge*huge;
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(cosh, coshl);
+-#endif
+diff --git a/modules/fdlibm/src/e_exp.cpp b/modules/fdlibm/src/e_exp.cpp
+--- a/modules/fdlibm/src/e_exp.cpp
++++ b/modules/fdlibm/src/e_exp.cpp
+@@ -152,12 +152,8 @@ double
+ else y = one-((lo-(x*c)/(2.0-c))-hi);
+ if(k >= -1021) {
+ if (k==1024) return y*2.0*0x1p1023;
+ return y*twopk;
+ } else {
+ return y*twopk*twom1000;
+ }
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(exp, expl);
+-#endif
+diff --git a/modules/fdlibm/src/e_hypot.cpp b/modules/fdlibm/src/e_hypot.cpp
+--- a/modules/fdlibm/src/e_hypot.cpp
++++ b/modules/fdlibm/src/e_hypot.cpp
+@@ -119,12 +119,8 @@ double
+ if(k!=0) {
+ u_int32_t high;
+ t1 = 1.0;
+ GET_HIGH_WORD(high,t1);
+ SET_HIGH_WORD(t1,high+(k<<20));
+ return t1*w;
+ } else return w;
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(hypot, hypotl);
+-#endif
+diff --git a/modules/fdlibm/src/e_log.cpp b/modules/fdlibm/src/e_log.cpp
+--- a/modules/fdlibm/src/e_log.cpp
++++ b/modules/fdlibm/src/e_log.cpp
+@@ -135,12 +135,8 @@ double
+ hfsq=0.5*f*f;
+ if(k==0) return f-(hfsq-s*(hfsq+R)); else
+ return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f);
+ } else {
+ if(k==0) return f-s*(f-R); else
+ return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f);
+ }
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(log, logl);
+-#endif
+diff --git a/modules/fdlibm/src/e_log10.cpp b/modules/fdlibm/src/e_log10.cpp
+--- a/modules/fdlibm/src/e_log10.cpp
++++ b/modules/fdlibm/src/e_log10.cpp
+@@ -82,12 +82,8 @@ double
+ * with some parallelism and it reduces the error for many args.
+ */
+ w = y2 + val_hi;
+ val_lo += (y2 - w) + val_hi;
+ val_hi = w;
+
+ return val_lo + val_hi;
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(log10, log10l);
+-#endif
+diff --git a/modules/fdlibm/src/e_log2.cpp b/modules/fdlibm/src/e_log2.cpp
+--- a/modules/fdlibm/src/e_log2.cpp
++++ b/modules/fdlibm/src/e_log2.cpp
+@@ -105,12 +105,8 @@ double
+
+ /* spadd(val_hi, val_lo, y), except for not using double_t: */
+ w = y + val_hi;
+ val_lo += (y - w) + val_hi;
+ val_hi = w;
+
+ return val_lo + val_hi;
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(log2, log2l);
+-#endif
+diff --git a/modules/fdlibm/src/e_sinh.cpp b/modules/fdlibm/src/e_sinh.cpp
+--- a/modules/fdlibm/src/e_sinh.cpp
++++ b/modules/fdlibm/src/e_sinh.cpp
+@@ -67,12 +67,8 @@ double
+
+ /* |x| in [log(maxdouble), overflowthresold] */
+ if (ix<=0x408633CE)
+ return h*2.0*__ldexp_exp(fabs(x), -1);
+
+ /* |x| > overflowthresold, sinh(x) overflow */
+ return x*shuge;
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(sinh, sinhl);
+-#endif
+diff --git a/modules/fdlibm/src/e_sqrt.cpp b/modules/fdlibm/src/e_sqrt.cpp
+--- a/modules/fdlibm/src/e_sqrt.cpp
++++ b/modules/fdlibm/src/e_sqrt.cpp
+@@ -182,20 +182,16 @@ double
+ ix0 = (q>>1)+0x3fe00000;
+ ix1 = q1>>1;
+ if ((q&1)==1) ix1 |= sign;
+ ix0 += (m <<20);
+ INSERT_WORDS(z,ix0,ix1);
+ return z;
+ }
+
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(sqrt, sqrtl);
+-#endif
+-
+ /*
+ Other methods (use floating-point arithmetic)
+ -------------
+ (This is a copy of a drafted paper by Prof W. Kahan
+ and K.C. Ng, written in May, 1986)
+
+ Two algorithms are given here to implement sqrt(x)
+ (IEEE double precision arithmetic) in software.
+diff --git a/modules/fdlibm/src/s_asinh.cpp b/modules/fdlibm/src/s_asinh.cpp
+--- a/modules/fdlibm/src/s_asinh.cpp
++++ b/modules/fdlibm/src/s_asinh.cpp
+@@ -50,12 +50,8 @@ asinh(double x)
+ t = fabs(x);
+ w = __ieee754_log(2.0*t+one/(__ieee754_sqrt(x*x+one)+t));
+ } else { /* 2.0 > |x| > 2**-28 */
+ t = x*x;
+ w =log1p(fabs(x)+t/(one+__ieee754_sqrt(one+t)));
+ }
+ if(hx>0) return w; else return -w;
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(asinh, asinhl);
+-#endif
+diff --git a/modules/fdlibm/src/s_atan.cpp b/modules/fdlibm/src/s_atan.cpp
+--- a/modules/fdlibm/src/s_atan.cpp
++++ b/modules/fdlibm/src/s_atan.cpp
+@@ -112,12 +112,8 @@ atan(double x)
+ s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10])))));
+ s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9]))));
+ if (id<0) return x - x*(s1+s2);
+ else {
+ z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x);
+ return (hx<0)? -z:z;
+ }
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(atan, atanl);
+-#endif
+diff --git a/modules/fdlibm/src/s_cbrt.cpp b/modules/fdlibm/src/s_cbrt.cpp
+--- a/modules/fdlibm/src/s_cbrt.cpp
++++ b/modules/fdlibm/src/s_cbrt.cpp
+@@ -105,12 +105,8 @@ cbrt(double x)
+ s=t*t; /* t*t is exact */
+ r=x/s; /* error <= 0.5 ulps; |r| < |t| */
+ w=t+t; /* t+t is exact */
+ r=(r-t)/(w+r); /* r-t is exact; w+r ~= 3*t */
+ t=t+t*r; /* error <= 0.5 + 0.5/3 + epsilon */
+
+ return(t);
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(cbrt, cbrtl);
+-#endif
+diff --git a/modules/fdlibm/src/s_ceil.cpp b/modules/fdlibm/src/s_ceil.cpp
+--- a/modules/fdlibm/src/s_ceil.cpp
++++ b/modules/fdlibm/src/s_ceil.cpp
+@@ -65,12 +65,8 @@ ceil(double x)
+ }
+ }
+ i1 &= (~i);
+ }
+ }
+ INSERT_WORDS(x,i0,i1);
+ return x;
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(ceil, ceill);
+-#endif
+diff --git a/modules/fdlibm/src/s_expm1.cpp b/modules/fdlibm/src/s_expm1.cpp
+--- a/modules/fdlibm/src/s_expm1.cpp
++++ b/modules/fdlibm/src/s_expm1.cpp
+@@ -210,12 +210,8 @@ expm1(double x)
+ SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */
+ y = x-(e+t);
+ y += one;
+ y = y*twopk;
+ }
+ }
+ return y;
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(expm1, expm1l);
+-#endif
+diff --git a/modules/fdlibm/src/s_floor.cpp b/modules/fdlibm/src/s_floor.cpp
+--- a/modules/fdlibm/src/s_floor.cpp
++++ b/modules/fdlibm/src/s_floor.cpp
+@@ -66,12 +66,8 @@ floor(double x)
+ }
+ }
+ i1 &= (~i);
+ }
+ }
+ INSERT_WORDS(x,i0,i1);
+ return x;
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(floor, floorl);
+-#endif
+diff --git a/modules/fdlibm/src/s_log1p.cpp b/modules/fdlibm/src/s_log1p.cpp
+--- a/modules/fdlibm/src/s_log1p.cpp
++++ b/modules/fdlibm/src/s_log1p.cpp
+@@ -168,12 +168,8 @@ log1p(double x)
+ return k*ln2_hi-((R-(k*ln2_lo+c))-f);
+ }
+ s = f/(2.0+f);
+ z = s*s;
+ R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7))))));
+ if(k==0) return f-(hfsq-s*(hfsq+R)); else
+ return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f);
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(log1p, log1pl);
+-#endif
+diff --git a/modules/fdlibm/src/s_rint.cpp b/modules/fdlibm/src/s_rint.cpp
+--- a/modules/fdlibm/src/s_rint.cpp
++++ b/modules/fdlibm/src/s_rint.cpp
+@@ -80,12 +80,8 @@ rint(double x)
+ if((i1&i)==0) return x; /* x is integral */
+ i>>=1;
+ if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
+ }
+ INSERT_WORDS(x,i0,i1);
+ STRICT_ASSIGN(double,w,TWO52[sx]+x);
+ return w-TWO52[sx];
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(rint, rintl);
+-#endif
+diff --git a/modules/fdlibm/src/s_scalbn.cpp b/modules/fdlibm/src/s_scalbn.cpp
+--- a/modules/fdlibm/src/s_scalbn.cpp
++++ b/modules/fdlibm/src/s_scalbn.cpp
+@@ -53,13 +53,8 @@ scalbn (double x, int n)
+ if (k <= -54)
+ if (n > 50000) /* in case integer overflow in n+k */
+ return huge*copysign(huge,x); /*overflow*/
+ else return tiny*copysign(tiny,x); /*underflow*/
+ k += 54; /* subnormal result */
+ SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
+ return x*twom54;
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(scalbn, ldexpl);
+-__weak_reference(scalbn, scalbnl);
+-#endif
+diff --git a/modules/fdlibm/src/s_tanh.cpp b/modules/fdlibm/src/s_tanh.cpp
+--- a/modules/fdlibm/src/s_tanh.cpp
++++ b/modules/fdlibm/src/s_tanh.cpp
+@@ -72,12 +72,8 @@ tanh(double x)
+ z= -t/(t+two);
+ }
+ /* |x| >= 22, return +-1 */
+ } else {
+ z = one - tiny; /* raise inexact flag */
+ }
+ return (jx>=0)? z: -z;
+ }
+-
+-#if (LDBL_MANT_DIG == 53)
+-__weak_reference(tanh, tanhl);
+-#endif
+diff --git a/modules/fdlibm/src/s_trunc.cpp b/modules/fdlibm/src/s_trunc.cpp
+--- a/modules/fdlibm/src/s_trunc.cpp
++++ b/modules/fdlibm/src/s_trunc.cpp
+@@ -55,12 +55,8 @@ trunc(double x)
+ i = ((u_int32_t)(0xffffffff))>>(j0-20);
+ if((i1&i)==0) return x; /* x is integral */
+ if(huge+x>0.0) /* raise inexact flag */
+ i1 &= (~i);
+ }
+ INSERT_WORDS(x,i0,i1);
+ return x;
+ }
+-
+-#if LDBL_MANT_DIG == 53
+-__weak_reference(trunc, truncl);
+-#endif
diff --git a/modules/fdlibm/patches/09_comment_out_rcsid_variable.patch b/modules/fdlibm/patches/09_comment_out_rcsid_variable.patch
new file mode 100644
index 000000000..464f2d6fd
--- /dev/null
+++ b/modules/fdlibm/patches/09_comment_out_rcsid_variable.patch
@@ -0,0 +1,849 @@
+diff --git a/modules/fdlibm/src/e_acos.cpp b/modules/fdlibm/src/e_acos.cpp
+--- a/modules/fdlibm/src/e_acos.cpp
++++ b/modules/fdlibm/src/e_acos.cpp
+@@ -6,18 +6,18 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_acos(x)
+ * Method :
+ * acos(x) = pi/2 - asin(x)
+ * acos(-x) = pi/2 + asin(x)
+ * For |x|<=0.5
+ * acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c)
+ * For x>0.5
+diff --git a/modules/fdlibm/src/e_acosh.cpp b/modules/fdlibm/src/e_acosh.cpp
+--- a/modules/fdlibm/src/e_acosh.cpp
++++ b/modules/fdlibm/src/e_acosh.cpp
+@@ -7,18 +7,18 @@
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ *
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_acosh(x)
+ * Method :
+ * Based on
+ * acosh(x) = log [ x + sqrt(x*x-1) ]
+ * we have
+ * acosh(x) := log(x)+ln2, if x is large; else
+ * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else
+diff --git a/modules/fdlibm/src/e_asin.cpp b/modules/fdlibm/src/e_asin.cpp
+--- a/modules/fdlibm/src/e_asin.cpp
++++ b/modules/fdlibm/src/e_asin.cpp
+@@ -6,18 +6,18 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_asin(x)
+ * Method :
+ * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...
+ * we approximate asin(x) on [0,0.5] by
+ * asin(x) = x + x*x^2*R(x^2)
+ * where
+ * R(x^2) is a rational approximation of (asin(x)-x)/x^3
+diff --git a/modules/fdlibm/src/e_atan2.cpp b/modules/fdlibm/src/e_atan2.cpp
+--- a/modules/fdlibm/src/e_atan2.cpp
++++ b/modules/fdlibm/src/e_atan2.cpp
+@@ -7,18 +7,18 @@
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ *
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_atan2(y,x)
+ * Method :
+ * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
+ * 2. Reduce x to positive by (if x and y are unexceptional):
+ * ARG (x+iy) = arctan(y/x) ... if x > 0,
+ * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
+ *
+diff --git a/modules/fdlibm/src/e_atanh.cpp b/modules/fdlibm/src/e_atanh.cpp
+--- a/modules/fdlibm/src/e_atanh.cpp
++++ b/modules/fdlibm/src/e_atanh.cpp
+@@ -7,18 +7,18 @@
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ *
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_atanh(x)
+ * Method :
+ * 1.Reduced x to positive by atanh(-x) = -atanh(x)
+ * 2.For x>=0.5
+ * 1 2x x
+ * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
+ * 2 1 - x 1 - x
+diff --git a/modules/fdlibm/src/e_cosh.cpp b/modules/fdlibm/src/e_cosh.cpp
+--- a/modules/fdlibm/src/e_cosh.cpp
++++ b/modules/fdlibm/src/e_cosh.cpp
+@@ -6,18 +6,18 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_cosh(x)
+ * Method :
+ * mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2
+ * 1. Replace x by |x| (cosh(x) = cosh(-x)).
+ * 2.
+ * [ exp(x) - 1 ]^2
+ * 0 <= x <= ln2/2 : cosh(x) := 1 + -------------------
+diff --git a/modules/fdlibm/src/e_exp.cpp b/modules/fdlibm/src/e_exp.cpp
+--- a/modules/fdlibm/src/e_exp.cpp
++++ b/modules/fdlibm/src/e_exp.cpp
+@@ -5,18 +5,18 @@
+ * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_exp(x)
+ * Returns the exponential of x.
+ *
+ * Method
+ * 1. Argument reduction:
+ * Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
+ * Given x, find r and integer k such that
+diff --git a/modules/fdlibm/src/e_hypot.cpp b/modules/fdlibm/src/e_hypot.cpp
+--- a/modules/fdlibm/src/e_hypot.cpp
++++ b/modules/fdlibm/src/e_hypot.cpp
+@@ -6,18 +6,18 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_hypot(x,y)
+ *
+ * Method :
+ * If (assume round-to-nearest) z=x*x+y*y
+ * has error less than sqrt(2)/2 ulp, than
+ * sqrt(z) has error less than 1 ulp (exercise).
+ *
+diff --git a/modules/fdlibm/src/e_log.cpp b/modules/fdlibm/src/e_log.cpp
+--- a/modules/fdlibm/src/e_log.cpp
++++ b/modules/fdlibm/src/e_log.cpp
+@@ -6,18 +6,18 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_log(x)
+ * Return the logrithm of x
+ *
+ * Method :
+ * 1. Argument Reduction: find k and f such that
+ * x = 2^k * (1+f),
+ * where sqrt(2)/2 < 1+f < sqrt(2) .
+diff --git a/modules/fdlibm/src/e_log10.cpp b/modules/fdlibm/src/e_log10.cpp
+--- a/modules/fdlibm/src/e_log10.cpp
++++ b/modules/fdlibm/src/e_log10.cpp
+@@ -6,32 +6,32 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * Return the base 10 logarithm of x. See e_log.c and k_log.h for most
+ * comments.
+ *
+ * log10(x) = (f - 0.5*f*f + k_log1p(f)) / ln10 + k * log10(2)
+ * in not-quite-routine extra precision.
+ */
+
+ #include <float.h>
+
+ #include "math_private.h"
+ #include "k_log.h"
+-
++
+ static const double
+ two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+ ivln10hi = 4.34294481878168880939e-01, /* 0x3fdbcb7b, 0x15200000 */
+ ivln10lo = 2.50829467116452752298e-11, /* 0x3dbb9438, 0xca9aadd5 */
+ log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
+ log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
+
+ static const double zero = 0.0;
+diff --git a/modules/fdlibm/src/e_log2.cpp b/modules/fdlibm/src/e_log2.cpp
+--- a/modules/fdlibm/src/e_log2.cpp
++++ b/modules/fdlibm/src/e_log2.cpp
+@@ -6,18 +6,18 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * Return the base 2 logarithm of x. See e_log.c and k_log.h for most
+ * comments.
+ *
+ * This reduces x to {k, 1+f} exactly as in e_log.c, then calls the kernel,
+ * then does the combining and scaling steps
+ * log2(x) = (f - 0.5*f*f + k_log1p(f)) / ln2 + k
+diff --git a/modules/fdlibm/src/e_pow.cpp b/modules/fdlibm/src/e_pow.cpp
+--- a/modules/fdlibm/src/e_pow.cpp
++++ b/modules/fdlibm/src/e_pow.cpp
+@@ -4,18 +4,18 @@
+ * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_pow(x,y) return x**y
+ *
+ * n
+ * Method: Let x = 2 * (1+f)
+ * 1. Compute and return log2(x) in two pieces:
+ * log2(x) = w1 + w2,
+ * where w1 has 53-24 = 29 bit trailing zeros.
+diff --git a/modules/fdlibm/src/e_sinh.cpp b/modules/fdlibm/src/e_sinh.cpp
+--- a/modules/fdlibm/src/e_sinh.cpp
++++ b/modules/fdlibm/src/e_sinh.cpp
+@@ -6,18 +6,18 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_sinh(x)
+ * Method :
+ * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
+ * 1. Replace x by |x| (sinh(-x) = -sinh(x)).
+ * 2.
+ * E + E/(E+1)
+ * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
+diff --git a/modules/fdlibm/src/e_sqrt.cpp b/modules/fdlibm/src/e_sqrt.cpp
+--- a/modules/fdlibm/src/e_sqrt.cpp
++++ b/modules/fdlibm/src/e_sqrt.cpp
+@@ -6,18 +6,18 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* __ieee754_sqrt(x)
+ * Return correctly rounded sqrt.
+ * ------------------------------------------
+ * | Use the hardware sqrt if you have one |
+ * ------------------------------------------
+ * Method:
+ * Bit by bit method using integer arithmetic. (Slow, but portable)
+diff --git a/modules/fdlibm/src/k_exp.cpp b/modules/fdlibm/src/k_exp.cpp
+--- a/modules/fdlibm/src/k_exp.cpp
++++ b/modules/fdlibm/src/k_exp.cpp
+@@ -19,22 +19,22 @@
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ #include <complex.h>
+
+-#include "math_private.h"
++ #include "math_private.h"
+
+ static const uint32_t k = 1799; /* constant for reduction */
+ static const double kln2 = 1246.97177782734161156; /* k * ln2 */
+
+ /*
+ * Compute exp(x), scaled to avoid spurious overflow. An exponent is
+ * returned separately in 'expt'.
+ *
+diff --git a/modules/fdlibm/src/k_log.h b/modules/fdlibm/src/k_log.h
+--- a/modules/fdlibm/src/k_log.h
++++ b/modules/fdlibm/src/k_log.h
+@@ -6,18 +6,18 @@
+ *
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * k_log1p(f):
+ * Return log(1+f) - f for 1+f in ~[sqrt(2)/2, sqrt(2)].
+ *
+ * The following describes the overall strategy for computing
+ * logarithms in base e. The argument reduction and adding the final
+ * term of the polynomial are done by the caller for increased accuracy
+diff --git a/modules/fdlibm/src/s_asinh.cpp b/modules/fdlibm/src/s_asinh.cpp
+--- a/modules/fdlibm/src/s_asinh.cpp
++++ b/modules/fdlibm/src/s_asinh.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* asinh(x)
+ * Method :
+ * Based on
+ * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
+ * we have
+ * asinh(x) := x if 1+x*x=1,
+ * := sign(x)*(log(x)+ln2)) for large |x|, else
+diff --git a/modules/fdlibm/src/s_atan.cpp b/modules/fdlibm/src/s_atan.cpp
+--- a/modules/fdlibm/src/s_atan.cpp
++++ b/modules/fdlibm/src/s_atan.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* atan(x)
+ * Method
+ * 1. Reduce x to positive by atan(x) = -atan(-x).
+ * 2. According to the integer k=4t+0.25 chopped, t=x, the argument
+ * is further reduced to one of the following intervals and the
+ * arctangent of t is evaluated by the corresponding formula:
+ *
+diff --git a/modules/fdlibm/src/s_cbrt.cpp b/modules/fdlibm/src/s_cbrt.cpp
+--- a/modules/fdlibm/src/s_cbrt.cpp
++++ b/modules/fdlibm/src/s_cbrt.cpp
+@@ -7,18 +7,18 @@
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ *
+ * Optimized by Bruce D. Evans.
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ #include "math_private.h"
+
+ /* cbrt(x)
+ * Return cube root of x
+ */
+ static const u_int32_t
+ B1 = 715094163, /* B1 = (1023-1023/3-0.03306235651)*2**20 */
+diff --git a/modules/fdlibm/src/s_ceil.cpp b/modules/fdlibm/src/s_ceil.cpp
+--- a/modules/fdlibm/src/s_ceil.cpp
++++ b/modules/fdlibm/src/s_ceil.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * ceil(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to ceil(x).
+diff --git a/modules/fdlibm/src/s_ceilf.cpp b/modules/fdlibm/src/s_ceilf.cpp
+--- a/modules/fdlibm/src/s_ceilf.cpp
++++ b/modules/fdlibm/src/s_ceilf.cpp
+@@ -8,18 +8,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ #include "math_private.h"
+
+ static const float huge = 1.0e30;
+
+ float
+ ceilf(float x)
+ {
+diff --git a/modules/fdlibm/src/s_copysign.cpp b/modules/fdlibm/src/s_copysign.cpp
+--- a/modules/fdlibm/src/s_copysign.cpp
++++ b/modules/fdlibm/src/s_copysign.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * copysign(double x, double y)
+ * copysign(x,y) returns a value with the magnitude of x and
+ * with the sign bit of y.
+ */
+
+ #include "math_private.h"
+diff --git a/modules/fdlibm/src/s_expm1.cpp b/modules/fdlibm/src/s_expm1.cpp
+--- a/modules/fdlibm/src/s_expm1.cpp
++++ b/modules/fdlibm/src/s_expm1.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* expm1(x)
+ * Returns exp(x)-1, the exponential of x minus 1.
+ *
+ * Method
+ * 1. Argument reduction:
+ * Given x, find r and integer k such that
+ *
+diff --git a/modules/fdlibm/src/s_fabs.cpp b/modules/fdlibm/src/s_fabs.cpp
+--- a/modules/fdlibm/src/s_fabs.cpp
++++ b/modules/fdlibm/src/s_fabs.cpp
+@@ -1,22 +1,22 @@
+-/* @(#)s_fabs.c 5.1 93/09/24 */
++ /* @(#)s_fabs.c 5.1 93/09/24 */
+ /*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+ #ifndef lint
+-static char rcsid[] = "$FreeBSD$";
++ //static char rcsid[] = "$FreeBSD$";
+ #endif
+
+ /*
+ * fabs(x) returns the absolute value of x.
+ */
+
+ #include "math_private.h"
+
+diff --git a/modules/fdlibm/src/s_floor.cpp b/modules/fdlibm/src/s_floor.cpp
+--- a/modules/fdlibm/src/s_floor.cpp
++++ b/modules/fdlibm/src/s_floor.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * floor(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to floor(x).
+diff --git a/modules/fdlibm/src/s_floorf.cpp b/modules/fdlibm/src/s_floorf.cpp
+--- a/modules/fdlibm/src/s_floorf.cpp
++++ b/modules/fdlibm/src/s_floorf.cpp
+@@ -8,18 +8,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * floorf(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to floorf(x).
+diff --git a/modules/fdlibm/src/s_log1p.cpp b/modules/fdlibm/src/s_log1p.cpp
+--- a/modules/fdlibm/src/s_log1p.cpp
++++ b/modules/fdlibm/src/s_log1p.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* double log1p(double x)
+ *
+ * Method :
+ * 1. Argument Reduction: find k and f such that
+ * 1+x = 2^k * (1+f),
+ * where sqrt(2)/2 < 1+f < sqrt(2) .
+ *
+diff --git a/modules/fdlibm/src/s_nearbyint.cpp b/modules/fdlibm/src/s_nearbyint.cpp
+--- a/modules/fdlibm/src/s_nearbyint.cpp
++++ b/modules/fdlibm/src/s_nearbyint.cpp
+@@ -19,18 +19,18 @@
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ #include <fenv.h>
+ #include "math_private.h"
+
+ /*
+ * We save and restore the floating-point environment to avoid raising
+ * an inexact exception. We can get away with using fesetenv()
+ * instead of feclearexcept()/feupdateenv() to restore the environment
+diff --git a/modules/fdlibm/src/s_rint.cpp b/modules/fdlibm/src/s_rint.cpp
+--- a/modules/fdlibm/src/s_rint.cpp
++++ b/modules/fdlibm/src/s_rint.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * rint(x)
+ * Return x rounded to integral value according to the prevailing
+ * rounding mode.
+ * Method:
+ * Using floating addition.
+ * Exception:
+diff --git a/modules/fdlibm/src/s_rintf.cpp b/modules/fdlibm/src/s_rintf.cpp
+--- a/modules/fdlibm/src/s_rintf.cpp
++++ b/modules/fdlibm/src/s_rintf.cpp
+@@ -8,18 +8,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ #include <float.h>
+ #include <stdint.h>
+
+ #include "math_private.h"
+
+ static const float
+ TWO23[2]={
+diff --git a/modules/fdlibm/src/s_scalbn.cpp b/modules/fdlibm/src/s_scalbn.cpp
+--- a/modules/fdlibm/src/s_scalbn.cpp
++++ b/modules/fdlibm/src/s_scalbn.cpp
+@@ -6,27 +6,27 @@
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+ #ifndef lint
+-static char rcsid[] = "$FreeBSD$";
++//static char rcsid[] = "$FreeBSD$";
+ #endif
+
+ /*
+ * scalbn (double x, int n)
+ * scalbn(x,n) returns x* 2**n computed by exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+-#include <sys/cdefs.h>
++//#include <sys/cdefs.h>
+ #include <float.h>
+
+ #include "math_private.h"
+
+ static const double
+ two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+ twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+ huge = 1.0e+300,
+diff --git a/modules/fdlibm/src/s_tanh.cpp b/modules/fdlibm/src/s_tanh.cpp
+--- a/modules/fdlibm/src/s_tanh.cpp
++++ b/modules/fdlibm/src/s_tanh.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /* Tanh(x)
+ * Return the Hyperbolic Tangent of x
+ *
+ * Method :
+ * x -x
+ * e - e
+ * 0. tanh(x) is defined to be -----------
+diff --git a/modules/fdlibm/src/s_trunc.cpp b/modules/fdlibm/src/s_trunc.cpp
+--- a/modules/fdlibm/src/s_trunc.cpp
++++ b/modules/fdlibm/src/s_trunc.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * trunc(x)
+ * Return x rounded toward 0 to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to trunc(x).
+diff --git a/modules/fdlibm/src/s_truncf.cpp b/modules/fdlibm/src/s_truncf.cpp
+--- a/modules/fdlibm/src/s_truncf.cpp
++++ b/modules/fdlibm/src/s_truncf.cpp
+@@ -5,18 +5,18 @@
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+-#include <sys/cdefs.h>
+-__FBSDID("$FreeBSD$");
++//#include <sys/cdefs.h>
++//__FBSDID("$FreeBSD$");
+
+ /*
+ * truncf(x)
+ * Return x rounded toward 0 to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to truncf(x).
diff --git a/modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch b/modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch
new file mode 100644
index 000000000..712110dc8
--- /dev/null
+++ b/modules/fdlibm/patches/10_remove_unused_function_from_k_exp_cpp.patch
@@ -0,0 +1,55 @@
+diff --git a/modules/fdlibm/src/k_exp.cpp b/modules/fdlibm/src/k_exp.cpp
+--- a/modules/fdlibm/src/k_exp.cpp
++++ b/modules/fdlibm/src/k_exp.cpp
+@@ -22,18 +22,16 @@
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+ //#include <sys/cdefs.h>
+ //__FBSDID("$FreeBSD$");
+
+-#include <complex.h>
+-
+ #include "math_private.h"
+
+ static const uint32_t k = 1799; /* constant for reduction */
+ static const double kln2 = 1246.97177782734161156; /* k * ln2 */
+
+ /*
+ * Compute exp(x), scaled to avoid spurious overflow. An exponent is
+ * returned separately in 'expt'.
+@@ -76,32 +74,8 @@ double
+ double exp_x, scale;
+ int ex_expt;
+
+ exp_x = __frexp_exp(x, &ex_expt);
+ expt += ex_expt;
+ INSERT_WORDS(scale, (0x3ff + expt) << 20, 0);
+ return (exp_x * scale);
+ }
+-
+-double complex
+-__ldexp_cexp(double complex z, int expt)
+-{
+- double x, y, exp_x, scale1, scale2;
+- int ex_expt, half_expt;
+-
+- x = creal(z);
+- y = cimag(z);
+- exp_x = __frexp_exp(x, &ex_expt);
+- expt += ex_expt;
+-
+- /*
+- * Arrange so that scale1 * scale2 == 2**expt. We use this to
+- * compensate for scalbn being horrendously slow.
+- */
+- half_expt = expt / 2;
+- INSERT_WORDS(scale1, (0x3ff + half_expt) << 20, 0);
+- half_expt = expt - half_expt;
+- INSERT_WORDS(scale2, (0x3ff + half_expt) << 20, 0);
+-
+- return (CMPLX(cos(y) * exp_x * scale1 * scale2,
+- sin(y) * exp_x * scale1 * scale2));
+-}
diff --git a/modules/fdlibm/patches/11_include_cfloat_to_use_flt_eval_method.patch b/modules/fdlibm/patches/11_include_cfloat_to_use_flt_eval_method.patch
new file mode 100644
index 000000000..a5ddcb1ca
--- /dev/null
+++ b/modules/fdlibm/patches/11_include_cfloat_to_use_flt_eval_method.patch
@@ -0,0 +1,21 @@
+diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -12,16 +12,17 @@
+ /*
+ * from: @(#)fdlibm.h 5.1 93/09/24
+ * $FreeBSD$
+ */
+
+ #ifndef _MATH_PRIVATE_H_
+ #define _MATH_PRIVATE_H_
+
++#include <cfloat>
+ #include <stdint.h>
+ #include <sys/types.h>
+
+ #include "fdlibm.h"
+
+ #include "mozilla/EndianUtils.h"
+
+ /*
diff --git a/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch b/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch
new file mode 100644
index 000000000..b8f238c74
--- /dev/null
+++ b/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch
@@ -0,0 +1,25 @@
+diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -33,16 +33,21 @@
+ * to dig two 32 bit words out of the 64 bit IEEE floating point
+ * value. That is non-ANSI, and, moreover, the gcc instruction
+ * scheduler gets it wrong. We instead use the following macros.
+ * Unlike the original code, we determine the endianness at compile
+ * time, not at run time; I don't see much benefit to selecting
+ * endianness at run time.
+ */
+
++#ifdef WIN32
++#define u_int32_t uint32_t
++#define u_int64_t uint64_t
++#endif
++
+ /*
+ * A union which permits us to convert between a double and two 32 bit
+ * ints.
+ */
+
+ #if MOZ_BIG_ENDIAN
+
+ typedef union
diff --git a/modules/fdlibm/patches/13_define_strict_assign_even_if_flt_eval_method_is_not_defined.patch b/modules/fdlibm/patches/13_define_strict_assign_even_if_flt_eval_method_is_not_defined.patch
new file mode 100644
index 000000000..4b2a9541e
--- /dev/null
+++ b/modules/fdlibm/patches/13_define_strict_assign_even_if_flt_eval_method_is_not_defined.patch
@@ -0,0 +1,31 @@
+diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -285,16 +285,27 @@ do { \
+ if (sizeof(type) >= sizeof(long double)) \
+ (lval) = (rval); \
+ else { \
+ __lval = (rval); \
+ (lval) = __lval; \
+ } \
+ } while (0)
+ #endif
++#else
++#define STRICT_ASSIGN(type, lval, rval) do { \
++ volatile type __lval; \
++ \
++ if (sizeof(type) >= sizeof(long double)) \
++ (lval) = (rval); \
++ else { \
++ __lval = (rval); \
++ (lval) = __lval; \
++ } \
++} while (0)
+ #endif /* FLT_EVAL_METHOD */
+
+ /* Support switching the mode to FP_PE if necessary. */
+ #if defined(__i386__) && !defined(NO_FPSETPREC)
+ #define ENTERI() \
+ long double __retval; \
+ fp_prec_t __oprec; \
+ \
diff --git a/modules/fdlibm/patches/14_do_not_use_hexadecimal_floating_point_number.patch b/modules/fdlibm/patches/14_do_not_use_hexadecimal_floating_point_number.patch
new file mode 100644
index 000000000..627603448
--- /dev/null
+++ b/modules/fdlibm/patches/14_do_not_use_hexadecimal_floating_point_number.patch
@@ -0,0 +1,47 @@
+diff --git a/modules/fdlibm/src/e_exp.cpp b/modules/fdlibm/src/e_exp.cpp
+--- a/modules/fdlibm/src/e_exp.cpp
++++ b/modules/fdlibm/src/e_exp.cpp
+@@ -146,14 +146,17 @@ double
+ if(k >= -1021)
+ INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0);
+ else
+ INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0);
+ c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
+ if(k==0) return one-((x*c)/(c-2.0)-x);
+ else y = one-((lo-(x*c)/(2.0-c))-hi);
+ if(k >= -1021) {
+- if (k==1024) return y*2.0*0x1p1023;
++ if (k==1024) {
++ double const_0x1p1023 = pow(2, 1023);
++ return y*2.0*const_0x1p1023;
++ }
+ return y*twopk;
+ } else {
+ return y*twopk*twom1000;
+ }
+ }
+diff --git a/modules/fdlibm/src/s_expm1.cpp b/modules/fdlibm/src/s_expm1.cpp
+--- a/modules/fdlibm/src/s_expm1.cpp
++++ b/modules/fdlibm/src/s_expm1.cpp
+@@ -192,17 +192,20 @@ expm1(double x)
+ e -= hxs;
+ if(k== -1) return 0.5*(x-e)-0.5;
+ if(k==1) {
+ if(x < -0.25) return -2.0*(e-(x+0.5));
+ else return one+2.0*(x-e);
+ }
+ if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */
+ y = one-(e-x);
+- if (k == 1024) y = y*2.0*0x1p1023;
++ if (k == 1024) {
++ double const_0x1p1023 = pow(2, 1023);
++ y = y*2.0*const_0x1p1023;
++ }
+ else y = y*twopk;
+ return y-one;
+ }
+ t = one;
+ if(k<20) {
+ SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */
+ y = t-(e-x);
+ y = y*twopk;
diff --git a/modules/fdlibm/patches/15_remove_unused_rintl_function_from_s_nearbyint_cpp.patch b/modules/fdlibm/patches/15_remove_unused_rintl_function_from_s_nearbyint_cpp.patch
new file mode 100644
index 000000000..5648d3096
--- /dev/null
+++ b/modules/fdlibm/patches/15_remove_unused_rintl_function_from_s_nearbyint_cpp.patch
@@ -0,0 +1,13 @@
+diff --git a/modules/fdlibm/src/s_nearbyint.cpp b/modules/fdlibm/src/s_nearbyint.cpp
+--- a/modules/fdlibm/src/s_nearbyint.cpp
++++ b/modules/fdlibm/src/s_nearbyint.cpp
+@@ -51,9 +51,8 @@ fn(type x) \
+ fegetenv(&env); \
+ ret = rint(x); \
+ fesetenv(&env); \
+ return (ret); \
+ }
+
+ DECL(double, nearbyint, rint)
+ DECL(float, nearbyintf, rintf)
+-DECL(long double, nearbyintl, rintl)
diff --git a/modules/fdlibm/patches/15_use_safer_strict_assign_on_visual_studio.patch b/modules/fdlibm/patches/15_use_safer_strict_assign_on_visual_studio.patch
new file mode 100644
index 000000000..282edbb78
--- /dev/null
+++ b/modules/fdlibm/patches/15_use_safer_strict_assign_on_visual_studio.patch
@@ -0,0 +1,23 @@
+diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -271,17 +271,17 @@ do { \
+ /* The above works on non-i386 too, but we use this to check v. */
+ #define LD80C(m, ex, v) { .e = (v), }
+ #endif
+
+ #ifdef FLT_EVAL_METHOD
+ /*
+ * Attempt to get strict C99 semantics for assignment with non-C99 compilers.
+ */
+-#if FLT_EVAL_METHOD == 0 || __GNUC__ == 0
++#if !defined(_MSC_VER) && (FLT_EVAL_METHOD == 0 || __GNUC__ == 0)
+ #define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval))
+ #else
+ #define STRICT_ASSIGN(type, lval, rval) do { \
+ volatile type __lval; \
+ \
+ if (sizeof(type) >= sizeof(long double)) \
+ (lval) = (rval); \
+ else { \
+