about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-07-12 23:35:19 +0000
committerUlrich Drepper <drepper@redhat.com>1997-07-12 23:35:19 +0000
commitf21acc89c06c14160eab88246e9dbe0b17eb5f89 (patch)
tree096a11e16faed78c69e77fd79b7c8bb4dc0bd051
parent2d7da676f38bc00f40d2b604036c0295c156529e (diff)
downloadglibc-f21acc89c06c14160eab88246e9dbe0b17eb5f89.tar.gz
glibc-f21acc89c06c14160eab88246e9dbe0b17eb5f89.tar.xz
glibc-f21acc89c06c14160eab88246e9dbe0b17eb5f89.zip
1997-07-13 01:18  Ulrich Drepper  <drepper@cygnus.com>

	* setjmp/setjmp.h: Define _setjmp and _longjmp also if __USE_XOPEN.

	* sysdeps/unix/sysv/linux/bits/ipc.h: Fix comment.
	* sysdeps/unix/sysv/linux/bits/msq.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/sem.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/shm.h: Likewise.

	* time/Makefile (routines): Add getdate.
	* time/time.h: Add prototype for getdate and getdate_r.
	* time/getdate.c: New file.
	Provided by Mark Kettenis <kettenis@phys.uva.nl>.

1997-06-30 14:49  H.J. Lu  <hjl@gnu.ai.mit.edu>

	From Ralf Baechle <ralf@informatik.uni-koblenz.de> on
	Sat Jun 21 18:11:21 1997:

	* sysdeps/unix/sysv/linux/syscalls.list (swapon): Add __swapon alias.
	(swapoff): New.

	* elf/Makefile: Add linker script support.
	(headers): Add bits/dlfcn.h.

	* elf/dl-load.c (MAP_BASE_ADDR): New.

	* elf/dlfcn.h: Include <bits/dlfcn.h>.

	* elf/elf.h: Add MIPS support.

	* sysdeps/generic/Dist: Add entry.h.
	* sysdeps/generic/entry.h: New, define the entry symbol.

	* elf/rtld.c (_start): Include <entry.h>.  Change to ENTRY_POINT.
	* sysdeps/generic/dl-sysdep.c (_start): Likewise.
	* mips/elf/start.S (_start): Likewise.

	* sysdeps/mips/bsd-_setjmp.S: Fix PIC.
	* sysdeps/mips/bsd-setjmp.S: Likewise.
	* sysdeps/mips/setjmp.S: Likewise.
	* mips/elf/start.S: Likewise.
	* sysdeps/unix/mips/brk.S: Likewise.
	* sysdeps/unix/mips/sysdep.S: Likewise.
	* sysdeps/unix/mips/sysdep.h: Likewise.
	* sysdeps/unix/mips/wait.S: Likewise.

	* sysdeps/mips/dl-machine.h: Update for Linux/MIPS.
	* sysdeps/mips/fpu_control.h: Likewise.

	* sysdeps/generic/bits/dlfcn.h: New file.

	* sysdeps/mips/rtld-ldscript.in: New for Linux/MIPS.
	* sysdeps/mips/rtld-parms: Likewise.
	* sysdeps/mips/bits/dlfcn.h: Likewise.
	* sysdeps/mips/mips64/rtld-parms: Likewise.
	* sysdeps/mips/mipsel/rtld-parms: Likewise.
	* sysdeps/unix/sysv/linux/mips/Dist: Likewise.
	* sysdeps/unix/sysv/linux/mips/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/mips/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/mips/entry.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/fpregdef.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/fxstat.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel_sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel_stat.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel_termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/lxstat.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/regdef.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sgidefs.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/mips/ustat.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/xmknod.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/xstat.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/endian.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h:
	* sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/shm.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/signum.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/socket.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/statfs.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/time.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/acct.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/asm.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/cachectl.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/fpregdef.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/regdef.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/syscall.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/sysmips.h: Likewise.

1997-04-09 19:05  H.J. Lu (hjl@gnu.ai.mit.edu)

	* isomac.c (xstrndup): New, use it instead of strndup ().

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

	* sysdeps/i386/dl-machine.h (elf_machine_rel): Print
	the program name for different sizes.

1997-07-10 15:47  Fila Kolodny  <fila@ibi.com>

	* nis/ypclnt.c: Change references to MAXHOSTNAMELEN to NIS_MAXNAMELEN.
	Add include of rpcsvc/nis.h.
	* inet/getnameinfo.c: Delete references to MAXHOSTNAMELEN.
	* sysdeps/posix/getaddrinfo.c: Likewise.
	Change size of variable buffer to be big enough to hold an IPv6
	address in printable format.

1997-07-12 18:47  Ulrich Drepper  <drepper@cygnus.com>

	* assert/assert.h [!NDEBUG] (assert, assert_perror): Don't use ||
	and && in tests to allow use in C++ code which overloads these
	operators.  Reported by Istvan Marko <istvan@cmdmail.amd.com>.

	* configure.in: Move mips64* recognition before mips*.
	Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.

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

	* Makerules (lib%.so, $(common-objpfx)libc.so): Don't use
	automatic variables in dependency lists.
	(build-shlib): Always filter out the version script file.
	* extra-lib.mk ($(objpfx)$(lib).so): Depend on version script.

1997-07-12 17:56  Ulrich Drepper  <drepper@cygnus.com>

	* login/login.c (tty_name): Test return value of ttyname_r for !=
	0, not < 0.
	* misc/ttyslot.c (ttyslot): Test return value of ttyname_r for ==
	0, not >= 0.
	* sysdeps/unix/getlogin.c (getlogin): Test return value of
	ttyname_r for != 0.
	* sysdeps/unix/getlogin_r.c (getlogin_r): Likewise.

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

	* login/utmp_file.c (getutline_r_file): Fix type: compare with
	*result.

1997-07-11 00:21  Mark Kettenis  <kettenis@phys.uva.nl>

	* login/Makefile (headers): Add utmpx.h and bits/utmpx.h.

1997-07-09 19:21  Mark Kettenis  <kettenis@phys.uva.nl>

	* login/programs/utmpd.c, login/programs/database.c,
	login/programs/request.c: Prepare messages for
	internationalization.

	* login/programs/utmpd.c:
	(main): Change handling of errors in opening the database.
	* login/programs/database.c:
	(open_database, synchronize_dtatabase, initialize_database):
	Properly handle errors.
	(get_mtime): Use fstat instead of stat.  All callers changed.

	* login/getutent_r.c: Make setutxent a weak alias for __setutxent.
	* login/getutent.c: Rename getutent to __getutent and make
	getutent a weak alias.
	Make getutxent a weak alias for	__getutent.
	* login/utmpx.h: New file.
	* sysdeps/gnu/bits/utmp.h: Cleanup.  Added comments.
	* sysdeps/gnu/bits/utmpx.h: New file.

	* stdio-common/strops.c: Partialy undo last change.  Will need
	more investigation.
-rw-r--r--ChangeLog171
-rw-r--r--Makerules6
-rw-r--r--assert/assert.h40
-rw-r--r--bits/dlfcn.h33
-rwxr-xr-xconfigure2754
-rw-r--r--configure.in2
-rw-r--r--elf/Makefile27
-rw-r--r--elf/dl-load.c12
-rw-r--r--elf/dlfcn.h11
-rw-r--r--elf/elf.h4
-rw-r--r--elf/rtld.c5
-rw-r--r--extra-lib.mk3
-rw-r--r--inet/getnameinfo.c55
-rw-r--r--isomac.c17
-rw-r--r--libio/strops.c4
-rw-r--r--login/Makefile2
-rw-r--r--login/getutent.c6
-rw-r--r--login/getutent_r.c5
-rw-r--r--login/login.c2
-rw-r--r--login/programs/database.c99
-rw-r--r--login/programs/request.c6
-rw-r--r--login/programs/utmpd.c19
-rw-r--r--login/utmp_file.c12
-rw-r--r--login/utmpx.h50
-rw-r--r--misc/ttyslot.c2
-rw-r--r--nis/ypclnt.c5
-rw-r--r--setjmp/setjmp.h14
-rw-r--r--sysdeps/generic/Dist1
-rw-r--r--sysdeps/generic/bits/dlfcn.h33
-rw-r--r--sysdeps/generic/dl-sysdep.c3
-rw-r--r--sysdeps/generic/entry.h1
-rw-r--r--sysdeps/gnu/bits/utmp.h84
-rw-r--r--sysdeps/gnu/bits/utmpx.h79
-rw-r--r--sysdeps/i386/dl-machine.h4
-rw-r--r--sysdeps/mips/bits/dlfcn.h42
-rw-r--r--sysdeps/mips/bsd-_setjmp.S13
-rw-r--r--sysdeps/mips/bsd-setjmp.S13
-rw-r--r--sysdeps/mips/dl-machine.h496
-rw-r--r--sysdeps/mips/elf/start.S55
-rw-r--r--sysdeps/mips/fpu_control.h90
-rw-r--r--sysdeps/mips/mips64/rtld-parms3
-rw-r--r--sysdeps/mips/mipsel/rtld-parms3
-rw-r--r--sysdeps/mips/rtld-ldscript.in106
-rw-r--r--sysdeps/mips/setjmp.S22
-rw-r--r--sysdeps/posix/getaddrinfo.c8
-rw-r--r--sysdeps/unix/getlogin.c4
-rw-r--r--sysdeps/unix/getlogin_r.c10
-rw-r--r--sysdeps/unix/mips/brk.S44
-rw-r--r--sysdeps/unix/mips/sysdep.S25
-rw-r--r--sysdeps/unix/mips/sysdep.h26
-rw-r--r--sysdeps/unix/mips/wait.S6
-rw-r--r--sysdeps/unix/sysv/linux/bits/ipc.h2
-rw-r--r--sysdeps/unix/sysv/linux/bits/msq.h2
-rw-r--r--sysdeps/unix/sysv/linux/bits/sem.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/shm.h2
-rw-r--r--sysdeps/unix/sysv/linux/mips/Dist3
-rw-r--r--sysdeps/unix/sysv/linux/mips/Makefile10
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/endian.h12
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/fcntl.h100
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h71
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/ipc.h85
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/shm.h92
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sigaction.h62
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/signum.h30
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/socket.h178
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/stat.h97
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/statfs.h44
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/termios.h260
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/time.h54
-rw-r--r--sysdeps/unix/sysv/linux/mips/clone.S125
-rw-r--r--sysdeps/unix/sysv/linux/mips/entry.h1
-rw-r--r--sysdeps/unix/sysv/linux/mips/fpregdef.h1
-rw-r--r--sysdeps/unix/sysv/linux/mips/fxstat.c80
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_sigaction.h22
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_stat.h28
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_termios.h20
-rw-r--r--sysdeps/unix/sysv/linux/mips/lxstat.h80
-rw-r--r--sysdeps/unix/sysv/linux/mips/regdef.h1
-rw-r--r--sysdeps/unix/sysv/linux/mips/sgidef.h28
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/acct.h66
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/asm.h28
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/cachectl.h42
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/fpregdef.h27
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/procfs.h109
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/regdef.h29
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/syscall.h1187
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/sysmips.h36
-rw-r--r--sysdeps/unix/sysv/linux/mips/syscalls.list46
-rw-r--r--sysdeps/unix/sysv/linux/mips/ustat.c35
-rw-r--r--sysdeps/unix/sysv/linux/mips/xmknod.c47
-rw-r--r--sysdeps/unix/sysv/linux/mips/xstat.c80
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list3
-rw-r--r--time/Makefile2
-rw-r--r--time/getdate.c247
-rw-r--r--time/time.h32
95 files changed, 4751 insertions, 3296 deletions
diff --git a/ChangeLog b/ChangeLog
index 67048cc6a5..696a336389 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,171 @@
+1997-07-13 01:18  Ulrich Drepper  <drepper@cygnus.com>
+
+	* setjmp/setjmp.h: Define _setjmp and _longjmp also if __USE_XOPEN.
+
+	* sysdeps/unix/sysv/linux/bits/ipc.h: Fix comment.
+	* sysdeps/unix/sysv/linux/bits/msq.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/sem.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/shm.h: Likewise.
+
+	* time/Makefile (routines): Add getdate.
+	* time/time.h: Add prototype for getdate and getdate_r.
+	* time/getdate.c: New file.
+	Provided by Mark Kettenis <kettenis@phys.uva.nl>.
+
+1997-06-30 14:49  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+	From Ralf Baechle <ralf@informatik.uni-koblenz.de> on
+	Sat Jun 21 18:11:21 1997:
+
+	* sysdeps/unix/sysv/linux/syscalls.list (swapon): Add __swapon alias.
+	(swapoff): New.
+
+	* elf/Makefile: Add linker script support.
+	(headers): Add bits/dlfcn.h.
+
+	* elf/dl-load.c (MAP_BASE_ADDR): New.
+
+	* elf/dlfcn.h: Include <bits/dlfcn.h>.
+
+	* elf/elf.h: Add MIPS support.
+
+	* sysdeps/generic/Dist: Add entry.h.
+	* sysdeps/generic/entry.h: New, define the entry symbol.
+
+	* elf/rtld.c (_start): Include <entry.h>.  Change to ENTRY_POINT.
+	* sysdeps/generic/dl-sysdep.c (_start): Likewise.
+	* mips/elf/start.S (_start): Likewise.
+
+	* sysdeps/mips/bsd-_setjmp.S: Fix PIC.
+	* sysdeps/mips/bsd-setjmp.S: Likewise.
+	* sysdeps/mips/setjmp.S: Likewise.
+	* mips/elf/start.S: Likewise.
+	* sysdeps/unix/mips/brk.S: Likewise.
+	* sysdeps/unix/mips/sysdep.S: Likewise.
+	* sysdeps/unix/mips/sysdep.h: Likewise.
+	* sysdeps/unix/mips/wait.S: Likewise.
+
+	* sysdeps/mips/dl-machine.h: Update for Linux/MIPS.
+	* sysdeps/mips/fpu_control.h: Likewise.
+
+	* sysdeps/generic/bits/dlfcn.h: New file.
+
+	* sysdeps/mips/rtld-ldscript.in: New for Linux/MIPS.
+	* sysdeps/mips/rtld-parms: Likewise.
+	* sysdeps/mips/bits/dlfcn.h: Likewise.
+	* sysdeps/mips/mips64/rtld-parms: Likewise.
+	* sysdeps/mips/mipsel/rtld-parms: Likewise.
+	* sysdeps/unix/sysv/linux/mips/Dist: Likewise.
+	* sysdeps/unix/sysv/linux/mips/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/mips/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/mips/entry.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/fpregdef.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/fxstat.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/kernel_sigaction.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/kernel_stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/kernel_termios.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/lxstat.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/regdef.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sgidefs.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/mips/ustat.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/xmknod.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/xstat.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/endian.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h:
+	* sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/shm.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/signum.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/socket.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/statfs.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/time.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/acct.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/asm.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/cachectl.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/fpregdef.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/procfs.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/regdef.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/syscall.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/sysmips.h: Likewise.
+
+1997-04-09 19:05  H.J. Lu (hjl@gnu.ai.mit.edu)
+
+	* isomac.c (xstrndup): New, use it instead of strndup ().
+
+1997-07-02 08:55  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+	* sysdeps/i386/dl-machine.h (elf_machine_rel): Print
+	the program name for different sizes.
+
+1997-07-10 15:47  Fila Kolodny  <fila@ibi.com>
+
+	* nis/ypclnt.c: Change references to MAXHOSTNAMELEN to NIS_MAXNAMELEN.
+	Add include of rpcsvc/nis.h.
+	* inet/getnameinfo.c: Delete references to MAXHOSTNAMELEN.
+	* sysdeps/posix/getaddrinfo.c: Likewise.
+	Change size of variable buffer to be big enough to hold an IPv6
+	address in printable format.
+
+1997-07-12 18:47  Ulrich Drepper  <drepper@cygnus.com>
+
+	* assert/assert.h [!NDEBUG] (assert, assert_perror): Don't use ||
+	and && in tests to allow use in C++ code which overloads these
+	operators.  Reported by Istvan Marko <istvan@cmdmail.amd.com>.
+
+	* configure.in: Move mips64* recognition before mips*.
+	Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
+
+1997-07-03 20:44  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makerules (lib%.so, $(common-objpfx)libc.so): Don't use
+	automatic variables in dependency lists.
+	(build-shlib): Always filter out the version script file.
+	* extra-lib.mk ($(objpfx)$(lib).so): Depend on version script.
+
+1997-07-12 17:56  Ulrich Drepper  <drepper@cygnus.com>
+
+	* login/login.c (tty_name): Test return value of ttyname_r for !=
+	0, not < 0.
+	* misc/ttyslot.c (ttyslot): Test return value of ttyname_r for ==
+	0, not >= 0.
+	* sysdeps/unix/getlogin.c (getlogin): Test return value of
+	ttyname_r for != 0.
+	* sysdeps/unix/getlogin_r.c (getlogin_r): Likewise.
+
+1997-07-10  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* login/utmp_file.c (getutline_r_file): Fix type: compare with
+	*result.
+
+1997-07-11 00:21  Mark Kettenis  <kettenis@phys.uva.nl>
+
+	* login/Makefile (headers): Add utmpx.h and bits/utmpx.h.
+
+1997-07-09 19:21  Mark Kettenis  <kettenis@phys.uva.nl>
+
+	* login/programs/utmpd.c, login/programs/database.c,
+	login/programs/request.c: Prepare messages for
+	internationalization.
+
+	* login/programs/utmpd.c:
+	(main): Change handling of errors in opening the database.
+	* login/programs/database.c:
+	(open_database, synchronize_dtatabase, initialize_database):
+	Properly handle errors.
+	(get_mtime): Use fstat instead of stat.  All callers changed.
+
+	* login/getutent_r.c: Make setutxent a weak alias for __setutxent.
+	* login/getutent.c: Rename getutent to __getutent and make
+	getutent a weak alias.
+	Make getutxent a weak alias for	__getutent.
+	* login/utmpx.h: New file.
+	* sysdeps/gnu/bits/utmp.h: Cleanup.  Added comments.
+	* sysdeps/gnu/bits/utmpx.h: New file.
+
 1997-07-11 03:00  Ulrich Drepper  <drepper@cygnus.com>
 
 	* inet/inet_ntoa.c: Prevent looking for thread data key if we found
@@ -23,6 +191,9 @@
 	function with return value.
 	Reported by Andreas Jaeger.
 
+	* stdio-common/strops.c: Partialy undo last change.  Will need
+	more investigation.
+
 1997-07-10  Marcus G. Daniels  <marcus@cathcart.sysc.pdx.edu>
 
 	* sysdeps/mach/hurd/select.c (__select): Need bit count for
diff --git a/Makerules b/Makerules
index e4f8a7b559..fb9eebe5a7 100644
--- a/Makerules
+++ b/Makerules
@@ -344,7 +344,7 @@ endif
 # build shared libraries in place from the installed *_pic.a files.
 # $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
 # on other shared objects.
-lib%.so: lib%_pic.a $(load-map-file); $(build-shlib)
+lib%.so: lib%_pic.a; $(build-shlib)
 
 ifeq ($(have-no-whole-archive),yes)
 no-whole-archive = -Wl,--no-whole-archive
@@ -367,7 +367,7 @@ $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS)  \
 	  -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
 	  $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
 	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
-	  -Wl,--whole-archive $(filter-out $(load-map-file),$^) \
+	  -Wl,--whole-archive $(filter-out $($(@F:.so=)-map),$^) \
 	  $(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)
 endef
 
@@ -385,7 +385,7 @@ libc-map = $(..)libc.map
 $(common-objpfx)libc.so: $(elfobjdir)/soinit.so \
 			 $(common-objpfx)libc_pic.a \
 			 $(elfobjdir)/sofini.so $(elfobjdir)/ld.so \
-			 $(load-map-file)
+			 $(libc-map)
 	$(build-shlib)
 ifdef libc.so-version
 $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
diff --git a/assert/assert.h b/assert/assert.h
index c670a66359..3f0d6a3ac1 100644
--- a/assert/assert.h
+++ b/assert/assert.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -37,7 +37,7 @@
 
 #ifdef	NDEBUG
 
-#define	assert(expr)		((void) 0)
+# define assert(expr)		((void) 0)
 
 /* void assert_perror (int errnum);
 
@@ -45,14 +45,12 @@
    error message with the error text for ERRNUM and abort.
    (This is a GNU extension.) */
 
-#ifdef	__USE_GNU
-#define	assert_perror(errnum)	((void) 0)
-#endif
+# ifdef	__USE_GNU
+#  define assert_perror(errnum)	((void) 0)
+# endif
 
 #else /* Not NDEBUG.  */
 
-#include <sys/cdefs.h>
-
 __BEGIN_DECLS
 
 /* This prints an "Assertion failed" message and aborts.  */
