about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-07-22 00:10:33 +0000
committerUlrich Drepper <drepper@redhat.com>1997-07-22 00:10:33 +0000
commit60c966358ed6fa6ce3ded5426f46232cbfd8e0fd (patch)
tree2edfd4ad681692a2dbfdfcabaead5bca25ed2be5
parent907a1bacf996264c3197342cfc565b1d4f840bfb (diff)
downloadglibc-cvs/libc-ud-970721.tar.gz
glibc-cvs/libc-ud-970721.tar.xz
glibc-cvs/libc-ud-970721.zip
1997-07-22 01:35  Ulrich Drepper  <drepper@cygnus.com>

	* Makerules (+make-deps): Use $(CFLAGS) in run of $(+mkdep) so
	that optimizing is also selected for dependency generation.

	* configure.in: Add machine description for TI c[34]x.

	* inet/Makefile (routines): Remove ntohl and ntohs.
	* inet/netinet/in.h: Use optimized version of hton? and ntoh?
	for little endian machines.
	* sysdeps/alpha/ntohl.s: Removed.
	* sysdeps/alpha/ntohs.s: Removed.
	* sysdeps/generic/ntohl.c: Removed.
	* sysdeps/generic/ntohs.c: Removed.
	* sysdeps/generic/htonl.c: Add aliases for ntohl.
	* sysdeps/vax/htonl.s: Likewise.
	* sysdeps/generic/htons.c: Add aliases for ntohs.
	* sysdeps/vax/htons.s: Likewise.
	* sysdeps/vax/ntohl.s: Removed.
	* sysdeps/vax/ntohs.s: Removed.
	* sysdeps/generic/bits/htontoh.h: New file.
	* sysdeps/i386/htonl.S: New file.
	* sysdeps/i386/htons.S: New file.
	* sysdeps/i386/i486/htonl.S: New file.

	* sysdeps/i386/fpu/bits/mathinline.h: Correct and optimized compare
	macros.

	* sysdeps/mips/dl-machine.h: Remove mips64 dependent parts.
	* sysdeps/mips/mips64/dl-machine.h: New file.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Don't install
	syscall-list.h.

1997-07-12  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* libc.map: Add missing symbol _obstack.

1997-07-14 08:22  H.J. Lu  <hjl@gnu.ai.mit.edu>

	* sysdeps/mips/rtld-parms: New.

	* sysdeps/unix/sysv/linux/mips/lxstat.h: Moved to
	* sysdeps/unix/sysv/linux/mips/lxstat.c: ...this.

	* sysdeps/unix/sysv/linux/mips/sgidef.h: Moved to
	* sysdeps/unix/sysv/linux/mips/sgidefs.h: ...this.

	* sysdeps/generic/dl-sysdep.c (_start): Change to ENTRY_POINT.

1997-07-17 08:39  H.J. Lu  <hjl@gnu.ai.mit.edu>

	* sysdeps/mips/dl-machine.h: Remove extra stuff.

1997-07-06 07:18  Geoff Keating  <geoffk@ozemail.com.au>

	* sysdeps/powerpc/bits/endian.h: Handle multiple endianess.

	* stdlib/grouping.h: Suppress gcc warning about testing
	unsigned char for less-than-zero.
	* stdio-common/printf_fp.c: Likewise.
	* stdio-common/vfprintf.c: Likewise.

	* sysdeps/powerpc/add_n.s: New file.
	* sysdeps/powerpc/sub_n.s: New file.
	* sysdeps/powerpc/lshift.s: Ported XCOFF->ELF (from GMP).
	* sysdeps/powerpc/mul_1.s: Ported XCOFF->ELF (from GMP).
	* sysdeps/powerpc/addmul_1.s: Ported XCOFF->ELF (from GMP).
	* sysdeps/powerpc/submul_1.s: Ported XCOFF->ELF (from GMP).
	* sysdeps/powerpc/rshift.s: Ported XCOFF->ELF (from GMP).

	* math/libm-test.c (cos_test, sin_test, sincos_test): Use
	precomputed pi/6 rather than having gcc calculate it, otherwise
	tests give inaccurate result due to inaccurate input.
	* math/libm.map: Add __fe_*_env constants to list of exported
	symbols.

	* sysdeps/libm-ieee754/s_isinf.c: Simplify, make faster.
	* sysdeps/libm-ieee754/s_isinff.c: Simplify, make faster.
	* sysdeps/libm-ieee754/s_atan2f.c: Correct value of pi to be correct
	round-to-nearest value.

	* sysdeps/libm-ieee754/e_log.c: Make sure exceptions are raised.
	* sysdeps/libm-ieee754/e_log10.c: Likewise.
	* sysdeps/libm-ieee754/e_log10f.c: Likewise.
	* sysdeps/libm-ieee754/e_logf.c: Likewise.
	* sysdeps/libm-ieee754/s_log1p.c: Likewise. Also use correct -Inf.
	* sysdeps/libm-ieee754/s_log1pf.c: Likewise. Also use correct -Inf.
	* sysdeps/libm-ieee754/s_log2.c: Likewise.
	* sysdeps/libm-ieee754/s_log2f.c: Likewise.

1997-07-15 21:54  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* nis/nss_compat/compat-grp.c: Fix "buffer to small" problems
	and memory leaks.
	* nis/nss_compat/compat-pwd.c: Likewise.
	* nis/nss_compat/compat-spwd.c: Likewise.
	* nis/nss_nis/nis-alias.c: Likewise.
	* nis/nss_nis/nis-ethers.c: Likewise.
	* nis/nss_nis/nis-grp.c: Likewise.
	* nis/nss_nis/nis-hosts.c: Likewise.
	* nis/nss_nis/nis-network.c: Likewise.
	* nis/nss_nis/nis-proto.c: Likewise.
	* nis/nss_nis/nis-pwd.c: Likewise.
	* nis/nss_nis/nis-rpc.c: Likewise.
	* nis/nss_nis/nis-service.c: Likewise.
	* nis/nss_nis/nis-spwd.c: Likewise.
	* nis/nss_nisplus-alias.c: Likewise.
	* nis/nss_nisplus-ethers.c: Likewise.
	* nis/nss_nisplus-grp.c: Likewise.
	* nis/nss_nisplus-hosts.c: Likewise.
	* nis/nss_nisplus-netgrp.c: Likewise.
	* nis/nss_nisplus-network.c: Likewise.
	* nis/nss_nisplus-proto.c: Likewise.
	* nis/nss_nisplus-pwd.c: Likewise.
	* nis/nss_nisplus-rpc.c: Likewise.
	* nis/nss_nisplus-service.c: Likewise.
	* nis/nss_nisplus-spwd.c: Likewise.

	* nis/nss_nisplus-parse.c: If buffer to small, give -1 back.

1997-07-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/m68k/dl-machine.h (elf_machine_rela): Mention program
	name in warning message.
	* sysdeps/powerpc/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/sparc/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/sparc64/dl-machine.h (elf_machine_rela): Likewise.

	* sysdeps/i386/dl-machine.h (elf_machine_rel): Print program name
	first.

1997-07-20 19:33  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* libc.map: Add _null_auth and _seterr_reply.

	* sunrpc/clnt_udp.c (clntudp_call): If xargs is NULL, don't encode it.
-rw-r--r--ChangeLog138
-rw-r--r--ChangeLog.62
-rw-r--r--Makerules2
-rwxr-xr-xconfig.guess54
-rwxr-xr-xconfig.sub18
-rwxr-xr-xconfigure110
-rw-r--r--configure.in2
-rw-r--r--inet/Makefile2
-rw-r--r--inet/netinet/in.h35
-rw-r--r--libc.map3
-rw-r--r--math/libm-test.c12
-rw-r--r--math/libm.map4
-rw-r--r--nis/nss_compat/compat-grp.c94
-rw-r--r--nis/nss_compat/compat-pwd.c123
-rw-r--r--nis/nss_compat/compat-spwd.c104
-rw-r--r--nis/nss_nis/nis-alias.c17
-rw-r--r--nis/nss_nis/nis-ethers.c29
-rw-r--r--nis/nss_nis/nis-grp.c36
-rw-r--r--nis/nss_nis/nis-hosts.c13
-rw-r--r--nis/nss_nis/nis-network.c12
-rw-r--r--nis/nss_nis/nis-proto.c36
-rw-r--r--nis/nss_nis/nis-pwd.c18
-rw-r--r--nis/nss_nis/nis-rpc.c9
-rw-r--r--nis/nss_nis/nis-service.c8
-rw-r--r--nis/nss_nis/nis-spwd.c24
-rw-r--r--nis/nss_nisplus/nisplus-alias.c23
-rw-r--r--nis/nss_nisplus/nisplus-ethers.c75
-rw-r--r--nis/nss_nisplus/nisplus-grp.c22
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c79
-rw-r--r--nis/nss_nisplus/nisplus-netgrp.c2
-rw-r--r--nis/nss_nisplus/nisplus-network.c45
-rw-r--r--nis/nss_nisplus/nisplus-parser.c6
-rw-r--r--nis/nss_nisplus/nisplus-proto.c45
-rw-r--r--nis/nss_nisplus/nisplus-pwd.c42
-rw-r--r--nis/nss_nisplus/nisplus-rpc.c41
-rw-r--r--nis/nss_nisplus/nisplus-service.c43
-rw-r--r--nis/nss_nisplus/nisplus-spwd.c33
-rw-r--r--stdio-common/printf_fp.c12
-rw-r--r--stdio-common/vfprintf.c6
-rw-r--r--stdlib/grouping.h8
-rw-r--r--sunrpc/clnt_udp.c3
-rw-r--r--sysdeps/alpha/ntohl.s2
-rw-r--r--sysdeps/alpha/ntohs.s2
-rw-r--r--sysdeps/generic/bits/htontoh.h (renamed from sysdeps/generic/ntohs.c)17
-rw-r--r--sysdeps/generic/dl-sysdep.c2
-rw-r--r--sysdeps/generic/htonl.c5
-rw-r--r--sysdeps/generic/htons.c5
-rw-r--r--sysdeps/i386/bits/htontoh.h79
-rw-r--r--sysdeps/i386/dl-machine.h5
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h24
-rw-r--r--sysdeps/i386/htonl.S39
-rw-r--r--sysdeps/i386/htons.S38
-rw-r--r--sysdeps/i386/i486/htonl.S (renamed from sysdeps/generic/ntohl.c)29
-rw-r--r--sysdeps/libm-ieee754/e_atan2f.c20
-rw-r--r--sysdeps/libm-ieee754/e_log.c4
-rw-r--r--sysdeps/libm-ieee754/e_log10.c16
-rw-r--r--sysdeps/libm-ieee754/e_log10f.c8
-rw-r--r--sysdeps/libm-ieee754/e_logf.c16
-rw-r--r--sysdeps/libm-ieee754/s_isinf.c5
-rw-r--r--sysdeps/libm-ieee754/s_isinff.c2
-rw-r--r--sysdeps/libm-ieee754/s_log1p.c2
-rw-r--r--sysdeps/libm-ieee754/s_log1pf.c14
-rw-r--r--sysdeps/libm-ieee754/s_log2.c4
-rw-r--r--sysdeps/libm-ieee754/s_log2f.c4
-rw-r--r--sysdeps/m68k/dl-machine.h4
-rw-r--r--sysdeps/mips/dl-machine.h192
-rw-r--r--sysdeps/mips/mips64/dl-machine.h594
-rw-r--r--sysdeps/mips/rtld-parms15
-rw-r--r--sysdeps/powerpc/bits/endian.h33
-rw-r--r--sysdeps/powerpc/dl-machine.h4
-rw-r--r--sysdeps/sparc/dl-machine.h4
-rw-r--r--sysdeps/sparc64/dl-machine.h4
-rw-r--r--sysdeps/unix/sysv/linux/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/mips/lxstat.c (renamed from sysdeps/unix/sysv/linux/mips/lxstat.h)0
-rw-r--r--sysdeps/unix/sysv/linux/mips/sgidefs.h (renamed from sysdeps/unix/sysv/linux/mips/sgidef.h)0
-rw-r--r--sysdeps/vax/htonl.s5
-rw-r--r--sysdeps/vax/htons.s3
-rw-r--r--sysdeps/vax/ntohl.s30
-rw-r--r--sysdeps/vax/ntohs.s30
79 files changed, 1881 insertions, 771 deletions
diff --git a/ChangeLog b/ChangeLog
index a446cc5391..0e0750c485 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,141 @@
+1997-07-22 01:35  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makerules (+make-deps): Use $(CFLAGS) in run of $(+mkdep) so
+	that optimizing is also selected for dependency generation.
+
+	* configure.in: Add machine description for TI c[34]x.
+
+	* inet/Makefile (routines): Remove ntohl and ntohs.
+	* inet/netinet/in.h: Use optimized version of hton? and ntoh?
+	for little endian machines.
+	* sysdeps/alpha/ntohl.s: Removed.
+	* sysdeps/alpha/ntohs.s: Removed.
+	* sysdeps/generic/ntohl.c: Removed.
+	* sysdeps/generic/ntohs.c: Removed.
+	* sysdeps/generic/htonl.c: Add aliases for ntohl.
+	* sysdeps/vax/htonl.s: Likewise.
+	* sysdeps/generic/htons.c: Add aliases for ntohs.
+	* sysdeps/vax/htons.s: Likewise.
+	* sysdeps/vax/ntohl.s: Removed.
+	* sysdeps/vax/ntohs.s: Removed.
+	* sysdeps/generic/bits/htontoh.h: New file.
+	* sysdeps/i386/htonl.S: New file.
+	* sysdeps/i386/htons.S: New file.
+	* sysdeps/i386/i486/htonl.S: New file.
+
+	* sysdeps/i386/fpu/bits/mathinline.h: Correct and optimized compare
+	macros.
+
+	* sysdeps/mips/dl-machine.h: Remove mips64 dependent parts.
+	* sysdeps/mips/mips64/dl-machine.h: New file.
+
+	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Don't install
+	syscall-list.h.
+
+1997-07-12  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* libc.map: Add missing symbol _obstack.
+
+1997-07-14 08:22  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+	* sysdeps/mips/rtld-parms: New.
+
+	* sysdeps/unix/sysv/linux/mips/lxstat.h: Moved to
+	* sysdeps/unix/sysv/linux/mips/lxstat.c: ...this.
+
+	* sysdeps/unix/sysv/linux/mips/sgidef.h: Moved to
+	* sysdeps/unix/sysv/linux/mips/sgidefs.h: ...this.
+
+	* sysdeps/generic/dl-sysdep.c (_start): Change to ENTRY_POINT.
+
+1997-07-17 08:39  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+	* sysdeps/mips/dl-machine.h: Remove extra stuff.
+
+1997-07-06 07:18  Geoff Keating  <geoffk@ozemail.com.au>
+
+	* sysdeps/powerpc/bits/endian.h: Handle multiple endianess.
+
+	* stdlib/grouping.h: Suppress gcc warning about testing
+	unsigned char for less-than-zero.
+	* stdio-common/printf_fp.c: Likewise.
+	* stdio-common/vfprintf.c: Likewise.
+
+	* sysdeps/powerpc/add_n.s: New file.
+	* sysdeps/powerpc/sub_n.s: New file.
+	* sysdeps/powerpc/lshift.s: Ported XCOFF->ELF (from GMP).
+	* sysdeps/powerpc/mul_1.s: Ported XCOFF->ELF (from GMP).
+	* sysdeps/powerpc/addmul_1.s: Ported XCOFF->ELF (from GMP).
+	* sysdeps/powerpc/submul_1.s: Ported XCOFF->ELF (from GMP).
+	* sysdeps/powerpc/rshift.s: Ported XCOFF->ELF (from GMP).
+
+	* math/libm-test.c (cos_test, sin_test, sincos_test): Use
+	precomputed pi/6 rather than having gcc calculate it, otherwise
+	tests give inaccurate result due to inaccurate input.
+	* math/libm.map: Add __fe_*_env constants to list of exported
+	symbols.
+
+	* sysdeps/libm-ieee754/s_isinf.c: Simplify, make faster.
+	* sysdeps/libm-ieee754/s_isinff.c: Simplify, make faster.
+	* sysdeps/libm-ieee754/s_atan2f.c: Correct value of pi to be correct
+	round-to-nearest value.
+
+	* sysdeps/libm-ieee754/e_log.c: Make sure exceptions are raised.
+	* sysdeps/libm-ieee754/e_log10.c: Likewise.
+	* sysdeps/libm-ieee754/e_log10f.c: Likewise.
+	* sysdeps/libm-ieee754/e_logf.c: Likewise.
+	* sysdeps/libm-ieee754/s_log1p.c: Likewise. Also use correct -Inf.
+	* sysdeps/libm-ieee754/s_log1pf.c: Likewise. Also use correct -Inf.
+	* sysdeps/libm-ieee754/s_log2.c: Likewise.
+	* sysdeps/libm-ieee754/s_log2f.c: Likewise.
+
+1997-07-15 21:54  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
+
+	* nis/nss_compat/compat-grp.c: Fix "buffer to small" problems
+	and memory leaks.
+	* nis/nss_compat/compat-pwd.c: Likewise.
+	* nis/nss_compat/compat-spwd.c: Likewise.
+	* nis/nss_nis/nis-alias.c: Likewise.
+	* nis/nss_nis/nis-ethers.c: Likewise.
+	* nis/nss_nis/nis-grp.c: Likewise.
+	* nis/nss_nis/nis-hosts.c: Likewise.
+	* nis/nss_nis/nis-network.c: Likewise.
+	* nis/nss_nis/nis-proto.c: Likewise.
+	* nis/nss_nis/nis-pwd.c: Likewise.
+	* nis/nss_nis/nis-rpc.c: Likewise.
+	* nis/nss_nis/nis-service.c: Likewise.
+	* nis/nss_nis/nis-spwd.c: Likewise.
+	* nis/nss_nisplus-alias.c: Likewise.
+	* nis/nss_nisplus-ethers.c: Likewise.
+	* nis/nss_nisplus-grp.c: Likewise.
+	* nis/nss_nisplus-hosts.c: Likewise.
+	* nis/nss_nisplus-netgrp.c: Likewise.
+	* nis/nss_nisplus-network.c: Likewise.
+	* nis/nss_nisplus-proto.c: Likewise.
+	* nis/nss_nisplus-pwd.c: Likewise.
+	* nis/nss_nisplus-rpc.c: Likewise.
+	* nis/nss_nisplus-service.c: Likewise.
+	* nis/nss_nisplus-spwd.c: Likewise.
+
+	* nis/nss_nisplus-parse.c: If buffer to small, give -1 back.
+
+1997-07-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/m68k/dl-machine.h (elf_machine_rela): Mention program
+	name in warning message.
+	* sysdeps/powerpc/dl-machine.h (elf_machine_rela): Likewise.
+	* sysdeps/sparc/dl-machine.h (elf_machine_rela): Likewise.
+	* sysdeps/sparc64/dl-machine.h (elf_machine_rela): Likewise.
+
+	* sysdeps/i386/dl-machine.h (elf_machine_rel): Print program name
+	first.
+
+1997-07-20 19:33  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
+
+	* libc.map: Add _null_auth and _seterr_reply.
+
+	* sunrpc/clnt_udp.c (clntudp_call): If xargs is NULL, don't encode it.
+
 1997-07-19 22:53  Ulrich Drepper  <drepper@cygnus.com>
 
 	* time/africa: Update from tzdata1997g.
diff --git a/ChangeLog.6 b/ChangeLog.6
index e53adb1f17..5858bd0493 100644
--- a/ChangeLog.6
+++ b/ChangeLog.6
@@ -217,7 +217,7 @@ Thu Jan 23 04:06:42 1997  Ulrich Drepper  <drepper@cygnus.com>
 	(sysdep_headers): Add sys/kernel_termios.h.
 	* sysdeps/unix/sysv/linux/kernel_termios.h: Moved to...
 	* sysdeps/unix/sysv/linux/sys/kernel_termios.h: ...here.
-	* sysdeps/unix/sysv/linux/sys/tcgetattr.c: Use __kernel_termios and
+	* sysdeps/unix/sysv/linux/tcgetattr.c: Use __kernel_termios and
 	__KERNEL_NCCS instead of kernel_termios and KERNEL_NCCS resp.
 
 	* sysdeps/unix/sysv/linux/alpha/ioctls.h: New file.
