about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog81
-rw-r--r--Makerules8
-rw-r--r--NEWS10
-rw-r--r--math/libm-test.inc38
-rw-r--r--math/s_clog.c27
-rw-r--r--math/s_clog10.c28
-rw-r--r--math/s_clog10f.c28
-rw-r--r--math/s_clog10l.c28
-rw-r--r--math/s_clogf.c28
-rw-r--r--math/s_clogl.c27
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps60
-rw-r--r--sysdeps/ieee754/dbl-64/e_atan2.c9
-rw-r--r--sysdeps/unix/Makefile240
-rw-r--r--sysdeps/unix/errnos-tmpl.c98
-rw-r--r--sysdeps/unix/errnos.awk12
-rw-r--r--sysdeps/unix/ioctls-tmpl.c134
-rw-r--r--sysdeps/unix/ioctls.awk10
-rw-r--r--sysdeps/unix/mk-local_lim.c125
-rwxr-xr-xsysdeps/unix/snarf-ioctls48
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps67
20 files changed, 404 insertions, 702 deletions
diff --git a/ChangeLog b/ChangeLog
index 88ee5935c2..e806afcbca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,84 @@
+2012-03-19  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #13629]
+	* math/s_clog.c: Include <float.h>.
+	(__clog): Scale large or subnormal inputs.
+	* math/s_clogf.c: Likewise.
+	* math/s_clogl.c: Likewise.
+	* math/s_clog10.c: Include <float.h>.
+	(M_LOG10_2): Define.
+	(__clog10): Scale large or subnormal inputs.
+	* math/s_clog10f.c: Likewise.
+	* math/s_clog10l.c: Likewise.
+	* math/libm-test.inc (clog_test): Add more tests.
+	(clog10_test): Likewise.
+	* sysdeps/i386/fpu/libm-test-ulps: Update.
+	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
+
+	[BZ #11451]
+	* sysdeps/ieee754/dbl-64/e_atan2.c (__ieee754_atan2): Scale large
+	x and y.
+	* math/libm-test.inc (atan2_test): Add another test.
+
+	* Makerules (common-objdir-compile): Remove.
+	* sysdeps/unix/Makefile (config-generated): Do not add
+	$(unix-generated) to variable.
+	[generic bits/local_lim.h] (mk-local_lim-CFLAGS): Remove variable.
+	[generic bits/local_lim.h] ($(common-objpfx)bits/local_lim.h):
+	Remove rule.
+	[generic bits/local_lim.h] ($(common-objpfx)mk-local_lim):
+	Likewise.
+	[generic bits/local_lim.h] (before-compile): Do not append to
+	variable.
+	[generic bits/local_lim.h] (common-generated): Likewise.
+	[generic sys/param.h] (before-compile): Do not append to variable.
+	[generic sys/param.h] ($(common-objpfx)sys/param.h): Remove rule.
+	[generic sys/param.h] ($(common-objpfx)param.h.c): Likewise.
+	[generic sys/param.h] ($(common-objpfx)param.h.dep): Likewise.
+	[generic sys/param.h] ($(common-objpfx)param.h.dep): Do not
+	include.
+	[generic sys/param.h] (sys/param.h-includes): Remove variable.
+	[generic sys/param.h] (sys/param.h-includes): Remove rule.
+	[generic sys/param.h] ($(addprefix
+	$(common-objpfx),$(sys/param.h-includes))): Likewise.
+	[generic sys/param.h] (common-generated): Do not append to
+	variable.
+	[generic sys/param.h] (sysdep_headers): Likewise.
+	[generic bits/errno.h] (before-compile): Do not append to
+	variable.
+	[generic bits/errno.h] ($(common-objpfx)bits/errno.h): Remove
+	rule.
+	[generic bits/errno.h] ($(common-objpfx)make-errnos): Likewise.
+	[generic bits/errno.h] ($(common-objpfx)make-errnos.c): Likewise.
+	[generic bits/errno.h] ($(common-objpfx)errnos): Likewise.
+	[generic bits/errno.h] (common-generated): Do not append to
+	variable.
+	[generic bits/ioctls.h] (before-compile): Do not append to
+	variable.
+	[generic bits/ioctls.h] ($(common-objpfx)bits/ioctls.h): Remove
+	rule.
+	[generic bits/ioctls.h] (ioctl-includes): Remove variable.
+	[generic bits/ioctls.h] (make-ioctls-CFLAGS): Likewise.
+	[generic bits/ioctls.h] ($(common-objpfx)make-ioctls): Remove
+	rule.
+	[generic bits/ioctls.h] ($(common-objpfx)make-ioctls.c): Likewise.
+	[generic bits/ioctls.h] (bits_termios.h): Remove variable.
+	[generic bits/ioctls.h] ($(common-objpfx)ioctls): Remove rule.
+	[generic bits/ioctls.h] (common-generated): Do not append to
+	variable.
+	[generic sys/syscall.h] (syscall.h): Remove variable.
+	[generic sys/syscall.h] ($(common-objpfx)sys/syscall.h): Remove
+	rule.
+	[generic sys/syscall.h] (before-compile): Do not append to
+	variable.
+	[generic sys/syscall.h] (common-generated): Likewise.
+	* sysdeps/unix/errnos-tmpl.c: Remove file.
+	* sysdeps/unix/errnos.awk: Likewise.
+	* sysdeps/unix/ioctls-tmpl.c: Likewise.
+	* sysdeps/unix/ioctls.awk: Likewise.
+	* sysdeps/unix/mk-local_lim.c: Likewise.
+	* sysdeps/unix/snarf-ioctls: Likewise.
+
 2012-03-19  Richard Henderson  <rth@twiddle.net>
 
 	* sysdeps/i386/fpu/fenv_private.h: New file.
diff --git a/Makerules b/Makerules
index f1807c2ee8..d184be6d20 100644
--- a/Makerules
+++ b/Makerules
@@ -1122,14 +1122,6 @@ $(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
 	    $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
 endef
 
-# Command to compile $< in $(common-objdir) using the native libraries.
-# We must cd to $(objdir) anyway so that $(..)config.h is valid.
-define common-objdir-compile
-$(patsubst %/,cd % &&,$(objpfx)) \
-$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
-	    $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(..)$(@F)
-endef
-
 # We always want to use configuration definitions.
 # Note that this is only used for commands running in $(objpfx).
 ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h
diff --git a/NEWS b/NEWS
index 5af4f68f06..df8e1f03a6 100644
--- a/NEWS
+++ b/NEWS
@@ -12,11 +12,11 @@ Version 2.16
   174, 350, 411, 2541, 2547, 2548, 2551, 2552, 2553, 2554, 2562, 2563, 2565,
   2566, 2576, 3335, 3976, 3992, 4026, 4108, 4596, 4822, 5077, 5461, 5805,
   5993, 6471, 6884, 6907, 6911, 9739, 9902, 10110, 10135, 10140, 10210,
-  10545, 10716, 11174, 11322, 11365, 11494, 12047, 13058, 13525, 13526,
-  13527, 13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551, 13552,
-  13553, 13555, 13559, 13566, 13583, 13618, 13637, 13656, 13658, 13673,
-  13695, 13704, 13706, 13726, 13738, 13786, 13792, 13806, 13840, 13841,
-  13844, 13846, 13851, 13852, 13854
+  10545, 10716, 11174, 11322, 11365, 11451, 11494, 12047, 13058, 13525,
+  13526, 13527, 13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551,
+  13552, 13553, 13555, 13559, 13566, 13583, 13618, 13637, 13656, 13658,
+  13673, 13695, 13704, 13706, 13726, 13738, 13786, 13792, 13806, 13840,
+  13841, 13844, 13846, 13851, 13852, 13854
 
 * ISO C11 support:
 
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5638b76869..8bb435875d 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -949,6 +949,8 @@ atan2_test (void)
   TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
   TEST_ff_f (atan2, nan_value, nan_value, nan_value);
 
+  TEST_ff_f (atan2, max_value, max_value, M_PI_4l);
+
   TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
   TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
   TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
@@ -1967,6 +1969,24 @@ clog_test (void)
   TEST_c_c (clog, 0.75L, 1.25L, 0.376885901188190075998919126749298416L, 1.03037682652431246378774332703115153L);
   TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
 
+  TEST_c_c (clog, 0x1.fffffep+127L, 0x1.fffffep+127L, 89.06941264234832570836679262104313101776L, M_PI_4l);
+  TEST_c_c (clog, 0x1.fffffep+127L, 1.0L, 88.72283905206835305365817656031404273372L, 2.938736052218037251011746307725933020145e-39L);
+  TEST_c_c (clog, 0x1p-149L, 0x1p-149L, -102.9323563131518784484589700365392203592L, M_PI_4l);
+  TEST_c_c (clog, 0x1p-147L, 0x1p-147L, -101.5460619520319878296245057936228672231L, M_PI_4l);
+
+#ifndef TEST_FLOAT
+  TEST_c_c (clog, 0x1.fffffffffffffp+1023L, 0x1.fffffffffffffp+1023L, 710.1292864836639693869320059713862337880L, M_PI_4l);
+  TEST_c_c (clog, 0x1.fffffffffffffp+1023L, 0x1p+1023L, 709.8942846690411016323109979483151967689L, 0.4636476090008061606231772164674799632783L);
+  TEST_c_c (clog, 0x1p-1074L, 0x1p-1074L, -744.0934983311012896593986823853525458290L, M_PI_4l);
+  TEST_c_c (clog, 0x1p-1073L, 0x1p-1073L, -743.4003511505413443499814502638943692610L, M_PI_4l);
+#endif
+
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+  TEST_c_c (clog, 0x1.fp+16383L, 0x1.fp+16383L, 11356.83823118610934184548269774874545400L, M_PI_4l);
+  TEST_c_c (clog, 0x1.fp+16383L, 0x1p+16383L, 11356.60974243783798653123798337822335902L, 0.4764674194737066993385333770295162295856L);
+  TEST_c_c (clog, 0x1p-16440L, 0x1p-16441L, -11395.22807662984378194141292922726786191L, 0.4636476090008061162142562314612144020285L);
+#endif
+
   END (clog, complex);
 }
 
@@ -2033,6 +2053,24 @@ clog10_test (void)
   TEST_c_c (clog10, 0.75L, 1.25L, 0.163679467193165171449476605077428975L, 0.447486970040493067069984724340855636L);
   TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L);
 
