about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-04-15 01:38:39 +0000
committerUlrich Drepper <drepper@redhat.com>1997-04-15 01:38:39 +0000
commit7799b7b3350fdcadc6dfb8821fb49b7772c96701 (patch)
tree21a6a07547c0e58dee9fef4082a7e7d27ddece7e
parent9d8067d8f20139548df2a29b8800975ea410bc4c (diff)
downloadglibc-cvs/libc-970415.tar.gz
glibc-cvs/libc-970415.tar.xz
glibc-cvs/libc-970415.zip
1997-04-15 03:14  Ulrich Drepper  <drepper@cygnus.com>

	* wcsmbs/wcsstr.c: Add weak alias wcswcs for Unix98 compliance.

	* math/Makefile (libm-calls): Add s_sincos and s_cproj.
	* math/mathcalls.h: Add prototype for sincos.
	* sysdeps/i386/fpu/__math.h: Warn about restriction on arguments to
	inlined sin and cos function.
	Define functions new in ISO C 9X when __USE_ISOC9X is defined.
	Add optimized version of finite.
	Rewrite sincos function to handle too large arguments.
	* sysdeps/libm-i387/s_cos.S: Better code alignment.
	* sysdeps/libm-i387/s_cosl.S: Likewise.
	* sysdeps/libm-i387/s_sin.S: Likewise.
	* sysdeps/libm-i387/s_sinl.S: Likewise.
	* sysdeps/libm-i387/s_finite.S: Yet better code.
	* sysdeps/libm-i387/s_finitef.S: Likewise.
	* sysdeps/libm-i387/s_sincos.S: New file.
	* sysdeps/libm-i387/s_sincosf.S: New file.
	* sysdeps/libm-i387/s_sincosl.S: New file.
	* sysdeps/libm-ieee754/s_sincos.c: New file.
	* sysdeps/libm-ieee754/s_sincosf.c: New file.
	* sysdeps/libm-ieee754/s_sincosl.c: New file.

	* sysdeps/libm-ieee754/s_ccosh.c: Change to use sincos function.
	* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
	* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.
	* sysdeps/libm-ieee754/s_cexp.c: Likewise.
	* sysdeps/libm-ieee754/s_cexpf.c: Likewise.
	* sysdeps/libm-ieee754/s_cexpl.c: Likewise.
	* sysdeps/libm-ieee754/s_csinh.c: Likewise.
	* sysdeps/libm-ieee754/s_csinhf.c: Likewise.
	* sysdeps/libm-ieee754/s_csinhl.c: Likewise.
	* sysdeps/libm-ieee754/s_ctan.c: Likewise.
	* sysdeps/libm-ieee754/s_ctanf.c: Likewise.
	* sysdeps/libm-ieee754/s_ctanl.c: Likewise.
	* sysdeps/libm-ieee754/s_ctanh.c: Likewise.
	* sysdeps/libm-ieee754/s_ctanhf.c: Likewise.
	* sysdeps/libm-ieee754/s_ctanhl.c: Likewise.

	* sysdeps/libm-ieee754/s_cosl.c: Correct check for range.
	* sysdeps/libm-ieee754/s_sinl.c: Likewise.

	* sysdeps/libm-ieee754/s_roundtol.c: Fix typos.
	* sysdeps/libm-ieee754/s_roundtoll.c: Likewise.

	* nis/Makefile (services): Mention nisplus before compat.
	* nis/nis_call.c (__do_niscall): Change type of variable server_len
	to prevent warning.
	* nis/nss_compat/compat-grp.c (getgrent_next_file_plusgroup): Add
	cast to prevent warning.
	* nis/nss_compat/compat-pwd.c (getpwent_next_file_plususer): Likewise.
	* nis/nss_compat/compat-spwd.c (getspent_next_file_plususer): Likewise.
	* nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change
	type of variable `i' to prevent warning.
	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_parse_netent):
	Likewise.
	* nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_parse_protoent):
	Likewise.
	* nis/nss_nisplus/nisplus-rpc.c (_nss_nisplus_parse_rpcent): Likewise.
	* nis/nss_nisplus/nisplus-service.c (_nss_nisplus_parse_servent):
	Likewise.

	* sysdeps/generic/Dist: Remove old math implementation files.
	* sysdeps/generic/mathimpl.h: Removed.
	* sysdeps/generic/trig.h: Removed.
	* sysdeps/generic/sincos.c: Removed.
	* sysdeps/generic/asincos.c: Removed.
	* sysdeps/generic/exp__E.c: Removed.
	* sysdeps/generic/log__L.c: Removed.

1997-04-13 17:18  Wolfram Gloger  <wmglo@dent.med.uni-muenchen.de>

	* malloc/malloc.c (fREe): Small optimization.  Before returning,
	add fast check whether the heap containing top can go away.

1997-04-11 16:46  Wolfram Gloger  <wmglo@dent.med.uni-muenchen.de>

	* malloc/malloc.c (mALLOc, rEALLOc, cALLOc, mEMALIGn): When
	failing to allocate a new chunk, also try the main_arena.  It may
	be that we are only running out of mmapped regions, and other
	arenas cannot be enlarged sufficiently.
	(new_heap, malloc_extend_top): Handle top_pad more consistently,
	i.e. only in new_heap().

1997-04-13 21:10  Philip Blundell  <pjb27@cl.cam.ac.uk>

	* sysdeps/posix/Makefile: Don't try to build and run mk-stdiolim
	if cross-compiling.

	* configure.in: Recognise "...linuxaout" OS names and turn off ELF.

	* configure.in: Add ARM support.
	* sysdeps/arm/Implies: New file.
	* sysdeps/arm/__longjmp.S: New file.
	* sysdeps/arm/bsd-_setjmp: New file.
	* sysdeps/arm/bsd-setjmp: New file.
	* sysdeps/arm/bytesex.h: New file.
	* sysdeps/arm/fpu_control.h: New file.
	* sysdeps/arm/jmp_buf.h: New file.
	* sysdeps/arm/setjmp.h: New file.
	* sysdeps/arm/sysdep.h: New file.
	* sysdeps/unix/arm/config.h: New file.

1997-04-14 04:03  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/libm-ieee754/s_cproj.c: New file.
	* sysdeps/libm-ieee754/s_cprojf.c: New file.
	* sysdeps/libm-ieee754/s_cprojl.c: New file.
-rw-r--r--.cvsignore3
-rw-r--r--ChangeLog110
-rwxr-xr-xconfigure112
-rw-r--r--configure.in4
-rw-r--r--malloc/malloc.c118
-rw-r--r--math/Makefile4
-rw-r--r--math/mathcalls.h5
-rw-r--r--nis/Makefile2
-rw-r--r--nis/nis_call.c15
-rw-r--r--nis/nss_compat/compat-grp.c2
-rw-r--r--nis/nss_compat/compat-pwd.c2
-rw-r--r--nis/nss_compat/compat-spwd.c2
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c3
-rw-r--r--nis/nss_nisplus/nisplus-network.c2
-rw-r--r--nis/nss_nisplus/nisplus-proto.c2
-rw-r--r--nis/nss_nisplus/nisplus-rpc.c2
-rw-r--r--nis/nss_nisplus/nisplus-service.c2
-rw-r--r--sysdeps/arm/Implies2
-rw-r--r--sysdeps/arm/__longjmp.S37
-rw-r--r--sysdeps/arm/bsd-_setjmp.S29
-rw-r--r--sysdeps/arm/bsd-setjmp.S29
-rw-r--r--sysdeps/arm/bytesex.h3
-rw-r--r--sysdeps/arm/fpu_control.h48
-rw-r--r--sysdeps/arm/jmp_buf.h10
-rw-r--r--sysdeps/arm/setjmp.S36
-rw-r--r--sysdeps/arm/sysdep.h92
-rw-r--r--sysdeps/generic/Dist6
-rw-r--r--sysdeps/generic/asincos.c169
-rw-r--r--sysdeps/generic/exp__E.c136
-rw-r--r--sysdeps/generic/log__L.c110
-rw-r--r--sysdeps/generic/mathimpl.h127
-rw-r--r--sysdeps/generic/sincos.c98
-rw-r--r--sysdeps/generic/trig.h215
-rw-r--r--sysdeps/i386/fpu/__math.h69
-rw-r--r--sysdeps/libm-i387/s_cos.S1
-rw-r--r--sysdeps/libm-i387/s_cosl.S1
-rw-r--r--sysdeps/libm-i387/s_finite.S7
-rw-r--r--sysdeps/libm-i387/s_finitef.S7
-rw-r--r--sysdeps/libm-i387/s_sin.S1
-rw-r--r--sysdeps/libm-i387/s_sincos.S48
-rw-r--r--sysdeps/libm-i387/s_sincosf.S48
-rw-r--r--sysdeps/libm-i387/s_sincosl.S48
-rw-r--r--sysdeps/libm-i387/s_sinl.S1
-rw-r--r--sysdeps/libm-ieee754/s_ccosh.c15
-rw-r--r--sysdeps/libm-ieee754/s_ccoshf.c15
-rw-r--r--sysdeps/libm-ieee754/s_ccoshl.c15
-rw-r--r--sysdeps/libm-ieee754/s_cexp.c23
-rw-r--r--sysdeps/libm-ieee754/s_cexpf.c19
-rw-r--r--sysdeps/libm-ieee754/s_cexpl.c19
-rw-r--r--sysdeps/libm-ieee754/s_cosl.c7
-rw-r--r--sysdeps/libm-ieee754/s_cproj.c49
-rw-r--r--sysdeps/libm-ieee754/s_cprojf.c45
-rw-r--r--sysdeps/libm-ieee754/s_cprojl.c46
-rw-r--r--sysdeps/libm-ieee754/s_csinh.c17
-rw-r--r--sysdeps/libm-ieee754/s_csinhf.c17
-rw-r--r--sysdeps/libm-ieee754/s_csinhl.c15
-rw-r--r--sysdeps/libm-ieee754/s_ctan.c10
-rw-r--r--sysdeps/libm-ieee754/s_ctanf.c10
-rw-r--r--sysdeps/libm-ieee754/s_ctanh.c10
-rw-r--r--sysdeps/libm-ieee754/s_ctanhf.c10
-rw-r--r--sysdeps/libm-ieee754/s_ctanhl.c10
-rw-r--r--sysdeps/libm-ieee754/s_ctanl.c10
-rw-r--r--sysdeps/libm-ieee754/s_roundtol.c4
-rw-r--r--sysdeps/libm-ieee754/s_roundtoll.c4
-rw-r--r--sysdeps/libm-ieee754/s_sincos.c78
-rw-r--r--sysdeps/libm-ieee754/s_sincosf.c74
-rw-r--r--sysdeps/libm-ieee754/s_sincosl.c74
-rw-r--r--sysdeps/libm-ieee754/s_sinl.c7
-rw-r--r--sysdeps/posix/Makefile10
-rw-r--r--sysdeps/unix/arm/sysdep.h21
-rw-r--r--wcsmbs/wcsstr.c3
71 files changed, 1342 insertions, 1063 deletions
diff --git a/.cvsignore b/.cvsignore
index fccffa3b45..519db6b9c3 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -14,6 +14,9 @@ gpl2lgpl.sed
 distinfo
 distinfo
 
+analysis
+docs
+
 crypt
 linuxthreads
 localedata
diff --git a/ChangeLog b/ChangeLog
index 2817e818bf..a43ebf0ab5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,113 @@
+1997-04-15 03:14  Ulrich Drepper  <drepper@cygnus.com>
+
+	* wcsmbs/wcsstr.c: Add weak alias wcswcs for Unix98 compliance.
+
+	* math/Makefile (libm-calls): Add s_sincos and s_cproj.
+	* math/mathcalls.h: Add prototype for sincos.
+	* sysdeps/i386/fpu/__math.h: Warn about restriction on arguments to
+	inlined sin and cos function.
+	Define functions new in ISO C 9X when __USE_ISOC9X is defined.
+	Add optimized version of finite.
+	Rewrite sincos function to handle too large arguments.
+	* sysdeps/libm-i387/s_cos.S: Better code alignment.
+	* sysdeps/libm-i387/s_cosl.S: Likewise.
+	* sysdeps/libm-i387/s_sin.S: Likewise.
+	* sysdeps/libm-i387/s_sinl.S: Likewise.
+	* sysdeps/libm-i387/s_finite.S: Yet better code.
+	* sysdeps/libm-i387/s_finitef.S: Likewise.
+	* sysdeps/libm-i387/s_sincos.S: New file.
+	* sysdeps/libm-i387/s_sincosf.S: New file.
+	* sysdeps/libm-i387/s_sincosl.S: New file.
+	* sysdeps/libm-ieee754/s_sincos.c: New file.
+	* sysdeps/libm-ieee754/s_sincosf.c: New file.
+	* sysdeps/libm-ieee754/s_sincosl.c: New file.
+
+	* sysdeps/libm-ieee754/s_ccosh.c: Change to use sincos function.
+	* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
+	* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.
+	* sysdeps/libm-ieee754/s_cexp.c: Likewise.
+	* sysdeps/libm-ieee754/s_cexpf.c: Likewise.
+	* sysdeps/libm-ieee754/s_cexpl.c: Likewise.
+	* sysdeps/libm-ieee754/s_csinh.c: Likewise.
+	* sysdeps/libm-ieee754/s_csinhf.c: Likewise.
+	* sysdeps/libm-ieee754/s_csinhl.c: Likewise.
+	* sysdeps/libm-ieee754/s_ctan.c: Likewise.
+	* sysdeps/libm-ieee754/s_ctanf.c: Likewise.
+	* sysdeps/libm-ieee754/s_ctanl.c: Likewise.
+	* sysdeps/libm-ieee754/s_ctanh.c: Likewise.
+	* sysdeps/libm-ieee754/s_ctanhf.c: Likewise.
+	* sysdeps/libm-ieee754/s_ctanhl.c: Likewise.
+
+	* sysdeps/libm-ieee754/s_cosl.c: Correct check for range.
+	* sysdeps/libm-ieee754/s_sinl.c: Likewise.
+
+	* sysdeps/libm-ieee754/s_roundtol.c: Fix typos.
+	* sysdeps/libm-ieee754/s_roundtoll.c: Likewise.
+
+	* nis/Makefile (services): Mention nisplus before compat.
+	* nis/nis_call.c (__do_niscall): Change type of variable server_len
+	to prevent warning.
+	* nis/nss_compat/compat-grp.c (getgrent_next_file_plusgroup): Add
+	cast to prevent warning.
+	* nis/nss_compat/compat-pwd.c (getpwent_next_file_plususer): Likewise.
+	* nis/nss_compat/compat-spwd.c (getspent_next_file_plususer): Likewise.
+	* nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change
+	type of variable `i' to prevent warning.
+	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_parse_netent):
+	Likewise.
+	* nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_parse_protoent):
+	Likewise.
+	* nis/nss_nisplus/nisplus-rpc.c (_nss_nisplus_parse_rpcent): Likewise.
+	* nis/nss_nisplus/nisplus-service.c (_nss_nisplus_parse_servent):
+	Likewise.
+
+	* sysdeps/generic/Dist: Remove old math implementation files.
+	* sysdeps/generic/mathimpl.h: Removed.
+	* sysdeps/generic/trig.h: Removed.
+	* sysdeps/generic/sincos.c: Removed.
+	* sysdeps/generic/asincos.c: Removed.
+	* sysdeps/generic/exp__E.c: Removed.
+	* sysdeps/generic/log__L.c: Removed.
+
+1997-04-13 17:18  Wolfram Gloger  <wmglo@dent.med.uni-muenchen.de>
+
+	* malloc/malloc.c (fREe): Small optimization.  Before returning,
+	add fast check whether the heap containing top can go away.
+
+1997-04-11 16:46  Wolfram Gloger  <wmglo@dent.med.uni-muenchen.de>
+
+	* malloc/malloc.c (mALLOc, rEALLOc, cALLOc, mEMALIGn): When
+	failing to allocate a new chunk, also try the main_arena.  It may
+	be that we are only running out of mmapped regions, and other
+	arenas cannot be enlarged sufficiently.
+	(new_heap, malloc_extend_top): Handle top_pad more consistently,
+	i.e. only in new_heap().
+
+1997-04-13 21:10  Philip Blundell  <pjb27@cl.cam.ac.uk>
+
+	* sysdeps/posix/Makefile: Don't try to build and run mk-stdiolim
+	if cross-compiling.
+
+	* configure.in: Recognise "...linuxaout" OS names and turn off ELF.
+
+	* configure.in: Add ARM support.
+	* sysdeps/arm/Implies: New file.
+	* sysdeps/arm/__longjmp.S: New file.
+	* sysdeps/arm/bsd-_setjmp: New file.
+	* sysdeps/arm/bsd-setjmp: New file.
+	* sysdeps/arm/bytesex.h: New file.
+	* sysdeps/arm/fpu_control.h: New file.
+	* sysdeps/arm/jmp_buf.h: New file.
+	* sysdeps/arm/setjmp.h: New file.
+	* sysdeps/arm/sysdep.h: New file.
+	* sysdeps/unix/arm/config.h: New file.
+
+1997-04-14 04:03  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/libm-ieee754/s_cproj.c: New file.
+	* sysdeps/libm-ieee754/s_cprojf.c: New file.
+	* sysdeps/libm-ieee754/s_cprojl.c: New file.
+
 1997-04-13 01:06  Ulrich Drepper  <drepper@cygnus.com>
 
 	* isomac.c: Improve messages.