diff --git a/Makerules b/Makerules
index fb9eebe5a7..ba0116b0ac 100644
--- a/Makerules
+++ b/Makerules
@@ -313,7 +313,7 @@ S-CPPFLAGS = $(asm-CPPFLAGS)
 define +make-deps
 $(make-target-directory)
 -@rm -f $@
-$(+mkdep) $< $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
+$(+mkdep) $< $(CFLAGS) $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
 sed \
 -e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \
 $(sed-remove-objpfx) > $(@:.d=.T)
diff --git a/config.guess b/config.guess
index da4358892b..a73a8d93c0 100755
--- a/config.guess
+++ b/config.guess
@@ -56,7 +56,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
+	cat <<EOF >dummy.s
+	.globl main
+	.ent main
+main:
+	.frame \$30,0,\$26,0
+	.prologue 0
+	.long 0x47e03d84
+	cmoveq \$4,0,\$3
+	addl \$3,\$31,\$0
+	ret \$31,(\$26),1
+	.end main
+EOF
+	${CC-cc} dummy.s -o dummy 2>/dev/null
+	if test "$?" = 0 ; then
+		./dummy
+		case "$?" in
+			1)
+				UNAME_MACHINE="alphaev5"
+				;;
+			2)
+				UNAME_MACHINE="alphaev56"
+				;;
+		esac
+	fi
+	rm -f dummy.s dummy
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
 	exit 0 ;;
     21064:Windows_NT:50:3)
 	echo alpha-dec-winnt3.5
@@ -457,7 +482,32 @@ EOF
 	esac
 
 	if test "${UNAME_MACHINE}" = "alpha" ; then
-	  echo alpha-unknown-linux-gnu ; exit 0
+		sed 's/^	//'  <<EOF >dummy.s
+		.globl main
+		.ent main
+	main:
+		.frame \$30,0,\$26,0
+		.prologue 0
+		.long 0x47e03d84
+		cmoveq \$4,0,\$3
+		addl \$3,\$31,\$0
+		ret \$31,(\$26),1
+		.end main
+EOF
+		${CC-cc} dummy.s -o dummy 2>/dev/null
+		if test "$?" = 0 ; then
+			./dummy
+			case "$?" in
+				1)
+					UNAME_MACHINE="alphaev5"
+				;;	
+			2)	
+					UNAME_MACHINE="alphaev56"
+				;;	
+		esac	
+	  fi	
+	  rm -f dummy.s dummy
+	  echo ${UNAME_MACHINE}-unknown-linux-gnu ; exit 0
 	elif test "${UNAME_MACHINE}" = "mips" ; then
 	  cat >dummy.c <<EOF
 main(argc, argv)
diff --git a/config.sub b/config.sub
index 3caaa0c088..e3105a7fe5 100755
--- a/config.sub
+++ b/config.sub
@@ -152,9 +152,9 @@ case $basic_machine in
 	tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
 		| arme[lb] | pyramid | mn10200 | mn10300 \
 		| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
-		| alpha | we32k | ns16k | clipper | i370 | sh \
-		| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
-		| pdp11 | mips64el | mips64orion | mips64orionel \
+		| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
+		| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
+		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
 		| sparc | sparclet | sparclite | sparc64)
 		basic_machine=$basic_machine-unknown
 		;;
@@ -172,11 +172,13 @@ case $basic_machine in
 	# Recognize the basic CPU types with company name.
 	vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
 	      | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
-	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
-	      | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
-	      | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
-	      | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
-	      | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
+	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+	      | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
+	      | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
+	      | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
+	      | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
+	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+	      | sparc64-* | mips64-* | mipsel-* \
 	      | mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
 		;;
 	# Recognize the various machine names and aliases which stand
diff --git a/configure b/configure
index 1380a4904e..e2f2b78b1c 100755
--- a/configure
+++ b/configure
@@ -816,6 +816,8 @@ case "$machine" in
 a29k | am29000)	base_machine=a29k machine=a29k ;;
 alpha*)		base_machine=alpha machine=alpha/$machine ;;
 arm*)		base_machine=arm machine=arm/$machine ;;
+c3[012])	base_machine=cx0 machine=cx0/c30 ;;
+c4[04])		base_machine=cx0 machine=cx0/c40 ;;
 hppa*)		base_machine=hppa machine=hppa/$machine ;;
 i[3456]86)	base_machine=i386 machine=i386/$machine ;;
 m680?0)		base_machine=m68k machine=m68k/$machine ;;
@@ -834,7 +836,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:838: checking sysdep dirs" >&5
+echo "configure:840: 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'`"
 
@@ -1035,7 +1037,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:1039: checking for a BSD compatible install" >&5
+echo "configure:1041: 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
@@ -1089,7 +1091,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:1093: checking whether ln -s works" >&5
+echo "configure:1095: 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
@@ -1114,7 +1116,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:1118: checking for $ac_word" >&5
+echo "configure:1120: 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
@@ -1147,7 +1149,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:1151: checking for $ac_word" >&5
+echo "configure:1153: 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
@@ -1176,7 +1178,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:1180: checking for $ac_word" >&5
+echo "configure:1182: 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
@@ -1224,7 +1226,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1228: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1230: 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.
@@ -1234,11 +1236,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 1238 "configure"
+#line 1240 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1244: \"$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
@@ -1261,13 +1263,13 @@ else
  cross_linkable=yes
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1265: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1267: 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:1271: checking whether we are using GNU C" >&5
+echo "configure:1273: 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
@@ -1276,7 +1278,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1280: \"$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:1282: \"$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
@@ -1293,7 +1295,7 @@ if test $ac_cv_prog_gcc = yes; then
   yes;
 #endif
 EOF
-  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1297: \"$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:1299: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
     if test -z "$CFLAGS"; then
       CFLAGS="-g -O2"
     fi
@@ -1305,7 +1307,7 @@ else
 fi
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1309: checking build system type" >&5
+echo "configure:1311: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1328,7 +1330,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:1332: checking for $ac_word" >&5
+echo "configure:1334: 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
@@ -1359,7 +1361,7 @@ done
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1363: checking how to run the C preprocessor" >&5
+echo "configure:1365: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1374,13 +1376,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 1378 "configure"
+#line 1380 "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:1384: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1386: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1391,13 +1393,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1395 "configure"
+#line 1397 "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:1401: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1403: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1428,7 +1430,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:1432: checking for $ac_word" >&5
+echo "configure:1434: 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
@@ -1459,7 +1461,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:1463: checking for $ac_word" >&5
+echo "configure:1465: 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
@@ -1490,7 +1492,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:1494: checking for $ac_word" >&5
+echo "configure:1496: 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
@@ -1525,7 +1527,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:1529: checking for $ac_word" >&5
+echo "configure:1531: 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
@@ -1566,7 +1568,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:1570: checking for $ac_word" >&5
+echo "configure:1572: 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
@@ -1608,7 +1610,7 @@ fi
 
 
 echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:1612: checking for signed size_t type" >&5
+echo "configure:1614: 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
@@ -1632,12 +1634,12 @@ EOF
 fi
 
 echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:1636: checking for libc-friendly stddef.h" >&5
+echo "configure:1638: 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 1641 "configure"
+#line 1643 "configure"
 #include "confdefs.h"
 #define __need_size_t
 #define __need_wchar_t
@@ -1652,7 +1654,7 @@ size_t size; wchar_t wchar;
 if (&size == NULL || &wchar == NULL) abort ();
 ; return 0; }
 EOF