+  TEST_c_c (clog10, 0x1.fffffep+127L, 0x1.fffffep+127L, 38.68235441693561449174780668781319348761L, M_PI4_LOG10El);
+  TEST_c_c (clog10, 0x1.fffffep+127L, 1.0L, 38.53183941910362389414093724045094697423L, 1.276276851248440096917018665609900318458e-39L);
+  TEST_c_c (clog10, 0x1p-149L, 0x1p-149L, -44.70295435610120748924022586658721447508L, M_PI4_LOG10El);
+  TEST_c_c (clog10, 0x1p-147L, 0x1p-147L, -44.10089436477324509881274807713822842154L, M_PI4_LOG10El);
+
+#ifndef TEST_FLOAT
+  TEST_c_c (clog10, 0x1.fffffffffffffp+1023L, 0x1.fffffffffffffp+1023L, 308.4052305577487344482591243175787477115L, M_PI4_LOG10El);
+  TEST_c_c (clog10, 0x1.fffffffffffffp+1023L, 0x1p+1023L, 308.3031705664207720674749211936626341569L, 0.2013595981366865903254995612594728746470L);
+  TEST_c_c (clog10, 0x1p-1074L, 0x1p-1074L, -323.1557003452838130619487034867432642357L, M_PI4_LOG10El);
+  TEST_c_c (clog10, 0x1p-1073L, 0x1p-1073L, -322.8546703496198318667349645920187712089L, M_PI4_LOG10El);
+#endif
+
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+  TEST_c_c (clog10, 0x1.fp+16383L, 0x1.fp+16383L, 4932.212175672014259683102930239951947672L, M_PI4_LOG10El);
+  TEST_c_c (clog10, 0x1.fp+16383L, 0x1p+16383L, 4932.112944269463028900262609694408579449L, 0.2069271710841128115912940666587802677383L);
+  TEST_c_c (clog10, 0x1p-16440L, 0x1p-16441L, -4948.884673709346821106688037612752099609L, 0.2013595981366865710389502301937289472543L);
+#endif
+
   END (clog10, complex);
 }
 