diff --git a/configure b/configure
index c04f1a0c36..0866deca11 100755
--- a/configure
+++ b/configure
@@ -776,7 +776,8 @@ gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
   gnu_ld=yes gnu_as=yes ;;
 esac
 case "$host_os" in
-linux*ecoff*)
+# i586-linuxaout is mangled into i586-pc-linux-gnuaout
+linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
   ;;
 gnu* | linux* | sysv4* | solaris2*)
   # These systems (almost) always use the ELF format.
@@ -793,6 +794,7 @@ os=$config_os
 case "$machine" in
 a29k | am29000)	base_machine=a29k machine=a29k ;;
 alpha*)		base_machine=alpha machine=alpha/$machine ;;
+arm*)		base_machine=arm machine=arm/$machine ;;
 hppa*)		base_machine=hppa machine=hppa/$machine ;;
 i[3456]86)	base_machine=i386 machine=i386/$machine ;;
 m680?0)		base_machine=m68k machine=m68k/$machine ;;
@@ -810,7 +812,7 @@ esac
 # This can take a while to compute.
 sysdep_dir=$srcdir/sysdeps
 echo $ac_n "checking sysdep dirs""... $ac_c" 1>&6
-echo "configure:814: checking sysdep dirs" >&5
+echo "configure:816: checking sysdep dirs" >&5
 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
 
@@ -1011,7 +1013,7 @@ echo "$ac_t""sysdeps/generic sysdeps/stub" 1>&6
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1015: checking for a BSD compatible install" >&5
+echo "configure:1017: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1065,7 +1067,7 @@ if test "$INSTALL" = "${srcdir}/install-sh -c"; then
   INSTALL='$(..)./install-sh -c'
 fi
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1069: checking whether ln -s works" >&5
+echo "configure:1071: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1090,7 +1092,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1094: checking for $ac_word" >&5
+echo "configure:1096: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1123,7 +1125,7 @@ test -n "$MSGFMT" || MSGFMT=":"
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1127: checking for $ac_word" >&5
+echo "configure:1129: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1152,7 +1154,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1156: checking for $ac_word" >&5
+echo "configure:1158: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1200,7 +1202,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1204: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1206: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1210,11 +1212,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 1214 "configure"
+#line 1216 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1234,12 +1236,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1238: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1240: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1243: checking whether we are using GNU C" >&5
+echo "configure:1245: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1248,7 +1250,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1263,7 +1265,7 @@ if test $ac_cv_prog_gcc = yes; then
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1267: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1269: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1291,7 +1293,7 @@ else
 fi
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1295: checking build system type" >&5
+echo "configure:1297: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1314,7 +1316,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1318: checking for $ac_word" >&5
+echo "configure:1320: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1344,7 +1346,7 @@ done
 
 fi
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1348: checking how to run the C preprocessor" >&5
+echo "configure:1350: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1359,13 +1361,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1363 "configure"
+#line 1365 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1369: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1376,13 +1378,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1380 "configure"
+#line 1382 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1386: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1388: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1413,7 +1415,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1417: checking for $ac_word" >&5
+echo "configure:1419: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1444,7 +1446,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1448: checking for $ac_word" >&5
+echo "configure:1450: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1475,7 +1477,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1479: checking for $ac_word" >&5
+echo "configure:1481: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1510,7 +1512,7 @@ fi
 # Extract the first word of "bash", so it can be a program name with args.
 set dummy bash; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1514: checking for $ac_word" >&5
+echo "configure:1516: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1551,7 +1553,7 @@ if test "$BASH" = no; then
   # Extract the first word of "ksh", so it can be a program name with args.
 set dummy ksh; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1555: checking for $ac_word" >&5
+echo "configure:1557: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1593,7 +1595,7 @@ fi
 
 
 echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:1597: checking for signed size_t type" >&5
+echo "configure:1599: checking for signed size_t type" >&5
 if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1617,12 +1619,12 @@ EOF
 fi
 
 echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:1621: checking for libc-friendly stddef.h" >&5
+echo "configure:1623: checking for libc-friendly stddef.h" >&5
 if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1626 "configure"
+#line 1628 "configure"
 #include "confdefs.h"
 #define __need_size_t
 #define __need_wchar_t
@@ -1637,7 +1639,7 @@ size_t size; wchar_t wchar;
 if (&size == NULL || &wchar == NULL) abort ();
 ; return 0; }
 EOF
-if { (eval echo configure:1641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_friendly_stddef=yes
 else
@@ -1656,7 +1658,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
 fi
 
 echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
-echo "configure:1660: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:1662: checking whether we need to use -P to assemble .S files" >&5
 if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1679,7 +1681,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
 fi
 
 echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:1683: checking for assembler global-symbol directive" >&5
+echo "configure:1685: checking for assembler global-symbol directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1709,7 +1711,7 @@ EOF
 fi
 
 echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1713: checking for .set assembler directive" >&5
+echo "configure:1715: checking for .set assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1743,7 +1745,7 @@ EOF
 fi
 
 echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:1747: checking for .symver assembler directive" >&5
+echo "configure:1749: checking for .symver assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1762,7 +1764,7 @@ fi
 
 echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6
 echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6
-echo "configure:1766: checking for ld --version-script" >&5
+echo "configure:1768: checking for ld --version-script" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1779,7 +1781,7 @@ VERS {
 EOF
   if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&5 2>&5; then
     if { ac_try='${CC-cc} $CFLAGS --shared -o conftest.so conftest.o
-					-Wl,--version-script,conftest.map'; { (eval echo configure:1783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+					-Wl,--version-script,conftest.map'; { (eval echo configure:1785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
     then
       libc_cv_ld_version_script_option=yes
     else
@@ -1809,7 +1811,7 @@ fi
 
 if test $elf = yes; then
   echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:1813: checking for .previous assembler directive" >&5
+echo "configure:1815: checking for .previous assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1817,7 +1819,7 @@ else
 .section foo_section
 .previous
 EOF
-  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1821: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     libc_cv_asm_previous_directive=yes
   else
     libc_cv_asm_previous_directive=no
@@ -1833,7 +1835,7 @@ EOF
 
   else
     echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:1837: checking for .popsection assembler directive" >&5
+echo "configure:1839: checking for .popsection assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1841,7 +1843,7 @@ else
 .pushsection foo_section
 .popsection
 EOF
-    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1845: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
       libc_cv_asm_popsection_directive=yes
     else
       libc_cv_asm_popsection_directive=no
@@ -1861,12 +1863,12 @@ fi
 
 if test $elf != yes; then
   echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1865: checking for .init and .fini sections" >&5
+echo "configure:1867: checking for .init and .fini sections" >&5
 if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1870 "configure"
+#line 1872 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1875,7 +1877,7 @@ asm (".section .init");
 				    asm (".text");
 ; return 0; }
 EOF
-if { (eval echo configure:1879: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1881: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -1900,19 +1902,19 @@ if test $elf = yes; then
   libc_cv_asm_underscores=no
 else
   echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:1904: checking for _ prefix on C symbol names" >&5
+echo "configure:1906: checking for _ prefix on C symbol names" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1909 "configure"
+#line 1911 "configure"
 #include "confdefs.h"
 asm ("_glibc_foobar:");
 int main() {
 glibc_foobar ();
 ; return 0; }
 EOF
-if { (eval echo configure:1916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   libc_cv_asm_underscores=yes
 else
@@ -1939,7 +1941,7 @@ if test $elf = yes; then
   libc_cv_asm_weakext_directive=no
 else
   echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:1943: checking for assembler .weak directive" >&5
+echo "configure:1945: checking for assembler .weak directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1962,7 +1964,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
 
 if test $libc_cv_asm_weak_directive = no; then
   echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:1966: checking for assembler .weakext directive" >&5
+echo "configure:1968: checking for assembler .weakext directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1999,7 +2001,7 @@ EOF
 fi
 
 echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:2003: checking for ld --no-whole-archive" >&5
+echo "configure:2005: checking for ld --no-whole-archive" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2010,7 +2012,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -Wl,--no-whole-archive
-			    -o conftest conftest.c'; { (eval echo configure:2014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:2016: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_ld_no_whole_archive=yes
 else
   libc_cv_ld_no_whole_archive=no
@@ -2021,7 +2023,7 @@ fi
 echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
 
 echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:2025: checking for gcc -fno-exceptions" >&5
+echo "configure:2027: checking for gcc -fno-exceptions" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2032,7 +2034,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -fno-exceptions
-			    -o conftest conftest.c'; { (eval echo configure:2036: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:2038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_no_exceptions=yes
 else
   libc_cv_gcc_no_exceptions=no
@@ -2084,7 +2086,7 @@ if test "$uname" = generic; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:2088: checking OS release for uname" >&5
+echo "configure:2090: checking OS release for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2106,7 +2108,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
   uname_release="$libc_cv_uname_release"
 
   echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:2110: checking OS version for uname" >&5
+echo "configure:2112: checking OS version for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2128,7 +2130,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:2132: checking stdio selection" >&5
+echo "configure:2134: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
diff --git a/configure.in b/configure.in
index 3a0f1a22f3..2d3265eb5b 100644
--- a/configure.in
+++ b/configure.in
@@ -119,7 +119,8 @@ gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
   gnu_ld=yes gnu_as=yes ;;
 esac
 case "$host_os" in
-linux*ecoff*)
+# i586-linuxaout is mangled into i586-pc-linux-gnuaout
+linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
   ;;
 gnu* | linux* | sysv4* | solaris2*)
   # These systems (almost) always use the ELF format.
@@ -138,6 +139,7 @@ changequote(,)dnl
 case "$machine" in
 a29k | am29000)	base_machine=a29k machine=a29k ;;
 alpha*)		base_machine=alpha machine=alpha/$machine ;;
+arm*)		base_machine=arm machine=arm/$machine ;;
 hppa*)		base_machine=hppa machine=hppa/$machine ;;
 i[3456]86)	base_machine=i386 machine=i386/$machine ;;
 m680?0)		base_machine=m68k machine=m68k/$machine ;;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index f86d2df5ed..5b16a0ac20 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1801,11 +1801,16 @@ new_heap(size) size_t size;
   unsigned long ul;
   heap_info *h;
 
-  if(size < HEAP_MIN_SIZE)
+  if(size+top_pad < HEAP_MIN_SIZE)
     size = HEAP_MIN_SIZE;
-  size = (size + page_mask) & ~page_mask;
-  if(size > HEAP_MAX_SIZE)
+  else if(size+top_pad <= HEAP_MAX_SIZE)
+    size += top_pad;
+  else if(size > HEAP_MAX_SIZE)
     return 0;
+  else
+    size = HEAP_MAX_SIZE;
+  size = (size + page_mask) & ~page_mask;
+
   p1 = (char *)MMAP(HEAP_MAX_SIZE<<1, PROT_NONE);
   if(p1 == (char *)-1)
     return 0;
@@ -2228,9 +2233,11 @@ static void malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
         (brk < old_end && old_top != initial_top(&main_arena)))
       return;
 
+#if defined(_LIBC) || defined(MALLOC_HOOKS)
     /* Call the `morecore' hook if necessary.  */
     if (__after_morecore_hook)
       (*__after_morecore_hook) ();
+#endif
 
     sbrked_mem += sbrk_size;
 
@@ -2260,9 +2267,11 @@ static void malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
       new_brk = (char*)(MORECORE (correction));
       if (new_brk == (char*)(MORECORE_FAILURE)) return;
 
+#if defined(_LIBC) || defined(MALLOC_HOOKS)
       /* Call the `morecore' hook if necessary.  */
       if (__after_morecore_hook)
-	(*__after_morecore_hook) ();
+        (*__after_morecore_hook) ();
+#endif
 
       sbrked_mem += correction;
 
@@ -2303,7 +2312,7 @@ static void malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
     }
 
     /* A new heap must be created. */
-    heap = new_heap(nb + top_pad + (MINSIZE + sizeof(*heap)));
+    heap = new_heap(nb + (MINSIZE + sizeof(*heap)));
     if(!heap)
       return;
     heap->ar_ptr = ar_ptr;
@@ -2425,12 +2434,21 @@ Void_t* mALLOc(bytes) size_t bytes;
 #endif
 
   nb = request2size(bytes);
-  arena_get(ar_ptr, nb + top_pad);
+  arena_get(ar_ptr, nb);
   if(!ar_ptr)
     return 0;
   victim = chunk_alloc(ar_ptr, nb);
   (void)mutex_unlock(&ar_ptr->mutex);
-  return victim ? chunk2mem(victim) : 0;
+  if(!victim) {
+    /* Maybe the failure is due to running out of mmapped areas. */
+    if(ar_ptr != &main_arena) {
+      (void)mutex_lock(&main_arena.mutex);
+      victim = chunk_alloc(&main_arena, nb);
+      (void)mutex_unlock(&main_arena.mutex);
+    }
+    if(!victim) return 0;
+  }
+  return chunk2mem(victim);
 }
 
 static mchunkptr
@@ -2792,8 +2810,6 @@ chunk_free(ar_ptr, p) arena *ar_ptr; mchunkptr p;
     return;
   }
 
-  set_head(next, nextsz);                    /* clear inuse bit */
-
   islr = 0;
 
   if (!(hd & PREV_INUSE))                    /* consolidate backward */
@@ -2820,12 +2836,29 @@ chunk_free(ar_ptr, p) arena *ar_ptr; mchunkptr p;
     }
     else
       unlink(next, bck, fwd);