-if { (eval echo configure:1656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_friendly_stddef=yes
 else
@@ -1671,7 +1673,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:1675: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:1677: 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
@@ -1694,7 +1696,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:1698: checking for assembler global-symbol directive" >&5
+echo "configure:1700: 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
@@ -1724,7 +1726,7 @@ EOF
 fi
 
 echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1728: checking for .set assembler directive" >&5
+echo "configure:1730: 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
@@ -1758,7 +1760,7 @@ EOF
 fi
 
 echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:1762: checking for .symver assembler directive" >&5
+echo "configure:1764: 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
@@ -1777,7 +1779,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:1781: checking for ld --version-script" >&5
+echo "configure:1783: 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
@@ -1796,7 +1798,7 @@ EOF
     if { ac_try='${CC-cc} $CFLAGS -shared -o conftest.so conftest.o
 					-nostartfiles -nostdlib
 					-Wl,--version-script,conftest.map
-		       1>&5'; { (eval echo configure:1800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+		       1>&5'; { (eval echo configure:1802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
     then
       libc_cv_ld_version_script_option=yes
     else
@@ -1826,7 +1828,7 @@ fi
 
 if test $elf = yes; then
   echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:1830: checking for .previous assembler directive" >&5
+echo "configure:1832: 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
@@ -1834,7 +1836,7 @@ else
 .section foo_section
 .previous
 EOF
-  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     libc_cv_asm_previous_directive=yes
   else
     libc_cv_asm_previous_directive=no
@@ -1850,7 +1852,7 @@ EOF
 
   else
     echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:1854: checking for .popsection assembler directive" >&5
+echo "configure:1856: 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
@@ -1858,7 +1860,7 @@ else
 .pushsection foo_section
 .popsection
 EOF
-    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
       libc_cv_asm_popsection_directive=yes
     else
       libc_cv_asm_popsection_directive=no
@@ -1878,12 +1880,12 @@ fi
 
 if test $elf != yes; then
   echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1882: checking for .init and .fini sections" >&5
+echo "configure:1884: 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 1887 "configure"
+#line 1889 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1892,7 +1894,7 @@ asm (".section .init");
 				    asm (".text");
 ; return 0; }
 EOF
-if { (eval echo configure:1896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -1917,19 +1919,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:1921: checking for _ prefix on C symbol names" >&5
+echo "configure:1923: 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 1926 "configure"
+#line 1928 "configure"
 #include "confdefs.h"
 asm ("_glibc_foobar:");
 int main() {
 glibc_foobar ();
 ; return 0; }
 EOF
-if { (eval echo configure:1933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   libc_cv_asm_underscores=yes
 else
@@ -1956,7 +1958,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:1960: checking for assembler .weak directive" >&5
+echo "configure:1962: 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
@@ -1979,7 +1981,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:1983: checking for assembler .weakext directive" >&5
+echo "configure:1985: 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
@@ -2016,7 +2018,7 @@ EOF
 fi
 
 echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:2020: checking for ld --no-whole-archive" >&5
+echo "configure:2022: 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
@@ -2027,7 +2029,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -Wl,--no-whole-archive
-			    -o conftest conftest.c 1>&5'; { (eval echo configure:2031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c 1>&5'; { (eval echo configure:2033: \"$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
@@ -2038,7 +2040,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:2042: checking for gcc -fno-exceptions" >&5
+echo "configure:2044: 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
@@ -2049,7 +2051,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -fno-exceptions
-			    -o conftest conftest.c 1>&5'; { (eval echo configure:2053: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c 1>&5'; { (eval echo configure:2055: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_no_exceptions=yes
 else
   libc_cv_gcc_no_exceptions=no
@@ -2101,7 +2103,7 @@ if test "$uname" = "sysdeps/generic"; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:2105: checking OS release for uname" >&5
+echo "configure:2107: 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
@@ -2123,7 +2125,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:2127: checking OS version for uname" >&5
+echo "configure:2129: 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
@@ -2145,7 +2147,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:2149: checking stdio selection" >&5
+echo "configure:2151: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
diff --git a/configure.in b/configure.in
index 3f5a754250..ba8b413452 100644
--- a/configure.in
+++ b/configure.in
@@ -149,6 +149,8 @@ case "$machine" in
 a29k | am29000)	base_machine=a29k machine=a29k ;;
 alpha*)		base_machine=alpha machine=alpha/$machine ;;
 arm*)		base_machine=arm machine=arm/$machine ;;
+c3[012])	base_machine=cx0 machine=cx0/c30 ;;
+c4[04])		base_machine=cx0 machine=cx0/c40 ;;
 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/inet/Makefile b/inet/Makefile
index 847d994478..47570f131c 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -27,7 +27,7 @@ headers	:= netinet/ether.h netinet/in.h netinet/if_ether.h \
 
 distribute := netgroup.h
 
-routines := ntohl ntohs htonl htons		\
+routines := htonl htons		\
 	    inet_lnaof inet_mkadr	\
 	    inet_netof inet_ntoa inet_net herrno \
 	    gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
diff --git a/inet/netinet/in.h b/inet/netinet/in.h
index 33f88064e1..ac0d167287 100644
--- a/inet/netinet/in.h
+++ b/inet/netinet/in.h
@@ -210,9 +210,13 @@ struct ipv6_mreq
    this was a short-sighted decision since on different systems the types
    may have different representations but the values are always the same.  */
 
+extern u_int32_t __ntohl __P ((u_int32_t __netlong));
 extern u_int32_t ntohl __P ((u_int32_t __netlong));
+extern u_int16_t __ntohs __P ((u_int16_t __netshort));
 extern u_int16_t ntohs __P ((u_int16_t __netshort));
+extern u_int32_t __htonl __P ((u_int32_t __hostlong));
 extern u_int32_t htonl __P ((u_int32_t __hostlong));
+extern u_int16_t __htons __P ((u_int16_t __hostshort));
 extern u_int16_t htons __P ((u_int16_t __hostshort));
 
 #include <endian.h>
@@ -220,10 +224,33 @@ extern u_int16_t htons __P ((u_int16_t __hostshort));
 #if __BYTE_ORDER == __BIG_ENDIAN
 /* The host byte order is the same as network byte order,
    so these functions are all just identity.  */
-#define	ntohl(x)	(x)
-#define	ntohs(x)	(x)
-#define	htonl(x)	(x)
-#define	htons(x)	(x)
+# define ntohl(x)	(x)
+# define ntohs(x)	(x)
+# define htonl(x)	(x)
+# define htons(x)	(x)
+#else
+# if __BYTE_ORDER == __LITTLE_ENDIAN && defined __OPTIMIZE__
+#  define ntohl(x)	(__builtin_constant_p (x)			  \
+			 ? __constant_htontohl (x) : __ntohl (x))
+#  define ntohs(x)	(__builtin_constant_p (x)			  \
+			 ? __constant_htontohs (x) : __ntohs (x))
+#  define htonl(x)	(__builtin_constant_p (x)			  \
+			 ? __constant_htontohl (x) : __htonl (x))
+#  define htons(x)	(__builtin_constant_p (x)			  \
+			 ? __constant_htontohl (x) : __htonl (x))
+
+#  define __constant_htontohl(x) \
+	((((x) & 0xff000000) >> 24) | \
+	 (((x) & 0x00ff0000) >>  8) | \
+	 (((x) & 0x0000ff00) <<  8) | \
+	 (((x) & 0x000000ff) << 24))
+#  define __constant_htontohs(x) \
+	((((x) & 0x0000ff00) >>  8) | \
+	 (((x) & 0x000000ff) << 8))
+
+/* Now get machine dependent optimized versions for the real work.  */
+#  include <bits/htontoh.h>
+# endif
 #endif
 
 #define IN6_IS_ADDR_UNSPECIFIED(a) \
diff --git a/libc.map b/libc.map
index fec1c49832..b23a8ff5d3 100644
--- a/libc.map
+++ b/libc.map
@@ -11,6 +11,7 @@ GLIBC_2.0 {
     _nl_current_LC_COLLATE; __collate_element_hash;
     __collate_element_strings; __collate_symbol_classes;
     __collate_symbol_hash; __collate_symbol_strings;
+    _obstack;
 
     # helper functions
     __errno_location; __libc_init_first; __h_errno_location;
@@ -81,7 +82,7 @@ GLIBC_2.0 {
     _IO_str_underflow; _IO_str_init_static; _IO_str_init_readonly;
     _IO_str_seekoff; _IO_str_pbackfail; _IO_list_all; _IO_file_jumps;
     _IO_peekc_locked;
-    _rpc_dtablesize;
+    _rpc_dtablesize; _null_auth; _seterr_reply;
 
     # all functions and variables in the normal name space
     a*; b*; c*; d*; e*; f*; g*; h*; i*; j*; k*; l*; m*;
diff --git a/math/libm-test.c b/math/libm-test.c
index c2103d4a8b..72c09a7b8e 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -134,6 +134,8 @@
 #define PRINT 1
 #define NO_PRINT 0
 
+/* Various constants (we must supply them precalculated for accuracy).  */
+#define M_PI_6  .52359877559829887308L
 
 static int noErrors;
 
@@ -1058,7 +1060,7 @@ cos_test (void)
 		   FUNC(cos) (minus_infty),
 		   INVALID_EXCEPTION);
 
-  check_eps ("cos (pi/3) == 0.5", FUNC(cos) (M_PI / 3.0),
+  check_eps ("cos (pi/3) == 0.5", FUNC(cos) (M_PI_6 * 2.0),
 	     0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
   check_eps ("cos (pi/2) == 0", FUNC(cos) (M_PI_2),
 	     0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
@@ -1711,8 +1713,8 @@ sin_test (void)
 		   FUNC(sin) (minus_infty),
 		   INVALID_EXCEPTION);
 
-  check_eps ("sin (pi/6) == 0.5", FUNC(sin) (M_PI / 6.0), 0.5,
-	     CHOOSE (4e-18L, 0, 0));
+  check_eps ("sin (pi/6) == 0.5", FUNC(sin) (M_PI_6),
+	     0.5,CHOOSE (4e-18L, 0, 0));
   check ("sin (pi/2) == 1", FUNC(sin) (M_PI_2), 1);
 }
 
@@ -1772,11 +1774,11 @@ sincos_test (void)
   check_eps ("sincos (pi/2, &sin, &cos) puts 0 in cos", cos_res, 0,
 	     CHOOSE (1e-18L, 1e-16, 1e-7));
 
-  FUNC(sincos) (M_PI / 6.0, &sin_res, &cos_res);
+  FUNC(sincos) (M_PI_6, &sin_res, &cos_res);
   check_eps ("sincos (pi/6, &sin, &cos) puts 0.5 in sin", sin_res, 0.5,
 	     CHOOSE (5e-18L, 0, 0));
 
-  FUNC(sincos) (M_PI / 3.0, &sin_res, &cos_res);
+  FUNC(sincos) (M_PI_6*2.0, &sin_res, &cos_res);
   check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res, 0.5,
 	     CHOOSE (5e-18L, 1e-15, 1e-7));
 
diff --git a/math/libm.map b/math/libm.map
index aff0ccd73f..2a1aa6cfbe 100644
--- a/math/libm.map
+++ b/math/libm.map
@@ -98,7 +98,6 @@ GLIBC_2.0 {
     fesetenv; fesetexceptflag; fesetround;
     fetestexcept; feupdateenv;
 
-
     # global variables
     _LIB_VERSION; signgam;
 
@@ -109,6 +108,9 @@ GLIBC_2.0 {
 
     __log1p;
 
+    # symbols used in macros from sysdeps/powerpc/bits/fenv.h
+    __fe_dfl_env; __fe_enabled_env; __fe_nonieee_env; __fe_nomask_env;
+
   local:
     *;
 };
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index 59165ea590..9726784b2d 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -218,6 +218,10 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
 
   do
     {
+      char *save_oldkey;
+      int save_oldlen;
+      bool_t save_nis_first;
+
       if (ent->nis_first)
 	{
 	  if (yp_first (domain, "group.byname", &outkey, &outkeylen,
@@ -226,7 +230,9 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
 	      ent->nis = 0;
 	      return NSS_STATUS_UNAVAIL;
 	    }
-
+	  save_oldkey = ent->oldkey;
+	  save_oldlen = ent->oldkeylen;
+	  save_nis_first = TRUE;
 	  ent->oldkey = outkey;
 	  ent->oldkeylen = outkeylen;
 	  ent->nis_first = FALSE;
@@ -241,7 +247,9 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
 	      return NSS_STATUS_NOTFOUND;
 	    }
 
-	  free (ent->oldkey);
+	  save_oldkey = ent->oldkey;
+	  save_oldlen = ent->oldkeylen;
+	  save_nis_first = FALSE;
 	  ent->oldkey = outkey;
 	  ent->oldkeylen = outkeylen;
 	}
@@ -255,8 +263,21 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
       while (isspace (*p))
 	++p;
 
-      parse_res = _nss_files_parse_grent (p, result, data, buflen);
-
+      if ((parse_res = _nss_files_parse_grent (p, result, data, buflen)) == -1)
+	{
+	  free (ent->oldkey);
+	  ent->oldkey = save_oldkey;
+	  ent->oldkeylen = save_oldlen;
+	  ent->nis_first = save_nis_first;
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (!save_nis_first)
+	    free (save_oldkey);
+	}
+      
       if (parse_res &&
 	  in_blacklist (result->gr_name, strlen (result->gr_name), ent))
 	parse_res = 0; /* if result->gr_name in blacklist,search next entry */
@@ -274,8 +295,13 @@ getgrent_next_nisplus (struct group *result, ent_t *ent, char *buffer,
 
   do
     {
+      nis_result *save_oldres;
+      bool_t save_nis_first;
+      
       if (ent->nis_first)
         {
+	  save_oldres = ent->result;
+	  save_nis_first = TRUE;
           ent->result = nis_first_entry(grptable);
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
             {
@@ -288,8 +314,9 @@ getgrent_next_nisplus (struct group *result, ent_t *ent, char *buffer,
         {
           nis_result *res;
 
+	  save_oldres = ent->result;
+	  save_nis_first = FALSE;
           res = nis_next_entry(grptable, &ent->result->cookie);
-          nis_freeresult (ent->result);
           ent->result = res;
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
             {
@@ -297,8 +324,21 @@ getgrent_next_nisplus (struct group *result, ent_t *ent, char *buffer,
 	      return niserr2nss (ent->result->status);
             }
         }
-      parse_res = _nss_nisplus_parse_grent (ent->result, 0, result, buffer,
-                                            buflen);
+      if ((parse_res = _nss_nisplus_parse_grent (ent->result, 0, result, 
+						 buffer, buflen)) == -1)
+	{
+	  nis_freeresult (ent->result);
+	  ent->result = save_oldres;
+	  ent->nis_first = save_nis_first;
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (!save_nis_first)
+	    nis_freeresult (save_oldres);
+	}
+
       if (parse_res &&
           in_blacklist (result->gr_name, strlen (result->gr_name), ent))
         parse_res = 0; /* if result->gr_name in blacklist,search next entry */
@@ -330,7 +370,13 @@ getgrent_next_file_plusgroup (struct group *result, char *buffer,
           nis_freeresult (res);
           return status;
         }
-      parse_res = _nss_nisplus_parse_grent (res, 0, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_grent (res, 0, result, buffer, 
+						 buflen)) == -1)
+	{
+	  __set_errno (ERANGE);
+	  nis_freeresult (res);
+	  return NSS_STATUS_TRYAGAIN;
+	}
       nis_freeresult (res);
     }
   else /* Use NIS */
@@ -350,7 +396,11 @@ getgrent_next_file_plusgroup (struct group *result, char *buffer,
       free (outval);
       while (isspace (*p))
         p++;
-      parse_res = _nss_files_parse_grent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_grent (p, result, data, buflen)) == -1)
+	{
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
     }
 
   if (parse_res)
@@ -368,13 +418,24 @@ getgrent_next_file (struct group *result, ent_t *ent,
   struct parser_data *data = (void *) buffer;
   while (1)
     {
+      fpos_t pos;
+      int parse_res = 0;
       char *p;
 
       do
 	{
+	  fgetpos (ent->stream, &pos);
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL)
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      if (feof (ent->stream))
+		return NSS_STATUS_NOTFOUND;
+	      else
+		{
+		  __set_errno (ERANGE);
+		  return NSS_STATUS_TRYAGAIN;
+		}
+	    }
 
 	  /* Terminate the line for any case.  */
 	  buffer[buflen - 1] = '\0';
@@ -383,11 +444,18 @@ getgrent_next_file (struct group *result, ent_t *ent,
 	  while (isspace (*p))
 	    ++p;
 	}
-      /* Ignore empty and comment lines.  */
-      while (*p == '\0' || *p == '#' ||
+      while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
       /* Parse the line.  If it is invalid, loop to
          get the next line of the file to parse.  */
-	     !_nss_files_parse_grent (p, result, data, buflen));
+	     !(parse_res = _nss_files_parse_grent (p, result, data, buflen)));
+
+      if (parse_res == -1)
+	{
+	  /* The parser ran out of space.  */
+	  fsetpos (ent->stream, &pos);
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
 
       if (result->gr_name[0] != '+' && result->gr_name[0] != '-')
 	/* This is a real entry.  */
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index 0d0f2a6c33..af1267922c 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -272,6 +272,9 @@ internal_endpwent (ent_t *ent)
       ent->stream = NULL;
     }
 
+  if (ent->netgroup)
+    __internal_endnetgrent (&ent->netgrdata);
+  
   ent->nis = ent->first = ent->netgroup = 0;
 
   if (ent->oldkey != NULL)
@@ -303,9 +306,6 @@ _nss_compat_endpwent (void)
 
   __libc_lock_lock (lock);
 
-  if (ext_ent.netgroup)
-    __internal_endnetgrent (&ext_ent.netgrdata);
-
   result = internal_endpwent (&ext_ent);
 
   __libc_lock_unlock (lock);
@@ -339,6 +339,10 @@ getpwent_next_nis_netgr (struct passwd *result, ent_t *ent, char *group,
 
   while (1)
     {
+      char *saved_cursor;
+      int parse_res;
+
+      saved_cursor = ent->netgrdata.cursor;
       status = __internal_getnetgrent_r (&host, &user, &domain,
 					 &ent->netgrdata, buffer, buflen);
       if (status != 1)
@@ -372,7 +376,13 @@ getpwent_next_nis_netgr (struct passwd *result, ent_t *ent, char *group,
       while (isspace (*p))
 	p++;
       free (outval);
-      if (_nss_files_parse_pwent (p, result, data, buflen))
+      if ((parse_res = _nss_files_parse_pwent (p, result, data, buflen)) == -1)
+	{
+	  ent->netgrdata.cursor = saved_cursor;
+	  return NSS_STATUS_TRYAGAIN;
+	}
+
+      if (parse_res)
 	{
 	  copy_pwd_changes (result, &ent->pwd, p2, p2len);
 	  break;
@@ -410,6 +420,9 @@ getpwent_next_nisplus_netgr (struct passwd *result, ent_t *ent, char *group,
 
   while (1)
     {
+      char *saved_cursor;
+
+      saved_cursor = ent->netgrdata.cursor;
       status = __internal_getnetgrent_r (&host, &user, &domain,
 					 &ent->netgrdata, buffer, buflen);
       if (status != 1)
@@ -419,13 +432,13 @@ getpwent_next_nisplus_netgr (struct passwd *result, ent_t *ent, char *group,
 	  give_pwd_free (&ent->pwd);
 	  return NSS_STATUS_RETURN;
 	}
-
+      
       if (user == NULL || user[0] == '-')
 	continue;
-
+      
       if (domain != NULL && strcmp (ypdomain, domain) != 0)
 	continue;
-
+      
       p2len = pwd_need_buflen (&ent->pwd);
       if (p2len > buflen)
 	{
@@ -444,7 +457,13 @@ getpwent_next_nisplus_netgr (struct passwd *result, ent_t *ent, char *group,
 	  nis_freeresult (nisres);
 	  continue;
 	}
-      parse_res = _nss_nisplus_parse_pwent (nisres, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_pwent (nisres, result, buffer, 
+						 buflen)) == -1)
+	{
+	  nis_freeresult (nisres);
+	  ent->netgrdata.cursor = saved_cursor;
+	  return NSS_STATUS_TRYAGAIN;
+	}
       nis_freeresult (nisres);
 
       if (parse_res)
@@ -485,8 +504,14 @@ getpwent_next_nisplus (struct passwd *result, ent_t *ent, char *buffer,
   buflen -= p2len;
   do
     {
+      bool_t saved_first;
+      nis_result *saved_res;
+
       if (ent->first)
 	{
+	  saved_first = TRUE;
+	  saved_res = ent->result;
+
 	  ent->result = nis_first_entry(pwdtable);
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
 	    {
@@ -501,17 +526,32 @@ getpwent_next_nisplus (struct passwd *result, ent_t *ent, char *buffer,
 	  nis_result *res;
 
 	  res = nis_next_entry(pwdtable, &ent->result->cookie);
-	  nis_freeresult (ent->result);
+	  saved_res = ent->result;
+	  saved_first = FALSE;
 	  ent->result = res;
 	  if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
 	    {
 	      ent->nis = 0;
+	      nis_freeresult (saved_res);
 	      give_pwd_free (&ent->pwd);
 	      return niserr2nss (ent->result->status);
 	    }
 	}
-      parse_res = _nss_nisplus_parse_pwent (ent->result, result, buffer,
-					    buflen);
+      if ((parse_res = _nss_nisplus_parse_pwent (ent->result, result, buffer,
+						 buflen)) == -1)
+	{
+	  nis_freeresult (ent->result);
+	  ent->result = saved_res;
+	  ent->first = saved_first;
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (!saved_first)
+	    nis_freeresult (saved_res);
+	}
+      
       if (parse_res &&
 	  in_blacklist (result->pw_name, strlen (result->pw_name), ent))
 	parse_res = 0; /* if result->pw_name in blacklist,search next entry */
@@ -549,6 +589,10 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
   buflen -= p2len;
   do
     {
+      bool_t saved_first;
+      char *saved_oldkey;
+      int saved_oldlen;
+      
       if (ent->first)
 	{
 	  if (yp_first (domain, "passwd.byname", &outkey, &outkeylen,
@@ -558,7 +602,10 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
 	      give_pwd_free (&ent->pwd);
 	      return NSS_STATUS_UNAVAIL;
 	    }
-
+	  
+	  saved_first = TRUE;
+	  saved_oldkey = ent->oldkey;
+	  saved_oldlen = ent->oldkeylen;
 	  ent->oldkey = outkey;
 	  ent->oldkeylen = outkeylen;
 	  ent->first = FALSE;
@@ -574,7 +621,9 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
 	      return NSS_STATUS_NOTFOUND;
 	    }
 
-	  free (ent->oldkey);
+	  saved_first = FALSE;
+	  saved_oldkey = ent->oldkey;
+	  saved_oldlen = ent->oldkeylen;
 	  ent->oldkey = outkey;
 	  ent->oldkeylen = outkeylen;
 	}
@@ -587,7 +636,20 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
 
       while (isspace (*p))
 	++p;
-      parse_res = _nss_files_parse_pwent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_pwent (p, result, data, buflen)) == -1)
+	{
+	  free (ent->oldkey);
+	  ent->oldkey = saved_oldkey;
+	  ent->oldkeylen = saved_oldlen;
+	  ent->first = saved_first;
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (!saved_first)
+	    free (saved_oldkey);
+	}
       if (parse_res &&
 	  in_blacklist (result->pw_name, strlen (result->pw_name), ent))
 	parse_res = 0;
@@ -637,7 +699,13 @@ getpwent_next_file_plususer (struct passwd *result, char *buffer,
 	  nis_freeresult (res);
 	  return status;
 	}
-      parse_res = _nss_nisplus_parse_pwent (res, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_pwent (res, result, buffer, 
+						 buflen)) == -1)
+	{
+	  nis_freeresult (res);
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
       nis_freeresult (res);
     }
   else /* Use NIS */
@@ -645,10 +713,10 @@ getpwent_next_file_plususer (struct passwd *result, char *buffer,
       char *domain;
       char *outval;
       int outvallen;
-
+      
       if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
 	return NSS_STATUS_TRYAGAIN;
-
+      
       if (yp_match (domain, "passwd.byname", &result->pw_name[1],
 		    strlen (result->pw_name) - 1, &outval, &outvallen)
 	  != YPERR_SUCCESS)
@@ -658,10 +726,14 @@ getpwent_next_file_plususer (struct passwd *result, char *buffer,
       free (outval);
       while (isspace (*p))
 	p++;
-      parse_res = _nss_files_parse_pwent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_pwent (p, result, data, buflen)) == -1)
+	{
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
     }
 
-  if (parse_res)
+  if (parse_res > 0)
     {
       copy_pwd_changes (result, &pwd, p, plen);
       give_pwd_free (&pwd);
@@ -684,10 +756,13 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
   struct parser_data *data = (void *) buffer;
   while (1)
     {
+      fpos_t pos;
       char *p;
+      int parse_res;
 
       do
 	{
+	  fgetpos (ent->stream, &pos);
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL)
 	    return NSS_STATUS_NOTFOUND;
@@ -702,7 +777,15 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
       while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines.  */
       /* Parse the line.  If it is invalid, loop to
          get the next line of the file to parse.  */
-	     !_nss_files_parse_pwent (p, result, data, buflen));
+	     !(parse_res = _nss_files_parse_pwent (p, result, data, buflen)));
+
+      if (parse_res == -1)
+	{
+	  /* The parser ran out of space.  */
+	  fsetpos (ent->stream, &pos);
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
 
       if (result->pw_name[0] != '+' && result->pw_name[0] != '-')
 	/* This is a real entry.  */
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 4199baf202..61a703c1ea 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -292,6 +292,10 @@ getspent_next_nis_netgr (struct spwd *result, ent_t *ent, char *group,
 
   while (1)
     {
+      char *saved_cursor;
+      int parse_res;
+
+      saved_cursor = ent->netgrdata.cursor;
       status = __internal_getnetgrent_r (&host, &user, &domain,
 					 &ent->netgrdata, buffer, buflen);
       if (status != 1)
@@ -301,10 +305,10 @@ getspent_next_nis_netgr (struct spwd *result, ent_t *ent, char *group,
 	  give_spwd_free (&ent->pwd);
 	  return NSS_STATUS_RETURN;
 	}
-
+      
       if (user == NULL || user[0] == '-')
 	continue;
-
+      
       if (domain != NULL && strcmp (ypdomain, domain) != 0)
 	continue;
 
@@ -325,7 +329,13 @@ getspent_next_nis_netgr (struct spwd *result, ent_t *ent, char *group,
       while (isspace (*p))
 	p++;
       free (outval);
-      if (_nss_files_parse_spent (p, result, data, buflen))
+      if ((parse_res = _nss_files_parse_spent (p, result, data, buflen)) == -1)
+	{
+	  ent->netgrdata.cursor = saved_cursor;
+	  return NSS_STATUS_TRYAGAIN;
+	}
+
+      if (parse_res)
 	{
 	  copy_spwd_changes (result, &ent->pwd, p2, p2len);
 	  break;
@@ -363,6 +373,9 @@ getspent_next_nisplus_netgr (struct spwd *result, ent_t *ent, char *group,
 
   while (1)
     {
+      char *saved_cursor;
+
+      saved_cursor = ent->netgrdata.cursor;
       status = __internal_getnetgrent_r (&host, &user, &domain,
                                          &ent->netgrdata, buffer, buflen);
       if (status != 1)
@@ -397,7 +410,12 @@ getspent_next_nisplus_netgr (struct spwd *result, ent_t *ent, char *group,
           nis_freeresult (nisres);
           continue;
         }
-      parse_res = _nss_nisplus_parse_spent (nisres, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_spent (nisres, result, buffer,
+						 buflen)) == -1)
+	{
+	  nis_freeresult (nisres);
+	  return NSS_STATUS_TRYAGAIN;
+	}
       nis_freeresult (nisres);
 
       if (parse_res)
@@ -438,8 +456,14 @@ getspent_next_nisplus (struct spwd *result, ent_t *ent, char *buffer,
   buflen -= p2len;
   do
     {
+      bool_t saved_first;
+      nis_result *saved_res;
+
       if (ent->first)
         {
+	  saved_first = TRUE;
+	  saved_res = ent->result;
+
           ent->result = nis_first_entry(pwdtable);
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
             {
@@ -453,18 +477,33 @@ getspent_next_nisplus (struct spwd *result, ent_t *ent, char *buffer,
         {
           nis_result *res;
 
+	  saved_first = FALSE;
+	  saved_res = ent->result;
+
           res = nis_next_entry(pwdtable, &ent->result->cookie);
-          nis_freeresult (ent->result);
           ent->result = res;
           if (niserr2nss (ent->result->status) != NSS_STATUS_SUCCESS)
             {
+	      nis_freeresult (saved_res);
 	      ent->nis = 0;
 	      give_spwd_free (&ent->pwd);
 	      return niserr2nss (ent->result->status);
             }
         }
-      parse_res = _nss_nisplus_parse_spent (ent->result, result, buffer,
-                                            buflen);
+      if ((parse_res = _nss_nisplus_parse_spent (ent->result, result, buffer,
+						 buflen)) == -1)
+	{
+	  ent->first = saved_first;
+	  nis_freeresult (ent->result);
+	  ent->result = saved_res;
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (!saved_first)
+	    nis_freeresult (saved_res);
+	}
       if (parse_res &&
           in_blacklist (result->sp_namp, strlen (result->sp_namp), ent))
         parse_res = 0; /* if result->pw_name in blacklist,search next entry */
@@ -503,6 +542,10 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
   buflen -= p2len;
   do
     {
+      bool_t saved_first;
+      char *saved_oldkey;
+      int saved_oldlen;
+
       if (ent->first)
 	{
 	  if (yp_first (domain, "shadow.byname", &outkey, &outkeylen,
@@ -512,7 +555,9 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
 	      give_spwd_free (&ent->pwd);
 	      return NSS_STATUS_UNAVAIL;
 	    }
-
+	  saved_first = TRUE;
+	  saved_oldkey = ent->oldkey;
+	  saved_oldlen = ent->oldkeylen;
 	  ent->oldkey = outkey;
 	  ent->oldkeylen = outkeylen;
 	  ent->first = FALSE;
@@ -528,7 +573,9 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
 	      return NSS_STATUS_NOTFOUND;
 	    }
 
-	  free (ent->oldkey);
+	  saved_first = FALSE;
+	  saved_oldkey = ent->oldkey;
+	  saved_oldlen = ent->oldkeylen;
 	  ent->oldkey = outkey;
 	  ent->oldkeylen = outkeylen;
 	}
@@ -541,7 +588,20 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
 
       while (isspace (*p))
 	++p;
-      parse_res = _nss_files_parse_spent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_spent (p, result, data, buflen)) == -1)
+	{
+	  free (ent->oldkey);
+	  ent->oldkey = saved_oldkey;
+	  ent->oldkeylen = saved_oldlen;
+	  ent->first = saved_first;
+	  __set_errno (ERANGE);
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (!saved_first)
+	    free (saved_oldkey);
+	}
       if (parse_res &&
           in_blacklist (result->sp_namp, strlen (result->sp_namp), ent))
         parse_res = 0;
@@ -591,7 +651,12 @@ getspent_next_file_plususer (struct spwd *result, char *buffer,
           nis_freeresult (res);
           return status;
         }
-      parse_res = _nss_nisplus_parse_spent (res, result, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_spent (res, result, buffer, 
+						 buflen)) == -1)
+	{
+	  nis_freeresult (res);
+	  return NSS_STATUS_TRYAGAIN;
+	}
       nis_freeresult (res);
     }
   else /* Use NIS */
@@ -612,7 +677,8 @@ getspent_next_file_plususer (struct spwd *result, char *buffer,
       free (outval);
       while (isspace (*p))
         p++;
-      parse_res = _nss_files_parse_spent (p, result, data, buflen);
+      if ((parse_res = _nss_files_parse_spent (p, result, data, buflen)) == -1)
+	return NSS_STATUS_TRYAGAIN;
     }
 
   if (parse_res)
@@ -638,10 +704,13 @@ getspent_next_file (struct spwd *result, ent_t *ent,
   struct parser_data *data = (void *) buffer;
   while (1)
     {
+      fpos_t pos;
+      int parse_res = 0;
       char *p;
 
       do
 	{
+	  fgetpos (ent->stream, &pos);
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL)
 	    return NSS_STATUS_NOTFOUND;
@@ -656,8 +725,17 @@ getspent_next_file (struct spwd *result, ent_t *ent,
       while (*p == '\0' || *p == '#'	/* Ignore empty and comment lines.  */
       /* Parse the line.  If it is invalid, loop to
          get the next line of the file to parse.  */
-	     || !_nss_files_parse_spent (p, result, data, buflen));
+	     || !(parse_res = _nss_files_parse_spent (p, result, data,
+						      buflen)));
 
+      if (parse_res == -1)
+        {
+          /* The parser ran out of space.  */
+          fsetpos (ent->stream, &pos);
+          __set_errno (ERANGE);
+          return NSS_STATUS_TRYAGAIN;
+        }
+      
       if (result->sp_namp[0] != '+' && result->sp_namp[0] != '-')
 	/* This is a real entry.  */
 	break;
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c
index 80c49ff5dd..e187716bb0 100644
--- a/nis/nss_nis/nis-alias.c
+++ b/nis/nss_nis/nis-alias.c
@@ -184,9 +184,10 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
         ++p;
       free (result);
 
-      parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer, buflen);
-      if (parse_res == -1)
+      if ((parse_res = _nss_nis_parse_aliasent (outkey, p, alias, 
+						buffer, buflen)) == -1)
 	{
+	  free (outkey);
 	  __set_errno (ERANGE);
 	  return NSS_STATUS_TRYAGAIN;
 	}
@@ -258,12 +259,12 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
   free (result);
 
   alias->alias_local = 0;
-  parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen);
-  if (parse_res == -1)
+  if ((parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, 
+					    buflen)) == -1)
     return NSS_STATUS_TRYAGAIN;
+  
+  if (parse_res)
+    return NSS_STATUS_SUCCESS;
   else
-    if (parse_res == 0)
-      return NSS_STATUS_NOTFOUND;
-    else
-      return NSS_STATUS_SUCCESS;
+    return NSS_STATUS_NOTFOUND;
 }
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index 149910bfab..e54262409c 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -159,17 +159,16 @@ internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen)
       if (next == NULL)
 	return NSS_STATUS_NOTFOUND;
       p = strcpy (buffer, next->val);
-      next = next->next;
 
       while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
-      if (!parse_res && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
+      if ((parse_res = _nss_files_parse_etherent (p, eth, data, buflen)) == -1)
+	return NSS_STATUS_TRYAGAIN;
+      next = next->next;
     }
   while (!parse_res);
-
+  
   return NSS_STATUS_SUCCESS;
 }
 
@@ -228,15 +227,11 @@ _nss_nis_gethostton_r (const char *name, struct ether *eth,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
+  if ((parse_res = _nss_files_parse_etherent (p, eth, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
   if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
+    return NSS_STATUS_NOTFOUND;
   else
     return NSS_STATUS_SUCCESS;
 }
@@ -291,15 +286,11 @@ _nss_nis_getntohost_r (struct ether_addr *addr, struct ether *eth,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
+  if ((parse_res = _nss_files_parse_etherent (p, eth, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
   if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
+    return NSS_STATUS_NOTFOUND;
   else
     return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index 9577499670..7897e21881 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -121,9 +121,11 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen)
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_grent (p, grp, data, buflen);
-      if (parse_res < 1 && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
+      if ((parse_res = _nss_files_parse_grent (p, grp, data, buflen)) == -1)
+	{
+	  free (outkey);
+	  return NSS_STATUS_TRYAGAIN;
+	}
 
       free (oldkey);
       oldkey = outkey;
@@ -190,17 +192,13 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_grent (p, grp, data, buflen);
+  if ((parse_res = _nss_files_parse_grent (p, grp, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (parse_res < 1)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
 
 enum nss_status
@@ -241,15 +239,11 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_grent (p, grp, data, buflen);
+  if ((parse_res = _nss_files_parse_grent (p, grp, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (parse_res < 1)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index d26b4f5ccc..da7cef5ada 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -199,9 +199,9 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
 	++p;
       free (result);
 
-      parse_res = parse_line (p, host, data, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = parse_line (p, host, data, buflen)) == -1)
 	{
+	  free (outkey);
 	  *h_errnop = NETDB_INTERNAL;;
 	  return NSS_STATUS_TRYAGAIN;
 	}
@@ -287,9 +287,9 @@ _nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host,
 
   parse_res = parse_line (p, host, data, buflen);
 
-  if (!parse_res || host->h_addrtype != af)
+  if (parse_res < 1 || host->h_addrtype != af)
     {
-      if (!parse_res && errno == ERANGE)
+      if (parse_res == -1)
 	{
 	  *h_errnop = NETDB_INTERNAL;
 	  return NSS_STATUS_TRYAGAIN;
@@ -377,10 +377,9 @@ _nss_nis_gethostbyaddr_r (char *addr, int addrlen, int type,
   free (result);
 
   parse_res = parse_line (p, host, data, buflen);
-
-  if (!parse_res)
+  if (parse_res < 1)
     {
-      if (errno == ERANGE)
+      if (parse_res == -1)
 	{
 	  *h_errnop = NETDB_INTERNAL;
 	  return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index 284e479401..c17ba81a62 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -126,9 +126,9 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_netent (p, net, data, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_files_parse_netent (p, net, data, buflen)) == -1)
 	{
+	  free (outkey);
 	  *herrnop = NETDB_INTERNAL;
 	  return NSS_STATUS_TRYAGAIN;
 	}
@@ -206,10 +206,10 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net,
 
   parse_res = _nss_files_parse_netent (p, net, data, buflen);
 
-  if (!parse_res)
+  if (parse_res < 1)
     {
       *herrnop = NETDB_INTERNAL;
-      if (errno == ERANGE)
+      if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
         return NSS_STATUS_NOTFOUND;
@@ -286,10 +286,10 @@ _nss_nis_getnetbyaddr_r (unsigned long addr, int type, struct netent *net,
 	parse_res = _nss_files_parse_netent (p, net, data, buflen);
 
 
-	if (!parse_res)
+	if (parse_res < 1)
 	  {
 	    *herrnop = NETDB_INTERNAL;
-	    if (errno == ERANGE)
+	    if (parse_res == -1)
 	      return NSS_STATUS_TRYAGAIN;
 	    else
 	      return NSS_STATUS_NOTFOUND;
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index ceed40e036..eb09bb4ec7 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -152,17 +152,17 @@ internal_nis_getprotoent_r (struct protoent *proto,
       if (next == NULL)
         return NSS_STATUS_NOTFOUND;
       p = strcpy (buffer, next->val);
-      next = next->next;
 
       while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_files_parse_protoent (p, proto, data, 
+						  buflen)) == -1)
         return NSS_STATUS_TRYAGAIN;
+      next = next->next;
     }
   while (!parse_res);
-
+  
   return NSS_STATUS_SUCCESS;
 }
 
@@ -221,17 +221,13 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
+  if ((parse_res = _nss_files_parse_protoent (p, proto, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
 
 enum nss_status
@@ -272,15 +268,11 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
+  if ((parse_res = _nss_files_parse_protoent (p, proto, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index 39c2948b65..f693db17ea 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -121,16 +121,18 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen)
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_pwent (p, pwd, data, buflen);
-      if (!parse_res && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
+      if ((parse_res = _nss_files_parse_pwent (p, pwd, data, buflen)) == -1)
+	{
+	  free (outkey);
+	  return NSS_STATUS_TRYAGAIN;
+	}
 
       free (oldkey);
       oldkey = outkey;
       oldkeylen = keylen;
       new_start = 0;
     }
-  while (!parse_res);
+  while (parse_res < 1);
 
   return NSS_STATUS_SUCCESS;
 }
@@ -192,9 +194,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
 
   parse_res = _nss_files_parse_pwent (p, pwd, data, buflen);
 
-  if (!parse_res)
+  if (parse_res < 1)
     {
-      if (errno == ERANGE)
+      if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
       else
         return NSS_STATUS_NOTFOUND;
@@ -243,9 +245,9 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
 
   parse_res = _nss_files_parse_pwent (p, pwd, data, buflen);
 
-  if (!parse_res)
+  if (parse_res < 1)
     {
-      if (errno == ERANGE)
+      if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
       else
         return NSS_STATUS_NOTFOUND;
diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c
index 073284865e..cd1f0db9b5 100644
--- a/nis/nss_nis/nis-rpc.c
+++ b/nis/nss_nis/nis-rpc.c
@@ -169,13 +169,12 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
       if (data->next == NULL)
         return NSS_STATUS_NOTFOUND;
       p = strcpy (buffer, data->next->val);
-      data->next = data->next->next;
       while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen)) == -1)
 	return NSS_STATUS_TRYAGAIN;
+      data->next = data->next->next;
     }
   while (!parse_res);
 
@@ -286,9 +285,9 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
 
   parse_res = _nss_files_parse_rpcent (p, rpc, data, buflen);
 
-  if (!parse_res)
+  if (parse_res < 1)
     {
-      if (errno == ERANGE)
+      if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
 	return NSS_STATUS_NOTFOUND;
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index 054bc33169..5ec89c8677 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -169,13 +169,13 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
       if (data->next == NULL)
 	return NSS_STATUS_NOTFOUND;
       p = strcpy (buffer, data->next->val);
-      data->next = data->next->next;
-      while (isspace (*p))
+           while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_servent (p, serv, buffer, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_files_parse_servent (p, serv, buffer, 
+						 buflen)) == -1)
         return NSS_STATUS_TRYAGAIN;
+      data->next = data->next->next;
     }
   while (!parse_res);
 
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index 21221fd7e5..0263f4e313 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -121,10 +121,12 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen)
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_spent (p, sp, data, buflen);
-      if (!parse_res && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-
+      if ((parse_res = _nss_files_parse_spent (p, sp, data, buflen)) == -1)
+	{
+	  free (outkey);
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      
       free (oldkey);
       oldkey = outkey;
       oldkeylen = keylen;
@@ -190,15 +192,11 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_spent (p, sp, data, buflen);
+  if ((parse_res = _nss_files_parse_spent (p, sp, data, buflen)) == -1)
+    return NSS_STATUS_TRYAGAIN;
 
-  if (!parse_res)
-    {
-      if (errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
-    }
-  else
+  if (parse_res)
     return NSS_STATUS_SUCCESS;
+  else
+    return NSS_STATUS_NOTFOUND;
 }
diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index 660ba3c34a..0a16b3890f 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -87,7 +87,7 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
 	  /* The line is too long for our buffer.  */
 	no_more_room:
 	  __set_errno (ERANGE);
-	  return 0;
+	  return -1;
 	}
       else
 	{
@@ -214,8 +214,10 @@ internal_nisplus_getaliasent_r (struct aliasent *alias,
       if (next_entry >= result->objects.objects_len)
 	return NSS_STATUS_NOTFOUND;
 
-      parse_res = _nss_nisplus_parse_aliasent (result, next_entry, alias,
-					       buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_aliasent (result, next_entry, alias,
+						    buffer, buflen)) == -1)
+	return NSS_STATUS_TRYAGAIN;
+
       ++next_entry;
     } while (!parse_res);
 
@@ -247,9 +249,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
     if (_nss_create_tablename() != NSS_STATUS_SUCCESS)
       return NSS_STATUS_UNAVAIL;
 
-  if (name == NULL || strlen(name) > 8)
-    return NSS_STATUS_NOTFOUND;
-  else
+  if (name != NULL || strlen(name) <= 8)
     {
       nis_result *result;
       char buf[strlen (name) + 30 + tablename_len];
@@ -261,15 +261,12 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
       if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
 	return niserr2nss (result->status);
 
-      parse_res = _nss_nisplus_parse_aliasent (result, 0, alias,
-					       buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_aliasent (result, 0, alias,
+						    buffer, buflen)) == -1)
+	return NSS_STATUS_TRYAGAIN;
 
       if (parse_res)
 	return NSS_STATUS_SUCCESS;
-
-      if (!parse_res && errno == ERANGE)
-	return NSS_STATUS_TRYAGAIN;
-      else
-	return NSS_STATUS_NOTFOUND;
     }
+  return NSS_STATUS_NOTFOUND;
 }
diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c
index 7c07833ef4..d7c3720932 100644
--- a/nis/nss_nisplus/nisplus-ethers.c
+++ b/nis/nss_nisplus/nisplus-ethers.c
@@ -74,7 +74,7 @@ _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
   if (NISENTRYLEN (0, 0, result) +1 > room_left)
     {
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
   strncpy (p, NISENTRYVAL (0, 0, result), NISENTRYLEN (0, 0, result));
   room_left -= (NISENTRYLEN (0, 0, result) +1);
@@ -152,8 +152,11 @@ internal_nisplus_getetherent_r (struct etherent *ether, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_result;
+      
       if (result == NULL)
 	{
+	  saved_result = NULL;
 	  result = nis_first_entry(tablename_val);
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
 	    return niserr2nss (result->status);
@@ -163,13 +166,28 @@ internal_nisplus_getetherent_r (struct etherent *ether, char *buffer,
 	  nis_result *res2;
 
 	  res2 = nis_next_entry(tablename_val, &result->cookie);
-	  nis_freeresult (result);
+	  saved_result = result;
 	  result = res2;
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-	    return niserr2nss (result->status);
+	    {
+	      nis_freeresult (saved_result);
+	      return niserr2nss (result->status);
+	    }
 	}
 
-      parse_res = _nss_nisplus_parse_etherent (result, ether, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_etherent (result, ether, buffer, 
+						    buflen)) == -1)
+	{
+	  nis_freeresult (result);
+	  result = saved_result;
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (saved_result != NULL)
+	    nis_freeresult (saved_result);
+	}
+      
     } while (!parse_res);
 
   return NSS_STATUS_SUCCESS;
@@ -200,9 +218,7 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
     if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
       return NSS_STATUS_UNAVAIL;
 
-  if (name == NULL)
-    return NSS_STATUS_NOTFOUND;
-  else
+  if (name != NULL)
     {
       nis_result *result;
       char buf[strlen (name) + 40 + tablename_len];
@@ -212,18 +228,23 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
       result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
 
       if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-        return niserr2nss (result->status);
-
-      parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, buflen);
-
+	{
+	  enum nss_status status = niserr2nss (result->status);
+	  nis_freeresult (result);
+	  return status;
+	}
+      
+      if ((parse_res = _nss_nisplus_parse_etherent (result, eth, buffer,
+						    buflen)) == -1)
+	{
+	  nis_freeresult (result);
+	  return NSS_STATUS_TRYAGAIN;
+	}
+	  
       if (parse_res)
         return NSS_STATUS_SUCCESS;
-
-      if (!parse_res && errno == ERANGE)
-        return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
     }
+  return NSS_STATUS_NOTFOUND;
 }
 
 enum nss_status
@@ -255,16 +276,22 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr,
       result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
 
       if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-	return niserr2nss (result->status);
-
-      parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, buflen);
+	{
+	  enum nss_status status = niserr2nss (result->status);
+	  nis_freeresult (result);
+	  return status;
+	}
 
+      if ((parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, 
+						    buflen)) == -1)
+	{
+	  nis_freeresult (result);
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      
       if (parse_res)
 	return NSS_STATUS_SUCCESS;
-
-      if (!parse_res && errno == ERANGE)
-	return NSS_STATUS_TRYAGAIN;
-      else
-	return NSS_STATUS_NOTFOUND;
     }
+  return NSS_STATUS_NOTFOUND;
 }
+
diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c
index f759f61ca0..08e9e040fe 100644
--- a/nis/nss_nisplus/nisplus-grp.c
+++ b/nis/nss_nisplus/nisplus-grp.c
@@ -117,8 +117,10 @@ internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen)
       if (next_entry >= result->objects.objects_len)
 	return NSS_STATUS_NOTFOUND;
 
-      parse_res = _nss_nisplus_parse_grent (result, next_entry, gr,
-					    buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_grent (result, next_entry, gr,
+						 buffer, buflen)) == -1)
+	return NSS_STATUS_TRYAGAIN;
+
       ++next_entry;
     }
   while (!parse_res);
@@ -170,16 +172,14 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr,
 	}
 
       parse_res = _nss_nisplus_parse_grent (result, 0, gr, buffer, buflen);
-
       nis_freeresult (result);
 
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
       if (parse_res)
 	return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-	return NSS_STATUS_TRYAGAIN;
-      else
-	return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -212,12 +212,12 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
 
     nis_freeresult (result);
 
+    if (parse_res == -1)
+      return NSS_STATUS_TRYAGAIN;
+
     if (parse_res)
       return NSS_STATUS_SUCCESS;
 
-    if (!parse_res && errno == ERANGE)
-      return NSS_STATUS_TRYAGAIN;
-    else
-      return NSS_STATUS_NOTFOUND;
+    return NSS_STATUS_NOTFOUND;
   }
 }
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index d4dda5964e..10f939e341 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -66,8 +66,9 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
 
   if (room_left < NISENTRYLEN (0, 2, result) + 1)
     {
+    no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   data = first_unused;
@@ -96,10 +97,8 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
   room_left-=host->h_length;
 
   if (NISENTRYLEN (0, 0, result) + 1 > room_left)
-    {
-      __set_errno (ERANGE);
-      return 0;
-    }
+    goto no_more_room;
+  
   p = stpncpy (first_unused, NISENTRYVAL (0, 0, result),
 	       NISENTRYLEN (0, 0, result));
   *p = '\0';
@@ -114,10 +113,8 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
       if (strcmp (NISENTRYVAL (i, 1, result), host->h_name) != 0)
 	{
 	  if (NISENTRYLEN (i, 1, result) + 2 > room_left)
-	    {
-	      __set_errno (ERANGE);
-	      return 0;
-	    }
+	    goto no_more_room;
+	  
 	  *p++ = ' ';
 	  p = stpncpy (p, NISENTRYVAL (i, 1, result),
 		       NISENTRYLEN (i, 1, result));
@@ -133,10 +130,8 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
   first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
   host->h_addr_list = (char **) first_unused;
   if (room_left < 2 * sizeof (char *))
-    {
-      __set_errno (ERANGE);
-      return 0;
-    }
+    goto no_more_room;
+  
   room_left -= (2 * sizeof (char *));
   host->h_addr_list[0] = data;
   host->h_addr_list[1] = NULL;
@@ -154,10 +149,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
 	break;
 
       if (room_left < sizeof (char *))
-	{
-	  __set_errno (ERANGE);
-	  return 0;
-	}
+	goto no_more_room;
 
       room_left -= sizeof (char *);
       host->h_aliases[i] = line;
@@ -174,9 +166,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
       else
 	host->h_aliases[i+1] = NULL;
     }
-
   return 1;
-
 }
 
 static enum nss_status
@@ -240,8 +230,11 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
 	{
+	  saved_res = NULL;
 	  if (tablename_val == NULL)
 	    if (_nss_create_tablename() != NSS_STATUS_SUCCESS)
 	      return NSS_STATUS_UNAVAIL;
@@ -249,9 +242,7 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
 	  result = nis_first_entry(tablename_val);
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
             {
-              int retval;
-
-              retval = niserr2nss (result->status);
+              enum nss_status retval = niserr2nss (result->status);	      
               if (retval == NSS_STATUS_TRYAGAIN)
                 {
                   *herrnop = NETDB_INTERNAL;
@@ -259,20 +250,21 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
                 }
               return retval;
             }
-
+	  
 	}
       else
 	{
 	  nis_result *res2;
-
+	  
+	  saved_res = result;
 	  res2 = nis_next_entry(tablename_val, &result->cookie);
-	  nis_freeresult (result);
 	  result = res2;
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
             {
-              int retval;
+              enum nss_status retval= niserr2nss (result->status);
 
-              retval = niserr2nss (result->status);
+	      nis_freeresult (result);
+	      result = saved_res;
               if (retval == NSS_STATUS_TRYAGAIN)
                 {
                   *herrnop = NETDB_INTERNAL;
@@ -281,20 +273,24 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
               return retval;
             }
 	}
-
+      
       parse_res = _nss_nisplus_parse_hostent (result, AF_INET6,
 					      host, buffer, buflen);
-      if (!parse_res && errno != ERANGE)
+      if (parse_res < 1 && errno != ERANGE)
 	parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host,
 						buffer, buflen);
-      if (!parse_res && errno == ERANGE)
+      if (parse_res < 1 && errno == ERANGE)
         {
+	  nis_freeresult (result);
+	  result = saved_res;
           *herrnop = NETDB_INTERNAL;
           return NSS_STATUS_TRYAGAIN;
         }
-
+      if (saved_res != NULL)
+	nis_freeresult (saved_res);
+      
     } while (!parse_res);
-
+  
   return NSS_STATUS_SUCCESS;
 }
 
@@ -353,10 +349,10 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
       else
 	sprintf(buf, "[cname=%s],%s", NISENTRYVAL(0, 0, result),
 		tablename_val);
-
+      
       nis_freeresult (result);
       result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
-
+      
       retval = niserr2nss (result->status);
       if (retval != NSS_STATUS_SUCCESS)
         {
@@ -373,12 +369,12 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
 	_nss_nisplus_parse_hostent (result, af, host, buffer, buflen);
 
       nis_freeresult (result);
-
-      if (parse_res)
+      
+      if (parse_res > 0)
 	return NSS_STATUS_SUCCESS;
 
       *herrnop = NETDB_INTERNAL;
-      if (!parse_res && errno == ERANGE)
+      if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
 	return NSS_STATUS_NOTFOUND;
@@ -438,14 +434,13 @@ _nss_nisplus_gethostbyaddr_r (const char *addr, int addrlen, int type,
 
       parse_res = _nss_nisplus_parse_hostent (result, type, host,
 					      buffer, buflen);
-
       nis_freeresult (result);
-
-      if (parse_res)
+      
+      if (parse_res > 0)
 	return NSS_STATUS_SUCCESS;
-
+      
       *herrnop = NETDB_INTERNAL;
-      if (!parse_res && errno == ERANGE)
+      if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
 	return NSS_STATUS_NOTFOUND;
diff --git a/nis/nss_nisplus/nisplus-netgrp.c b/nis/nss_nisplus/nisplus-netgrp.c
index 670d0bb4ed..9c38539de8 100644
--- a/nis/nss_nisplus/nisplus-netgrp.c
+++ b/nis/nss_nisplus/nisplus-netgrp.c
@@ -80,7 +80,7 @@ _nss_nisplus_parse_netgroup (struct __netgrent *result, char *buffer,
       NISENTRYLEN (position, 4, data) + 6 > buflen)
     {
       __set_errno (ERANGE);
-      status = NSS_STATUS_UNAVAIL;
+      status = NSS_STATUS_TRYAGAIN;
     }
   else
     {
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index 183722633f..57362dba78 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -66,7 +66,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
       /* The line is too long for our buffer.  */
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   strncpy (first_unused, NISENTRYVAL(0, 0, result),
@@ -85,10 +85,8 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
       if (strcmp (NISENTRYVAL (i, 1, result), network->n_name) != 0)
         {
           if (NISENTRYLEN (i, 1, result) + 2 > room_left)
-            {
-              __set_errno (ERANGE);
-              return 0;
-            }
+	    goto no_more_room;
+	  
 	  *p++ = ' ';
           p = stpncpy (p, NISENTRYVAL (i, 1, result),
                        NISENTRYLEN (i, 1, result));
@@ -120,10 +118,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
         break;
 
       if (room_left < sizeof (char *))
-        {
-          __set_errno (ERANGE);
-          return 0;
-        }
+	goto no_more_room;
 
       room_left -= sizeof (char *);
       network->n_aliases[i] = line;
@@ -208,8 +203,12 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
 	{
+	  saved_res = NULL;
+
 	  if (tablename_val == NULL)
 	    if (_nss_create_tablename() != NSS_STATUS_SUCCESS)
 	      return NSS_STATUS_UNAVAIL;
@@ -218,8 +217,10 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer,
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
 	    {
 	      int retval;
-
+	      
 	      retval = niserr2nss (result->status);
+	      nis_freeresult (result);
+	      result = NULL;
 	      if (retval == NSS_STATUS_TRYAGAIN)
 		{
 		  *herrnop = NETDB_INTERNAL;
@@ -235,13 +236,15 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer,
 	  nis_result *res;
 
 	  res = nis_next_entry(tablename_val, &result->cookie);
-	  nis_freeresult (result);
+	  saved_res = result;
 	  result = res;
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
 	    {
 	      int retval;
 
 	      retval = niserr2nss (result->status);
+	      nis_freeresult (result);
+	      result = saved_res;
 	      if (retval == NSS_STATUS_TRYAGAIN)
 		{
 		  *herrnop = NETDB_INTERNAL;
@@ -251,15 +254,15 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer,
 	    }
 	}
 
-      parse_res = _nss_nisplus_parse_netent (result, network, buffer, buflen);
-      if (!parse_res && errno == ERANGE)
+      if ((parse_res = _nss_nisplus_parse_netent (result, network, buffer, 
+						  buflen)) == -1)
         {
           *herrnop = NETDB_INTERNAL;
           return NSS_STATUS_TRYAGAIN;
         }
-
+      
     } while (!parse_res);
-
+  
   return NSS_STATUS_SUCCESS;
 }
 
@@ -298,7 +301,7 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
     {
       nis_result *result;
       char buf[strlen (name) + 255 + tablename_len];
-
+      
       /* Search at first in the alias list, and use the correct name
 	 for the next search */
       sprintf(buf, "[name=%s],%s", name, tablename_val);
@@ -336,11 +339,11 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
 
       nis_freeresult (result);
 
-      if (parse_res)
+      if (parse_res > 0)
 	return NSS_STATUS_SUCCESS;
 
       *herrnop = NETDB_INTERNAL;
-      if (!parse_res && errno == ERANGE)
+      if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
 	return NSS_STATUS_NOTFOUND;
@@ -385,11 +388,11 @@ _nss_nisplus_getnetbyaddr_r (const unsigned long addr, const int type,
 
     nis_freeresult (result);
 
-    if (parse_res)
+    if (parse_res > 0)
       return NSS_STATUS_SUCCESS;
-
+    
     *herrnop = NETDB_INTERNAL;
-    if (!parse_res && errno == ERANGE)
+    if (parse_res == -1)
       return NSS_STATUS_TRYAGAIN;
     else
       return NSS_STATUS_NOTFOUND;
diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
index bb6bba1e3e..3d0ff32e57 100644
--- a/nis/nss_nisplus/nisplus-parser.c
+++ b/nis/nss_nisplus/nisplus-parser.c
@@ -55,7 +55,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
       /* The line is too long for our buffer.  */
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   strncpy (first_unused, NISENTRYVAL(0, 0, result),
@@ -152,7 +152,7 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry,
       /* The line is too long for our buffer.  */
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   strncpy (first_unused, NISENTRYVAL (entry, 0, result),
@@ -258,7 +258,7 @@ _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp,
       /* The line is too long for our buffer.  */
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
 
   strncpy (first_unused, NISENTRYVAL (0, 0, result),
diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c
index d98317a8a1..707a0e5296 100644
--- a/nis/nss_nisplus/nisplus-proto.c
+++ b/nis/nss_nisplus/nisplus-proto.c
@@ -63,7 +63,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
     {
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
   strncpy (first_unused, NISENTRYVAL (0, 0, result),
            NISENTRYLEN (0, 0, result));
@@ -196,8 +196,11 @@ internal_nisplus_getprotoent_r (struct protoent *proto, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
 	{
+	  saved_res = NULL;
 	  if (tablename_val == NULL)
 	    if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
 	      return NSS_STATUS_UNAVAIL;
@@ -209,16 +212,30 @@ internal_nisplus_getprotoent_r (struct protoent *proto, char *buffer,
       else
 	{
 	  nis_result *res;
-
+	  
+	  saved_res = result;
 	  res = nis_next_entry (tablename_val, &result->cookie);
-	  nis_freeresult (result);
 	  result = res;
 
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-	    return niserr2nss (result->status);
+	    {
+	      nis_freeresult (saved_res);
+	      return niserr2nss (result->status);
+	    }
 	}
 
-      parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, 
+						    buflen)) == -1)
+	{
+	  nis_freeresult (result);
+	  result = saved_res;
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (saved_res)
+	    nis_freeresult (saved_res);
+	}
     }
   while (!parse_res);
 
@@ -290,13 +307,12 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto,
 
       nis_freeresult (result);
 
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
       if (parse_res)
 	return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-	return NSS_STATUS_TRYAGAIN;
-      else
-	return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -327,12 +343,13 @@ _nss_nisplus_getprotobynumber_r (const int number, struct protoent *proto,
     parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen);
 
     nis_freeresult (result);
-    if (parse_res)
-      return NSS_STATUS_SUCCESS;
 
-    if (!parse_res && errno == ERANGE)
+    if (parse_res == -1)
       return NSS_STATUS_TRYAGAIN;
-    else
-      return NSS_STATUS_NOTFOUND;
+    
+    if (parse_res)
+      return NSS_STATUS_SUCCESS;
+    
+    return NSS_STATUS_NOTFOUND;
   }
 }
diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c
index 459a1a4380..2c1fb19cab 100644
--- a/nis/nss_nisplus/nisplus-pwd.c
+++ b/nis/nss_nisplus/nisplus-pwd.c
@@ -96,8 +96,11 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen)
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+      
       if (result == NULL)
 	{
+	  saved_res = NULL;
           if (tablename_val == NULL)
             if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
               return NSS_STATUS_UNAVAIL;
@@ -110,14 +113,28 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen)
 	{
 	  nis_result *res;
 
+	  saved_res = result;
 	  res = nis_next_entry(tablename_val, &result->cookie);
-	  nis_freeresult (result);
 	  result = res;
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-	    return niserr2nss (result->status);
+	    {
+	      nis_freeresult (saved_res);
+	      return niserr2nss (result->status);
+	    }
 	}
 
-      parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, 
+						 buflen)) == -1)
+	{
+	  nis_freeresult (result);
+	  result = saved_res;
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (saved_res)
+	    nis_freeresult (saved_res);
+	}
     } while (!parse_res);
 
   return NSS_STATUS_SUCCESS;
@@ -170,13 +187,13 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
 
       nis_freeresult (result);
 
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
 	return NSS_STATUS_SUCCESS;
-
-      if (!parse_res && errno == ERANGE)
-	return NSS_STATUS_TRYAGAIN;
-      else
-	return NSS_STATUS_NOTFOUND;
+      
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -207,12 +224,13 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
     parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen);
 
     nis_freeresult (result);
+
+    if (parse_res == -1)
+      return NSS_STATUS_TRYAGAIN;
+    
     if (parse_res)
       return NSS_STATUS_SUCCESS;
 
-    if (!parse_res && errno == ERANGE)
-      return NSS_STATUS_TRYAGAIN;
-    else
-      return NSS_STATUS_NOTFOUND;
+    return NSS_STATUS_NOTFOUND;
   }
 }
diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c
index 47610a4dca..b70c2ebbca 100644
--- a/nis/nss_nisplus/nisplus-rpc.c
+++ b/nis/nss_nisplus/nisplus-rpc.c
@@ -64,7 +64,7 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
     {
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
   strncpy (first_unused, NISENTRYVAL (0, 0, result),
            NISENTRYLEN (0, 0, result));
@@ -198,8 +198,11 @@ internal_nisplus_getrpcent_r (struct rpcent *rpc, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
 	{
+	  saved_res = NULL;
           if (tablename_val == NULL)
             if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
               return NSS_STATUS_UNAVAIL;
@@ -212,14 +215,28 @@ internal_nisplus_getrpcent_r (struct rpcent *rpc, char *buffer,
 	{
 	  nis_result *res;
 
+	  saved_res = result;
 	  res = nis_next_entry (tablename_val, &result->cookie);
-	  nis_freeresult (result);
 	  result = res;
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-	    return niserr2nss (result->status);
+	    {
+	      nis_freeresult (saved_res);
+	      return niserr2nss (result->status);
+	    }
 	}
 
-      parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, 
+						  buflen)) == -1)
+	{
+	  nis_freeresult (result);
+	  result = saved_res;
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (saved_res)
+	    nis_freeresult (saved_res);
+	}
     } while (!parse_res);
 
   return NSS_STATUS_SUCCESS;
@@ -290,13 +307,13 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc,
 
       nis_freeresult (result);
 
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
 	return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-	return NSS_STATUS_TRYAGAIN;
-      else
-	return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -329,12 +346,12 @@ _nss_nisplus_getrpcbynumber_r (const int number, struct rpcent *rpc,
 
     nis_freeresult (result);
 
+    if (parse_res == -1)
+      return NSS_STATUS_TRYAGAIN;
+
     if (parse_res)
       return NSS_STATUS_SUCCESS;
 
-    if (!parse_res && errno == ERANGE)
-      return NSS_STATUS_TRYAGAIN;
-    else
-      return NSS_STATUS_NOTFOUND;
+    return NSS_STATUS_NOTFOUND;
   }
 }
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index b97034e9b8..37042d9d13 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -63,7 +63,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
     {
     no_more_room:
       __set_errno (ERANGE);
-      return 0;
+      return -1;
     }
   strncpy (first_unused, NISENTRYVAL (0, 0, result),
            NISENTRYLEN (0, 0, result));
@@ -204,8 +204,11 @@ internal_nisplus_getservent_r (struct servent *serv, char *buffer,
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+      
       if (result == NULL)
 	{
+	  saved_res = NULL;
           if (tablename_val == NULL)
             if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
               return NSS_STATUS_UNAVAIL;
@@ -218,14 +221,28 @@ internal_nisplus_getservent_r (struct servent *serv, char *buffer,
 	{
 	  nis_result *res;
 
+	  saved_res = result;
 	  res = nis_next_entry (tablename_val, &result->cookie);
-	  nis_freeresult (result);
 	  result = res;
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-	    return niserr2nss (result->status);
+	    {
+	      nis_freeresult (saved_res);
+	      return niserr2nss (result->status);
+	    }
 	}
 
-      parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_servent (result, serv, buffer,
+						   buflen)) == -1)
+	{
+	  nis_freeresult (result);
+	  result = saved_res;
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (saved_res)
+	    nis_freeresult (saved_res);
+	}
     }
   while (!parse_res);
 
@@ -300,16 +317,15 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
 	}
 
       parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen);
-
       nis_freeresult (result);
 
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
 	return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-	return NSS_STATUS_TRYAGAIN;
-      else
-	return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
 
@@ -347,15 +363,14 @@ _nss_nisplus_getservbynumber_r (const int number, const char *protocol,
 	}
 
       parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen);
-
       nis_freeresult (result);
 
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
 	return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-	return NSS_STATUS_TRYAGAIN;
-      else
-	return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
diff --git a/nis/nss_nisplus/nisplus-spwd.c b/nis/nss_nisplus/nisplus-spwd.c
index 81bde4e689..c7f1e2a567 100644
--- a/nis/nss_nisplus/nisplus-spwd.c
+++ b/nis/nss_nisplus/nisplus-spwd.c
@@ -93,8 +93,12 @@ internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen)
   /* Get the next entry until we found a correct one. */
   do
     {
+      nis_result *saved_res;
+
       if (result == NULL)
 	{
+	  saved_res = NULL;
+
           if (tablename_val == NULL)
             if (_nss_create_tablename () != NSS_STATUS_SUCCESS)
               return NSS_STATUS_UNAVAIL;
@@ -107,14 +111,28 @@ internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen)
 	{
 	  nis_result *res;
 
+	  saved_res = result;
 	  res = nis_next_entry (tablename_val, &result->cookie);
-	  nis_freeresult (result);
 	  result = res;
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-	    return niserr2nss (result->status);
+	    {
+	      nis_freeresult (saved_res);
+	      return niserr2nss (result->status);
+	    }
 	}
 
-      parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen);
+      if ((parse_res = _nss_nisplus_parse_spent (result, sp, buffer,
+						 buflen)) == -1)
+	{
+	  nis_freeresult (result);
+	  result = saved_res;
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  if (saved_res)
+	    nis_freeresult (saved_res);
+	}
     } while (!parse_res);
 
   return NSS_STATUS_SUCCESS;
@@ -164,15 +182,14 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp,
 	}
 
       parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen);
-
       nis_freeresult (result);
 
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+
       if (parse_res)
 	return NSS_STATUS_SUCCESS;
 
-      if (!parse_res && errno == ERANGE)
-	return NSS_STATUS_TRYAGAIN;
-      else
-	return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_NOTFOUND;
     }
 }
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 34fe918237..d1004356b4 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -982,7 +982,11 @@ __guess_grouping (unsigned int intdig_max, const char *grouping,
       ++groups;
       intdig_max -= *grouping++;
 
-      if (*grouping == CHAR_MAX || *grouping < 0)
+      if (*grouping == CHAR_MAX
+#if CHAR_MIN < 0
+	  || *grouping < 0
+#endif
+	  )
 	/* No more grouping should be done.  */
 	break;
       else if (*grouping == 0)
@@ -1023,7 +1027,11 @@ group_number (char *buf, char *bufend, unsigned int intdig_no,
       while (--len > 0);
       *p-- = thousands_sep;
 
-      if (*grouping == CHAR_MAX || *grouping < 0)
+      if (*grouping == CHAR_MAX
+#if CHAR_MIN < 0
+	  || *grouping < 0
+#endif
+	  )
 	/* No more grouping should be done.  */
 	break;
       else if (*grouping == 0)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index db6f3e4842..1cd8d2178a 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1514,7 +1514,11 @@ group_number (CHAR_T *w, CHAR_T *rear_ptr, const CHAR_T *grouping,
 	  if (*grouping == '\0')
 	    /* The previous grouping repeats ad infinitum.  */
 	    --grouping;
-	  else if (*grouping == CHAR_MAX || *grouping < 0)
+	  else if (*grouping == CHAR_MAX
+#if CHAR_MIN < 0
+		   || *grouping < 0
+#endif
+		   )
 	    {
 	      /* No further grouping to be done.
 		 Copy the rest of the number.  */
diff --git a/stdlib/grouping.h b/stdlib/grouping.h
index 8b097b68c5..deb7a15cfb 100644
--- a/stdlib/grouping.h
+++ b/stdlib/grouping.h
@@ -1,5 +1,5 @@
 /* Internal header for proving correct grouping in strings of numbers.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -81,7 +81,11 @@ correctly_grouped_prefix (const STRING_TYPE *begin, const STRING_TYPE *end,
 	      /* Skip the thousands separator.  */
 	      --cp;
 
-	      if (*gp == CHAR_MAX || *gp < 0)
+	      if (*gp == CHAR_MAX
+#if CHAR_MIN < 0
+		  || *gp < 0
+#endif
+		  )
 	        {
 	          /* No more thousands separators are allowed to follow.  */
 	          while (cp >= begin && (wchar_t) *cp != thousands)
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index e19e7e820b..5faf46caee 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -262,6 +262,8 @@ clntudp_call (cl, proc, xargs, argsp, xresults, resultsp, utimeout)
   time_waited.tv_usec = 0;
 call_again:
   xdrs = &(cu->cu_outxdrs);
+  if (xargs == NULL)
+    goto get_reply;
   xdrs->x_op = XDR_ENCODE;
   XDR_SETPOS (xdrs, cu->cu_xdrpos);
   /*
@@ -290,6 +292,7 @@ send_again:
     {
       return (cu->cu_error.re_status = RPC_TIMEDOUT);
     }
+ get_reply:
   /*
    * sub-optimal code appears here because we have
    * some clock time to spare while the packets are in flight.
diff --git a/sysdeps/alpha/ntohl.s b/sysdeps/alpha/ntohl.s
deleted file mode 100644
index 6a99a01dc4..0000000000
--- a/sysdeps/alpha/ntohl.s
+++ /dev/null
@@ -1,2 +0,0 @@
-/* This is a dummy to avoid including the generic version.  htonl and
-ntohl are identical and htonl.S defines appropriate aliases.  */
diff --git a/sysdeps/alpha/ntohs.s b/sysdeps/alpha/ntohs.s
deleted file mode 100644
index 69992a894c..0000000000
--- a/sysdeps/alpha/ntohs.s
+++ /dev/null
@@ -1,2 +0,0 @@
-/* This is a dummy to avoid including the generic version.  htons and
-ntohs are identical and htons.S defines appropriate aliases.  */
diff --git a/sysdeps/generic/ntohs.c b/sysdeps/generic/bits/htontoh.h
index f4f37eec93..fa4efed867 100644
--- a/sysdeps/generic/ntohs.c
+++ b/sysdeps/generic/bits/htontoh.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+/* 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
@@ -16,17 +16,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <netinet/in.h>
-
-#undef	ntohs
-
-u_int16_t
-ntohs (x)
-     u_int16_t x;
-{
-#if BYTE_ORDER == LITTLE_ENDIAN
-  x = (x << 8) | (x >> 8);
+#ifndef _NETINET_IN_H
+# error "Don't include this file directly, use <netinet/in.h>"
 #endif
 
-  return x;
-}
+/* We cannot give generic optimized versions here.  */
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index c5e85274b0..e18f0b89a4 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -32,7 +32,7 @@ extern char **_dl_argv;
 extern char **_environ;
 extern size_t _dl_pagesize;
 extern void _end;
-extern void _start (void);
+extern void ENTRY_POINT (void);
 
 int __libc_enable_secure;
 int __libc_multiple_libcs;	/* Defining this here avoids the inclusion
diff --git a/sysdeps/generic/htonl.c b/sysdeps/generic/htonl.c
index f1e077ae1a..d460d40f89 100644
--- a/sysdeps/generic/htonl.c
+++ b/sysdeps/generic/htonl.c
@@ -21,7 +21,7 @@
 #undef	htonl
 
 u_int32_t
-htonl (x)
+__htonl (x)
      u_int32_t x;
 {
 #if BYTE_ORDER == LITTLE_ENDIAN
@@ -30,3 +30,6 @@ htonl (x)
 
   return x;
 }
+strong_alias (__htonl, __ntohl)
+weak_alias (__htonl, htonl)
+weak_alias (__ntohl, ntohl)
diff --git a/sysdeps/generic/htons.c b/sysdeps/generic/htons.c
index 3aaf28551c..a0a0e81adf 100644
--- a/sysdeps/generic/htons.c
+++ b/sysdeps/generic/htons.c
@@ -21,7 +21,7 @@
 #undef	htons
 
 u_int16_t
-htons (x)
+__htons (x)
      u_int16_t x;
 {
 #if BYTE_ORDER == LITTLE_ENDIAN
@@ -30,3 +30,6 @@ htons (x)
 
   return x;
 }
+strong_alias (__htons, __ntohs)
+weak_alias (__htons, htons)
+weak_alias (__ntohs, ntohs)
diff --git a/sysdeps/i386/bits/htontoh.h b/sysdeps/i386/bits/htontoh.h
new file mode 100644
index 0000000000..590b509875
--- /dev/null
+++ b/sysdeps/i386/bits/htontoh.h
@@ -0,0 +1,79 @@
+/* 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.  */
+
+#ifndef _NETINET_IN_H
+# error "Don't include this file directly, use <netinet/in.h>"
+#endif
+
+#if defined __GNUC__ && __GNUC__ >= 2
+/* We can use inline assembler instructions to optimize the code.  */
+
+/* To swap the bytes in a word the i486 processors and up provide the
+   `bswap' opcode.  On i386 we have to use three instructions.  */
+# if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__
+
+extern __inline u_int32_t
+__ntohl (u_int32_t netlong)
+{
+  register u_int32_t hostlong;
+
+  __asm__ ("rorw $8, %w0; rorl $16, %0; rorw $8, %w0"
+	   : "=r" (hostlong)
+	   : "0" (netlong));
+
+  return hostlong;
+}
+
+# else
+
+extern __inline u_int32_t
+__ntohl (u_int32_t netlong)
+{
+  register u_int32_t hostlong;
+
+  __asm__ ("bswap %0" : "=r" (hostlong) : "0" (netlong));
+
+  return hostlong;
+}
+
+# endif
+
+/* For a short word we have a simple solution.  */
+extern __inline u_int16_t
+__ntohs (u_int16_t netshort)
+{
+  register u_int16_t hostshort;
+
+  __asm__ ("rorw $8, %w0" : "=r" (hostshort) : "0" (netshort));
+}
+
+
+/* The other direction can be handled with the same functions.  */
+extern __inline u_int32_t
+__htonl (u_int32_t hostlong)
+{
+  return __ntohl (hostlong);
+}
+
+extern __inline u_int16_t
+__htons (u_int16_t hostshort)
+{
+  return __ntohs (hostshort);
+}
+
+#endif /* GNU CC */
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index a83356fce1..0388cbe510 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -276,9 +276,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 
 	      strtab = ((void *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
-	      _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
-				"' in `",
-				_dl_argv[0] ?: "<program name unknown>",
+	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+				": Symbol `", strtab + refsym->st_name,
 				"' has different size in shared object, "
 				"consider re-linking\n", NULL);
 	    }
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index 42dae92a2a..4228959d23 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -30,42 +30,42 @@
 # define isgreater(x, y) \
      ({ int result;							      \
 	__asm__ ("fucompp; fnstsw; andb $0x45, %%ah; setz %%al;"	      \
-		 "andl $0xff, %0"					      \
-		 : "=a" (result) : "t" (x), "u" (y) : "cc");		      \
+		 "andl $0x01, %0"					      \
+		 : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
 	result; })
 
 # define isgreaterequal(x, y) \
      ({ int result;							      \
 	__asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al;"	      \
-		 "andl $0xff, %0"					      \
-		 : "=a" (result) : "t" (x), "u" (y) : "cc");		      \
+		 "andl $0x01, %0"					      \
+		 : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
 	result; })
 
 # define isless(x, y) \
      ({ int result;							      \
 	__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x45, %%ah;"      \
-		 "setz %%al; andl $0xff, %0"				      \
-		 : "=a" (result) : "t" (x), "u" (y) : "cc");		      \
+		 "setz %%al; andl $0x01, %0"				      \
+		 : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
 	result; })
 
 # define islessequal(x, y) \
      ({ int result;							      \
 	__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x05, %%ah;"      \
-		 "setz %%al; andl $0xff, %0"				      \
-		 : "=a" (result) : "t" (x), "u" (y) : "cc");		      \
+		 "setz %%al; andl $0x01, %0"				      \
+		 : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
 	result; })
 
 # define islessgreater(x, y) \
      ({ int result;							      \
 	__asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al;"	      \
-		 "andl $0xff, %0"					      \
-		 : "=a" (result) : "t" (x), "u" (y) : "cc");		      \
+		 "andl $0x01, %0"					      \
+		 : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
 	result; })
 
 # define isunordered(x, y) \
      ({ int result;							      \
-	__asm__ ("fucompp; fnstsw; sahf; setp %%al; andl $0xff, %0"	      \
-		 : "=a" (result) : "t" (x), "u" (y) : "cc");		      \
+	__asm__ ("fucompp; fnstsw; sahf; setp %%al; andl $0x01, %0"	      \
+		 : "=a" (result) : "u" (y), "t" (x) : "cc", "st", "st(1)");   \
 	result; })
 #endif
 
diff --git a/sysdeps/i386/htonl.S b/sysdeps/i386/htonl.S
new file mode 100644
index 0000000000..73dd1e9bea
--- /dev/null
+++ b/sysdeps/i386/htonl.S
@@ -0,0 +1,39 @@
+/* Change byte order in word.  For Intel 80386.
+   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>
+#include "asm-syntax.h"
+
+/*
+   INPUT PARAMETERS:
+   word		(sp + 4)
+*/
+
+	.text
+ENTRY (__htonl)
+	movl	4(%esp), %eax
+	rorw	$8, %ax
+	rorl	$16, %eax
+	rorw	$8, %ax
+	ret
+END (__htonl)
+
+strong_alias (__htonl, __ntohl)
+weak_alias (__htonl, htonl)
+weak_alias (__ntohl, ntohl)
diff --git a/sysdeps/i386/htons.S b/sysdeps/i386/htons.S
new file mode 100644
index 0000000000..5d0f59c92b
--- /dev/null
+++ b/sysdeps/i386/htons.S
@@ -0,0 +1,38 @@
+/* Change byte order in word.  For Intel 80x86, x >= 3.
+   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>
+#include "asm-syntax.h"
+
+/*
+   INPUT PARAMETERS:
+   word		(sp + 4)
+*/
+
+	.text
+ENTRY (__htons)
+	movl	4(%esp), %eax
+	andl	$0xffff, %eax
+	rorw	$8, %ax
+	ret
+END (__htons)
+
+strong_alias (__htons, __ntohs)
+weak_alias (__htons, htons)
+weak_alias (__ntohs, ntohs)
diff --git a/sysdeps/generic/ntohl.c b/sysdeps/i386/i486/htonl.S
index 0cb83c5aa4..cf3a94fc76 100644
--- a/sysdeps/generic/ntohl.c
+++ b/sysdeps/i386/i486/htonl.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+/* Change byte order in word.  For Intel 80x86, x >= 4.
+   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
@@ -16,17 +17,21 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <netinet/in.h>
+#include <sysdep.h>
+#include "asm-syntax.h"
 
-#undef	ntohl
+/*
+   INPUT PARAMETERS:
+   word		(sp + 4)
+*/
 
-u_int32_t
-ntohl (x)
-     u_int32_t x;
-{
-#if BYTE_ORDER == LITTLE_ENDIAN
-  x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24);
-#endif
+	.text
+ENTRY (__htonl)
+	movl	4(%esp), %eax
+	bswap	%eax
+	ret
+END (__htonl)
 
-  return x;
-}
+strong_alias (__htonl, __ntohl)
+weak_alias (__htonl, htonl)
+weak_alias (__ntohl, ntohl)
diff --git a/sysdeps/libm-ieee754/e_atan2f.c b/sysdeps/libm-ieee754/e_atan2f.c
index 437975f79f..8b3398c0a3 100644
--- a/sysdeps/libm-ieee754/e_atan2f.c
+++ b/sysdeps/libm-ieee754/e_atan2f.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -21,16 +21,16 @@ static char rcsid[] = "$NetBSD: e_atan2f.c,v 1.4 1995/05/10 20:44:53 jtc Exp $";
 #include "math_private.h"
 
 #ifdef __STDC__
-static const float 
+static const float
 #else
-static float 
+static float
 #endif
 tiny  = 1.0e-30,
 zero  = 0.0,
-pi_o_4  = 7.8539818525e-01, /* 0x3f490fdb */
-pi_o_2  = 1.5707963705e+00, /* 0x3fc90fdb */
-pi      = 3.1415925026e+00, /* 0x40490fda */
-pi_lo   = 1.5099578832e-07; /* 0x34222168 */
+pi_o_4  = 7.8539818525e-01,  /* 0x3f490fdb */
+pi_o_2  = 1.5707963705e+00,  /* 0x3fc90fdb */
+pi      = 3.1415927410e+00,  /* 0x40490fdb */
+pi_lo   = -8.7422776573e-07; /* 0xb3bbbd2e */
 
 #ifdef __STDC__
 	float __ieee754_atan2f(float y, float x)
@@ -38,7 +38,7 @@ pi_lo   = 1.5099578832e-07; /* 0x34222168 */
 	float __ieee754_atan2f(y,x)
 	float  y,x;
 #endif
-{  
+{
 	float z;
 	int32_t k,m,hx,hy,ix,iy;
 
@@ -55,7 +55,7 @@ pi_lo   = 1.5099578832e-07; /* 0x34222168 */
     /* when y = 0 */
 	if(iy==0) {
 	    switch(m) {
-		case 0: 
+		case 0:
 		case 1: return y; 	/* atan(+-0,+anything)=+-0 */
 		case 2: return  pi+tiny;/* atan(+0,-anything) = pi */
 		case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
@@ -63,7 +63,7 @@ pi_lo   = 1.5099578832e-07; /* 0x34222168 */
 	}
     /* when x = 0 */
 	if(ix==0) return (hy<0)?  -pi_o_2-tiny: pi_o_2+tiny;
-	    
+
     /* when x is INF */
 	if(ix==0x7f800000) {
 	    if(iy==0x7f800000) {
diff --git a/sysdeps/libm-ieee754/e_log.c b/sysdeps/libm-ieee754/e_log.c
index f584694686..e4e6eab6c5 100644
--- a/sysdeps/libm-ieee754/e_log.c
+++ b/sysdeps/libm-ieee754/e_log.c
@@ -106,8 +106,8 @@ static double zero   =  0.0;
 	k=0;
 	if (hx < 0x00100000) {			/* x < 2**-1022  */
 	    if (((hx&0x7fffffff)|lx)==0)
-		return -two54/zero;		/* log(+-0)=-inf */
-	    if (hx<0) return (x-x)/zero;	/* log(-#) = NaN */
+		return -two54/(x-x);		/* log(+-0)=-inf */
+	    if (hx<0) return (x-x)/(x-x);	/* log(-#) = NaN */
 	    k -= 54; x *= two54; /* subnormal number, scale up x */
 	    GET_HIGH_WORD(hx,x);
 	}
diff --git a/sysdeps/libm-ieee754/e_log10.c b/sysdeps/libm-ieee754/e_log10.c
index 5d004ac4e2..e8a3278eaf 100644
--- a/sysdeps/libm-ieee754/e_log10.c
+++ b/sysdeps/libm-ieee754/e_log10.c
@@ -5,7 +5,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -16,26 +16,26 @@ static char rcsid[] = "$NetBSD: e_log10.c,v 1.9 1995/05/10 20:45:51 jtc Exp $";
 
 /* __ieee754_log10(x)
  * Return the base 10 logarithm of x
- * 
+ *
  * Method :
  *	Let log10_2hi = leading 40 bits of log10(2) and
  *	    log10_2lo = log10(2) - log10_2hi,
  *	    ivln10   = 1/log(10) rounded.
  *	Then
- *		n = ilogb(x), 
+ *		n = ilogb(x),
  *		if(n<0)  n = n+1;
  *		x = scalbn(x,-n);
  *		log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x))
  *
  * Note 1:
- *	To guarantee log10(10**n)=n, where 10**n is normal, the rounding 
+ *	To guarantee log10(10**n)=n, where 10**n is normal, the rounding
  *	mode must set to Round-to-Nearest.
  * Note 2:
  *	[1/log(10)] rounded to 53 bits has error  .198   ulps;
  *	log10 is monotonic at all binary break points.
  *
  * Special cases:
- *	log10(x) is NaN with signal if x < 0; 
+ *	log10(x) is NaN with signal if x < 0;
  *	log10(+INF) is +INF with no signal; log10(0) is -INF with signal;
  *	log10(NaN) is that NaN with no signal;
  *	log10(10**N) = N  for N=0,1,...,22.
@@ -80,10 +80,10 @@ static double zero   =  0.0;
 	EXTRACT_WORDS(hx,lx,x);
 
         k=0;
-        if (hx < 0x00100000) {                  /* x < 2**-1022  */
+        if (hx < 0x00100000) {			/* x < 2**-1022  */
             if (((hx&0x7fffffff)|lx)==0)
-                return -two54/zero;             /* log(+-0)=-inf */
-            if (hx<0) return (x-x)/zero;        /* log(-#) = NaN */
+                return -two54/(x-x);		/* log(+-0)=-inf */
+            if (hx<0) return (x-x)/(x-x);	/* log(-#) = NaN */
             k -= 54; x *= two54; /* subnormal number, scale up x */
 	    GET_HIGH_WORD(hx,x);
         }
diff --git a/sysdeps/libm-ieee754/e_log10f.c b/sysdeps/libm-ieee754/e_log10f.c
index 2082a763bb..cea3d9156b 100644
--- a/sysdeps/libm-ieee754/e_log10f.c
+++ b/sysdeps/libm-ieee754/e_log10f.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -49,10 +49,10 @@ static float zero   =  0.0;
 	GET_FLOAT_WORD(hx,x);
 
         k=0;
-        if (hx < 0x00800000) {                  /* x < 2**-126  */
+        if (hx < 0x00800000) {			/* x < 2**-126  */
             if ((hx&0x7fffffff)==0)
-                return -two25/zero;             /* log(+-0)=-inf */
-            if (hx<0) return (x-x)/zero;        /* log(-#) = NaN */
+                return -two25/(x-x);		/* log(+-0)=-inf */
+            if (hx<0) return (x-x)/(x-x);	/* log(-#) = NaN */
             k -= 25; x *= two25; /* subnormal number, scale up x */
 	    GET_FLOAT_WORD(hx,x);
         }
diff --git a/sysdeps/libm-ieee754/e_logf.c b/sysdeps/libm-ieee754/e_logf.c
index 1481fd01cb..0f1af93ba8 100644
--- a/sysdeps/libm-ieee754/e_logf.c
+++ b/sysdeps/libm-ieee754/e_logf.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -56,12 +56,12 @@ static float zero   =  0.0;
 
 	k=0;
 	if (ix < 0x00800000) {			/* x < 2**-126  */
-	    if ((ix&0x7fffffff)==0) 
-		return -two25/zero;		/* log(+-0)=-inf */
-	    if (ix<0) return (x-x)/zero;	/* log(-#) = NaN */
+	    if ((ix&0x7fffffff)==0)
+		return -two25/(x-x);		/* log(+-0)=-inf */
+	    if (ix<0) return (x-x)/(x-x);	/* log(-#) = NaN */
 	    k -= 25; x *= two25; /* subnormal number, scale up x */
 	    GET_FLOAT_WORD(ix,x);
-	} 
+	}
 	if (ix >= 0x7f800000) return x+x;
 	k += (ix>>23)-127;
 	ix &= 0x007fffff;
@@ -76,14 +76,14 @@ static float zero   =  0.0;
 	    if(k==0) return f-R; else {dk=(float)k;
 	    	     return dk*ln2_hi-((R-dk*ln2_lo)-f);}
 	}
- 	s = f/((float)2.0+f); 
+ 	s = f/((float)2.0+f);
 	dk = (float)k;
 	z = s*s;
 	i = ix-(0x6147a<<3);
 	w = z*z;
 	j = (0x6b851<<3)-ix;
-	t1= w*(Lg2+w*(Lg4+w*Lg6)); 
-	t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); 
+	t1= w*(Lg2+w*(Lg4+w*Lg6));
+	t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
 	i |= j;
 	R = t2+t1;
 	if(i>0) {
diff --git a/sysdeps/libm-ieee754/s_isinf.c b/sysdeps/libm-ieee754/s_isinf.c
index d3c2cb55b7..6f76ce1fba 100644
--- a/sysdeps/libm-ieee754/s_isinf.c
+++ b/sysdeps/libm-ieee754/s_isinf.c
@@ -23,12 +23,11 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
 	double x;
 #endif
 {
-	u_int32_t hx;
-	int32_t lx;
+	int32_t hx,lx;
 	EXTRACT_WORDS(hx,lx,x);
 	lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
 	lx |= -lx;
-	return ~(lx >> 31) & (1 - ((hx >> 30) & 2));
+	return ~(lx >> 31) & (hx >> 30);
 }
 weak_alias (__isinf, isinf)
 #ifdef NO_LONG_DOUBLE
diff --git a/sysdeps/libm-ieee754/s_isinff.c b/sysdeps/libm-ieee754/s_isinff.c
index 9acc0df6ec..18a0b5e03b 100644
--- a/sysdeps/libm-ieee754/s_isinff.c
+++ b/sysdeps/libm-ieee754/s_isinff.c
@@ -27,6 +27,6 @@ static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $";
 	t = ix & 0x7fffffff;
 	t ^= 0x7f800000;
 	t |= -t;
-	return ~(t >> 31) & (1 - ((ix & 0x80000000) >> 30));
+	return ~(t >> 31) & (ix >> 30);
 }
 weak_alias (__isinff, isinff)
diff --git a/sysdeps/libm-ieee754/s_log1p.c b/sysdeps/libm-ieee754/s_log1p.c
index cc380a1091..086c0dce6c 100644
--- a/sysdeps/libm-ieee754/s_log1p.c
+++ b/sysdeps/libm-ieee754/s_log1p.c
@@ -120,7 +120,7 @@ static double zero = 0.0;
 	k = 1;
 	if (hx < 0x3FDA827A) {			/* x < 0.41422  */
 	    if(ax>=0x3ff00000) {		/* x <= -1.0 */
-		if(x==-1.0) return -two54/zero; /* log1p(-1)=+inf */
+		if(x==-1.0) return -two54/(x-x);/* log1p(-1)=+inf */
 		else return (x-x)/(x-x);	/* log1p(x<-1)=NaN */
 	    }
 	    if(ax<0x3e200000) {			/* |x| < 2**-29 */
diff --git a/sysdeps/libm-ieee754/s_log1pf.c b/sysdeps/libm-ieee754/s_log1pf.c
index ee0a83958d..5b1237b0d0 100644
--- a/sysdeps/libm-ieee754/s_log1pf.c
+++ b/sysdeps/libm-ieee754/s_log1pf.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -58,7 +58,7 @@ static float zero = 0.0;
 	k = 1;
 	if (hx < 0x3ed413d7) {			/* x < 0.41422  */
 	    if(ax>=0x3f800000) {		/* x <= -1.0 */
-		if(x==(float)-1.0) return -two25/zero; /* log1p(-1)=+inf */
+		if(x==(float)-1.0) return -two25/(x-x); /* log1p(-1)=+inf */
 		else return (x-x)/(x-x);	/* log1p(x<-1)=NaN */
 	    }
 	    if(ax<0x31000000) {			/* |x| < 2**-29 */
@@ -70,11 +70,11 @@ static float zero = 0.0;
 	    }
 	    if(hx>0||hx<=((int32_t)0xbe95f61f)) {
 		k=0;f=x;hu=1;}	/* -0.2929<x<0.41422 */
-	} 
+	}
 	if (hx >= 0x7f800000) return x+x;
 	if(k!=0) {
 	    if(hx<0x5a000000) {
-		u  = (float)1.0+x; 
+		u  = (float)1.0+x;
 		GET_FLOAT_WORD(hu,u);
 	        k  = (hu>>23)-127;
 		/* correction term */
@@ -90,7 +90,7 @@ static float zero = 0.0;
 	    if(hu<0x3504f7) {
 	        SET_FLOAT_WORD(u,hu|0x3f800000);/* normalize u */
 	    } else {
-	        k += 1; 
+	        k += 1;
 		SET_FLOAT_WORD(u,hu|0x3f000000);	/* normalize u/2 */
 	        hu = (0x00800000-hu)>>2;
 	    }
@@ -98,13 +98,13 @@ static float zero = 0.0;
 	}
 	hfsq=(float)0.5*f*f;
 	if(hu==0) {	/* |f| < 2**-20 */
-	    if(f==zero) if(k==0) return zero;  
+	    if(f==zero) if(k==0) return zero;
 			else {c += k*ln2_lo; return k*ln2_hi+c;}
 	    R = hfsq*((float)1.0-(float)0.66666666666666666*f);
 	    if(k==0) return f-R; else
 	    	     return k*ln2_hi-((R-(k*ln2_lo+c))-f);
 	}
- 	s = f/((float)2.0+f); 
+ 	s = f/((float)2.0+f);
 	z = s*s;
 	R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7))))));
 	if(k==0) return f-(hfsq-s*(hfsq+R)); else
diff --git a/sysdeps/libm-ieee754/s_log2.c b/sysdeps/libm-ieee754/s_log2.c
index 46b53cfeff..93c20b3db1 100644
--- a/sysdeps/libm-ieee754/s_log2.c
+++ b/sysdeps/libm-ieee754/s_log2.c
@@ -93,8 +93,8 @@ static double zero   =  0.0;
 	k=0;
 	if (hx < 0x00100000) {			/* x < 2**-1022  */
 	    if (((hx&0x7fffffff)|lx)==0)
-		return -two54/zero;		/* log(+-0)=-inf */
-	    if (hx<0) return (x-x)/zero;	/* log(-#) = NaN */
+		return -two54/(x-x);		/* log(+-0)=-inf */
+	    if (hx<0) return (x-x)/(x-x);	/* log(-#) = NaN */
 	    k -= 54; x *= two54; /* subnormal number, scale up x */
 	    GET_HIGH_WORD(hx,x);
 	}
diff --git a/sysdeps/libm-ieee754/s_log2f.c b/sysdeps/libm-ieee754/s_log2f.c
index 6415c37f53..da9dfb8324 100644
--- a/sysdeps/libm-ieee754/s_log2f.c
+++ b/sysdeps/libm-ieee754/s_log2f.c
@@ -53,8 +53,8 @@ static float zero   =  0.0;
 	k=0;
 	if (ix < 0x00800000) {			/* x < 2**-126  */
 	    if ((ix&0x7fffffff)==0)
-		return -two25/zero;		/* log(+-0)=-inf */
-	    if (ix<0) return (x-x)/zero;	/* log(-#) = NaN */
+		return -two25/(x-x);		/* log(+-0)=-inf */
+	    if (ix<0) return (x-x)/(x-x);	/* log(-#) = NaN */
 	    k -= 25; x *= two25; /* subnormal number, scale up x */
 	    GET_FLOAT_WORD(ix,x);
 	}
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index e50f773614..c0a17c73c2 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -234,11 +234,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  if (sym->st_size > refsym->st_size
 	      || (_dl_verbose && sym->st_size < refsym->st_size))
 	    {
+	      extern char **_dl_argv;
 	      const char *strtab;
 
 	      strtab = ((void *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
-	      _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
+	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+				": Symbol `", strtab + refsym->st_name,
 				"' has different size in shared object, "
 				"consider re-linking\n", NULL);
 	    }
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index cc7198b60e..7456ae0b7a 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -125,32 +125,11 @@ elf_machine_got (void)
 }
 
 
-/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-   first element of the GOT.  This must be inlined in a function which
-   uses global data.  */
-static inline ElfW(Addr)
-elf_machine_dynamic (void)
-{
-  register ElfW(Addr) gp asm ("$28");
-  return * (ElfW(Addr) *) (gp - 0x7ff0);
-}
-
 /* Return the run-time load address of the shared object.  */
 static inline ElfW(Addr)
 elf_machine_load_address (void)
 {
   ElfW(Addr) addr;
-#ifdef __mips64
-  asm ("	.set noreorder\n"
-       "	dla %0, here\n"
-       "	bltzal $0, here\n"
-       "	nop\n"
-       "here:	dsubu %0, $31, %0\n"
-       "	.set reorder\n"
-       :	"=r" (addr)
-       :	/* No inputs */
-       :	"$31");
-#else
   asm ("	.set noreorder\n"
        "	la %0, here\n"
        "	bltzal $0, here\n"
@@ -160,7 +139,6 @@ elf_machine_load_address (void)
        :	"=r" (addr)
        :	/* No inputs */
        :	"$31");
-#endif
   return addr;
 }
 
@@ -364,100 +342,6 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
      t8  index for this function symbol in .dynsym
    to usual c arguments.  */
 
-#ifdef __mips64
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE					      \
-/* The flag _dl_mips_gnu_objects is set if all dynamic objects are	      \
-   generated by the gnu linker. */					      \
-int _dl_mips_gnu_objects = 1;						      \
-									      \
-/* This is called from assembly stubs below which the compiler can't see.  */ \
-static ElfW(Addr)							      \
-__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr))	      \
-                  __attribute__ ((unused));				      \
-									      \
-static ElfW(Addr)							      \
-__dl_runtime_resolve (ElfW(Word) sym_index,				      \
-		      ElfW(Word) return_address,			      \
-		      ElfW(Addr) old_gpreg,				      \
-		      ElfW(Addr) stub_pc)				      \
-{									      \
-  struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);     \
-  const ElfW(Sym) *const symtab						      \
-    = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr);     \
-  const char *strtab							      \
-    = (void *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);		      \
-  const ElfW(Addr) *got							      \
-    = (const ElfW(Addr) *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr);    \
-  const ElfW(Word) local_gotno						      \
-    = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;	      \
-  const ElfW(Word) gotsym						      \
-    = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;	      \
-  const ElfW(Sym) *definer;						      \
-  ElfW(Addr) loadbase;							      \
-  ElfW(Addr) funcaddr;							      \
-  struct link_map **scope;						      \
-									      \
-  /* Look up the symbol's run-time value.  */				      \
-  scope = _dl_object_relocation_scope (l);				      \
-  definer = &symtab[sym_index];						      \
-									      \
-  loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,	      \
-				scope, l->l_name, ELF_MACHINE_RELOC_NOPLT);   \
-									      \
-  *_dl_global_scope_end = NULL;						      \
-									      \
-  /* Apply the relocation with that value.  */				      \
-  funcaddr = loadbase + definer->st_value;				      \
-  *(got + local_gotno + sym_index - gotsym) = funcaddr;			      \
-									      \
-  return funcaddr;							      \
-}									      \
-									      \
-asm ("\n								      \
-	.text\n								      \
-	.align	3\n							      \
-	.globl	_dl_runtime_resolve\n					      \
-	.type	_dl_runtime_resolve,@function\n				      \
-	.ent	_dl_runtime_resolve\n					      \
-_dl_runtime_resolve:\n							      \
-	.set noreorder\n						      \
-	# Save old GP to $3.\n						      \
-	move	$3,$28\n						      \
-	# Modify t9 ($25) so as to point .cpload instruction.\n		      \
-	daddu	$25,2*8\n						      \
-	# Compute GP.\n							      \
-	.cpload $25\n							      \
-	.set reorder\n							      \
-	# Save slot call pc.\n						      \
-        move	$2, $31\n						      \
-	# Save arguments and sp value in stack.\n			      \
-	dsubu	$29, 10*8\n						      \
-	.cprestore 8*8\n						      \
-	sd	$15, 9*8($29)\n						      \
-	sd	$4, 3*8($29)\n						      \
-	sd	$5, 4*8($29)\n						      \
-	sd	$6, 5*8($29)\n						      \
-	sd	$7, 6*8($29)\n						      \
-	sd	$16, 7*8($29)\n						      \
-	move	$16, $29\n						      \
-	move	$4, $24\n						      \
-	move	$5, $15\n						      \
-	move	$6, $3\n						      \
-	move	$7, $2\n						      \
-	jal	__dl_runtime_resolve\n					      \
-	move	$29, $16\n						      \
-	ld	$31, 9*8($29)\n						      \
-	ld	$4, 3*8($29)\n						      \
-	ld	$5, 4*8($29)\n						      \
-	ld	$6, 5*8($29)\n						      \
-	ld	$7, 6*8($29)\n						      \
-	ld	$16, 7*8($29)\n						      \
-	daddu	$29, 10*8\n						      \
-	move	$25, $2\n						      \
-	jr	$25\n							      \
-	.end	_dl_runtime_resolve\n					      \
-");
-#else
 #define ELF_MACHINE_RUNTIME_TRAMPOLINE					      \
 /* The flag _dl_mips_gnu_objects is set if all dynamic objects are	      \
    generated by the gnu linker. */					      \
@@ -550,7 +434,6 @@ _dl_runtime_resolve:\n							      \
 	jr	$25\n							      \
 	.end	_dl_runtime_resolve\n					      \
 ");
-#endif
 
 /* Mask identifying addresses reserved for the user program,
    where the dynamic linker should not map anything.  */
@@ -573,78 +456,6 @@ _dl_runtime_resolve:\n							      \
    2) That under Linux the entry is named __start
       and not just plain _start.  */
 
-#ifdef __mips64
-#define RTLD_START asm ("\
-	.text\n\
-	.align	3\n"\
-_RTLD_PROLOGUE (ENTRY_POINT)\
-"	.globl _dl_start_user\n\
-	.set noreorder\n\
-	bltzal $0, 0f\n\
-	nop\n\
-0:	.cpload $31\n\
-	.set reorder\n\
-	# i386 ABI book says that the first entry of GOT holds\n\
-	# the address of the dynamic structure. Though MIPS ABI\n\
-	# doesn't say nothing about this, I emulate this here.\n\
-	dla $4, _DYNAMIC\n\
-	sd $4, -0x7ff0($28)\n\
-	move $4, $29\n\
-	jal _dl_start\n\
-	# Get the value of label '_dl_start_user' in t9 ($25).\n\
-	dla $25, _dl_start_user\n\
-_dl_start_user:\n\
-	.set noreorder\n\
-	.cpload $25\n\
-	.set reorder\n\
-	move $16, $28\n\
-	# Save the user entry point address in saved register.\n\
-	move $17, $2\n\
-	# See if we were run as a command with the executable file\n\
-	# name as an extra leading argument.\n\
-	ld $2, _dl_skip_args\n\
-	beq $2, $0, 1f\n\
-	# Load the original argument count.\n\
-	ld $4, 0($29)\n\
-	# Subtract _dl_skip_args from it.\n\
-	dsubu $4, $2\n\
-	# Adjust the stack pointer to skip _dl_skip_args words.\n\
-	dsll $2,2\n\
-	daddu $29, $2\n\
-	# Save back the modified argument count.\n\
-	sd $4, 0($29)\n\
-	# Get _dl_default_scope[2] as argument in _dl_init_next call below.\n\
-1:	dla $2, _dl_default_scope\n\
-	ld $4, 2*8($2)\n\
-	# Call _dl_init_next to return the address of an initializer\n\
-	# function to run.\n\
-	jal _dl_init_next\n\
-	move $28, $16\n\
-	# Check for zero return,  when out of initializers.\n\
-	beq $2, $0, 2f\n\
-	# Call the shared object initializer function.\n\
-	move $25, $2\n\
-	ld $4, 0($29)\n\
-	ld $5, 1*8($29)\n\
-	ld $6, 2*8($29)\n\
-	ld $7, 3*8($29)\n\
-	jalr $25\n\
-	move $28, $16\n\
-	# Loop to call _dl_init_next for the next initializer.\n\
-	b 1b\n\
-	# Pass our finalizer function to the user in ra.\n\
-2:	dla $31, _dl_fini\n\
-	# Jump to the user entry point.\n\
-	move $25, $17\n\
-	ld $4, 0($29)\n\
-	ld $5, 1*8($29)\n\
-	ld $6, 2*8$29)\n\
-	ld $7, 3*8($29)\n\
-	jr $25\n"\
-_RTLD_EPILOGUE(ENTRY_POINT) \
-);
-
-#else
 #define RTLD_START asm ("\
 	.text\n"\
 _RTLD_PROLOGUE(ENTRY_POINT)\
@@ -718,8 +529,7 @@ _dl_start_user:\n\
 	lw $7, 12($29)\n\
 	jr $25\n"\
 _RTLD_EPILOGUE(ENTRY_POINT)\
-");
-#endif
+);
 
 /* The MIPS never uses Elfxx_Rela relocations.  */
 #define ELF_MACHINE_NO_RELA 1
diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h
new file mode 100644
index 0000000000..3277b109d9
--- /dev/null
+++ b/sysdeps/mips/mips64/dl-machine.h
@@ -0,0 +1,594 @@
+/* Machine-dependent ELF dynamic relocation inline functions.  MIPS version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
+
+   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.  */
+
+#ifndef dl_machine_h
+#define dl_machine_h
+
+#define ELF_MACHINE_NAME "MIPS"
+
+#include <assert.h>
+#include <entry.h>
+
+#ifndef ENTRY_POINT
+#error ENTRY_POINT needs to be defined for MIPS.
+#endif
+
+#ifndef _RTLD_PROLOGUE
+#ifdef __STDC__
+#define _RTLD_PROLOGUE(entry) "\n\t.globl " #entry \
+			      "\n\t.ent " #entry \
+			      "\n\t" #entry ":\n\t"
+#else
+#define _RTLD_PROLOGUE(entry) "\n\t.globl entry\n\t.ent entry\n\t entry:\n\t"
+#endif
+#endif
+
+#ifndef _RTLD_EPILOGUE
+#ifdef __STDC__
+#define _RTLD_EPILOGUE(entry) "\t.end " #entry "\n"
+#else
+#define _RTLD_EPILOGUE(entry) "\t.end entry\n"
+#endif
+#endif
+
+/* I have no idea what I am doing. */
+#define ELF_MACHINE_RELOC_NOPLT			-1
+#define elf_machine_lookup_noplt_p(type)	(1)
+#define elf_machine_lookup_noexec_p(type)	(0)
+
+/* Translate a processor specific dynamic tag to the index
+   in l_info array.  */
+#define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM)
+
+#if 0
+/* We may need 64k alignment. */
+#define ELF_MACHINE_ALIGN_MASK 0xffff
+#endif
+
+/*
+ * MIPS libraries are usually linked to a non-zero base address.  We
+ * subtrace the base address from the address where we map the object
+ * to.  This results in more efficient address space usage.
+ */
+#if 0
+#define MAP_BASE_ADDR(l) ((l)->l_info[DT_MIPS(BASE_ADDRESS)] ? \
+			  (l)->l_info[DT_MIPS(BASE_ADDRESS)]->d_un.d_ptr : 0)
+#else
+#define MAP_BASE_ADDR(l) 0x5ffe0000
+#endif
+
+/* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
+   with the run-time address of the r_debug structure  */
+#define ELF_MACHINE_DEBUG_SETUP(l,r) \
+do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
+       *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
+       (ElfW(Addr)) (r); \
+   } while (0)
+
+/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+static inline int __attribute__ ((unused))
+elf_machine_matches_host (ElfW(Half) e_machine)
+{
+  switch (e_machine)
+    {
+    case EM_MIPS:
+    case EM_MIPS_RS4_BE:
+      return 1;
+    default:
+      return 0;
+    }
+}
+
+/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
++   first element of the GOT.  This must be inlined in a function which
++   uses global data.  */
++static inline ElfW(Addr)
++elf_machine_dynamic (void)
++{
++  register ElfW(Addr) gp asm ("$28");
++  return * (ElfW(Addr) *) (gp - 0x7ff0);
++}
++
+static inline ElfW(Addr) *
+elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
+{
+  /* FIXME: the offset of gp from GOT may be system-dependent. */
+  return (ElfW(Addr) *) (gpreg - 0x7ff0);
+}
+
+/* Return the run-time address of the _GLOBAL_OFFSET_TABLE_.
+   Must be inlined in a function which uses global data.  */
+static inline ElfW(Addr) *
+elf_machine_got (void)
+{
+  ElfW(Addr) gp;
+
+  __asm__ __volatile__("move %0, $28\n\t" : "=r" (gp));
+  return elf_mips_got_from_gpreg (gp);
+}
+
+
+/* Return the run-time load address of the shared object.  */
+static inline ElfW(Addr)
+elf_machine_load_address (void)
+{
+  ElfW(Addr) addr;
+  asm ("	.set noreorder\n"
+       "	dla %0, here\n"
+       "	bltzal $0, here\n"
+       "	nop\n"
+       "here:	dsubu %0, $31, %0\n"
+       "	.set reorder\n"
+       :	"=r" (addr)
+       :	/* No inputs */
+       :	"$31");
+  return addr;
+}
+
+/* The MSB of got[1] of a gnu object is set to identify gnu objects. */
+#define ELF_MIPS_GNU_GOT1_MASK 0x80000000
+
+/* Relocate GOT. */
+static inline void
+elf_machine_got_rel (struct link_map *map, int lazy)
+{
+  ElfW(Addr) *got;
+  ElfW(Sym) *sym;
+  int i, n;
+  struct link_map **scope;
+  const char *strtab
+    = ((void *) map->l_addr + map->l_info[DT_STRTAB]->d_un.d_ptr);
+
+#define RESOLVE_GOTSYM(sym) \
+    ({ \
+      const ElfW(Sym) *ref = sym; \
+      ElfW(Addr) sym_loadaddr; \
+      sym_loadaddr = _dl_lookup_symbol (strtab + sym->st_name, &ref, scope, \
+					map->l_name, ELF_MACHINE_RELOC_NOPLT);\
+      (ref)? sym_loadaddr + ref->st_value: 0; \
+    })
+
+  got = (ElfW(Addr) *) ((void *) map->l_addr
+			+ map->l_info[DT_PLTGOT]->d_un.d_ptr);
+
+  /* got[0] is reserved. got[1] is also reserved for the dynamic object
+     generated by gnu ld. Skip these reserved entries from relocation.  */
+  i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2: 1;
+  n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
+  /* Add the run-time display to all local got entries. */
+  while (i < n)
+    got[i++] += map->l_addr;
+
+  /* Set scope.  */
+  scope = _dl_object_relocation_scope (map);
+
+  /* Handle global got entries. */
+  got += n;
+  sym = (ElfW(Sym) *) ((void *) map->l_addr
+		       + map->l_info[DT_SYMTAB]->d_un.d_ptr);
+  sym += map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;
+  i = (map->l_info[DT_MIPS (SYMTABNO)]->d_un.d_val
+       - map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val);
+
+  while (i--)
+    {
+      if (sym->st_shndx == SHN_UNDEF)
+	{
+	  if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC)
+	    {
+	      if (sym->st_value && lazy)
+		*got = sym->st_value + map->l_addr;
+	      else
+		*got = RESOLVE_GOTSYM (sym);
+	    }
+	  else /* if (*got == 0 || *got == QS) */
+	    *got = RESOLVE_GOTSYM (sym);
+	}
+      else if (sym->st_shndx == SHN_COMMON)
+	*got = RESOLVE_GOTSYM (sym);
+      else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
+	       && *got != sym->st_value
+	       && lazy)
+	*got += map->l_addr;
+      else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION)
+	{
+	  if (sym->st_other == 0)
+	    *got += map->l_addr;
+	}
+      else
+	*got = RESOLVE_GOTSYM (sym);
+
+      got++;
+      sym++;
+    }
+
+#undef RESOLVE_GOTSYM
+  *_dl_global_scope_end = NULL;
+
+  return;
+}
+
+/* Set up the loaded object described by L so its stub function
+   will jump to the on-demand fixup code in dl-runtime.c.  */
+
+static inline int
+elf_machine_runtime_setup (struct link_map *l, int lazy)
+{
+  ElfW(Addr) *got;
+  extern void _dl_runtime_resolve (ElfW(Word));
+  extern int _dl_mips_gnu_objects;
+
+#ifdef RTLD_BOOTSTRAP
+    {
+      return lazy;
+    }
+#endif
+  if (lazy)
+    {
+      /* The GOT entries for functions have not yet been filled in.
+	 Their initial contents will arrange when called to put an
+	 offset into the .dynsym section in t8, the return address
+	 in t7 and then jump to _GLOBAL_OFFSET_TABLE[0].  */
+      got = (ElfW(Addr) *) ((void *) l->l_addr
+			    + l->l_info[DT_PLTGOT]->d_un.d_ptr);
+
+      /* This function will get called to fix up the GOT entry indicated by
+	 the register t8, and then jump to the resolved address.  */
+      got[0] = (ElfW(Addr)) &_dl_runtime_resolve;
+
+      /* Store l to _GLOBAL_OFFSET_TABLE[1] for gnu object. The MSB
+	 of got[1] of a gnu object is set to identify gnu objects.
+	 Where we can store l for non gnu objects? XXX  */
+      if ((got[1] & ELF_MIPS_GNU_GOT1_MASK) != 0)
+	got[1] = (ElfW(Addr)) ((unsigned) l | ELF_MIPS_GNU_GOT1_MASK);
+      else
+	_dl_mips_gnu_objects = 0;
+    }
+
+  /* Relocate global offset table.  */
+  elf_machine_got_rel (l, lazy);
+
+  return lazy;
+}
+
+/* Get link_map for this object.  */
+static inline struct link_map *
+elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
+{
+  extern int _dl_mips_gnu_objects;
+
+  /* got[1] is reserved to keep its link map address for the shared
+     object generated by gnu linker. If all are such object, we can
+     find link map from current GPREG simply. If not so, get link map
+     for callers object containing STUB_PC.  */
+
+  if (_dl_mips_gnu_objects)
+    {
+      ElfW(Addr) *got = elf_mips_got_from_gpreg (gpreg);
+      ElfW(Word) g1;
+
+      g1 = ((ElfW(Word) *) got)[1];
+
+      if ((g1 & ELF_MIPS_GNU_GOT1_MASK) != 0)
+	return (struct link_map *) (g1 & ~ELF_MIPS_GNU_GOT1_MASK);
+    }
+
+    {
+      struct link_map *l = _dl_loaded;
+      struct link_map *ret = 0;
+      ElfW(Addr) candidate = 0;
+
+      while (l)
+	{
+	  ElfW(Addr) base = 0;
+	  const ElfW(Phdr) *p = l->l_phdr;
+	  ElfW(Half) this, nent = l->l_phnum;
+
+	  /* Get the base. */
+	  for (this = 0; this < nent; this++)
+	    if (p[this].p_type == PT_LOAD)
+	      {
+		base = p[this].p_vaddr + l->l_addr;
+		break;
+	      }
+	  if (! base)
+	    {
+	      l = l->l_next;
+	      continue;
+	    }
+
+	  /* Find closest link base addr. */
+	  if ((base < stub_pc) && (candidate < base))
+	    {
+	      candidate = base;
+	      ret = l;
+	    }
+	  l = l->l_next;
+	}
+      if (candidate && ret && (candidate < stub_pc))
+	return ret;
+      else if (!candidate)
+	return _dl_loaded;
+    }
+
+  _dl_signal_error (0, NULL, "cannot find runtime link map");
+  return NULL;
+}
+
+/* Mips has no PLT but define elf_machine_relplt to be elf_machine_rel. */
+#define elf_machine_relplt elf_machine_rel
+
+/* Define mips specific runtime resolver. The function __dl_runtime_resolve
+   is called from assembler function _dl_runtime_resolve which converts
+   special argument registers t7 ($15) and t8 ($24):
+     t7  address to return to the caller of the function
+     t8  index for this function symbol in .dynsym
+   to usual c arguments.  */
+
+#define ELF_MACHINE_RUNTIME_TRAMPOLINE					      \
+/* The flag _dl_mips_gnu_objects is set if all dynamic objects are	      \
+   generated by the gnu linker. */					      \
+int _dl_mips_gnu_objects = 1;						      \
+									      \
+/* This is called from assembly stubs below which the compiler can't see.  */ \
+static ElfW(Addr)							      \
+__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr))	      \
+                  __attribute__ ((unused));				      \
+									      \
+static ElfW(Addr)							      \
+__dl_runtime_resolve (ElfW(Word) sym_index,				      \
+		      ElfW(Word) return_address,			      \
+		      ElfW(Addr) old_gpreg,				      \
+		      ElfW(Addr) stub_pc)				      \
+{									      \
+  struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);     \
+  const ElfW(Sym) *const symtab						      \
+    = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr);     \
+  const char *strtab							      \
+    = (void *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);		      \
+  const ElfW(Addr) *got							      \
+    = (const ElfW(Addr) *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr);    \
+  const ElfW(Word) local_gotno						      \
+    = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;	      \
+  const ElfW(Word) gotsym						      \
+    = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;	      \
+  const ElfW(Sym) *definer;						      \
+  ElfW(Addr) loadbase;							      \
+  ElfW(Addr) funcaddr;							      \
+  struct link_map **scope;						      \
+									      \
+  /* Look up the symbol's run-time value.  */				      \
+  scope = _dl_object_relocation_scope (l);				      \
+  definer = &symtab[sym_index];						      \
+									      \
+  loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,	      \
+				scope, l->l_name, ELF_MACHINE_RELOC_NOPLT);   \
+									      \
+  *_dl_global_scope_end = NULL;						      \
+									      \
+  /* Apply the relocation with that value.  */				      \
+  funcaddr = loadbase + definer->st_value;				      \
+  *(got + local_gotno + sym_index - gotsym) = funcaddr;			      \
+									      \
+  return funcaddr;							      \
+}									      \
+									      \
+asm ("\n								      \
+	.text\n								      \
+	.align	3\n							      \
+	.globl	_dl_runtime_resolve\n					      \
+	.type	_dl_runtime_resolve,@function\n				      \
+	.ent	_dl_runtime_resolve\n					      \
+_dl_runtime_resolve:\n							      \
+	.set noreorder\n						      \
+	# Save old GP to $3.\n						      \
+	move	$3,$28\n						      \
+	# Modify t9 ($25) so as to point .cpload instruction.\n		      \
+	daddu	$25,2*8\n						      \
+	# Compute GP.\n							      \
+	.cpload $25\n							      \
+	.set reorder\n							      \
+	# Save slot call pc.\n						      \
+        move	$2, $31\n						      \
+	# Save arguments and sp value in stack.\n			      \
+	dsubu	$29, 10*8\n						      \
+	.cprestore 8*8\n						      \
+	sd	$15, 9*8($29)\n						      \
+	sd	$4, 3*8($29)\n						      \
+	sd	$5, 4*8($29)\n						      \
+	sd	$6, 5*8($29)\n						      \
+	sd	$7, 6*8($29)\n						      \
+	sd	$16, 7*8($29)\n						      \
+	move	$16, $29\n						      \
+	move	$4, $24\n						      \
+	move	$5, $15\n						      \
+	move	$6, $3\n						      \
+	move	$7, $2\n						      \
+	jal	__dl_runtime_resolve\n					      \
+	move	$29, $16\n						      \
+	ld	$31, 9*8($29)\n						      \
+	ld	$4, 3*8($29)\n						      \
+	ld	$5, 4*8($29)\n						      \
+	ld	$6, 5*8($29)\n						      \
+	ld	$7, 6*8($29)\n						      \
+	ld	$16, 7*8($29)\n						      \
+	daddu	$29, 10*8\n						      \
+	move	$25, $2\n						      \
+	jr	$25\n							      \
+	.end	_dl_runtime_resolve\n					      \
+");
+
+/* Mask identifying addresses reserved for the user program,
+   where the dynamic linker should not map anything.  */
+#define ELF_MACHINE_USER_ADDRESS_MASK	0x80000000UL
+
+
+
+/* Initial entry point code for the dynamic linker.
+   The C function `_dl_start' is the real entry point;
+   its return value is the user program's entry point.
+   Note how we have to be careful about two things:
+
+   1) That we allocate a minimal stack of 24 bytes for
+      every function call, the MIPS ABI states that even
+      if all arguments are passed in registers the procedure
+      called can use the 16 byte area pointed to by $sp
+      when it is called to store away the arguments passed
+      to it.
+
+   2) That under Linux the entry is named __start
+      and not just plain _start.  */
+
+#define RTLD_START asm ("\
+	.text\n\
+	.align	3\n"\
+_RTLD_PROLOGUE (ENTRY_POINT)\
+"	.globl _dl_start_user\n\
+	.set noreorder\n\
+	bltzal $0, 0f\n\
+	nop\n\
+0:	.cpload $31\n\
+	.set reorder\n\
+	# i386 ABI book says that the first entry of GOT holds\n\
+	# the address of the dynamic structure. Though MIPS ABI\n\
+	# doesn't say nothing about this, I emulate this here.\n\
+	dla $4, _DYNAMIC\n\
+	sd $4, -0x7ff0($28)\n\
+	move $4, $29\n\
+	jal _dl_start\n\
+	# Get the value of label '_dl_start_user' in t9 ($25).\n\
+	dla $25, _dl_start_user\n\
+_dl_start_user:\n\
+	.set noreorder\n\
+	.cpload $25\n\
+	.set reorder\n\
+	move $16, $28\n\
+	# Save the user entry point address in saved register.\n\
+	move $17, $2\n\
+	# See if we were run as a command with the executable file\n\
+	# name as an extra leading argument.\n\
+	ld $2, _dl_skip_args\n\
+	beq $2, $0, 1f\n\
+	# Load the original argument count.\n\
+	ld $4, 0($29)\n\
+	# Subtract _dl_skip_args from it.\n\
+	dsubu $4, $2\n\
+	# Adjust the stack pointer to skip _dl_skip_args words.\n\
+	dsll $2,2\n\
+	daddu $29, $2\n\
+	# Save back the modified argument count.\n\
+	sd $4, 0($29)\n\
+	# Get _dl_default_scope[2] as argument in _dl_init_next call below.\n\
+1:	dla $2, _dl_default_scope\n\
+	ld $4, 2*8($2)\n\
+	# Call _dl_init_next to return the address of an initializer\n\
+	# function to run.\n\
+	jal _dl_init_next\n\
+	move $28, $16\n\
+	# Check for zero return,  when out of initializers.\n\
+	beq $2, $0, 2f\n\
+	# Call the shared object initializer function.\n\
+	move $25, $2\n\
+	ld $4, 0($29)\n\
+	ld $5, 1*8($29)\n\
+	ld $6, 2*8($29)\n\
+	ld $7, 3*8($29)\n\
+	jalr $25\n\
+	move $28, $16\n\
+	# Loop to call _dl_init_next for the next initializer.\n\
+	b 1b\n\
+	# Pass our finalizer function to the user in ra.\n\
+2:	dla $31, _dl_fini\n\
+	# Jump to the user entry point.\n\
+	move $25, $17\n\
+	ld $4, 0($29)\n\
+	ld $5, 1*8($29)\n\
+	ld $6, 2*8$29)\n\
+	ld $7, 3*8($29)\n\
+	jr $25\n"\
+_RTLD_EPILOGUE(ENTRY_POINT) \
+);
+
+
+/* The MIPS never uses Elfxx_Rela relocations.  */
+#define ELF_MACHINE_NO_RELA 1
+
+#endif /* !dl_machine_h */
+
+#ifdef RESOLVE
+
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+   MAP is the object containing the reloc.  */
+
+static inline void
+elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
+		 const ElfW(Sym) *sym, const struct r_found_version *version)
+{
+  ElfW(Addr) *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
+  ElfW(Addr) loadbase;
+  ElfW(Addr) undo __attribute__ ((unused));
+
+  switch (ELFW(R_TYPE) (reloc->r_info))
+    {
+    case R_MIPS_REL32:
+      {
+	ElfW(Addr) undo = 0;
+
+	if (ELFW(ST_BIND) (sym->st_info) == STB_LOCAL
+	    && (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION
+		|| ELFW(ST_TYPE) (sym->st_info) == STT_NOTYPE))
+	  {
+	    *reloc_addr += map->l_addr;
+	    break;
+	  }
+#ifndef RTLD_BOOTSTRAP
+	/* This is defined in rtld.c, but nowhere in the static libc.a;
+	   make the reference weak so static programs can still link.  This
+	   declaration cannot be done when compiling rtld.c (i.e.  #ifdef
+	   RTLD_BOOTSTRAP) because rtld.c contains the common defn for
+	   _dl_rtld_map, which is incompatible with a weak decl in the same
+	   file.  */
+	weak_extern (_dl_rtld_map);
+	if (map == &_dl_rtld_map)
+	  /* Undo the relocation done here during bootstrapping.  Now we will
+	     relocate it anew, possibly using a binding found in the user
+	     program or a loaded library rather than the dynamic linker's
+	     built-in definitions used while loading those libraries.  */
+	  undo = map->l_addr + sym->st_value;
+#endif
+	  loadbase = RESOLVE (&sym, version, 0);
+	  *reloc_addr += (sym ? (loadbase + sym->st_value) : 0) - undo;
+	}
+      break;
+    case R_MIPS_NONE:		/* Alright, Wilbur.  */
+      break;
+    default:
+      assert (! "unexpected dynamic reloc type");
+      break;
+    }
+}
+
+static inline void
+elf_machine_lazy_rel (struct link_map *map, const ElfW(Rel) *reloc)
+{
+  /* Do nothing.  */
+}
+
+#endif /* RESOLVE */
diff --git a/sysdeps/mips/rtld-parms b/sysdeps/mips/rtld-parms
new file mode 100644
index 0000000000..72f09e7341
--- /dev/null
+++ b/sysdeps/mips/rtld-parms
@@ -0,0 +1,15 @@
+ifndef rtld-wordsize
+rtld-wordsize = 32
+endif
+ifndef rtld-oformat
+rtld-oformat = elf$(rtld-wordsize)-bigmips
+endif
+ifndef rtld-arch
+rtld-arch = mips
+endif
+ifndef rtld-entry
+rtld-entry = __start
+endif
+ifndef rtld-base
+rtld-base = 0x0fb60000 + SIZEOF_HEADERS
+endif
diff --git a/sysdeps/powerpc/bits/endian.h b/sysdeps/powerpc/bits/endian.h
index e0e90cfd7a..d3ff74f12f 100644
--- a/sysdeps/powerpc/bits/endian.h
+++ b/sysdeps/powerpc/bits/endian.h
@@ -1,3 +1,32 @@
-/* PowerPC is big-endian.  */
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-#define __BYTE_ORDER __BIG_ENDIAN
+   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.  */
+
+/* PowerPC can be little or big endian.  Hopefully gcc will know...  */
+
+#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN
+# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+#  error Please fix sysdeps/powerpc/bits/endian.h (compiling bi-endian?).
+# endif
+# define __BYTE_ORDER __BIG_ENDIAN
+#else
+# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+#  define __BYTE_ORDER __LITTLE_ENDIAN
+# else
+#  error Please fix sysdeps/powerpc/bits/endian.h.
+# endif
+#endif
diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h
index 6ddbea584b..12bcf43e4d 100644
--- a/sysdeps/powerpc/dl-machine.h
+++ b/sysdeps/powerpc/dl-machine.h
@@ -598,11 +598,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
       if (sym->st_size > refsym->st_size
 	  || (_dl_verbose && sym->st_size < refsym->st_size))
 	{
+	  extern char **_dl_argv;
 	  const char *strtab;
 
 	  strtab = ((void *) map->l_addr
 		    + map->l_info[DT_STRTAB]->d_un.d_ptr);
-	  _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
+	  _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+			    ": Symbol `", strtab + refsym->st_name,
 			    "' has different size in shared object, "
 			    "consider re-linking\n", NULL);
 	}