@@ -71,27 +69,27 @@ extern void __assert_perror_fail __P ((int __errnum,
 
 __END_DECLS
 
-#define	assert(expr)							      \
-  ((void) ((expr) ||							      \
+# define assert(expr)							      \
+  ((void) ((expr) ? 0 :							      \
 	   (__assert_fail (__STRING(expr),				      \
 			   __FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
 
-#ifdef	__USE_GNU
-#define assert_perror(errnum)						      \
-  ((void) ((errnum) && (__assert_perror_fail ((errnum),			      \
-					      __FILE__, __LINE__,	      \
-					      __ASSERT_FUNCTION), 0)))
-#endif
+# ifdef	__USE_GNU
+#  define assert_perror(errnum)						      \
+  ((void) ((errnum) ? 0 : (__assert_perror_fail ((errnum),		      \
+						 __FILE__, __LINE__,	      \
+						 __ASSERT_FUNCTION), 0)))
+# endif
 
 /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
    which contains the name of the function currently being defined.
    This is broken in G++ before version 2.6.  */
-#if (!defined (__GNUC__) || __GNUC__ < 2 || \
-     __GNUC_MINOR__ < (defined (__cplusplus) ? 6 : 4))
-#define __ASSERT_FUNCTION	((__const char *) 0)
-#else
-#define __ASSERT_FUNCTION	__PRETTY_FUNCTION__
-#endif
+# if (!defined __GNUC__ || __GNUC__ < 2 || \
+     __GNUC_MINOR__ < (defined __cplusplus ? 6 : 4))
+#  define __ASSERT_FUNCTION	((__const char *) 0)
+# else
+#  define __ASSERT_FUNCTION	__PRETTY_FUNCTION__
+# endif
 
 
 #endif /* NDEBUG.  */
diff --git a/bits/dlfcn.h b/bits/dlfcn.h
new file mode 100644
index 0000000000..79604fe8ff
--- /dev/null
+++ b/bits/dlfcn.h
@@ -0,0 +1,33 @@
+/* System dependand definitions for run-time dynamic loading.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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	_BITS_DLFCN_H
+#define	_BITS_DLFCN_H 1
+
+/* The MODE argument to `dlopen' contains one of the following: */
+#define RTLD_LAZY	0x001	/* Lazy function call binding.  */
+#define RTLD_NOW	0x002	/* Immediate function call binding.  */
+#define	RTLD_BINDING_MASK 0x3	/* Mask of binding time value.  */
+
+/* If the following bit is set in the MODE argument to `dlopen',
+   the symbols of the loaded object and its dependencies are made
+   visible as if the object were linked directly into the program.  */
+#define RTLD_GLOBAL	0x100
+
+#endif	/* bits/dlfcn.h */
diff --git a/configure b/configure
index c5b597c5ca..e69de29bb2 100755
--- a/configure
+++ b/configure
@@ -1,2754 +0,0 @@
-#! /bin/sh
-
-# From configure.in CVSid
-
-
-
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12 
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
-  --with-gmp=DIRECTORY	  find GMP source code in DIRECTORY (not needed)"
-ac_help="$ac_help
-  --with-gettext=DIR	  find GNU gettext source code in DIR (not needed)"
-ac_help="$ac_help
-  --with-fp		  if using floating-point hardware [default=yes]"
-ac_help="$ac_help
-  --with-gnu-binutils	  if using GNU binutils (as and ld)"
-ac_help="$ac_help
-  --with-gnu-ld		  if using GNU ld (in the binutils package)"
-ac_help="$ac_help
-  --with-gnu-as		  if using GNU as (in the binutils package)"
-ac_help="$ac_help
-  --with-elf		  if using the ELF object format"
-ac_help="$ac_help
-  --enable-libio          build in GNU libio instead of GNU stdio"
-ac_help="$ac_help
-  --disable-sanity-checks really do not use threads (should not be used
-			  except in special situations) [default=yes]"
-ac_help="$ac_help
-  --enable-shared         build shared library [default=yes if GNU ld & ELF]"
-ac_help="$ac_help
-  --enable-profile        build profiled library [default=yes]"
-ac_help="$ac_help
-  --enable-omitfp         build undebuggable optimized library [default=no]"
-ac_help="$ac_help
-  --enable-bounded        build with runtime bounds checking [default=no]"
-ac_help="$ac_help
-  --enable-add-ons=DIR... configure and build named extra directories"
-ac_help="$ac_help
-  --enable-static-nss     build static NSS modules [default=no]"
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
-  # If the previous option needs an argument, assign it.
-  if test -n "$ac_prev"; then
-    eval "$ac_prev=\$ac_option"
-    ac_prev=
-    continue
-  fi
-
-  case "$ac_option" in
-  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) ac_optarg= ;;
-  esac
-
-  # Accept the important Cygnus configure options, so we can diagnose typos.
-
-  case "$ac_option" in
-
-  -bindir | --bindir | --bindi | --bind | --bin | --bi)
-    ac_prev=bindir ;;
-  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir="$ac_optarg" ;;
-
-  -build | --build | --buil | --bui | --bu)
-    ac_prev=build ;;
-  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build="$ac_optarg" ;;
-
-  -cache-file | --cache-file | --cache-fil | --cache-fi \
-  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-    ac_prev=cache_file ;;
-  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file="$ac_optarg" ;;
-
-  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
-    ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
-  | --da=*)
-    datadir="$ac_optarg" ;;
-
-  -disable-* | --disable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    eval "enable_${ac_feature}=no" ;;
-
-  -enable-* | --enable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "enable_${ac_feature}='$ac_optarg'" ;;
-
-  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
-  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-  | --exec | --exe | --ex)
-    ac_prev=exec_prefix ;;
-  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
-  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
-  | --exec=* | --exe=* | --ex=*)
-    exec_prefix="$ac_optarg" ;;
-
-  -gas | --gas | --ga | --g)
-    # Obsolete; use --with-gas.
-    with_gas=yes ;;
-
-  -help | --help | --hel | --he)
-    # Omit some internal or obsolete options to make the list less imposing.
-    # This message is too long to be a string in the A/UX 3.1 sh.
-    cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
-  --cache-file=FILE       cache test results in FILE
-  --help                  print this message
-  --no-create             do not create output files
-  --quiet, --silent       do not print \`checking...' messages
-  --version               print the version of autoconf that created configure
-Directory and file names:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [same as prefix]
-  --bindir=DIR            user executables in DIR [EPREFIX/bin]
-  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
-  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
-  --datadir=DIR           read-only architecture-independent data in DIR
-                          [PREFIX/share]
-  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
-                          [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
-  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
-  --includedir=DIR        C header files in DIR [PREFIX/include]
-  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
-  --infodir=DIR           info documentation in DIR [PREFIX/info]
-  --mandir=DIR            man documentation in DIR [PREFIX/man]
-  --srcdir=DIR            find the sources in DIR [configure dir or ..]
-  --program-prefix=PREFIX prepend PREFIX to installed program names
-  --program-suffix=SUFFIX append SUFFIX to installed program names
-  --program-transform-name=PROGRAM
-                          run sed PROGRAM on installed program names
-EOF
-    cat << EOF
-Host type:
-  --build=BUILD           configure for building on BUILD [BUILD=HOST]
-  --host=HOST             configure for HOST [guessed]
-  --target=TARGET         configure for TARGET [TARGET=HOST]
-Features and packages:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --x-includes=DIR        X include files are in DIR
-  --x-libraries=DIR       X library files are in DIR
-EOF
-    if test -n "$ac_help"; then
-      echo "--enable and --with options recognized:$ac_help"
-    fi
-    exit 0 ;;
-
-  -host | --host | --hos | --ho)
-    ac_prev=host ;;
-  -host=* | --host=* | --hos=* | --ho=*)
-    host="$ac_optarg" ;;
-
-  -includedir | --includedir | --includedi | --included | --include \
-  | --includ | --inclu | --incl | --inc)
-    ac_prev=includedir ;;
-  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
-  | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir="$ac_optarg" ;;
-
-  -infodir | --infodir | --infodi | --infod | --info | --inf)
-    ac_prev=infodir ;;
-  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir="$ac_optarg" ;;
-
-  -libdir | --libdir | --libdi | --libd)
-    ac_prev=libdir ;;
-  -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir="$ac_optarg" ;;
-
-  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
-  | --libexe | --libex | --libe)
-    ac_prev=libexecdir ;;
-  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
-  | --libexe=* | --libex=* | --libe=*)
-    libexecdir="$ac_optarg" ;;
-
-  -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst \
-  | --locals | --local | --loca | --loc | --lo)
-    ac_prev=localstatedir ;;
-  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
-  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
-    localstatedir="$ac_optarg" ;;
-
-  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
-    ac_prev=mandir ;;
-  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir="$ac_optarg" ;;
-
-  -nfp | --nfp | --nf)
-    # Obsolete; use --without-fp.
-    with_fp=no ;;
-
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c)
-    no_create=yes ;;
-
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-    no_recursion=yes ;;
-
-  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
-  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
-  | --oldin | --oldi | --old | --ol | --o)
-    ac_prev=oldincludedir ;;
-  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
-  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
-  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir="$ac_optarg" ;;
-
-  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-    ac_prev=prefix ;;
-  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix="$ac_optarg" ;;
-
-  -program-prefix | --program-prefix | --program-prefi | --program-pref \
-  | --program-pre | --program-pr | --program-p)
-    ac_prev=program_prefix ;;
-  -program-prefix=* | --program-prefix=* | --program-prefi=* \
-  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix="$ac_optarg" ;;
-
-  -program-suffix | --program-suffix | --program-suffi | --program-suff \
-  | --program-suf | --program-su | --program-s)
-    ac_prev=program_suffix ;;
-  -program-suffix=* | --program-suffix=* | --program-suffi=* \
-  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix="$ac_optarg" ;;
-
-  -program-transform-name | --program-transform-name \
-  | --program-transform-nam | --program-transform-na \
-  | --program-transform-n | --program-transform- \
-  | --program-transform | --program-transfor \
-  | --program-transfo | --program-transf \
-  | --program-trans | --program-tran \
-  | --progr-tra | --program-tr | --program-t)
-    ac_prev=program_transform_name ;;
-  -program-transform-name=* | --program-transform-name=* \
-  | --program-transform-nam=* | --program-transform-na=* \
-  | --program-transform-n=* | --program-transform-=* \
-  | --program-transform=* | --program-transfor=* \
-  | --program-transfo=* | --program-transf=* \
-  | --program-trans=* | --program-tran=* \
-  | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name="$ac_optarg" ;;
-
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil)
-    silent=yes ;;
-
-  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
-    ac_prev=sbindir ;;
-  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
-  | --sbi=* | --sb=*)
-    sbindir="$ac_optarg" ;;
-
-  -sharedstatedir | --sharedstatedir | --sharedstatedi \
-  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
-  | --sharedst | --shareds | --shared | --share | --shar \
-  | --sha | --sh)
-    ac_prev=sharedstatedir ;;
-  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
-  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
-  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
-  | --sha=* | --sh=*)
-    sharedstatedir="$ac_optarg" ;;
-
-  -site | --site | --sit)
-    ac_prev=site ;;
-  -site=* | --site=* | --sit=*)
-    site="$ac_optarg" ;;
-
-  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-    ac_prev=srcdir ;;
-  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir="$ac_optarg" ;;
-
-  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
-  | --syscon | --sysco | --sysc | --sys | --sy)
-    ac_prev=sysconfdir ;;
-  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
-  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir="$ac_optarg" ;;
-
-  -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target ;;
-  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target="$ac_optarg" ;;
-
-  -v | -verbose | --verbose | --verbos | --verbo | --verb)
-    verbose=yes ;;
-
-  -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12"
-    exit 0 ;;
-
-  -with-* | --with-*)
-    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "with_${ac_package}='$ac_optarg'" ;;
-
-  -without-* | --without-*)
-    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    eval "with_${ac_package}=no" ;;
-
-  --x)
-    # Obsolete; use --with-x.
-    with_x=yes ;;
-
-  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
-  | --x-incl | --x-inc | --x-in | --x-i)
-    ac_prev=x_includes ;;
-  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
-  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes="$ac_optarg" ;;
-
-  -x-libraries | --x-libraries | --x-librarie | --x-librari \
-  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
-    ac_prev=x_libraries ;;
-  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
-  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries="$ac_optarg" ;;
-
-  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
-    ;;
-
-  *)
-    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
-      echo "configure: warning: $ac_option: invalid host type" 1>&2
-    fi
-    if test "x$nonopt" != xNONE; then
-      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
-    fi
-    nonopt="$ac_option"
-    ;;
-
-  esac
-done
-
-if test -n "$ac_prev"; then
-  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
-  exec 6>/dev/null
-else
-  exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
-  case "$ac_arg" in
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c) ;;
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
-  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
-  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
-  esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set.  These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=include/features.h
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
-  ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then its parent.
-  ac_prog=$0
-  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
-  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
-  srcdir=$ac_confdir
-  if test ! -r $srcdir/$ac_unique_file; then
-    srcdir=..
-  fi
-else
-  ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
-  if test "$ac_srcdir_defaulted" = yes; then
-    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
-  else
-    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
-  fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
-  if test "x$prefix" != xNONE; then
-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-  else
-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
-  fi
-fi
-for ac_site_file in $CONFIG_SITE; do
-  if test -r "$ac_site_file"; then
-    echo "loading site script $ac_site_file"
-    . "$ac_site_file"
-  fi
-done
-
-if test -r "$cache_file"; then
-  echo "loading cache $cache_file"
-  . $cache_file
-else
-  echo "creating cache $cache_file"
-  > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
-  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
-  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
-    ac_n= ac_c='
-' ac_t='	'
-  else
-    ac_n=-n ac_c= ac_t=
-  fi
-else
-  ac_n= ac_c='\c' ac_t=
-fi
-
-    if test -r /vmunix; then
-      kernel_id=`strings /vmunix | grep UNIX`
-    elif test -r /dynix; then
-      kernel_id=`strings /dynix | grep DYNIX`
-    else
-      kernel_id=
-    fi
-
-
-
-
-# This will get text that should go into config.make.
-config_vars=
-
-# Check for a --with-gmp argument and set gmp-srcdir in config.make.
-# Check whether --with-gmp or --without-gmp was given.
-if test "${with_gmp+set}" = set; then
-  withval="$with_gmp"
-  case "$with_gmp" in
-yes) { echo "configure: error: --with-gmp requires an argument; use --with-gmp=DIRECTORY" 1>&2; exit 1; } ;;
-''|no) ;;
-*) config_vars="$config_vars
-gmp-srcdir = $withval" ;;
-esac
-
-fi
-
-# Check for a --with-gettext argument and set gettext-srcdir in config.make.
-# Check whether --with-gettext or --without-gettext was given.
-if test "${with_gettext+set}" = set; then
-  withval="$with_gettext"
-  case "$with_gettext" in
-yes)
-  { echo "configure: error: --with-gettext requires an argument; use --with-gettext=DIR" 1>&2; exit 1; } ;;
-''|no) ;;
-*)
-  config_vars="$config_vars
-gettext-srcdir = $withval" ;;
-esac
-
-fi
-
-
-# Check whether --with-fp or --without-fp was given.
-if test "${with_fp+set}" = set; then
-  withval="$with_fp"
-  with_fp=$withval
-else
-  with_fp=yes
-fi
-
-# Check whether --with-gnu-binutils or --without-gnu-binutils was given.
-if test "${with_gnu_binutils+set}" = set; then
-  withval="$with_gnu_binutils"
-  gnu_binutils=$withval
-else
-  gnu_binutils=no
-fi
-
-# Check whether --with-gnu-ld or --without-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
-  withval="$with_gnu_ld"
-  gnu_ld=$withval
-else
-  gnu_ld=no
-fi
-
-# Check whether --with-gnu-as or --without-gnu-as was given.
-if test "${with_gnu_as+set}" = set; then
-  withval="$with_gnu_as"
-  gnu_as=$withval
-else
-  gnu_as=no
-fi
-
-test $gnu_binutils = yes && gnu_as=yes gnu_ld=yes
-# Check whether --with-elf or --without-elf was given.
-if test "${with_elf+set}" = set; then
-  withval="$with_elf"
-  elf=$withval
-else
-  elf=no
-fi
-
-
-# Check whether --enable-libio or --disable-libio was given.
-if test "${enable_libio+set}" = set; then
-  enableval="$enable_libio"
-  if test $enableval = yes; then
-	         stdio=libio
-	       else
-	         stdio=stdio
-	       fi
-else
-  stdio=default
-fi
-
-
-# Check whether --enable-sanity-checks or --disable-sanity-checks was given.
-if test "${enable_sanity_checks+set}" = set; then
-  enableval="$enable_sanity_checks"
-  enable_sanity=$enableval
-else
-  enable_sanity=yes
-fi
-
-
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
-  enableval="$enable_shared"
-  shared=$enableval
-else
-  shared=default
-fi
-
-# Check whether --enable-profile or --disable-profile was given.
-if test "${enable_profile+set}" = set; then
-  enableval="$enable_profile"
-  profile=$enableval
-else
-  profile=yes
-fi
-
-# Check whether --enable-omitfp or --disable-omitfp was given.
-if test "${enable_omitfp+set}" = set; then
-  enableval="$enable_omitfp"
-  omitfp=$enableval
-else
-  omitfp=no
-fi
-
-# Check whether --enable-bounded or --disable-bounded was given.
-if test "${enable_bounded+set}" = set; then
-  enableval="$enable_bounded"
-  bounded=$enableval
-else
-  bounded=no
-fi
-
-
-# Check whether --enable-add-ons or --disable-add-ons was given.
-if test "${enable_add_ons+set}" = set; then
-  enableval="$enable_add_ons"
-  add_ons=`echo "$enableval" | sed 's/,/ /g'`
-else
-  add_ons=
-fi
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
-  if test -f $ac_dir/install-sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f $ac_dir/install.sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-subdirs="$add_ons"
-
-add_ons_pfx=
-if test x"$add_ons" != x; then
-  for f in $add_ons; do
-    add_ons_pfx="$add_ons_pfx $f/"
-  done
-fi
-
-# Check whether --enable-static-nss or --disable-static-nss was given.
-if test "${enable_static_nss+set}" = set; then
-  enableval="$enable_static_nss"
-  static_nss=$enableval
-else
-  static_nss=no
-fi
-
-if test x"$static_nss" = xyes; then
-  cat >> confdefs.h <<\EOF
-#define DO_STATIC_NSS 1
-EOF
-
-fi
-
-
-# Make sure we can run config.sub.
-if $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:755: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
-  case $nonopt in
-  NONE)
-    if host_alias=`$ac_config_guess`; then :
-    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
-    fi ;;
-  *) host_alias=$nonopt ;;
-  esac ;;
-esac
-
-host=`$ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-
-# The way shlib-versions is used to generate soversions.mk uses a
-# fairly simplistic model for name recognition that can't distinguish
-# i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
-# of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
-# tell.  This doesn't get used much beyond that, so it's fairly safe.
-case "$host_os" in
-linux*)
-  ;;
-gnu*)
-  host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
-  ;;
-esac
-
-# We keep the original values in `$config_*' and never modify them, so we
-# can write them unchanged into config.make.  Everything else uses
-# $machine, $vendor, and $os, and changes them whenever convenient.
-config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
-
-# Some configurations imply other options.
-case "$host_os" in
-gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
-  # These systems always use GNU tools.
-  gnu_ld=yes gnu_as=yes ;;
-esac
-case "$host_os" in
-# i586-linuxaout is mangled into i586-pc-linux-gnuaout
-linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
-  ;;
-gnu* | linux* | sysv4* | solaris2*)
-  # These systems (almost) always use the ELF format.
-  elf=yes
-  ;;
-esac
-
-machine=$config_machine
-vendor=$config_vendor
-os=$config_os
-
-# Expand the configuration machine name into a subdirectory by architecture
-# type and particular chip.
-case "$machine" in
-a29k | am29000)	base_machine=a29k machine=a29k ;;
-alpha*)		base_machine=alpha machine=alpha/$machine ;;
-arm*)		base_machine=arm machine=arm/$machine ;;
-hppa*)		base_machine=hppa machine=hppa/$machine ;;
-i[3456]86)	base_machine=i386 machine=i386/$machine ;;
-m680?0)		base_machine=m68k machine=m68k/$machine ;;
-m68k)		base_machine=m68k machine=m68k/m68020 ;;
-m88???)		base_machine=m88k machine=m88k/$machine ;;
-m88k)		base_machine=m88k machine=m88k/m88100 ;;
-mips*)		base_machine=mips machine=mips/$machine ;;
-mips64*)	base_machine=mips64 machine=mips/mips64/$machine ;;
-sparc[6789])	base_machine=sparc machine=sparc/$machine ;;
-supersparc)	base_machine=sparc machine=sparc/sparc8 ;;
-sparc64)	base_machine=sparc64 machine=sparc64/$machine ;;
-esac
-
-
-# Compute the list of sysdep directories for this configuration.
-# 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
-# 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'`"
-
-case "$os" in
-gnu*)
-  base_os=mach/hurd ;;
-netbsd* | 386bsd* | freebsd* | bsdi*)
-  base_os=unix/bsd/bsd4.4 ;;
-osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
-  base_os=unix/bsd ;;
-sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
-  base_os=unix/sysv ;;
-solaris[2-9]*)
-  base_os=unix/sysv/sysv4 ;;
-none)
-  base_os=standalone ;;
-*)
-  base_os='' ;;
-esac
-
-# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
-tail=$os
-ostry=$os
-while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
-  ostry="$ostry /$o"
-  tail=$o
-done
-o=`echo $tail | sed 's/[0-9]*$//'`
-if test $o != $tail; then
-  ostry="$ostry /$o"
-fi
-# For linux-gnu, try linux-gnu, then linux.
-o=`echo $tail | sed 's/-.*$//'`
-if test $o != $tail; then
-  ostry="$ostry /$o"
-fi
-
-# For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
-base=
-tail=$base_os
-while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
-  set $b
-  base="$base /$1"
-  tail="$2"
-done
-
-# For sparc/sparc9, try sparc/sparc9 and then sparc.
-mach=
-tail=$machine
-while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
-  set $m
-  # Prepend the machine's FPU directory unless --without-fp.
-  if test "$with_fp" = yes; then
-    mach="$mach /$1/fpu"
-  fi
-  mach="$mach /$1"
-  tail="$2"
-done
-
-
-# Find what sysdep directories exist.
-sysnames=
-IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-for d in $add_ons_pfx ''; do
-  for b in $base ''; do
-    for m0 in $mach ''; do
-      for v in /$vendor ''; do
-	for o in /$ostry ''; do
-	  for m in $mach ''; do
-	    if test "$m0$b$v$o$m"; then
-	      try="${d}sysdeps$m0$b$v$o$m"
-	      test -n "$enable_debug_configure" &&
-	      echo "$0 DEBUG: try $try" >&2
-	      case $try in
-		/*) dest=$try ;;
-		*)  dest=$srcdir/$try ;;
-	      esac
-	      if test -d $dest; then
-		sysnames="$sysnames $try"
-		{ test -n "$o" || test -n "$b"; } && os_used=t
-		{ test -n "$m" || test -n "$m0"; } && machine_used=t
-	      fi
-	    fi
-	  done
-	done
-      done
-    done
-  done
-done
-IFS="$ac_save_ifs"
-
-if test -z "$os_used" && test "$os" != none; then
-  { echo "configure: error: Operating system $os is not supported." 1>&2; exit 1; }
-fi
-if test -z "$machine_used" && test "$machine" != none; then
-  { echo "configure: error: The $machine is not supported." 1>&2; exit 1; }
-fi
-
-# We have now validated the configuration.
-
-
-# If using ELF, look for an `elf' subdirectory of each machine directory.
-# We prepend these rather than inserting them whereever the machine appears
-# because things specified by the machine's ELF ABI should override
-# OS-specific things, and should always be the same for any OS on the
-# machine (otherwise what's the point of an ABI?).
-if test "$elf" = yes; then
-  elf_dirs=
-  for d in $add_ons_pfx ''; do
-    case $d in
-      /*) xsrcdir= ;;
-      *)  xsrcdir=$srcdir/ ;;
-    esac
-    for m in $mach; do
-      if test -d $xsrcdir${d}sysdeps$m/elf; then
-	elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
-      fi
-    done
-  done
-  sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
-fi
-
-
-# Expand the list of system names into a full list of directories
-# from each element's parent name and Implies file (if present).
-set $sysnames
-names=
-while test $# -gt 0; do
-  name=$1
-  shift
-
-  case " $names " in *" $name "*)
-    # Already in the list.
-    continue
-  esac
-
-  # Report each name as we discover it, so there is no long pause in output.
-  echo $ac_n "$name $ac_c" >&6
-
-  name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
-
-  case $name in
-    /*) xsrcdir= ;;
-    *)  xsrcdir=$srcdir/ ;;
-  esac
-  test -n "$enable_debug_configure" &&
-  echo "DEBUG: name/Implies $xsrcdir$name/Implies" >&2
-
-  if test -f $xsrcdir$name/Implies; then
-    # Collect more names from the `Implies' file (removing comments).
-    implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
-    implied=
-    for x in $implied_candidate; do
-      if test -d $xsrcdir$name_base/$x; then
-	implied="$implied $name_base/$x";
-      else
-        echo "configure: warning: $name/Implies specifies nonexistent $x" 1>&2
-      fi
-    done
-  else
-    implied=
-  fi
-
-  # Add NAME to the list of names.
-  names="$names $name"
-
-  # Find the parent of NAME, using the empty string if it has none.
-  parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
-
-  # Add the names implied by NAME, and NAME's parent (if it has one), to
-  # the list of names to be processed (the argument list).  We prepend the
-  # implied names to the list and append the parent.  We want implied
-  # directories to come before further directories inferred from the
-  # configuration components; this ensures that for sysv4, unix/common
-  # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
-  # after sysv4).
-  sysnames="`echo $implied $* $parent`"
-  test -n "$sysnames" && set $sysnames
-done
-
-# Add the default directories.
-sysnames="$names sysdeps/generic sysdeps/stub"
-
-# The other names were emitted during the scan.
-echo "$ac_t""sysdeps/generic sysdeps/stub" 1>&6
-
-
-### Locate tools.
-
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# 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
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    # Account for people who put trailing slashes in PATH elements.
-    case "$ac_dir/" in
-    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
-    *)
-      # OSF1 and SCO ODT 3.0 have their own names for install.
-      for ac_prog in ginstall installbsd scoinst install; do
-        if test -f $ac_dir/$ac_prog; then
-	  if test $ac_prog = install &&
-            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
-	    # AIX install.  It has an incompatible calling convention.
-	    # OSF/1 installbsd also uses dspmsg, but is usable.
-	    :
-	  else
-	    ac_cv_path_install="$ac_dir/$ac_prog -c"
-	    break 2
-	  fi
-	fi
-      done
-      ;;
-    esac
-  done
-  IFS="$ac_save_IFS"
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL="$ac_cv_path_install"
-  else
-    # As a last resort, use the slow shell script.  We don't cache a
-    # path for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the path is relative.
-    INSTALL="$ac_install_sh"
-  fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-if test "$INSTALL" = "${srcdir}/install-sh -c"; then
-  # The makefiles need to use a different form to find it in $srcdir.
-  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
-if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  rm -f conftestdata
-if ln -s X conftestdata 2>/dev/null
-then
-  rm -f conftestdata
-  ac_cv_prog_LN_S="ln -s"
-else
-  ac_cv_prog_LN_S=ln
-fi
-fi
-LN_S="$ac_cv_prog_LN_S"
-if test "$ac_cv_prog_LN_S" = "ln -s"; then
-  echo "$ac_t""yes" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-for ac_prog in msgfmt gmsgfmt
-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
-if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$MSGFMT"; then
-  ac_cv_prog_MSGFMT="$MSGFMT" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_MSGFMT="$ac_prog"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-MSGFMT="$ac_cv_prog_MSGFMT"
-if test -n "$MSGFMT"; then
-  echo "$ac_t""$MSGFMT" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-test -n "$MSGFMT" && break
-done
-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
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="gcc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-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
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  ac_prog_rejected=no
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-        ac_prog_rejected=yes
-	continue
-      fi
-      ac_cv_prog_CC="cc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# -gt 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    set dummy "$ac_dir/$ac_word" "$@"
-    shift
-    ac_cv_prog_CC="$@"
-  fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-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
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext <<EOF
-#line 1238 "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
-  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
-    ac_cv_prog_cc_cross=no
-  else
-    ac_cv_prog_cc_cross=yes
-  fi
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- cross_linkable=no
- ac_cv_prog_cc_cross=yes
-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 "$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
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.c <<EOF
-#ifdef __GNUC__
-  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
-  ac_cv_prog_gcc=yes
-else
-  ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
-  GCC=yes
-
-  cat > conftest.c <<EOF
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-  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 test -z "$CFLAGS"; then
-      CFLAGS="-g -O2"
-    fi
-  else
-    { echo "configure: error: We require GNU CC version 2.7 or newer" 1>&2; exit 1; }
-  fi
-else
-  { echo "configure: error: GNU libc must be compiled using GNU CC" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1309: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
-  case $nonopt in
-  NONE) build_alias=$host_alias ;;
-  *) build_alias=$nonopt ;;
-  esac ;;
-esac
-
-build=`$ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-if test $host != $build; then
-  for ac_prog in gcc cc
-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
-if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$BUILD_CC"; then
-  ac_cv_prog_BUILD_CC="$BUILD_CC" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_BUILD_CC="$ac_prog"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-BUILD_CC="$ac_cv_prog_BUILD_CC"
-if test -n "$BUILD_CC"; then
-  echo "$ac_t""$BUILD_CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-test -n "$BUILD_CC" && break
-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
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    # This must be in double quotes, not single quotes, because CPP may get
-  # substituted into the Makefile and "${CC-cc}" will confuse make.
-  CPP="${CC-cc} -E"
-  # 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"
-#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; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -E -traditional-cpp"
-  cat > conftest.$ac_ext <<EOF
-#line 1395 "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; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-  ac_cv_prog_CPP="$CPP"
-fi
-  CPP="$ac_cv_prog_CPP"
-else
-  ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-if test $host != $build; then
-  ac_tool_prefix=${host_alias}-
-else
-  ac_tool_prefix=
-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
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$AR"; then
-  ac_cv_prog_AR="$AR" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_AR="${ac_tool_prefix}ar"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
-  echo "$ac_t""$AR" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-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
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
-  echo "$ac_t""$RANLIB" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_RANLIB"; then
-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
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_RANLIB="ranlib"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
-  echo "$ac_t""$RANLIB" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-  RANLIB=":"
-fi
-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
-if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$BASH" in
-  /*)
-  ac_cv_path_BASH="$BASH" # Let the user override the test with a path.
-  ;;
-  *)
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_BASH="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_BASH" && ac_cv_path_BASH="no"
-  ;;
-esac
-fi
-BASH="$ac_cv_path_BASH"
-if test -n "$BASH"; then
-  echo "$ac_t""$BASH" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-if test "$BASH" != no &&
-   $BASH -c 'test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
-  libc_cv_have_bash2=yes
-else
-  libc_cv_have_bash2=no
-fi
-
-
-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
-if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$KSH" in
-  /*)
-  ac_cv_path_KSH="$KSH" # Let the user override the test with a path.
-  ;;
-  *)
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_KSH="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_KSH" && ac_cv_path_KSH="no"
-  ;;
-esac
-fi
-KSH="$ac_cv_path_KSH"
-if test -n "$KSH"; then
-  echo "$ac_t""$KSH" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-  if test "$KSH" = no; then
-    libc_cv_have_ksh=no
-  else
-    libc_cv_have_ksh=yes
-  fi
-else
-  KSH="$BASH"
-  
-  libc_cv_have_ksh=yes
-fi
-
-
-echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:1612: 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
-  echo '#include <stddef.h>
-FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
-if eval "$ac_cpp conftest.c 2>/dev/null" \
-| grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
-  libc_cv_signed_size_t=no
-else
-  libc_cv_signed_size_t=yes
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_signed_size_t" 1>&6
-if test $libc_cv_signed_size_t = yes; then
-    cat >> confdefs.h <<\EOF
-#undef __SIZE_TYPE__
-#define __SIZE_TYPE__ unsigned
-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
-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"
-#include "confdefs.h"
-#define __need_size_t
-#define __need_wchar_t
-#include <stddef.h>
-#define __need_NULL
-#include <stddef.h>
-int main() {
-size_t size; wchar_t wchar;
-#ifdef offsetof
-#error stddef.h ignored __need_*
-#endif
-if (&size == NULL || &wchar == NULL) abort ();
-; return 0; }
-EOF
-if { (eval echo configure:1656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  libc_cv_friendly_stddef=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  libc_cv_friendly_stddef=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_friendly_stddef" 1>&6
-if test $libc_cv_friendly_stddef = yes; then
-  config_vars="$config_vars
-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
-if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.S <<EOF
-#include "confdefs.h"
-/* Nothing whatsoever.  */
-EOF
-if ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null; then
-  libc_cv_need_minus_P=no
-else
-  libc_cv_need_minus_P=yes
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_need_minus_P" 1>&6
-if test $libc_cv_need_minus_P = yes; then
-  config_vars="$config_vars
-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
-if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  libc_cv_asm_global_directive=UNKNOWN
-for ac_globl in .globl .global; do
-  cat > conftest.s <<EOF
-.text
-${ac_globl} foo
-foo:
-EOF
-  if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
-    libc_cv_asm_global_directive=${ac_globl}
-  fi
-  rm -f conftest*
-  test $libc_cv_asm_global_directive != UNKNOWN && break
-done
-fi
-
-echo "$ac_t""$libc_cv_asm_global_directive" 1>&6
-if test $libc_cv_asm_global_directive = UNKNOWN; then
-  { echo "configure: error: cannot determine asm global directive" 1>&2; exit 1; }
-else
-  cat >> confdefs.h <<EOF
-#define ASM_GLOBAL_DIRECTIVE ${libc_cv_asm_global_directive}
-EOF
-
-fi
-
-echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1728: 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
-  cat > conftest.s <<EOF
-.text
-foo:
-.set glibc_conftest_frobozz,foo
-$libc_cv_asm_global_directive glibc_conftest_frobozz
-EOF
-# The alpha-dec-osf1 assembler gives only a warning for `.set'
-# (but it doesn't work), so we must do a linking check to be sure.
-cat > conftest1.c <<\EOF
-extern int glibc_conftest_frobozz;
-main () { printf ("%d\n", glibc_conftest_frobozz); }
-EOF
-if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
-	    -o conftest conftest.s conftest1.c 1>&5 2>&5; then
-  libc_cv_asm_set_directive=yes
-else
-  libc_cv_asm_set_directive=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_asm_set_directive" 1>&6
-if test $libc_cv_asm_set_directive = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_ASM_SET_DIRECTIVE 1
-EOF
-
-fi
-
-echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:1762: 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
-  cat > conftest.s <<EOF
-.text
-_sym:
-.symver _sym,sym@VERS
-EOF
-if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&5 2>&5; then
-  libc_cv_asm_symver_directive=yes
-else
-  libc_cv_asm_symver_directive=no
-fi
-rm -f conftest*
-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
-if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test $libc_cv_asm_symver_directive = yes; then
-  cat > conftest.s <<EOF
-.text
-_sym:
-.symver _sym,sym@VERS
-EOF
-  cat > conftest.map <<EOF
-VERS {
-	global: sym;
-};
-EOF
-  if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&5 2>&5; then
-    if { ac_try='${CC-cc} $CFLAGS -shared -o conftest.so conftest.o
-					-nostartfiles -nostdlib
-					-Wl,--version-script,conftest.map
-		       1>&5'; { (eval echo configure:1800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
-    then
-      libc_cv_ld_version_script_option=yes
-    else
-      libc_cv_ld_version_script_option=no
-    fi
-  else
-    libc_cv_ld_version_script_option=no
-  fi
-else
-  libc_cv_ld_version_script_option=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_ld_version_script_option" 1>&6
-if test $libc_cv_asm_symver_directive = yes &&
-   test $libc_cv_ld_version_script_option = yes; then
-  VERSIONING=yes
-  cat >> confdefs.h <<\EOF
-#define DO_VERSIONING 1
-EOF
-
-else
-  VERSIONING=no
-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
-if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    cat > conftest.s <<EOF
-.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
-    libc_cv_asm_previous_directive=yes
-  else
-    libc_cv_asm_previous_directive=no
-  fi
-  rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_asm_previous_directive" 1>&6
-  if test $libc_cv_asm_previous_directive = yes; then
-    cat >> confdefs.h <<\EOF
-#define HAVE_ASM_PREVIOUS_DIRECTIVE 1
-EOF
-
-  else
-    echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:1854: 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
-      cat > conftest.s <<EOF
-.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
-      libc_cv_asm_popsection_directive=yes
-    else
-      libc_cv_asm_popsection_directive=no
-    fi
-    rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_asm_popsection_directive" 1>&6
-    if test $libc_cv_asm_popsection_directive = yes; then
-      cat >> confdefs.h <<\EOF
-#define HAVE_ASM_POPSECTION_DIRECTIVE 1
-EOF
-
-    fi
-  fi
-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
-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"
-#include "confdefs.h"
-
-int main() {
-asm (".section .init");
-				    asm (".section .fini");
-				    asm (".text");
-; return 0; }
-EOF
-if { (eval echo configure:1896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  libc_cv_have_initfini=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  libc_cv_have_initfini=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_have_initfini" 1>&6
-    if test $libc_cv_have_initfini = yes; then
-    cat >> confdefs.h <<\EOF
-#define HAVE_INITFINI 1
-EOF
-
-  fi
-fi
-
-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
-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"
-#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
-  rm -rf conftest*
-  libc_cv_asm_underscores=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  libc_cv_asm_underscores=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_asm_underscores" 1>&6
-fi
-if test $libc_cv_asm_underscores = no; then
-  cat >> confdefs.h <<\EOF
-#define NO_UNDERSCORES 1
-EOF
-
-fi
-
-if test $elf = yes; then
-  libc_cv_weak_symbols=yes
-  libc_cv_asm_weak_directive=yes
-  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
-if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.s <<EOF
-.text
-${libc_cv_asm_global_directive} foo
-foo:
-.weak foo
-.weak bar; bar = foo
-EOF
-  if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
-    libc_cv_asm_weak_directive=yes
-  else
-    libc_cv_asm_weak_directive=no
-  fi
-  rm -f conftest*
-fi
-
-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
-if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.s <<EOF
-.text
-${libc_cv_asm_global_directive} foo
-foo:
-.weakext foo
-.weakext foo, bar
-EOF
-  if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
-    libc_cv_asm_weakext_directive=yes
-  else
-    libc_cv_asm_weakext_directive=no
-  fi
-  rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_asm_weakext_directive" 1>&6
-
-  fi # no .weak
-fi # not ELF
-
-if test $libc_cv_asm_weak_directive = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_ASM_WEAK_DIRECTIVE 1
-EOF
-
-elif test $libc_cv_asm_weakext_directive = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_ASM_WEAKEXT_DIRECTIVE 1
-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
-if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.c <<\EOF
-_start () {}
-int __eh_pc;
-__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
-  libc_cv_ld_no_whole_archive=yes
-else
-  libc_cv_ld_no_whole_archive=no
-fi
-rm -f conftest*
-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
-if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.c <<\EOF
-_start () {}
-int __eh_pc;
-__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
-  libc_cv_gcc_no_exceptions=yes
-else
-  libc_cv_gcc_no_exceptions=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$libc_cv_gcc_no_exceptions" 1>&6
-
-### End of automated tests.
-### Now run sysdeps configure fragments.
-
-# sysdeps configure fragments may set these with files to be linked below.
-libc_link_dests=
-libc_link_sources=
-
-# Iterate over all the sysdep directories we will use, running their
-# configure fragments, and looking for a uname implementation.
-uname=
-for dir in $sysnames; do
-  case $dir in
-    /*) dest=$dir ;;
-    *)  dest=$srcdir/$dir ;;
-  esac
-  if test -r $dest/configure; then
-    echo "$ac_t""running configure fragment for $dest" 1>&6
-    . $dest/configure
-  fi
-
-  if test -z "$uname"; then
-    if test -r $dest/uname.c ||
-       test -r $dest/uname.S ||
-       { test -r $dest/syscalls.list &&
-	 grep '^uname[ 	]' $dest/syscalls.list >/dev/null; }; then
-      uname=$dir
-    fi
-  fi
-done
-
-
-
-# If we will use the generic uname implementation, we must figure out what
-# it will say by examining the system, and write the results in config-name.h.
-if test "$uname" = "sysdeps/generic"; then
-
-  uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
-  if test $uname_sysname != $config_os; then
-    config_release=`echo $config_os | sed s/$uname_sysname//`
-  fi
-
-  echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:2105: 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
-    kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
-  if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
-	 != x$config_release; then
-    # The configuration release is a substring of the kernel release.
-    libc_cv_uname_release=$kernel_release
-  elif test x$config_release != x; then
-    libc_cv_uname_release=$config_release
-  elif test x$kernel_release != x; then
-    libc_cv_uname_release=$kernel_release
-  else
-    libc_cv_uname_release=unknown
-  fi
-fi
-
-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
-if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
-  if test -n "$kernel_version"; then
-    libc_cv_uname_version="$kernel_version"
-  else
-    libc_cv_uname_version=unknown
-  fi
-fi
-
-echo "$ac_t""$libc_cv_uname_version" 1>&6
-  uname_version="$libc_cv_uname_version"
-
-    config_uname=config-name.h:config-name.in
-else
-  # For non-generic uname, we don't need to create config-name.h at all.
-  config_uname=
-fi
-
-echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:2149: checking stdio selection" >&5
-
-case $stdio in
-libio) cat >> confdefs.h <<\EOF
-#define USE_IN_LIBIO 1
-EOF
- ;;
-default) stdio=stdio ;;
-esac
-echo "$ac_t""$stdio" 1>&6
-
-
-
-
-
-
-
-  
-if test $gnu_ld = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_GNU_LD 1
-EOF
-
-fi
-if test $gnu_as = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_GNU_AS 1
-EOF
-
-fi
-if test $elf = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_ELF 1
-EOF
-
-fi
-
-
-if test $shared = default; then
-  if test $gnu_ld = yes; then
-    shared=$elf
-  else
-    # For now we do not assume shared libs are available.  In future more
-    # tests might become available.
-    shared=no
-  fi
-fi
-
-
-
-
-
-
-
-
-if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
-  config_makefile=
-else
-  config_makefile=Makefile
-fi
-
-VERSION=`sed -e 's/^#define VERSION "\([^"]*\)"/\1/p' -e d < $srcdir/version.h`
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs.  It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already.  You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
-  case `(ac_space=' '; set) 2>&1` in
-  *ac_space=\ *)
-    # `set' does not quote correctly, so add quotes (double-quote substitution
-    # turns \\\\ into \\, and sed turns \\ into \).
-    sed -n \
-      -e "s/'/'\\\\''/g" \
-      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
-    ;;
-  *)
-    # `set' quotes correctly as required by POSIX, so do not add quotes.
-    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
-    ;;
-  esac >> confcache
-if cmp -s $cache_file confcache; then
-  :
-else
-  if test -w $cache_file; then
-    echo "updating cache $cache_file"
-    cat confcache > $cache_file
-  else
-    echo "not updating unwritable cache $cache_file"
-  fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-DEFS=-DHAVE_CONFIG_H
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
-  case "\$ac_option" in
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
-    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.12"
-    exit 0 ;;
-  -help | --help | --hel | --he | --h)
-    echo "\$ac_cs_usage"; exit 0 ;;
-  *) echo "\$ac_cs_usage"; exit 1 ;;
-  esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "config.make glibcbug ${config_makefile} ${config_uname} config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@subdirs@%$subdirs%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@base_machine@%$base_machine%g
-s%@sysnames@%$sysnames%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@LN_S@%$LN_S%g
-s%@MSGFMT@%$MSGFMT%g
-s%@CC@%$CC%g
-s%@cross_linkable@%$cross_linkable%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@BUILD_CC@%$BUILD_CC%g
-s%@cross_compiling@%$cross_compiling%g
-s%@CPP@%$CPP%g
-s%@AR@%$AR%g
-s%@RANLIB@%$RANLIB%g
-s%@BASH@%$BASH%g
-s%@libc_cv_have_bash2@%$libc_cv_have_bash2%g
-s%@KSH@%$KSH%g
-s%@libc_cv_have_ksh@%$libc_cv_have_ksh%g
-s%@VERSIONING@%$VERSIONING%g
-s%@libc_cv_have_initfini@%$libc_cv_have_initfini%g
-s%@libc_cv_ld_no_whole_archive@%$libc_cv_ld_no_whole_archive%g
-s%@libc_cv_gcc_no_exceptions@%$libc_cv_gcc_no_exceptions%g
-s%@uname_sysname@%$uname_sysname%g
-s%@uname_release@%$uname_release%g
-s%@uname_version@%$uname_version%g
-s%@stdio@%$stdio%g
-s%@libc_cv_slibdir@%$libc_cv_slibdir%g
-s%@libc_cv_sysconfdir@%$libc_cv_sysconfdir%g
-s%@libc_cv_rootsbindir@%$libc_cv_rootsbindir%g
-s%@has_ldconfig@%$has_ldconfig%g
-s%@gnu_ld@%$gnu_ld%g
-s%@gnu_as@%$gnu_as%g
-s%@elf@%$elf%g
-s%@shared@%$shared%g
-s%@profile@%$profile%g
-s%@omitfp@%$omitfp%g
-s%@bounded@%$bounded%g
-s%@static_nss@%$static_nss%g
-s%@nopic_initfini@%$nopic_initfini%g
-s%@DEFINES@%$DEFINES%g
-s%@VERSION@%$VERSION%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
-  if test $ac_beg -gt 1; then
-    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
-  else
-    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
-  fi
-  if test ! -s conftest.s$ac_file; then
-    ac_more_lines=false
-    rm -f conftest.s$ac_file
-  else
-    if test -z "$ac_sed_cmds"; then
-      ac_sed_cmds="sed -f conftest.s$ac_file"
-    else
-      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
-    fi
-    ac_file=`expr $ac_file + 1`
-    ac_beg=$ac_end
-    ac_end=`expr $ac_end + $ac_max_sed_cmds`
-  fi
-done
-if test -z "$ac_sed_cmds"; then
-  ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"config.make glibcbug ${config_makefile} ${config_uname}"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-  *) ac_file_in="${ac_file}.in" ;;
-  esac
-
-  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
-  # Remove last slash and all that follows it.  Not all systems have dirname.
-  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-    # The file is in a subdirectory.
-    test ! -d "$ac_dir" && mkdir "$ac_dir"
-    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
-    # A "../" for each directory in $ac_dir_suffix.
-    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
-  else
-    ac_dir_suffix= ac_dots=
-  fi
-
-  case "$ac_given_srcdir" in
-  .)  srcdir=.
-      if test -z "$ac_dots"; then top_srcdir=.
-      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
-  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
-  *) # Relative path.
-    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
-    top_srcdir="$ac_dots$ac_given_srcdir" ;;
-  esac
-
-  case "$ac_given_INSTALL" in
-  [/$]*) INSTALL="$ac_given_INSTALL" ;;
-  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
-  esac
-
-  echo creating "$ac_file"
-  rm -f "$ac_file"
-  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
-  case "$ac_file" in
-  *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
-  *) ac_comsub= ;;
-  esac
-
-  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-  sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
-ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
-ac_uB='\([ 	]\)%\1#\2define\3'
-ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
-  CONFIG_HEADERS="config.h"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-  *) ac_file_in="${ac_file}.in" ;;
-  esac
-
-  echo creating $ac_file
-
-  rm -f conftest.frag conftest.in conftest.out
-  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-  cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h.  And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
-
-# This sed command replaces #undef with comments.  This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
-
-rm -f conftest.tail
-while :
-do
-  ac_lines=`grep -c . conftest.vals`
-  # grep -c gives empty output for an empty file on some AIX systems.
-  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
-  # Write a limited-size here document to conftest.frag.
-  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
-  echo 'CEOF
-  sed -f conftest.frag conftest.in > conftest.out
-  rm -f conftest.in
-  mv conftest.out conftest.in
-' >> $CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
-  rm -f conftest.vals
-  mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
-  rm -f conftest.frag conftest.h
-  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
-  cat conftest.in >> conftest.h
-  rm -f conftest.in
-  if cmp -s $ac_file conftest.h 2>/dev/null; then
-    echo "$ac_file is unchanged"
-    rm -f conftest.h
-  else
-    # Remove last slash and all that follows it.  Not all systems have dirname.
-      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-      # The file is in a subdirectory.
-      test ! -d "$ac_dir" && mkdir "$ac_dir"
-    fi
-    rm -f $ac_file
-    mv conftest.h $ac_file
-  fi
-fi; done
-
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-ac_sources="`echo $libc_link_sources`"
-ac_dests="`echo $libc_link_dests`"
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-srcdir=$ac_given_srcdir
-while test -n "$ac_sources"; do
-  set $ac_dests; ac_dest=$1; shift; ac_dests=$*
-  set $ac_sources; ac_source=$1; shift; ac_sources=$*
-
-  echo "linking $srcdir/$ac_source to $ac_dest"
-
-  if test ! -r $srcdir/$ac_source; then
-    { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
-  fi
-  rm -f $ac_dest
-
-  # Make relative symlinks.
-  # Remove last slash and all that follows it.  Not all systems have dirname.
-  ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
-  if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
-    # The dest file is in a subdirectory.
-    test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
-    ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
-    # A "../" for each directory in $ac_dest_dir_suffix.
-    ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
-  else
-    ac_dest_dir_suffix= ac_dots=
-  fi
-
-  case "$srcdir" in
-  [/$]*) ac_rel_source="$srcdir/$ac_source" ;;
-  *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
-  esac
-
-  # Make a symlink if possible; otherwise try a hard link.
-  if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
-    ln $srcdir/$ac_source $ac_dest; then :
-  else
-    { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
-  fi
-done
-EOF
-cat >> $CONFIG_STATUS <<EOF
-echo '$config_vars' >> config.make; test -d bits || mkdir bits
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-if test "$no_recursion" != yes; then
-
-  # Remove --cache-file and --srcdir arguments so they do not pile up.
-  ac_sub_configure_args=
-  ac_prev=
-  for ac_arg in $ac_configure_args; do
-    if test -n "$ac_prev"; then
-      ac_prev=
-      continue
-    fi
-    case "$ac_arg" in
-    -cache-file | --cache-file | --cache-fil | --cache-fi \
-    | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-      ac_prev=cache_file ;;
-    -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-    | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-      ;;
-    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-      ac_prev=srcdir ;;
-    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-      ;;
-    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
-    esac
-  done
-
-  for ac_config_dir in $add_ons; do
-
-    # Do not complain, so a configure script can configure whichever
-    # parts of a large source tree are present.
-    if test ! -d $srcdir/$ac_config_dir; then
-      continue
-    fi
-
-    echo configuring in $ac_config_dir
-
-    case "$srcdir" in
-    .) ;;
-    *)
-      if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
-      else
-        { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
-      fi
-      ;;
-    esac
-
-    ac_popdir=`pwd`
-    cd $ac_config_dir
-
-      # A "../" for each directory in /$ac_config_dir.
-      ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
-
-    case "$srcdir" in
-    .) # No --srcdir option.  We are building in place.
-      ac_sub_srcdir=$srcdir ;;
-    /*) # Absolute path.
-      ac_sub_srcdir=$srcdir/$ac_config_dir ;;
-    *) # Relative path.
-      ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
-    esac
-
-    # Check for guested configure; otherwise get Cygnus style configure.
-    if test -f $ac_sub_srcdir/configure; then
-      ac_sub_configure=$ac_sub_srcdir/configure
-    elif test -f $ac_sub_srcdir/configure.in; then
-      ac_sub_configure=$ac_configure
-    else
-      echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2
-      ac_sub_configure=
-    fi
-
-    # The recursion is here.
-    if test -n "$ac_sub_configure"; then
-
-      # Make the cache file name correct relative to the subdirectory.
-      case "$cache_file" in
-      /*) ac_sub_cache_file=$cache_file ;;
-      *) # Relative path.
-        ac_sub_cache_file="$ac_dots$cache_file" ;;
-      esac
-  case "$ac_given_INSTALL" in
-        [/$]*) INSTALL="$ac_given_INSTALL" ;;
-        *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
-        esac
-
-      echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
-      # The eval makes quoting arguments work.
-      if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
-      then :
-      else
-        { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
-      fi
-    fi
-
-    cd $ac_popdir
-  done
-fi
-
diff --git a/configure.in b/configure.in
index 9ac5f03dbd..3f5a754250 100644
--- a/configure.in
+++ b/configure.in
@@ -155,8 +155,8 @@ m680?0)		base_machine=m68k machine=m68k/$machine ;;
 m68k)		base_machine=m68k machine=m68k/m68020 ;;
 m88???)		base_machine=m88k machine=m88k/$machine ;;
 m88k)		base_machine=m88k machine=m88k/m88100 ;;
-mips*)		base_machine=mips machine=mips/$machine ;;
 mips64*)	base_machine=mips64 machine=mips/mips64/$machine ;;
+mips*)		base_machine=mips machine=mips/$machine ;;
 sparc[6789])	base_machine=sparc machine=sparc/$machine ;;
 supersparc)	base_machine=sparc machine=sparc/sparc8 ;;
 sparc64)	base_machine=sparc64 machine=sparc64/$machine ;;
diff --git a/elf/Makefile b/elf/Makefile
index ef9207c07b..269a872969 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -20,7 +20,7 @@
 
 subdir		:= elf
 
-headers		= elf.h bits/elfclass.h link.h dlfcn.h
+headers		= elf.h bits/elfclass.h bits/dlfcn.h link.h dlfcn.h
 routines	= $(dl-routines) dl-open dl-close dl-symbol dl-support \
 		  dl-version enbl-secure
 
@@ -88,6 +88,30 @@ $(objpfx)dl-allobjs.so: $(rtld-routines:%=$(objpfx)%.so)
 $(objpfx)librtld.so: $(objpfx)dl-allobjs.so $(common-objpfx)libc_pic.a
 	$(reloc-link) '-Wl,-(' $^ -lgcc '-Wl,-)'
 
+# Do we need a linker script?
+rtld-ldscript-in := $(firstword $(wildcard $(+sysdep_dirs:%=%/rtld-ldscript.in)))
+ifneq (,$(rtld-ldscript-in))
+LDFLAGS-rtld = -T $(objpfx)rtld-ldscript
+
+before-compile += $(objpfx)rtld-ldscript
+rtld-parms = $(wildcard $(+sysdep_dirs:%=%/rtld-parms))
+include $(rtld-parms)
+generated += rtld-ldscript
+$(objpfx)rtld-ldscript: $(rtld-ldscript-in) $(rtld-parms)
+	sed -e 's#@@rtld-oformat@@#$(rtld-oformat)#' \
+	    -e 's#@@rtld-arch@@#$(rtld-arch)#' \
+	    -e 's#@@rtld-entry@@#$(rtld-entry)#' \
+	    -e 's#@@rtld-base@@#$(rtld-base)#' $< >$@
+
+$(objpfx)ld.so: $(objpfx)librtld.so $(objpfx)rtld-ldscript
+	$(rtld-link) -Wl,-soname=$(rtld-installed-name)
+
+define rtld-link
+$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
+	  -Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \
+	  $(filter-out $(objpfx)rtld-ldscript,$^)
+endef
+else
 $(objpfx)ld.so: $(objpfx)librtld.so
 	$(rtld-link) -Wl,-soname=$(rtld-installed-name)
 
@@ -95,6 +119,7 @@ define rtld-link
 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
 	  -Wl,-rpath=$(default-rpath) $^
 endef
+endif
 
 # The dl code in the static libc needs a default library path.
 CFLAGS-dl-support.c = -D'DEFAULT_RPATH="$(default-rpath)"'
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 10cc074a6a..87859219f1 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -44,6 +44,15 @@
 #define MAP_COPY	MAP_PRIVATE
 #endif
 
+/* Some systems link their relocatable objects for another base address
+   than 0.  We want to know the base address for these such that we can
+   subtract this address from the segment addresses during mapping.
+   This results in a more efficient address space usage.  Defaults to
+   zero for almost all systems.  */
+#ifndef MAP_BASE_ADDR
+#define MAP_BASE_ADDR(l)	0
+#endif
+
 
 #include <endian.h>
 #if BYTE_ORDER == BIG_ENDIAN
@@ -335,7 +344,8 @@ _dl_map_object_from_fd (char *name, int fd, char *realname,
  	caddr_t mapat;
 	ElfW(Addr) mappref;
 	size_t maplength = loadcmds[nloadcmds - 1].allocend - c->mapstart;
-	mappref = ELF_PREFERRED_ADDRESS (loader, maplength, c->mapstart);
+	mappref = (ELF_PREFERRED_ADDRESS (loader, maplength, c->mapstart)
+		   - MAP_BASE_ADDR (l));
 	mapat = map_segment (mappref, maplength, c->prot, 0, c->mapoff);
 	l->l_addr = (ElfW(Addr)) mapat - c->mapstart;
 
diff --git a/elf/dlfcn.h b/elf/dlfcn.h
index 9b06988e96..9db5fb4635 100644
--- a/elf/dlfcn.h
+++ b/elf/dlfcn.h
@@ -22,15 +22,8 @@
 
 #include <features.h>
 
-/* The MODE argument to `dlopen' contains one of the following: */
-#define RTLD_LAZY	0x001	/* Lazy function call binding.  */
-#define RTLD_NOW	0x002	/* Immediate function call binding.  */
-#define	RTLD_BINDING_MASK 0x3	/* Mask of binding time value.  */
-
-/* If the following bit is set in the MODE argument to `dlopen',
-   the symbols of the loaded object and its dependencies are made
-   visible as if the object were linked directly into the program.  */
-#define RTLD_GLOBAL	0x100
+/* Collect various system dependand definitions and declarations.  */
+#include <bits/dlfcn.h>
 
 /* If the first argument of `dlsym' is set to RTLD_NEXT the run-time
    address of the symbol called NAME in the next shared object is
diff --git a/elf/elf.h b/elf/elf.h
index 63d36b141c..d01bc90c90 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -741,6 +741,8 @@ typedef struct
 #define E_MIPS_ARCH_1	  0x00000000	/* -mips1 code.  */
 #define E_MIPS_ARCH_2	  0x10000000	/* -mips2 code.  */
 #define E_MIPS_ARCH_3	  0x20000000	/* -mips3 code.  */
+#define E_MIPS_ARCH_4	  0x30000000	/* -mips4 code.  */
+#define E_MIPS_ARCH_5	  0x40000000	/* -mips5 code.  */
 
 /* Special section indices.  */
 
@@ -810,6 +812,8 @@ typedef struct
 /* Legal values for p_type field of Elf32_Phdr.  */
 
 #define PT_MIPS_REGINFO	0x70000000	/* Register usage information */
+#define PT_MIPS_RTPROC  0x70000001	/* Runtime procedure table. */
+#define PT_MIPS_OPTIONS 0x70000002
 
 /* Legal values for d_tag field of Elf32_Dyn.  */
 
diff --git a/elf/rtld.c b/elf/rtld.c
index 22c1059fd2..a025757e05 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -25,6 +25,7 @@
 #include <sys/mman.h>		/* Check if MAP_ANON is defined.  */
 #include <stdio-common/_itoa.h>
 #include <assert.h>
+#include <entry.h>
 #include "dynamic-link.h"
 
 
@@ -137,7 +138,7 @@ _dl_start (void *arg)
 /* Now life is peachy; we can do all normal operations.
    On to the real work.  */
 
-void _start (void);
+void ENTRY_POINT (void);
 
 /* Some helper functions.  */
 
@@ -268,7 +269,7 @@ dl_main (const ElfW(Phdr) *phdr,
   /* Set up a flag which tells we are just starting.  */
   _dl_starting_up = 1;
 
-  if (*user_entry == (ElfW(Addr)) &_start)
+  if (*user_entry == (ElfW(Addr)) &ENTRY_POINT)
     {
       /* Ho ho.  We are not the program interpreter!  We are the program
 	 itself!  This means someone ran ld.so as a command.  Well, that
diff --git a/extra-lib.mk b/extra-lib.mk
index f2efb4bf7e..ad9f28cc65 100644
--- a/extra-lib.mk
+++ b/extra-lib.mk
@@ -49,4 +49,7 @@ endef
 object-suffixes-left = $(object-suffixes-$(lib))
 include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-$(lib)))
 
+# Add the version script to the dependencies of the shared library.
+$(objpfx)$(lib).so: $($(lib)-map)
+
 endif
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 7c28e551b3..030447addb 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -72,16 +72,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 struct hostent *_addr2hostname_hosts(const char *, int, int);
 #endif /* HOSTTABLE */
 
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 128
-#endif
-
 #ifndef min
 #define min(x,y) (((x) > (y)) ? (y) : (x))
 #endif /* min */
 
-static char *domain;
-static char domainbuffer[MAXHOSTNAMELEN];
+static const char *domain;
 
 static char *nrl_domainname(void)
 {
@@ -114,32 +109,34 @@ static char *nrl_domainname(void)
       }
 
       if (h && (c = strchr(h->h_name, '.'))) {
-	strcpy(domain = domainbuffer, ++c);
+	domain = __strdup (++c);
 	goto ret;
       }
 
-      if (!gethostname(domainbuffer, sizeof(domainbuffer))) {
-	if (c = strchr(domainbuffer, '.')) {
-	  domain = ++c;
-	  goto ret;
-	}
+      while (gethostname (tmpbuf, tmpbuflen)) {
+	tmpbuflen *= 2;
+	tmpbuf = __alloca (tmpbuflen);
+      }
+      if (c = strchr(tmpbuf, '.')) {
+	domain = __strdup(++c);
+	goto ret;
+      }
 
-	while (__gethostbyname_r(domainbuffer, &th, tmpbuf, tmpbuflen, &h,
-				 &herror)) {
-	  if (herror == NETDB_INTERNAL) {
-	    if (errno == ERANGE) {
-	      tmpbuflen *= 2;
-	      tmpbuf = __alloca(tmpbuflen);
-	    }
-	  } else {
-	    break;
+      while (__gethostbyname_r(tmpbuf, &th, tmpbuf, tmpbuflen, &h,
+			       &herror)) {
+	if (herror == NETDB_INTERNAL) {
+	  if (errno == ERANGE) {
+	    tmpbuflen *= 2;
+	    tmpbuf = __alloca(tmpbuflen);
 	  }
+	} else {
+	  break;
 	}
+      }
 
-	if (h && (c = strchr(h->h_name, '.'))) {
-	  strcpy(domain = domainbuffer, ++c);
-	  goto ret;
-	}
+      if (h && (c = strchr(h->h_name, '.'))) {
+	domain = __strdup(++c);
+	goto ret;
       }
 
       {
@@ -147,7 +144,9 @@ static char *nrl_domainname(void)
 
 	in_addr.s_addr = htonl(0x7f000001);
 
-	while (__gethostbyaddr_r((const char *)&in_addr, sizeof(struct in_addr), AF_INET, &th, tmpbuf, tmpbuflen, &h, &herror)) {
+	while (__gethostbyaddr_r((const char *)&in_addr,
+				 sizeof(struct in_addr), AF_INET, &th, tmpbuf,
+				 tmpbuflen, &h, &herror)) {
 	  if (herror == NETDB_INTERNAL) {
 	    if (errno == ERANGE) {
 	      tmpbuflen *= 2;
@@ -159,7 +158,7 @@ static char *nrl_domainname(void)
 	}
 
 	if (h && (c = strchr(h->h_name, '.'))) {
-	  domain = domainbuffer, ++c;
+	  domain = __strdup(++c);
 	  goto ret;
 	}
       }
@@ -168,7 +167,7 @@ static char *nrl_domainname(void)
 
   ret:
     __libc_lock_unlock (lock);
-  };
+  }
 
   return domain;
 };
diff --git a/isomac.c b/isomac.c
index f1d2d7d4a1..47040e61e6 100644
--- a/isomac.c
+++ b/isomac.c
@@ -185,6 +185,7 @@ char *CC;
 /* The -I parameters for CC to find all headers.  */
 char *INC;
 
+static char *xstrndup (const char *, size_t);
 static const char **get_null_defines (void);
 static int check_header (const char *, const char **);
 
@@ -222,6 +223,20 @@ main (int argc, char *argv[])
 }
 
 
+static char *
+xstrndup (const char *s, size_t n)
+{
+  size_t len = n;
+  char *new = malloc (len + 1);
+
+  if (new == NULL)
+    return NULL;
+
+  new[len] = '\0';
+  return memcpy (new, s, len);
+}
+
+
 static const char **
 get_null_defines (void)
 {
@@ -285,7 +300,7 @@ get_null_defines (void)
       start = &line[8];
       for (end = start + 1; !isspace (*end) && *end != '\0'; ++end)
 	;
-      result[result_len++] = strndup (start, end - start);
+      result[result_len++] = xstrndup (start, end - start);
 
       if (first)
 	{
diff --git a/libio/strops.c b/libio/strops.c
index ee2ed16c51..afc293bd7d 100644
--- a/libio/strops.c
+++ b/libio/strops.c
@@ -88,7 +88,7 @@ DEFUN(_IO_str_init_static, (fp, ptr, size, pstart),
   if (pstart)
     {
       fp->_IO_write_ptr = pstart;
-      fp->_IO_write_end = pstart;
+      fp->_IO_write_end = ptr + size;
       fp->_IO_read_end = pstart;
     }
   else
@@ -158,7 +158,7 @@ DEFUN(_IO_str_overflow, (fp, c),
 	  fp->_IO_write_ptr = new_buf + (fp->_IO_write_ptr - old_buf);
 
 	  fp->_IO_write_base = new_buf;
-	  fp->_IO_write_end = new_buf + (fp->_IO_write_end - old_buf);
+	  fp->_IO_write_end = fp->_IO_buf_end;
 	}
     }
 
diff --git a/login/Makefile b/login/Makefile
index 6ee21d2285..407330707b 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -22,7 +22,7 @@
 
 subdir	:= login
 
-headers	:= utmp.h bits/utmp.h lastlog.h pty.h
+headers	:= utmp.h bits/utmp.h utmpx.h bits/utmpx.h lastlog.h pty.h
 
 routines := getutent getutent_r getutid getutline getutid_r getutline_r \
 	    utmp_file utmp_daemon utmpname updwtmp
diff --git a/login/getutent.c b/login/getutent.c
index e9462db18d..eb99158592 100644
--- a/login/getutent.c
+++ b/login/getutent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -25,7 +25,7 @@ static struct utmp buffer;
 
 
 struct utmp *
-getutent (void)
+__getutent (void)
 {
   struct utmp *result;
 
@@ -34,3 +34,5 @@ getutent (void)
 
   return result;
 }
+weak_alias (__getutent, getutent)
+weak_alias (__getutent, getutxent)
diff --git a/login/getutent_r.c b/login/getutent_r.c
index 340e4747bd..a50e2786fd 100644
--- a/login/getutent_r.c
+++ b/login/getutent_r.c
@@ -63,6 +63,7 @@ __setutent (void)
   __libc_lock_unlock (__libc_utmp_lock);
 }
 weak_alias (__setutent, setutent)
+weak_alias (__setutent, setutxent)
 
 
 static int
@@ -105,6 +106,7 @@ __endutent (void)
   __libc_lock_unlock (__libc_utmp_lock);
 }
 weak_alias (__endutent, endutent)
+weak_alias (__endutent, endutxent)
 
 
 static void
@@ -154,8 +156,9 @@ __pututline (const struct utmp *data)
   return buffer;
 }
 weak_alias (__pututline, pututline)
+weak_alias (__pututline, pututxline)
 
-
+     
 static struct utmp *
 pututline_unknown (const struct utmp *data)
 {
diff --git a/login/login.c b/login/login.c
index cf8632daab..075ef15056 100644
--- a/login/login.c
+++ b/login/login.c
@@ -43,7 +43,7 @@ tty_name (int fd, char **tty, size_t buf_len)
 	{
 	  rv = ttyname_r (fd, buf, buf_len);
 
-	  if (rv < 0 || memchr (buf, '\0', buf_len))
+	  if (rv != 0 || memchr (buf, '\0', buf_len))
 	    /* We either got an error, or we succeeded and the
 	       returned name fit in the buffer.  */
 	    break;
diff --git a/login/programs/database.c b/login/programs/database.c
index 3138ae605c..087ec54d26 100644
--- a/login/programs/database.c
+++ b/login/programs/database.c
@@ -42,13 +42,13 @@ static int replace_entry (utmp_database *database, int old_position,
 			  int new_position, const struct utmp *entry);
 static int store_entry (utmp_database *database, int position,
 			const struct utmp *entry);
-static int get_mtime (const char *file, time_t *timer);
+static int get_mtime (int filedes, time_t *timer);
 
 
-/* Open the database specified by FILE and merge it with the
-   contents of the old format file specified by OLD_FILE.  Returns a
-   pointer to a newly allocated structure describing the database, or
-   NULL on error.  */
+/* Open the database specified by FILE and merge it with the contents
+   of the old format file specified by OLD_FILE.  Returns a pointer to
+   a newly allocated structure describing the database, or NULL on
+   error.  */
 utmp_database *
 open_database (const char *file, const char *old_file)
 {
@@ -57,31 +57,54 @@ open_database (const char *file, const char *old_file)
   /* Allocate memory.  */
   database = (utmp_database *) malloc (sizeof (utmp_database));
   if (database == NULL)
-    return NULL;
+    {
+      error (0, 0, _("memory exhausted"));
+      return NULL;
+    }
 
   memset (database, 0, sizeof (utmp_database));
 
-  /* Open database.  */
-  database->fd = open (file, O_RDWR);
+  /* Open database, create it if it doesn't exist already.  */
+  database->fd = open (file, O_RDWR | O_CREAT);
   if (database->fd < 0)
-    goto fail;
+    {
+      error (0, errno, "%s", file);
+      goto return_error;
+    }
 
-  database->old_fd = open (old_file, O_RDWR);
-  if (database->old_fd < 0)
-    goto fail;
+  database->file = strdup (file);
+  if (database->file == NULL)
+    {
+      error (0, 0, _("memory exhausted"));
+      goto return_error;
+    }
+
+  if (old_file)
+    {
+      database->old_fd = open (old_file, O_RDWR);
+      if (database->old_fd < 0)
+	{
+	  error (0, errno, "%s", old_file);
+	  goto return_error;
+	}
   
-  if ((file && !(database->file = strdup (file)))
-      || (old_file && !(database->old_file = strdup (old_file))))
-    goto fail;
+      database->old_file = strdup (old_file);
+      if (database->old_file == NULL)
+	{
+	  error (0, 0, _("memory exhausted"));
+	  goto return_error;
+	}
+    }
 
-  if (initialize_database (database) < 0
-      || synchronize_database (database) < 0)
-    goto fail;
+  /* Initialize database.  */
+  if (initialize_database (database) < 0)
+    goto return_error;
   
   return database;
 
-fail:
+return_error:
   close_database (database);
+  
   return NULL;
 }
 
@@ -100,8 +123,12 @@ synchronize_database (utmp_database *database)
       
       curtime = time (NULL);
       
-      if (get_mtime (database->old_file, &mtime) < 0)
-	return -1;
+      if (get_mtime (database->old_fd, &mtime) < 0)
+	{
+	  error (0, errno, _("%s: cannot get modification time"),
+		 database->old_file);
+	  return -1;
+	}
       
       if (mtime >= database->mtime)
 	{
@@ -118,7 +145,10 @@ synchronize_database (utmp_database *database)
 		  || !compare_entry (&old_entry, &entry))
 		{
 		  if (write_entry (database, position, &old_entry) < 0)
-		    return -1;
+		    {
+		      error (0, errno, "%s", database->file);
+		      return -1;
+		    }
 		}
 
 	      position++;
@@ -325,13 +355,19 @@ initialize_database (utmp_database *database)
 	      || entry.ut_type == OLD_TIME || entry.ut_type == NEW_TIME)
 	    {
 	      if (store_state_entry (database, position, &entry) < 0)
-		return -1;
+		{
+		  error (0, errno, "%s", database->file);
+		  return -1;
+		}
 	    }
 	  else
 #endif
 	    {
 	      if (store_process_entry (database, position, &entry) < 0)
-		return -1;
+		{
+		  error (0, errno, "%s", database->file);
+		  return -1;
+		}
 	    }
 
 	  /* Update position.  */
@@ -344,14 +380,17 @@ initialize_database (utmp_database *database)
 	    break;
 
 	  if (write_old_entry (database, position, &entry) < 0)
-	    return -1;
+	    {
+	      error (0, errno, "%s", database->file);
+	      return -1;
+	    }
 
 	  /* Update position.  */
 	  position++;
 	}
     }
 
-  return 0;
+  return synchronize_database (database);
 }
 
 
@@ -472,14 +511,14 @@ store_entry (utmp_database *database, int position,
 }
 
 
-/* Get modification time of FILE and put it in TIMER.  returns 0 if
-   successful, -1 if not.  */
+/* Get modification time of the file with file descriptor FILEDES and
+   put it in TIMER.  Returns 0 if successful, -1 if not.  */
 static int
-get_mtime (const char *file, time_t *timer)
+get_mtime (int filedes, time_t *timer)
 {
   struct stat st;
   
-  if (stat (file, &st) < 0)
+  if (fstat (filedes, &st) < 0)
     return -1;
 
   *timer = st.st_mtime;
diff --git a/login/programs/request.c b/login/programs/request.c
index 5e6bfa19cf..889ce0cba9 100644
--- a/login/programs/request.c
+++ b/login/programs/request.c
@@ -88,7 +88,7 @@ read_data (client_connection *connection)
     }
 
   if (nbytes < 0)
-    error (0, errno, "cannot read from client");
+    error (0, errno, _("cannot read from client"));
 
   return -1;
 }
@@ -117,7 +117,7 @@ write_data (client_connection *connection)
     }
 
   if (nbytes < 0)
-    error (0, errno, "cannot write to client");
+    error (0, errno, _("cannot write to client"));
 
   return -1;
 }
@@ -164,7 +164,7 @@ send_reply (client_connection *connection, const reply_header *reply)
   /* Check if the reply fits in the buffer.  */
   if ((size_t) (connection->write_end - connection->write_ptr) < reply->size)
     {
-      error (0, 0, "buffer overflow");
+      error (0, 0, _("buffer overflow"));
       return -1;
     }
 
diff --git a/login/programs/utmpd.c b/login/programs/utmpd.c
index 3c8d626a84..2fef776a69 100644
--- a/login/programs/utmpd.c
+++ b/login/programs/utmpd.c
@@ -139,12 +139,12 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
   
   /* Check if we are already running.  */
   if (check_pid (_PATH_UTMPDPID))
-    error (EXIT_FAILURE, 0, "already running");
+    error (EXIT_FAILURE, 0, _("already running"));
 
   /* Open UTMP database.  */
   utmp_db = open_database (_PATH_UTMP "x", _PATH_UTMP);
   if (utmp_db == NULL)
-    error (EXIT_FAILURE, errno, "%s", _PATH_UTMP);
+    exit (EXIT_FAILURE);
 
   /* Create sockets, with the right permissions.  */
   mask = umask (S_IXUSR | S_IXGRP | S_IXOTH);
@@ -156,7 +156,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
   /* Set the sockets up to accept connections.  */
   if (listen (ro_sock, MAX_CONNECTIONS) < 0
       || listen (rw_sock, MAX_CONNECTIONS) < 0)
-    error (EXIT_FAILURE, errno, "cannot enable socket to accept connections");
+    error (EXIT_FAILURE, errno,
+	   _("cannot enable socket to accept connections"));
 
   /* Behave like a daemon.  */
   if (!debug)
@@ -164,7 +165,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
       openlog ("utmpd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
       
       if (daemon (0, 0) < 0)
-	error (EXIT_FAILURE, errno, "cannot auto-background");
+	error (EXIT_FAILURE, errno, _("cannot auto-background"));
       forked = 1;
 
       if (write_pid (_PATH_UTMPDPID) < 0)
@@ -235,7 +236,7 @@ make_socket (const char *name)
   /* Create the socket.  */
   sock = socket (PF_UNIX, SOCK_STREAM, 0);
   if (sock < 0)
-    error (EXIT_FAILURE, errno, "cannot create socket");
+    error (EXIT_FAILURE, errno, _("cannot create socket"));
 
   /* Bind a name to the socket.  */
   addr.sun_family = AF_UNIX;
@@ -277,7 +278,7 @@ void handle_requests (void)
       read_fd_set = active_read_fd_set;
       write_fd_set = active_write_fd_set;
       if (select (FD_SETSIZE, &read_fd_set, &write_fd_set, NULL, NULL) < 0)
-	error (EXIT_FAILURE, errno, "cannot get input on sockets");
+	error (EXIT_FAILURE, errno, _("cannot get input on sockets"));
 
       /* Service all the sockets with input pending.  */
       for (fd = 0; fd < FD_SETSIZE; fd++)
@@ -290,7 +291,7 @@ void handle_requests (void)
 
 		  connection = accept_connection (fd, access);
 		  if (connection == NULL)
-		    error (0, errno, "cannot accept connection");
+		    error (0, errno, _("cannot accept connection"));
 
 		  FD_SET (connection->sock, &active_read_fd_set);
 		}
@@ -298,7 +299,7 @@ void handle_requests (void)
 		{
 		  connection = find_connection (fd);
 		  if (connection == NULL)
-		    error (EXIT_FAILURE, 0, "cannot find connection");
+		    error (EXIT_FAILURE, 0, _("cannot find connection"));
 
 		  if (read_data (connection) < 0)
 		    {
@@ -316,7 +317,7 @@ void handle_requests (void)
 	    {
 	      connection = find_connection (fd);
 	      if (connection == NULL)
-		error (EXIT_FAILURE, 0, "cannot find connection");
+		error (EXIT_FAILURE, 0, _("cannot find connection"));
 
 	      if (write_data (connection) < 0)
 		{
diff --git a/login/utmp_file.c b/login/utmp_file.c
index 51b33226e0..4e218d8baa 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -170,7 +170,7 @@ getutline_r_file (const struct utmp *line, struct utmp *buffer,
 		  struct utmp **result)
 {
   struct flock fl;
-  
+
   if (file_fd < 0 || file_offset == -1l)
     {
       *result = NULL;
@@ -215,7 +215,7 @@ unlock_return:
   fl.l_type = F_UNLCK;
   fcntl (file_fd, F_SETLKW, &fl);
 
-  return ((result == NULL) ? -1 : 0);
+  return ((*result == NULL) ? -1 : 0);
 }
 
 
@@ -251,7 +251,7 @@ internal_getut_r (const struct utmp *id, struct utmp *buffer)
 {
   int result = -1;
   struct flock fl;
-  
+
   /* Try to get the lock.  */
   memset (&fl, '\0', sizeof (struct flock));
   fl.l_type = F_RDLCK;
@@ -432,7 +432,7 @@ updwtmp_file (const char *file, const struct utmp *utmp)
   struct flock fl;
   off_t offset;
   int fd;
-  
+
   /* Open WTMP file.  */
   fd = open (file, O_WRONLY);
   if (fd < 0)
@@ -443,7 +443,7 @@ updwtmp_file (const char *file, const struct utmp *utmp)
   fl.l_type = F_WRLCK;
   fl.l_whence = SEEK_SET;
   fcntl (fd, F_SETLKW, &fl);
-  
+
   /* Remember original size of log file.  */
   offset = lseek (fd, 0, SEEK_END);
   if (offset % sizeof (struct utmp) != 0)
@@ -465,7 +465,7 @@ updwtmp_file (const char *file, const struct utmp *utmp)
     }
 
   result = 0;
-  
+
 unlock_return:
   /* And unlock the file.  */
   fl.l_type = F_UNLCK;
diff --git a/login/utmpx.h b/login/utmpx.h
new file mode 100644
index 0000000000..5873bf9310
--- /dev/null
+++ b/login/utmpx.h
@@ -0,0 +1,50 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef	_UTMPX_H
+#define	_UTMPX_H	1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Get system dependent values and data structures.  */
+#include <bits/utmpx.h>
+
+/* Open user accounting database.  */
+extern void *setutxent __P ((void));
+
+/* Close user accounting database.  */
+extern void endutxent __P ((void));
+
+/* Get the next entry from the user accounting database.  */
+extern struct utmpx *getutxent __P ((void));
+
+/* Get the user accounting database entry corresponding to ID.  */
+extern struct utmpx *getutxid __P ((const struct utmpx *__id));
+
+/* Get the user accounting database entry corresponding to LINE.  */
+extern struct utmpx *getutxline __P ((const struct utmpx *__line));
+
+/* Write the entry UTMPX into the user accounting database.  */
+extern struct utmpx *pututxline __P ((const struct utmpx *__utmpx));
+
+__END_DECLS
+
+#endif /* utmpx.h  */
diff --git a/misc/ttyslot.c b/misc/ttyslot.c
index 794cada0af..430f9c02d0 100644
--- a/misc/ttyslot.c
+++ b/misc/ttyslot.c
@@ -59,7 +59,7 @@ ttyslot()
 
 	setttyent();
 	for (cnt = 0; cnt < 3; ++cnt)
-		if (__ttyname_r (cnt, name, buflen) >= 0) {
+		if (__ttyname_r (cnt, name, buflen) == 0) {
 			if (p = rindex(name, '/'))
 				++p;
 			else
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index cc510b9541..85597144b2 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -22,6 +22,7 @@
 #include <fcntl.h>
 #include <bits/libc-lock.h>
 #include <rpc/rpc.h>
+#include <rpcsvc/nis.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 #include <rpcsvc/ypupd.h>
@@ -39,7 +40,7 @@ typedef struct dom_binding dom_binding;
 
 static struct timeval TIMEOUT = {25, 0};
 static int const MAXTRIES = 5;
-static char __ypdomainname[MAXHOSTNAMELEN + 1] = "\0";
+static char __ypdomainname[NIS_MAXNAMELEN + 1] = "\0";
 __libc_lock_define_initialized (static, ypbindlist_lock)
 static dom_binding *__ypbindlist = NULL;
 
@@ -305,7 +306,7 @@ yp_get_default_domain (char **outdomain)
 
   if (__ypdomainname[0] == '\0')
     {
-      if (getdomainname (__ypdomainname, MAXHOSTNAMELEN))
+      if (getdomainname (__ypdomainname, NIS_MAXNAMELEN))
 	result = YPERR_NODOM;
       else
 	*outdomain = __ypdomainname;
diff --git a/setjmp/setjmp.h b/setjmp/setjmp.h
index 0bb6fd64ca..b36bf3c692 100644
--- a/setjmp/setjmp.h
+++ b/setjmp/setjmp.h
@@ -51,17 +51,17 @@ extern int __sigsetjmp __P ((jmp_buf __env, int __savemask));
 /* Set ENV to the current position and return 0, not saving the signal mask.
    This is just like `sigsetjmp (ENV, 0)'.
    The ISO C standard says `setjmp' is a macro.  */
-#define	setjmp(env)	__sigsetjmp ((env), 0)
+# define setjmp(env)	__sigsetjmp ((env), 0)
 #else
 /* We are in 4.3 BSD-compatibility mode in which `setjmp'
    saves the signal mask like `sigsetjmp (ENV, 1)'.  */
-#define	setjmp(env)	__sigsetjmp ((env), 1)
+# define setjmp(env)	__sigsetjmp ((env), 1)
 #endif /* Favor BSD.  */
 
-#ifdef __USE_BSD
+#if defined __USE_BSD || defined __USE_XOPEN
 /* Set ENV to the current position and return 0, not saving the signal mask.
    This is the 4.3 BSD name for ISO `setjmp'.  */
-#define _setjmp(env)	__sigsetjmp ((env), 0)
+# define _setjmp(env)	__sigsetjmp ((env), 0)
 #endif
 
 
@@ -69,13 +69,13 @@ extern int __sigsetjmp __P ((jmp_buf __env, int __savemask));
    `setjmp' call there return VAL, or 1 if VAL is 0.  */
 extern void longjmp __P ((jmp_buf __env, int __val))
      __attribute__ ((__noreturn__));
-#ifdef	__USE_BSD
+#if defined __USE_BSD || defined __USE_XOPEN
 /* Same.  Usually `_longjmp' is used with `_setjmp', which does not save
    the signal mask.  But it is how ENV was saved that determines whether
    `longjmp' restores the mask; `_longjmp' is just an alias.  */
 extern void _longjmp __P ((jmp_buf __env, int __val))
      __attribute__ ((__noreturn__));
-#endif /* Use BSD.  */
+#endif
 
 /* Internal machine-dependent function to restore context sans signal mask.  */
 extern void __longjmp __P ((__jmp_buf __env, int __val))
@@ -96,7 +96,7 @@ typedef jmp_buf sigjmp_buf;
 
 /* Store the calling environment in ENV, also saving the
    signal mask if SAVEMASK is nonzero.  Return 0.  */
-#define	sigsetjmp(env, savemask)	__sigsetjmp ((env), (savemask))
+# define sigsetjmp(env, savemask)	__sigsetjmp ((env), (savemask))
 
 /* Jump to the environment saved in ENV, making the
    sigsetjmp call there return VAL, or 1 if VAL is 0.
diff --git a/sysdeps/generic/Dist b/sysdeps/generic/Dist
index e82624a61c..bc9e492e4f 100644
--- a/sysdeps/generic/Dist
+++ b/sysdeps/generic/Dist
@@ -1,2 +1,3 @@
 make_siglist.c signame.c signame.h
 det_endian.c
+entry.h
diff --git a/sysdeps/generic/bits/dlfcn.h b/sysdeps/generic/bits/dlfcn.h
new file mode 100644
index 0000000000..79604fe8ff
--- /dev/null
+++ b/sysdeps/generic/bits/dlfcn.h
@@ -0,0 +1,33 @@
+/* System dependand definitions for run-time dynamic loading.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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	_BITS_DLFCN_H
+#define	_BITS_DLFCN_H 1
+
+/* The MODE argument to `dlopen' contains one of the following: */
+#define RTLD_LAZY	0x001	/* Lazy function call binding.  */
+#define RTLD_NOW	0x002	/* Immediate function call binding.  */
+#define	RTLD_BINDING_MASK 0x3	/* Mask of binding time value.  */
+
+/* If the following bit is set in the MODE argument to `dlopen',
+   the symbols of the loaded object and its dependencies are made
+   visible as if the object were linked directly into the program.  */
+#define RTLD_GLOBAL	0x100
+
+#endif	/* bits/dlfcn.h */
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index f10fca81fd..c5e85274b0 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -18,6 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <elf.h>
+#include <entry.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
@@ -52,7 +53,7 @@ _dl_sysdep_start (void **start_argptr,
   gid_t egid = 0;
   unsigned int seen;
 
-  user_entry = (ElfW(Addr)) &_start;
+  user_entry = (ElfW(Addr)) &ENTRY_POINT;
   _dl_argc = *(long *) start_argptr;
   _dl_argv = (char **) start_argptr + 1;
   _environ = &_dl_argv[_dl_argc + 1];
diff --git a/sysdeps/generic/entry.h b/sysdeps/generic/entry.h
new file mode 100644
index 0000000000..cc0e1d88ab
--- /dev/null
+++ b/sysdeps/generic/entry.h
@@ -0,0 +1 @@
+#define ENTRY_POINT _start
diff --git a/sysdeps/gnu/bits/utmp.h b/sysdeps/gnu/bits/utmp.h
index db49ac845c..163f6427ec 100644
--- a/sysdeps/gnu/bits/utmp.h
+++ b/sysdeps/gnu/bits/utmp.h
@@ -16,35 +16,22 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _UTMPBITS_H
-
-#define _UTMPBITS_H	1
-#include <features.h>
+#ifndef _UTMP_H
+#error "Never use <bits/utmp.h> directly; include <utmpx.h> instead."
+#endif
 
 #include <paths.h>
 #include <sys/time.h>
 #include <sys/types.h>
 
 
-#define UT_UNKNOWN	0	/* for ut_type field */
-
-#define RUN_LVL		1
-#define BOOT_TIME	2
-#define NEW_TIME	3
-#define OLD_TIME	4
-
-#define INIT_PROCESS	5
-#define LOGIN_PROCESS	6
-#define USER_PROCESS	7
-#define DEAD_PROCESS	8
-#define ACCOUNTING	9
-
 #define UT_LINESIZE	32
 #define UT_NAMESIZE	32
 #define UT_HOSTSIZE	256
 
-__BEGIN_DECLS
 
+/* The structure describing an entry in the database of
+   previous logins.  */
 struct lastlog
 {
   time_t ll_time;
@@ -53,28 +40,8 @@ struct lastlog
 };
 
 
-/* XXX We are not ready to use this now.  It needs some more research.
-   Simly copying the behaviour of other implementations is no big
-   help.  */
-#if 0
-/* Which program created the record.  */
-enum utlogin
-{
-  unknown,
-  X,
-  local,
-  rlogin,
-  telnet,
-  rsh,
-  ftp,
-  screen,
-  splitvt,
-  xterm
-  /* More could be added here.  */
-};
-#endif
-
-
+/* The structure describing the status of a terminated process.  This
+   type is used in `struct utmp' below.  */
 struct exit_status
 {
   short int e_termination;	/* Process termination status.  */
@@ -82,16 +49,16 @@ struct exit_status
 };
 
 
+/* The structure describing an entry in the user accounting database.  */
 struct utmp
 {
   short int ut_type;		/* Type of login.  */
-  pid_t ut_pid;			/* Pid of login process.  */
-  char ut_line[UT_LINESIZE];	/* NUL-terminated devicename of tty.  */
-  char ut_id[4];		/* Inittab id. */
-  char ut_user[UT_NAMESIZE];	/* Username (not NUL terminated).  */
-#define ut_name	ut_user		/* Compatible field name for same.  */
+  pid_t ut_pid;			/* Process ID of login process.  */
+  char ut_line[UT_LINESIZE];	/* Devicename.  */
+  char ut_id[4];		/* Inittab ID.  */
+  char ut_user[UT_NAMESIZE];	/* Username.  */
   char ut_host[UT_HOSTSIZE];	/* Hostname for remote login.  */
-  struct exit_status ut_exit;	/* The exit status of a process marked
+  struct exit_status ut_exit;	/* Exit status of a process marked
 				   as DEAD_PROCESS.  */
   long ut_session;		/* Session ID, used for windowing.  */
   struct timeval ut_tv;		/* Time entry was made.  */
@@ -100,6 +67,7 @@ struct utmp
 };
 
 /* Backwards compatibility hacks.  */
+#define ut_name		ut_user
 #ifndef _NO_UT_TIME
 /* We have a problem here: `ut_time' is also used otherwise.  Define
    _NO_UT_TIME if the compiler complains.  */
@@ -108,6 +76,26 @@ struct utmp
 #define ut_xtime	ut_tv.tv_sec
 #define ut_addr		ut_addr_v6[0]
 
+
+/* Values for the `ut_type' field of a `struct utmp'.  */
+#define EMPTY		0	/* No valid user accounting information.  */
+
+#define RUN_LVL		1	/* The system's runlevel.  */
+#define BOOT_TIME	2	/* Time of system boot.  */
+#define NEW_TIME	3	/* Time after system clock changed.  */
+#define OLD_TIME	4	/* Time when system clock changed.  */
+
+#define INIT_PROCESS	5	/* Process spawned by the init process.  */
+#define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
+#define USER_PROCESS	7	/* Normal process.  */
+#define DEAD_PROCESS	8	/* Terminated process.  */
+
+#define ACCOUNTING	9
+
+/* Old Linux name for the EMPTY type.  */
+#define UT_UNKNOWN	EMPTY
+
+
 /* Tell the user that we have a modern system with UT_HOST, UT_PID,
    UT_TYPE, UT_ID and UT_TV fields.  */
 #define _HAVE_UT_TYPE	1
@@ -115,7 +103,3 @@ struct utmp
 #define _HAVE_UT_ID	1
 #define _HAVE_UT_TV	1
 #define _HAVE_UT_HOST	1
-
-__END_DECLS
-
-#endif /* !_UTMP_H_ */
diff --git a/sysdeps/gnu/bits/utmpx.h b/sysdeps/gnu/bits/utmpx.h
new file mode 100644
index 0000000000..4f1a876d0a
--- /dev/null
+++ b/sysdeps/gnu/bits/utmpx.h
@@ -0,0 +1,79 @@
+/* Structures and defenitions for the user accounting database.  GNU version.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _UTMPX_H
+#error "Never use <bits/utmpx.h> directly; include <utmpx.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <sys/time.h>
+
+
+#define __UT_LINESIZE	32
+#define __UT_NAMESIZE	32
+#define __UT_HOSTSIZE	256
+
+   
+/* The structure describing the status of a terminated process.  This
+   type is used in `struct utmpx' below.  */
+struct __exit_status
+{
+  short int e_termination;	/* Process termination status.  */
+  short int e_exit;		/* Process exit status.  */
+};
+
+
+/* The structure describing an entry in the user accounting database.  */
+struct utmpx
+{
+  short int ut_type;		/* Type of login.  */
+  __pid_t ut_pid;		/* Process ID of login process.  */
+  char ut_line[__UT_LINESIZE];	/* Devicename.  */
+  char ut_id[4];		/* Inittab ID. */
+  char ut_user[__UT_NAMESIZE];	/* Username.  */
+  char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
+  struct __exit_status ut_exit;	/* Exit status of a process marked
+				   as DEAD_PROCESS.  */
+  long ut_session;		/* Session ID, used for windowing.  */
+  struct timeval ut_tv;		/* Time entry was made.  */
+  __int32_t ut_addr_v6[4];	/* Internet address of remote host.  */
+  char pad[20];			/* Reserved for future use.  */
+};
+
+
+/* Values for the `ut_type' field of a `struct utmp'.  */
+#define EMPTY		0	/* No valid user accounting information.  */
+
+#define RUN_LVL		1	/* The system's runlevel.  */
+#define BOOT_TIME	2	/* Time of system boot.  */
+#define NEW_TIME	3	/* Time after system clock changed.  */
+#define OLD_TIME	4	/* Time when system clock changed.  */
+
+#define INIT_PROCESS	5	/* Process spawned by the init process.  */
+#define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
+#define USER_PROCESS	7	/* Normal process.  */
+#define DEAD_PROCESS	8	/* Terminated process.  */
+
+
+
+
+
+
+
+
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 64d36ca1a9..a83356fce1 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -237,6 +237,8 @@ _dl_start_user:\n\
 
 #ifdef RESOLVE
 
+extern char **_dl_argv;
+
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
@@ -275,6 +277,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>",
 				"' has different size in shared object, "
 				"consider re-linking\n", NULL);
 	    }
diff --git a/sysdeps/mips/bits/dlfcn.h b/sysdeps/mips/bits/dlfcn.h
new file mode 100644
index 0000000000..636da5662d
--- /dev/null
+++ b/sysdeps/mips/bits/dlfcn.h
@@ -0,0 +1,42 @@
+/* System dependand definitions for run-time dynamic loading.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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	_BITS_DLFCN_H
+#define	_BITS_DLFCN_H 1
+
+/* The MODE argument to `dlopen' contains one of the following: */
+#define RTLD_LAZY	0x001	/* Lazy function call binding.  */
+#define RTLD_NOW	0x002	/* Immediate function call binding.  */
+#define	RTLD_BINDING_MASK 0x3	/* Mask of binding time value.  */
+
+/* If the following bit is set in the MODE argument to `dlopen',
+   the symbols of the loaded object and its dependencies are made
+   visible as if the object were linked directly into the program.  */
+#define RTLD_GLOBAL	0x004
+
+__BEGIN_DECLS
+
+/* Some SGI specific calls that aren't implemented yet.  */
+extern void *sgidladd __P ((const char *, int));
+extern void *sgidlopen_version __P ((const char *, int, const char *, int));
+extern char *sgigetdsoversion __P ((const char *));
+
+__END_DECLS
+
+#endif	/* bits/dlfcn.h */
diff --git a/sysdeps/mips/bsd-_setjmp.S b/sysdeps/mips/bsd-_setjmp.S
index f519f19359..819a7018c4 100644
--- a/sysdeps/mips/bsd-_setjmp.S
+++ b/sysdeps/mips/bsd-_setjmp.S
@@ -23,14 +23,19 @@
 
 #include <sysdep.h>
 
+/* XXX Must this be __PIC__ ? --drepper */
 #ifdef PIC
 	.option pic2
 #endif
 ENTRY (_setjmp)
+	.set noreorder
 #ifdef PIC
 	.cpload t9
+	la	t9, C_SYMBOL_NAME (__sigsetjmp)
+	jr	t9
+#else
+	j	C_SYMBOL_NAME (__sigsetjmp)
 #endif
-	la t9, C_SYMBOL_NAME (__sigsetjmp)
-	nop
-	jr t9
-	li a1, 0		/* Pass a second argument of zero.  */
+	move	a1,zero		/* Pass a second argument of zero.  */
+	.set	reorder
+	.end	_setjmp
diff --git a/sysdeps/mips/bsd-setjmp.S b/sysdeps/mips/bsd-setjmp.S
index 9a22700718..f220404c2c 100644
--- a/sysdeps/mips/bsd-setjmp.S
+++ b/sysdeps/mips/bsd-setjmp.S
@@ -23,14 +23,19 @@
 
 #include <sysdep.h>
 
+/* XXX Must this be __PIC__ ? --drepper */
 #ifdef PIC
 	.option pic2
 #endif
 ENTRY (setjmp)
+	.set	noreorder
 #ifdef PIC
 	.cpload t9
+	la	t9, C_SYMBOL_NAME (__sigsetjmp)
+	jr	t9
+#else
+	j	C_SYMBOL_NAME (__sigsetjmp)
 #endif
-	la t9, C_SYMBOL_NAME (__sigsetjmp)
-	nop
-	jr t9
-	li a1, 1		/* Pass a second argument of one.  */
+	li	a1, 1		/* Pass a second argument of one.  */
+	.set	reorder
+	.end	setjmp
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index ff7d371025..cc7198b60e 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -24,6 +24,34 @@
 #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.  */
@@ -34,6 +62,18 @@
 #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) \
@@ -43,7 +83,7 @@ do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
    } while (0)
 
 /* Return nonzero iff E_MACHINE is compatible with the running host.  */
-static inline int
+static inline int __attribute__ ((unused))
 elf_machine_matches_host (ElfW(Half) e_machine)
 {
   switch (e_machine)
@@ -56,6 +96,16 @@ elf_machine_matches_host (ElfW(Half) e_machine)
     }
 }
 
+/* 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)
 {
@@ -75,6 +125,16 @@ 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)
@@ -87,7 +147,9 @@ elf_machine_load_address (void)
        "	nop\n"
        "here:	dsubu %0, $31, %0\n"
        "	.set reorder\n"
-       : "=r" (addr));
+       :	"=r" (addr)
+       :	/* No inputs */
+       :	"$31");
 #else
   asm ("	.set noreorder\n"
        "	la %0, here\n"
@@ -95,7 +157,9 @@ elf_machine_load_address (void)
        "	nop\n"
        "here:	subu %0, $31, %0\n"
        "	.set reorder\n"
-       : "=r" (addr));
+       :	"=r" (addr)
+       :	/* No inputs */
+       :	"$31");
 #endif
   return addr;
 }
@@ -105,7 +169,7 @@ elf_machine_load_address (void)
 
 /* Relocate GOT. */
 static inline void
-elf_machine_got_rel (struct link_map *map)
+elf_machine_got_rel (struct link_map *map, int lazy)
 {
   ElfW(Addr) *got;
   ElfW(Sym) *sym;
@@ -119,7 +183,7 @@ elf_machine_got_rel (struct link_map *map)
       const ElfW(Sym) *ref = sym; \
       ElfW(Addr) sym_loadaddr; \
       sym_loadaddr = _dl_lookup_symbol (strtab + sym->st_name, &ref, scope, \
-					map->l_name, DL_LOOKUP_NOPLT); \
+					map->l_name, ELF_MACHINE_RELOC_NOPLT);\
       (ref)? sym_loadaddr + ref->st_value: 0; \
     })
 
@@ -151,7 +215,7 @@ elf_machine_got_rel (struct link_map *map)
 	{
 	  if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC)
 	    {
-	      if (sym->st_value /* && maybe_stub (sym->st_value) */)
+	      if (sym->st_value && lazy)
 		*got = sym->st_value + map->l_addr;
 	      else
 		*got = RESOLVE_GOTSYM (sym);
@@ -163,7 +227,7 @@ elf_machine_got_rel (struct link_map *map)
 	*got = RESOLVE_GOTSYM (sym);
       else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
 	       && *got != sym->st_value
-	       /* && maybe_stub (*got) */)
+	       && lazy)
 	*got += map->l_addr;
       else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION)
 	{
@@ -193,6 +257,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
   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.
@@ -216,7 +285,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
     }
 
   /* Relocate global offset table.  */