+
+    next = chunk_at_offset(p, sz);
   }
+  else
+    set_head(next, nextsz);                  /* clear inuse bit */
 
   set_head(p, sz | PREV_INUSE);
-  set_foot(p, sz);
+  next->prev_size = sz;
   if (!islr)
     frontlink(ar_ptr, p, sz, idx, bck, fwd);
+
+#ifndef NO_THREADS
+  /* Check whether the heap containing top can go away now. */
+  if(next->size < MINSIZE &&
+     (unsigned long)sz > trim_threshold &&
+     ar_ptr != &main_arena) {                /* fencepost */
+    heap_info* heap = heap_for_ptr(top(ar_ptr));
+
+    if(top(ar_ptr) == chunk_at_offset(heap, sizeof(*heap)) &&
+       heap->prev == heap_for_ptr(p))
+      heap_trim(heap, top_pad);
+  }
+#endif
 }
 
 
@@ -3063,8 +3096,16 @@ arena* ar_ptr; mchunkptr oldp; INTERNAL_SIZE_T oldsize, nb;
 
     newp = chunk_alloc (ar_ptr, nb);
 
-    if (newp == 0)  /* propagate failure */
-      return 0;
+    if (newp == 0) {
+      /* Maybe the failure is due to running out of mmapped areas. */
+      if (ar_ptr != &main_arena) {
+        (void)mutex_lock(&main_arena.mutex);
+        newp = chunk_alloc(&main_arena, nb);
+        (void)mutex_unlock(&main_arena.mutex);
+      }
+      if (newp == 0) /* propagate failure */
+        return 0;
+    }
 
     /* Avoid copy if newp is next chunk after oldp. */
     /* (This can only happen when new chunk is sbrk'ed.) */
@@ -3159,7 +3200,16 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
     return 0;
   p = chunk_align(ar_ptr, nb, alignment);
   (void)mutex_unlock(&ar_ptr->mutex);
-  return p ? chunk2mem(p) : NULL;
+  if(!p) {
+    /* Maybe the failure is due to running out of mmapped areas. */
+    if(ar_ptr != &main_arena) {
+      (void)mutex_lock(&main_arena.mutex);
+      p = chunk_align(&main_arena, nb, alignment);
+      (void)mutex_unlock(&main_arena.mutex);
+    }
+    if(!p) return 0;
+  }
+  return chunk2mem(p);
 }
 
 static mchunkptr
@@ -3329,31 +3379,34 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
   /* Only clearing follows, so we can unlock early. */
   (void)mutex_unlock(&ar_ptr->mutex);
 
-  if (p == 0)
-    return 0;
-  else
-  {
-    mem = chunk2mem(p);
+  if (p == 0) {
+    /* Maybe the failure is due to running out of mmapped areas. */
+    if(ar_ptr != &main_arena) {
+      (void)mutex_lock(&main_arena.mutex);
+      p = chunk_alloc(&main_arena, sz);
+      (void)mutex_unlock(&main_arena.mutex);
+    }
+    if (p == 0) return 0;
+  }
+  mem = chunk2mem(p);
 
-    /* Two optional cases in which clearing not necessary */
+  /* Two optional cases in which clearing not necessary */
 
 #if HAVE_MMAP
-    if (chunk_is_mmapped(p)) return mem;
+  if (chunk_is_mmapped(p)) return mem;
 #endif
 
-    csz = chunksize(p);
+  csz = chunksize(p);
 
 #if MORECORE_CLEARS
-    if (p == oldtop && csz > oldtopsize)
-    {
-      /* clear only the bytes from non-freshly-sbrked memory */
-      csz = oldtopsize;
-    }
+  if (p == oldtop && csz > oldtopsize) {
+    /* clear only the bytes from non-freshly-sbrked memory */
+    csz = oldtopsize;
+  }
 #endif
 
-    MALLOC_ZERO(mem, csz - SIZE_SZ);
-    return mem;
-  }
+  MALLOC_ZERO(mem, csz - SIZE_SZ);
+  return mem;
 }
 
 /*
@@ -3444,9 +3497,11 @@ main_trim(pad) size_t pad;
 
   new_brk = (char*)(MORECORE (-extra));
 
+#if defined(_LIBC) || defined(MALLOC_HOOKS)
   /* Call the `morecore' hook if necessary.  */
   if (__after_morecore_hook)
     (*__after_morecore_hook) ();
+#endif
 
   if (new_brk == (char*)(MORECORE_FAILURE)) { /* sbrk failed? */
     /* Try to figure out what we have */
@@ -3702,7 +3757,11 @@ void mALLOC_STATs()
     ar_ptr = ar_ptr->next;
     if(ar_ptr == &main_arena) break;
   }
+#if HAVE_MMAP
   fprintf(stderr, "Total (incl. mmap):\n");
+#else
+  fprintf(stderr, "Total:\n");
+#endif
   fprintf(stderr, "system bytes     = %10u\n", system_b);
   fprintf(stderr, "in use bytes     = %10u\n", in_use_b);
 #ifdef NO_THREADS
@@ -3710,6 +3769,7 @@ void mALLOC_STATs()
 #endif
 #if HAVE_MMAP
   fprintf(stderr, "max mmap regions = %10u\n", (unsigned int)max_n_mmaps);
+  fprintf(stderr, "max mmap bytes   = %10lu\n", max_mmapped_mem);
 #endif
 #if THREAD_STATS
   fprintf(stderr, "heaps created    = %10d\n",  stat_n_heaps);
diff --git a/math/Makefile b/math/Makefile
index 86418b003a..1ff61a03c8 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -53,10 +53,10 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod	\
 	     w_gamma_r w_hypot w_j0 w_j1 w_jn w_lgamma w_lgamma_r	\
 	     w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt	\
 	     s_signbit s_fpclassify s_fmax s_fmin s_fdim s_nan s_trunc	\
-	     s_remquo s_log2 s_exp2 s_round s_nearbyint			\
+	     s_remquo s_log2 s_exp2 s_round s_nearbyint s_sincos	\
 	     conj cimag creal cabs carg s_cexp s_csinh s_ccosh s_clog	\
 	     s_catan s_casin s_ccos s_csin s_ctan s_ctanh s_cacos	\
-	     s_casinh s_cacosh s_catanh s_csqrt s_cpow
+	     s_casinh s_cacosh s_catanh s_csqrt s_cpow s_cproj
 libm-routines = $(libm-support) $(libm-calls) \
 		$(patsubst %_rf,%f_r,$(libm-calls:=f))	\
 		$(long-m-$(long-double-fcts))
diff --git a/math/mathcalls.h b/math/mathcalls.h
index d566020aee..0aac420bd0 100644
--- a/math/mathcalls.h
+++ b/math/mathcalls.h
@@ -63,6 +63,11 @@ __MATHCALL (sin,, (_Mdouble_ __x));
 /* Tangent of X.  */
 __MATHCALL (tan,, (_Mdouble_ __x));
 
+#ifdef __USE_GNU
+/* Cosine and sine of X.  */
+__MATHDECL (void, sincos,,
+	    (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));
+#endif
 
 /* Hyperbolic functions.  */
 
diff --git a/nis/Makefile b/nis/Makefile
index fe4dd94ebb..64925bb70d 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -30,7 +30,7 @@ databases		= proto service hosts network grp pwd rpc ethers \
 			  spwd netgrp alias publickey
 
 # Specify rules for the nss_* modules.
-services		:= nis compat nisplus
+services		:= nis nisplus compat
 
 extra-libs		= libnsl $(services:%=libnss_%)
 # These libraries will be built in the `others' pass rather than
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 78e8767318..12b3ab265e 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -113,7 +113,7 @@ __nis_dobind (const nis_server *server, u_long flags)
 	  }
 	else
 	  continue;