diff --git a/sysdeps/sparc/dl-machine.h b/sysdeps/sparc/dl-machine.h
index 20def2c5b7..1d193ae91c 100644
--- a/sysdeps/sparc/dl-machine.h
+++ b/sysdeps/sparc/dl-machine.h
@@ -133,11 +133,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  if (sym->st_size > refsym->st_size
 	      || (_dl_verbose && sym->st_size < refsym->st_size))
 	    {
+	      extern char **_dl_argv;
 	      const char *strtab;
 
 	      strtab = ((void *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
-	      _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
+	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+				": Symbol `", strtab + refsym->st_name,
 				"' has different size in shared object, "
 				"consider re-linking\n", NULL);
 	    }
diff --git a/sysdeps/sparc64/dl-machine.h b/sysdeps/sparc64/dl-machine.h
index 21c3d6b9bd..ad216b79dc 100644
--- a/sysdeps/sparc64/dl-machine.h
+++ b/sysdeps/sparc64/dl-machine.h
@@ -110,11 +110,13 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 	  if (sym->st_size > refsym->st_size
 	      || (_dl_verbose && sym->st_size < refsym->st_size))
 	    {
+	      extern char **_dl_argv;
 	      const char *strtab;
 
 	      strtab = ((void *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
-	      _dl_sysdep_error ("Symbol `", strtab + refsym->st_name,
+	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+				": Symbol `", strtab + refsym->st_name,
 				"' has different size in shared object, "
 				"consider re-linking\n", NULL);
 	    }
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 2004a48b42..1c5da4b9bf 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -9,7 +9,7 @@ sysdep_routines += sysctl clone llseek
 
 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
 		  sys/module.h sys/io.h sys/klog.h sys/kdaemon.h \
-		  sys/user.h syscall-list.h sys/sysmacros.h sys/procfs.h \
+		  sys/user.h sys/sysmacros.h sys/procfs.h \
 		  sys/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h \
 		  sys/quota.h
 
diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.h b/sysdeps/unix/sysv/linux/mips/lxstat.c
index 7907b2f2d2..7907b2f2d2 100644
--- a/sysdeps/unix/sysv/linux/mips/lxstat.h
+++ b/sysdeps/unix/sysv/linux/mips/lxstat.c
diff --git a/sysdeps/unix/sysv/linux/mips/sgidef.h b/sysdeps/unix/sysv/linux/mips/sgidefs.h
index a36ece0175..a36ece0175 100644
--- a/sysdeps/unix/sysv/linux/mips/sgidef.h
+++ b/sysdeps/unix/sysv/linux/mips/sgidefs.h
diff --git a/sysdeps/vax/htonl.s b/sysdeps/vax/htonl.s
index af5b96c22f..93e13ea9a1 100644
--- a/sysdeps/vax/htonl.s
+++ b/sysdeps/vax/htonl.s
@@ -23,8 +23,11 @@
 
 #include "DEFS.h"
 
-ENTRY(htonl, 0)
+ENTRY(__htonl, 0)
 	rotl	$-8,4(ap),r0
 	insv	r0,$16,$8,r0
 	movb	7(ap),r0
 	ret
+strong_alias (__htonl, __ntohl)
+weak_alias (__htonl, htonl)
+weak_alias (__ntohl, ntohl)
diff --git a/sysdeps/vax/htons.s b/sysdeps/vax/htons.s
index c500e84506..16964c2861 100644
--- a/sysdeps/vax/htons.s
+++ b/sysdeps/vax/htons.s
@@ -28,3 +28,6 @@ ENTRY(htons, 0)
 	movb	5(ap),r0
 	movzwl	r0,r0
 	ret
+strong_alias (__htons, __ntohs)
+weak_alias (__htons, htons)
+weak_alias (__ntohs, ntohs)
diff --git a/sysdeps/vax/ntohl.s b/sysdeps/vax/ntohl.s
deleted file mode 100644
index 0fcaa2f8e4..0000000000
--- a/sysdeps/vax/ntohl.s
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-	.asciz "@(#)ntohl.s	5.5 (Berkeley) 6/27/88"
-#endif /* LIBC_SCCS and not lint */
-
-/* hostorder = ntohl(netorder) */
-
-#include "DEFS.h"
-
-ENTRY(ntohl, 0)
-	rotl	$-8,4(ap),r0
-	insv	r0,$16,$8,r0
-	movb	7(ap),r0
-	ret
diff --git a/sysdeps/vax/ntohs.s b/sysdeps/vax/ntohs.s
deleted file mode 100644
index 626a37bf09..0000000000
--- a/sysdeps/vax/ntohs.s
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-	.asciz "@(#)ntohs.s	5.5 (Berkeley) 6/27/88"
-#endif /* LIBC_SCCS and not lint */
-
-/* hostorder = ntohs(netorder) */
-
-#include "DEFS.h"
-
-ENTRY(ntohs, 0)
-	rotl	$8,4(ap),r0
-	movb	5(ap),r0
-	movzwl	r0,r0
-	ret