-  elf_machine_got_rel (l);
+  elf_machine_got_rel (l, lazy);
 
   return lazy;
 }
@@ -282,6 +351,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
     }
 
   _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. */
@@ -295,211 +365,220 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
    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;\
-\
+#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, DL_LOOKUP_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\
+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. */\
-int _dl_mips_gnu_objects = 1;\
-\
+#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, DL_LOOKUP_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	2\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\
-	addu	$25,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\
-	subu	$29, 40\n\
-	.cprestore 32\n\
-	sw	$15, 36($29)\n\
-	sw	$4, 12($29)\n\
-	sw	$5, 16($29)\n\
-	sw	$6, 20($29)\n\
-	sw	$7, 24($29)\n\
-	sw	$16, 28($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\
-	lw	$31, 36($29)\n\
-	lw	$4, 12($29)\n\
-	lw	$5, 16($29)\n\
-	lw	$6, 20($29)\n\
-	lw	$7, 24($29)\n\
-	lw	$16, 28($29)\n\
-	addu	$29, 40\n\
-	move	$25, $2\n\
-	jr	$25\n\
-	.end	_dl_runtime_resolve\n\
+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	2\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 slot call pc.\n						      \
+	move	$3, $31\n						      \
+	# Modify t9 ($25) so as to point .cpload instruction.\n		      \
+	addu	$25,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			      \
+	subu	$29, 40\n						      \
+	.cprestore 32\n							      \
+	sw	$15, 36($29)\n						      \
+	sw	$4, 12($29)\n						      \
+	sw	$5, 16($29)\n						      \
+	sw	$6, 20($29)\n						      \
+	sw	$7, 24($29)\n						      \
+	sw	$16, 28($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						      \
+	lw	$31, 36($29)\n						      \
+	lw	$4, 12($29)\n						      \
+	lw	$5, 16($29)\n						      \
+	lw	$6, 20($29)\n						      \
+	lw	$7, 24($29)\n						      \
+	lw	$16, 28($29)\n						      \
+	addu	$29, 40\n						      \
+	move	$25, $2\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.  */
-#define ELF_MACHINE_USER_ADDRESS_MASK	0x00000000UL
+#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.  */
+   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.  */
 
 #ifdef __mips64
 #define RTLD_START asm ("\
 	.text\n\
-	.align	3\n\
-	.globl _start\n\
-	.globl _dl_start_user\n\
-	.ent _start\n\
-_start:\n\
+	.align	3\n"\
+_RTLD_PROLOGUE (ENTRY_POINT)\
+"	.globl _dl_start_user\n\
 	.set noreorder\n\
 	bltzal $0, 0f\n\
 	nop\n\
@@ -561,16 +640,15 @@ _dl_start_user:\n\
 	ld $5, 1*8($29)\n\
 	ld $6, 2*8$29)\n\
 	ld $7, 3*8($29)\n\
-	jr $25\n\
-	.end _start\n\
-");
+	jr $25\n"\
+_RTLD_EPILOGUE(ENTRY_POINT) \
+);
+
 #else
 #define RTLD_START asm ("\
-	.text\n\
-	.globl _start\n\
-	.globl _dl_start_user\n\
-	.ent _start\n\
-_start:\n\
+	.text\n"\
+_RTLD_PROLOGUE(ENTRY_POINT)\
+"	.globl _dl_start_user\n\
 	.set noreorder\n\
 	bltzal $0, 0f\n\
 	nop\n\
@@ -582,7 +660,9 @@ _start:\n\
 	la $4, _DYNAMIC\n\
 	sw $4, -0x7ff0($28)\n\
 	move $4, $29\n\
+	subu $29, 16\n\
 	jal _dl_start\n\
+	addiu $29, 16\n\
 	# Get the value of label '_dl_start_user' in t9 ($25).\n\
 	la $25, _dl_start_user\n\
 _dl_start_user:\n\
@@ -610,7 +690,9 @@ _dl_start_user:\n\
 	lw $4, 8($2)\n\
 	# Call _dl_init_next to return the address of an initializer\n\
 	# function to run.\n\
+	subu $29, 16\n\
 	jal _dl_init_next\n\
+	addiu $29, 16\n\
 	move $28, $16\n\
 	# Check for zero return,  when out of initializers.\n\
 	beq $2, $0, 2f\n\
@@ -624,16 +706,18 @@ _dl_start_user:\n\
 	move $28, $16\n\
 	# Loop to call _dl_init_next for the next initializer.\n\
 	b 1b\n\
+2:	# Clear the startup flag.  Assumes 32 bit ints.\n\
+	sw $0, _dl_starting_up\n\
 	# Pass our finalizer function to the user in ra.\n\
-2:	la $31, _dl_fini\n\
+	la $31, _dl_fini\n\
 	# Jump to the user entry point.\n\
 	move $25, $17\n\
 	lw $4, 0($29)\n\
 	lw $5, 4($29)\n\
 	lw $6, 8($29)\n\
 	lw $7, 12($29)\n\
-	jr $25\n\
-	.end _start\n\
+	jr $25\n"\
+_RTLD_EPILOGUE(ENTRY_POINT)\
 ");
 #endif
 