-      
+
       clnt_sock = RPC_ANYSOCK;
       if ((flags & USE_DGRAM) == USE_DGRAM)
 	client = clntudp_create (&clnt_saddr, NIS_PROG, NIS_VERSION,
@@ -121,7 +121,7 @@ __nis_dobind (const nis_server *server, u_long flags)
       else
 	client = clnttcp_create (&clnt_saddr, NIS_PROG, NIS_VERSION,
 				 &clnt_sock, 0, 0);
-      
+
       if (client == NULL)
 	continue;
       if (clnt_call (client, 0, (xdrproc_t) xdr_void, NULL,
@@ -138,7 +138,7 @@ __nis_dobind (const nis_server *server, u_long flags)
 	    {
 	      char netname[MAXNETNAMELEN+1];
 	      char *p;
-	      
+
 	      p = stpcpy (netname, "unix.");
 	      strncpy (p, server->name,MAXNETNAMELEN-5);
 	      netname[MAXNETNAMELEN] = '\0';
@@ -155,7 +155,7 @@ __nis_dobind (const nis_server *server, u_long flags)
 	}
       return client;
     }
-  
+
   return NULL;
 }
 
@@ -167,7 +167,8 @@ __do_niscall (const nis_server *serv, int serv_len, u_long prog,
   CLIENT *clnt;
   directory_obj *dir = NULL;
   const nis_server *server;
-  int try, result, server_len;
+  int try, result;
+  unsigned int server_len;
 
   if (serv == NULL || serv_len == 0)
     {
@@ -195,10 +196,10 @@ __do_niscall (const nis_server *serv, int serv_len, u_long prog,
   while (try < MAXTRIES && result != RPC_SUCCESS)
     {
       unsigned int i;
-      
+
       if ((flags & HARD_LOOKUP) == 0)
 	++try;
-      
+
       for (i = 0; i < server_len; i++)
 	{
 	  if ((clnt = __nis_dobind (&server[i], flags)) == NULL)
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index 372212d0a3..68f852d19a 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -360,7 +360,7 @@ getgrent_next_file_plusgroup (struct group *result, char *buffer,
           != YPERR_SUCCESS)
         return NSS_STATUS_TRYAGAIN;
       p = strncpy (buffer, outval,
-                   buflen < outvallen ? buflen : outvallen);
+                   buflen < (size_t) outvallen ? buflen : (size_t) outvallen);
       free (outval);
       while (isspace (*p))
         p++;
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index 194b332c38..b47a8b13c1 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -677,7 +677,7 @@ getpwent_next_file_plususer (struct passwd *result, char *buffer,
 	  != YPERR_SUCCESS)
 	return NSS_STATUS_TRYAGAIN;
       p = strncpy (buffer, outval,
-		   buflen < outvallen ? buflen : outvallen);
+		   buflen < (size_t) outvallen ? buflen : (size_t) outvallen);
       free (outval);
       while (isspace (*p))
 	p++;
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 74967f8fd4..30c4e407d2 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -630,7 +630,7 @@ getspent_next_file_plususer (struct spwd *result, char *buffer,
           != YPERR_SUCCESS)
         return NSS_STATUS_TRYAGAIN;
       p = strncpy (buffer, outval,
-                   buflen < outvallen ? buflen : outvallen);
+                   buflen < (size_t) outvallen ? buflen : (size_t) outvallen);
       free (outval);
       while (isspace (*p))
         p++;
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index 1bcbe40e87..c933ae49be 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -117,7 +117,8 @@ _nss_nisplus_parse_hostent (nis_result *result, struct hostent *host,
 {
   char *p = buffer;
   size_t room_left = buflen;
-  int parse_res, i;
+  int parse_res;
+  unsigned int i;
   struct parser_data *data = (void *) buffer;
 
   if (result == NULL)
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index 7e0ccd6411..7f849e21e9 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -65,7 +65,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
 {
   char *p = buffer;
   size_t room_left = buflen;
-  int i;
+  unsigned int i;
   struct parser_data *data = (void *) buffer;
 
   if (result == NULL)
diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c
index 5cb55d367c..1399748846 100644
--- a/nis/nss_nisplus/nisplus-proto.c
+++ b/nis/nss_nisplus/nisplus-proto.c
@@ -56,7 +56,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
 {
   char *p = buffer;
   size_t room_left = buflen;
-  int i;
+  unsigned int i;
   struct parser_data *data = (void *) buffer;
 
   if (result == NULL)
diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c
index 9cf9f68b44..435da5792c 100644
--- a/nis/nss_nisplus/nisplus-rpc.c
+++ b/nis/nss_nisplus/nisplus-rpc.c
@@ -56,7 +56,7 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
 {
   char *p = buffer;
   size_t room_left = buflen;
-  int i;
+  unsigned int i;
   struct parser_data *data = (void *) buffer;
 
   if (result == NULL)
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index 1a8716ab9d..c95507a468 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -59,7 +59,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
 {
   char *p = buffer;
   size_t room_left = buflen;
-  int i;
+  unsigned int i;
   struct parser_data *data = (void *) buffer;
 
   if (result == NULL)
diff --git a/sysdeps/arm/Implies b/sysdeps/arm/Implies
new file mode 100644
index 0000000000..d6acf04a82
--- /dev/null
+++ b/sysdeps/arm/Implies
@@ -0,0 +1,2 @@
+wordsize-32
+ieee754
diff --git a/sysdeps/arm/__longjmp.S b/sysdeps/arm/__longjmp.S
new file mode 100644
index 0000000000..5443761f0a
--- /dev/null
+++ b/sysdeps/arm/__longjmp.S
@@ -0,0 +1,37 @@
+/* longjmp for ARM.
+   Copyright (C) 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+#define _ASM
+#include <jmp_buf.h>
+
+/* __longjmp(jmpbuf, val) */
+
+ENTRY (__longjmp)
+	movs	r2, r0
+	movs	r0, r1		/* get the return value in place */
+	moveq	r1, #1		/* can't let setjmp() return zero! */
+
+#if __ARM_USES_FP
+	add	r2, r2, #48
+	lfmfd	f4, 4, [r2]
+#endif
+	
+	LOADREGS(ia, r2, {v1-v6, sl, fp, sp, pc})
+END (__longjmp)
diff --git a/sysdeps/arm/bsd-_setjmp.S b/sysdeps/arm/bsd-_setjmp.S
new file mode 100644
index 0000000000..5643c50918
--- /dev/null
+++ b/sysdeps/arm/bsd-_setjmp.S
@@ -0,0 +1,29 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  ARM version.
+   Copyright (C) 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+ENTRY (_setjmp)
+	mov	r1, #0
+	b	__sigsetjmp
+END (_setjmp)
diff --git a/sysdeps/arm/bsd-setjmp.S b/sysdeps/arm/bsd-setjmp.S
new file mode 100644
index 0000000000..ac7dd96821
--- /dev/null
+++ b/sysdeps/arm/bsd-setjmp.S
@@ -0,0 +1,29 @@
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  ARM version.
+   Copyright (C) 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+ENTRY (setjmp)
+	mov	r1, #1
+	b	__sigsetjmp
+END (setjmp)
diff --git a/sysdeps/arm/bytesex.h b/sysdeps/arm/bytesex.h
new file mode 100644
index 0000000000..32f8489df2
--- /dev/null
+++ b/sysdeps/arm/bytesex.h
@@ -0,0 +1,3 @@
+/* ARM is little-endian.  */
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/sysdeps/arm/fpu_control.h b/sysdeps/arm/fpu_control.h
new file mode 100644
index 0000000000..6a4a4bb0f0
--- /dev/null
+++ b/sysdeps/arm/fpu_control.h
@@ -0,0 +1,48 @@
+/* FPU control word definitions.  Stub version.
+Copyright (C) 1996 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 Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#ifndef _FPU_CONTROL_H
+#define _FPU_CONTROL_H
+
+#define _FPU_RESERVED 0xffffffff  /* These bits are reserved.  */
+
+/* The fdlibm code requires no interrupts for exceptions.  Don't
+   change the rounding mode, it would break long double I/O!  */
+#define _FPU_DEFAULT  0x00000000 /* Default value.  */
+
+/* Type of the control word.  */
+typedef unsigned int fpu_control_t;
+
+/* Macros for accessing the hardware control word.
+ * On the ARM, we can't do this from user mode (it would trap). 
+ */
+#define _FPU_GETCW(cw) __asm__ ("movnv r0,r0" : "=g" (cw))
+#define _FPU_SETCW(cw) __asm__ ("movnv r0,r0" : : "g" (cw))
+
+/* Default control word set at startup.  */
+extern fpu_control_t __fpu_control;
+
+__BEGIN_DECLS
+
+/* Called at startup.  It can be used to manipulate fpu control register.  */
+extern void __setfpucw __P ((fpu_control_t));
+
+__END_DECLS
+
+#endif /* _FPU_CONTROL_H */
diff --git a/sysdeps/arm/jmp_buf.h b/sysdeps/arm/jmp_buf.h
new file mode 100644
index 0000000000..93b0f5f916
--- /dev/null
+++ b/sysdeps/arm/jmp_buf.h
@@ -0,0 +1,10 @@
+/* Define the machine-dependent type `jmp_buf'.  ARM version. */
+
+#ifndef _ASM
+/* Jump buffer contains v1-v6, sl, fp, sp, pc and (f4-f7) if we do FP. */
+#if __ARM_USES_FP
+typedef int __jmp_buf[22];
+#else
+typedef int __jmp_buf[10];
+#endif
+#endif
diff --git a/sysdeps/arm/setjmp.S b/sysdeps/arm/setjmp.S
new file mode 100644
index 0000000000..5891cb9dec
--- /dev/null
+++ b/sysdeps/arm/setjmp.S
@@ -0,0 +1,36 @@
+/* setjmp for ARM.
+   Copyright (C) 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+#define _ASM
+#include <jmp_buf.h>
+
+	/* Binary compatibility entry point.  */
+ENTRY (__setjmp)
+	mov	r1, #0
+ENTRY (__sigsetjmp)
+	/* Save registers */
+#if __ARM_USES_FP
+	sfmea	f4, 4, [r0]!
+#endif	
+	stmia	r0, {v1-v6, sl, fp, sp, lr}
+
+	/* Make a tail call to __sigjmp_save; it takes the same args.  */
+	B	__sigjmp_save
+END (__sigsetjmp)
diff --git a/sysdeps/arm/sysdep.h b/sysdeps/arm/sysdep.h
new file mode 100644
index 0000000000..b7964a35b1
--- /dev/null
+++ b/sysdeps/arm/sysdep.h
@@ -0,0 +1,92 @@
+/* Assembler macros for ARM.
+   Copyright (C) 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdeps/generic/sysdep.h>
+
+#ifdef	ASSEMBLER
+
+/* Syntactic details of assembler.  */
+
+#ifdef HAVE_ELF
+
+/* ELF uses byte-counts for .align, most others use log2 of count of bytes.  */
+#define ALIGNARG(log2) 1<<log2
+/* For ELF we need the `.type' directive to make shared libs work right.  */
+#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
+#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+
+/* In ELF C symbols are asm symbols.  */
+#undef	NO_UNDERSCORES
+#define NO_UNDERSCORES
+
+#else
+
+#define ALIGNARG(log2) log2
+#define ASM_TYPE_DIRECTIVE(name,type)	/* Nothing is specified.  */
+#define ASM_SIZE_DIRECTIVE(name)	/* Nothing is specified.  */
+
+#endif
+
+/* ARM 6 needs slightly different handling */
+#ifdef __arm6__
+#define LOADREGS(cond, base, reglist...)\
+	ldm##cond	base,reglist
+#define RETINSTR(instr, regs...)\
+	instr	regs
+#else  /* arm 3 */
+#define LOADREGS(cond, base, reglist...)\
+	ldm##cond	base,reglist^
+#define RETINSTR(instr, regs...)\
+	instr##s	regs
+#endif
+
+/* Don't do floating point */
+#define __ARM_USES_FP   1
+
+/* Define an entry point visible from C.  */
+#define	ENTRY(name)							      \
+  ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name);				      \
+  ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function)			      \
+  .align ALIGNARG(4);							      \
+  C_LABEL(name)								      \
+  CALL_MCOUNT
+
+#undef	END
+#define END(name)							      \
+  ASM_SIZE_DIRECTIVE(name)
+
+/* If compiled for profiling, call `mcount' at the start of each function.  */
+#ifdef	PROF
+/* The mcount code relies on a normal frame pointer being on the stack
+   to locate our caller, so push one just for its benefit.  */
+#define CALL_MCOUNT \
+#error Profiling not supported.
+#else
+#define CALL_MCOUNT		/* Do nothing.  */
+#endif
+
+#ifdef	NO_UNDERSCORES
+/* Since C identifiers are not normally prefixed with an underscore
+   on this system, the asm identifier `syscall_error' intrudes on the
+   C name space.  Make sure we use an innocuous name.  */
+#define	syscall_error	__syscall_error
+#define mcount		_mcount
+#endif
+
+#endif	/* ASSEMBLER */
diff --git a/sysdeps/generic/Dist b/sysdeps/generic/Dist
index 2431f7b272..e82624a61c 100644
--- a/sysdeps/generic/Dist
+++ b/sysdeps/generic/Dist
@@ -1,8 +1,2 @@
 make_siglist.c signame.c signame.h
 det_endian.c
-mathimpl.h
-trig.h
-sincos.c
-asincos.c
-exp__E.c
-log__L.c
diff --git a/sysdeps/generic/asincos.c b/sysdeps/generic/asincos.c
deleted file mode 100644
index c746b1652a..0000000000
--- a/sysdeps/generic/asincos.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)asincos.c	8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/* ASIN(X)
- * RETURNS ARC SINE OF X
- * DOUBLE PRECISION (IEEE DOUBLE 53 bits, VAX D FORMAT 56 bits)
- * CODED IN C BY K.C. NG, 4/16/85, REVISED ON 6/10/85.
- *
- * Required system supported functions:
- *	copysign(x,y)
- *	sqrt(x)
- *
- * Required kernel function:
- *	atan2(y,x) 
- *
- * Method :                  
- *	asin(x) = atan2(x,sqrt(1-x*x)); for better accuracy, 1-x*x is 
- *		  computed as follows
- *			1-x*x                     if x <  0.5, 
- *			2*(1-|x|)-(1-|x|)*(1-|x|) if x >= 0.5.
- *
- * Special cases:
- *	if x is NaN, return x itself;
- *	if |x|>1, return NaN.
- *
- * Accuracy:
- * 1)  If atan2() uses machine PI, then
- * 
- *	asin(x) returns (PI/pi) * (the exact arc sine of x) nearly rounded;
- *	and PI is the exact pi rounded to machine precision (see atan2 for
- *      details):
- *
- *	in decimal:
- *		pi = 3.141592653589793 23846264338327 ..... 
- *    53 bits   PI = 3.141592653589793 115997963 ..... ,
- *    56 bits   PI = 3.141592653589793 227020265 ..... ,  
- *
- *	in hexadecimal:
- *		pi = 3.243F6A8885A308D313198A2E....
- *    53 bits   PI = 3.243F6A8885A30  =  2 * 1.921FB54442D18	error=.276ulps
- *    56 bits   PI = 3.243F6A8885A308 =  4 * .C90FDAA22168C2    error=.206ulps
- *	
- *	In a test run with more than 200,000 random arguments on a VAX, the 
- *	maximum observed error in ulps (units in the last place) was
- *	2.06 ulps.      (comparing against (PI/pi)*(exact asin(x)));
- *
- * 2)  If atan2() uses true pi, then
- *
- *	asin(x) returns the exact asin(x) with error below about 2 ulps.
- *
- *	In a test run with more than 1,024,000 random arguments on a VAX, the 
- *	maximum observed error in ulps (units in the last place) was
- *      1.99 ulps.
- */
-
-double asin(x)
-double x;
-{
-	double s,t,copysign(),atan2(),sqrt(),one=1.0;
-#if !defined(vax)&&!defined(tahoe)
-	if(x!=x) return(x);	/* x is NaN */
-#endif	/* !defined(vax)&&!defined(tahoe) */
-	s=copysign(x,one);
-	if(s <= 0.5)
-	    return(atan2(x,sqrt(one-x*x)));
-	else 
-	    { t=one-s; s=t+t; return(atan2(x,sqrt(s-t*t))); }
-
-}
-
-/* ACOS(X)
- * RETURNS ARC COS OF X
- * DOUBLE PRECISION (IEEE DOUBLE 53 bits, VAX D FORMAT 56 bits)
- * CODED IN C BY K.C. NG, 4/16/85, REVISED ON 6/10/85.
- *
- * Required system supported functions:
- *	copysign(x,y)
- *	sqrt(x)
- *
- * Required kernel function:
- *	atan2(y,x) 
- *
- * Method :                  
- *			      ________
- *                           / 1 - x
- *	acos(x) = 2*atan2(  / -------- , 1 ) .
- *                        \/   1 + x
- *
- * Special cases:
- *	if x is NaN, return x itself;
- *	if |x|>1, return NaN.
- *
- * Accuracy:
- * 1)  If atan2() uses machine PI, then
- * 
- *	acos(x) returns (PI/pi) * (the exact arc cosine of x) nearly rounded;
- *	and PI is the exact pi rounded to machine precision (see atan2 for
- *      details):
- *
- *	in decimal:
- *		pi = 3.141592653589793 23846264338327 ..... 
- *    53 bits   PI = 3.141592653589793 115997963 ..... ,
- *    56 bits   PI = 3.141592653589793 227020265 ..... ,  
- *
- *	in hexadecimal:
- *		pi = 3.243F6A8885A308D313198A2E....
- *    53 bits   PI = 3.243F6A8885A30  =  2 * 1.921FB54442D18	error=.276ulps
- *    56 bits   PI = 3.243F6A8885A308 =  4 * .C90FDAA22168C2    error=.206ulps
- *	
- *	In a test run with more than 200,000 random arguments on a VAX, the 
- *	maximum observed error in ulps (units in the last place) was
- *	2.07 ulps.      (comparing against (PI/pi)*(exact acos(x)));
- *
- * 2)  If atan2() uses true pi, then
- *
- *	acos(x) returns the exact acos(x) with error below about 2 ulps.
- *
- *	In a test run with more than 1,024,000 random arguments on a VAX, the 
- *	maximum observed error in ulps (units in the last place) was
- *	2.15 ulps.
- */
-
-double acos(x)
-double x;
-{
-	double t,copysign(),atan2(),sqrt(),one=1.0;
-#if !defined(vax)&&!defined(tahoe)
-	if(x!=x) return(x);
-#endif	/* !defined(vax)&&!defined(tahoe) */
-	if( x != -1.0)
-	    t=atan2(sqrt((one-x)/(one+x)),one);
-	else
-	    t=atan2(one,0.0);	/* t = PI/2 */
-	return(t+t);
-}
diff --git a/sysdeps/generic/exp__E.c b/sysdeps/generic/exp__E.c
deleted file mode 100644
index ab972477a0..0000000000
--- a/sysdeps/generic/exp__E.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)exp__E.c	8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/* exp__E(x,c)
- * ASSUMPTION: c << x  SO THAT  fl(x+c)=x.
- * (c is the correction term for x)
- * exp__E RETURNS
- *
- *			 /  exp(x+c) - 1 - x ,  1E-19 < |x| < .3465736
- *       exp__E(x,c) = 	| 		     
- *			 \  0 ,  |x| < 1E-19.
- *
- * DOUBLE PRECISION (IEEE 53 bits, VAX D FORMAT 56 BITS)
- * KERNEL FUNCTION OF EXP, EXPM1, POW FUNCTIONS
- * CODED IN C BY K.C. NG, 1/31/85;
- * REVISED BY K.C. NG on 3/16/85, 4/16/85.
- *
- * Required system supported function:
- *	copysign(x,y)	
- *
- * Method:
- *	1. Rational approximation. Let r=x+c.
- *	   Based on
- *                                   2 * sinh(r/2)     
- *                exp(r) - 1 =   ----------------------   ,
- *                               cosh(r/2) - sinh(r/2)
- *	   exp__E(r) is computed using
- *                   x*x            (x/2)*W - ( Q - ( 2*P  + x*P ) )
- *                   --- + (c + x*[---------------------------------- + c ])
- *                    2                          1 - W
- * 	   where  P := p1*x^2 + p2*x^4,
- *	          Q := q1*x^2 + q2*x^4 (for 56 bits precision, add q3*x^6)
- *	          W := x/2-(Q-x*P),
- *
- *	   (See the listing below for the values of p1,p2,q1,q2,q3. The poly-
- *	    nomials P and Q may be regarded as the approximations to sinh
- *	    and cosh :
- *		sinh(r/2) =  r/2 + r * P  ,  cosh(r/2) =  1 + Q . )
- *
- *         The coefficients were obtained by a special Remez algorithm.
- *
- * Approximation error:
- *
- *   |	exp(x) - 1			   |        2**(-57),  (IEEE double)
- *   | ------------  -  (exp__E(x,0)+x)/x  |  <= 
- *   |	     x			           |	    2**(-69).  (VAX D)
- *
- * 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 "mathimpl.h"
-
-vc(p1, 1.5150724356786683059E-2 ,3abe,3d78,066a,67e1,  -6, .F83ABE67E1066A)
-vc(p2, 6.3112487873718332688E-5 ,5b42,3984,0173,48cd, -13, .845B4248CD0173)
-vc(q1, 1.1363478204690669916E-1 ,b95a,3ee8,ec45,44a2,  -3, .E8B95A44A2EC45)
-vc(q2, 1.2624568129896839182E-3 ,7905,3ba5,f5e7,72e4,  -9, .A5790572E4F5E7)
-vc(q3, 1.5021856115869022674E-6 ,9eb4,36c9,c395,604a, -19, .C99EB4604AC395)
-
-ic(p1, 1.3887401997267371720E-2,  -7, 1.C70FF8B3CC2CF)
-ic(p2, 3.3044019718331897649E-5, -15, 1.15317DF4526C4)
-ic(q1, 1.1110813732786649355E-1,  -4, 1.C719538248597)
-ic(q2, 9.9176615021572857300E-4, -10, 1.03FC4CB8C98E8)
-
-#ifdef vccast
-#define       p1    vccast(p1)
-#define       p2    vccast(p2)
-#define       q1    vccast(q1)
-#define       q2    vccast(q2)
-#define       q3    vccast(q3)
-#endif
-
-double __exp__E(x,c)
-double x,c;
-{
-	const static double zero=0.0, one=1.0, half=1.0/2.0, small=1.0E-19;
-	double z,p,q,xp,xh,w;
-	if(copysign(x,one)>small) {
-           z = x*x  ;
-	   p = z*( p1 +z* p2 );
-#if defined(vax)||defined(tahoe)
-           q = z*( q1 +z*( q2 +z* q3 ));
-#else	/* defined(vax)||defined(tahoe) */
-           q = z*( q1 +z*  q2 );
-#endif	/* defined(vax)||defined(tahoe) */
-           xp= x*p     ; 
-	   xh= x*half  ;
-           w = xh-(q-xp)  ;
-	   p = p+p;
-	   c += x*((xh*w-(q-(p+xp)))/(one-w)+c);
-	   return(z*half+c);
-	}
-	/* end of |x| > small */
-
-	else {
-	    if(x!=zero) one+small;	/* raise the inexact flag */
-	    return(copysign(zero,x));
-	}
-}
diff --git a/sysdeps/generic/log__L.c b/sysdeps/generic/log__L.c
deleted file mode 100644
index c00158fa51..0000000000
--- a/sysdeps/generic/log__L.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)log__L.c	8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/* log__L(Z)
- *		LOG(1+X) - 2S			       X
- * RETURN      ---------------  WHERE Z = S*S,  S = ------- , 0 <= Z <= .0294...
- *		      S				     2 + X
- *		     
- * DOUBLE PRECISION (VAX D FORMAT 56 bits or IEEE DOUBLE 53 BITS)
- * KERNEL FUNCTION FOR LOG; TO BE USED IN LOG1P, LOG, AND POW FUNCTIONS
- * CODED IN C BY K.C. NG, 1/19/85; 
- * REVISED BY K.C. Ng, 2/3/85, 4/16/85.
- *
- * Method :
- *	1. Polynomial approximation: let s = x/(2+x). 
- *	   Based on log(1+x) = log(1+s) - log(1-s)
- *		 = 2s + 2/3 s**3 + 2/5 s**5 + .....,
- *
- *	   (log(1+x) - 2s)/s is computed by
- *
- *	       z*(L1 + z*(L2 + z*(... (L7 + z*L8)...)))
- *
- *	   where z=s*s. (See the listing below for Lk's values.) The 
- *	   coefficients are obtained by a special Remez algorithm. 
- *
- * Accuracy:
- *	Assuming no rounding error, the maximum magnitude of the approximation 
- *	error (absolute) is 2**(-58.49) for IEEE double, and 2**(-63.63)
- *	for VAX D format.
- *
- * 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 "mathimpl.h"
-
-vc(L1, 6.6666666666666703212E-1 ,aaaa,402a,aac5,aaaa,  0, .AAAAAAAAAAAAC5)
-vc(L2, 3.9999999999970461961E-1 ,cccc,3fcc,2684,cccc, -1, .CCCCCCCCCC2684)
-vc(L3, 2.8571428579395698188E-1 ,4924,3f92,5782,92f8, -1, .92492492F85782)
-vc(L4, 2.2222221233634724402E-1 ,8e38,3f63,af2c,39b7, -2, .E38E3839B7AF2C)
-vc(L5, 1.8181879517064680057E-1 ,2eb4,3f3a,655e,cc39, -2, .BA2EB4CC39655E)
-vc(L6, 1.5382888777946145467E-1 ,8551,3f1d,781d,e8c5, -2, .9D8551E8C5781D)
-vc(L7, 1.3338356561139403517E-1 ,95b3,3f08,cd92,907f, -2, .8895B3907FCD92)
-vc(L8, 1.2500000000000000000E-1 ,0000,3f00,0000,0000, -2, .80000000000000)
-
-ic(L1, 6.6666666666667340202E-1, -1, 1.5555555555592)
-ic(L2, 3.9999999999416702146E-1, -2, 1.999999997FF24)
-ic(L3, 2.8571428742008753154E-1, -2, 1.24924941E07B4)
-ic(L4, 2.2222198607186277597E-1, -3, 1.C71C52150BEA6)
-ic(L5, 1.8183562745289935658E-1, -3, 1.74663CC94342F)
-ic(L6, 1.5314087275331442206E-1, -3, 1.39A1EC014045B)
-ic(L7, 1.4795612545334174692E-1, -3, 1.2F039F0085122)
-
-#ifdef vccast
-#define	L1	vccast(L1)
-#define	L2	vccast(L2)
-#define	L3	vccast(L3)
-#define	L4	vccast(L4)
-#define	L5	vccast(L5)
-#define	L6	vccast(L6)
-#define	L7	vccast(L7)
-#define	L8	vccast(L8)
-#endif
-
-double __log__L(z)
-double z;
-{
-#if defined(vax)||defined(tahoe)
-    return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*(L7+z*L8))))))));
-#else	/* defined(vax)||defined(tahoe) */
-    return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*L7)))))));
-#endif	/* defined(vax)||defined(tahoe) */
-}
diff --git a/sysdeps/generic/mathimpl.h b/sysdeps/generic/mathimpl.h
deleted file mode 100644
index a2c963d288..0000000000
--- a/sysdeps/generic/mathimpl.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* This part here added by roland@prep.ai.mit.edu for the GNU C library.  */
-   
-#include <math.h>		/* Done first so we can #undef.  */
-#include <endian.h>
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
-#undef national
-#define national
-#endif
-
-#undef	isinf
-#define	isinf	__isinf
-#undef	isnan
-#define	isnan	__isnan
-#undef	infnan
-#define	infnan	__infnan
-#undef	copysign
-#define	copysign	__copysign
-#undef	scalb
-#define	scalb	__scalb
-#undef	drem
-#define	drem	__drem
-#undef	logb
-#define	logb	__logb
-#undef	__finite
-#undef	finite
-#define	finite	__finite
-#undef	expm1
-#define	expm1	__expm1
-
-/*
- * Copyright (c) 1988, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)mathimpl.h	8.1 (Berkeley) 6/4/93
- */
-
-#include <sys/cdefs.h>
-#include <math.h>
-
-#if defined(vax)||defined(tahoe)
-
-/* Deal with different ways to concatenate in cpp */
-#  ifdef __STDC__
-#    define	cat3(a,b,c) a ## b ## c
-#  else
-#    define	cat3(a,b,c) a/**/b/**/c
-#  endif
-
-/* Deal with vax/tahoe byte order issues */
-#  ifdef vax
-#    define	cat3t(a,b,c) cat3(a,b,c)
-#  else
-#    define	cat3t(a,b,c) cat3(a,c,b)
-#  endif
-
-#  define vccast(name) (*(const double *)(cat3(name,,x)))
-
-   /*
-    * Define a constant to high precision on a Vax or Tahoe.
-    *
-    * Args are the name to define, the decimal floating point value,
-    * four 16-bit chunks of the float value in hex
-    * (because the vax and tahoe differ in float format!), the power
-    * of 2 of the hex-float exponent, and the hex-float mantissa.
-    * Most of these arguments are not used at compile time; they are
-    * used in a post-check to make sure the constants were compiled
-    * correctly.
-    *
-    * People who want to use the constant will have to do their own
-    *     #define foo vccast(foo)
-    * since CPP cannot do this for them from inside another macro (sigh).
-    * We define "vccast" if this needs doing.
-    */
-#  define vc(name, value, x1,x2,x3,x4, bexp, xval) \
-	const static long cat3(name,,x)[] = {cat3t(0x,x1,x2), cat3t(0x,x3,x4)};
-
-#  define ic(name, value, bexp, xval) ;
-
-#else	/* vax or tahoe */
-
-   /* Hooray, we have an IEEE machine */
-#  undef vccast
-#  define vc(name, value, x1,x2,x3,x4, bexp, xval) ;
-
-#  define ic(name, value, bexp, xval) \
-	const static double name = value;
-
-#endif	/* defined(vax)||defined(tahoe) */
-
-
-/*
- * Functions internal to the math package, yet not static.
- */
-extern double	__exp__E();
-extern double	__log__L();
-
-struct Double {double a, b;};
-double __exp__D __P((double, double));
-struct Double __log__D __P((double));
diff --git a/sysdeps/generic/sincos.c b/sysdeps/generic/sincos.c
deleted file mode 100644
index ab885607cf..0000000000
--- a/sysdeps/generic/sincos.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)sincos.c	8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#include "trig.h"
-double
-sin(x)
-double x;
-{
-	double a,c,z;
-
-        if(!finite(x))		/* sin(NaN) and sin(INF) must be NaN */
-		return x-x;
-	x=drem(x,PI2);		/* reduce x into [-PI,PI] */
-	a=copysign(x,one);
-	if (a >= PIo4) {
-		if(a >= PI3o4)		/* ... in [3PI/4,PI] */
-			x = copysign((a = PI-a),x);
-		else {			/* ... in [PI/4,3PI/4]  */
-			a = PIo2-a;		/* rtn. sign(x)*C(PI/2-|x|) */
-			z = a*a;
-			c = cos__C(z);
-			z *= half;
-			a = (z >= thresh ? half-((z-half)-c) : one-(z-c));
-			return copysign(a,x);
-		}
-	}
-
-	if (a < small) {		/* rtn. S(x) */
-		big+a;
-		return x;
-	}
-	return x+x*sin__S(x*x);
-}
-
-double
-cos(x) 
-double x;
-{
-	double a,c,z,s = 1.0;
-
-	if(!finite(x))		/* cos(NaN) and cos(INF) must be NaN */
-		return x-x;
-	x=drem(x,PI2);		/* reduce x into [-PI,PI] */
-	a=copysign(x,one);
-	if (a >= PIo4) {
-		if (a >= PI3o4) {	/* ... in [3PI/4,PI] */
-			a = PI-a;
-			s = negone;
-		}
-		else {			/* ... in [PI/4,3PI/4] */
-			a = PIo2-a;
-			return a+a*sin__S(a*a);	/* rtn. S(PI/2-|x|) */ 
-		}
-	}
-	if (a < small) {
-		big+a;
-		return s;		/* rtn. s*C(a) */
-	}
-	z = a*a;
-	c = cos__C(z);
-	z *= half;
-	a = (z >= thresh ? half-((z-half)-c) : one-(z-c));
-	return copysign(a,s);
-}
diff --git a/sysdeps/generic/trig.h b/sysdeps/generic/trig.h
deleted file mode 100644
index 9e05b0ea0d..0000000000
--- a/sysdeps/generic/trig.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)trig.h	8.1 (Berkeley) 6/4/93
- */
-
-#include "mathimpl.h"
-
-vc(thresh, 2.6117239648121182150E-1 ,b863,3f85,6ea0,6b02, -1, .85B8636B026EA0)
-vc(PIo4,   7.8539816339744830676E-1 ,0fda,4049,68c2,a221,  0, .C90FDAA22168C2)
-vc(PIo2,   1.5707963267948966135E0  ,0fda,40c9,68c2,a221,  1, .C90FDAA22168C2)
-vc(PI3o4,  2.3561944901923449203E0  ,cbe3,4116,0e92,f999,  2, .96CBE3F9990E92)
-vc(PI,     3.1415926535897932270E0  ,0fda,4149,68c2,a221,  2, .C90FDAA22168C2)
-vc(PI2,    6.2831853071795864540E0  ,0fda,41c9,68c2,a221,  3, .C90FDAA22168C2)
-
-ic(thresh, 2.6117239648121182150E-1 , -2, 1.0B70C6D604DD4)
-ic(PIo4,   7.8539816339744827900E-1 , -1, 1.921FB54442D18)
-ic(PIo2,   1.5707963267948965580E0  ,  0, 1.921FB54442D18)
-ic(PI3o4,  2.3561944901923448370E0  ,  1, 1.2D97C7F3321D2)
-ic(PI,     3.1415926535897931160E0  ,  1, 1.921FB54442D18)
-ic(PI2,    6.2831853071795862320E0  ,  2, 1.921FB54442D18)
-
-#ifdef vccast
-#define	thresh	vccast(thresh)
-#define	PIo4	vccast(PIo4)
-#define	PIo2	vccast(PIo2)
-#define	PI3o4	vccast(PI3o4)
-#define	PI	vccast(PI)
-#define	PI2	vccast(PI2)
-#endif
-
-#ifdef national
-static long fmaxx[]	= { 0xffffffff, 0x7fefffff};
-#define   fmax    (*(double*)fmaxx)
-#endif	/* national */
-
-static const double
-	zero = 0,
-	one = 1,
-	negone = -1,
-	half = 1.0/2.0, 
-	small = 1E-10,	/* 1+small**2 == 1; better values for small:
-			 *		small	= 1.5E-9 for VAX D
-			 *			= 1.2E-8 for IEEE Double
-			 *			= 2.8E-10 for IEEE Extended
-			 */
-	big = 1E20;	/* big := 1/(small**2) */
-
-/* sin__S(x*x) ... re-implemented as a macro
- * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS)
- * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) 
- * CODED IN C BY K.C. NG, 1/21/85; 
- * REVISED BY K.C. NG on 8/13/85.
- *
- *	    sin(x*k) - x
- * RETURN  --------------- on [-PI/4,PI/4] , where k=pi/PI, PI is the rounded
- *	            x	
- * value of pi in machine precision:
- *
- *	Decimal:
- *		pi = 3.141592653589793 23846264338327 ..... 
- *    53 bits   PI = 3.141592653589793 115997963 ..... ,
- *    56 bits   PI = 3.141592653589793 227020265 ..... ,  
- *
- *	Hexadecimal:
- *		pi = 3.243F6A8885A308D313198A2E....
- *    53 bits   PI = 3.243F6A8885A30  =  2 * 1.921FB54442D18
- *    56 bits   PI = 3.243F6A8885A308 =  4 * .C90FDAA22168C2    
- *
- * Method:
- *	1. Let z=x*x. Create a polynomial approximation to 
- *	    (sin(k*x)-x)/x  =  z*(S0 + S1*z^1 + ... + S5*z^5).
- *	Then
- *      sin__S(x*x) = z*(S0 + S1*z^1 + ... + S5*z^5)
- *
- *	The coefficient S's are obtained by a special Remez algorithm.
- *
- * Accuracy:
- *	In the absence of rounding error, the approximation has absolute error 
- *	less than 2**(-61.11) for VAX D FORMAT, 2**(-57.45) for IEEE DOUBLE. 
- *
- * 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.
- *
- */
-
-vc(S0, -1.6666666666666646660E-1  ,aaaa,bf2a,aa71,aaaa,  -2, -.AAAAAAAAAAAA71)
-vc(S1,  8.3333333333297230413E-3  ,8888,3d08,477f,8888,  -6,  .8888888888477F)
-vc(S2, -1.9841269838362403710E-4  ,0d00,ba50,1057,cf8a, -12, -.D00D00CF8A1057)
-vc(S3,  2.7557318019967078930E-6  ,ef1c,3738,bedc,a326, -18,  .B8EF1CA326BEDC)
-vc(S4, -2.5051841873876551398E-8  ,3195,b3d7,e1d3,374c, -25, -.D73195374CE1D3)
-vc(S5,  1.6028995389845827653E-10 ,3d9c,3030,cccc,6d26, -32,  .B03D9C6D26CCCC)
-vc(S6, -6.2723499671769283121E-13 ,8d0b,ac30,ea82,7561, -40, -.B08D0B7561EA82)
-
-ic(S0, -1.6666666666666463126E-1  ,  -3, -1.555555555550C)
-ic(S1,  8.3333333332992771264E-3  ,  -7,  1.111111110C461)
-ic(S2, -1.9841269816180999116E-4  , -13, -1.A01A019746345)
-ic(S3,  2.7557309793219876880E-6  , -19,  1.71DE3209CDCD9)
-ic(S4, -2.5050225177523807003E-8  , -26, -1.AE5C0E319A4EF)
-ic(S5,  1.5868926979889205164E-10 , -33,  1.5CF61DF672B13)
-
-#ifdef vccast
-#define	S0	vccast(S0)
-#define	S1	vccast(S1)
-#define	S2	vccast(S2)
-#define	S3	vccast(S3)
-#define	S4	vccast(S4)
-#define	S5	vccast(S5)
-#define	S6	vccast(S6)
-#endif
-
-#if defined(vax)||defined(tahoe)
-#  define	sin__S(z)	(z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*(S5+z*S6)))))))
-#else 	/* defined(vax)||defined(tahoe) */
-#  define	sin__S(z)	(z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*S5))))))
-#endif 	/* defined(vax)||defined(tahoe) */
-
-/* cos__C(x*x) ... re-implemented as a macro
- * DOUBLE PRECISION (VAX D FORMAT 56 BITS, IEEE DOUBLE 53 BITS)
- * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) 
- * CODED IN C BY K.C. NG, 1/21/85; 
- * REVISED BY K.C. NG on 8/13/85.
- *
- *	   		    x*x	
- * RETURN   cos(k*x) - 1 + ----- on [-PI/4,PI/4],  where k = pi/PI,
- *	  		     2	
- * PI is the rounded value of pi in machine precision :
- *
- *	Decimal:
- *		pi = 3.141592653589793 23846264338327 ..... 
- *    53 bits   PI = 3.141592653589793 115997963 ..... ,
- *    56 bits   PI = 3.141592653589793 227020265 ..... ,  
- *
- *	Hexadecimal:
- *		pi = 3.243F6A8885A308D313198A2E....
- *    53 bits   PI = 3.243F6A8885A30  =  2 * 1.921FB54442D18
- *    56 bits   PI = 3.243F6A8885A308 =  4 * .C90FDAA22168C2    
- *
- *
- * Method:
- *	1. Let z=x*x. Create a polynomial approximation to 
- *	    cos(k*x)-1+z/2  =  z*z*(C0 + C1*z^1 + ... + C5*z^5)
- *	then
- *      cos__C(z) =  z*z*(C0 + C1*z^1 + ... + C5*z^5)
- *
- *	The coefficient C's are obtained by a special Remez algorithm.
- *
- * Accuracy:
- *	In the absence of rounding error, the approximation has absolute error 
- *	less than 2**(-64) for VAX D FORMAT, 2**(-58.3) for IEEE DOUBLE. 
- *	
- *
- * 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.
- */
-
-vc(C0,  4.1666666666666504759E-2  ,aaaa,3e2a,a9f0,aaaa,  -4,  .AAAAAAAAAAA9F0)
-vc(C1, -1.3888888888865302059E-3  ,0b60,bbb6,0cca,b60a,  -9, -.B60B60B60A0CCA)
-vc(C2,  2.4801587285601038265E-5  ,0d00,38d0,098f,cdcd, -15,  .D00D00CDCD098F)
-vc(C3, -2.7557313470902390219E-7  ,f27b,b593,e805,b593, -21, -.93F27BB593E805)
-vc(C4,  2.0875623401082232009E-9  ,74c8,320f,3ff0,fa1e, -28,  .8F74C8FA1E3FF0)
-vc(C5, -1.1355178117642986178E-11 ,c32d,ae47,5a63,0a5c, -36, -.C7C32D0A5C5A63)
-
-ic(C0,  4.1666666666666504759E-2  ,  -5,  1.555555555553E)
-ic(C1, -1.3888888888865301516E-3  , -10, -1.6C16C16C14199)
-ic(C2,  2.4801587269650015769E-5  , -16,  1.A01A01971CAEB)
-ic(C3, -2.7557304623183959811E-7  , -22, -1.27E4F1314AD1A)
-ic(C4,  2.0873958177697780076E-9  , -29,  1.1EE3B60DDDC8C)
-ic(C5, -1.1250289076471311557E-11 , -37, -1.8BD5986B2A52E)
-
-#ifdef vccast
-#define	C0	vccast(C0)
-#define	C1	vccast(C1)
-#define	C2	vccast(C2)
-#define	C3	vccast(C3)
-#define	C4	vccast(C4)
-#define	C5	vccast(C5)
-#endif
-
-#define cos__C(z)	(z*z*(C0+z*(C1+z*(C2+z*(C3+z*(C4+z*C5))))))
diff --git a/sysdeps/i386/fpu/__math.h b/sysdeps/i386/fpu/__math.h
index 86793babe5..080d0ec220 100644
--- a/sysdeps/i386/fpu/__math.h
+++ b/sysdeps/i386/fpu/__math.h
@@ -96,6 +96,7 @@ fabs (double __x)
   return __value;
 }
 