diff --git a/math/s_clog.c b/math/s_clog.c
index 5bbca00388..15e5e9c678 100644
--- a/math/s_clog.c
+++ b/math/s_clog.c
@@ -1,5 +1,5 @@
 /* Compute complex natural logarithm.
-   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,7 @@
 #include <complex.h>
 #include <math.h>
 #include <math_private.h>
-
+#include <float.h>
 
 __complex__ double
 __clog (__complex__ double x)
@@ -40,8 +40,27 @@ __clog (__complex__ double x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_log (__ieee754_hypot (__real__ x,
-							__imag__ x));
+      double d;
+      int scale = 0;
+
+      if (fabs (__real__ x) > DBL_MAX / 2.0
+	  || fabs (__imag__ x) > DBL_MAX / 2.0)
+	{
+	  scale = -1;
+	  __real__ x = __scalbn (__real__ x, scale);
+	  __imag__ x = __scalbn (__imag__ x, scale);
+	}
+      else if (fabs (__real__ x) < DBL_MIN
+	       && fabs (__imag__ x) < DBL_MIN)
+	{
+	  scale = DBL_MANT_DIG;
+	  __real__ x = __scalbn (__real__ x, scale);
+	  __imag__ x = __scalbn (__imag__ x, scale);
+	}
+
+      d = __ieee754_hypot (__real__ x, __imag__ x);
+
+      __real__ result = __ieee754_log (d) - scale * M_LN2;
       __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
     }
   else
diff --git a/math/s_clog10.c b/math/s_clog10.c
index 3eb9c518a8..9d366d6f2b 100644
--- a/math/s_clog10.c
+++ b/math/s_clog10.c
@@ -1,5 +1,5 @@
 /* Compute complex base 10 logarithm.
-   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,10 @@
 #include <complex.h>
 #include <math.h>
 #include <math_private.h>
+#include <float.h>
 
+/* log_10 (2).  */
+#define M_LOG10_2 0.3010299956639811952137388947244930267682
 
 __complex__ double
 __clog10 (__complex__ double x)
@@ -40,8 +43,27 @@ __clog10 (__complex__ double x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x,
-							  __imag__ x));
+      double d;
+      int scale = 0;
+
+      if (fabs (__real__ x) > DBL_MAX / 2.0
+	  || fabs (__imag__ x) > DBL_MAX / 2.0)
+	{
+	  scale = -1;
+	  __real__ x = __scalbn (__real__ x, scale);
+	  __imag__ x = __scalbn (__imag__ x, scale);
+	}
+      else if (fabs (__real__ x) < DBL_MIN
+	       && fabs (__imag__ x) < DBL_MIN)
+	{
+	  scale = DBL_MANT_DIG;
+	  __real__ x = __scalbn (__real__ x, scale);
+	  __imag__ x = __scalbn (__imag__ x, scale);
+	}
+
+      d = __ieee754_hypot (__real__ x, __imag__ x);
+
+      __real__ result = __ieee754_log10 (d) - scale * M_LOG10_2;
       __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
     }
   else
diff --git a/math/s_clog10f.c b/math/s_clog10f.c
index e48d928b3c..11bb0bb9ad 100644
--- a/math/s_clog10f.c
+++ b/math/s_clog10f.c
@@ -1,5 +1,5 @@
 /* Compute complex base 10 logarithm.
-   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,10 @@
 #include <complex.h>
 #include <math.h>
 #include <math_private.h>
+#include <float.h>
 
+/* log_10 (2).  */
+#define M_LOG10_2f 0.3010299956639811952137388947244930267682f
 
 __complex__ float
 __clog10f (__complex__ float x)
@@ -40,8 +43,27 @@ __clog10f (__complex__ float x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x,
-							    __imag__ x));
+      float d;
+      int scale = 0;
+
+      if (fabsf (__real__ x) > FLT_MAX / 2.0f
+	  || fabsf (__imag__ x) > FLT_MAX / 2.0f)
+	{
+	  scale = -1;
+	  __real__ x = __scalbnf (__real__ x, scale);
+	  __imag__ x = __scalbnf (__imag__ x, scale);
+	}
+      else if (fabsf (__real__ x) < FLT_MIN
+	       && fabsf (__imag__ x) < FLT_MIN)
+	{
+	  scale = FLT_MANT_DIG;
+	  __real__ x = __scalbnf (__real__ x, scale);
+	  __imag__ x = __scalbnf (__imag__ x, scale);
+	}
+
+      d = __ieee754_hypotf (__real__ x, __imag__ x);
+
+      __real__ result = __ieee754_log10f (d) - scale * M_LOG10_2f;
       __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x);
     }
   else
diff --git a/math/s_clog10l.c b/math/s_clog10l.c
index 72b553152e..d1fc872cba 100644
--- a/math/s_clog10l.c
+++ b/math/s_clog10l.c
@@ -1,5 +1,5 @@
 /* Compute complex base 10 logarithm.
-   Copyright (C) 1997, 1998, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,10 @@
 #include <complex.h>
 #include <math.h>
 #include <math_private.h>
+#include <float.h>
 
+/* log_10 (2).  */
+#define M_LOG10_2l 0.3010299956639811952137388947244930267682L
 
 __complex__ long double
 __clog10l (__complex__ long double x)
@@ -40,8 +43,27 @@ __clog10l (__complex__ long double x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x,
-							    __imag__ x));
+      long double d;
+      int scale = 0;
+
+      if (fabsl (__real__ x) > LDBL_MAX / 2.0L
+	  || fabsl (__imag__ x) > LDBL_MAX / 2.0L)
+	{
+	  scale = -1;
+	  __real__ x = __scalbnl (__real__ x, scale);
+	  __imag__ x = __scalbnl (__imag__ x, scale);
+	}
+      else if (fabsl (__real__ x) < LDBL_MIN
+	       && fabsl (__imag__ x) < LDBL_MIN)
+	{
+	  scale = LDBL_MANT_DIG;
+	  __real__ x = __scalbnl (__real__ x, scale);
+	  __imag__ x = __scalbnl (__imag__ x, scale);
+	}
+
+      d = __ieee754_hypotl (__real__ x, __imag__ x);
+
+      __real__ result = __ieee754_log10l (d) - scale * M_LOG10_2l;
       __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x);
     }
   else