diff --git a/sysdeps/mips/elf/start.S b/sysdeps/mips/elf/start.S
index 355a4a905c..ce9ad9c7ec 100644
--- a/sysdeps/mips/elf/start.S
+++ b/sysdeps/mips/elf/start.S
@@ -17,6 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <entry.h>
+
+#ifndef ENTRY_POINT
+#error ENTRY_POINT needs to be defined for start.S on MIPS/ELF.
+#endif
+
 /* This is the canonical entry point, usually the first thing in the text
    segment.  The SVR4/Mips ABI (pages 3-31, 3-32) says that when the entry
    point runs, most registers' values are unspecified, except for:
@@ -53,8 +59,8 @@
 #endif
 
 	.text
-	.globl _start
-_start:
+	.globl ENTRY_POINT
+ENTRY_POINT:
 #ifdef PIC
 	SET_GP
 #endif
@@ -81,20 +87,9 @@ nofini:
 	   the prologue of __libc_init_first, we preload them to
 	   prevent clobbering the stack tops. In Hurd case, stack pointer
 	   ($29) may be VM_MAX_ADDRESS here. If so, we must modify it.  */
-#if (__mips64)
-	dli $4, 0x10000000000
-	bne $29, $4, 1f
-	dsubu $29, 32
-	sd $0, 0($29)
-	sd $0, 8($29)
-	sd $0, 16($29)
-	sd $0, 24($29)
-1:
-	ld $4, 0($29)
-	ld $5, 8($29)
-	ld $6, 16($29)
-	ld $7, 24($29)
-#else  /* __mips64 */
+#if 0
+	jal mach_host_self
+#endif
 	li $4, 0x80000000
 	bne $29, $4, 1f
 	subu $29, 16
@@ -107,23 +102,14 @@ nofini:
 	lw $5, 4($29)
 	lw $6, 8($29)
 	lw $7, 12($29)
-#endif  /* __mips64 */
-
 	jal __libc_init_first
 #ifdef PIC
 	SET_GP
 #endif
-#if (__mips64)
-	ld $4, 0($29)
-	ld $5, 8($29)
-	ld $6, 16($29)
-	ld $7, 24($29)
-#else  /* __mips64 */
 	lw $4, 0($29)
 	lw $5, 4($29)
 	lw $6, 8($29)
 	lw $7, 12($29)
-#endif  /* __mips64 */
 
 	/* Call `_init', which is the entry point to our own `.init'
 	   section; and register with `atexit' to have `exit' call
@@ -145,19 +131,11 @@ nofini:
 
 	/* Extract the arguments and environment as encoded on the stack
 	   and set up the arguments for `main': argc, argv, envp.  */
-#if (__mips64)
-	ld $4, 0($29)		/* argc */
-	daddu $5, $29, 8	/* argv */
-	dsll $6, $4, 3
-	daddu $6, $6, 8
-	daddu $6, $5, $6	/* envp = &argv[argc + 1] */
-#else  /* __mips64 */
 	lw $4, 0($29)		/* argc */
 	addu $5, $29, 4		/* argv */
 	sll $6, $4, 2
 	addu $6, $6, 4
 	addu $6, $5, $6		/* envp = &argv[argc + 1] */
-#endif  /* __mips64 */
 
 	/* Call the user's main function, and exit with its value.  */
 	jal main
@@ -172,10 +150,11 @@ hlt:	b hlt			/* Crash if somehow it does return.  */
 	.data
 	.globl __data_start
 __data_start:
-#if (__mips64)
-	.dword 0
-#else  /* __mips64 */
-	.word 0
-#endif  /* __mips64 */
+	.long 0
 	.weak data_start
 	data_start = __data_start
+
+	.comm errno, 4, 4
+#ifdef __ELF__
+	.type errno, @object
+#endif
diff --git a/sysdeps/mips/fpu_control.h b/sysdeps/mips/fpu_control.h
index 36e05a4f6e..e271ae1fcc 100644
--- a/sysdeps/mips/fpu_control.h
+++ b/sysdeps/mips/fpu_control.h
@@ -1,7 +1,7 @@
 /* FPU control word bits.  Mips version.
    Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Olaf Flebbe.
+   Contributed by Olaf Flebbe and Ralf Baechle.
 
    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
@@ -21,74 +21,84 @@
 #ifndef _FPU_CONTROL_H
 #define _FPU_CONTROL_H
 
-/* FP control/status register bit assignments.
+/* MIPS FPU floating point control register bits.
  *
- *     31-25    24  23     22-18       17-12          11-7       6-2     1-0
- *                                    (cause)      (enables)   (flags)
- * | reserved | FS | C | reserved | E V Z O U I | V Z O U I | V Z O U I | RM
+ * 31-25  -> floating point conditions code bits 7-1.  These bits are only
+ *           available in MIPS IV.
+ * 24     -> flush denormalized results to zero instead of
+ *           causing unimplemented operation exception.  This bit is only
+ *           available for MIPS III and newer.
+ * 23     -> Condition bit
+ * 22-18  -> reserved (read as 0, write with 0)
+ * 17     -> cause bit for unimplemented operation
+ * 16     -> cause bit for invalid exception
+ * 15     -> cause bit for division by zero exception
+ * 14     -> cause bit for overflow exception
+ * 13     -> cause bit for underflow exception
+ * 12     -> cause bit for inexact exception
+ * 11     -> enable exception for invalid exception
+ * 10     -> enable exception for division by zero exception
+ *  9     -> enable exception for overflow exception
+ *  8     -> enable exception for underflow exception
+ *  7     -> enable exception for inexact exception
+ *  6     -> flag invalid exception
+ *  5     -> flag division by zero exception
+ *  4     -> flag overflow exception
+ *  3     -> flag underflow exception
+ *  2     -> flag inexact exception
+ *  1-0   -> rounding control
  *
- * FS: When set, denormalized results are flushed to zero instead of
- *     causing an unimplemented operation exception.
- * C:  Condition bit.
- * E:  Unimplemented Operation.
- * V:  Invalid Operation.
- * Z:  Division by zero.
- * O:  Overflow.
- * U:  Underflow.
- * I:  Inexact Operation
- * RM: Rounding mode bits
- * 00 (RN) - rounding to nearest
- * 01 (RZ) - rounding toward zero
- * 10 (RP) - rounding down (toward - infinity)
- * 11 (RM) - rounding up (toward + infinity)
  *
+ * Rounding Control:
+ * 00 - rounding to nearest (RN)
+ * 01 - rounding toward zero (RZ)
+ * 01 - rounding (up) toward plus infinity (RP)
+ * 11 - rounding (down)toward minus infinity (RM)
  */
 
 #include <features.h>
 
 /* masking of interrupts */
-#define _FPU_MASK_IM  (1 << 11)
-#define _FPU_MASK_DM  (1 << 24)	/* XXX */
-#define _FPU_MASK_ZM  (1 << 10)
-#define _FPU_MASK_OM  (1 << 9)
-#define _FPU_MASK_UM  (1 << 8)
-#define _FPU_MASK_PM  (1 << 7)
-
-/* precision control */
-#define _FPU_EXTENDED 0
-#define _FPU_DOUBLE   0
-#define _FPU_SINGLE   0
+#define _FPU_MASK_V     0x0800  /* Invalid operation */
+#define _FPU_MASK_Z     0x0400  /* Division by zero  */
+#define _FPU_MASK_O     0x0200  /* Overflow          */
+#define _FPU_MASK_U     0x0100  /* Underflow         */
+#define _FPU_MASK_I     0x0080  /* Inexact operation */
+
+/* flush denormalized numbers to zero */
+#define _FPU_FLUSH_TZ   0x1000000
 
 /* rounding control */
-#define _FPU_RC_NEAREST 0x0    /* RECOMMENDED */
-#define _FPU_RC_DOWN    0x2
-#define _FPU_RC_UP      0x3
+#define _FPU_RC_NEAREST 0x0     /* RECOMMENDED */
 #define _FPU_RC_ZERO    0x1
+#define _FPU_RC_UP      0x2
+#define _FPU_RC_DOWN    0x3
 
-#define _FPU_RESERVED 0xfe7c0000  /* Reserved bits */
+#define _FPU_RESERVED 0xfe3c0000  /* Reserved bits in cw */
 
 
 /* The fdlibm code requires strict IEEE double precision arithmetic,
    and no interrupts for exceptions, rounding to nearest.  */
 
-#define _FPU_DEFAULT  0x0
+#define _FPU_DEFAULT  0x00000600
 
 /* IEEE:  same as above, but exceptions */
-#define _FPU_IEEE     (0x1f << 7)
+#define _FPU_IEEE     0x00000F80
 
 /* Type of the control word.  */
-typedef unsigned int fpu_control_t;
+typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
 
 /* Macros for accessing the hardware control word.  */
-#define _FPU_GETCW(cw) __asm__ ("cfc1 %0, $31; nop; nop" : "=r" (cw))
-#define _FPU_SETCW(cw) __asm__ ("ctc1 %0, $31; nop; nop" : : "r" (cw))
+#define _FPU_GETCW(cw) __asm__ ("cfc1 %0,$31" : "=r" (cw) : )
+#define _FPU_SETCW(cw) __asm__ ("ctc1 %0,$31" : : "r" (cw))
 
 /* Default control word set at startup.  */
 extern fpu_control_t __fpu_control;
 
 __BEGIN_DECLS
 
-/* Called at startup.  It can be used to manipulate fpu control register.  */
+/* Called at startup.  It can be used to manipulate the fpu control
+   register.  */
 extern void __setfpucw __P ((fpu_control_t));
 
 __END_DECLS
diff --git a/sysdeps/mips/mips64/rtld-parms b/sysdeps/mips/mips64/rtld-parms
new file mode 100644
index 0000000000..77dfc39ef4
--- /dev/null
+++ b/sysdeps/mips/mips64/rtld-parms
@@ -0,0 +1,3 @@
+ifndef rtld-wordsize
+rtld-wordsize = 64
+endif
diff --git a/sysdeps/mips/mipsel/rtld-parms b/sysdeps/mips/mipsel/rtld-parms
new file mode 100644
index 0000000000..07fac51647
--- /dev/null
+++ b/sysdeps/mips/mipsel/rtld-parms
@@ -0,0 +1,3 @@
+ifndef rtld-oformat
+rtld-oformat = elf32-littlemips
+endif
diff --git a/sysdeps/mips/rtld-ldscript.in b/sysdeps/mips/rtld-ldscript.in
new file mode 100644
index 0000000000..7c9f65f3e7
--- /dev/null
+++ b/sysdeps/mips/rtld-ldscript.in
@@ -0,0 +1,106 @@
+OUTPUT_FORMAT("@@rtld-oformat@@")
+OUTPUT_ARCH(@@rtld-arch@@)
+ENTRY(@@rtld-entry@@)
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = @@rtld-base@@;
+  .reginfo       : { *(.reginfo) }
+  .dynamic       : { *(.dynamic) }
+  .dynstr        : { *(.dynstr)		}
+  .dynsym        : { *(.dynsym)		}
+  .hash          : { *(.hash)		}
+  .rel.text      : { *(.rel.text)		}
+  .rela.text     : { *(.rela.text) 	}
+  .rel.data      : { *(.rel.data)		}
+  .rela.data     : { *(.rela.data) 	}
+  .rel.rodata    : { *(.rel.rodata) 	}
+  .rela.rodata   : { *(.rela.rodata) 	}
+  .rel.got       : { *(.rel.got)		}
+  .rela.got      : { *(.rela.got)		}
+  .rel.ctors     : { *(.rel.ctors)	}
+  .rela.ctors    : { *(.rela.ctors)	}
+  .rel.dtors     : { *(.rel.dtors)	}
+  .rela.dtors    : { *(.rela.dtors)	}
+  .rel.init      : { *(.rel.init)	}
+  .rela.init     : { *(.rela.init)	}
+  .rel.fini      : { *(.rel.fini)	}
+  .rela.fini     : { *(.rela.fini)	}
+  .rel.bss       : { *(.rel.bss)		}
+  .rela.bss      : { *(.rela.bss)		}
+  .rel.plt       : { *(.rel.plt)		}
+  .rela.plt      : { *(.rela.plt)		}
+  .rodata    : { *(.rodata)  }
+  .rodata1   : { *(.rodata1) }
+  .init          : { *(.init)	} =0
+  .text      :
+  {
+    *(.text)
+    *(.stub)
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+  } =0
+  .fini      : { *(.fini)    } =0
+  /* Adjust the address for the data segment.  We want to adjust up to
+     the same address within the page on the next page up.  It would
+     be more correct to do this:
+       . = 0x10000000;
+     The current expression does not correctly handle the case of a
+     text segment ending precisely at the end of a page; it causes the
+     data segment to skip a page.  The above expression does not have
+     this problem, but it will currently (2/95) cause BFD to allocate
+     a single segment, combining both text and data, for this case.
+     This will prevent the text segment from being shared among
+     multiple executions of the program; I think that is more
+     important than losing a page of the virtual address space (note
+     that no actual memory is lost; the page which is skipped can not
+     be referenced).  */
+  . += 0x10000;
+  .data    :
+  {
+    *(.data)
+    CONSTRUCTORS
+  }
+  .data1   : { *(.data1) }
+  .ctors         : { *(.ctors)   }
+  .dtors         : { *(.dtors)   }
+  _gp = ALIGN(16) + 0x7ff0;
+  .got           :
+  {
+    *(.got.plt) *(.got)
+   }
+  /* We want the small data sections together, so single-instruction offsets
+     can access them all, and initialized data all before uninitialized, so
+     we can shorten the on-disk segment size.  */
+  .sdata     : { *(.sdata) }
+  .lit8 : { *(.lit8) }
+  .lit4 : { *(.lit4) }
+  .sbss      : { *(.sbss) *(.scommon) }
+  .bss       :
+  {
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  /* The normal linker scripts created by the binutils doesn't have the
+     symbols end and _end which breaks ld.so's dl-minimal.c.  */
+  _end = . ;
+  PROVIDE (end = .);
+  /* These are needed for ELF backends which have not yet been
+     converted to the new style linker.  */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+  /* DWARF debug sections.
+     Symbols in the .debug DWARF section are relative to the beginning of the
+     section so we begin .debug at 0.  It's not clear yet what needs to happen
+     for the others.   */
+  .debug          0 : { *(.debug) }
+  .debug_srcinfo  0 : { *(.debug_srcinfo) }
+  .debug_aranges  0 : { *(.debug_aranges) }
+  .debug_pubnames 0 : { *(.debug_pubnames) }
+  .debug_sfnames  0 : { *(.debug_sfnames) }
+  .line           0 : { *(.line) }
+  /* These must appear regardless of  .  */
+  .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
+  .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
+}
diff --git a/sysdeps/mips/setjmp.S b/sysdeps/mips/setjmp.S
index bc42dcb03b..607b5f268d 100644
--- a/sysdeps/mips/setjmp.S
+++ b/sysdeps/mips/setjmp.S
@@ -26,10 +26,20 @@
 #endif
 ENTRY (__sigsetjmp)
 #ifdef PIC
-	.cpload t9
+	.set	noreorder
+	.cpload	t9
+	.set	reorder
 #endif