+/* The argument range of this inline version is limited.  */
 __MATH_INLINE double sin (double __x);
 __MATH_INLINE double
 sin (double __x)
@@ -108,6 +109,7 @@ sin (double __x)
   return __value;
 }
 
+/* The argument range of this inline version is limited.  */
 __MATH_INLINE double cos (double __x);
 __MATH_INLINE double
 cos (double __x)
@@ -371,7 +373,7 @@ ceil (double __x)
 
 
 /* Optimized versions for some non-standardized functions.  */
-#ifdef __USE_MISC
+#if defined __USE_ISOC9X || defined __USE_MISC
 
 __MATH_INLINE double hypot (double __x, double __y);
 __MATH_INLINE double
@@ -424,22 +426,6 @@ atanh (double __x)
   return -0.5 * __log1p (-(__y + __y) / (1.0 + __y)) * __sgn1 (__x);
 }
 
-__MATH_INLINE double coshm1 (double __x);
-__MATH_INLINE double
-coshm1 (double __x)
-{
-  register double __exm1 = __expm1 (fabs (__x));
-
-  return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1;
-}
-
-__MATH_INLINE double acosh1p (double __x);
-__MATH_INLINE double
-acosh1p (double __x)
-{
-  return __log1p (__x + sqrt (__x) * sqrt (__x + 2.0));
-}
-
 __MATH_INLINE double logb (double __x);
 __MATH_INLINE double
 logb (double __x)