diff --git a/math/s_clogf.c b/math/s_clogf.c
index eb8433a280..0b27506fb4 100644
--- a/math/s_clogf.c
+++ b/math/s_clogf.c
@@ -1,5 +1,5 @@
 /* Compute complex natural logarithm.
-   Copyright (C) 1997, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -19,9 +19,8 @@
 
 #include <complex.h>
 #include <math.h>
-
 #include <math_private.h>
-
+#include <float.h>
 
 __complex__ float
 __clogf (__complex__ float x)
@@ -41,8 +40,27 @@ __clogf (__complex__ float x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x,
-							  __imag__ x));
+      float d;
+      int scale = 0;
+
+      if (fabsf (__real__ x) > FLT_MAX / 2.0f
+	  || fabsf (__imag__ x) > FLT_MAX / 2.0f)
+	{
+	  scale = -1;
+	  __real__ x = __scalbnf (__real__ x, scale);
+	  __imag__ x = __scalbnf (__imag__ x, scale);
+	}
+      else if (fabsf (__real__ x) < FLT_MIN
+	       && fabsf (__imag__ x) < FLT_MIN)
+	{
+	  scale = FLT_MANT_DIG;
+	  __real__ x = __scalbnf (__real__ x, scale);
+	  __imag__ x = __scalbnf (__imag__ x, scale);
+	}
+
+      d = __ieee754_hypotf (__real__ x, __imag__ x);
+
+      __real__ result = __ieee754_logf (d) - scale * (float) M_LN2;
       __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
     }
   else
diff --git a/math/s_clogl.c b/math/s_clogl.c
index 11d4878252..8968eefee3 100644
--- a/math/s_clogl.c
+++ b/math/s_clogl.c
@@ -1,5 +1,5 @@
 /* Compute complex natural logarithm.
-   Copyright (C) 1997, 1998, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,7 @@
 #include <complex.h>
 #include <math.h>
 #include <math_private.h>
-
+#include <float.h>
 
 __complex__ long double
 __clogl (__complex__ long double x)
@@ -40,8 +40,27 @@ __clogl (__complex__ long double x)
   else if (__builtin_expect (rcls != FP_NAN && icls != FP_NAN, 1))
     {
       /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x,
-							  __imag__ x));
+      long double d;
+      int scale = 0;
+
+      if (fabsl (__real__ x) > LDBL_MAX / 2.0L
+	  || fabsl (__imag__ x) > LDBL_MAX / 2.0L)
+	{
+	  scale = -1;
+	  __real__ x = __scalbnl (__real__ x, scale);
+	  __imag__ x = __scalbnl (__imag__ x, scale);
+	}
+      else if (fabsl (__real__ x) < LDBL_MIN
+	       && fabsl (__imag__ x) < LDBL_MIN)
+	{
+	  scale = LDBL_MANT_DIG;
+	  __real__ x = __scalbnl (__real__ x, scale);
+	  __imag__ x = __scalbnl (__imag__ x, scale);
+	}
+
+      d = __ieee754_hypotl (__real__ x, __imag__ x);
+
+      __real__ result = __ieee754_logl (d) - scale * M_LN2l;
       __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
     }
   else
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 9b683b905d..1d87514e9b 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -447,6 +447,21 @@ float: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog (0x1.fffffep+127 + 0x1.fffffep+127 i) == 89.06941264234832570836679262104313101776 + pi/4 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 + 0x1.fp+16383 i) == 11356.83823118610934184548269774874545400 + pi/4 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 + 0x1p+16383 i) == 11356.60974243783798653123798337822335902 + 0.4764674194737066993385333770295162295856 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-149 + 0x1p-149 i) == -102.9323563131518784484589700365392203592 + pi/4 i":
+ildouble: 1
+ldouble: 1
 
 # clog10
 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
@@ -514,6 +529,51 @@ idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i) == 308.4052305577487344482591243175787477115 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 308.3031705664207720674749211936626341569 + 0.2013595981366865903254995612594728746470 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1.fp+16383 + 0x1.fp+16383 i) == 4932.212175672014259683102930239951947672 + pi/4*log10(e) i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1.fp+16383 + 0x1p+16383 i) == 4932.112944269463028900262609694408579449 + 0.2069271710841128115912940666587802677383 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i) == -44.10089436477324509881274807713822842154 + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
 double: 1
 float: 1
diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c
index dcef55f072..497afcab1e 100644
--- a/sysdeps/ieee754/dbl-64/e_atan2.c
+++ b/sysdeps/ieee754/dbl-64/e_atan2.c
@@ -1,7 +1,7 @@
 /*
  * IBM Accurate Mathematical Library
  * written by International Business Machines Corp.
- * Copyright (C) 2001, 2011 Free Software Foundation
+ * Copyright (C) 2001-2012 Free Software Foundation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -153,6 +153,13 @@ __ieee754_atan2(double y,double x) {
   /* if either x or y is extremely close to zero, scale abs(x), abs(y). */
   if (ax<twom500.d || ay<twom500.d) { ax*=two500.d;  ay*=two500.d; }
 