-	move a2, sp
-	move a3, fp
-	la t9, __sigsetjmp_aux
-	nop
-	jr t9
+	move	a2, sp
+#ifdef fp
+	move	a3, fp
+#else
+	move	a3, $fp
+#endif
+#ifdef PIC
+	la	t9, __sigsetjmp_aux
+	jr	t9
+#else
+	j	__sigsetjmp_aux
+#endif
+	.end __sigsetjmp
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index f819bb4c0c..fb9709fee7 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -436,10 +436,10 @@ static int gaih_inet(const char *name, const struct gaih_service *service,
     struct gaih_servtuple *st2;
     struct gaih_addrtuple *at2 = at;
     int j;
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 128
-#endif /* MAXHOSTNAMELEN */
-    char buffer[MAXHOSTNAMELEN];
+    /*
+      buffer is the size of an unformatted IPv6 address in printable format.
+     */
+    char buffer[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
 
     while(at2) {
       if (req->ai_flags & AI_CANONNAME) {
diff --git a/sysdeps/unix/getlogin.c b/sysdeps/unix/getlogin.c
index 6e8a9a2a87..84b7dd8276 100644
--- a/sysdeps/unix/getlogin.c
+++ b/sysdeps/unix/getlogin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -46,7 +46,7 @@ getlogin (void)
      thing to do.  Note that ttyname(open("/dev/tty")) on those
      systems returns /dev/tty, so that is not a possible solution for
      getlogin().  */
-  if (__ttyname_r (0, real_tty_path, sizeof (tty_pathname)) < 0)
+  if (__ttyname_r (0, real_tty_path, sizeof (tty_pathname)) != 0)
     return NULL;
 
   real_tty_path += 5;		/* Remove "/dev/".  */
diff --git a/sysdeps/unix/getlogin_r.c b/sysdeps/unix/getlogin_r.c
index 75f17cb86f..8ec2fae754 100644
--- a/sysdeps/unix/getlogin_r.c
+++ b/sysdeps/unix/getlogin_r.c
@@ -1,5 +1,5 @@
 /* Reentrant function to return the current login name.  Unix version.
-   Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -41,19 +41,17 @@ getlogin_r (name, name_len)
   struct utmp *ut, line, buffer;
 
   {
-    int err;
     int d = __open ("/dev/tty", 0);
     if (d < 0)
       return errno;
 
     result = ttyname_r (d, real_tty_path, sizeof (tty_pathname));
-    err = errno;
     (void) close (d);
 
-    if (result < 0)
+    if (result != 0)
       {
-	__set_errno (err);
-	return err;
+	__set_errno (result);
+	return result;
       }
   }
 
diff --git a/sysdeps/unix/mips/brk.S b/sysdeps/unix/mips/brk.S
index 197672669b..e38f735b92 100644
--- a/sysdeps/unix/mips/brk.S
+++ b/sysdeps/unix/mips/brk.S
@@ -24,46 +24,24 @@
 #endif
 
 #ifndef       HAVE_GNU_LD
-#define __end           end
+#define _end           end
 #endif
 
-.data
-.sdata
+	.data
 ENTRY(__curbrk)
-	.word __end
+	.word 0
 	.end __curbrk
-.text
-.set noreorder
-.set noat
 
-ENTRY(__brk)
-	/* Minimum is one page.  */
-	lui v0, 4096
-	lw v0, __end
-	nop
-
-	/* If they ask for less than a page, givvem the whole
-	   thing anyway.  */
-	sltu AT, a0, v0
-	beq AT, zero, down1
-	nop
-	move a0, v0
-down1:
-	li v0, SYS_brk
-	syscall
-	bne a3, zero, error
-
-	/* Update __curbrk and exit cleanly.  */
-	lui AT, 4096
+	.text
+SYSCALL__(brk, 1)
+	.set	reorder
+	/* Handle the query case.  */
+	bnez a0, 1f
+	move a0,v0
+1:	/* Update __curbrk and exit cleanly.  */
 	sw a0, __curbrk
-	j ra
 	move v0, zero
-
-	/* What a horrible way to die.  */
-error:	j syscall_error
-	nop
-	nop
-	nop
+	jr ra
 	.end __brk
 
 weak_alias (__brk, brk)
diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S
index 0cfc302770..ac8335fe5b 100644
--- a/sysdeps/unix/mips/sysdep.S
+++ b/sysdeps/unix/mips/sysdep.S
@@ -21,10 +21,23 @@
 #define _ERRNO_H
 #include <bits/errno.h>
 
-/* .globl errno */
-.set noreorder
+	.comm errno, 4
+#ifdef __ELF__
+	.type errno, @object
+#endif
+
+	.set noreorder
 
-ENTRY(syscall_error)
+ENTRY(__syscall_error)
+#ifdef __PIC__
+	.set	noat
+	move	$1, $31
+	bltzal	$0, 0f
+	nop
+0:	.cpload	$31
+	move	$31, $1
+	.set	at
+#endif
 #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
 	/* We translate the system's EWOULDBLOCK error into EAGAIN.
 	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
@@ -40,4 +53,8 @@ skip:
 	/* And just kick back a -1.  */
 	j ra
 	li v0, -1
-	.end syscall_error
+	END(__syscall_error)
+
+/* We provide this alias for compatilility with other Unices
+   like IRIX 5  */
+weak_alias (__syscall_error, syscall_error)
diff --git a/sysdeps/unix/mips/sysdep.h b/sysdeps/unix/mips/sysdep.h
index 2f148d0938..cbafbdcd9a 100644
--- a/sysdeps/unix/mips/sysdep.h
+++ b/sysdeps/unix/mips/sysdep.h
@@ -32,19 +32,41 @@
 /* Note that while it's better structurally, going back to call syscall_error
    can make things confusing if you're debugging---it looks like it's jumping
    backwards into the previous fn.  */
+#ifdef __PIC__
+ #define PSEUDO(name, syscall_name, args) \
+  .align 2;								      \
+  99: la t9,syscall_error;						      \
+  jr t9;								      \
+  ENTRY(name)								      \
+  .set noreorder;							      \
+  .cpload t9;								      \
+  li v0, SYS_##syscall_name;						      \
+  syscall;								      \
+  .set reorder;								      \
+  bne a3, zero, 99b;							      \
+syse1:
+#else
 #define PSEUDO(name, syscall_name, args) \
   .set noreorder;							      \
   .align 2;								      \
   99: j syscall_error;							      \
-  nop;							      		      \
   ENTRY(name)								      \
+  .set noreorder;							      \
   li v0, SYS_##syscall_name;						      \
   syscall;								      \
+  .set reorder;								      \
   bne a3, zero, 99b;							      \
-  nop;									      \
 syse1:
+#endif
+
+#undef PSEUDO_END
+#define PSEUDO_END(sym) .end sym
 
 #define ret	j ra ; nop
+
+#undef END
+#define END(sym)        .end sym
+
 #define r0	v0
 #define r1	v1
 /* The mips move insn is d,s.  */
diff --git a/sysdeps/unix/mips/wait.S b/sysdeps/unix/mips/wait.S
index a544156c4e..9ea55bc7d0 100644
--- a/sysdeps/unix/mips/wait.S
+++ b/sysdeps/unix/mips/wait.S
@@ -28,14 +28,14 @@ ENTRY(__wait)
 
 	li v0, SYS_wait
 	syscall
-	beq a3, zero, noerror
+	beqz a3, noerror
 	nop
-	j syscall_error
+	j __syscall_error
 	nop
 
 noerror:
 	/* If the arg is not NULL, store v1 there.  */
-	beq a0, zero, noarg
+	beqz a0, noarg
 	nop
 	sw v1, 0(a0)
 	nop
diff --git a/sysdeps/unix/sysv/linux/bits/ipc.h b/sysdeps/unix/sysv/linux/bits/ipc.h
index f5fea0d295..c01a81a83f 100644
--- a/sysdeps/unix/sysv/linux/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/bits/ipc.h
@@ -82,4 +82,4 @@ extern int __ipc __P ((int __call, int __first, int __second, int __third,
 
 __END_DECLS
 
-#endif /* _SYS_IPC_BUF_H */
+#endif /* bits/ipc_buf.h */
diff --git a/sysdeps/unix/sysv/linux/bits/msq.h b/sysdeps/unix/sysv/linux/bits/msq.h
index 0abc10f6e5..59559a31c3 100644
--- a/sysdeps/unix/sysv/linux/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/bits/msq.h
@@ -75,4 +75,4 @@ struct msginfo
 
 __END_DECLS
 
-#endif /* _SYS_MSQ_BUF_H */
+#endif /* bits/msq_buf.h */
diff --git a/sysdeps/unix/sysv/linux/bits/sem.h b/sysdeps/unix/sysv/linux/bits/sem.h
index 049a71bc47..87951efea1 100644
--- a/sysdeps/unix/sysv/linux/bits/sem.h
+++ b/sysdeps/unix/sysv/linux/bits/sem.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -85,4 +85,4 @@ struct  seminfo
 
 __END_DECLS
 
-#endif /* _SYS_SEM_BUF_H */
+#endif /* bits/sem_buf.h */
diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h
index 642b7bd191..6db01dd4a2 100644
--- a/sysdeps/unix/sysv/linux/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/bits/shm.h
@@ -89,4 +89,4 @@ struct shm_info
 
 __END_DECLS
 
-#endif /* _SYS_SHM_BUF_H */
+#endif /* bits/shm_buf.h */
diff --git a/sysdeps/unix/sysv/linux/mips/Dist b/sysdeps/unix/sysv/linux/mips/Dist
new file mode 100644
index 0000000000..a205c94f95
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/Dist
@@ -0,0 +1,3 @@
+clone.S
+kernel_sigaction.h
+kernel_stat.h
diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile
new file mode 100644
index 0000000000..e6240ea9a4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/Makefile
@@ -0,0 +1,10 @@
+ifeq ($(subdir),signal)
+#sysdep_routines += sigsuspend
+endif
+
+ifeq ($(subdir),misc)
+sysdep_routines += cachectl cacheflush sysmips
+
+headers += regdef.h fpregdef.h sys/asm.h sys/cachectl.h sys/fpregdef.h \
+	   sys/regdef.h sys/sysmips.h
+endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/endian.h b/sysdeps/unix/sysv/linux/mips/bits/endian.h
new file mode 100644
index 0000000000..9f60758f36
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/endian.h
@@ -0,0 +1,12 @@
+/* The MIPS architecture has selectable endianness.
+   Linux/MIPS exists in two both little and big endian flavours and we
+   want to be able to share the installed headerfiles between both,
+   so we define __BYTE_ORDER based on GCC's predefines.  */
+
+#ifdef __MIPSEB__
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#ifdef __MIPSEL__
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
new file mode 100644
index 0000000000..2586140fdc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
@@ -0,0 +1,100 @@
+/* O_*, F_*, FD_* bit values for Linux.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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 _FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+#include <sys/types.h>
+
+
+/* In GNU, read and write are bits (unlike BSD).  */
+#ifdef __USE_GNU
+#define O_READ		O_RDONLY	/* Open for reading.  */
+#define O_WRITE		O_WRONLY	/* Open for writing.  */
+#endif
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+   located on an ext2 file system */
+#define O_ACCMODE	0x0003
+#define O_RDONLY	0x0000
+#define O_WRONLY	0x0001
+#define O_RDWR		0x0002
+#define O_APPEND	0x0008
+#define O_SYNC		0x0010
+#define O_NONBLOCK	0x0080
+#define O_CREAT         0x0100	/* not fcntl */
+#define O_TRUNC		0x0200	/* not fcntl */
+#define O_EXCL		0x0400	/* not fcntl */
+#define O_NOCTTY	0x0800	/* not fcntl */
+#define O_FSYNC		O_SYNC
+#define O_ASYNC		020000
+
+#define O_NDELAY	O_NONBLOCK
+
+#define F_DUPFD		0	/* dup */
+#define F_GETFD		1	/* get f_flags */
+#define F_SETFD		2	/* set f_flags */
+#define F_GETFL		3	/* more flags (cloexec) */
+#define F_SETFL		4
+#define F_GETLK		14
+#define F_SETLK		6
+#define F_SETLKW	7
+
+#define F_SETOWN	24	/*  for sockets. */
+#define F_GETOWN	23	/*  for sockets. */
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK		0
+#define F_WRLCK		1
+#define F_UNLCK		2
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK		4	/* or 3 */
+#define F_SHLCK		8	/* or 4 */
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH		1	/* shared lock */
+#define LOCK_EX		2	/* exclusive lock */
+#define LOCK_NB		4	/* or'd with one of the above to prevent		XXXXXXXXXXXXXXXXXX
+				   blocking */
+#define LOCK_UN		8	/* remove lock */
+
+typedef struct flock {
+	short l_type;
+	short l_whence;
+	__off_t l_start;
+	__off_t l_len;
+	long  l_sysid;			/* XXX */
+	__pid_t l_pid;
+	long  pad[4];			/* XXX */
+} flock_t;
+
+
+/* Define some more compatibility macros to be backward compatible with
+   BSD systems which did not managed to hide these kernel macros.  */
+#ifdef	__USE_BSD
+#define	FAPPEND		O_APPEND
+#define	FFSYNC		O_FSYNC
+#define FASYNC		O_ASYNC
+#define	FNONBLOCK	O_NONBLOCK
+#define	FNDELAY		O_NDELAY
+#endif /* Use BSD.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h b/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h
new file mode 100644
index 0000000000..486022e6d9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h
@@ -0,0 +1,71 @@
+/* Structure types for pre-termios terminal ioctls.  Linux/MIPS version.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*
+ * Never include this file directly; use <sys/ioctl.h> instead.
+ */
+
+#ifndef _BITS_IOCTL_TYPES_H
+#define _BITS_IOCTL_TYPES_H 1
+
+/* Get definition of constants for use with `ioctl'.  */
+#include <asm/ioctls.h>
+
+struct winsize
+  {
+    unsigned short ws_row;
+    unsigned short ws_col;
+    unsigned short ws_xpixel;
+    unsigned short ws_ypixel;
+  };
+
+#define NCC	8
+struct termio
+  {
+    unsigned short c_iflag;		/* input mode flags */
+    unsigned short c_oflag;		/* output mode flags */
+    unsigned short c_cflag;		/* control mode flags */
+    unsigned short c_lflag;		/* local mode flags */
+    char c_line;			/* line discipline */
+    /* Yes, this is really NCCS.  */
+    unsigned char c_cc[32 /* NCCS */]; /* control characters */
+  };
+
+/* modem lines */
+#define TIOCM_LE	0x001		/* line enable */
+#define TIOCM_DTR	0x002		/* data terminal ready */
+#define TIOCM_RTS	0x004		/* request to send */
+#define TIOCM_ST	0x010		/* secondary transmit */
+#define TIOCM_SR	0x020		/* secondary receive */
+#define TIOCM_CTS	0x040		/* clear to send */
+#define TIOCM_CAR	0x100		/* carrier detect */
+#define TIOCM_CD	TIOCM_CAR
+#define TIOCM_RNG	0x200		/* ring */
+#define TIOCM_RI	TIOCM_RNG
+#define TIOCM_DSR	0x400		/* data set ready */
+
+/* line disciplines */
+#define N_TTY		0
+#define N_SLIP		1
+#define N_MOUSE		2
+#define N_PPP		3
+#define N_STRIP		4
+#define N_AX25		5
+
+#endif /* bits/ioctl-types.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/ipc.h b/sysdeps/unix/sysv/linux/mips/bits/ipc.h
new file mode 100644
index 0000000000..c5a3cd0049
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/ipc.h
@@ -0,0 +1,85 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+   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 _SYS_IPC_BUF_H
+
+#define _SYS_IPC_BUF_H	1
+#include <features.h>
+
+#include <sys/types.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'.  */
+#define IPC_CREAT	01000		/* Create key if key does not exist. */
+#define IPC_EXCL	02000		/* Fail if key exists.  */
+#define IPC_NOWAIT	04000		/* Return error on wait.  */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'.  */
+#define IPC_RMID	0		/* Remove identifier.  */
+#define IPC_SET		1		/* Set `ipc_perm' options.  */
+#define IPC_STAT	2		/* Get `ipc_perm' options.  */
+#define IPC_INFO	3		/* See ipcs.  */
+
+
+__BEGIN_DECLS
+
+/* Special key values.  */
+#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
+
+
+/* Data structure used to pass permission information to IPC operations.  */
+struct ipc_perm
+  {
+    __key_t __key;			/* Key.  */
+    long uid;				/* Owner's user ID.  */
+    long gid;				/* Owner's group ID.  */
+    long cuid;				/* Creator's user ID.  */
+    long cgid;				/* Creator's group ID.  */
+    unsigned long mode;			/* Read/write permission.  */
+    unsigned short int __seq;		/* Sequence number.  */
+  };
+
+
+/* Kludge to work around Linux' restriction of only up to five
+   arguments to a system call.  */
+struct ipc_kludge
+  {
+    void *msgp;
+    long int msgtyp;
+  };
+
+/* The actual system call: all functions are multiplexed by this.  */
+extern int __ipc __P ((int __call, int __first, int __second, int __third,
+		       void *__ptr));
+
+/* The codes for the functions to use the multiplexer `__ipc'.  */
+#define IPCOP_semop	 1
+#define IPCOP_semget	 2
+#define IPCOP_semctl	 3
+#define IPCOP_msgsnd	11
+#define IPCOP_msgrcv	12
+#define IPCOP_msgget	13
+#define IPCOP_msgctl	14
+#define IPCOP_shmat	21
+#define IPCOP_shmdt	22
+#define IPCOP_shmget	23
+#define IPCOP_shmctl	24
+
+__END_DECLS
+
+#endif /* bits/ipc_buf.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/shm.h b/sysdeps/unix/sysv/linux/mips/bits/shm.h
new file mode 100644
index 0000000000..9d4b20bb53
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/shm.h
@@ -0,0 +1,92 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+   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 _SYS_SHM_BUF_H
+
+#define _SYS_SHM_BUF_H	1
+#include <features.h>
+
+#include <sys/types.h>
+
+/* Permission flag for shmget.  */
+#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
+#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
+
+/* Flags for `shmat'.  */
+#define SHM_RDONLY	010000		/* attach read-only else read-write */
+#define SHM_RND		020000		/* round attach address to SHMLBA */
+#define SHM_REMAP	040000		/* take-over region on attach */
+
+/* Commands for `shmctl'.  */
+#define SHM_LOCK	11		/* lock segment (root only) */
+#define SHM_UNLOCK	12		/* unlock segment (root only) */
+
+
+__BEGIN_DECLS
+
+/* Data structure describing a set of semaphores.  */
+struct shmid_ds
+{
+  struct ipc_perm shm_perm;		/* operation permission struct */
+  int shm_segsz;			/* size of segment in bytes */
+  __time_t shm_atime;			/* time of last shmat() */
+  __time_t shm_dtime;			/* time of last shmdt() */
+  __time_t shm_ctime;			/* time of last change by shmctl() */
+  long shm_cpid;			/* pid of creator */
+  long shm_lpid;			/* pid of last shmop */
+  unsigned short int shm_nattch;	/* number of current attaches */
+  unsigned short int __shm_npages;	/* size of segment (pages) */
+  unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
+  struct vm_area_struct *__attaches;	/* descriptors for attaches */
+};
+
+#ifdef __USE_MISC
+
+/* ipcs ctl commands */
+#define SHM_STAT 	13
+#define SHM_INFO 	14
+
+/* shm_mode upper byte flags */
+#define	SHM_DEST	01000	/* segment will be destroyed on last detach */
+#define SHM_LOCKED      02000   /* segment will not be swapped */
+
+struct	shminfo
+{
+  int shmmax;
+  int shmmin;
+  int shmmni;
+  int shmseg;
+  int shmall;
+};
+
+struct shm_info
+{
+  int   used_ids;
+  ulong shm_tot;	/* total allocated shm */
+  ulong shm_rss;	/* total resident shm */
+  ulong shm_swp;	/* total swapped shm */
+  ulong swap_attempts;
+  ulong swap_successes;
+};
+
+#endif /* __USE_MISC */
+
+__END_DECLS
+
+#endif /* bits/shm_buf.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigaction.h b/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
new file mode 100644
index 0000000000..66c58cc540
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
@@ -0,0 +1,62 @@
+/* The proper definitions for Linux/MIPS's sigaction.
+   Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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.  */
+
+/* Structure describing the action to be taken when a signal arrives.  */
+struct sigaction
+  {
+    /* Special flags.  */
+    unsigned int sa_flags;
+
+    /* Signal handler.  */
+    __sighandler_t sa_handler;
+
+    /* Additional set of signals to be blocked.  */
+    __sigset_t sa_mask;
+
+    /* The ABI says here are two unused ints following. */
+    /* Restore handler.  */
+    void (*sa_restorer) __P ((void));
+
+#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
+    int sa_resv[1];
+#endif
+  };
+
+/* Bits in `sa_flags'.  */
+#define	SA_NOCLDSTOP 1		/* Don't send SIGCHLD when children stop.  */
+#ifdef __USE_MISC
+#define SA_STACK     0x08000000	/* Use signal stack by using `sa_restorer'.  */
+#define SA_RESTART   0x10000000	/* Don't restart syscall on signal return.  */
+#define SA_INTERRUPT 0x20000000	/* Historical no-op.  */
+#define SA_NODEFER   0x40000000	/* Don't automatically block the signal when
+				   its handler is being executed.  */
+#define SA_RESETHAND 0x80000000	/* Reset to SIG_DFL on entry to handler.  */
+
+/* Some aliases for the SA_ constants.  */
+#define SA_NOMASK	SA_NODEFER
+#define SA_ONESHOT	SA_RESETHAND
+#endif
+
+/* Values for the HOW argument to `sigprocmask'.  */
+#define SIG_NOP		0	/* 0 is unused to catch errors */
+#define	SIG_BLOCK	1	/* Block signals.  */
+#define	SIG_UNBLOCK	2	/* Unblock signals.  */
+#define	SIG_SETMASK	3	/* Set the set of blocked signals.  */
+#define SIG_SETMASK32	256	/* Goodie from SGI for BSD compatibility:
+				   set only the low 32 bit of the sigset.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum.h b/sysdeps/unix/sysv/linux/mips/bits/signum.h
new file mode 100644
index 0000000000..5254a2b420
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/signum.h
@@ -0,0 +1,30 @@
+/* Signal number definitions.  Linux version.
+   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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.  */
+
+#ifdef	_SIGNAL_H
+
+/* Take these architecture specific stuff from the kernel header files.  */
+#define __need_fake_sigfuns
+#define __need_signums
+#include <asm/signal.h>
+
+#endif	/* <signal.h> included.  */
+
+#define __need__nsig
+#include <asm/signal.h>
diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket.h b/sysdeps/unix/sysv/linux/mips/bits/socket.h
new file mode 100644
index 0000000000..15f420fc9c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/socket.h
@@ -0,0 +1,178 @@
+/* System-specific socket constants and types.  Linux version.
+   Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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 _SYS_SOCKET_H
+#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
+
+#include <features.h>
+
+#define	__need_size_t
+#define __need_NULL
+#include <stddef.h>
+
+
+__BEGIN_DECLS
+
+/* Supported address families. */
+#define PF_UNSPEC	0
+#define PF_UNIX		1		/* Unix domain sockets 		*/
+#define PF_LOCAL	1		/* POSIX name for AF_UNIX	*/
+#define PF_FILE		PF_LOCAL	/* POSIX name for PF_LOCAL.	*/
+#define PF_INET		2		/* Internet IP Protocol 	*/
+#define PF_AX25		3		/* Amateur Radio AX.25 		*/
+#define PF_IPX		4		/* Novell IPX 			*/
+#define PF_APPLETALK	5		/* Appletalk DDP 		*/
+#define PF_NETROM	6		/* Amateur Radio NET/ROM 	*/
+#define PF_BRIDGE	7		/* Multiprotocol bridge 	*/
+#define PF_AAL5		8		/* Reserved for Werner's ATM 	*/
+#define PF_X25		9		/* Reserved for X.25 project 	*/
+#define PF_INET6	10		/* IP version 6			*/
+#define PF_ROSE		11		/* Amateur Radio X.25 PLP	*/
+#define PF_DECNET	12		/* Reserved for DECnet project	*/
+#define PF_NETBEUI	13		/* Reserved for 802.2LLC project*/
+#define PF_MAX		32		/* For now.. */
+
+/* Protocol families, same as address families. */
+#define AF_UNSPEC	PF_UNSPEC
+#define AF_UNIX		PF_UNIX
+#define AF_LOCAL	PF_LOCAL
+#define AF_FILE		PF_FILE
+#define AF_INET		PF_INET
+#define AF_AX25		PF_AX25
+#define AF_IPX		PF_IPX
+#define AF_APPLETALK	PF_APPLETALK
+#define	AF_NETROM	PF_NETROM
+#define AF_BRIDGE	PF_BRIDGE
+#define AF_AAL5		PF_AAL5
+#define AF_X25		PF_X25
+#define AF_INET6	PF_INET6
+#define AF_ROSE		PF_ROSE
+#define AF_DECNET	PF_DECNET
+#define AF_NETBEUI	PF_NETBEUI
+
+#define AF_MAX		PF_MAX
+
+/* Raw IP packet level.  */
+#define SOL_RAW		255
+
+/* Maximum queue length specifiable by listen.  */
+#define SOMAXCONN	128
+
+/* Get the definition of the macro to define the common sockaddr members.  */
+#include <bits/sockaddr.h>
+
+/* Structure describing a generic socket address.  */
+struct sockaddr
+  {
+    __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
+    char sa_data[14];		/* Address data.  */
+  };
+
+
+/* Bits in the FLAGS argument to `send', `recv', et al.  */
+enum
+  {
+    MSG_OOB		= 0x01,	/* Process out-of-band data.  */
+    MSG_PEEK		= 0x02,	/* Peek at incoming messages.  */
+    MSG_DONTROUTE	= 0x04,	/* Don't use local routing.  */
+    MSG_CTRUNC		= 0x08,	/* Control data lost before delivery.  */
+    MSG_PROXY		= 0x10	/* Supply or ask second address.  */
+  };
+
+
+/* Structure describing messages sent by
+   `sendmsg' and received by `recvmsg'.  */
+struct msghdr
+  {
+    __ptr_t msg_name;		/* Address to send to/receive from.  */
+    int msg_namelen;		/* Length of address data.  */
+    /* XXX Should be type `size_t' according to POSIX.1g.  */
+
+    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
+    int msg_iovlen;		/* Number of elements in the vector.  */
+    /* XXX Should be type `size_t' according to POSIX.1g.  */
+
+    __ptr_t msg_control;	/* Ancillary data (eg BSD filedesc passing). */
+    int msg_controllen;		/* Ancillary data buffer length.  */
+    /* XXX Should be type `size_t' according to POSIX.1g.  */
+    int msg_flags;		/* Flags on received message.  */
+  };
+
+/* Structure used for storage of ancillary data object information.  */
+struct cmsghdr
+  {
+    int cmsg_len;		/* Length of data in cmsg_data plus length
+				   of cmsghdr structure.  */
+    /* XXX Should be type `size_t' according to POSIX.1g.  */
+    int cmsg_level;		/* Originating protocol.  */
+    int cmsg_type;		/* Protocol specific type.  */
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+    unsigned char __cmsg_data[0]; /* Ancillary data.  */
+#endif
+  };
+
+/* Ancillary data object manipulation macros.  */
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+#else
+# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
+#endif
+#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+#define CMSG_FIRSTHDR(mhdr) \
+  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)			      \
+   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
+
+
+#ifndef _EXTERN_INLINE
+# define _EXTERN_INLINE extern __inline
+#endif
+extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr,
+					   struct cmsghdr *__cmsg));
+_EXTERN_INLINE struct cmsghdr *
+__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
+{
+  unsigned char *__p;
+
+  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+    /* The kernel header does this so there may be a reason.  */
+    return NULL;
+
+  __p = (((unsigned char *) __cmsg)
+	 + ((__cmsg->cmsg_len + sizeof (long int) - 1) & ~sizeof (long int)));
+  if (__p >= (unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)
+    /* No more entries.  */
+    return NULL;
+  return (struct cmsghdr *) __p;
+}
+
+
+/* Get socket manipulation related informations from kernel headers.  */
+#include <asm/socket.h>
+
+
+/* Structure used to manipulate the SO_LINGER option.  */
+struct linger
+  {
+    int l_onoff;		/* Nonzero to linger on close.  */
+    int l_linger;		/* Time to linger.  */
+  };
+
+__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
new file mode 100644
index 0000000000..a797b34c38
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -0,0 +1,97 @@
+/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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.  */
+
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
+
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H	1
+
+/* Versions of the `struct stat' data structure.  */
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX	/* The one defined below.  */
+
+/* Versions of the `xmknod' interface.  */
+#define _MKNOD_VER_LINUX	1
+#define _MKNOD_VER_SVR4		2
+#define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
+
+/* Structure describing file characteristics.  */
+struct stat
+  {
+    unsigned long int st_dev;
+    long int st_pad1[3];
+    __ino_t st_ino;		/* File serial number.		*/
+    __mode_t st_mode;		/* File mode.  */
+    __nlink_t st_nlink;		/* Link count.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    unsigned long int st_rdev;	/* Device number, if device.  */
+    long int st_pad2[2];
+    __off_t st_size;		/* Size of file, in bytes.  */
+    /* SVR4 added this extra long to allow for expansion of off_t.  */
+    long int st_pad3;
+    /*
+     * Actually this should be timestruc_t st_atime, st_mtime and
+     * st_ctime but we don't have it under Linux.
+     */
+    __time_t st_atime;		/* Time of last access.  */
+    long int __reserved0;
+    __time_t st_mtime;		/* Time of last modification.  */
+    long int __reserved1;
+    __time_t st_ctime;		/* Time of last status change.  */
+    long int __reserved2;
+    long int st_blksize;	/* Optimal block size for I/O.  */
+#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
+    long int st_blocks;		/* Number of 512-byte blocks allocated.  */
+    char st_fstype[16];		/* Filesystem type name */
+    long int st_pad4[8];
+    /* Linux specific fields */
+    unsigned int st_flags;
+    unsigned int st_gen;
+  };
+
+
+/* Encoding of the file mode.  */
+
+#define	__S_IFMT	0170000	/* These bits determine file type.  */
+
+/* File types.  */
+#define	__S_IFDIR	0040000	/* Directory.  */
+#define	__S_IFCHR	0020000	/* Character device.  */
+#define	__S_IFBLK	0060000	/* Block device.  */
+#define	__S_IFREG	0100000	/* Regular file.  */
+#define	__S_IFIFO	0010000	/* FIFO.  */
+
+/* These don't actually exist on System V, but having them doesn't hurt.  */
+#define	__S_IFLNK	0120000	/* Symbolic link.  */
+#define	__S_IFSOCK	0140000	/* Socket.  */
+
+/* Protection bits.  */
+
+#define	__S_ISUID	04000	/* Set user ID on execution.  */
+#define	__S_ISGID	02000	/* Set group ID on execution.  */
+#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
+#define	__S_IREAD	0400	/* Read by owner.  */
+#define	__S_IWRITE	0200	/* Write by owner.  */
+#define	__S_IEXEC	0100	/* Execute by owner.  */
+
+#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/statfs.h b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
new file mode 100644
index 0000000000..3b2306147c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
@@ -0,0 +1,44 @@
+/* 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.  */
+
+/*
+ * Never include this file directly; use <sys/statfs.h> instead.
+ */
+
+#ifndef _BITS_STATFS_H
+#define _BITS_STATFS_H
+
+struct statfs
+  {
+    long int f_type;
+#define f_fstyp f_type
+    long int f_bsize;
+    long int f_frsize;	/* Fragment size - unsupported */
+    long int f_blocks;
+    long int f_bfree;
+    long int f_files;
+    long int f_ffree;
+
+	/* Linux specials */
+    long int f_bavail;
+    __fsid_t f_fsid;
+    long int f_namelen;
+    long int f_spare[6];
+  };
+
+#endif	/* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
new file mode 100644
index 0000000000..c8a24694d9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -0,0 +1,260 @@
+/* termios type and macro definitions.  Linux/MIPS version.
+   Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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.  */
+
+/*
+ * Never include this file directly; use <termios.h> instead.
+ */
+
+
+#ifndef _BITS_TERMIOS_H
+#define _BITS_TERMIOS_H 1
+
+typedef unsigned char	cc_t;
+typedef unsigned int	speed_t;
+typedef unsigned int	tcflag_t;
+
+
+#if defined __USE_BSD
+
+struct sgttyb
+  {
+    char sg_ispeed;
+    char sg_ospeed;
+    char sg_erase;
+    char sg_kill;
+    int	sg_flags;	/* SGI special - int, not short */
+  };
+
+struct tchars
+  {
+    char t_intrc;
+    char t_quitc;
+    char t_startc;
+    char t_stopc;
+    char t_eofc;
+    char t_brkc;
+  };
+
+struct ltchars
+  {
+    char t_suspc;		/* stop process signal */
+    char t_dsuspc;		/* delayed stop process signal */
+    char t_rprntc;		/* reprint line */
+    char t_flushc;		/* flush output (toggles) */
+    char t_werasc;		/* word erase */
+    char t_lnextc;		/* literal next character */
+  };
+
+#endif /* defined(__BSD) */
+
+#define NCCS 32
+struct termios
+  {
+    tcflag_t c_iflag;		/* input mode flags */
+    tcflag_t c_oflag;		/* output mode flags */
+    tcflag_t c_cflag;		/* control mode flags */
+    tcflag_t c_lflag;		/* local mode flags */
+    cc_t c_line;			/* line discipline */
+    cc_t c_cc[NCCS];		/* control characters */
+    speed_t c_ispeed;		/* input speed */
+    speed_t c_ospeed;		/* output speed */
+  };
+
+/* c_cc characters */
+#define VINTR		 0		/* Interrupt character [ISIG].  */
+#define VQUIT		 1		/* Quit character [ISIG].  */
+#define VERASE		 2		/* Erase character [ICANON].  */
+#define VKILL		 3		/* Kill-line character [ICANON].  */
+#define VMIN		 4		/* Minimum number of bytes read at once [!ICANON].  */
+#define VTIME		 5		/* Time-out value (tenths of a second) [!ICANON].  */
+#if defined (__USE_BSD)
+#define VEOL2		 6		/* Second EOL character [ICANON].  */
+/* The next two are guesses ... */
+#define VSWTC		 7		/* ??? */
+#endif
+#define VSWTCH		VSWTC
+#define VSTART		 8		/* Start (X-ON) character [IXON, IXOFF].  */
+#define VSTOP		 9		/* Stop (X-OFF) character [IXON, IXOFF].  */
+#define VSUSP		10		/* Suspend character [ISIG].  */
+#if 0
+/*
+ * VDSUSP is not supported
+ */
+#if defined (__USE_BSD)
+#define VDSUSP		11		/* Delayed suspend character [ISIG].  */
+#endif
+#endif
+#if defined (__USE_BSD)
+#define VREPRINT	12		/* Reprint-line character [ICANON].  */
+#endif
+#if defined (__USE_BSD)
+#define VDISCARD	13		/* Discard character [IEXTEN].  */
+#define VWERASE		14		/* Word-erase character [ICANON].  */
+#define VLNEXT		15		/* Literal-next character [IEXTEN].  */
+#endif
+#define VEOF		16		/* End-of-file character [ICANON].  */
+#define VEOL		17		/* End-of-line character [ICANON].  */
+
+/* c_iflag bits */
+#define IGNBRK	0000001		/* Ignore break condition.  */
+#define BRKINT	0000002		/* Signal interrupt on break.  */
+#define IGNPAR	0000004		/* Ignore characters with parity errors.  */
+#define PARMRK	0000010		/* Mark parity and framing errors.  */
+#define INPCK	0000020		/* Enable input parity check.  */
+#define ISTRIP	0000040		/* Strip 8th bit off characters.  */
+#define INLCR	0000100		/* Map NL to CR on input.  */
+#define IGNCR	0000200		/* Ignore CR.  */
+#define ICRNL	0000400		/* Map CR to NL on input.  */
+#if defined (__USE_BSD)
+#define IUCLC	0001000		/* Map upper case to lower case on input.  */
+#endif
+#define IXON	0002000		/* Enable start/stop output control.  */
+#if defined (__USE_BSD)
+#define IXANY	0004000		/* Any character will restart after stop.  */
+#endif
+#define IXOFF	0010000		/* Enable start/stop input control.  */
+#if defined (__USE_BSD)
+#define IMAXBEL	0020000		/* Ring bell when input queue is full.  */
+#endif
+
+/* c_oflag bits */
+#define OPOST	0000001		/* Perform output processing.  */
+#if defined (__USE_BSD)
+#define OLCUC	0000002		/* Map lower case to upper case on output.  */
+#define ONLCR	0000004		/* Map NL to CR-NL on output.  */
+#define OCRNL	0000010
+#define ONOCR	0000020
+#define ONLRET	0000040
+#define OFILL	0000100
+#define OFDEL	0000200
+#define NLDLY	0000400
+#define   NL0	0000000
+#define   NL1	0000400
+#define CRDLY	0003000
+#define   CR0	0000000
+#define   CR1	0001000
+#define   CR2	0002000
+#define   CR3	0003000
+#define TABDLY	0014000
+#define   TAB0	0000000
+#define   TAB1	0004000
+#define   TAB2	0010000
+#define   TAB3	0014000
+#define   XTABS	0014000
+#define BSDLY	0020000
+#define   BS0	0000000
+#define   BS1	0020000
+#define VTDLY	0040000
+#define   VT0	0000000
+#define   VT1	0040000
+#define FFDLY	0100000
+#define   FF0	0000000
+#define   FF1	0100000
+/*
+#define PAGEOUT ???
+#define WRAP    ???
+ */
+#endif
+
+/* c_cflag bit meaning */
+#define CBAUD	0010017
+#define  B0	0000000		/* hang up */
+#define  B50	0000001
+#define  B75	0000002
+#define  B110	0000003
+#define  B134	0000004
+#define  B150	0000005
+#define  B200	0000006
+#define  B300	0000007
+#define  B600	0000010
+#define  B1200	0000011
+#define  B1800	0000012
+#define  B2400	0000013
+#define  B4800	0000014
+#define  B9600	0000015
+#define  B19200	0000016
+#define  B38400	0000017
+#define EXTA B19200
+#define EXTB B38400
+#define CSIZE	0000060		/* Number of bits per byte (mask).  */
+#define   CS5	0000000		/* 5 bits per byte.  */
+#define   CS6	0000020		/* 6 bits per byte.  */
+#define   CS7	0000040		/* 7 bits per byte.  */
+#define   CS8	0000060		/* 8 bits per byte.  */
+#define CSTOPB	0000100		/* Two stop bits instead of one.  */
+#define CREAD	0000200		/* Enable receiver.  */
+#define PARENB	0000400		/* Parity enable.  */
+#define PARODD	0001000		/* Odd parity instead of even.  */
+#define HUPCL	0002000		/* Hang up on last close.  */
+#define CLOCAL	0004000		/* Ignore modem status lines.  */
+#if defined (__USE_BSD)
+#define CBAUDEX 0010000
+#define  B57600  0010001
+#define  B115200 0010002
+#define  B230400 0010003
+#define  B460800 0010004
+#define CIBAUD	  002003600000	/* input baud rate (not used) */
+#define CRTSCTS	  020000000000		/* flow control */
+#endif
+
+/* c_lflag bits */
+#define ISIG	0000001		/* Enable signals.  */
+#define ICANON	0000002		/* Do erase and kill processing.  */
+#define XCASE	0000004
+#define ECHO	0000010		/* Enable echo.  */
+#define ECHOE	0000020		/* Visual erase for ERASE.  */
+#define ECHOK	0000040		/* Echo NL after KILL.  */
+#define ECHONL	0000100		/* Echo NL even if ECHO is off.  */
+#define NOFLSH	0000200		/* Disable flush after interrupt.  */
+#define IEXTEN	0000400		/* Enable DISCARD and LNEXT.  */
+#if defined (__USE_BSD)
+#define ECHOCTL	0001000		/* Echo control characters as ^X.  */
+#define ECHOPRT	0002000		/* Hardcopy visual erase.  */
+#define ECHOKE	0004000		/* Visual erase for KILL.  */
+#endif
+#define FLUSHO	0020000
+#if defined (__USE_BSD)
+#define PENDIN	0040000		/* Retype pending input (state).  */
+#endif
+#define TOSTOP	0100000		/* Send SIGTTOU for background output.  */
+#define ITOSTOP	TOSTOP
+
+/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+
+/* tcflow() and TCXONC use these */
+#define	TCOOFF		0	/* Suspend output.  */
+#define	TCOON		1	/* Restart suspended output.  */
+#define	TCIOFF		2	/* Send a STOP character.  */
+#define	TCION		3	/* Send a START character.  */
+
+/* tcflush() and TCFLSH use these */
+#define	TCIFLUSH	0	/* Discard data received but not yet read.  */
+#define	TCOFLUSH	1	/* Discard data written but not yet sent.  */
+#define	TCIOFLUSH	2	/* Discard all pending data.  */
+
+/* tcsetattr uses these */
+#define	TCSANOW		0x540e	/* Same as TCSETS; change immediately.  */
+#define	TCSADRAIN	0x540f	/* Same as TCSETSW; change when pending output is written.  */
+#define	TCSAFLUSH	0x5410	/* Same as TCSETSF; flush pending input before changing.  */
+
+#define _IOT_termios /* Hurd ioctl type field.  */ \
+  _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
+
+#endif /* bits/termios.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/time.h b/sysdeps/unix/sysv/linux/mips/bits/time.h
new file mode 100644
index 0000000000..5fcef0fb8c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/time.h
@@ -0,0 +1,54 @@
+/* System-dependent timing definitions.  Linux/MIPS version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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.  */
+
+/*
+ * Never include this file directly; use <time.h> instead.
+ */
+
+#ifdef __need_timeval
+# undef __need_timeval
+# ifndef _STRUCT_TIMEVAL
+#  define _STRUCT_TIMEVAL	1
+/* A time value that is accurate to the nearest
+   microsecond but also has a range of years.  */
+struct timeval
+  {
+    long tv_sec;			/* Seconds.  */
+    long tv_usec;		/* Microseconds.  */
+  };
+# endif	/* struct timeval */
+#endif	/* need timeval */
+
+
+#ifndef _BITS_TIME_H
+#define _BITS_TIME_H	1
+
+/* ISO/IEC 9899:1990 7.12.1: <time.h>
+   The macro `CLOCKS_PER_SEC' is the number per second of the value
+   returned by the `clock' function. */
+/* CAE XSH, Issue 4, Version 2: <time.h>
+   The value of CLOCKS_PER_SEC is required to be 1 million on all
+   XSI-conformant systems. */
+# define CLOCKS_PER_SEC  1000000
+
+/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
+   presents the real value for clock ticks per second for the system.  */
+# define CLK_TCK 100		/* XXX not correct for all systems.  */
+
+#endif  /* bits/time.h */
diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S
new file mode 100644
index 0000000000..357f70e47f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/clone.S
@@ -0,0 +1,125 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ralf Baechle <ralf@gnu.ai.mit.edu>, 1996.
+
+   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.  */
+
+/* clone() is even more special than fork() as it mucks with stacks
+   and invokes a function in the right context after its all over.  */
+
+#include <sys/asm.h>
+#include <asm/unistd.h>
+#include <sysdep.h>
+#define _ERRNO_H	1
+#include <bits/errno.h>
+
+/* int clone(int (*fn)(), void *child_stack, int flags, int nargs, ...) */
+
+#define FRAMESZ  4*SZREG
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+#define MAX_REG_ARGS 4
+#else
+#define MAX_REG_ARGS 6
+#endif
+
+	.text
+NESTED(__clone,4*SZREG,sp)
+#ifdef __PIC__
+	.set		noreorder
+	.cpload		$25
+	.set		reorder
+	.cprestore	16
+#endif
+	PTR_SUBIU	sp,FRAMESZ
+#ifdef PROF
+	.set		noat
+	move		$1,ra
+	jal		_mcount
+	.set		at
+#endif
+
+	/* Sanity check arguments.  */
+	li		v0,EINVAL
+	beqz		a0,error	/* no NULL function pointers */
+	beqz		a1,error	/* no NULL stack pointers */
+	bltz		a3,error	/* no negative argument counts */
+
+	/* Allocate space on the new stack and copy args over */
+	move		t0,a3		# save nargs for __thread_start
+	PTR_SLL		t1,a3,PTR_SCALESHIFT
+	PTR_ADDU	t1,a3,sp
+1:	REG_L		t2,-SZREG(t1)
+	PTR_SUBIU	t1,SZREG
+	REG_S		t2,-SZREG(a1)
+	PTR_SUBIU	a3,1
+	PTR_SUBIU	a1,SZREG
+	bnez		a3,1b
+
+	/* Do the system call */
+	move		t9,a0		# get fn ptr out of the way
+	move		a0,a2
+	li		v0,__NR_clone
+	syscall
+
+	bnez		a3,error
+	beqz		v0,__thread_start
+
+	/* Successful return from the parent */
+	PTR_ADDIU	sp,FRAMESZ
+	ret
+
+	/* Something bad happened -- no child created */
+error:
+	PTR_ADDIU	sp,FRAMESZ
+#ifdef PIC
+	la		t9,__syscall_error
+	jr		t9
+#else
+	j		__syscall_error
+#endif
+	END(__clone)
+
+/* Load up the arguments to the function.  Put this block of code in
+   its own function so that we can terminate the stack trace with our
+   debug info.
+
+   At this point we have t0=nargs, t9=fn, sp=&arg[0].  */
+
+NESTED(__thread_start,32,sp)
+	/* Stackframe has been created on entry of clone() */
+	/* Calculate address of jump into argument loading code */
+	li		t1,MAX_REG_ARGS
+	slt		t0,t1,t2       /* max MAX_REG_ARGS args in registers */
+	MOVN		(t2,t1,t0)
+	la		v0,arg0
+	PTR_SLL		t1,t0,PTR_SCALESHIFT
+	PTR_SUBU	v0,t1
+	jr		v0
+
+	/* Load the integer register arguments */
+	REG_L		a0,SZREG(sp)
+arg0:
+
+	/* Call the user's function */
+	jalr		t9
+
+	/* Call _exit rather than doing it inline for breakpoint purposes */
+	move		a0,v0
+	jal		_exit
+
+	END(__thread_start)
+
+weak_alias(__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/mips/entry.h b/sysdeps/unix/sysv/linux/mips/entry.h
new file mode 100644
index 0000000000..3db6d93636
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/entry.h
@@ -0,0 +1 @@
+#define ENTRY_POINT __start
diff --git a/sysdeps/unix/sysv/linux/mips/fpregdef.h b/sysdeps/unix/sysv/linux/mips/fpregdef.h
new file mode 100644
index 0000000000..a963d5f588
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/fpregdef.h
@@ -0,0 +1 @@
+#include <sys/fpregdef.h>
diff --git a/sysdeps/unix/sysv/linux/mips/fxstat.c b/sysdeps/unix/sysv/linux/mips/fxstat.c
new file mode 100644
index 0000000000..4a3c486a4a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/fxstat.c
@@ -0,0 +1,80 @@
+/* fxstat using old-style Unix fstat system call.
+   Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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 <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+#include <kernel_stat.h>
+
+extern int __syscall_fstat (int, struct kernel_stat *);
+
+/* Get information about the file descriptor FD in BUF.  */
+int
+__fxstat (int vers, int fd, struct stat *buf)
+{
+  struct kernel_stat kbuf;
+  int result;
+
+  switch (vers)
+    {
+    case _STAT_VER_LINUX_OLD:
+      /* Nothing to do.  The struct is in the form the kernel expects
+	 it to be.  */
+      result = __syscall_fstat (fd, (struct kernel_stat *) buf);
+      break;
+
+    case _STAT_VER_LINUX:
+      /* Do the system call.  */
+      result = __syscall_fstat (fd, &kbuf);
+
+      /* Convert to current kernel version of `struct stat'.  */
+      buf->st_dev = kbuf.st_dev;
+      buf->st_pad1[0]  = 0; buf->st_pad1[1]  = 0; buf->st_pad1[2]  = 0;
+      buf->st_ino = kbuf.st_ino;
+      buf->st_mode = kbuf.st_mode;
+      buf->st_nlink = kbuf.st_nlink;
+      buf->st_uid = kbuf.st_uid;
+      buf->st_gid = kbuf.st_gid;
+      buf->st_rdev = kbuf.st_rdev;
+      buf->st_pad2[0] = 0; buf->st_pad2[1] = 0;
+      buf->st_pad3 = 0;
+      buf->st_size = kbuf.st_size;
+      buf->st_blksize = kbuf.st_blksize;
+      buf->st_blocks = kbuf.st_blocks;
+
+      buf->st_atime = kbuf.st_atime; buf->__reserved0 = 0;
+      buf->st_mtime = kbuf.st_mtime; buf->__reserved1 = 0;
+      buf->st_ctime = kbuf.st_ctime; buf->__reserved2 = 0;
+
+      buf->st_pad4[0] = 0; buf->st_pad4[1] = 0;
+      buf->st_pad4[2] = 0; buf->st_pad4[3] = 0;
+      buf->st_pad4[4] = 0; buf->st_pad4[5] = 0;
+      buf->st_pad4[6] = 0; buf->st_pad4[7] = 0;
+      break;
+
+    default:
+      __set_errno (EINVAL);
+      result = -1;
+      break;
+    }
+
+  return result;
+}
+weak_alias (__fxstat, _fxstat)
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h b/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h
new file mode 100644
index 0000000000..bb7fe6bece
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h
@@ -0,0 +1,22 @@
+/* This is the sigaction structure from the Linux 2.1.24 kernel.  */
+
+#include <sgidefs.h>
+
+#define HAVE_SA_RESTORER
+
+struct kernel_sigaction {
+	unsigned int	sa_flags;
+	__sighandler_t	sa_handler;
+	unsigned long	sa_mask;
+	unsigned int    __pad0[3]; /* reserved, keep size constant */
+
+	/* Abi says here follows reserved int[2] */
+	void		(*sa_restorer)(void);
+#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
+	/*
+	 * For 32 bit code we have to pad struct sigaction to get
+	 * constant size for the ABI
+	 */
+	int		pad1[1]; /* reserved */
+#endif
+};
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h
new file mode 100644
index 0000000000..c6419baf37
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/kernel_stat.h
@@ -0,0 +1,28 @@
+/* Definition of `struct stat' used in the kernel..  */
+struct kernel_stat
+  {
+    unsigned long int st_dev;
+    long int __pad1[3];			/* Reserved for network id */
+    unsigned long int st_ino;
+    unsigned long int st_mode;
+    unsigned long int st_nlink;
+    long int st_uid;
+    long int st_gid;
+    unsigned long int st_rdev;
+    long int __pad2[2];
+    long int st_size;
+    long int __pad3;
+    unsigned int st_atime;
+    unsigned int __unused1;
+    unsigned int st_mtime;
+    unsigned int __unused2;
+    unsigned int st_ctime;
+    unsigned int __unused3;
+    long int st_blksize;
+    long int st_blocks;
+    char st_fstype[16];			/* Filesystem type name, unsupported */
+    long st_pad4[8];
+    /* Linux specific fields */
+    unsigned int st_flags;
+    unsigned int st_gen;
+  };
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_termios.h b/sysdeps/unix/sysv/linux/mips/kernel_termios.h
new file mode 100644
index 0000000000..35be1bb290
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/kernel_termios.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_KERNEL_TERMIOS_H
+#define _SYS_KERNEL_TERMIOS_H 1
+/* The following corresponds to the values from the Linux 2.1.24 kernel.  */
+
+/* We need the definition of tcflag_t, cc_t, and speed_t.  */
+#include <bits/termios.h>
+
+#define __KERNEL_NCCS 23
+
+struct __kernel_termios
+  {
+    tcflag_t c_iflag;		/* input mode flags */
+    tcflag_t c_oflag;		/* output mode flags */
+    tcflag_t c_cflag;		/* control mode flags */
+    tcflag_t c_lflag;		/* local mode flags */
+    cc_t c_line;		/* line discipline */
+    cc_t c_cc[__KERNEL_NCCS];	/* control characters */
+  };
+
+#endif /* kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.h b/sysdeps/unix/sysv/linux/mips/lxstat.h
new file mode 100644
index 0000000000..7907b2f2d2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/lxstat.h
@@ -0,0 +1,80 @@
+/* lxstat using old-style Unix lstat system call.
+   Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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 <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+#include <kernel_stat.h>
+
+extern int __syscall_lstat (const char *, struct kernel_stat *);
+
+/* Get information about the file NAME in BUF.  */
+int
+__lxstat (int vers, const char *name, struct stat *buf)
+{
+  struct kernel_stat kbuf;
+  int result;
+
+  switch (vers)
+    {
+    case _STAT_VER_LINUX_OLD:
+      /* Nothing to do.  The struct is in the form the kernel expects
+	 it to be.  */
+      result = __syscall_lstat (name, (struct kernel_stat *) buf);
+      break;
+
+    case _STAT_VER_LINUX:
+      /* Do the system call.  */
+      result = __syscall_lstat (name, &kbuf);
+
+      /* Convert to current kernel version of `struct stat'.  */
+      buf->st_dev = kbuf.st_dev;
+      buf->st_pad1[0]  = 0; buf->st_pad1[1]  = 0; buf->st_pad1[2]  = 0;
+      buf->st_ino = kbuf.st_ino;
+      buf->st_mode = kbuf.st_mode;
+      buf->st_nlink = kbuf.st_nlink;
+      buf->st_uid = kbuf.st_uid;
+      buf->st_gid = kbuf.st_gid;
+      buf->st_rdev = kbuf.st_rdev;
+      buf->st_pad2[0] = 0; buf->st_pad2[1] = 0;
+      buf->st_pad3 = 0;
+      buf->st_size = kbuf.st_size;
+      buf->st_blksize = kbuf.st_blksize;
+      buf->st_blocks = kbuf.st_blocks;
+
+      buf->st_atime = kbuf.st_atime; buf->__reserved0 = 0;
+      buf->st_mtime = kbuf.st_mtime; buf->__reserved1 = 0;
+      buf->st_ctime = kbuf.st_ctime; buf->__reserved2 = 0;
+
+      buf->st_pad4[0] = 0; buf->st_pad4[1] = 0;
+      buf->st_pad4[2] = 0; buf->st_pad4[3] = 0;
+      buf->st_pad4[4] = 0; buf->st_pad4[5] = 0;
+      buf->st_pad4[6] = 0; buf->st_pad4[7] = 0;
+      break;
+
+    default:
+      __set_errno (EINVAL);
+      result = -1;
+      break;
+    }
+
+  return result;
+}
+weak_alias (__lxstat, _lxstat)
diff --git a/sysdeps/unix/sysv/linux/mips/regdef.h b/sysdeps/unix/sysv/linux/mips/regdef.h
new file mode 100644
index 0000000000..b613c8b250
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/regdef.h
@@ -0,0 +1 @@
+#include <sys/regdef.h>
diff --git a/sysdeps/unix/sysv/linux/mips/sgidef.h b/sysdeps/unix/sysv/linux/mips/sgidef.h
new file mode 100644
index 0000000000..a36ece0175
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/sgidef.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ralf Baechle <ralf@gnu.ai.mit.edu>.
+
+   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 _SGIDEFS_H
+#define _SGIDEFS_H	1
+
+/*
+ * The real definitions come from the Linux kernel sources
+ */
+#include <asm/sgidefs.h>
+
+#endif /* sgidefs.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/acct.h b/sysdeps/unix/sysv/linux/mips/sys/acct.h
new file mode 100644
index 0000000000..ee596db82b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/sys/acct.h
@@ -0,0 +1,66 @@
+/* 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 _SYS_ACCT_H
+
+#define _SYS_ACCT_H	1
+#include <features.h>
+
+#define	__need_time_t
+#include <time.h>
+
+
+__BEGIN_DECLS
+
+#define ACCT_COMM 16
+
+struct acct
+  {
+    char ac_comm[ACCT_COMM];		/* Accounting command name.  */
+    time_t ac_utime;			/* Accounting user time.  */
+    time_t ac_stime;			/* Accounting system time.  */
+    time_t ac_etime;			/* Accounting elapsed time.  */
+    time_t ac_btime;			/* Beginning time.  */
+    long ac_uid;			/* Accounting user ID.  */
+    long ac_gid;			/* Accounting group ID.  */
+    unsigned long int ac_tty;		/* Controlling tty.  */
+    /* Please note that the value of the `ac_tty' field, a device number,
+       is encoded differently in the kernel and for the libc dev_t type.  */
+    char ac_flag;			/* Accounting flag.  */
+    long int ac_minflt;			/* Accounting minor pagefaults.  */
+    long int ac_majflt;			/* Accounting major pagefaults.  */
+    long int ac_exitcode;		/* Accounting process exitcode.  */
+  };
+
+enum
+  {
+    AFORK = 0001,		/* Has executed fork, but no exec.  */
+    ASU = 0002,			/* Used super-user privileges.  */
+    ACORE = 0004,		/* Dumped core.  */
+    AXSIG = 0010		/* Killed by a signal.  */
+  };
+
+#define AHZ     100
+
+
+/* Switch process accounting on and off.  */
+extern int acct __P ((__const char *__filename));
+
+__END_DECLS
+
+#endif	/* sys/acct.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/asm.h b/sysdeps/unix/sysv/linux/mips/sys/asm.h
new file mode 100644
index 0000000000..346a9c4ec2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/sys/asm.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ralf Baechle <ralf@gnu.ai.mit.edu>.
+
+   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 _SYS_ASM_H
+#define _SYS_ASM_H
+
+/*
+ * The real definitions come from the Linux kernel sources
+ */
+#include <asm/asm.h>
+
+#endif /* sys/asm.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/cachectl.h b/sysdeps/unix/sysv/linux/mips/sys/cachectl.h
new file mode 100644
index 0000000000..740c24d6a8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/sys/cachectl.h
@@ -0,0 +1,42 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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 _SYS_CACHECTL_H
+#define _SYS_CACHECTL_H 1
+
+#include <features.h>
+
+/*
+ * Get the kernel definition for the op bits.
+ */
+#include <asm/cachectl.h>
+
+__BEGIN_DECLS
+
+#ifdef __USE_MISC
+extern int cachectl __P ((void *addr, __const int nbytes, __const int op));
+#endif
+extern int __cachectl __P ((void *addr, __const int nbytes, __const int op));
+#ifdef __USE_MISC
+extern int cacheflush __P ((void *addr, __const int nbytes, __const int op));
+#endif
+extern int _flush_cache __P ((char *addr, __const int nbytes, __const int op));
+
+__END_DECLS
+
+#endif /* sys/cachectl.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/fpregdef.h b/sysdeps/unix/sysv/linux/mips/sys/fpregdef.h
new file mode 100644
index 0000000000..48d8f7513e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/sys/fpregdef.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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 _SYS_FPREGDEF_H
+#define _SYS_FPREGDEF_H
+
+/*
+ * The real definitions come from the Linux kernel sources
+ */
+#include <asm/fpregdef.h>
+
+#endif /* sys/fpregdef.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/procfs.h b/sysdeps/unix/sysv/linux/mips/sys/procfs.h
new file mode 100644
index 0000000000..d740954a8d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/sys/procfs.h
@@ -0,0 +1,109 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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 _SYS_PROCFS_H
+
+#define _SYS_PROCFS_H	1
+#include <features.h>
+
+/* This is somehow modelled after the file of the same name on SysVr4
+   systems.  It provides a definition of the core file format for ELF
+   used on Linux.  */
+
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <asm/user.h>
+#include <asm/elf.h>
+
+__BEGIN_DECLS
+
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+typedef elf_greg_t greg_t;
+typedef elf_gregset_t gregset_t;
+typedef elf_fpregset_t fpregset_t;
+#define NGREG ELF_NGREG
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   gdb doesn't really use excluded.  Fields present but not used are
+   marked with "XXX".  */
+struct elf_prstatus
+  {
+#if 0
+    long int pr_flags;			/* XXX Process flags.  */
+    short int pr_why;			/* XXX Reason for process halt.  */
+    short int pr_what;			/* XXX More detailed reason.  */
+#endif
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+#if 0
+    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    struct sigaction pr_action;		/* Signal action for current sig.  */
+#endif
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+#if 0
+    long int pr_instr;			/* Current instruction.  */
+#endif
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    long pr_uid;
+    long pr_gid;
+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/regdef.h b/sysdeps/unix/sysv/linux/mips/sys/regdef.h
new file mode 100644
index 0000000000..700fd66f0b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/sys/regdef.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ralf Baechle <ralf@gnu.ai.mit.edu>.
+
+   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 _REGDEF_H
+#define _REGDEF_H	1
+
+/*
+ * The real definitions come from the Linux kernel sources
+ */
+#include <asm/regdef.h>
+#include <asm/fpregdef.h>
+
+#endif /* regdef.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/syscall.h b/sysdeps/unix/sysv/linux/mips/sys/syscall.h
new file mode 100644
index 0000000000..82f8427aa0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/sys/syscall.h
@@ -0,0 +1,1187 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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	_SYSCALL_H
+#define	_SYSCALL_H	1
+
+/* This file should list the numbers of the system the system knows.
+   But instead of duplicating this we use the information available
+   from the kernel sources.  */
+#include <asm/unistd.h>
+
+/*
+ * SVR4 syscalls are in the range from 1 to 999
+ */
+#define SYS_SVR4			0
+#define SYS_SVR4_syscall		(SYS_SVR4 +   0)
+#define SYS_SVR4_exit			(SYS_SVR4 +   1)
+#define SYS_SVR4_fork			(SYS_SVR4 +   2)
+#define SYS_SVR4_read			(SYS_SVR4 +   3)
+#define SYS_SVR4_write			(SYS_SVR4 +   4)
+#define SYS_SVR4_open			(SYS_SVR4 +   5)
+#define SYS_SVR4_close			(SYS_SVR4 +   6)
+#define SYS_SVR4_wait			(SYS_SVR4 +   7)
+#define SYS_SVR4_creat			(SYS_SVR4 +   8)
+#define SYS_SVR4_link			(SYS_SVR4 +   9)
+#define SYS_SVR4_unlink			(SYS_SVR4 +  10)
+#define SYS_SVR4_exec			(SYS_SVR4 +  11)
+#define SYS_SVR4_chdir			(SYS_SVR4 +  12)
+#define SYS_SVR4_gtime			(SYS_SVR4 +  13)
+#define SYS_SVR4_mknod			(SYS_SVR4 +  14)
+#define SYS_SVR4_chmod			(SYS_SVR4 +  15)
+#define SYS_SVR4_chown			(SYS_SVR4 +  16)
+#define SYS_SVR4_sbreak			(SYS_SVR4 +  17)
+#define SYS_SVR4_stat			(SYS_SVR4 +  18)
+#define SYS_SVR4_lseek			(SYS_SVR4 +  19)
+#define SYS_SVR4_getpid			(SYS_SVR4 +  20)
+#define SYS_SVR4_mount			(SYS_SVR4 +  21)
+#define SYS_SVR4_umount			(SYS_SVR4 +  22)
+#define SYS_SVR4_setuid			(SYS_SVR4 +  23)
+#define SYS_SVR4_getuid			(SYS_SVR4 +  24)
+#define SYS_SVR4_stime			(SYS_SVR4 +  25)
+#define SYS_SVR4_ptrace			(SYS_SVR4 +  26)
+#define SYS_SVR4_alarm			(SYS_SVR4 +  27)
+#define SYS_SVR4_fstat			(SYS_SVR4 +  28)
+#define SYS_SVR4_pause			(SYS_SVR4 +  29)
+#define SYS_SVR4_utime			(SYS_SVR4 +  30)
+#define SYS_SVR4_stty			(SYS_SVR4 +  31)
+#define SYS_SVR4_gtty			(SYS_SVR4 +  32)
+#define SYS_SVR4_access			(SYS_SVR4 +  33)
+#define SYS_SVR4_nice			(SYS_SVR4 +  34)
+#define SYS_SVR4_statfs			(SYS_SVR4 +  35)
+#define SYS_SVR4_sync			(SYS_SVR4 +  36)
+#define SYS_SVR4_kill			(SYS_SVR4 +  37)
+#define SYS_SVR4_fstatfs		(SYS_SVR4 +  38)
+#define SYS_SVR4_setpgrp		(SYS_SVR4 +  39)
+#define SYS_SVR4_cxenix			(SYS_SVR4 +  40)
+#define SYS_SVR4_dup			(SYS_SVR4 +  41)
+#define SYS_SVR4_pipe			(SYS_SVR4 +  42)
+#define SYS_SVR4_times			(SYS_SVR4 +  43)
+#define SYS_SVR4_profil			(SYS_SVR4 +  44)
+#define SYS_SVR4_plock			(SYS_SVR4 +  45)
+#define SYS_SVR4_setgid			(SYS_SVR4 +  46)
+#define SYS_SVR4_getgid			(SYS_SVR4 +  47)
+#define SYS_SVR4_sig			(SYS_SVR4 +  48)
+#define SYS_SVR4_msgsys			(SYS_SVR4 +  49)
+#define SYS_SVR4_sysmips		(SYS_SVR4 +  50)
+#define SYS_SVR4_sysacct		(SYS_SVR4 +  51)
+#define SYS_SVR4_shmsys			(SYS_SVR4 +  52)
+#define SYS_SVR4_semsys			(SYS_SVR4 +  53)
+#define SYS_SVR4_ioctl			(SYS_SVR4 +  54)
+#define SYS_SVR4_uadmin			(SYS_SVR4 +  55)
+#define SYS_SVR4_exch 			(SYS_SVR4 +  56)
+#define SYS_SVR4_utssys			(SYS_SVR4 +  57)
+#define SYS_SVR4_fsync			(SYS_SVR4 +  58)
+#define SYS_SVR4_exece			(SYS_SVR4 +  59)
+#define SYS_SVR4_umask			(SYS_SVR4 +  60)
+#define SYS_SVR4_chroot			(SYS_SVR4 +  61)
+#define SYS_SVR4_fcntl			(SYS_SVR4 +  62)
+#define SYS_SVR4_ulimit			(SYS_SVR4 +  63)
+#define SYS_SVR4_reserved1		(SYS_SVR4 +  64)
+#define SYS_SVR4_reserved2		(SYS_SVR4 +  65)
+#define SYS_SVR4_reserved3		(SYS_SVR4 +  66)
+#define SYS_SVR4_reserved4		(SYS_SVR4 +  67)
+#define SYS_SVR4_reserved5		(SYS_SVR4 +  68)
+#define SYS_SVR4_reserved6		(SYS_SVR4 +  69)
+#define SYS_SVR4_advfs			(SYS_SVR4 +  70)
+#define SYS_SVR4_unadvfs		(SYS_SVR4 +  71)
+#define SYS_SVR4_unused1		(SYS_SVR4 +  72)
+#define SYS_SVR4_unused2		(SYS_SVR4 +  73)
+#define SYS_SVR4_rfstart		(SYS_SVR4 +  74)
+#define SYS_SVR4_unused3		(SYS_SVR4 +  75)
+#define SYS_SVR4_rdebug			(SYS_SVR4 +  76)
+#define SYS_SVR4_rfstop			(SYS_SVR4 +  77)
+#define SYS_SVR4_rfsys			(SYS_SVR4 +  78)
+#define SYS_SVR4_rmdir			(SYS_SVR4 +  79)
+#define SYS_SVR4_mkdir			(SYS_SVR4 +  80)
+#define SYS_SVR4_getdents		(SYS_SVR4 +  81)
+#define SYS_SVR4_libattach		(SYS_SVR4 +  82)
+#define SYS_SVR4_libdetach		(SYS_SVR4 +  83)
+#define SYS_SVR4_sysfs			(SYS_SVR4 +  84)
+#define SYS_SVR4_getmsg			(SYS_SVR4 +  85)
+#define SYS_SVR4_putmsg			(SYS_SVR4 +  86)
+#define SYS_SVR4_poll			(SYS_SVR4 +  87)
+#define SYS_SVR4_lstat			(SYS_SVR4 +  88)
+#define SYS_SVR4_symlink		(SYS_SVR4 +  89)
+#define SYS_SVR4_readlink		(SYS_SVR4 +  90)
+#define SYS_SVR4_setgroups		(SYS_SVR4 +  91)
+#define SYS_SVR4_getgroups		(SYS_SVR4 +  92)
+#define SYS_SVR4_fchmod			(SYS_SVR4 +  93)
+#define SYS_SVR4_fchown			(SYS_SVR4 +  94)
+#define SYS_SVR4_sigprocmask		(SYS_SVR4 +  95)
+#define SYS_SVR4_sigsuspend		(SYS_SVR4 +  96)
+#define SYS_SVR4_sigaltstack		(SYS_SVR4 +  97)
+#define SYS_SVR4_sigaction		(SYS_SVR4 +  98)
+#define SYS_SVR4_sigpending		(SYS_SVR4 +  99)
+#define SYS_SVR4_setcontext		(SYS_SVR4 + 100)
+#define SYS_SVR4_evsys			(SYS_SVR4 + 101)
+#define SYS_SVR4_evtrapret		(SYS_SVR4 + 102)
+#define SYS_SVR4_statvfs		(SYS_SVR4 + 103)
+#define SYS_SVR4_fstatvfs		(SYS_SVR4 + 104)
+#define SYS_SVR4_reserved7		(SYS_SVR4 + 105)
+#define SYS_SVR4_nfssys			(SYS_SVR4 + 106)
+#define SYS_SVR4_waitid			(SYS_SVR4 + 107)
+#define SYS_SVR4_sigsendset		(SYS_SVR4 + 108)
+#define SYS_SVR4_hrtsys			(SYS_SVR4 + 109)
+#define SYS_SVR4_acancel		(SYS_SVR4 + 110)
+#define SYS_SVR4_async			(SYS_SVR4 + 111)
+#define SYS_SVR4_priocntlset		(SYS_SVR4 + 112)
+#define SYS_SVR4_pathconf		(SYS_SVR4 + 113)
+#define SYS_SVR4_mincore		(SYS_SVR4 + 114)
+#define SYS_SVR4_mmap			(SYS_SVR4 + 115)
+#define SYS_SVR4_mprotect		(SYS_SVR4 + 116)
+#define SYS_SVR4_munmap			(SYS_SVR4 + 117)
+#define SYS_SVR4_fpathconf		(SYS_SVR4 + 118)
+#define SYS_SVR4_vfork			(SYS_SVR4 + 119)
+#define SYS_SVR4_fchdir			(SYS_SVR4 + 120)
+#define SYS_SVR4_readv			(SYS_SVR4 + 121)
+#define SYS_SVR4_writev			(SYS_SVR4 + 122)
+#define SYS_SVR4_xstat			(SYS_SVR4 + 123)
+#define SYS_SVR4_lxstat			(SYS_SVR4 + 124)
+#define SYS_SVR4_fxstat			(SYS_SVR4 + 125)
+#define SYS_SVR4_xmknod			(SYS_SVR4 + 126)
+#define SYS_SVR4_clocal			(SYS_SVR4 + 127)
+#define SYS_SVR4_setrlimit		(SYS_SVR4 + 128)
+#define SYS_SVR4_getrlimit		(SYS_SVR4 + 129)
+#define SYS_SVR4_lchown			(SYS_SVR4 + 130)
+#define SYS_SVR4_memcntl		(SYS_SVR4 + 131)
+#define SYS_SVR4_getpmsg		(SYS_SVR4 + 132)
+#define SYS_SVR4_putpmsg		(SYS_SVR4 + 133)
+#define SYS_SVR4_rename			(SYS_SVR4 + 134)
+#define SYS_SVR4_nuname			(SYS_SVR4 + 135)
+#define SYS_SVR4_setegid		(SYS_SVR4 + 136)
+#define SYS_SVR4_sysconf		(SYS_SVR4 + 137)
+#define SYS_SVR4_adjtime		(SYS_SVR4 + 138)
+#define SYS_SVR4_sysinfo		(SYS_SVR4 + 139)
+#define SYS_SVR4_reserved8		(SYS_SVR4 + 140)
+#define SYS_SVR4_seteuid		(SYS_SVR4 + 141)
+#define SYS_SVR4_PYRAMID_statis		(SYS_SVR4 + 142)
+#define SYS_SVR4_PYRAMID_tuning		(SYS_SVR4 + 143)
+#define SYS_SVR4_PYRAMID_forcerr	(SYS_SVR4 + 144)
+#define SYS_SVR4_PYRAMID_mpcntl		(SYS_SVR4 + 145)
+#define SYS_SVR4_reserved9		(SYS_SVR4 + 146)
+#define SYS_SVR4_reserved10		(SYS_SVR4 + 147)
+#define SYS_SVR4_reserved11		(SYS_SVR4 + 148)
+#define SYS_SVR4_reserved12		(SYS_SVR4 + 149)
+#define SYS_SVR4_reserved13		(SYS_SVR4 + 150)
+#define SYS_SVR4_reserved14		(SYS_SVR4 + 151)
+#define SYS_SVR4_reserved15		(SYS_SVR4 + 152)
+#define SYS_SVR4_reserved16		(SYS_SVR4 + 153)
+#define SYS_SVR4_reserved17		(SYS_SVR4 + 154)
+#define SYS_SVR4_reserved18		(SYS_SVR4 + 155)
+#define SYS_SVR4_reserved19		(SYS_SVR4 + 156)
+#define SYS_SVR4_reserved20		(SYS_SVR4 + 157)
+#define SYS_SVR4_reserved21		(SYS_SVR4 + 158)
+#define SYS_SVR4_reserved22		(SYS_SVR4 + 159)
+#define SYS_SVR4_reserved23		(SYS_SVR4 + 160)
+#define SYS_SVR4_reserved24		(SYS_SVR4 + 161)
+#define SYS_SVR4_reserved25		(SYS_SVR4 + 162)
+#define SYS_SVR4_reserved26		(SYS_SVR4 + 163)
+#define SYS_SVR4_reserved27		(SYS_SVR4 + 164)
+#define SYS_SVR4_reserved28		(SYS_SVR4 + 165)
+#define SYS_SVR4_reserved29		(SYS_SVR4 + 166)
+#define SYS_SVR4_reserved30		(SYS_SVR4 + 167)
+#define SYS_SVR4_reserved31		(SYS_SVR4 + 168)
+#define SYS_SVR4_reserved32		(SYS_SVR4 + 169)
+#define SYS_SVR4_reserved33		(SYS_SVR4 + 170)
+#define SYS_SVR4_reserved34		(SYS_SVR4 + 171)
+#define SYS_SVR4_reserved35		(SYS_SVR4 + 172)
+#define SYS_SVR4_reserved36		(SYS_SVR4 + 173)
+#define SYS_SVR4_reserved37		(SYS_SVR4 + 174)
+#define SYS_SVR4_reserved38		(SYS_SVR4 + 175)
+#define SYS_SVR4_reserved39		(SYS_SVR4 + 176)
+#define SYS_SVR4_reserved40		(SYS_SVR4 + 177)
+#define SYS_SVR4_reserved41		(SYS_SVR4 + 178)
+#define SYS_SVR4_reserved42		(SYS_SVR4 + 179)
+#define SYS_SVR4_reserved43		(SYS_SVR4 + 180)
+#define SYS_SVR4_reserved44		(SYS_SVR4 + 181)
+#define SYS_SVR4_reserved45		(SYS_SVR4 + 182)
+#define SYS_SVR4_reserved46		(SYS_SVR4 + 183)
+#define SYS_SVR4_reserved47		(SYS_SVR4 + 184)
+#define SYS_SVR4_reserved48		(SYS_SVR4 + 185)
+#define SYS_SVR4_reserved49		(SYS_SVR4 + 186)
+#define SYS_SVR4_reserved50		(SYS_SVR4 + 187)
+#define SYS_SVR4_reserved51		(SYS_SVR4 + 188)
+#define SYS_SVR4_reserved52		(SYS_SVR4 + 189)
+#define SYS_SVR4_reserved53		(SYS_SVR4 + 190)
+#define SYS_SVR4_reserved54		(SYS_SVR4 + 191)
+#define SYS_SVR4_reserved55		(SYS_SVR4 + 192)
+#define SYS_SVR4_reserved56		(SYS_SVR4 + 193)
+#define SYS_SVR4_reserved57		(SYS_SVR4 + 194)
+#define SYS_SVR4_reserved58		(SYS_SVR4 + 195)
+#define SYS_SVR4_reserved59		(SYS_SVR4 + 196)
+#define SYS_SVR4_reserved60		(SYS_SVR4 + 197)
+#define SYS_SVR4_reserved61		(SYS_SVR4 + 198)
+#define SYS_SVR4_reserved62		(SYS_SVR4 + 199)
+#define SYS_SVR4_reserved63		(SYS_SVR4 + 200)
+#define SYS_SVR4_aread			(SYS_SVR4 + 201)
+#define SYS_SVR4_awrite			(SYS_SVR4 + 202)
+#define SYS_SVR4_listio			(SYS_SVR4 + 203)
+#define SYS_SVR4_mips_acancel		(SYS_SVR4 + 204)
+#define SYS_SVR4_astatus		(SYS_SVR4 + 205)
+#define SYS_SVR4_await			(SYS_SVR4 + 206)
+#define SYS_SVR4_areadv			(SYS_SVR4 + 207)
+#define SYS_SVR4_awritev		(SYS_SVR4 + 208)
+#define SYS_SVR4_MIPS_reserved1		(SYS_SVR4 + 209)
+#define SYS_SVR4_MIPS_reserved2		(SYS_SVR4 + 210)
+#define SYS_SVR4_MIPS_reserved3		(SYS_SVR4 + 211)
+#define SYS_SVR4_MIPS_reserved4		(SYS_SVR4 + 212)
+#define SYS_SVR4_MIPS_reserved5		(SYS_SVR4 + 213)
+#define SYS_SVR4_MIPS_reserved6		(SYS_SVR4 + 214)
+#define SYS_SVR4_MIPS_reserved7		(SYS_SVR4 + 215)
+#define SYS_SVR4_MIPS_reserved8		(SYS_SVR4 + 216)
+#define SYS_SVR4_MIPS_reserved9		(SYS_SVR4 + 217)
+#define SYS_SVR4_MIPS_reserved10	(SYS_SVR4 + 218)
+#define SYS_SVR4_MIPS_reserved11	(SYS_SVR4 + 219)
+#define SYS_SVR4_MIPS_reserved12	(SYS_SVR4 + 220)
+#define SYS_SVR4_CDC_reserved1		(SYS_SVR4 + 221)
+#define SYS_SVR4_CDC_reserved2		(SYS_SVR4 + 222)
+#define SYS_SVR4_CDC_reserved3		(SYS_SVR4 + 223)
+#define SYS_SVR4_CDC_reserved4		(SYS_SVR4 + 224)
+#define SYS_SVR4_CDC_reserved5		(SYS_SVR4 + 225)
+#define SYS_SVR4_CDC_reserved6		(SYS_SVR4 + 226)
+#define SYS_SVR4_CDC_reserved7		(SYS_SVR4 + 227)
+#define SYS_SVR4_CDC_reserved8		(SYS_SVR4 + 228)
+#define SYS_SVR4_CDC_reserved9		(SYS_SVR4 + 229)
+#define SYS_SVR4_CDC_reserved10		(SYS_SVR4 + 230)
+#define SYS_SVR4_CDC_reserved11		(SYS_SVR4 + 231)
+#define SYS_SVR4_CDC_reserved12		(SYS_SVR4 + 232)
+#define SYS_SVR4_CDC_reserved13		(SYS_SVR4 + 233)
+#define SYS_SVR4_CDC_reserved14		(SYS_SVR4 + 234)
+#define SYS_SVR4_CDC_reserved15		(SYS_SVR4 + 235)
+#define SYS_SVR4_CDC_reserved16		(SYS_SVR4 + 236)
+#define SYS_SVR4_CDC_reserved17		(SYS_SVR4 + 237)
+#define SYS_SVR4_CDC_reserved18		(SYS_SVR4 + 238)
+#define SYS_SVR4_CDC_reserved19		(SYS_SVR4 + 239)
+#define SYS_SVR4_CDC_reserved20		(SYS_SVR4 + 240)
+
+/*
+ * SYS V syscalls are in the range from 1000 to 1999
+ */
+#define SYS_SYSV			1000
+#define SYS_SYSV_syscall		(SYS_SYSV +   0)
+#define SYS_SYSV_exit			(SYS_SYSV +   1)
+#define SYS_SYSV_fork			(SYS_SYSV +   2)
+#define SYS_SYSV_read			(SYS_SYSV +   3)
+#define SYS_SYSV_write			(SYS_SYSV +   4)
+#define SYS_SYSV_open			(SYS_SYSV +   5)
+#define SYS_SYSV_close			(SYS_SYSV +   6)
+#define SYS_SYSV_wait			(SYS_SYSV +   7)
+#define SYS_SYSV_creat			(SYS_SYSV +   8)
+#define SYS_SYSV_link			(SYS_SYSV +   9)
+#define SYS_SYSV_unlink			(SYS_SYSV +  10)
+#define SYS_SYSV_execv			(SYS_SYSV +  11)
+#define SYS_SYSV_chdir			(SYS_SYSV +  12)
+#define SYS_SYSV_time			(SYS_SYSV +  13)
+#define SYS_SYSV_mknod			(SYS_SYSV +  14)
+#define SYS_SYSV_chmod			(SYS_SYSV +  15)
+#define SYS_SYSV_chown			(SYS_SYSV +  16)
+#define SYS_SYSV_brk			(SYS_SYSV +  17)
+#define SYS_SYSV_stat			(SYS_SYSV +  18)
+#define SYS_SYSV_lseek			(SYS_SYSV +  19)
+#define SYS_SYSV_getpid			(SYS_SYSV +  20)
+#define SYS_SYSV_mount			(SYS_SYSV +  21)
+#define SYS_SYSV_umount			(SYS_SYSV +  22)
+#define SYS_SYSV_setuid			(SYS_SYSV +  23)
+#define SYS_SYSV_getuid			(SYS_SYSV +  24)
+#define SYS_SYSV_stime			(SYS_SYSV +  25)
+#define SYS_SYSV_ptrace			(SYS_SYSV +  26)
+#define SYS_SYSV_alarm			(SYS_SYSV +  27)
+#define SYS_SYSV_fstat			(SYS_SYSV +  28)
+#define SYS_SYSV_pause			(SYS_SYSV +  29)
+#define SYS_SYSV_utime			(SYS_SYSV +  30)
+#define SYS_SYSV_stty			(SYS_SYSV +  31)
+#define SYS_SYSV_gtty			(SYS_SYSV +  32)
+#define SYS_SYSV_access			(SYS_SYSV +  33)
+#define SYS_SYSV_nice			(SYS_SYSV +  34)
+#define SYS_SYSV_statfs			(SYS_SYSV +  35)
+#define SYS_SYSV_sync			(SYS_SYSV +  36)
+#define SYS_SYSV_kill			(SYS_SYSV +  37)
+#define SYS_SYSV_fstatfs		(SYS_SYSV +  38)
+#define SYS_SYSV_setpgrp		(SYS_SYSV +  39)
+#define SYS_SYSV_syssgi			(SYS_SYSV +  40)
+#define SYS_SYSV_dup			(SYS_SYSV +  41)
+#define SYS_SYSV_pipe			(SYS_SYSV +  42)
+#define SYS_SYSV_times			(SYS_SYSV +  43)
+#define SYS_SYSV_profil			(SYS_SYSV +  44)
+#define SYS_SYSV_plock			(SYS_SYSV +  45)
+#define SYS_SYSV_setgid			(SYS_SYSV +  46)
+#define SYS_SYSV_getgid			(SYS_SYSV +  47)
+#define SYS_SYSV_sig			(SYS_SYSV +  48)
+#define SYS_SYSV_msgsys			(SYS_SYSV +  49)
+#define SYS_SYSV_sysmips		(SYS_SYSV +  50)
+#define SYS_SYSV_acct			(SYS_SYSV +  51)
+#define SYS_SYSV_shmsys			(SYS_SYSV +  52)
+#define SYS_SYSV_semsys			(SYS_SYSV +  53)
+#define SYS_SYSV_ioctl			(SYS_SYSV +  54)
+#define SYS_SYSV_uadmin			(SYS_SYSV +  55)
+#define SYS_SYSV_sysmp			(SYS_SYSV +  56)
+#define SYS_SYSV_utssys			(SYS_SYSV +  57)
+#define SYS_SYSV_USG_reserved1		(SYS_SYSV +  58)
+#define SYS_SYSV_execve			(SYS_SYSV +  59)
+#define SYS_SYSV_umask			(SYS_SYSV +  60)
+#define SYS_SYSV_chroot			(SYS_SYSV +  61)
+#define SYS_SYSV_fcntl			(SYS_SYSV +  62)
+#define SYS_SYSV_ulimit			(SYS_SYSV +  63)
+#define SYS_SYSV_SAFARI4_reserved1	(SYS_SYSV +  64)
+#define SYS_SYSV_SAFARI4_reserved2	(SYS_SYSV +  65)
+#define SYS_SYSV_SAFARI4_reserved3	(SYS_SYSV +  66)
+#define SYS_SYSV_SAFARI4_reserved4	(SYS_SYSV +  67)
+#define SYS_SYSV_SAFARI4_reserved5	(SYS_SYSV +  68)
+#define SYS_SYSV_SAFARI4_reserved6	(SYS_SYSV +  69)
+#define SYS_SYSV_advfs			(SYS_SYSV +  70)
+#define SYS_SYSV_unadvfs		(SYS_SYSV +  71)
+#define SYS_SYSV_rmount			(SYS_SYSV +  72)
+#define SYS_SYSV_rumount		(SYS_SYSV +  73)
+#define SYS_SYSV_rfstart		(SYS_SYSV +  74)
+#define SYS_SYSV_getrlimit64		(SYS_SYSV +  75)
+#define SYS_SYSV_setrlimit64		(SYS_SYSV +  76)
+#define SYS_SYSV_nanosleep		(SYS_SYSV +  77)
+#define SYS_SYSV_lseek64		(SYS_SYSV +  78)
+#define SYS_SYSV_rmdir			(SYS_SYSV +  79)
+#define SYS_SYSV_mkdir			(SYS_SYSV +  80)
+#define SYS_SYSV_getdents		(SYS_SYSV +  81)
+#define SYS_SYSV_sginap			(SYS_SYSV +  82)
+#define SYS_SYSV_sgikopt		(SYS_SYSV +  83)
+#define SYS_SYSV_sysfs			(SYS_SYSV +  84)
+#define SYS_SYSV_getmsg			(SYS_SYSV +  85)
+#define SYS_SYSV_putmsg			(SYS_SYSV +  86)
+#define SYS_SYSV_poll			(SYS_SYSV +  87)
+#define SYS_SYSV_sigreturn		(SYS_SYSV +  88)
+#define SYS_SYSV_accept			(SYS_SYSV +  89)
+#define SYS_SYSV_bind			(SYS_SYSV +  90)
+#define SYS_SYSV_connect		(SYS_SYSV +  91)
+#define SYS_SYSV_gethostid		(SYS_SYSV +  92)
+#define SYS_SYSV_getpeername		(SYS_SYSV +  93)
+#define SYS_SYSV_getsockname		(SYS_SYSV +  94)
+#define SYS_SYSV_getsockopt		(SYS_SYSV +  95)
+#define SYS_SYSV_listen			(SYS_SYSV +  96)
+#define SYS_SYSV_recv			(SYS_SYSV +  97)
+#define SYS_SYSV_recvfrom		(SYS_SYSV +  98)
+#define SYS_SYSV_recvmsg		(SYS_SYSV +  99)
+#define SYS_SYSV_select			(SYS_SYSV + 100)
+#define SYS_SYSV_send			(SYS_SYSV + 101)
+#define SYS_SYSV_sendmsg		(SYS_SYSV + 102)
+#define SYS_SYSV_sendto			(SYS_SYSV + 103)
+#define SYS_SYSV_sethostid		(SYS_SYSV + 104)
+#define SYS_SYSV_setsockopt		(SYS_SYSV + 105)
+#define SYS_SYSV_shutdown		(SYS_SYSV + 106)
+#define SYS_SYSV_socket			(SYS_SYSV + 107)
+#define SYS_SYSV_gethostname		(SYS_SYSV + 108)
+#define SYS_SYSV_sethostname		(SYS_SYSV + 109)
+#define SYS_SYSV_getdomainname		(SYS_SYSV + 110)
+#define SYS_SYSV_setdomainname		(SYS_SYSV + 111)
+#define SYS_SYSV_truncate		(SYS_SYSV + 112)
+#define SYS_SYSV_ftruncate		(SYS_SYSV + 113)
+#define SYS_SYSV_rename			(SYS_SYSV + 114)
+#define SYS_SYSV_symlink		(SYS_SYSV + 115)
+#define SYS_SYSV_readlink		(SYS_SYSV + 116)
+#define SYS_SYSV_lstat			(SYS_SYSV + 117)
+#define SYS_SYSV_nfsmount		(SYS_SYSV + 118)
+#define SYS_SYSV_nfssvc			(SYS_SYSV + 119)
+#define SYS_SYSV_getfh			(SYS_SYSV + 120)
+#define SYS_SYSV_async_daemon		(SYS_SYSV + 121)
+#define SYS_SYSV_exportfs		(SYS_SYSV + 122)
+#define SYS_SYSV_setregid		(SYS_SYSV + 123)
+#define SYS_SYSV_setreuid		(SYS_SYSV + 124)
+#define SYS_SYSV_getitimer		(SYS_SYSV + 125)
+#define SYS_SYSV_setitimer		(SYS_SYSV + 126)
+#define SYS_SYSV_adjtime		(SYS_SYSV + 127)
+#define SYS_SYSV_BSD_getime		(SYS_SYSV + 128)
+#define SYS_SYSV_sproc			(SYS_SYSV + 129)
+#define SYS_SYSV_prctl			(SYS_SYSV + 130)
+#define SYS_SYSV_procblk		(SYS_SYSV + 131)
+#define SYS_SYSV_sprocsp		(SYS_SYSV + 132)
+#define SYS_SYSV_sgigsc			(SYS_SYSV + 133)
+#define SYS_SYSV_mmap			(SYS_SYSV + 134)
+#define SYS_SYSV_munmap			(SYS_SYSV + 135)
+#define SYS_SYSV_mprotect		(SYS_SYSV + 136)
+#define SYS_SYSV_msync			(SYS_SYSV + 137)
+#define SYS_SYSV_madvise		(SYS_SYSV + 138)
+#define SYS_SYSV_pagelock		(SYS_SYSV + 139)
+#define SYS_SYSV_getpagesize		(SYS_SYSV + 140)
+#define SYS_SYSV_quotactl		(SYS_SYSV + 141)
+#define SYS_SYSV_libdetach		(SYS_SYSV + 142)
+#define SYS_SYSV_BSDgetpgrp		(SYS_SYSV + 143)
+#define SYS_SYSV_BSDsetpgrp		(SYS_SYSV + 144)
+#define SYS_SYSV_vhangup		(SYS_SYSV + 145)
+#define SYS_SYSV_fsync			(SYS_SYSV + 146)
+#define SYS_SYSV_fchdir			(SYS_SYSV + 147)
+#define SYS_SYSV_getrlimit		(SYS_SYSV + 148)
+#define SYS_SYSV_setrlimit		(SYS_SYSV + 149)
+#define SYS_SYSV_cacheflush		(SYS_SYSV + 150)
+#define SYS_SYSV_cachectl		(SYS_SYSV + 151)
+#define SYS_SYSV_fchown			(SYS_SYSV + 152)
+#define SYS_SYSV_fchmod			(SYS_SYSV + 153)
+#define SYS_SYSV_wait3			(SYS_SYSV + 154)
+#define SYS_SYSV_socketpair		(SYS_SYSV + 155)
+#define SYS_SYSV_sysinfo		(SYS_SYSV + 156)
+#define SYS_SYSV_nuname			(SYS_SYSV + 157)
+#define SYS_SYSV_xstat			(SYS_SYSV + 158)
+#define SYS_SYSV_lxstat			(SYS_SYSV + 159)
+#define SYS_SYSV_fxstat			(SYS_SYSV + 160)
+#define SYS_SYSV_xmknod			(SYS_SYSV + 161)
+#define SYS_SYSV_ksigaction		(SYS_SYSV + 162)
+#define SYS_SYSV_sigpending		(SYS_SYSV + 163)
+#define SYS_SYSV_sigprocmask		(SYS_SYSV + 164)
+#define SYS_SYSV_sigsuspend		(SYS_SYSV + 165)
+#define SYS_SYSV_sigpoll		(SYS_SYSV + 166)
+#define SYS_SYSV_swapctl		(SYS_SYSV + 167)
+#define SYS_SYSV_getcontext		(SYS_SYSV + 168)
+#define SYS_SYSV_setcontext		(SYS_SYSV + 169)
+#define SYS_SYSV_waitsys		(SYS_SYSV + 170)
+#define SYS_SYSV_sigstack		(SYS_SYSV + 171)
+#define SYS_SYSV_sigaltstack		(SYS_SYSV + 172)
+#define SYS_SYSV_sigsendset		(SYS_SYSV + 173)
+#define SYS_SYSV_statvfs		(SYS_SYSV + 174)
+#define SYS_SYSV_fstatvfs		(SYS_SYSV + 175)
+#define SYS_SYSV_getpmsg		(SYS_SYSV + 176)
+#define SYS_SYSV_putpmsg		(SYS_SYSV + 177)
+#define SYS_SYSV_lchown			(SYS_SYSV + 178)
+#define SYS_SYSV_priocntl		(SYS_SYSV + 179)
+#define SYS_SYSV_ksigqueue		(SYS_SYSV + 180)
+#define SYS_SYSV_readv			(SYS_SYSV + 181)
+#define SYS_SYSV_writev			(SYS_SYSV + 182)
+#define SYS_SYSV_truncate64		(SYS_SYSV + 183)
+#define SYS_SYSV_ftruncate64		(SYS_SYSV + 184)
+#define SYS_SYSV_mmap64			(SYS_SYSV + 185)
+#define SYS_SYSV_dmi			(SYS_SYSV + 186)
+#define SYS_SYSV_pread			(SYS_SYSV + 187)
+#define SYS_SYSV_pwrite			(SYS_SYSV + 188)
+
+/*
+ * BSD 4.3 syscalls are in the range from 2000 to 2999
+ */
+#define SYS_BSD43			2000
+#define SYS_BSD43_syscall		(SYS_BSD43 +   0)
+#define SYS_BSD43_exit			(SYS_BSD43 +   1)
+#define SYS_BSD43_fork			(SYS_BSD43 +   2)
+#define SYS_BSD43_read			(SYS_BSD43 +   3)
+#define SYS_BSD43_write			(SYS_BSD43 +   4)
+#define SYS_BSD43_open			(SYS_BSD43 +   5)
+#define SYS_BSD43_close			(SYS_BSD43 +   6)
+#define SYS_BSD43_wait			(SYS_BSD43 +   7)
+#define SYS_BSD43_creat			(SYS_BSD43 +   8)
+#define SYS_BSD43_link			(SYS_BSD43 +   9)
+#define SYS_BSD43_unlink		(SYS_BSD43 +  10)
+#define SYS_BSD43_exec			(SYS_BSD43 +  11)
+#define SYS_BSD43_chdir			(SYS_BSD43 +  12)
+#define SYS_BSD43_time			(SYS_BSD43 +  13)
+#define SYS_BSD43_mknod			(SYS_BSD43 +  14)
+#define SYS_BSD43_chmod			(SYS_BSD43 +  15)
+#define SYS_BSD43_chown			(SYS_BSD43 +  16)
+#define SYS_BSD43_sbreak		(SYS_BSD43 +  17)
+#define SYS_BSD43_oldstat		(SYS_BSD43 +  18)
+#define SYS_BSD43_lseek			(SYS_BSD43 +  19)
+#define SYS_BSD43_getpid		(SYS_BSD43 +  20)
+#define SYS_BSD43_oldmount		(SYS_BSD43 +  21)
+#define SYS_BSD43_umount		(SYS_BSD43 +  22)
+#define SYS_BSD43_setuid		(SYS_BSD43 +  23)
+#define SYS_BSD43_getuid		(SYS_BSD43 +  24)
+#define SYS_BSD43_stime			(SYS_BSD43 +  25)
+#define SYS_BSD43_ptrace		(SYS_BSD43 +  26)
+#define SYS_BSD43_alarm			(SYS_BSD43 +  27)
+#define SYS_BSD43_oldfstat		(SYS_BSD43 +  28)
+#define SYS_BSD43_pause			(SYS_BSD43 +  29)
+#define SYS_BSD43_utime			(SYS_BSD43 +  30)
+#define SYS_BSD43_stty			(SYS_BSD43 +  31)
+#define SYS_BSD43_gtty			(SYS_BSD43 +  32)
+#define SYS_BSD43_access		(SYS_BSD43 +  33)
+#define SYS_BSD43_nice			(SYS_BSD43 +  34)
+#define SYS_BSD43_ftime			(SYS_BSD43 +  35)
+#define SYS_BSD43_sync			(SYS_BSD43 +  36)
+#define SYS_BSD43_kill			(SYS_BSD43 +  37)
+#define SYS_BSD43_stat			(SYS_BSD43 +  38)
+#define SYS_BSD43_oldsetpgrp		(SYS_BSD43 +  39)
+#define SYS_BSD43_lstat			(SYS_BSD43 +  40)
+#define SYS_BSD43_dup			(SYS_BSD43 +  41)
+#define SYS_BSD43_pipe			(SYS_BSD43 +  42)
+#define SYS_BSD43_times			(SYS_BSD43 +  43)
+#define SYS_BSD43_profil		(SYS_BSD43 +  44)
+#define SYS_BSD43_msgsys		(SYS_BSD43 +  45)
+#define SYS_BSD43_setgid		(SYS_BSD43 +  46)
+#define SYS_BSD43_getgid		(SYS_BSD43 +  47)
+#define SYS_BSD43_ssig			(SYS_BSD43 +  48)
+#define SYS_BSD43_reserved1		(SYS_BSD43 +  49)
+#define SYS_BSD43_reserved2		(SYS_BSD43 +  50)
+#define SYS_BSD43_sysacct		(SYS_BSD43 +  51)
+#define SYS_BSD43_phys			(SYS_BSD43 +  52)
+#define SYS_BSD43_lock			(SYS_BSD43 +  53)
+#define SYS_BSD43_ioctl			(SYS_BSD43 +  54)
+#define SYS_BSD43_reboot		(SYS_BSD43 +  55)
+#define SYS_BSD43_mpxchan		(SYS_BSD43 +  56)
+#define SYS_BSD43_symlink		(SYS_BSD43 +  57)
+#define SYS_BSD43_readlink		(SYS_BSD43 +  58)
+#define SYS_BSD43_execve		(SYS_BSD43 +  59)
+#define SYS_BSD43_umask			(SYS_BSD43 +  60)
+#define SYS_BSD43_chroot		(SYS_BSD43 +  61)
+#define SYS_BSD43_fstat			(SYS_BSD43 +  62)
+#define SYS_BSD43_reserved3		(SYS_BSD43 +  63)
+#define SYS_BSD43_getpagesize		(SYS_BSD43 +  64)
+#define SYS_BSD43_mremap		(SYS_BSD43 +  65)
+#define SYS_BSD43_vfork			(SYS_BSD43 +  66)
+#define SYS_BSD43_vread			(SYS_BSD43 +  67)
+#define SYS_BSD43_vwrite		(SYS_BSD43 +  68)
+#define SYS_BSD43_sbrk			(SYS_BSD43 +  69)
+#define SYS_BSD43_sstk			(SYS_BSD43 +  70)
+#define SYS_BSD43_mmap			(SYS_BSD43 +  71)
+#define SYS_BSD43_vadvise		(SYS_BSD43 +  72)
+#define SYS_BSD43_munmap		(SYS_BSD43 +  73)
+#define SYS_BSD43_mprotect		(SYS_BSD43 +  74)
+#define SYS_BSD43_madvise		(SYS_BSD43 +  75)
+#define SYS_BSD43_vhangup		(SYS_BSD43 +  76)
+#define SYS_BSD43_vlimit		(SYS_BSD43 +  77)
+#define SYS_BSD43_mincore		(SYS_BSD43 +  78)
+#define SYS_BSD43_getgroups		(SYS_BSD43 +  79)
+#define SYS_BSD43_setgroups		(SYS_BSD43 +  80)
+#define SYS_BSD43_getpgrp		(SYS_BSD43 +  81)
+#define SYS_BSD43_setpgrp		(SYS_BSD43 +  82)
+#define SYS_BSD43_setitimer		(SYS_BSD43 +  83)
+#define SYS_BSD43_wait3			(SYS_BSD43 +  84)
+#define SYS_BSD43_swapon		(SYS_BSD43 +  85)
+#define SYS_BSD43_getitimer		(SYS_BSD43 +  86)
+#define SYS_BSD43_gethostname		(SYS_BSD43 +  87)
+#define SYS_BSD43_sethostname		(SYS_BSD43 +  88)
+#define SYS_BSD43_getdtablesize		(SYS_BSD43 +  89)
+#define SYS_BSD43_dup2			(SYS_BSD43 +  90)
+#define SYS_BSD43_getdopt		(SYS_BSD43 +  91)
+#define SYS_BSD43_fcntl			(SYS_BSD43 +  92)
+#define SYS_BSD43_select		(SYS_BSD43 +  93)
+#define SYS_BSD43_setdopt		(SYS_BSD43 +  94)
+#define SYS_BSD43_fsync			(SYS_BSD43 +  95)
+#define SYS_BSD43_setpriority		(SYS_BSD43 +  96)
+#define SYS_BSD43_socket		(SYS_BSD43 +  97)
+#define SYS_BSD43_connect		(SYS_BSD43 +  98)
+#define SYS_BSD43_oldaccept		(SYS_BSD43 +  99)
+#define SYS_BSD43_getpriority		(SYS_BSD43 + 100)
+#define SYS_BSD43_send			(SYS_BSD43 + 101)
+#define SYS_BSD43_recv			(SYS_BSD43 + 102)
+#define SYS_BSD43_sigreturn		(SYS_BSD43 + 103)
+#define SYS_BSD43_bind			(SYS_BSD43 + 104)
+#define SYS_BSD43_setsockopt		(SYS_BSD43 + 105)
+#define SYS_BSD43_listen		(SYS_BSD43 + 106)
+#define SYS_BSD43_vtimes		(SYS_BSD43 + 107)
+#define SYS_BSD43_sigvec		(SYS_BSD43 + 108)
+#define SYS_BSD43_sigblock		(SYS_BSD43 + 109)
+#define SYS_BSD43_sigsetmask		(SYS_BSD43 + 110)
+#define SYS_BSD43_sigpause		(SYS_BSD43 + 111)
+#define SYS_BSD43_sigstack		(SYS_BSD43 + 112)
+#define SYS_BSD43_oldrecvmsg		(SYS_BSD43 + 113)
+#define SYS_BSD43_oldsendmsg		(SYS_BSD43 + 114)
+#define SYS_BSD43_vtrace		(SYS_BSD43 + 115)
+#define SYS_BSD43_gettimeofday		(SYS_BSD43 + 116)
+#define SYS_BSD43_getrusage		(SYS_BSD43 + 117)
+#define SYS_BSD43_getsockopt		(SYS_BSD43 + 118)
+#define SYS_BSD43_reserved4		(SYS_BSD43 + 119)
+#define SYS_BSD43_readv			(SYS_BSD43 + 120)
+#define SYS_BSD43_writev		(SYS_BSD43 + 121)
+#define SYS_BSD43_settimeofday		(SYS_BSD43 + 122)
+#define SYS_BSD43_fchown		(SYS_BSD43 + 123)
+#define SYS_BSD43_fchmod		(SYS_BSD43 + 124)
+#define SYS_BSD43_oldrecvfrom		(SYS_BSD43 + 125)
+#define SYS_BSD43_setreuid		(SYS_BSD43 + 126)
+#define SYS_BSD43_setregid		(SYS_BSD43 + 127)
+#define SYS_BSD43_rename		(SYS_BSD43 + 128)
+#define SYS_BSD43_truncate		(SYS_BSD43 + 129)
+#define SYS_BSD43_ftruncate		(SYS_BSD43 + 130)
+#define SYS_BSD43_flock			(SYS_BSD43 + 131)
+#define SYS_BSD43_semsys		(SYS_BSD43 + 132)
+#define SYS_BSD43_sendto		(SYS_BSD43 + 133)
+#define SYS_BSD43_shutdown		(SYS_BSD43 + 134)
+#define SYS_BSD43_socketpair		(SYS_BSD43 + 135)
+#define SYS_BSD43_mkdir			(SYS_BSD43 + 136)
+#define SYS_BSD43_rmdir			(SYS_BSD43 + 137)
+#define SYS_BSD43_utimes		(SYS_BSD43 + 138)
+#define SYS_BSD43_sigcleanup		(SYS_BSD43 + 139)
+#define SYS_BSD43_adjtime		(SYS_BSD43 + 140)
+#define SYS_BSD43_oldgetpeername	(SYS_BSD43 + 141)
+#define SYS_BSD43_gethostid		(SYS_BSD43 + 142)
+#define SYS_BSD43_sethostid		(SYS_BSD43 + 143)
+#define SYS_BSD43_getrlimit		(SYS_BSD43 + 144)
+#define SYS_BSD43_setrlimit		(SYS_BSD43 + 145)
+#define SYS_BSD43_killpg		(SYS_BSD43 + 146)
+#define SYS_BSD43_shmsys		(SYS_BSD43 + 147)
+#define SYS_BSD43_quota			(SYS_BSD43 + 148)
+#define SYS_BSD43_qquota		(SYS_BSD43 + 149)
+#define SYS_BSD43_oldgetsockname	(SYS_BSD43 + 150)
+#define SYS_BSD43_sysmips		(SYS_BSD43 + 151)
+#define SYS_BSD43_cacheflush		(SYS_BSD43 + 152)
+#define SYS_BSD43_cachectl		(SYS_BSD43 + 153)
+#define SYS_BSD43_debug			(SYS_BSD43 + 154)
+#define SYS_BSD43_reserved5		(SYS_BSD43 + 155)
+#define SYS_BSD43_reserved6		(SYS_BSD43 + 156)
+#define SYS_BSD43_nfs_mount		(SYS_BSD43 + 157)
+#define SYS_BSD43_nfs_svc		(SYS_BSD43 + 158)
+#define SYS_BSD43_getdirentries		(SYS_BSD43 + 159)
+#define SYS_BSD43_statfs		(SYS_BSD43 + 160)
+#define SYS_BSD43_fstatfs		(SYS_BSD43 + 161)
+#define SYS_BSD43_unmount		(SYS_BSD43 + 162)
+#define SYS_BSD43_async_daemon		(SYS_BSD43 + 163)
+#define SYS_BSD43_nfs_getfh		(SYS_BSD43 + 164)
+#define SYS_BSD43_getdomainname		(SYS_BSD43 + 165)
+#define SYS_BSD43_setdomainname		(SYS_BSD43 + 166)
+#define SYS_BSD43_pcfs_mount		(SYS_BSD43 + 167)
+#define SYS_BSD43_quotactl		(SYS_BSD43 + 168)
+#define SYS_BSD43_oldexportfs		(SYS_BSD43 + 169)
+#define SYS_BSD43_smount		(SYS_BSD43 + 170)
+#define SYS_BSD43_mipshwconf		(SYS_BSD43 + 171)
+#define SYS_BSD43_exportfs		(SYS_BSD43 + 172)
+#define SYS_BSD43_nfsfh_open		(SYS_BSD43 + 173)
+#define SYS_BSD43_libattach		(SYS_BSD43 + 174)
+#define SYS_BSD43_libdetach		(SYS_BSD43 + 175)
+#define SYS_BSD43_accept		(SYS_BSD43 + 176)
+#define SYS_BSD43_reserved7		(SYS_BSD43 + 177)
+#define SYS_BSD43_reserved8		(SYS_BSD43 + 178)
+#define SYS_BSD43_recvmsg		(SYS_BSD43 + 179)
+#define SYS_BSD43_recvfrom		(SYS_BSD43 + 180)
+#define SYS_BSD43_sendmsg		(SYS_BSD43 + 181)
+#define SYS_BSD43_getpeername		(SYS_BSD43 + 182)
+#define SYS_BSD43_getsockname		(SYS_BSD43 + 183)
+#define SYS_BSD43_aread			(SYS_BSD43 + 184)
+#define SYS_BSD43_awrite		(SYS_BSD43 + 185)
+#define SYS_BSD43_listio		(SYS_BSD43 + 186)
+#define SYS_BSD43_acancel		(SYS_BSD43 + 187)
+#define SYS_BSD43_astatus		(SYS_BSD43 + 188)
+#define SYS_BSD43_await			(SYS_BSD43 + 189)
+#define SYS_BSD43_areadv		(SYS_BSD43 + 190)
+#define SYS_BSD43_awritev		(SYS_BSD43 + 191)
+
+/*
+ * POSIX syscalls are in the range from 3000 to 3999
+ */
+#define SYS_POSIX			3000
+#define SYS_POSIX_syscall		(SYS_POSIX +   0)
+#define SYS_POSIX_exit			(SYS_POSIX +   1)
+#define SYS_POSIX_fork			(SYS_POSIX +   2)
+#define SYS_POSIX_read			(SYS_POSIX +   3)
+#define SYS_POSIX_write			(SYS_POSIX +   4)
+#define SYS_POSIX_open			(SYS_POSIX +   5)
+#define SYS_POSIX_close			(SYS_POSIX +   6)
+#define SYS_POSIX_wait			(SYS_POSIX +   7)
+#define SYS_POSIX_creat			(SYS_POSIX +   8)
+#define SYS_POSIX_link			(SYS_POSIX +   9)
+#define SYS_POSIX_unlink		(SYS_POSIX +  10)
+#define SYS_POSIX_exec			(SYS_POSIX +  11)
+#define SYS_POSIX_chdir			(SYS_POSIX +  12)
+#define SYS_POSIX_gtime			(SYS_POSIX +  13)
+#define SYS_POSIX_mknod			(SYS_POSIX +  14)
+#define SYS_POSIX_chmod			(SYS_POSIX +  15)
+#define SYS_POSIX_chown			(SYS_POSIX +  16)
+#define SYS_POSIX_sbreak		(SYS_POSIX +  17)
+#define SYS_POSIX_stat			(SYS_POSIX +  18)
+#define SYS_POSIX_lseek			(SYS_POSIX +  19)
+#define SYS_POSIX_getpid		(SYS_POSIX +  20)
+#define SYS_POSIX_mount			(SYS_POSIX +  21)
+#define SYS_POSIX_umount		(SYS_POSIX +  22)
+#define SYS_POSIX_setuid		(SYS_POSIX +  23)
+#define SYS_POSIX_getuid		(SYS_POSIX +  24)
+#define SYS_POSIX_stime			(SYS_POSIX +  25)
+#define SYS_POSIX_ptrace		(SYS_POSIX +  26)
+#define SYS_POSIX_alarm			(SYS_POSIX +  27)
+#define SYS_POSIX_fstat			(SYS_POSIX +  28)
+#define SYS_POSIX_pause			(SYS_POSIX +  29)
+#define SYS_POSIX_utime			(SYS_POSIX +  30)
+#define SYS_POSIX_stty			(SYS_POSIX +  31)
+#define SYS_POSIX_gtty			(SYS_POSIX +  32)
+#define SYS_POSIX_access		(SYS_POSIX +  33)
+#define SYS_POSIX_nice			(SYS_POSIX +  34)
+#define SYS_POSIX_statfs		(SYS_POSIX +  35)
+#define SYS_POSIX_sync			(SYS_POSIX +  36)
+#define SYS_POSIX_kill			(SYS_POSIX +  37)
+#define SYS_POSIX_fstatfs		(SYS_POSIX +  38)
+#define SYS_POSIX_getpgrp		(SYS_POSIX +  39)
+#define SYS_POSIX_syssgi		(SYS_POSIX +  40)
+#define SYS_POSIX_dup			(SYS_POSIX +  41)
+#define SYS_POSIX_pipe			(SYS_POSIX +  42)
+#define SYS_POSIX_times			(SYS_POSIX +  43)
+#define SYS_POSIX_profil		(SYS_POSIX +  44)
+#define SYS_POSIX_lock			(SYS_POSIX +  45)
+#define SYS_POSIX_setgid		(SYS_POSIX +  46)
+#define SYS_POSIX_getgid		(SYS_POSIX +  47)
+#define SYS_POSIX_sig			(SYS_POSIX +  48)
+#define SYS_POSIX_msgsys		(SYS_POSIX +  49)
+#define SYS_POSIX_sysmips		(SYS_POSIX +  50)
+#define SYS_POSIX_sysacct		(SYS_POSIX +  51)
+#define SYS_POSIX_shmsys		(SYS_POSIX +  52)
+#define SYS_POSIX_semsys		(SYS_POSIX +  53)
+#define SYS_POSIX_ioctl			(SYS_POSIX +  54)
+#define SYS_POSIX_uadmin		(SYS_POSIX +  55)
+#define SYS_POSIX_exch			(SYS_POSIX +  56)
+#define SYS_POSIX_utssys		(SYS_POSIX +  57)
+#define SYS_POSIX_USG_reserved1		(SYS_POSIX +  58)
+#define SYS_POSIX_exece			(SYS_POSIX +  59)
+#define SYS_POSIX_umask			(SYS_POSIX +  60)
+#define SYS_POSIX_chroot		(SYS_POSIX +  61)
+#define SYS_POSIX_fcntl			(SYS_POSIX +  62)
+#define SYS_POSIX_ulimit		(SYS_POSIX +  63)
+#define SYS_POSIX_SAFARI4_reserved1	(SYS_POSIX +  64)
+#define SYS_POSIX_SAFARI4_reserved2	(SYS_POSIX +  65)
+#define SYS_POSIX_SAFARI4_reserved3	(SYS_POSIX +  66)
+#define SYS_POSIX_SAFARI4_reserved4	(SYS_POSIX +  67)
+#define SYS_POSIX_SAFARI4_reserved5	(SYS_POSIX +  68)
+#define SYS_POSIX_SAFARI4_reserved6	(SYS_POSIX +  69)
+#define SYS_POSIX_advfs			(SYS_POSIX +  70)
+#define SYS_POSIX_unadvfs		(SYS_POSIX +  71)
+#define SYS_POSIX_rmount		(SYS_POSIX +  72)
+#define SYS_POSIX_rumount		(SYS_POSIX +  73)
+#define SYS_POSIX_rfstart		(SYS_POSIX +  74)
+#define SYS_POSIX_reserved1		(SYS_POSIX +  75)
+#define SYS_POSIX_rdebug		(SYS_POSIX +  76)
+#define SYS_POSIX_rfstop		(SYS_POSIX +  77)
+#define SYS_POSIX_rfsys			(SYS_POSIX +  78)
+#define SYS_POSIX_rmdir			(SYS_POSIX +  79)
+#define SYS_POSIX_mkdir			(SYS_POSIX +  80)
+#define SYS_POSIX_getdents		(SYS_POSIX +  81)
+#define SYS_POSIX_sginap		(SYS_POSIX +  82)
+#define SYS_POSIX_sgikopt		(SYS_POSIX +  83)
+#define SYS_POSIX_sysfs			(SYS_POSIX +  84)
+#define SYS_POSIX_getmsg		(SYS_POSIX +  85)
+#define SYS_POSIX_putmsg		(SYS_POSIX +  86)
+#define SYS_POSIX_poll			(SYS_POSIX +  87)
+#define SYS_POSIX_sigreturn		(SYS_POSIX +  88)
+#define SYS_POSIX_accept		(SYS_POSIX +  89)
+#define SYS_POSIX_bind			(SYS_POSIX +  90)
+#define SYS_POSIX_connect		(SYS_POSIX +  91)
+#define SYS_POSIX_gethostid		(SYS_POSIX +  92)
+#define SYS_POSIX_getpeername		(SYS_POSIX +  93)
+#define SYS_POSIX_getsockname		(SYS_POSIX +  94)
+#define SYS_POSIX_getsockopt		(SYS_POSIX +  95)
+#define SYS_POSIX_listen		(SYS_POSIX +  96)
+#define SYS_POSIX_recv			(SYS_POSIX +  97)
+#define SYS_POSIX_recvfrom		(SYS_POSIX +  98)
+#define SYS_POSIX_recvmsg		(SYS_POSIX +  99)
+#define SYS_POSIX_select		(SYS_POSIX + 100)
+#define SYS_POSIX_send			(SYS_POSIX + 101)
+#define SYS_POSIX_sendmsg		(SYS_POSIX + 102)
+#define SYS_POSIX_sendto		(SYS_POSIX + 103)
+#define SYS_POSIX_sethostid		(SYS_POSIX + 104)
+#define SYS_POSIX_setsockopt		(SYS_POSIX + 105)
+#define SYS_POSIX_shutdown		(SYS_POSIX + 106)
+#define SYS_POSIX_socket		(SYS_POSIX + 107)
+#define SYS_POSIX_gethostname		(SYS_POSIX + 108)
+#define SYS_POSIX_sethostname		(SYS_POSIX + 109)
+#define SYS_POSIX_getdomainname		(SYS_POSIX + 110)
+#define SYS_POSIX_setdomainname		(SYS_POSIX + 111)
+#define SYS_POSIX_truncate		(SYS_POSIX + 112)
+#define SYS_POSIX_ftruncate		(SYS_POSIX + 113)
+#define SYS_POSIX_rename		(SYS_POSIX + 114)
+#define SYS_POSIX_symlink		(SYS_POSIX + 115)
+#define SYS_POSIX_readlink		(SYS_POSIX + 116)
+#define SYS_POSIX_lstat			(SYS_POSIX + 117)
+#define SYS_POSIX_nfs_mount		(SYS_POSIX + 118)
+#define SYS_POSIX_nfs_svc		(SYS_POSIX + 119)
+#define SYS_POSIX_nfs_getfh		(SYS_POSIX + 120)
+#define SYS_POSIX_async_daemon		(SYS_POSIX + 121)
+#define SYS_POSIX_exportfs		(SYS_POSIX + 122)
+#define SYS_POSIX_SGI_setregid		(SYS_POSIX + 123)
+#define SYS_POSIX_SGI_setreuid		(SYS_POSIX + 124)
+#define SYS_POSIX_getitimer		(SYS_POSIX + 125)
+#define SYS_POSIX_setitimer		(SYS_POSIX + 126)
+#define SYS_POSIX_adjtime		(SYS_POSIX + 127)
+#define SYS_POSIX_SGI_bsdgettime	(SYS_POSIX + 128)
+#define SYS_POSIX_SGI_sproc		(SYS_POSIX + 129)
+#define SYS_POSIX_SGI_prctl		(SYS_POSIX + 130)
+#define SYS_POSIX_SGI_blkproc		(SYS_POSIX + 131)
+#define SYS_POSIX_SGI_reserved1		(SYS_POSIX + 132)
+#define SYS_POSIX_SGI_sgigsc		(SYS_POSIX + 133)
+#define SYS_POSIX_SGI_mmap		(SYS_POSIX + 134)
+#define SYS_POSIX_SGI_munmap		(SYS_POSIX + 135)
+#define SYS_POSIX_SGI_mprotect		(SYS_POSIX + 136)
+#define SYS_POSIX_SGI_msync		(SYS_POSIX + 137)
+#define SYS_POSIX_SGI_madvise		(SYS_POSIX + 138)
+#define SYS_POSIX_SGI_mpin		(SYS_POSIX + 139)
+#define SYS_POSIX_SGI_getpagesize	(SYS_POSIX + 140)
+#define SYS_POSIX_SGI_libattach		(SYS_POSIX + 141)
+#define SYS_POSIX_SGI_libdetach		(SYS_POSIX + 142)
+#define SYS_POSIX_SGI_getpgrp		(SYS_POSIX + 143)
+#define SYS_POSIX_SGI_setpgrp		(SYS_POSIX + 144)
+#define SYS_POSIX_SGI_reserved2		(SYS_POSIX + 145)
+#define SYS_POSIX_SGI_reserved3		(SYS_POSIX + 146)
+#define SYS_POSIX_SGI_reserved4		(SYS_POSIX + 147)
+#define SYS_POSIX_SGI_reserved5		(SYS_POSIX + 148)
+#define SYS_POSIX_SGI_reserved6		(SYS_POSIX + 149)
+#define SYS_POSIX_cacheflush		(SYS_POSIX + 150)
+#define SYS_POSIX_cachectl		(SYS_POSIX + 151)
+#define SYS_POSIX_fchown		(SYS_POSIX + 152)
+#define SYS_POSIX_fchmod		(SYS_POSIX + 153)
+#define SYS_POSIX_wait3			(SYS_POSIX + 154)
+#define SYS_POSIX_mmap			(SYS_POSIX + 155)
+#define SYS_POSIX_munmap		(SYS_POSIX + 156)
+#define SYS_POSIX_madvise		(SYS_POSIX + 157)
+#define SYS_POSIX_BSD_getpagesize	(SYS_POSIX + 158)
+#define SYS_POSIX_setreuid		(SYS_POSIX + 159)
+#define SYS_POSIX_setregid		(SYS_POSIX + 160)
+#define SYS_POSIX_setpgid		(SYS_POSIX + 161)
+#define SYS_POSIX_getgroups		(SYS_POSIX + 162)
+#define SYS_POSIX_setgroups		(SYS_POSIX + 163)
+#define SYS_POSIX_gettimeofday		(SYS_POSIX + 164)
+#define SYS_POSIX_getrusage		(SYS_POSIX + 165)
+#define SYS_POSIX_getrlimit		(SYS_POSIX + 166)
+#define SYS_POSIX_setrlimit		(SYS_POSIX + 167)
+#define SYS_POSIX_waitpid		(SYS_POSIX + 168)
+#define SYS_POSIX_dup2			(SYS_POSIX + 169)
+#define SYS_POSIX_reserved2		(SYS_POSIX + 170)
+#define SYS_POSIX_reserved3		(SYS_POSIX + 171)
+#define SYS_POSIX_reserved4		(SYS_POSIX + 172)
+#define SYS_POSIX_reserved5		(SYS_POSIX + 173)
+#define SYS_POSIX_reserved6		(SYS_POSIX + 174)
+#define SYS_POSIX_reserved7		(SYS_POSIX + 175)
+#define SYS_POSIX_reserved8		(SYS_POSIX + 176)
+#define SYS_POSIX_reserved9		(SYS_POSIX + 177)
+#define SYS_POSIX_reserved10		(SYS_POSIX + 178)
+#define SYS_POSIX_reserved11		(SYS_POSIX + 179)
+#define SYS_POSIX_reserved12		(SYS_POSIX + 180)
+#define SYS_POSIX_reserved13		(SYS_POSIX + 181)
+#define SYS_POSIX_reserved14		(SYS_POSIX + 182)
+#define SYS_POSIX_reserved15		(SYS_POSIX + 183)
+#define SYS_POSIX_reserved16		(SYS_POSIX + 184)
+#define SYS_POSIX_reserved17		(SYS_POSIX + 185)
+#define SYS_POSIX_reserved18		(SYS_POSIX + 186)
+#define SYS_POSIX_reserved19		(SYS_POSIX + 187)
+#define SYS_POSIX_reserved20		(SYS_POSIX + 188)
+#define SYS_POSIX_reserved21		(SYS_POSIX + 189)
+#define SYS_POSIX_reserved22		(SYS_POSIX + 190)
+#define SYS_POSIX_reserved23		(SYS_POSIX + 191)
+#define SYS_POSIX_reserved24		(SYS_POSIX + 192)
+#define SYS_POSIX_reserved25		(SYS_POSIX + 193)
+#define SYS_POSIX_reserved26		(SYS_POSIX + 194)
+#define SYS_POSIX_reserved27		(SYS_POSIX + 195)
+#define SYS_POSIX_reserved28		(SYS_POSIX + 196)
+#define SYS_POSIX_reserved29		(SYS_POSIX + 197)
+#define SYS_POSIX_reserved30		(SYS_POSIX + 198)
+#define SYS_POSIX_reserved31		(SYS_POSIX + 199)
+#define SYS_POSIX_reserved32		(SYS_POSIX + 200)
+#define SYS_POSIX_reserved33		(SYS_POSIX + 201)
+#define SYS_POSIX_reserved34		(SYS_POSIX + 202)
+#define SYS_POSIX_reserved35		(SYS_POSIX + 203)
+#define SYS_POSIX_reserved36		(SYS_POSIX + 204)
+#define SYS_POSIX_reserved37		(SYS_POSIX + 205)
+#define SYS_POSIX_reserved38		(SYS_POSIX + 206)
+#define SYS_POSIX_reserved39		(SYS_POSIX + 207)
+#define SYS_POSIX_reserved40		(SYS_POSIX + 208)
+#define SYS_POSIX_reserved41		(SYS_POSIX + 209)
+#define SYS_POSIX_reserved42		(SYS_POSIX + 210)
+#define SYS_POSIX_reserved43		(SYS_POSIX + 211)
+#define SYS_POSIX_reserved44		(SYS_POSIX + 212)
+#define SYS_POSIX_reserved45		(SYS_POSIX + 213)
+#define SYS_POSIX_reserved46		(SYS_POSIX + 214)
+#define SYS_POSIX_reserved47		(SYS_POSIX + 215)
+#define SYS_POSIX_reserved48		(SYS_POSIX + 216)
+#define SYS_POSIX_reserved49		(SYS_POSIX + 217)
+#define SYS_POSIX_reserved50		(SYS_POSIX + 218)
+#define SYS_POSIX_reserved51		(SYS_POSIX + 219)
+#define SYS_POSIX_reserved52		(SYS_POSIX + 220)
+#define SYS_POSIX_reserved53		(SYS_POSIX + 221)
+#define SYS_POSIX_reserved54		(SYS_POSIX + 222)
+#define SYS_POSIX_reserved55		(SYS_POSIX + 223)
+#define SYS_POSIX_reserved56		(SYS_POSIX + 224)
+#define SYS_POSIX_reserved57		(SYS_POSIX + 225)
+#define SYS_POSIX_reserved58		(SYS_POSIX + 226)
+#define SYS_POSIX_reserved59		(SYS_POSIX + 227)
+#define SYS_POSIX_reserved60		(SYS_POSIX + 228)
+#define SYS_POSIX_reserved61		(SYS_POSIX + 229)
+#define SYS_POSIX_reserved62		(SYS_POSIX + 230)
+#define SYS_POSIX_reserved63		(SYS_POSIX + 231)
+#define SYS_POSIX_reserved64		(SYS_POSIX + 232)
+#define SYS_POSIX_reserved65		(SYS_POSIX + 233)
+#define SYS_POSIX_reserved66		(SYS_POSIX + 234)
+#define SYS_POSIX_reserved67		(SYS_POSIX + 235)
+#define SYS_POSIX_reserved68		(SYS_POSIX + 236)
+#define SYS_POSIX_reserved69		(SYS_POSIX + 237)
+#define SYS_POSIX_reserved70		(SYS_POSIX + 238)
+#define SYS_POSIX_reserved71		(SYS_POSIX + 239)
+#define SYS_POSIX_reserved72		(SYS_POSIX + 240)
+#define SYS_POSIX_reserved73		(SYS_POSIX + 241)
+#define SYS_POSIX_reserved74		(SYS_POSIX + 242)
+#define SYS_POSIX_reserved75		(SYS_POSIX + 243)
+#define SYS_POSIX_reserved76		(SYS_POSIX + 244)
+#define SYS_POSIX_reserved77		(SYS_POSIX + 245)
+#define SYS_POSIX_reserved78		(SYS_POSIX + 246)
+#define SYS_POSIX_reserved79		(SYS_POSIX + 247)
+#define SYS_POSIX_reserved80		(SYS_POSIX + 248)
+#define SYS_POSIX_reserved81		(SYS_POSIX + 249)
+#define SYS_POSIX_reserved82		(SYS_POSIX + 250)
+#define SYS_POSIX_reserved83		(SYS_POSIX + 251)
+#define SYS_POSIX_reserved84		(SYS_POSIX + 252)
+#define SYS_POSIX_reserved85		(SYS_POSIX + 253)
+#define SYS_POSIX_reserved86		(SYS_POSIX + 254)
+#define SYS_POSIX_reserved87		(SYS_POSIX + 255)
+#define SYS_POSIX_reserved88		(SYS_POSIX + 256)
+#define SYS_POSIX_reserved89		(SYS_POSIX + 257)
+#define SYS_POSIX_reserved90		(SYS_POSIX + 258)
+#define SYS_POSIX_reserved91		(SYS_POSIX + 259)
+#define SYS_POSIX_netboot		(SYS_POSIX + 260)
+#define SYS_POSIX_netunboot		(SYS_POSIX + 261)
+#define SYS_POSIX_rdump			(SYS_POSIX + 262)
+#define SYS_POSIX_setsid		(SYS_POSIX + 263)
+#define SYS_POSIX_getmaxsig		(SYS_POSIX + 264)
+#define SYS_POSIX_sigpending		(SYS_POSIX + 265)
+#define SYS_POSIX_sigprocmask		(SYS_POSIX + 266)
+#define SYS_POSIX_sigsuspend		(SYS_POSIX + 267)
+#define SYS_POSIX_sigaction		(SYS_POSIX + 268)
+#define SYS_POSIX_MIPS_reserved1	(SYS_POSIX + 269)
+#define SYS_POSIX_MIPS_reserved2	(SYS_POSIX + 270)
+#define SYS_POSIX_MIPS_reserved3	(SYS_POSIX + 271)
+#define SYS_POSIX_MIPS_reserved4	(SYS_POSIX + 272)
+#define SYS_POSIX_MIPS_reserved5	(SYS_POSIX + 273)
+#define SYS_POSIX_MIPS_reserved6	(SYS_POSIX + 274)
+#define SYS_POSIX_MIPS_reserved7	(SYS_POSIX + 275)
+#define SYS_POSIX_MIPS_reserved8	(SYS_POSIX + 276)
+#define SYS_POSIX_MIPS_reserved9	(SYS_POSIX + 277)
+#define SYS_POSIX_MIPS_reserved10	(SYS_POSIX + 278)
+#define SYS_POSIX_MIPS_reserved11	(SYS_POSIX + 279)
+#define SYS_POSIX_TANDEM_reserved1	(SYS_POSIX + 280)
+#define SYS_POSIX_TANDEM_reserved2	(SYS_POSIX + 281)
+#define SYS_POSIX_TANDEM_reserved3	(SYS_POSIX + 282)
+#define SYS_POSIX_TANDEM_reserved4	(SYS_POSIX + 283)
+#define SYS_POSIX_TANDEM_reserved5	(SYS_POSIX + 284)
+#define SYS_POSIX_TANDEM_reserved6	(SYS_POSIX + 285)
+#define SYS_POSIX_TANDEM_reserved7	(SYS_POSIX + 286)
+#define SYS_POSIX_TANDEM_reserved8	(SYS_POSIX + 287)
+#define SYS_POSIX_TANDEM_reserved9	(SYS_POSIX + 288)
+#define SYS_POSIX_TANDEM_reserved10	(SYS_POSIX + 289)
+#define SYS_POSIX_TANDEM_reserved11	(SYS_POSIX + 290)
+#define SYS_POSIX_TANDEM_reserved12	(SYS_POSIX + 291)
+#define SYS_POSIX_TANDEM_reserved13	(SYS_POSIX + 292)
+#define SYS_POSIX_TANDEM_reserved14	(SYS_POSIX + 293)
+#define SYS_POSIX_TANDEM_reserved15	(SYS_POSIX + 294)
+#define SYS_POSIX_TANDEM_reserved16	(SYS_POSIX + 295)
+#define SYS_POSIX_TANDEM_reserved17	(SYS_POSIX + 296)
+#define SYS_POSIX_TANDEM_reserved18	(SYS_POSIX + 297)
+#define SYS_POSIX_TANDEM_reserved19	(SYS_POSIX + 298)
+#define SYS_POSIX_TANDEM_reserved20	(SYS_POSIX + 299)
+#define SYS_POSIX_SGI_reserved7		(SYS_POSIX + 300)
+#define SYS_POSIX_SGI_reserved8		(SYS_POSIX + 301)
+#define SYS_POSIX_SGI_reserved9		(SYS_POSIX + 302)
+#define SYS_POSIX_SGI_reserved10	(SYS_POSIX + 303)
+#define SYS_POSIX_SGI_reserved11	(SYS_POSIX + 304)
+#define SYS_POSIX_SGI_reserved12	(SYS_POSIX + 305)
+#define SYS_POSIX_SGI_reserved13	(SYS_POSIX + 306)
+#define SYS_POSIX_SGI_reserved14	(SYS_POSIX + 307)
+#define SYS_POSIX_SGI_reserved15	(SYS_POSIX + 308)
+#define SYS_POSIX_SGI_reserved16	(SYS_POSIX + 309)
+#define SYS_POSIX_SGI_reserved17	(SYS_POSIX + 310)
+#define SYS_POSIX_SGI_reserved18	(SYS_POSIX + 311)
+#define SYS_POSIX_SGI_reserved19	(SYS_POSIX + 312)
+#define SYS_POSIX_SGI_reserved20	(SYS_POSIX + 313)
+#define SYS_POSIX_SGI_reserved21	(SYS_POSIX + 314)
+#define SYS_POSIX_SGI_reserved22	(SYS_POSIX + 315)
+#define SYS_POSIX_SGI_reserved23	(SYS_POSIX + 316)
+#define SYS_POSIX_SGI_reserved24	(SYS_POSIX + 317)
+#define SYS_POSIX_SGI_reserved25	(SYS_POSIX + 318)
+#define SYS_POSIX_SGI_reserved26	(SYS_POSIX + 319)
+
+/*
+ * Linux syscalls are in the range from 4000 to 4999
+ * Hopefully these syscall numbers are unused ...  If not everyone using
+ * statically linked binaries is pretty <censored - the government>.  You've
+ * been warned.
+ */
+#define SYS_Linux			4000
+#define SYS_syscall			(SYS_Linux +   0)
+#define SYS_exit			(SYS_Linux +   1)
+#define SYS_fork			(SYS_Linux +   2)
+#define SYS_read			(SYS_Linux +   3)
+#define SYS_write			(SYS_Linux +   4)
+#define SYS_open			(SYS_Linux +   5)
+#define SYS_close			(SYS_Linux +   6)
+#define SYS_waitpid			(SYS_Linux +   7)
+#define SYS_creat			(SYS_Linux +   8)
+#define SYS_link			(SYS_Linux +   9)
+#define SYS_unlink			(SYS_Linux +  10)
+#define SYS_execve			(SYS_Linux +  11)
+#define SYS_chdir			(SYS_Linux +  12)
+#define SYS_time			(SYS_Linux +  13)
+#define SYS_mknod			(SYS_Linux +  14)
+#define SYS_chmod			(SYS_Linux +  15)
+#define SYS_chown			(SYS_Linux +  16)
+#define SYS_break			(SYS_Linux +  17)
+#define SYS_oldstat			(SYS_Linux +  18)
+#define SYS_lseek			(SYS_Linux +  19)
+#define SYS_getpid			(SYS_Linux +  20)
+#define SYS_mount			(SYS_Linux +  21)
+#define SYS_umount			(SYS_Linux +  22)
+#define SYS_setuid			(SYS_Linux +  23)
+#define SYS_getuid			(SYS_Linux +  24)
+#define SYS_stime			(SYS_Linux +  25)
+#define SYS_ptrace			(SYS_Linux +  26)
+#define SYS_alarm			(SYS_Linux +  27)
+#define SYS_oldfstat			(SYS_Linux +  28)
+#define SYS_pause			(SYS_Linux +  29)
+#define SYS_utime			(SYS_Linux +  30)
+#define SYS_stty			(SYS_Linux +  31)
+#define SYS_gtty			(SYS_Linux +  32)
+#define SYS_access			(SYS_Linux +  33)
+#define SYS_nice			(SYS_Linux +  34)
+#define SYS_ftime			(SYS_Linux +  35)
+#define SYS_sync			(SYS_Linux +  36)
+#define SYS_kill			(SYS_Linux +  37)
+#define SYS_rename			(SYS_Linux +  38)
+#define SYS_mkdir			(SYS_Linux +  39)
+#define SYS_rmdir			(SYS_Linux +  40)
+#define SYS_dup				(SYS_Linux +  41)
+#define SYS_pipe			(SYS_Linux +  42)
+#define SYS_times			(SYS_Linux +  43)
+#define SYS_prof			(SYS_Linux +  44)
+#define SYS_brk				(SYS_Linux +  45)
+#define SYS_setgid			(SYS_Linux +  46)
+#define SYS_getgid			(SYS_Linux +  47)
+#define SYS_signal			(SYS_Linux +  48)
+#define SYS_geteuid			(SYS_Linux +  49)
+#define SYS_getegid			(SYS_Linux +  50)
+#define SYS_acct			(SYS_Linux +  51)
+#define SYS_phys			(SYS_Linux +  52)
+#define SYS_lock			(SYS_Linux +  53)
+#define SYS_ioctl			(SYS_Linux +  54)
+#define SYS_fcntl			(SYS_Linux +  55)
+#define SYS_mpx				(SYS_Linux +  56)
+#define SYS_setpgid			(SYS_Linux +  57)
+#define SYS_ulimit			(SYS_Linux +  58)
+#define SYS_oldolduname			(SYS_Linux +  59)
+#define SYS_umask			(SYS_Linux +  60)
+#define SYS_chroot			(SYS_Linux +  61)
+#define SYS_ustat			(SYS_Linux +  62)
+#define SYS_dup2			(SYS_Linux +  63)
+#define SYS_getppid			(SYS_Linux +  64)
+#define SYS_getpgrp			(SYS_Linux +  65)
+#define SYS_setsid			(SYS_Linux +  66)
+#define SYS_sigaction			(SYS_Linux +  67)
+#define SYS_sgetmask			(SYS_Linux +  68)
+#define SYS_ssetmask			(SYS_Linux +  69)
+#define SYS_setreuid			(SYS_Linux +  70)
+#define SYS_setregid			(SYS_Linux +  71)
+#define SYS_sigsuspend			(SYS_Linux +  72)
+#define SYS_sigpending			(SYS_Linux +  73)
+#define SYS_sethostname			(SYS_Linux +  74)
+#define SYS_setrlimit			(SYS_Linux +  75)
+#define SYS_getrlimit			(SYS_Linux +  76)
+#define SYS_getrusage			(SYS_Linux +  77)
+#define SYS_gettimeofday		(SYS_Linux +  78)
+#define SYS_settimeofday		(SYS_Linux +  79)
+#define SYS_getgroups			(SYS_Linux +  80)
+#define SYS_setgroups			(SYS_Linux +  81)
+#define SYS_reserved82			(SYS_Linux +  82)
+#define SYS_symlink			(SYS_Linux +  83)
+#define SYS_oldlstat			(SYS_Linux +  84)
+#define SYS_readlink			(SYS_Linux +  85)
+#define SYS_uselib			(SYS_Linux +  86)
+#define SYS_swapon			(SYS_Linux +  87)
+#define SYS_reboot			(SYS_Linux +  88)
+#define SYS_readdir			(SYS_Linux +  89)
+#define SYS_mmap			(SYS_Linux +  90)
+#define SYS_munmap			(SYS_Linux +  91)
+#define SYS_truncate			(SYS_Linux +  92)
+#define SYS_ftruncate			(SYS_Linux +  93)
+#define SYS_fchmod			(SYS_Linux +  94)
+#define SYS_fchown			(SYS_Linux +  95)
+#define SYS_getpriority			(SYS_Linux +  96)
+#define SYS_setpriority			(SYS_Linux +  97)
+#define SYS_profil			(SYS_Linux +  98)
+#define SYS_statfs			(SYS_Linux +  99)
+#define SYS_fstatfs			(SYS_Linux + 100)
+#define SYS_ioperm			(SYS_Linux + 101)
+#define SYS_socketcall			(SYS_Linux + 102)
+#define SYS_syslog			(SYS_Linux + 103)
+#define SYS_setitimer			(SYS_Linux + 104)
+#define SYS_getitimer			(SYS_Linux + 105)
+#define SYS_stat			(SYS_Linux + 106)
+#define SYS_lstat			(SYS_Linux + 107)
+#define SYS_fstat			(SYS_Linux + 108)
+#define SYS_olduname			(SYS_Linux + 109)
+#define SYS_iopl			(SYS_Linux + 110)
+#define SYS_vhangup			(SYS_Linux + 111)
+#define SYS_idle			(SYS_Linux + 112)
+#define SYS_vm86			(SYS_Linux + 113)
+#define SYS_wait4			(SYS_Linux + 114)
+#define SYS_swapoff			(SYS_Linux + 115)
+#define SYS_sysinfo			(SYS_Linux + 116)
+#define SYS_ipc				(SYS_Linux + 117)
+#define SYS_fsync			(SYS_Linux + 118)
+#define SYS_sigreturn			(SYS_Linux + 119)
+#define SYS_clone			(SYS_Linux + 120)
+#define SYS_setdomainname		(SYS_Linux + 121)
+#define SYS_uname			(SYS_Linux + 122)
+#define SYS_modify_ldt			(SYS_Linux + 123)
+#define SYS_adjtimex			(SYS_Linux + 124)
+#define SYS_mprotect			(SYS_Linux + 125)
+#define SYS_sigprocmask			(SYS_Linux + 126)
+#define SYS_create_module		(SYS_Linux + 127)
+#define SYS_init_module			(SYS_Linux + 128)
+#define SYS_delete_module		(SYS_Linux + 129)
+#define SYS_get_kernel_syms		(SYS_Linux + 130)
+#define SYS_quotactl			(SYS_Linux + 131)
+#define SYS_getpgid			(SYS_Linux + 132)
+#define SYS_fchdir			(SYS_Linux + 133)
+#define SYS_bdflush			(SYS_Linux + 134)
+#define SYS_sysfs			(SYS_Linux + 135)
+#define SYS_personality			(SYS_Linux + 136)
+#define SYS_afs_syscall			(SYS_Linux + 137) /* Syscall for Andrew File System */
+#define SYS_setfsuid			(SYS_Linux + 138)
+#define SYS_setfsgid			(SYS_Linux + 139)
+#define SYS__llseek			(SYS_Linux + 140)
+#define SYS_getdents			(SYS_Linux + 141)
+#define SYS__newselect			(SYS_Linux + 142)
+#define SYS_syscall_flock		(SYS_Linux + 143)
+#define SYS_msync			(SYS_Linux + 144)
+#define SYS_readv			(SYS_Linux + 145)
+#define SYS_writev			(SYS_Linux + 146)
+#define SYS_cacheflush			(SYS_Linux + 147)
+#define SYS_cachectl			(SYS_Linux + 148)
+#define SYS_sysmips			(SYS_Linux + 149)
+#define SYS_setup			(SYS_Linux + 150)	/* used only by init, to get system going */
+#define SYS_getsid			(SYS_Linux + 151)
+#define SYS_fdatasync			(SYS_Linux + 152)
+#define SYS__sysctl			(SYS_Linux + 153)
+#define SYS_mlock			(SYS_Linux + 154)
+#define SYS_munlock			(SYS_Linux + 155)
+#define SYS_mlockall			(SYS_Linux + 156)
+#define SYS_munlockall			(SYS_Linux + 157)
+#define SYS_sched_setparam		(SYS_Linux + 158)
+#define SYS_sched_getparam		(SYS_Linux + 159)
+#define SYS_sched_setscheduler		(SYS_Linux + 160)
+#define SYS_sched_getscheduler		(SYS_Linux + 161)
+#define SYS_sched_yield			(SYS_Linux + 162)
+#define SYS_sched_get_priority_max	(SYS_Linux + 163)
+#define SYS_sched_get_priority_min	(SYS_Linux + 164)
+#define SYS_sched_rr_get_interval	(SYS_Linux + 165)
+#define SYS_nanosleep			(SYS_Linux + 166)
+#define SYS_mremap			(SYS_Linux + 167)
+#define SYS_accept			(SYS_Linux + 168)
+#define SYS_bind			(SYS_Linux + 169)
+#define SYS_connect			(SYS_Linux + 170)
+#define SYS_getpeername			(SYS_Linux + 171)
+#define SYS_getsockname			(SYS_Linux + 172)
+#define SYS_getsockopt			(SYS_Linux + 173)
+#define SYS_listen			(SYS_Linux + 174)
+#define SYS_recv			(SYS_Linux + 175)
+#define SYS_recvfrom			(SYS_Linux + 176)
+#define SYS_recvmsg			(SYS_Linux + 177)
+#define SYS_send			(SYS_Linux + 178)
+#define SYS_sendmsg			(SYS_Linux + 179)
+#define SYS_sendto			(SYS_Linux + 180)
+#define SYS_setsockopt			(SYS_Linux + 181)
+#define SYS_shutdown			(SYS_Linux + 182)
+#define SYS_socket			(SYS_Linux + 183)
+#define SYS_socketpair			(SYS_Linux + 184)
+#define SYS_setresuid			(SYS_Linux + 185)
+#define SYS_getresuid			(SYS_Linux + 186)
+#define SYS_query_module		(SYS_Linux + 187)
+#define SYS_poll			(SYS_Linux + 188)
+#define SYS_nfsservctl			(SYS_Linux + 189)
+
+#endif	/* sys/syscall.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/sysmips.h b/sysdeps/unix/sysv/linux/mips/sys/sysmips.h
new file mode 100644
index 0000000000..cbb7eba2b4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/sys/sysmips.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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 _SYS_SYSMIPS_H
+#define _SYS_SYSMIPS_H 1
+
+#include <features.h>
+
+/*
+ * Get the kernel definition for sysmips(2)
+ */
+#include <asm/sysmips.h>
+
+__BEGIN_DECLS
+
+extern int sysmips __P ((__const int cmd, __const int arg1,
+			 __const int arg2, __const int arg3));
+
+__END_DECLS
+
+#endif /* sys/sysmips.h */
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
new file mode 100644
index 0000000000..6dd9cd81c5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -0,0 +1,46 @@
+# File name	Caller	Syscall name	# args	Strong name	Weak names
+
+#
+# Calls for compatibility with existing MIPS OS implementations and
+# compilers.
+#
+cachectl	-	cachectl	3	__cachectl	cachectl
+cacheflush	-	cacheflush	3	_flush_cache	cacheflush
+sysmips		-	sysmips		4	__sysmips	sysmips
+
+# override select.S in parent directory:
+select		-	select		5	__select	select
+sigsuspend	-	sigsuspend	1	__sigsuspend	sigsuspend
+
+#
+# Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
+# it's provided for compatibility, though.
+#
+accept		-	accept		3	__accept	accept
+bind		-	bind		3	__bind		bind
+connect		-	connect		3	__connect	connect
+getpeername	-	getpeername	3	__getpeername	getpeername
+getsockname	-	getsockname	3	__getsockname	getsockname
+getsockopt	-	getsockopt	5	__getsockopt	getsockopt
+listen		-	listen		2	__listen	listen
+recv		-	recv		4	__recv		recv
+recvfrom	-	recvfrom	6	__recvfrom	recvfrom
+recvmsg		-	recvmsg		3	__recvmsg	recvmsg
+send		-	send		4	__send		send
+sendmsg		-	sendmsg		3	__sendmsg	sendmsg
+sendto		-	sendto		6	__sendto	sendto
+setsockopt	-	setsockopt	5	__setsockopt	setsockopt
+shutdown	-	shutdown	2	__shutdown	shutdown
+socket		-	socket		3	__socket	socket
+socketpair	-	socketpair	4	__socketpair	socketpair
+
+#
+# There are defined locally because the caller is also defined in this dir.
+#
+s_llseek	llseek	_llseek		5	__sys_llseek
+s_sigaction	sigaction sigaction	3	__syscall_sigaction
+s_ustat		ustat	ustat		2	__syscall_ustat
+sys_mknod	xmknod	mknod		3	__syscall_mknod
+sys_fstat	fxstat	fstat		2	__syscall_fstat
+sys_lstat	lxstat	lstat		2	__syscall_lstat
+sys_stat	xstat	stat		2	__syscall_stat
diff --git a/sysdeps/unix/sysv/linux/mips/ustat.c b/sysdeps/unix/sysv/linux/mips/ustat.c
new file mode 100644
index 0000000000..447ab2947e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/ustat.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sys/ustat.h>
+#include <sys/sysmacros.h>
+
+
+extern int __syscall_ustat (unsigned long dev, struct ustat *ubuf);
+
+int
+ustat (dev_t dev, struct ustat *ubuf)
+{
+  unsigned long k_dev;
+
+  /* We must convert the value to dev_t type used by the kernel.  */
+  k_dev = ((major (dev) & 0xff) << 8) | (minor (dev) & 0xff);
+
+  return __syscall_ustat (k_dev, ubuf);
+}
diff --git a/sysdeps/unix/sysv/linux/mips/xmknod.c b/sysdeps/unix/sysv/linux/mips/xmknod.c
new file mode 100644
index 0000000000..c7ff64fecb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/xmknod.c
@@ -0,0 +1,47 @@
+/* xmknod call using old-style Unix mknod system call.
+   Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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 <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+
+extern int __syscall_mknod (const char *, unsigned long, unsigned int);
+
+/* Create a device file named PATH, with permission and special bits MODE
+   and device number DEV (which can be constructed from major and minor
+   device numbers with the `makedev' macro above).  */
+int
+__xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
+{
+  unsigned long k_dev;
+
+  if (vers != _MKNOD_VER)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* We must convert the value to dev_t type used by the kernel.  */
+  k_dev = ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff);
+
+  return __syscall_mknod (path, mode, k_dev);
+}
+
+weak_alias (__xmknod, _xmknod)
diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c
new file mode 100644
index 0000000000..9f7eb58e0a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/xstat.c
@@ -0,0 +1,80 @@
+/* xstat using old-style Unix stat system call.
+   Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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 <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+#include <kernel_stat.h>
+
+extern int __syscall_stat (const char *, struct kernel_stat *);
+
+/* Get information about the file NAME in BUF.  */
+int
+__xstat (int vers, const char *name, struct stat *buf)
+{
+  struct kernel_stat kbuf;
+  int result;
+
+  switch (vers)
+    {
+    case _STAT_VER_LINUX_OLD:
+      /* Nothing to do.  The struct is in the form the kernel expects
+	 it to be.  */
+      result = __syscall_stat (name, (struct kernel_stat *) buf);
+      break;
+
+    case _STAT_VER_LINUX:
+      /* Do the system call.  */
+      result = __syscall_stat (name, &kbuf);
+
+      /* Convert to current kernel version of `struct stat'.  */
+      buf->st_dev = kbuf.st_dev;
+      buf->st_pad1[0]  = 0; buf->st_pad1[1]  = 0; buf->st_pad1[2]  = 0;
+      buf->st_ino = kbuf.st_ino;
+      buf->st_mode = kbuf.st_mode;
+      buf->st_nlink = kbuf.st_nlink;
+      buf->st_uid = kbuf.st_uid;
+      buf->st_gid = kbuf.st_gid;
+      buf->st_rdev = kbuf.st_rdev;
+      buf->st_pad2[0] = 0; buf->st_pad2[1] = 0;
+      buf->st_pad3 = 0;
+      buf->st_size = kbuf.st_size;
+      buf->st_blksize = kbuf.st_blksize;
+      buf->st_blocks = kbuf.st_blocks;
+
+      buf->st_atime = kbuf.st_atime; buf->__reserved0 = 0;
+      buf->st_mtime = kbuf.st_mtime; buf->__reserved1 = 0;
+      buf->st_ctime = kbuf.st_ctime; buf->__reserved2 = 0;
+
+      buf->st_pad4[0] = 0; buf->st_pad4[1] = 0;
+      buf->st_pad4[2] = 0; buf->st_pad4[3] = 0;
+      buf->st_pad4[4] = 0; buf->st_pad4[5] = 0;
+      buf->st_pad4[6] = 0; buf->st_pad4[7] = 0;
+      break;
+
+    default:
+      __set_errno (EINVAL);
+      result = -1;
+      break;
+    }
+
+  return result;
+}
+weak_alias (__xstat, _xstat)
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index f11370d6cb..a3b0eef691 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -67,7 +67,8 @@ sys_readv	readv	readv		3	__syscall_readv
 sys_stat	xstat	stat		2	__syscall_stat
 sys_writev	writev	writev		3	__syscall_writev
 sysinfo		EXTRA	sysinfo		1	sysinfo
-swapon		-	swapon		2	swapon
+swapon		-	swapon		2	__swapon	swapon
+swapoff		-	swapoff		1	__swapoff	swapoff
 umount		EXTRA	umount		1	__umount	umount
 uselib		EXTRA	uselib		1	uselib
 wait4		-	wait4		4	__wait4		wait4
diff --git a/time/Makefile b/time/Makefile
index 5b20e1d071..123ba2d08a 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -32,7 +32,7 @@ routines	:= offtime asctime clock ctime ctime_r difftime	\
 		   tzfile gettimeofday settimeofday adjtime	\
 		   getitimer setitimer				\
 		   stime dysize timegm ftime			\
-		   strptime
+		   strptime getdate
 
 others	:= ap zdump zic
 tests	:= test_time clocktest test-tz
diff --git a/time/getdate.c b/time/getdate.c
new file mode 100644
index 0000000000..a3153a9591
--- /dev/null
+++ b/time/getdate.c
@@ -0,0 +1,247 @@
+/* Convert a string representation of time to a time value.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/stat.h>
+
+
+/* Prototypes for local functions.  */
+static int first_wday (int year, int mon, int wday);
+static int check_mday (int year, int mon, int mday);
+
+
+/* Set to one of the following values to indicate an error.
+     1  the DATEMSK environment variable is null or undefined,
+     2  the template file cannot be opened for reading,
+     3  failed to get file status information,
+     4  the template file is not a regular file,
+     5  an error is encountered while reading the template file,
+     6  memory allication failed (not enough memory available),
+     7  there is no line in the template that matches the input,
+     8  invalid input specification Example: February 31 or a time is
+        specified that can not be represented in a time_t (representing
+	the time in seconds since 00:00:00 UTC, January 1, 1970) */
+int getdate_err = 0;
+
+
+/* Returns the first weekday WDAY of month MON in the year YEAR.  */
+static int
+first_wday (int year, int mon, int wday)
+{
+  struct tm tm;
+
+  if (wday == INT_MIN)
+    return 1;
+
+  memset (&tm, 0, sizeof (struct tm));
+  tm.tm_year = year;
+  tm.tm_mon = mon;
+  tm.tm_mday = 1;
+  mktime (&tm);
+
+  return (1 + (wday - tm.tm_wday + 7) % 7);
+}
+
+
+/* Returns 1 if MDAY is a valid day of the month in month MON of year
+   YEAR, and 0 if it is not.  */
+static int
+check_mday (int year, int mon, int mday)
+{
+  switch (mon)
+    {
+    case 1:
+    case 3:
+    case 5:
+    case 7:
+    case 8:
+    case 10:
+    case 12:
+      if (mday >= 1 && mday <= 31)
+	return 1;
+      break;
+    case 4:
+    case 6:
+    case 9:
+    case 11:
+      if (mday >= 1 && mday <= 30)
+	return 1;
+      break;
+    case 2:
+      if (mday >= 1 && mday < (__isleap (year) ? 29 : 28))
+	return 1;
+      break;
+    }
+
+  return 0;
+}
+
+
+int
+__getdate_r (const char *string, struct tm *tp)
+{
+  FILE *fp;
+  char *line;
+  size_t len;
+  char *datemsk;
+  char *result = NULL;
+  time_t timer;
+  struct tm tm;
+  struct stat st;
+  int mday_ok = 0;
+
+  datemsk = getenv ("DATEMSK");
+  if (datemsk == NULL || *datemsk == '\0')
+    return 1;
+
+  if (stat (datemsk, &st) < 0)
+    return 3;
+
+  if (!S_ISREG (st.st_mode))
+    return 4;
+
+  /* Open the template file.  */
+  fp = fopen (datemsk, "r");
+  if (fp == NULL)
+    return 2;
+
+  line = NULL;
+  len = 0;
+  do
+    {
+      ssize_t n;
+
+      n = __getline (&line, &len, fp);
+      if (n < 0)
+	break;
+      if (line[n - 1] == '\n')
+	line[n - 1] = '\0';
+
+      /* Do the conversion.  */
+      tp->tm_year = tp->tm_mon = tp->tm_mday = tp->tm_wday = INT_MIN;
+      tp->tm_hour = tp->tm_sec = tp->tm_min = INT_MIN;
+      result = strptime (string, line, tp);
+      if (result && *result == '\0')
+	break;
+    }
+  while (!feof (fp));
+
+  /* Free the buffer.  */
+  free (line);
+
+  /* Check for errors. */
+  if (ferror (fp))
+    {
+      fclose (fp);
+      return 5;
+    }
+
+  /* Close template file.  */
+  fclose (fp);
+
+  if (result == NULL)
+    return 7;
+
+  /* Get current time.  */
+  time (&timer);
+  __localtime_r (&timer, &tm);
+
+  /* If only the weekday is given, today is assumed if the given day
+     is equal to the current day and next week if it is less.  */
+  if (tp->tm_wday >= 0 && tp->tm_wday <= 6 && tp->tm_year == INT_MIN
+      && tp->tm_mon == INT_MIN && tp->tm_mday == INT_MIN)
+    {
+      tp->tm_year = tm.tm_year;
+      tp->tm_mon = tm.tm_mon;
+      tp->tm_mday = tm.tm_mday + (tp->tm_wday - tm.tm_wday + 7) % 7;
+      mday_ok = 1;
+    }
+
+  /* If only the month is given, the current month is assumed if the
+     given month is equal to the current month and next year if it is
+     less and no year is given (the first day of month is assumed if
+     no day is given.  */
+  if (tp->tm_mon >= 0 && tp->tm_mon <= 11 && tp->tm_mday == INT_MIN)
+    {
+      if (tp->tm_year == INT_MIN)
+	tp->tm_year = tm.tm_year + (((tp->tm_mon - tm.tm_mon) < 0) ? 1 : 0);
+      tp->tm_mday = first_wday (tp->tm_year, tp->tm_mon, tp->tm_wday);
+      mday_ok = 1;
+    }
+
+  /* If no hour, minute and second are given the current hour, minute
+     and second are assumed.  */
+  if (tp->tm_hour == INT_MIN && tp->tm_min == INT_MIN && tp->tm_sec == INT_MIN)
+    {
+      tp->tm_hour = tm.tm_hour;
+      tp->tm_min = tm.tm_min;
+      tp->tm_sec = tm.tm_sec;
+    }
+
+  /* If no date is given, today is assumed if the given hour is
+     greater than the current hour and tomorrow is assumed if
+     it is less.  */
+  if (tp->tm_hour >= 0 && tp->tm_hour <= 23
+      && tp->tm_year == INT_MIN && tp->tm_mon == INT_MIN
+      && tp->tm_mday == INT_MIN && tp->tm_wday == INT_MIN)
+    {
+      tp->tm_year = tm.tm_year;
+      tp->tm_mon = tm.tm_mon;
+      tp->tm_mday = tm.tm_mday + ((tp->tm_hour - tm.tm_hour) < 0 ? 1 : 0);
+      mday_ok = 1;
+    }
+
+  /* Fill in the gaps.  */
+  if (tp->tm_year == INT_MIN)
+    tp->tm_year = tm.tm_year;
+  if (tp->tm_hour == INT_MIN)
+    tp->tm_hour = 0;
+  if (tp->tm_min == INT_MIN)
+    tp->tm_min = 0;
+  if (tp->tm_sec == INT_MIN)
+    tp->tm_sec = 0;
+
+  /* Check if the day of month is within range, and if the time can be
+     represented in a time_t.  We make use of the fact that the mktime
+     call normalizes the struct tm.  */
+  if ((!mday_ok && !check_mday (tp->tm_year, tp->tm_mon, tp->tm_mday))
+      || mktime (tp) == (time_t) -1)
+    return 8;
+
+  return 0;
+}
+#ifdef weak_alias
+weak_alias (__getdate_r, getdate_r)
+#endif
+
+
+struct tm *
+getdate (const char *string)
+{
+  /* Buffer returned by getdate.  */
+  static struct tm tmbuf;
+  int errval = __getdate_r (string, &tmbuf);
+
+  return errval == 0 ? &tmbuf : NULL;
+}
diff --git a/time/time.h b/time/time.h
index ce9b9755b1..d062ba1cc0 100644
--- a/time/time.h
+++ b/time/time.h
@@ -275,6 +275,38 @@ extern int nanosleep __P ((__const struct timespec *__requested_time,
 #endif
 
 
+#ifdef __USE_XOPEN_EXTENDED
+/* Set to one of the following values to indicate an error.
+     1  the DATEMSK environment variable is null or undefined,
+     2  the template file cannot be opened for reading,
+     3  failed to get file status information,
+     4  the template file is not a regular file,
+     5  an error is encountered while reading the template file,
+     6  memory allication failed (not enough memory available),
+     7  there is no line in the template that matches the input,
+     8  invalid input specification Example: February 31 or a time is
+        specified that can not be represented in a time_t (representing
+	the time in seconds since 00:00:00 UTC, January 1, 1970) */
+extern int getdate_err;
+
+/* Parse the given string as a date specification and return a value
+   representing the value.  The templates from the file identified by
+   the environment variable DATEMSK are used.  In case of an error
+   `getdate_err' is set.  */
+extern struct tm *getdate __P ((__const char *__string));
+#endif
+
+#ifdef __USE_GNU
+/* Since `getdate' is not reentrant because of the use of `getdate_err'
+   and the static buffer to return the result in, we provide a thread-safe
+   variant.  The functionality is the same.  The result is returned in
+   the buffer pointed to by RESBUFP and in case of an error the return
+   value is != 0 with the same values as given above for `getdate_err'.  */
+extern int __getdate_r __P ((__const char *__string, struct tm *__resbufp));
+extern int getdate_r __P ((__const char *__string, struct tm *__resbufp));
+#endif
+
+
 __END_DECLS
 
 #endif /* <time.h> included.  */