@@ -467,13 +453,58 @@ drem (double __x, double __y)
   return __value;
 }
 
+/* This function is used in the `isfinite' macro.  */
+__MATH_INLINE int __finite (double __x);
+__MATH_INLINE int
+__finite (double __x)
+{
+  register int __result;
+  __asm__ __volatile__
+    ("orl	$x0x800fffff, %0\n\t"
+     "incl	%0\n\t"
+     "shrl	$31, %0"
+     : "=q" (__result) : "0" (((int *) &__x)[1]));
+  return __result;
+}
+#endif
+
+#ifdef __USE_MISC
+__MATH_INLINE double coshm1 (double __x);
+__MATH_INLINE double
+coshm1 (double __x)
+{
+  register double __exm1 = __expm1 (fabs (__x));
+
+  return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1;
+}
+
+__MATH_INLINE double acosh1p (double __x);
+__MATH_INLINE double
+acosh1p (double __x)
+{
+  return __log1p (__x + sqrt (__x) * sqrt (__x + 2.0));
+}
+
 __MATH_INLINE void sincos (double __x, double *__sinx, double *__cosx);
 __MATH_INLINE void
 sincos (double __x, double *__sinx, double *__cosx)
 {
   register double __cosr, __sinr;
   __asm __volatile__
-    ("fsincos"
+    ("fsincos\n\t"
+     "fnstsw	%%ax\n\t"
+     "testl	$0x400, %%eax\n\t"
+     "jz	1f\n\t"
+     "fldpi\n\t"
+     "fadd	%%st(0)\n\t"
+     "fxch	%%st(1)\n\t"
+     "2: fprem1\n\t"
+     "fnstsw	%%ax\n\t"
+     "testl	$0x400, %%eax\n\t"
+     "jnz	2b\n\t"
+     "fstp	%%st(1)\n\t"
+     "fsincos\n\t"
+     "1:"
      : "=t" (__cosr), "=u" (__sinr) : "0" (__x));
 
   *__sinx = __sinr;
@@ -484,7 +515,7 @@ __MATH_INLINE double sgn (double __x);
 __MATH_INLINE double
 sgn (double __x)
 {
-  return (__x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0));
+  return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0);
 }
 
 __MATH_INLINE double pow2 (double __x);
diff --git a/sysdeps/libm-i387/s_cos.S b/sysdeps/libm-i387/s_cos.S
index f75e98060b..ac8b1459d9 100644
--- a/sysdeps/libm-i387/s_cos.S
+++ b/sysdeps/libm-i387/s_cos.S
@@ -14,6 +14,7 @@ ENTRY(__cos)
 	testl	$0x400,%eax
 	jnz	1f
 	ret
+	.align ALIGNARG(4)
 1:	fldpi
 	fadd	%st(0)
 	fxch	%st(1)
diff --git a/sysdeps/libm-i387/s_cosl.S b/sysdeps/libm-i387/s_cosl.S
index f41fc19958..61c9010c99 100644
--- a/sysdeps/libm-i387/s_cosl.S
+++ b/sysdeps/libm-i387/s_cosl.S
@@ -16,6 +16,7 @@ ENTRY(__cosl)
 	testl	$0x400,%eax
 	jnz	1f
 	ret
+	.align ALIGNARG(4)
 1:	fldpi
 	fadd	%st(0)
 	fxch	%st(1)
diff --git a/sysdeps/libm-i387/s_finite.S b/sysdeps/libm-i387/s_finite.S
index 384fc1c79e..198eb809a9 100644
--- a/sysdeps/libm-i387/s_finite.S
+++ b/sysdeps/libm-i387/s_finite.S
@@ -5,9 +5,10 @@
 #include <machine/asm.h>
 
 ENTRY(__finite)
-	movl	8(%esp),%eax
-	orl	$0x800fffff, %eax
-	incl	%eax
+	movl	8(%esp)
+	movl    $0xFFEFFFFF,%ecx
+	subl    %eax,%ecx
+	xorl    %ecx,%eax,%eax
 	shrl	$31, %eax
 	ret
 END (__finite)
diff --git a/sysdeps/libm-i387/s_finitef.S b/sysdeps/libm-i387/s_finitef.S
index 51b4d0d536..dabb71a115 100644
--- a/sysdeps/libm-i387/s_finitef.S
+++ b/sysdeps/libm-i387/s_finitef.S
@@ -6,9 +6,10 @@
 
 ENTRY(__finitef)
 	movl	4(%esp),%eax
-	orl	$0x807fffff, %eax
-	incl	%eax
-	shrl	$31, %eax
+	movl    $0xFF7FFFFF,%ecx
+	subl    %eax,%ecx
+	xorl    %ecx,%eax
+	shrl    $31,%eax
 	ret
 END (__finitef)
 weak_alias (__finitef, finitef)
diff --git a/sysdeps/libm-i387/s_sin.S b/sysdeps/libm-i387/s_sin.S
index f048e5278b..eb22d7e98b 100644
--- a/sysdeps/libm-i387/s_sin.S
+++ b/sysdeps/libm-i387/s_sin.S
@@ -14,6 +14,7 @@ ENTRY(__sin)
 	testl	$0x400,%eax
 	jnz	1f
 	ret
+	.align ALIGNARG(4)
 1:	fldpi
 	fadd	%st(0)
 	fxch	%st(1)
diff --git a/sysdeps/libm-i387/s_sincos.S b/sysdeps/libm-i387/s_sincos.S
new file mode 100644
index 0000000000..fe99f42d18
--- /dev/null
+++ b/sysdeps/libm-i387/s_sincos.S
@@ -0,0 +1,48 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <machine/asm.h>
+
+ENTRY(__sincos)
+	fldl	4(%esp)
+	fsincos
+	movl	12(%esp), %ecx
+	movl	16(%esp), %edx
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstpl	(%edx)
+	fstpl	(%ecx)
+	ret
+	.align ALIGNARG(4)
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fsincos
+	fstpl	(%edx)
+	fstpl	(%ecx)
+	ret
+END(__sincos)
+weak_alias(__sincos, sincos)
diff --git a/sysdeps/libm-i387/s_sincosf.S b/sysdeps/libm-i387/s_sincosf.S
new file mode 100644
index 0000000000..5bb13f3c33
--- /dev/null
+++ b/sysdeps/libm-i387/s_sincosf.S
@@ -0,0 +1,48 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <machine/asm.h>
+
+ENTRY(__sincosf)
+	flds	4(%esp)
+	fsincos
+	movl	8(%esp), %ecx
+	movl	12(%esp), %edx
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstps	(%edx)
+	fstps	(%ecx)
+	ret
+	.align ALIGNARG(4)
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fsincos
+	fstps	(%edx)
+	fstps	(%ecx)
+	ret
+END(__sincosf)
+weak_alias(__sincosf, sincosf)
diff --git a/sysdeps/libm-i387/s_sincosl.S b/sysdeps/libm-i387/s_sincosl.S
new file mode 100644
index 0000000000..8b6694f09f
--- /dev/null
+++ b/sysdeps/libm-i387/s_sincosl.S
@@ -0,0 +1,48 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <machine/asm.h>
+
+ENTRY(__sincosl)
+	fldt	4(%esp)
+	fsincos
+	movl	16(%esp), %ecx
+	movl	20(%esp), %edx
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstpt	(%edx)
+	fstpt	(%ecx)
+	ret
+	.align ALIGNARG(4)
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fsincos
+	fstpt	(%edx)
+	fstpt	(%ecx)
+	ret
+END(__sincosl)
+weak_alias(__sincosl, sincosl)
diff --git a/sysdeps/libm-i387/s_sinl.S b/sysdeps/libm-i387/s_sinl.S
index 7c8c95f8a6..3e215de5e1 100644
--- a/sysdeps/libm-i387/s_sinl.S
+++ b/sysdeps/libm-i387/s_sinl.S
@@ -16,6 +16,7 @@ ENTRY(__sinl)
 	testl	$0x400,%eax
 	jnz	1f
 	ret
+	.align ALIGNARG(4)
 1:	fldpi
 	fadd	%st(0)
 	fxch	%st(1)