+  /* Likewise for large x and y.  */
+  if (ax > two500.d || ay > two500.d)
+    {
+      ax *= twom500.d;
+      ay *= twom500.d;
+    }
+
   /* x,y which are neither special nor extreme */
   if (ay<ax) {
     u=ay/ax;
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index 4b887a7a87..c8ef96d50e 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,1999,2003,2006,2008,2009
-#	Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 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
@@ -16,243 +15,6 @@
 # License along with the GNU C Library; if not, see
 # <http://www.gnu.org/licenses/>.
 
-# The unix-specific configure fragment writes `unix-generated' in config.make.
-config-generated := $(config-generated) $(unix-generated)
-
-ifeq (,$(filter-out $(sysdep_dir)/generic/ $(common-objpfx),\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/local_lim.h))))))
-
-ifneq (,$(wildcard $(sysincludedir)/sys/param.h))
-mk-local_lim-CFLAGS += -DHAVE_SYS_PARAM_H
-endif
-ifneq (,$(wildcard $(sysincludedir)/sys/limits.h))
-mk-local_lim-CFLAGS += -DHAVE_SYS_LIMITS_H
-endif
-ifneq (,$(wildcard $(sysincludedir)/limits.h))
-mk-local_lim-CFLAGS += -DHAVE_LIMITS_H
-endif
-
-$(common-objpfx)bits/local_lim.h: $(common-objpfx)mk-local_lim
-	$(dir $<)$(notdir $<) > $@-t
-	mv -f $@-t $@
-$(common-objpfx)mk-local_lim: $(sysdep_dir)/unix/mk-local_lim.c
-	$(common-objdir-compile)
-
-before-compile += $(common-objpfx)bits/local_lim.h
-common-generated += bits/local_lim.h mk-local_lim
-
-endif
-
-ifeq (,$(filter-out $(sysdep_dir)/generic/ $(common-objpfx),\
-	$(patsubst %/sys/param.h,%/,\
-		   $(firstword $(wildcard $(+sysdep_dirs:%=%/sys/param.h))))))
-
-before-compile := $(before-compile) $(common-objpfx)sys/param.h
-
-$(common-objpfx)sys/param.h: $(sysincludedir)/sys/param.h
-	$(make-target-directory)
-	(echo '#ifndef _SYS_PARAM_H';	\
-	 echo '#define _SYS_PARAM_H 1';	\
-	 echo '#include <endian.h>';		\
-	 $(AWK) < $<			\
-	   '/^#define[ 	]*NULL/ { print "#ifndef NULL";	\
-				  print $$0;		\
-				  print "#endif";	\
-				  was_null = 1 }	\
-	    { if (!was_null) print $$0;			\
-	      was_null = 0 }';		\
-	 echo '#ifndef MAXHOSTNAMELEN'; \
-	 echo '#define MAXHOSTNAMELEN 64 /* XXX */'; \
-	 echo '#endif /* No MAXHOSTNAMELEN.  */'; \
-	 echo '#endif	/* sys/param.h */') > $@-tmp
-	mv $@-tmp $@
-
-$(common-objpfx)param.h.c: $(sysincludedir)/sys/param.h
-	rm -f $@
-	cp $< $@
-$(common-objpfx)param.h.dep: $(common-objpfx)param.h.c \
-			     $(sysdep_dir)/unix/Makefile
-	$(+mkdep) -I$(sysincludedir) $<			\
-	| sed > $@-t					\
-	      -e 's@$(sysincludedir)/sys/param.h@@'	\
-	      -e 's@^.*:@@'				\
-	      -e 's@$<@@g'				\
-	      -e 's@$(sysincludedir)/*@@g'		\
-	      -e 's@\\$$@@'				\
-	      -e 's@^@sys/param.h-includes := $$(sys/param.h-includes) @'
-	mv $@-t $@
-
-# Get the generated definition of sys/param.h-includes.
-ifndef no_deps
--include $(common-objpfx)param.h.dep
-endif
-
-# Don't preempt our own headers.
-sys/param.h-includes := \
-  $(filter-out $(patsubst $(..)%,%,\
-			  $(wildcard $(addprefix $(..),\
-				     $(sys/param.h-includes)))),\
-	       $(sys/param.h-includes))
-
-
-.PHONY: sys/param.h-includes
-sys/param.h-includes: $(addprefix $(common-objpfx),$(sys/param.h-includes))
-
-ifdef sys/param.h-includes
-# Copy the system files to $(common-objdir).
-$(addprefix $(common-objpfx),$(sys/param.h-includes)): $(common-objpfx)%: \
-						       $(sysincludedir)/%
-	$(make-target-directory)
-# Some of these files sometimes contain conflicting declarations for htons,
-# ntohs, etc.  They also often contain definitions of *_ENDIAN and
-# BYTE_ORDER, which we define ourselves in <endian.h>.
-	sed -e '/[ 	]*[hn]to[nh][sl][	 (]*/d' \
-	    -e '/^#define[ 	]*[A-Z]*_ENDIAN/d' \
-	    -e '/^#define[ 	]*BYTE_ORDER/d' \
-	    $< > $@-t
-	mv $@-t $@
-endif
-
-common-generated := $(common-generated) \
-		    sys/param.h $(sys/param.h-includes) param.h.c param.h.dep
-
-
-ifeq ($(subdir),misc)
-
-# Install system headers the system sys/param.h uses.
-
-sysdep_headers := $(sysdep_headers) $(sys/param.h-includes)
-
-endif # misc
-
-endif # No sysdep sys/param.h.
-
-ifeq (,$(filter-out $(sysdep_dir)/generic/ $(common-objpfx),\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/errno.h))))))
-
-# These need to exist before any compiling is done,
-# so cpp doesn't instead find the generic versions.
-before-compile := $(before-compile) $(common-objpfx)bits/errno.h
-
-$(common-objpfx)bits/errno.h: $(common-objpfx)make-errnos
-	$(dir $<)$(notdir $<) > $@-tmp
-	mv $@-tmp $@
-
-$(common-objpfx)make-errnos: $(common-objpfx)make-errnos.c
-	$(common-objdir-compile)
-
-$(common-objpfx)make-errnos.c: $(sysdep_dir)/unix/errnos-tmpl.c \
-			$(sysdep_dir)/unix/errnos.awk $(common-objpfx)errnos
-	$(AWK) -f $(word 2,$^) errnos="`tr '\012' ' ' < $(word 3,$^)`" $< > $@T
-	mv $@T $@
-
-$(common-objpfx)errnos: $(wildcard $(sysincludedir)/errno.h	\
-				   $(sysincludedir)/sys/errno.h)
-	sed -n 's/^#define[ 	]*\(E[A-Z0-9][A-Z0-9]*\)[ 	].*$$/\1/p' \
-	    $^ > $@-tmp
-	mv $@-tmp $@
-
-common-generated := $(common-generated) \
-		    errnos.h errnos make-errnos make-errnos.c
-endif
-
-ifeq (,$(filter-out $(sysdep_dir)/generic/ $(common-objpfx),\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/ioctls.h))))))
-
-before-compile := $(before-compile) $(common-objpfx)bits/ioctls.h
-
-$(common-objpfx)bits/ioctls.h: $(common-objpfx)make-ioctls
-	$(dir $<)$(notdir $<) > $@-tmp
-	mv $@-tmp $@
-
-ioctl-includes := sys/termios.h net/nit.h
-ioctl-includes := $(wildcard $(addprefix $(sysincludedir)/,$(ioctl-includes)))
-make-ioctls-CFLAGS := $(subst /,_,$(subst .,_,\
-			$(patsubst $(sysincludedir)/%,-DHAVE_%,\
-				   $(ioctl-includes))))
-
-$(common-objpfx)make-ioctls: $(common-objpfx)make-ioctls.c
-	$(common-objdir-compile)
-
-$(common-objpfx)make-ioctls.c: $(sysdep_dir)/unix/ioctls-tmpl.c \
-			       $(sysdep_dir)/unix/ioctls.awk \
-			       $(common-objpfx)ioctls
-	$(AWK) -f $(word 2,$^) requests="`cat $(word 3,$^)`" $< > $@T
-	mv $@T $@
-
-
-bits_termios.h := $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/termios.h)))
-ifeq ($(bits_termios.h),$(sysdep_dir)/generic/bits/termios.h)
-bits_termios.h := # Ignore the generic version.
-endif
-
-# If there is a system-specific <bits/termios.h> file, we want to omit
-# all the symbols it defines from ioctls.  Otherwise, both
-# <bits/ioctls.h> and <bits/termios.h> would define them.  The
-# system-specific <bits/termios.h> file presumably defines them with
-# the same values as we find from the system's headers.  We also want
-# to omit from ioctls the symbols defined in our own
-# <sys/ttydefaults.h>, to avoid multiple definition conflicts.  We use
-# snarf-ioctls on these files to find what symbols we want to omit.
-# fgrep -xv gives all lines which do not match in their entirety;
-# without -x, CSTOP's presence elided TIOCSTOP.
-
-$(common-objpfx)ioctls: $(sysdep_dir)/unix/snarf-ioctls \
-			$(sysincludedir)/sys/ioctl.h $(ioctl-includes)
-	$(dir $<)$(notdir $<) $(filter-out $<,$^) \
-	| fgrep -xv "`($(dir $<)$(notdir $<) $(bits_termios.h) \
-					     $(..)sysdeps/generic/sys/ttydefaults.h; \
-		      echo NULL) \
-		     | sort | uniq`" \
-	| sort | uniq | tr '\012' ' ' > $@-tmp
-	mv $@-tmp $@
-
-common-generated := $(common-generated) \
-		    bits/ioctls.h ioctls make-ioctls make-ioctls.c
-endif
-
-ifeq (,$(filter-out $(sysdep_dir)/generic/ $(common-objpfx),\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/sys/syscall.h))))))
-
-# The syscall code assumes a file <sys/syscall.h> that defines macros
-# `SYS_call' for syscall `call'.  Variations on this I have seen include:
-# it's in <sys/syscall.h>;
-# it's in <sys.s>;
-# it defines `CALL' instead of `SYS_call'.
-# Irix has a <syscall.h> which is not what we want, so check for <sys.s> first.
-
-# Find a file that might have these.  NOTE: This list of possibilities is
-# repeated in sysdeps/unix/configure and the two should be kept in sync.
-syscall.h := $(firstword $(wildcard $(addprefix $(sysincludedir)/, \
-						sys.s sys/sys.s \
-						sys.S sys/sys.S \
-						syscall.h sys/syscall.h \
-						)))
-ifdef syscall.h
-
-# Transmogrify any of several formats of the file into the one we want.
-$(common-objpfx)sys/syscall.h: $(syscall.h)
-	$(make-target-directory)
-	tr '[A-Z]' '[a-z]' < $< | \
-	sed -e 's/[ 	]sys_/ /' \
-	    -e 's/^#define[ 	]*\([a-z0-9_]*\)[ 	]*/#define SYS_\1 /' \
-	    -e 's/[ 	]sys_/ SYS_/' \
-	    -e 's/SYS_syscall_basenum/syscall_basenum/g' \
-	    -e 's/SYS_kerncall_basenum/kerncall_basenum/g' \
-	    -e 's/SYS_sysvoffset/sysvoffset/g' \
-	    -e '/^#/!d' \
-	    -e '/^#ident/d' \
-	    -e 's-\(/\*[^*]*\)$$-\1\*/-' \
-	> $@-tmp
-	mv $@-tmp $@
-
-before-compile += $(common-objpfx)sys/syscall.h
-common-generated += sys/syscall.h
-
-endif
-
-endif
-
 ifndef inhibit-unix-syscalls
 
 # Sysdep dirs unix/... can contain a file syscalls.list,