diff --git a/sysdeps/libm-ieee754/s_ccosh.c b/sysdeps/libm-ieee754/s_ccosh.c
index b9d7b82f5e..fa958f491b 100644
--- a/sysdeps/libm-ieee754/s_ccosh.c
+++ b/sysdeps/libm-ieee754/s_ccosh.c
@@ -40,9 +40,12 @@ __ccosh (__complex__ double x)
 	{
 	  /* Imaginary part is finite.  */
 	  double cosh_val = __ieee754_cosh (__real__ x);
+	  double sinix, cosix;
 
-	  __real__ retval = cosh_val * __cos (__imag__ x);
-	  __imag__ retval = cosh_val * __sin (__imag__ x);
+	  __sincos (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = cosh_val * cosix;
+	  __imag__ retval = cosh_val * sinix;
 	}
       else
 	{
@@ -62,8 +65,12 @@ __ccosh (__complex__ double x)
       else if (icls > FP_ZERO)
 	{
 	  /* Imaginary part is finite.  */
-	  __real__ retval = __copysign (HUGE_VAL, __cos (__imag__ x));
-	  __imag__ retval = __copysign (HUGE_VAL, __sin (__imag__ x));
+	  double sinix, cosix;
+
+	  __sincos (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysign (HUGE_VAL, cosix);
+	  __imag__ retval = __copysign (HUGE_VAL, sinix);
 	}
       else
 	{
diff --git a/sysdeps/libm-ieee754/s_ccoshf.c b/sysdeps/libm-ieee754/s_ccoshf.c
index 758ec5b579..aeeacbaed0 100644
--- a/sysdeps/libm-ieee754/s_ccoshf.c
+++ b/sysdeps/libm-ieee754/s_ccoshf.c
@@ -40,9 +40,12 @@ __ccoshf (__complex__ float x)
 	{
 	  /* Imaginary part is finite.  */
 	  float cosh_val = __ieee754_coshf (__real__ x);
+	  float sinix, cosix;
 
-	  __real__ retval = cosh_val * __cosf (__imag__ x);
-	  __imag__ retval = cosh_val * __sinf (__imag__ x);
+	  __sincosf (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = cosh_val * cosix;
+	  __imag__ retval = cosh_val * sinix;
 	}
       else
 	{
@@ -62,8 +65,12 @@ __ccoshf (__complex__ float x)
       else if (icls > FP_ZERO)
 	{
 	  /* Imaginary part is finite.  */
-	  __real__ retval = __copysignf (HUGE_VALF, __cosf (__imag__ x));
-	  __imag__ retval = __copysignf (HUGE_VALF, __sinf (__imag__ x));
+	  float sinix, cosix;
+
+	  __sincosf (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignf (HUGE_VALF, cosix);
+	  __imag__ retval = __copysignf (HUGE_VALF, sinix);
 	}
       else
 	{
diff --git a/sysdeps/libm-ieee754/s_ccoshl.c b/sysdeps/libm-ieee754/s_ccoshl.c
index 5e8c399fb2..9937ba1904 100644
--- a/sysdeps/libm-ieee754/s_ccoshl.c
+++ b/sysdeps/libm-ieee754/s_ccoshl.c
@@ -40,9 +40,12 @@ __ccoshl (__complex__ long double x)
 	{
 	  /* Imaginary part is finite.  */
 	  long double cosh_val = __ieee754_coshl (__real__ x);
+	  long double sinix, cosix;
 
-	  __real__ retval = cosh_val * __cosl (__imag__ x);
-	  __imag__ retval = cosh_val * __sinl (__imag__ x);
+	  __sincosl (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = cosh_val * cosix;
+	  __imag__ retval = cosh_val * sinix;
 	}
       else
 	{
@@ -62,8 +65,12 @@ __ccoshl (__complex__ long double x)
       else if (icls > FP_ZERO)
 	{
 	  /* Imaginary part is finite.  */
-	  __real__ retval = __copysignl (HUGE_VALL, __cosl (__imag__ x));
-	  __imag__ retval = __copysignl (HUGE_VALL, __sinl (__imag__ x));
+	  long double sinix, cosix;
+
+	  __sincosl (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignl (HUGE_VALL, cosix);
+	  __imag__ retval = __copysignl (HUGE_VALL, sinix);
 	}
       else
 	{
diff --git a/sysdeps/libm-ieee754/s_cexp.c b/sysdeps/libm-ieee754/s_cexp.c
index b99b042d78..5e68f585f7 100644
--- a/sysdeps/libm-ieee754/s_cexp.c
+++ b/sysdeps/libm-ieee754/s_cexp.c
@@ -1,4 +1,4 @@
-/* Return value of complex exponential function for float complex value.
+/* Return value of complex exponential function for double complex value.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -21,17 +21,23 @@
 #include <complex.h>
 #include <math.h>
 
+#include "math_private.h"
+
 
 __complex__ double
 __cexp (__complex__ double x)
 {
   __complex__ double retval;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
 
-  if (isfinite (__real__ x))
+  if (rcls >= FP_ZERO)
     {
-      if (isfinite (__imag__ x))
+      /* Real part is finite.  */
+      if (icls >= FP_ZERO)
 	{
-	  double exp_val = __exp (__real__ x);
+	  /* Imaginary part is finite.  */
+	  double exp_val = __ieee754_exp (__real__ x);
 
 	  if (isfinite (exp_val))
 	    {
@@ -52,14 +58,17 @@ __cexp (__complex__ double x)
 	  __imag__ retval = __nan ("");
 	}
     }
-  else if (__isinf (__real__ x))
+  else if (rcls == FP_INFINITE)
     {
-      if (isfinite (__imag__ x))
+      /* Real part is infinite.  */
+      if (icls >= FP_ZERO)
 	{
+	  /* Imaginary part is finite.  */
 	  double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
 
-	  if (__imag__ x == 0.0)
+	  if (icls == FP_ZERO)
 	    {
+	      /* Imaginary part is 0.0.  */
 	      __real__ retval = value;
 	      __imag__ retval = __imag__ x;
 	    }
diff --git a/sysdeps/libm-ieee754/s_cexpf.c b/sysdeps/libm-ieee754/s_cexpf.c
index 0d4372103b..99f33dc873 100644
--- a/sysdeps/libm-ieee754/s_cexpf.c
+++ b/sysdeps/libm-ieee754/s_cexpf.c
@@ -38,16 +38,19 @@ __cexpf (__complex__ float x)
 	{
 	  /* Imaginary part is finite.  */
 	  float exp_val = __ieee754_expf (__real__ x);
+	  float sinix, cosix;
+
+	  __sincosf (__imag__ x, &sinix, &cosix);
 
 	  if (isfinite (exp_val))
 	    {
-	      __real__ retval = exp_val * __cosf (__imag__ x);
-	      __imag__ retval = exp_val * __sinf (__imag__ x);
+	      __real__ retval = exp_val * cosix;
+	      __imag__ retval = exp_val * sinix;
 	    }
 	  else
 	    {
-	      __real__ retval = __copysignf (exp_val, __cosf (__imag__ x));
-	      __imag__ retval = __copysignf (exp_val, __sinf (__imag__ x));
+	      __real__ retval = __copysignf (exp_val, cosix);
+	      __imag__ retval = __copysignf (exp_val, sinix);
 	    }
 	}
       else
@@ -74,8 +77,12 @@ __cexpf (__complex__ float x)
 	    }
 	  else
 	    {
-	      __real__ retval = __copysignf (value, __cosf (__imag__ x));
-	      __imag__ retval = __copysignf (value, __sinf (__imag__ x));
+	      float sinix, cosix;
+
+	      __sincosf (__imag__ x, &sinix, &cosix);
+
+	      __real__ retval = __copysignf (value, cosix);
+	      __imag__ retval = __copysignf (value, sinix);
 	    }
 	}
       else if (signbit (__real__ x) == 0)
diff --git a/sysdeps/libm-ieee754/s_cexpl.c b/sysdeps/libm-ieee754/s_cexpl.c
index ac27e1eeb8..1b97dba74d 100644
--- a/sysdeps/libm-ieee754/s_cexpl.c
+++ b/sysdeps/libm-ieee754/s_cexpl.c
@@ -38,16 +38,19 @@ __cexpl (__complex__ long double x)
 	{
 	  /* Imaginary part is finite.  */
 	  long double exp_val = __ieee754_expl (__real__ x);
+	  long double sinix, cosix;
+
+	  __sincosl (__imag__ x, &sinix, &cosix);
 
 	  if (isfinite (exp_val))
 	    {
-	      __real__ retval = exp_val * __cosl (__imag__ x);
-	      __imag__ retval = exp_val * __sinl (__imag__ x);
+	      __real__ retval = exp_val * cosix;
+	      __imag__ retval = exp_val * sinix;
 	    }
 	  else
 	    {
-	      __real__ retval = __copysignl (exp_val, __cosl (__imag__ x));
-	      __imag__ retval = __copysignl (exp_val, __sinl (__imag__ x));
+	      __real__ retval = __copysignl (exp_val, cosix);
+	      __imag__ retval = __copysignl (exp_val, sinix);
 	    }
 	}
       else
@@ -74,8 +77,12 @@ __cexpl (__complex__ long double x)
 	    }
 	  else
 	    {
-	      __real__ retval = __copysignl (value, __cosl (__imag__ x));
-	      __imag__ retval = __copysignl (value, __sinl (__imag__ x));
+	      long double sinix, cosix;
+
+	      __sincosl (__imag__ x, &sinix, &cosix);
+
+	      __real__ retval = __copysignl (value, cosix);
+	      __imag__ retval = __copysignl (value, sinix);
 	    }
 	}
       else if (signbit (__real__ x) == 0)
diff --git a/sysdeps/libm-ieee754/s_cosl.c b/sysdeps/libm-ieee754/s_cosl.c
index 0e7a06d8ba..9765f7fd4e 100644
--- a/sysdeps/libm-ieee754/s_cosl.c
+++ b/sysdeps/libm-ieee754/s_cosl.c
@@ -60,14 +60,15 @@ static char rcsid[] = "$NetBSD: $";
 #endif
 {
 	long double y[2],z=0.0;
-	int32_t n, se;
+	int32_t n, se, i0, i1;
 
     /* High word of x. */
-	GET_LDOUBLE_EXP(se,x);
+	GET_LDOUBLE_WORDS(se,i0,i1,x);
 
     /* |x| ~< pi/4 */
 	se &= 0x7fff;
-	if(ix <= 0x3ffe) return __kernel_cosl(x,z);
+	if(se < 0x3ffe || (se == 0x3ffe && i0 <= 0xc90fdaa2))
+	  return __kernel_cosl(x,z);
 
     /* cos(Inf or NaN) is NaN */
 	else if (se==0x7fff) return x-x;
diff --git a/sysdeps/libm-ieee754/s_cproj.c b/sysdeps/libm-ieee754/s_cproj.c
new file mode 100644
index 0000000000..8ad27c0e5b
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_cproj.c
@@ -0,0 +1,49 @@
+/* Compute projection of complex double value to Riemann sphere.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cproj (__complex__ double x)
+{
+  __complex__ double res;
+
+  if (!finite (__real__ x) || !finite (__imag__ x))
+    {
+      __real__ res = INFINITY;
+      __imag__ res = __copysign (0.0, __imag__ x);
+    }
+  else
+    {
+      double den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
+
+      __real__ res = (2.0 * __real__ x) / den;
+      __imag__ res = (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
+weak_alias (__cproj, cproj)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cproj, __cprojl)
+weak_alias (__cproj, cprojl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_cprojf.c b/sysdeps/libm-ieee754/s_cprojf.c
new file mode 100644
index 0000000000..8ee61c727c
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_cprojf.c
@@ -0,0 +1,45 @@
+/* Compute projection of complex float value to Riemann sphere.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__cprojf (__complex__ float x)
+{
+  __complex__ float res;
+
+  if (!finite (__real__ x) || !finite (__imag__ x))
+    {
+      __real__ res = INFINITY;
+      __imag__ res = __copysignf (0.0, __imag__ x);
+    }
+  else
+    {
+      float den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
+
+      __real__ res = (2.0 * __real__ x) / den;
+      __imag__ res = (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
+weak_alias (__cprojf, cprojf)
diff --git a/sysdeps/libm-ieee754/s_cprojl.c b/sysdeps/libm-ieee754/s_cprojl.c
new file mode 100644
index 0000000000..34298e1f25
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_cprojl.c
@@ -0,0 +1,46 @@
+/* Compute projection of complex long double value to Riemann sphere.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cprojl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!finite (__real__ x) || !finite (__imag__ x))
+    {
+      __real__ res = INFINITY;
+      __imag__ res = __copysignl (0.0, __imag__ x);
+    }
+  else
+    {
+      long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x
+			 + 1.0);
+
+      __real__ res = (2.0 * __real__ x) / den;
+      __imag__ res = (2.0 * __imag__ x) / den;
+    }
+
+  return res;
+}
+weak_alias (__cprojl, cprojl)
diff --git a/sysdeps/libm-ieee754/s_csinh.c b/sysdeps/libm-ieee754/s_csinh.c
index 05cec85e7c..98f06a558f 100644
--- a/sysdeps/libm-ieee754/s_csinh.c
+++ b/sysdeps/libm-ieee754/s_csinh.c
@@ -40,10 +40,13 @@ __csinh (__complex__ double x)
       if (icls >= FP_ZERO)
 	{
 	  /* Imaginary part is finite.  */
-	   double sinh_val = __ieee754_sinh (__real__ x);
+	  double sinh_val = __ieee754_sinh (__real__ x);
+	  double sinix, cosix;
 
-	  __real__ retval = sinh_val * __cos (__imag__ x);
-	  __imag__ retval = sinh_val * __sin (__imag__ x);
+	  __sincos (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = sinh_val * cosix;
+	  __imag__ retval = sinh_val * sinix;
 
 	  if (negate)
 	    __real__ retval = -__real__ retval;
@@ -75,8 +78,12 @@ __csinh (__complex__ double x)
       else if (icls > FP_ZERO)
 	{
 	  /* Imaginary part is finite.  */
-	  __real__ retval = __copysign (HUGE_VAL, __cos (__imag__ x));
-	  __imag__ retval = __copysign (HUGE_VAL, __sin (__imag__ x));
+	  double sinix, cosix;
+
+	  __sincos (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysign (HUGE_VAL, cosix);
+	  __imag__ retval = __copysign (HUGE_VAL, sinix);
 
 	  if (negate)
 	    __real__ retval = -__real__ retval;
diff --git a/sysdeps/libm-ieee754/s_csinhf.c b/sysdeps/libm-ieee754/s_csinhf.c
index 93f83cf7b6..c644d3a5e8 100644
--- a/sysdeps/libm-ieee754/s_csinhf.c
+++ b/sysdeps/libm-ieee754/s_csinhf.c
@@ -40,10 +40,13 @@ __csinhf (__complex__ float x)
       if (icls >= FP_ZERO)
 	{
 	  /* Imaginary part is finite.  */
-	   float sinh_val = __ieee754_sinhf (__real__ x);
+	  float sinh_val = __ieee754_sinhf (__real__ x);
+	  float sinix, cosix;
 
-	  __real__ retval = sinh_val * __cosf (__imag__ x);
-	  __imag__ retval = sinh_val * __sinf (__imag__ x);
+	  __sincosf (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = sinh_val * cosix;
+	  __imag__ retval = sinh_val * sinix;
 
 	  if (negate)
 	    __real__ retval = -__real__ retval;
@@ -75,8 +78,12 @@ __csinhf (__complex__ float x)
       else if (icls > FP_ZERO)
 	{
 	  /* Imaginary part is finite.  */
-	  __real__ retval = __copysignf (HUGE_VALF, __cosf (__imag__ x));
-	  __imag__ retval = __copysignf (HUGE_VALF, __sinf (__imag__ x));
+	  float sinix, cosix;
+
+	  __sincosf (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignf (HUGE_VALF, cosix);
+	  __imag__ retval = __copysignf (HUGE_VALF, sinix);
 
 	  if (negate)
 	    __real__ retval = -__real__ retval;
diff --git a/sysdeps/libm-ieee754/s_csinhl.c b/sysdeps/libm-ieee754/s_csinhl.c
index 8388a40b46..4bb9e63680 100644
--- a/sysdeps/libm-ieee754/s_csinhl.c
+++ b/sysdeps/libm-ieee754/s_csinhl.c
@@ -41,9 +41,12 @@ __csinhl (__complex__ long double x)
 	{
 	  /* Imaginary part is finite.  */
 	  long double sinh_val = __ieee754_sinhl (__real__ x);
+	  long double sinix, cosix;
 
-	  __real__ retval = sinh_val * __cosl (__imag__ x);
-	  __imag__ retval = sinh_val * __sinl (__imag__ x);
+	  __sincosl (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = sinh_val * cosix;
+	  __imag__ retval = sinh_val * sinix;
 
 	  if (negate)
 	    __real__ retval = -__real__ retval;
@@ -75,8 +78,12 @@ __csinhl (__complex__ long double x)
       else if (icls > FP_ZERO)
 	{
 	  /* Imaginary part is finite.  */
-	  __real__ retval = __copysignl (HUGE_VALL, __cosl (__imag__ x));
-	  __imag__ retval = __copysignl (HUGE_VALL, __sinl (__imag__ x));
+	  long double sinix, cosix;
+
+	  __sincosl (__imag__ x, &sinix, &cosix);
+
+	  __real__ retval = __copysignl (HUGE_VALL, cosix);
+	  __imag__ retval = __copysignl (HUGE_VALL, sinix);
 
 	  if (negate)
 	    __real__ retval = -__real__ retval;
diff --git a/sysdeps/libm-ieee754/s_ctan.c b/sysdeps/libm-ieee754/s_ctan.c
index f448395c7e..069b96c1d6 100644
--- a/sysdeps/libm-ieee754/s_ctan.c
+++ b/sysdeps/libm-ieee754/s_ctan.c
@@ -48,10 +48,14 @@ __ctan (__complex__ double x)
     }
   else
     {
-      double den = (__cos (2.0 * __real__ x)
-		    + __ieee754_cosh (2.0 * __imag__ x));
+      double sin2rx, cos2rx;
+      double den;
 
-      __real__ res = __sin (2.0 * __real__ x) / den;
+      __sincos (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+      den = cos2rx + __ieee754_cosh (2.0 * __imag__ x);
+
+      __real__ res = sin2rx / den;
       __imag__ res = __ieee754_sinh (2.0 * __imag__ x) / den;
     }
 
diff --git a/sysdeps/libm-ieee754/s_ctanf.c b/sysdeps/libm-ieee754/s_ctanf.c
index 99011fa41d..1c6fdca81d 100644
--- a/sysdeps/libm-ieee754/s_ctanf.c
+++ b/sysdeps/libm-ieee754/s_ctanf.c
@@ -48,10 +48,14 @@ __ctanf (__complex__ float x)
     }
   else
     {
-      float den = (__cosf (2.0 * __real__ x)
-		   + __ieee754_coshf (2.0 * __imag__ x));
+      float sin2rx, cos2rx;
+      float den;
 
-      __real__ res = __sinf (2.0 * __real__ x) / den;
+      __sincosf (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+      den = cos2rx + __ieee754_coshf (2.0 * __imag__ x);
+
+      __real__ res = sin2rx / den;
       __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den;
     }
 
diff --git a/sysdeps/libm-ieee754/s_ctanh.c b/sysdeps/libm-ieee754/s_ctanh.c
index 7c9b3197ef..a16f9c8d02 100644
--- a/sysdeps/libm-ieee754/s_ctanh.c
+++ b/sysdeps/libm-ieee754/s_ctanh.c
@@ -48,11 +48,15 @@ __ctanh (__complex__ double x)
     }
   else
     {
-      double den = (__ieee754_cosh (2.0 * __real__ x)
-		    + __cos (2.0 * __imag__ x));
+      double sin2ix, cos2ix;
+      double den;
+
+      __sincos (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+      den = (__ieee754_cosh (2.0 * __real__ x) + cos2ix);
 
       __real__ res = __ieee754_sinh (2.0 * __real__ x) / den;
-      __imag__ res = __sin (2.0 * __imag__ x) / den;
+      __imag__ res = sin2ix / den;
     }
 
   return res;
diff --git a/sysdeps/libm-ieee754/s_ctanhf.c b/sysdeps/libm-ieee754/s_ctanhf.c
index 1bdbc0fdc5..45548d518c 100644
--- a/sysdeps/libm-ieee754/s_ctanhf.c
+++ b/sysdeps/libm-ieee754/s_ctanhf.c
@@ -48,11 +48,15 @@ __ctanhf (__complex__ float x)
     }
   else
     {
-      float den = (__ieee754_coshf (2.0 * __real__ x)
-		   + __cosf (2.0 * __imag__ x));
+      float sin2ix, cos2ix;
+      float den;
+
+      __sincosf (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+      den = (__ieee754_coshf (2.0 * __real__ x) + cos2ix);
 
       __real__ res = __ieee754_sinhf (2.0 * __real__ x) / den;
-      __imag__ res = __sinf (2.0 * __imag__ x) / den;
+      __imag__ res = sin2ix / den;
     }
 
   return res;
diff --git a/sysdeps/libm-ieee754/s_ctanhl.c b/sysdeps/libm-ieee754/s_ctanhl.c
index b34aeb77dd..5c466167a6 100644
--- a/sysdeps/libm-ieee754/s_ctanhl.c
+++ b/sysdeps/libm-ieee754/s_ctanhl.c
@@ -48,11 +48,15 @@ __ctanhl (__complex__ long double x)
     }
   else
     {
-      long double den = (__ieee754_coshl (2.0 * __real__ x)
-			 + __cosl (2.0 * __imag__ x));
+      long double sin2ix, cos2ix;
+      long double den;
+
+      __sincosl (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+      den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix);
 
       __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den;
-      __imag__ res = __sinl (2.0 * __imag__ x) / den;
+      __imag__ res = sin2ix / den;
     }
 
   return res;
diff --git a/sysdeps/libm-ieee754/s_ctanl.c b/sysdeps/libm-ieee754/s_ctanl.c
index 82f86fc148..b4a2b4a13c 100644
--- a/sysdeps/libm-ieee754/s_ctanl.c
+++ b/sysdeps/libm-ieee754/s_ctanl.c
@@ -48,10 +48,14 @@ __ctanl (__complex__ long double x)
     }
   else
     {
-      long double den = (__cosl (2.0 * __real__ x)
-			 + __ieee754_coshl (2.0 * __imag__ x));
+      long double sin2rx, cos2rx;
+      long double den;
 
-      __real__ res = __sinl (2.0 * __real__ x) / den;
+      __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+      den = cos2rx + __ieee754_coshl (2.0 * __imag__ x);
+
+      __real__ res = sin2rx / den;
       __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den;
     }
 
diff --git a/sysdeps/libm-ieee754/s_roundtol.c b/sysdeps/libm-ieee754/s_roundtol.c
index 6649369b06..bc0ceae0f8 100644
--- a/sysdeps/libm-ieee754/s_roundtol.c
+++ b/sysdeps/libm-ieee754/s_roundtol.c
@@ -63,7 +63,7 @@ __roundtol (long double x)
     }
   else
     {
-      i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
+      u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
       if ((i1 & i) != 0)
 	{
 	  /* x is not integral.  */
@@ -93,7 +93,7 @@ __roundtol (long double x)
 	{
 	  result = (long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
 	  if (sizeof (long int) > 4 && j0 > 31)
-	    result |= j >> (63 - j0);
+	    result |= i1 >> (63 - j0);
 	}
     }
 
diff --git a/sysdeps/libm-ieee754/s_roundtoll.c b/sysdeps/libm-ieee754/s_roundtoll.c
index 8d99130697..49167236a6 100644
--- a/sysdeps/libm-ieee754/s_roundtoll.c
+++ b/sysdeps/libm-ieee754/s_roundtoll.c
@@ -63,7 +63,7 @@ __roundtoll (long double x)
     }
   else
     {
-      i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
+      u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
       if ((i1 & i) != 0)
 	{
 	  /* x is not integral.  */
@@ -95,7 +95,7 @@ __roundtoll (long double x)
 	{
 	  result = (long long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
 	  if (sizeof (long long int) > 4 && j0 > 31)
-	    result |= j >> (63 - j0);
+	    result |= i1 >> (63 - j0);
 	}
     }
 
diff --git a/sysdeps/libm-ieee754/s_sincos.c b/sysdeps/libm-ieee754/s_sincos.c
new file mode 100644
index 0000000000..5bc564ba5b
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_sincos.c
@@ -0,0 +1,78 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+void
+__sincos (double x, double *sinx, double *cosx)
+{
+  int32_t ix;
+
+  /* High word of x. */
+  GET_HIGH_WORD (ix, x);
+
+  /* |x| ~< pi/4 */
+  ix &= 0x7fffffff;
+  if (ix <= 0x3fe921fb)
+    {
+      *sinx = __kernel_sin (x, 0.0, 0);
+      *cosx = __kernel_cos (x, 0.0);
+    }
+  else if (ix>=0x7ff00000)
+    {
+      /* sin(Inf or NaN) is NaN */
+      *sinx = *cosx = x - x;
+    }
+  else
+    {
+      /* Argument reduction needed.  */
+      double y[2];
+      int n;
+
+      n = __ieee754_rem_pio2 (x, y);
+      switch (n & 3)
+	{
+	case 0:
+	  *sinx = __kernel_sin (y[0], y[1], 1);
+	  *cosx = __kernel_cos (y[0], y[1]);
+	  break;
+	case 1:
+	  *sinx = __kernel_cos (y[0], y[1]);
+	  *cosx = -__kernel_sin (y[0], y[1], 1);
+	  break;
+	case 2:
+	  *sinx = -__kernel_sin (y[0], y[1], 1);
+	  *cosx = -__kernel_cos (y[0], y[1]);
+	  break;
+	default:
+	  *sinx = -__kernel_cos (y[0], y[1]);
+	  *cosx = __kernel_sin (y[0], y[1], 1);
+	  break;
+	}
+    }
+}
+weak_alias (__sincos, sincos)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__sincos, __sincosl)
+weak_alias (__sincos, sincosl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_sincosf.c b/sysdeps/libm-ieee754/s_sincosf.c
new file mode 100644
index 0000000000..0fd7b0ca8b
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_sincosf.c
@@ -0,0 +1,74 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+void
+__sincosf (float x, float *sinx, float *cosx)
+{
+  int32_t ix;
+
+  /* High word of x. */
+  GET_FLOAT_WORD (ix, x);
+
+  /* |x| ~< pi/4 */
+  ix &= 0x7fffffff;
+  if (ix <= 0x3f490fd8)
+    {
+      *sinx = __kernel_sinf (x, 0.0, 0);
+      *cosx = __kernel_cosf (x, 0.0);
+    }
+  else if (ix>=0x7ff00000)
+    {
+      /* sin(Inf or NaN) is NaN */
+      *sinx = *cosx = x - x;
+    }
+  else
+    {
+      /* Argument reduction needed.  */
+      float y[2];
+      int n;
+
+      n = __ieee754_rem_pio2f (x, y);
+      switch (n & 3)
+	{
+	case 0:
+	  *sinx = __kernel_sinf (y[0], y[1], 1);
+	  *cosx = __kernel_cosf (y[0], y[1]);
+	  break;
+	case 1:
+	  *sinx = __kernel_cosf (y[0], y[1]);
+	  *cosx = -__kernel_sinf (y[0], y[1], 1);
+	  break;
+	case 2:
+	  *sinx = -__kernel_sinf (y[0], y[1], 1);
+	  *cosx = -__kernel_cosf (y[0], y[1]);
+	  break;
+	default:
+	  *sinx = -__kernel_cosf (y[0], y[1]);
+	  *cosx = __kernel_sinf (y[0], y[1], 1);
+	  break;
+	}
+    }
+}
+weak_alias (__sincosf, sincosf)
diff --git a/sysdeps/libm-ieee754/s_sincosl.c b/sysdeps/libm-ieee754/s_sincosl.c
new file mode 100644
index 0000000000..7cadf88a40
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_sincosl.c
@@ -0,0 +1,74 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+void
+__sincosl (long double x, long double *sinx, long double *cosx)
+{
+  int32_t se, i0, i1;
+
+  /* High word of x. */
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+
+  /* |x| ~< pi/4 */
+  se &= 0x7fff;
+  if (se < 0x3ffe || (se == 0x3ffe && i0 <= 0xc90fdaa2))
+    {
+      *sinx = __kernel_sinl (x, 0.0, 0);
+      *cosx = __kernel_cosl (x, 0.0);
+    }
+  else if (ix == 0x7fff)
+    {
+      /* sin(Inf or NaN) is NaN */
+      *sinx = *cosx = x - x;
+    }
+  else
+    {
+      /* Argument reduction needed.  */
+      long double y[2];
+      int n;
+
+      n = __ieee754_rem_pio2l (x, y);
+      switch (n & 3)
+	{
+	case 0:
+	  *sinx = __kernel_sinl (y[0], y[1], 1);
+	  *cosx = __kernel_cosl (y[0], y[1]);
+	  break;
+	case 1:
+	  *sinx = __kernel_cosl (y[0], y[1]);
+	  *cosx = -__kernel_sinl (y[0], y[1], 1);
+	  break;
+	case 2:
+	  *sinx = -__kernel_sinl (y[0], y[1], 1);
+	  *cosx = -__kernel_cosl (y[0], y[1]);
+	  break;
+	default:
+	  *sinx = -__kernel_cosl (y[0], y[1]);
+	  *cosx = __kernel_sinl (y[0], y[1], 1);
+	  break;
+	}
+    }
+}
+weak_alias (__sincosl, sincosl)
diff --git a/sysdeps/libm-ieee754/s_sinl.c b/sysdeps/libm-ieee754/s_sinl.c
index ade86dfa66..4fd48805b4 100644
--- a/sysdeps/libm-ieee754/s_sinl.c
+++ b/sysdeps/libm-ieee754/s_sinl.c
@@ -60,14 +60,15 @@ static char rcsid[] = "$NetBSD: $";
 #endif
 {
 	long double y[2],z=0.0;
-	int32_t n, se;
+	int32_t n, se, i0, i1;
 
     /* High word of x. */
-	GET_LDOUBLE_EXP(se,x);
+	GET_LDOUBLE_WORDS(se,i0,i1,x);
 
     /* |x| ~< pi/4 */
 	se &= 0x7fff;
-	if(se <= 0x3ffe) return __kernel_sinl(x,z,0);
+	if(se < 0x3ffe || (se == 0x3ffe && i0 <= 0xc90fdaa2))
+	  return __kernel_sinl(x,z,0);
 
     /* sin(Inf or NaN) is NaN */
 	else if (se==0x7fff) return x-x;
diff --git a/sysdeps/posix/Makefile b/sysdeps/posix/Makefile
index 9770dbb358..7c1013ad2b 100644
--- a/sysdeps/posix/Makefile
+++ b/sysdeps/posix/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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,9 +16,17 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
+ifeq (yes,$(cross-compiling))
+$(common-objpfx)stdio_lim.h:
+	@echo
+	@echo "You must build stdio_lim.h by hand.  Stop."
+	@echo
+	@exit 1
+else
 $(common-objpfx)stdio_lim.h: $(common-objpfx)mk-stdiolim
 	$(dir $<)$(notdir $<) > $@-t
 	mv $@-t $@
+endif
 
 # Turn into a version that works when cd'd into $(objdir).
 mk-stdiolim-CFLAGS = $(patsubst -I$(shell pwd)//%,-I/%,\
diff --git a/sysdeps/unix/arm/sysdep.h b/sysdeps/unix/arm/sysdep.h
new file mode 100644
index 0000000000..18e812b9f1
--- /dev/null
+++ b/sysdeps/unix/arm/sysdep.h
@@ -0,0 +1,21 @@
+/* Copyright (C) 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 Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <sysdeps/unix/sysdep.h>
+#include <sysdeps/arm/sysdep.h>
+
diff --git a/wcsmbs/wcsstr.c b/wcsmbs/wcsstr.c
index 5f0d2b4329..c063474a75 100644
--- a/wcsmbs/wcsstr.c
+++ b/wcsmbs/wcsstr.c
@@ -95,3 +95,6 @@ foundneedle:
 ret0:
   return NULL;
 }
+/* This alias is for backward compatibility with drafts of the ISO C
+   standard.  Unfortunately the Unix(TM) standard requires this name.  */
+weak_alias (wcsstr, wcswcs)