diff --git a/sysdeps/unix/errnos-tmpl.c b/sysdeps/unix/errnos-tmpl.c
deleted file mode 100644
index 3a9793ead9..0000000000
--- a/sysdeps/unix/errnos-tmpl.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright (C) 1991, 1993, 1997 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 <errno.h>
-
-static char iferrno[] = "#ifdef _ERRNO_H";
-static char endiferrno[] = "#endif /* <errno.h> included.  */";
-static char ifEmath[] = "#if !defined(__Emath_defined) && \
- (defined(_ERRNO_H) || defined(__need_Emath))";
-static char endifEmath[] = "#endif /* Emath not defined and <errno.h> \
-included or need Emath.  */";
-
-static int biggest_value = 0;
-static int done_ENOSYS = 0;
-static int done_ERANGE = 0, done_EDOM = 0;
-
-static void
-DO(name, value)
-     char *name;
-     int value;
-{
-  int is_ERANGE = !done_ERANGE && !strcmp(name, "ERANGE");
-  int is_EDOM = !done_EDOM && !strcmp(name, "EDOM");
-  int is_Emath = is_ERANGE || is_EDOM;
-
-  if (is_Emath)
-    {
-      puts(endiferrno);
-      puts(ifEmath);
-    }
-
-  if (!strcmp (name, "EWOULDBLOCK"))
-    {
-      puts ("#define EWOULDBLOCK EAGAIN /* Translated in glibc. */");
-      name = "EWOULDBLOCK_sys /* Value actually returned by kernel. */";
-    }
-
-  printf ("#define %s %d\n", name, value);
-
-  if (is_Emath)
-    {
-      puts(endifEmath);
-      puts(iferrno);
-    }
-
-  if (value > biggest_value)
-    biggest_value = value;
-
-  if (is_ERANGE)
-    done_ERANGE = 1;
-  else if (is_EDOM)
-    done_EDOM = 1;
-  else if (!done_ENOSYS && !strcmp(name, "ENOSYS"))
-    done_ENOSYS = 1;
-}
-
-int
-main()
-{
-  puts(iferrno);
-
-  ERRNOS;
-
-  if (!done_EDOM || !done_ERANGE)
-    {
-      puts(endiferrno);
-      puts(ifEmath);
-      if (!done_EDOM)
-	printf("#define EDOM %d\n", ++biggest_value);
-      if (!done_ERANGE)
-	printf("#define ERANGE %d\n", ++biggest_value);
-      puts(endifEmath);
-    }
-
-  if (!done_ENOSYS)
-    printf("#define ENOSYS %d\n", ++biggest_value);
-
-  puts(endiferrno);
-
-  puts("#undef __need_Emath");
-  puts("#ifndef __Emath_defined\n#define __Emath_defined 1\n#endif");
-
-  exit(0);
-}
diff --git a/sysdeps/unix/errnos.awk b/sysdeps/unix/errnos.awk
deleted file mode 100644
index 8648f41fb2..0000000000
--- a/sysdeps/unix/errnos.awk
+++ /dev/null
@@ -1,12 +0,0 @@
-BEGIN { special = 0 }
-
-/ERRNOS/ { nerrnos = split(errnos, errs)
-	     for (i = 1; i <= nerrnos; ++i)
-	       # Some systems define errno codes inside undefined #ifdefs,
-	       # and then never actually use them.
-	       printf "#ifdef %s\n  DO(\"%s\", %s);\n#endif\n", \
-		 errs[i], errs[i], errs[i]
-	     special = 1 }
-
-
-{ if (special == 0) print $0; special = 0 }
diff --git a/sysdeps/unix/ioctls-tmpl.c b/sysdeps/unix/ioctls-tmpl.c
deleted file mode 100644
index 1c973c945a..0000000000
--- a/sysdeps/unix/ioctls-tmpl.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* On SVR4, this #define is necessary to make <sys/ioctl.h> define
-   many of the ioctls.  */
-#define BSD_COMP
-
-#include <sys/types.h>
-#include <sys/param.h>
-
-/* On SunOS 4.1, <sys/ioctl.h> and <sys/termios.h> define some symbols
-   with different values, but <sys/termios.h> defines some ioctl symbols
-   not in <sys/ioctl.h>, so we need it.  Our <sys/ioctl.h> should define
-   them with the values from Sun's <sys/ioctl.h>, not <sys/termios.h>.
-   So we include <sys/termios.h> and let <sys/ioctl.h> redefine things.
-   This produces some spurious warnings.  */
-
-#ifdef HAVE_sys_termios_h
-#include <sys/termios.h>
-#endif
-
-/* This causes <sys/ioctl.h> to define some necessary data structure.  */
-#ifdef sony_news
-#define KANJI
-#endif
-
-#include <sys/ioctl.h>
-
-#ifdef	SIOCGIFCONF
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <net/if.h>
-#include <net/route.h>
-#if	defined(SIOCGARP) && !defined(ARPOP_REQUEST)
-#include <net/if_arp.h>
-#endif
-#ifdef	SIOCGNIT
-#ifdef	HAVE_net_nit_h
-#include <net/nit.h>
-#else	/* No net/nit.h.  */
-#undef SIOCGNIT
-#undef SIOCSNIT
-#endif	/* net/nit.h.  */
-#endif	/* SIOCGNIT.  */
-#endif	/* SIOCGIFCONF.  */
-
-/* These exist on Sequents.  */
-#ifdef SMIOSTATS
-#include <sec/sec.h>
-#include <sec/sm.h>
-#endif
-#ifdef SMIOGETREBOOT0
-#include <i386/cfg.h>
-#endif
-#ifdef ZIOCBCMD
-#include <zdc/zdc.h>
-#endif
-
-/* These exist under Ultrix, but I figured there may be others.  */
-#ifdef DIOCGETPT
-#include <ufs/fs.h>		/* for DIOC* */
-#endif
-#ifdef DEVGETGEOM
-#include <sys/devio.h>
-#endif
-
-#ifdef ultrix
-/* Ultrix has a conditional include that brings these in; we have to force
-   their inclusion when we actually compile them.  */
-#undef TCGETA
-#undef TCSETA
-#undef TCSETAW
-#undef TCSETAF
-#undef TCGETP
-#undef TCSANOW
-#undef TCSADRAIN
-#undef TCSAFLUSH
-#ifdef ELSETPID
-#include <sys/un.h> /* get sockaddr_un for elcsd.h */
-#include <elcsd.h>
-#endif
-#ifdef DKIOCDOP
-#include <sys/dkio.h>
-#endif
-/* Couldn't find the header where the structures used by these are
-   defined; it looks like an unbundled LAT package or something.  */
-#undef LIOCSOL
-#undef LIOCRES
-#undef LIOCCMD
-#undef LIOCINI
-#undef LIOCTTYI
-#undef LIOCCONN
-/* struct mtop hasn't been in sys/mtio.h since 4.1 */
-#undef MTIOCTOP
-#undef MTIOCGET
-#endif
-
-#if defined(__osf__) && defined(__alpha__)
-#include <sys/ioctl_compat.h>	/* To get TIOCGETP, etc.  */
-#include <alpha/pt.h>		/* for DIOC* */
-#include <sys/mtio.h>		/* for MTIOC* */
-/* The binlog_getstatus structure doesn't seem to be defined.  */
-#undef BINLOG_GETSTATUS
-/* Can't find `struct ifdata' anywhere.  */
-#undef SIOCMANREQ
-#undef SIOCGETEVENTS
-/* OSF/1 smells an awful lot like Ultrix.  */
-#undef TCGETA
-#undef TCSETA
-#undef TCSETAF
-#undef TCSETAW
-/* This macro looks screwed in sys/devio.h.  */
-#undef DEV_DISKPART
-/* This is in sys/dkio.h, but we don't need it.  */
-#undef DKIOCACC
-#undef DKIOCDOP
-#undef DKIOCEXCL
-#undef DKIOCGET
-#undef DKIOCHDR
-/* Introduced by OSF/1 2.0.  */
-#undef FIOPIPESTAT
-#undef SIOCSRREQR
-#undef SIOCSRREQW
-#undef SRVC_REQUEST
-#endif
-
-#define	DEFINE(name, value) \
-  printf("#define %s 0x%.8x\n", (name), (value))
-
-int
-main()
-{
-  REQUESTS
-
-  exit(0);
-  return 0;
-}
diff --git a/sysdeps/unix/ioctls.awk b/sysdeps/unix/ioctls.awk
deleted file mode 100644
index b05140af7a..0000000000
--- a/sysdeps/unix/ioctls.awk
+++ /dev/null
@@ -1,10 +0,0 @@
-BEGIN { special = 0 }
-
-/REQUESTS/ { nreqs = split(requests, reqs)
-	     for (i = 1; i <= nreqs; ++i)
-	       printf "#ifdef\t%s\n  DEFINE(\"%s\", %s);\n#endif\n", \
-		      reqs[i], reqs[i], reqs[i]
-	     special = 1 }
-
-
-{ if (special == 0) print $0; special = 0 }
diff --git a/sysdeps/unix/mk-local_lim.c b/sysdeps/unix/mk-local_lim.c
deleted file mode 100644
index 3ed2426a87..0000000000
--- a/sysdeps/unix/mk-local_lim.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright (C) 1993, 1996, 1997 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 <stdio.h>
-#include <sys/types.h>
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifdef HAVE_SYS_LIMITS_H
-#include <sys/limits.h>
-#endif
-
-/* Generate bits/local_lim.h from the values defined in the system's
-   headers.  */
-
-struct param
-  {
-    char *name;
-    int value;
-  };
-
-static struct param params[] =
-  {
-
-#if !defined (ARG_MAX) && defined (NCARGS)
-#define ARG_MAX NCARGS
-#endif
-#ifdef ARG_MAX
-    { "ARG_MAX", ARG_MAX },
-#endif
-
-#if !defined (CHILD_MAX) && defined (MAXUPRC)
-#define CHILD_MAX MAXUPRC
-#endif
-#ifdef CHILD_MAX
-    { "CHILD_MAX", CHILD_MAX },
-#endif
-
-#if !defined (LINK_MAX) && defined (MAXLINK)
-#define LINK_MAX MAXLINK
-#endif
-#ifdef LINK_MAX
-    { "LINK_MAX", LINK_MAX },
-#endif
-
-#if !defined (OPEN_MAX) && defined (NOFILE)
-#define OPEN_MAX NOFILE
-#endif
-#ifdef OPEN_MAX
-    { "OPEN_MAX", OPEN_MAX },
-#endif
-
-#if !defined (MAX_CANON) && defined (CANBSIZ)
-#define MAX_CANON CANBSIZ
-#endif
-#ifdef MAX_CANON
-    { "MAX_CANON", MAX_CANON },
-#endif
-
-#if !defined (NAME_MAX) && defined (MAXNAMLEN)
-#define NAME_MAX MAXNAMLEN
-#endif
-#ifndef NAME_MAX
-#define NAME_MAX	255	/* XXX ? */
-#endif
-    { "NAME_MAX", NAME_MAX },
-
-#if !defined (PATH_MAX) && defined (MAXPATHLEN)
-#define PATH_MAX MAXPATHLEN
-#endif
-#ifdef PATH_MAX
-    { "PATH_MAX", PATH_MAX },
-#endif
-
-#if !defined (SYMLOOP_MAX) && defined (MAXSYMLINKS)
-#define SYMLOOP_MAX MAXSYMLINKS
-#endif
-#ifdef SYMLOOP_MAX
-    { "SYMLOOP_MAX", SYMLOOP_MAX },
-#endif
-
-    { NULL, 0 }
-  };
-
-int
-main()
-{
-  extern char *ctime ();
-  extern time_t time ();
-  time_t now = time ((time_t *) NULL);
-  register struct param *p;
-
-  if (! params[0].name)
-    /* We have no information to give, so let the caller know.  */
-    exit (1);
-
-  printf ("\
-/* Implementation-specific limits.\n\
-   Generated at %.24s.  */\n\n", ctime (&now));
-
-  for (p = params; p->name != NULL; ++p)
-    printf ("#define %s %d\n", p->name, p->value);
-
-  exit (0);
-}
diff --git a/sysdeps/unix/snarf-ioctls b/sysdeps/unix/snarf-ioctls
deleted file mode 100755
index a2fc023429..0000000000
--- a/sysdeps/unix/snarf-ioctls
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-# Copyright (C) 1991, 1992, 1995, 1997 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/>.
-
-sysincludedir=${sysincludedir-/usr/include}
-
-if [ ! "$snarfexclude" ]; then
-  # Filter out some headers which cause trouble.
-  # Reportedly a bug in sunos4.1.2's sed makes this lose if
-  # the two cmds are in a single sed invocation.
-  snarfexclude="`echo !${sysincludedir}/sys/param.h! \
-		      !${sysincludedir}/sys/time.h! \
-		      !${sysincludedir}/sys/types.h! \
-		 | sed 's,/,\\\\/,g' \
-		 | sed 's,!\\([^!]*\\)!,-e /\\1/d,g'`"
-fi
-
-for file in $*; do
-  sed -n 's/^#define[ 	]*\([A-Z][A-Z0-9_]*\)[ 	][ 	]*[^ 	].*$/\1/p' \
-    < $file
-
-  snarfexclude="$snarfexclude \
-		`echo $file | sed -e 's,/,\\\\/,g' -e 's,^.*$,-e /&/d,'`"
-  export snarfexclude
-
-  included="`sed -n < $file \
-		 -e 's,^#include[ 	]*<\(.*\)>.*$,'${sysincludedir}'/\1,p'\
-	     | sed $snarfexclude`"
-  if [ "$included" ]; then
-    $0 $included
-  fi
-done
-
-exit 0
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index ad1e2f19b8..fef6ea1a8a 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -501,6 +501,23 @@ float: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog (0x1.fffffep+127 + 0x1.fffffep+127 i) == 89.06941264234832570836679262104313101776 + pi/4 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 + 0x1p+16383 i) == 11356.60974243783798653123798337822335902 + 0.4764674194737066993385333770295162295856 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-147 + 0x1p-147 i) == -101.5460619520319878296245057936228672231 + pi/4 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (0x1p-149 + 0x1p-149 i) == -102.9323563131518784484589700365392203592 + pi/4 i":
+ildouble: 1
+ldouble: 1
 
 # clog10
 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
@@ -570,6 +587,54 @@ idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0x1.fffffep+127 + 1.0 i) == 38.53183941910362389414093724045094697423 + 1.276276851248440096917018665609900318458e-39 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i) == 308.4052305577487344482591243175787477115 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 308.3031705664207720674749211936626341569 + 0.2013595981366865903254995612594728746470 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1.fp+16383 + 0x1.fp+16383 i) == 4932.212175672014259683102930239951947672 + pi/4*log10(e) i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i) == -44.10089436477324509881274807713822842154 + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
 double: 1
 float: 1
@@ -2035,7 +2100,9 @@ ildouble: 1
 ldouble: 1
 
 Function: Real part of "clog":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1