summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-11-24 08:05:15 +0000
committerJakub Jelinek <jakub@redhat.com>2004-11-24 08:05:15 +0000
commit945a6124b6aa3047e3d144da4fb47cbbf5da70ee (patch)
tree7b7d217428c431919749c4e8280228da5739c25e
parent06bc2b63c861ca3f53e5e98bc0ecd23e4b159531 (diff)
downloadglibc-945a6124b6aa3047e3d144da4fb47cbbf5da70ee.tar.gz
glibc-945a6124b6aa3047e3d144da4fb47cbbf5da70ee.tar.xz
glibc-945a6124b6aa3047e3d144da4fb47cbbf5da70ee.zip
Updated to fedora-glibc-20041124T0741 cvs/fedora-glibc-2_3_3-84
-rw-r--r--ChangeLog92
-rw-r--r--dirent/dirent.h56
-rw-r--r--dlfcn/dlfcn.h17
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in10
-rw-r--r--linuxthreads/ChangeLog7
-rw-r--r--linuxthreads/sysdeps/mips/pspinlock.c3
-rw-r--r--linuxthreads/sysdeps/mips/pt-machine.h9
-rw-r--r--nscd/nscd_getai.c8
-rw-r--r--nss/nss_files/files-XXX.c10
-rw-r--r--sysdeps/generic/dl-tls.c2
-rw-r--r--sysdeps/i386/fpu_control.h4
-rw-r--r--sysdeps/mips/atomicity.h10
-rw-r--r--sysdeps/mips/bits/setjmp.h4
-rw-r--r--sysdeps/mips/dl-machine.h16
-rw-r--r--sysdeps/mips/elf/start.S7
-rw-r--r--sysdeps/mips/fpu/bits/mathdef.h2
-rw-r--r--sysdeps/mips/machine-gmon.h6
-rw-r--r--sysdeps/mips/mips64/__longjmp.c3
-rw-r--r--sysdeps/mips/mips64/bsd-_setjmp.S6
-rw-r--r--sysdeps/mips/mips64/bsd-setjmp.S5
-rw-r--r--sysdeps/mips/mips64/setjmp.S8
-rw-r--r--sysdeps/mips/mips64/setjmp_aux.c3
-rw-r--r--sysdeps/mips/sgidefs.h45
-rw-r--r--sysdeps/mips/sys/asm.h28
-rw-r--r--sysdeps/mips/sys/regdef.h10
-rw-r--r--sysdeps/mips/sys/ucontext.h9
-rw-r--r--sysdeps/posix/getaddrinfo.c2
-rw-r--r--sysdeps/unix/mips/sysdep.h5
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h6
-rw-r--r--sysdeps/unix/sysv/linux/mips/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/fcntl.h6
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sigcontext.h6
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/siginfo.h22
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/stat.h2
-rwxr-xr-xsysdeps/unix/sysv/linux/mips/configure6
-rw-r--r--sysdeps/unix/sysv/linux/mips/configure.in6
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_stat.h2
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread.c7
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread64.c5
-rw-r--r--sysdeps/unix/sysv/linux/mips/ptrace.c3
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite.c7
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite64.c5
-rw-r--r--sysdeps/unix/sysv/linux/mips/sigaction.c9
-rw-r--r--sysdeps/unix/sysv/linux/mips/sigcontextinfo.h2
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/procfs.h7
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/ptrace.h2
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/tas.h3
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/ucontext.h5
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/user.h8
50 files changed, 347 insertions, 167 deletions
diff --git a/ChangeLog b/ChangeLog
index 78a93b0270..4240be3c81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,90 @@
+2004-11-05  Maciej W. Rozycki  <macro@mips.com>
+
+	* sysdeps/mips/dl-machine.h: Include <sgidefs.h>.  Use _ABIO32,
+	_ABIN32 and _ABI64 for ABI selection throughout.
+	* sysdeps/mips/elf/start.S: Likewise.
+	* sysdeps/mips/mips64/__longjmp.c: Likewise.
+	* sysdeps/mips/mips64/bsd-_setjmp.S: Likewise.
+	* sysdeps/mips/mips64/bsd-setjmp.S: Likewise.
+	* sysdeps/mips/mips64/setjmp.S: Likewise.
+	* sysdeps/mips/mips64/setjmp_aux.c: Likewise.
+	* sysdeps/mips/sys/regdef.h: Likewise.
+	* sysdeps/mips/sys/ucontext.h: Likewise.
+	* sysdeps/unix/mips/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/kernel-features.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/pread.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/pread64.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/ptrace.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/pwrite.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/pwrite64.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sigaction.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/procfs.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Likewise.
+
+	* sysdeps/mips/atomicity.h: Use _ABIO32, _ABIN32 and _ABI64 for
+	ABI selection throughout.
+	* sysdeps/mips/bits/setjmp.h: Likewise.
+	* sysdeps/mips/fpu/bits/mathdef.h: Likewise.
+	* sysdeps/mips/machine-gmon.h: Likewise.
+	* sysdeps/mips/sys/asm.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/sigcontext.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/kernel_stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sigcontextinfo.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/ptrace.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/tas.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sys/user.h: Likewise.
+
+	* sysdeps/mips/sgidefs.h: Prevent <asm/sgidefs.h> from being
+	included by kernel headers and undo its settings if already
+	included.  Define _ABIO32, _ABIN32 and _ABI64 if missing and use
+	them to define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32 and
+	_MIPS_SIM_ABI64 for compatibility.
+	* sysdeps/unix/sysv/linux/mips/Makefile: Use _ABIO32, _ABIN32 and
+	_ABI64 for ABI selection in generated syscall-list.h
+	* sysdeps/unix/sysv/linux/mips/configure.in: Use _ABIO32, _ABIN32
+	and _ABI64 for ABI selection in generated asm-unistd.h.
+	* sysdeps/unix/sysv/linux/mips/configure: Regenerate.
+
+	* sysdeps/unix/sysv/linux/mips/pwrite.c (__libc_pwrite): Correct
+	an inverted _MIPS_SIM conditional.
+
+2004-11-23  Alexandre Oliva  <aoliva@redhat.com>
+
+	* sysdeps/generic/dl-tls.c (_dl_determine_tlsoffset): Use free
+	range even if it doesn't match exactly.
+
+2004-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+	* nss/nss_files/files-XXX.c (internal_getent): If parse_line returned
+	-1, also do H_ERRNO_SET (NETDB_INTERNAL).
+
+2004-11-22  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/i386/fpu_control.h: Add volatile to the asms.
+	Patch by Alexander Stohr.
+
+2004-11-22  Jakub Jelinek  <jakub@redhat.com>
+
+	* nscd/nscd_getai (__nscd_getai): Avoid memory and file descriptor
+	leaks.
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): Free air.
+
+2004-11-15  Maciej W. Rozycki  <macro@mips.com>
+
+	* sysdeps/unix/sysv/linux/mips/bits/siginfo.h (__SI_MAX_SIZE):
+	Define appropriately based on __WORDSIZE.
+	[struct siginfo] (__pad0): Add for explicit padding.
+
+	* sysdeps/unix/sysv/linux/mips/bits/siginfo.h: Formatting fixes
+	throughout.
+
+2004-11-22  Ulrich Drepper  <drepper@redhat.com>
+
+	* dirent/dirent.h: Add nonnull attributes.
+	* dlfcn/dlfcn.h: Likewise.
+
 2004-11-20  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/ieee754/k_standard.c: Document code 50.
@@ -9,16 +96,13 @@
 	[BZ #552]
 	* math/libm-test.inc (tgamma_test): Update tgamma (0) and
 	tgamma (-0).
-
-	* sysdeps/generic/w_tgamma.c (__tgamma): Properly handle
-	|x| == 0.
+	* sysdeps/generic/w_tgamma.c (__tgamma): Properly handle |x| == 0.
 	* sysdeps/generic/w_tgammaf.c (__tgammaf): Likewise.
 	* sysdeps/generic/w_tgammal.c (__tgammal): Likewise.
 	* sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r): Likewise.
 	* sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise.
 	* sysdeps/ieee754/ldbl-128/e_gammal_r.c: Likewise.
 	* sysdeps/ieee754/ldbl-96/e_gammal_r.c: Likewise.
-
 	* sysdeps/ieee754/k_standard.c (__kernel_standard): Handle
 	tgamma (0) and tgamma (-0).
 
diff --git a/dirent/dirent.h b/dirent/dirent.h
index 173d0eba97..a5e8a004e2 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -132,14 +132,14 @@ typedef struct __dirstream DIR;
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern DIR *opendir (__const char *__name);
+extern DIR *opendir (__const char *__name) __nonnull ((1));
 
 /* Close the directory stream DIRP.
    Return 0 if successful, -1 if not.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int closedir (DIR *__dirp);
+extern int closedir (DIR *__dirp) __nonnull ((1));
 
 /* Read a directory entry from DIRP.  Return a pointer to a `struct
    dirent' describing the entry, or NULL for EOF or error.  The
@@ -152,17 +152,18 @@ extern int closedir (DIR *__dirp);
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 #ifndef __USE_FILE_OFFSET64
-extern struct dirent *readdir (DIR *__dirp);
+extern struct dirent *readdir (DIR *__dirp) __nonnull ((1));
 #else
 # ifdef __REDIRECT
-extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64);
+extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64)
+     __nonnull ((1));
 # else
 #  define readdir readdir64
 # endif
 #endif
 
 #ifdef __USE_LARGEFILE64
-extern struct dirent64 *readdir64 (DIR *__dirp);
+extern struct dirent64 *readdir64 (DIR *__dirp) __nonnull ((1));
 #endif
 
 #if defined __USE_POSIX || defined __USE_MISC
@@ -174,14 +175,15 @@ extern struct dirent64 *readdir64 (DIR *__dirp);
 # ifndef __USE_FILE_OFFSET64
 extern int readdir_r (DIR *__restrict __dirp,
 		      struct dirent *__restrict __entry,
-		      struct dirent **__restrict __result);
+		      struct dirent **__restrict __result)
+     __nonnull ((1, 2, 3));
 # else
 #  ifdef __REDIRECT
 extern int __REDIRECT (readdir_r,
 		       (DIR *__restrict __dirp,
 			struct dirent *__restrict __entry,
 			struct dirent **__restrict __result),
-		       readdir64_r);
+		       readdir64_r) __nonnull ((1, 2, 3));
 #  else
 #   define readdir_r readdir64_r
 #  endif
@@ -190,27 +192,28 @@ extern int __REDIRECT (readdir_r,
 # ifdef __USE_LARGEFILE64
 extern int readdir64_r (DIR *__restrict __dirp,
 			struct dirent64 *__restrict __entry,
-			struct dirent64 **__restrict __result);
+			struct dirent64 **__restrict __result)
+     __nonnull ((1, 2, 3));
 # endif
 #endif	/* POSIX or misc */
 
 /* Rewind DIRP to the beginning of the directory.  */
-extern void rewinddir (DIR *__dirp) __THROW;
+extern void rewinddir (DIR *__dirp) __THROW __nonnull ((1));
 
 #if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN
 # include <bits/types.h>
 
 /* Seek to position POS on DIRP.  */
-extern void seekdir (DIR *__dirp, long int __pos) __THROW;
+extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1));
 
 /* Return the current position of DIRP.  */
-extern long int telldir (DIR *__dirp) __THROW;
+extern long int telldir (DIR *__dirp) __THROW __nonnull ((1));
 #endif
 
 #if defined __USE_BSD || defined __USE_MISC
 
 /* Return the file descriptor used by DIRP.  */
-extern int dirfd (DIR *__dirp) __THROW;
+extern int dirfd (DIR *__dirp) __THROW __nonnull ((1));
 
 # if defined __OPTIMIZE__ && defined _DIR_dirfd
 #  define dirfd(dirp)	_DIR_dirfd (dirp)
@@ -239,7 +242,8 @@ extern int dirfd (DIR *__dirp) __THROW;
 extern int scandir (__const char *__restrict __dir,
 		    struct dirent ***__restrict __namelist,
 		    int (*__selector) (__const struct dirent *),
-		    int (*__cmp) (__const void *, __const void *));
+		    int (*__cmp) (__const void *, __const void *))
+     __nonnull ((1, 2));
 # else
 #  ifdef __REDIRECT
 extern int __REDIRECT (scandir,
@@ -247,7 +251,7 @@ extern int __REDIRECT (scandir,
 			struct dirent ***__restrict __namelist,
 			int (*__selector) (__const struct dirent *),
 			int (*__cmp) (__const void *, __const void *)),
-		       scandir64);
+		       scandir64) __nonnull ((1, 2));
 #  else
 #   define scandir scandir64
 #  endif
@@ -259,18 +263,19 @@ extern int __REDIRECT (scandir,
 extern int scandir64 (__const char *__restrict __dir,
 		      struct dirent64 ***__restrict __namelist,
 		      int (*__selector) (__const struct dirent64 *),
-		      int (*__cmp) (__const void *, __const void *));
+		      int (*__cmp) (__const void *, __const void *))
+     __nonnull ((1, 2));
 # endif
 
 /* Function to compare two `struct dirent's alphabetically.  */
 # ifndef __USE_FILE_OFFSET64
 extern int alphasort (__const void *__e1, __const void *__e2)
-     __THROW __attribute_pure__;
+     __THROW __attribute_pure__ __nonnull ((1, 2));
 # else
 #  ifdef __REDIRECT
 extern int __REDIRECT_NTH (alphasort,
 			   (__const void *__e1, __const void *__e2),
-			   alphasort64) __attribute_pure__;
+			   alphasort64) __attribute_pure__ __nonnull ((1, 2));
 #  else
 #   define alphasort alphasort64
 #  endif
@@ -278,19 +283,20 @@ extern int __REDIRECT_NTH (alphasort,
 
 # if defined __USE_GNU && defined __USE_LARGEFILE64
 extern int alphasort64 (__const void *__e1, __const void *__e2)
-     __THROW __attribute_pure__;
+     __THROW __attribute_pure__ __nonnull ((1, 2));
 # endif
 
 # ifdef __USE_GNU
 /* Function to compare two `struct dirent's by name & version.  */
 #  ifndef __USE_FILE_OFFSET64
 extern int versionsort (__const void *__e1, __const void *__e2)
-     __THROW __attribute_pure__;
+     __THROW __attribute_pure__ __nonnull ((1, 2));
 #  else
 #   ifdef __REDIRECT
 extern int __REDIRECT_NTH (versionsort,
 			   (__const void *__e1, __const void *__e2),
-			   versionsort64) __attribute_pure__;
+			   versionsort64)
+     __attribute_pure__ __nonnull ((1, 2));
 #   else
 #    define versionsort versionsort64
 #   endif
@@ -298,7 +304,7 @@ extern int __REDIRECT_NTH (versionsort,
 
 #  ifdef __USE_LARGEFILE64
 extern int versionsort64 (__const void *__e1, __const void *__e2)
-     __THROW __attribute_pure__;
+     __THROW __attribute_pure__ __nonnull ((1, 2));
 #  endif
 # endif
 
@@ -309,14 +315,15 @@ extern int versionsort64 (__const void *__e1, __const void *__e2)
 # ifndef __USE_FILE_OFFSET64
 extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
 				size_t __nbytes,
-				__off_t *__restrict __basep) __THROW;
+				__off_t *__restrict __basep)
+     __THROW __nonnull ((2, 4));
 # else
 #  ifdef __REDIRECT
 extern __ssize_t __REDIRECT_NTH (getdirentries,
 				 (int __fd, char *__restrict __buf,
 				  size_t __nbytes,
 				  __off64_t *__restrict __basep),
-				 getdirentries64);
+				 getdirentries64) __nonnull ((2, 4));
 #  else
 #   define getdirentries getdirentries64
 #  endif
@@ -325,7 +332,8 @@ extern __ssize_t __REDIRECT_NTH (getdirentries,
 # ifdef __USE_LARGEFILE64
 extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf,
 				  size_t __nbytes,
-				  __off64_t *__restrict __basep) __THROW;
+				  __off64_t *__restrict __basep)
+     __THROW __nonnull ((2, 4));
 # endif
 
 #endif /* Use BSD or misc.  */
diff --git a/dlfcn/dlfcn.h b/dlfcn/dlfcn.h
index 9383c230dc..c3943b3250 100644
--- a/dlfcn/dlfcn.h
+++ b/dlfcn/dlfcn.h
@@ -54,16 +54,16 @@ __BEGIN_DECLS
 
 /* Open the shared object FILE and map it in; return a handle that can be
    passed to `dlsym' to get symbol values from it.  */
-extern void *dlopen (__const char *__file, int __mode) __THROW;
+extern void *dlopen (__const char *__file, int __mode) __THROW __nonnull ((1));
 
 /* Unmap and close a shared object opened by `dlopen'.
    The handle cannot be used again after calling `dlclose'.  */
-extern int dlclose (void *__handle) __THROW;
+extern int dlclose (void *__handle) __THROW __nonnull ((1));
 
 /* Find the run-time address in the shared object HANDLE refers to
    of the symbol called NAME.  */
 extern void *dlsym (void *__restrict __handle,
-		    __const char *__restrict __name) __THROW;
+		    __const char *__restrict __name) __THROW __nonnull ((2));
 
 #ifdef __USE_GNU
 /* Like `dlopen', but request object to be allocated in a new namespace.  */
@@ -73,7 +73,8 @@ extern void *dlmopen (Lmid_t __nsid, __const char *__file, int __mode) __THROW;
    of the symbol called NAME with VERSION.  */
 extern void *dlvsym (void *__restrict __handle,
 		     __const char *__restrict __name,
-		     __const char *__restrict __version) __THROW;
+		     __const char *__restrict __version)
+     __THROW __nonnull ((2, 3));
 #endif
 
 /* When any of the above functions fails, call this function
@@ -95,11 +96,12 @@ typedef struct
 
 /* Fill in *INFO with the following information about ADDRESS.
    Returns 0 iff no shared object's segments contain that address.  */
-extern int dladdr (__const void *__address, Dl_info *__info) __THROW;
+extern int dladdr (__const void *__address, Dl_info *__info)
+     __THROW __nonnull ((2));
 
 /* Same as `dladdr', but additionally sets *EXTRA_INFO according to FLAGS.  */
 extern int dladdr1 (__const void *__address, Dl_info *__info,
-		    void **__extra_info, int __flags) __THROW;
+		    void **__extra_info, int __flags) __THROW __nonnull ((2));
 
 /* These are the possible values for the FLAGS argument to `dladdr1'.
    This indicates what extra information is stored at *EXTRA_INFO.
@@ -120,7 +122,8 @@ enum
    On success, returns zero.  On failure, returns -1 and records an error
    message to be fetched with `dlerror'.  */
 extern int dlinfo (void *__restrict __handle,
-		   int __request, void *__restrict __arg);
+		   int __request, void *__restrict __arg)
+     __THROW __nonnull ((1, 3));
 
 /* These are the possible values for the REQUEST argument to `dlinfo'.  */
 enum
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 072780bdb9..689614472b 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -1,5 +1,5 @@
 # This file is updated automatically by Makefile.
 glibc-branch := fedora
 glibc-base := HEAD
-fedora-sync-date := 2004-11-21 11:16 UTC
-fedora-sync-tag := fedora-glibc-20041121T1116
+fedora-sync-date := 2004-11-24 07:41 UTC
+fedora-sync-tag := fedora-glibc-20041124T0741
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index f13b18a235..8b496b3c5e 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1,4 +1,4 @@
-%define glibcrelease 83
+%define glibcrelease 84
 %define auxarches i586 i686 athlon sparcv9 alphaev6
 %define prelinkarches noarch
 %define nptlarches i386 i686 athlon x86_64 ia64 s390 s390x sparcv9 ppc ppc64
@@ -1256,6 +1256,14 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Wed Nov 24 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-84
+- update from CVS
+  - fix memory leak in getaddrinfo if using nscd (#139559)
+  - handle large lines in /etc/hosts and /etc/networks
+    (#140378)
+  - add nonnull attributes to selected dirent.h and dlfcn.h
+    functions
+
 * Sun Nov 21 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-83
 - update from CVS
   - add deprecated and/or nonnull attribute to some signal.h
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index e15dc08a10..529d03d2e2 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,10 @@
+2004-11-05  Maciej W. Rozycki  <macro@mips.com>
+
+	* sysdeps/mips/pspinlock.c: Include <sgidefs.h>.  Use _ABIO32,
+	_ABIN32 and _ABI64 for ABI selection throughout.
+	* sysdeps/mips/pt-machine.h: Use _ABIO32, _ABIN32 and _ABI64 for
+	ABI selection throughout.
+
 2004-10-18  Roland McGrath  <roland@redhat.com>
 
 	[BZ #406]
diff --git a/linuxthreads/sysdeps/mips/pspinlock.c b/linuxthreads/sysdeps/mips/pspinlock.c
index b04b9ffea9..350aa7553c 100644
--- a/linuxthreads/sysdeps/mips/pspinlock.c
+++ b/linuxthreads/sysdeps/mips/pspinlock.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
+#include <sgidefs.h>
 #include <sys/tas.h>
 #include "internals.h"
 
@@ -34,7 +35,7 @@ __pthread_spin_lock (pthread_spinlock_t *lock)
     ("\t\t\t# spin_lock\n"
      "1:\n\t"
      ".set	push\n\t"
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
      ".set	mips2\n\t"
 #endif
      "ll	%1,%3\n\t"
diff --git a/linuxthreads/sysdeps/mips/pt-machine.h b/linuxthreads/sysdeps/mips/pt-machine.h
index c2f448e4be..96f7a7f8c6 100644
--- a/linuxthreads/sysdeps/mips/pt-machine.h
+++ b/linuxthreads/sysdeps/mips/pt-machine.h
@@ -24,9 +24,8 @@
 #ifndef _PT_MACHINE_H
 #define _PT_MACHINE_H   1
 
-#include <sys/tas.h>
-
 #include <sgidefs.h>
+#include <sys/tas.h>
 
 #ifndef PT_EI
 # define PT_EI extern inline __attribute__ ((always_inline))
@@ -63,10 +62,10 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
     ("/* Inline compare & swap */\n"
      "1:\n\t"
      ".set	push\n\t"
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
      ".set	mips2\n\t"
 #endif
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
      "lld	%1,%5\n\t"
 #else
      "ll	%1,%5\n\t"
@@ -74,7 +73,7 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
      "move	%0,$0\n\t"
      "bne	%1,%3,2f\n\t"
      "move	%0,%4\n\t"
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
      "scd	%0,%2\n\t"
 #else
      "sc	%0,%2\n\t"
diff --git a/nscd/nscd_getai.c b/nscd/nscd_getai.c
index f0b2082baa..24b374b0dc 100644
--- a/nscd/nscd_getai.c
+++ b/nscd/nscd_getai.c
@@ -104,7 +104,7 @@ __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop)
       if (resultbuf == NULL)
 	{
 	  *h_errnop = NETDB_INTERNAL;
-	  return -1;
+	  goto out_close;
 	}
 
       /* Set up the data structure, including pointers.  */
@@ -140,7 +140,10 @@ __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop)
 	  if (resultbuf->canon != NULL
 	      && resultbuf->canon[ai_resp->canonlen - 1] != '\0')
 	    /* We cannot use the database.  */
-	    goto out_close;
+	    {
+	      free (resultbuf);
+	      goto out_close;
+	    }
 
 	  retval = 0;
 	  *result = resultbuf;
@@ -173,6 +176,7 @@ __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop)
 	  mapped = NO_MAPPING;
 	}
 
+      *result = NULL;
       free (resultbuf);
 
       goto retry;
diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
index fd000bfd9a..fb13fbe2b6 100644
--- a/nss/nss_files/files-XXX.c
+++ b/nss/nss_files/files-XXX.c
@@ -1,5 +1,5 @@
 /* Common code for file-based databases in nss_files module.
-   Copyright (C) 1996,1997,1998,1999,2001,2002 Free Software Foundation, Inc.
+   Copyright (C) 1996-1999,2001,2002,2004 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
@@ -213,8 +213,14 @@ internal_getent (struct STRUCTURE *result,
 	 || ! (parse_result = parse_line (p, result, data, buflen, errnop
 					  EXTRA_ARGS)));
 
+  if (__builtin_expect (parse_result == -1, 0))
+    {
+      H_ERRNO_SET (NETDB_INTERNAL);
+      return NSS_STATUS_TRYAGAIN;
+    }
+
   /* Filled in RESULT with the next entry from the database file.  */
-  return parse_result == -1 ? NSS_STATUS_TRYAGAIN : NSS_STATUS_SUCCESS;
+  return NSS_STATUS_SUCCESS;
 }
 
 
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
index bf3592e292..3382e3493c 100644
--- a/sysdeps/generic/dl-tls.c
+++ b/sysdeps/generic/dl-tls.c
@@ -217,7 +217,7 @@ _dl_determine_tlsoffset (void)
       size_t off;
       max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
 
-      if (slotinfo[cnt].map->l_tls_blocksize >= freetop - freebottom)
+      if (slotinfo[cnt].map->l_tls_blocksize <= freetop - freebottom)
 	{
 	  off = roundup (freebottom, slotinfo[cnt].map->l_tls_align);
 	  if (off - freebottom < firstbyte)
diff --git a/sysdeps/i386/fpu_control.h b/sysdeps/i386/fpu_control.h
index e2d00467b7..0a9b57c30c 100644
--- a/sysdeps/i386/fpu_control.h
+++ b/sysdeps/i386/fpu_control.h
@@ -93,8 +93,8 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
    Note that the use of these macros is no sufficient anymore with
    recent hardware.  Some floating point operations are executed in
    the SSE/SSE2 engines which have their own control and status register.  */
-#define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw))
-#define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw))
+#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
+#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
 
 /* Default control word set at startup.  */
 extern fpu_control_t __fpu_control;
diff --git a/sysdeps/mips/atomicity.h b/sysdeps/mips/atomicity.h
index f3d05bd50e..7380e1000c 100644
--- a/sysdeps/mips/atomicity.h
+++ b/sysdeps/mips/atomicity.h
@@ -33,7 +33,7 @@ exchange_and_add (volatile uint32_t *mem, int val)
     ("/* Inline exchange & add */\n"
      "1:\n\t"
      ".set	push\n\t"
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
      ".set	mips2\n\t"
 #endif
      "ll	%0,%3\n\t"
@@ -59,7 +59,7 @@ atomic_add (volatile uint32_t *mem, int val)
     ("/* Inline atomic add */\n"
      "1:\n\t"
      ".set	push\n\t"
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
      ".set	mips2\n\t"
 #endif
      "ll	%0,%2\n\t"
@@ -83,10 +83,10 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
     ("/* Inline compare & swap */\n"
      "1:\n\t"
      ".set	push\n\t"
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
      ".set	mips2\n\t"
 #endif
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
      "lld	%1,%5\n\t"
 #else
      "ll	%1,%5\n\t"
@@ -94,7 +94,7 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
      "move	%0,$0\n\t"
      "bne	%1,%3,2f\n\t"
      "move	%0,%4\n\t"
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
      "scd	%0,%2\n\t"
 #else
      "sc	%0,%2\n\t"
diff --git a/sysdeps/mips/bits/setjmp.h b/sysdeps/mips/bits/setjmp.h
index 4ca199d7b6..ec0aaa020d 100644
--- a/sysdeps/mips/bits/setjmp.h
+++ b/sysdeps/mips/bits/setjmp.h
@@ -26,7 +26,7 @@
 
 typedef struct
   {
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
     /* Program counter.  */
     __ptr_t __pc;
 
@@ -62,7 +62,7 @@ typedef struct
     int __fpc_csr;
 
     /* Callee-saved floating point registers.  */
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
     double __fpregs[8];
 #else
     double __fpregs[6];
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 49fdffb93d..0d87b65691 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -32,6 +32,7 @@
 #error ENTRY_POINT needs to be defined for MIPS.
 #endif
 
+#include <sgidefs.h>
 #include <sys/asm.h>
 
 /* The offset of gp from GOT might be system-dependent.  It's set by
@@ -74,10 +75,9 @@ do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
 static inline int __attribute_used__
 elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
 {
-#if _MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIN32
   /* Don't link o32 and n32 together.  */
-  if (((ehdr->e_flags & EF_MIPS_ABI2) != 0)
-      != (_MIPS_SIM != _MIPS_SIM_ABI32))
+  if (((ehdr->e_flags & EF_MIPS_ABI2) != 0) != (_MIPS_SIM == _ABIN32))
     return 0;
 #endif
 
@@ -130,7 +130,7 @@ elf_machine_load_address (void)
 }
 
 /* The MSB of got[1] of a gnu object is set to identify gnu objects.  */
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
 # define ELF_MIPS_GNU_GOT1_MASK	0x8000000000000000L
 #else
 # define ELF_MIPS_GNU_GOT1_MASK	0x80000000L
@@ -257,7 +257,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
   return NULL;
 }
 
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 #define ELF_DL_FRAME_SIZE 40
 
 #define ELF_DL_SAVE_ARG_REGS "\
@@ -278,7 +278,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
 
 #define IFABIO32(X) X
 
-#else /* _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64 */
+#else /* _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64 */
 
 #define ELF_DL_FRAME_SIZE 80
 
@@ -550,7 +550,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
 
   switch (r_type)
     {
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
     case (R_MIPS_64 << 8) | R_MIPS_REL32:
 #else
     case R_MIPS_REL32:
@@ -615,7 +615,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
       break;
     case R_MIPS_NONE:		/* Alright, Wilbur.  */
       break;
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
     case R_MIPS_64:
       /* For full compliance with the ELF64 ABI, one must precede the
 	 _REL32/_64 pair of relocations with a _64 relocation, such
diff --git a/sysdeps/mips/elf/start.S b/sysdeps/mips/elf/start.S
index 3dd513777d..d9cc3b7ee2 100644
--- a/sysdeps/mips/elf/start.S
+++ b/sysdeps/mips/elf/start.S
@@ -1,5 +1,5 @@
 /* Startup code compliant to the ELF Mips ABI.
-   Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003
+   Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003, 2004
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -37,6 +37,7 @@
 
 #define __ASSEMBLY__ 1
 #include <entry.h>
+#include <sgidefs.h>
 #include <sys/asm.h>
 
 #ifndef ENTRY_POINT
@@ -93,12 +94,12 @@ ENTRY_POINT:
 	   on o32 and quad words (16 bytes) on n32 and n64.  */
 	
 	and $29, -2 * SZREG
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 	PTR_SUBIU $29, 32
 #endif
 	PTR_LA $7, __libc_csu_init		/* init */
 	PTR_LA $8, __libc_csu_fini
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 	PTR_S $8, 16($29)		/* fini */
 	PTR_S $2, 20($29)		/* rtld_fini */
 	PTR_S $29, 24($29)		/* stack_end */
diff --git a/sysdeps/mips/fpu/bits/mathdef.h b/sysdeps/mips/fpu/bits/mathdef.h
index c1ce876bf7..99be0db2b5 100644
--- a/sysdeps/mips/fpu/bits/mathdef.h
+++ b/sysdeps/mips/fpu/bits/mathdef.h
@@ -39,7 +39,7 @@ typedef double double_t;	/* `double' expressions are evaluated as
 
 #endif	/* ISO C99 */
 
-#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _MIPS_SIM_ABI32
+#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
 /* Signal that we do not really have a `long double'.  This disables the
    declaration of all the `long double' function variants.  */
 # define __NO_LONG_DOUBLE_MATH	1
diff --git a/sysdeps/mips/machine-gmon.h b/sysdeps/mips/machine-gmon.h
index f23a4c3008..7a089fa595 100644
--- a/sysdeps/mips/machine-gmon.h
+++ b/sysdeps/mips/machine-gmon.h
@@ -26,7 +26,7 @@ static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
 /* Call __mcount with the return PC for our caller,
    and the return PC our caller will return to.  */
 
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 
 #ifdef __PIC__
 # define CPLOAD ".cpload $25;"
@@ -83,10 +83,10 @@ static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
 # define CPRETURN
 #endif
 
-#if _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _ABIN32
 # define PTR_ADDU_STRING "add" /* no u */
 # define PTR_SUBU_STRING "sub" /* no u */
-#elif _MIPS_SIM == _MIPS_SIM_ABI64
+#elif _MIPS_SIM == _ABI64
 # define PTR_ADDU_STRING "daddu"
 # define PTR_SUBU_STRING "dsubu"
 #else
diff --git a/sysdeps/mips/mips64/__longjmp.c b/sysdeps/mips/mips64/__longjmp.c
index b2705793b2..546493f842 100644
--- a/sysdeps/mips/mips64/__longjmp.c
+++ b/sysdeps/mips/mips64/__longjmp.c
@@ -19,6 +19,7 @@
    02111-1307 USA.  */
 
 #include <setjmp.h>
+#include <sgidefs.h>
 #include <stdlib.h>
 
 #undef __longjmp
@@ -39,7 +40,7 @@ __longjmp (env, val_arg)
   register int val asm ("a1");
 
   /* Pull back the floating point callee-saved registers.  */
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
   asm volatile ("l.d $f24, %0" : : "m" (env[0].__fpregs[0]));
   asm volatile ("l.d $f25, %0" : : "m" (env[0].__fpregs[1]));
   asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[2]));
diff --git a/sysdeps/mips/mips64/bsd-_setjmp.S b/sysdeps/mips/mips64/bsd-_setjmp.S
index 73f5cc2de2..7620cf391f 100644
--- a/sysdeps/mips/mips64/bsd-_setjmp.S
+++ b/sysdeps/mips/mips64/bsd-_setjmp.S
@@ -1,5 +1,6 @@
 /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  MIPS64 version.
-   Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004
+	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
@@ -21,6 +22,7 @@
    We cannot do it in C because it must be a tail-call, so frame-unwinding
    in setjmp doesn't clobber the state restored by longjmp.  */
 
+#include <sgidefs.h>
 #include <sysdep.h>
 #include <sys/asm.h>
 
@@ -33,7 +35,7 @@ ENTRY (_setjmp)
 #endif
 	SETUP_GP64 (v0, C_SYMBOL_NAME (_setjmp))
 	PTR_LA t9, C_SYMBOL_NAME (__sigsetjmp)
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 	nop
 #endif	
 	RESTORE_GP64
diff --git a/sysdeps/mips/mips64/bsd-setjmp.S b/sysdeps/mips/mips64/bsd-setjmp.S
index f542cb565f..2a1fd9ce71 100644
--- a/sysdeps/mips/mips64/bsd-setjmp.S
+++ b/sysdeps/mips/mips64/bsd-setjmp.S
@@ -1,5 +1,5 @@
 /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  MIPS64 version.
-   Copyright (C) 1996, 1997, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2002, 2003, 2004 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
@@ -21,6 +21,7 @@
    We cannot do it in C because it must be a tail-call, so frame-unwinding
    in setjmp doesn't clobber the state restored by longjmp.  */
 
+#include <sgidefs.h>
 #include <sysdep.h>
 #include <sys/asm.h>
 
@@ -33,7 +34,7 @@ ENTRY (setjmp)
 #endif
 	SETUP_GP64 (v0, C_SYMBOL_NAME (setjmp))
 	PTR_LA t9, C_SYMBOL_NAME (__sigsetjmp)
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 	nop
 #endif	
 	RESTORE_GP64
diff --git a/sysdeps/mips/mips64/setjmp.S b/sysdeps/mips/mips64/setjmp.S
index d566921a87..bdfd9cd51c 100644
--- a/sysdeps/mips/mips64/setjmp.S
+++ b/sysdeps/mips/mips64/setjmp.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <sgidefs.h>
 #include <sysdep.h>
 #include <sys/asm.h>
 
@@ -33,11 +35,11 @@ ENTRY (__sigsetjmp)
 	move a2, sp
 	move a3, fp
 	PTR_LA t9, __sigsetjmp_aux
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 	nop
 #endif	
 	RESTORE_GP64
-#if _MIPS_SIM != _MIPS_SIM_ABI32
+#if _MIPS_SIM != _ABIO32
 	move a4, gp
 #endif
 	jr t9
diff --git a/sysdeps/mips/mips64/setjmp_aux.c b/sysdeps/mips/mips64/setjmp_aux.c
index b5afd14cbf..26b4739c32 100644
--- a/sysdeps/mips/mips64/setjmp_aux.c
+++ b/sysdeps/mips/mips64/setjmp_aux.c
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <setjmp.h>
+#include <sgidefs.h>
 
 /* This function is only called via the assembly language routine
    __sigsetjmp, which arranges to pass in the stack pointer and the frame
@@ -29,7 +30,7 @@ __sigsetjmp_aux (jmp_buf env, int savemask, long long sp, long long fp,
 		 long long gp)
 {
   /* Store the floating point callee-saved registers...  */
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABI64
   asm volatile ("s.d $f24, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[0]));
   asm volatile ("s.d $f25, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[1]));
   asm volatile ("s.d $f26, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[2]));
diff --git a/sysdeps/mips/sgidefs.h b/sysdeps/mips/sgidefs.h
index 1d4893501e..74509fdbd0 100644
--- a/sysdeps/mips/sgidefs.h
+++ b/sysdeps/mips/sgidefs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ralf Baechle <ralf@gnu.org>.
 
@@ -21,6 +21,27 @@
 #define _SGIDEFS_H	1
 
 /*
+ * A crude hack to stop <asm/sgidefs.h>
+ */
+#undef __ASM_SGIDEFS_H
+#define __ASM_SGIDEFS_H
+
+/*
+ * And remove any damage it might have already done
+ */
+#undef _MIPS_ISA_MIPS1
+#undef _MIPS_ISA_MIPS2
+#undef _MIPS_ISA_MIPS3
+#undef _MIPS_ISA_MIPS4
+#undef _MIPS_ISA_MIPS5
+#undef _MIPS_ISA_MIPS32
+#undef _MIPS_ISA_MIPS64
+
+#undef _MIPS_SIM_ABI32
+#undef _MIPS_SIM_NABI32
+#undef _MIPS_SIM_ABI64
+
+/*
  * Definitions for the ISA level
  */
 #define _MIPS_ISA_MIPS1 1
@@ -33,14 +54,20 @@
 
 /*
  * Subprogram calling convention
- *
- * At the moment only _MIPS_SIM_ABI32 is in use.  This will change rsn.
- * Until GCC 2.8.0 is released don't rely on this definitions because the
- * 64bit code is essentially using the 32bit interface model just with
- * 64bit registers.
  */
-#define _MIPS_SIM_ABI32		1
-#define _MIPS_SIM_NABI32	2
-#define _MIPS_SIM_ABI64		3
+#ifndef _ABIO32
+# define _ABIO32		1
+#endif
+#define _MIPS_SIM_ABI32		_ABIO32
+
+#ifndef _ABIN32
+# define _ABIN32		2
+#endif
+#define _MIPS_SIM_NABI32	_ABIN32
+
+#ifndef _ABI64
+# define _ABI64			3
+#endif
+#define _MIPS_SIM_ABI64		_ABI64
 
 #endif /* sgidefs.h */
diff --git a/sysdeps/mips/sys/asm.h b/sysdeps/mips/sys/asm.h
index 76f6af3e15..b04c36ba5e 100644
--- a/sysdeps/mips/sys/asm.h
+++ b/sysdeps/mips/sys/asm.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ralf Baechle <ralf@gnu.org>.
 
@@ -37,11 +37,11 @@
  * 64 bit address space isn't used yet, so we may use the R3000 32 bit
  * defines for now.
  */
-#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
+#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIN32
 # define PTR .word
 # define PTRSIZE 4
 # define PTRLOG 2
-#elif (_MIPS_SIM == _MIPS_SIM_ABI64)
+#elif _MIPS_SIM == _ABI64
 # define PTR .dword
 # define PTRSIZE 8
 # define PTRLOG 3
@@ -50,7 +50,7 @@
 /*
  * PIC specific declarations
  */
-#if (_MIPS_SIM == _MIPS_SIM_ABI32)
+#if _MIPS_SIM == _ABIO32
 # ifdef __PIC__
 #  define CPRESTORE(register) \
 		.cprestore register
@@ -97,7 +97,7 @@ l:							\
 # define SETUP_GPX64_L(cp_reg, ra_save, l)
 # define RESTORE_GP64
 # define USE_ALT_CP(a)
-#else /* (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) */
+#else /* _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 */
 /*
  * For callee-saved gp calling convention:
  */
@@ -131,15 +131,15 @@ l:							\
 /* Use alternate register for context pointer.  */
 # define USE_ALT_CP(reg)	\
 		.cplocal reg
-#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
+#endif /* _MIPS_SIM != _ABIO32 */
 
 /*
  * Stack Frame Definitions
  */
-#if (_MIPS_SIM == _MIPS_SIM_ABI32)
+#if _MIPS_SIM == _ABIO32
 # define NARGSAVE 4 /* Space for 4 argument registers must be allocated.  */
 #endif
-#if (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32)
+#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32
 # define NARGSAVE 0 /* No caller responsibilities.  */
 #endif
 
@@ -287,7 +287,7 @@ symbol		=	value
 /*
  * Stack alignment
  */
-#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32)
+#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32
 # define ALSZ	15
 # define ALMASK	~15
 #else
@@ -298,7 +298,7 @@ symbol		=	value
 /*
  * Size of a register
  */
-#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32)
+#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32
 # define SZREG	8
 #else
 # define SZREG	4
@@ -389,7 +389,7 @@ symbol		=	value
 /*
  * How to add/sub/load/store/shift pointers.
  */
-#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 32)
+#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 32)
 # define PTR_ADD	add
 # define PTR_ADDI	addi
 # define PTR_ADDU	addu
@@ -411,7 +411,7 @@ symbol		=	value
 # define PTR_SCALESHIFT	2
 #endif
 
-#if _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _ABIN32
 # define PTR_ADD	add
 # define PTR_ADDI	addi
 # define PTR_ADDU	add /* no u */
@@ -433,8 +433,8 @@ symbol		=	value
 # define PTR_SCALESHIFT	2
 #endif
 
-#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 64 /* o64??? */) \
-    || _MIPS_SIM == _MIPS_SIM_ABI64
+#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 64 /* o64??? */) \
+    || _MIPS_SIM == _ABI64
 # define PTR_ADD	dadd
 # define PTR_ADDI	daddi
 # define PTR_ADDU	daddu
diff --git a/sysdeps/mips/sys/regdef.h b/sysdeps/mips/sys/regdef.h
index 9d2c4c1c4c..8fb898a2d0 100644
--- a/sysdeps/mips/sys/regdef.h
+++ b/sysdeps/mips/sys/regdef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ralf Baechle <ralf@gnu.org>.
 
@@ -20,6 +20,8 @@
 #ifndef _SYS_REGDEF_H
 #define _SYS_REGDEF_H
 
+#include <sgidefs.h>
+
 /*
  * Symbolic register names for 32 bit ABI
  */
@@ -31,7 +33,7 @@
 #define a1      $5
 #define a2      $6
 #define a3      $7
-#if _MIPS_SIM != _MIPS_SIM_ABI32
+#if _MIPS_SIM != _ABIO32
 #define a4      $8
 #define a5      $9
 #define a6      $10
@@ -44,7 +46,7 @@
 #define ta1     a5
 #define ta2     a6
 #define ta3     a7
-#else /* if _MIPS_SIM == _MIPS_SIM_ABI32 */
+#else /* if _MIPS_SIM == _ABIO32 */
 #define t0      $8      /* caller saved */
 #define t1      $9
 #define t2      $10
@@ -57,7 +59,7 @@
 #define ta1     t5
 #define ta2     t6
 #define ta3     t7
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
+#endif /* _MIPS_SIM == _ABIO32 */
 #define s0      $16     /* callee saved */
 #define s1      $17
 #define s2      $18
diff --git a/sysdeps/mips/sys/ucontext.h b/sysdeps/mips/sys/ucontext.h
index 90aa09a80f..fe378e94cd 100644
--- a/sysdeps/mips/sys/ucontext.h
+++ b/sysdeps/mips/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2002, 2003, 2004 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
@@ -22,10 +22,11 @@
 #define _SYS_UCONTEXT_H	1
 
 #include <features.h>
+#include <sgidefs.h>
 #include <signal.h>
 
 /* Type for general register.  */
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 typedef __uint32_t greg_t;
 #else
 typedef __uint64_t greg_t;
@@ -119,7 +120,7 @@ typedef struct fpregset
 {
   union
   {
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
     double fp_dregs[16];
     float fp_fregs[32];
     unsigned int fp_regs[32];
@@ -143,7 +144,7 @@ typedef struct
 /* Userlevel context.  */
 typedef struct ucontext
 {
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
   unsigned long int uc_flags;
 #else
   __uint64_t uc_flags;
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index eb45709be1..c9081345ab 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -767,6 +767,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		      addrs += size;
 		    }
 
+		  free (air);
+
 		  if (at->family == AF_UNSPEC)
 		    return (GAIH_OKIFUNSPEC | -EAI_NONAME);
 
diff --git a/sysdeps/unix/mips/sysdep.h b/sysdeps/unix/mips/sysdep.h
index 9302710efa..714830147d 100644
--- a/sysdeps/unix/mips/sysdep.h
+++ b/sysdeps/unix/mips/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003
+/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003, 2004
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
@@ -18,6 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <sgidefs.h>
 #include <sysdeps/unix/sysdep.h>
 
 #ifdef __ASSEMBLER__
@@ -69,7 +70,7 @@
 /* The mips move insn is d,s.  */
 #define MOVE(x,y)	move y , x
 
-#if _MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _MIPS_SIM_ABIO64
+#if _MIPS_SIM == _ABIO32
 # define L(label) $L ## label
 #else
 # define L(label) .L ## label
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 17f4f8fcf7..f499a712c4 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -21,6 +21,10 @@
 /* This file must not contain any C code.  At least it must be protected
    to allow using the file also in assembler files.  */
 
+#if defined __mips__
+# include <sgidefs.h>
+#endif
+
 #ifndef __LINUX_KERNEL_VERSION
 /* We assume the worst; all kernels should be supported.  */
 # define __LINUX_KERNEL_VERSION	0
@@ -277,7 +281,7 @@
 # define __ASSUME_TIMEVAL64		1
 #endif
 
-#if defined __mips__ && defined _ABIN32 && _MIPS_SIM == _ABIN32
+#if defined __mips__ && _MIPS_SIM == _ABIN32
 # define __ASSUME_FCNTL64		1
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile
index db06a48405..d5e4f6b72d 100644
--- a/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/sysdeps/unix/sysv/linux/mips/Makefile
@@ -28,10 +28,10 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/s
 	 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \
 	     > $(@:.d=.h).newt; \
 	 if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
-	   echo '#if _MIPS_SIM == _MIPS_SIM_NABI32'; \
+	   echo '#if _MIPS_SIM == _ABIN32'; \
 	   sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt | \
 		LC_ALL=C sort; \
-	   echo '#elif _MIPS_SIM == _MIPS_SIM_ABI64'; \
+	   echo '#elif _MIPS_SIM == _ABI64'; \
 	   sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt | \
 		LC_ALL=C sort; \
 	   echo '#else'; \
diff --git a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
index 550593b0e9..aa039b4c0e 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
@@ -22,8 +22,8 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-#include <sys/types.h>
 #include <sgidefs.h>
+#include <sys/types.h>
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -144,7 +144,7 @@ typedef struct flock
 #ifndef __USE_FILE_OFFSET64
     __off_t l_start;	/* Offset where the lock begins.  */
     __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#if _MIPS_SIM != _MIPS_SIM_ABI64
+#if _MIPS_SIM != _ABI64
     /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit
        fcntls in o32 and n32, never has this field.  */
     long int l_sysid;
@@ -154,7 +154,7 @@ typedef struct flock
     __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
 #endif
     __pid_t l_pid;	/* Process holding the lock.  */
-#if ! defined __USE_FILE_OFFSET64 && _MIPS_SIM != _MIPS_SIM_ABI64
+#if ! defined __USE_FILE_OFFSET64 && _MIPS_SIM != _ABI64
     /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit
        flock in o32 and n32, never has this field.  */
     long int pad[4];
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h b/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
index 19f58812df..079964ed46 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
@@ -34,7 +34,7 @@
    licenses, the fact that the file is pasted, instead of included,
    doesn't really make any difference for the program that includes
    this header.  */
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 /*
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -70,7 +70,7 @@ struct sigcontext {
 };
 
 #endif /* _ASM_SIGCONTEXT_H */
-#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */
+#else /* _MIPS_SIM != _ABIO32 */
 /*
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -101,5 +101,5 @@ struct sigcontext {
 };
 
 #endif /* _ASM_SIGCONTEXT_H */
-#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
+#endif /* _MIPS_SIM != _ABIO32 */
 #endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/siginfo.h b/sysdeps/unix/sysv/linux/mips/bits/siginfo.h
index 629a055640..54eba41d6e 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/siginfo.h
@@ -1,5 +1,6 @@
 /* siginfo_t, sigevent and constants.  Linux/MIPS version.
-   Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004
+	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
@@ -22,6 +23,8 @@
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#include <bits/wordsize.h>
+
 #if (!defined __have_sigval_t \
      && (defined _SIGNAL_H || defined __need_siginfo_t \
 	 || defined __need_sigevent_t))
@@ -39,8 +42,13 @@ typedef union sigval
      && (defined _SIGNAL_H || defined __need_siginfo_t))
 # define __have_siginfo_t	1
 
-# define __SI_MAX_SIZE     128
-# define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# define __SI_MAX_SIZE		128
+# if __WORDSIZE == 64
+#  define __SI_PAD_SIZE		((__SI_MAX_SIZE / sizeof (int)) - 4)
+# else
+#  define __SI_PAD_SIZE		((__SI_MAX_SIZE / sizeof (int)) - 3)
+# endif
+
 
 typedef struct siginfo
   {
@@ -48,6 +56,8 @@ typedef struct siginfo
     int si_code;		/* Signal code.  */
     int si_errno;		/* If non-zero, an errno value associated with
 				   this signal, as defined in <errno.h>.  */
+    int __pad0[__SI_MAX_SIZE / sizeof (int) - __SI_PAD_SIZE - 3];
+				/* Explicit padding.  */
 
     union
       {
@@ -121,9 +131,9 @@ enum
 {
   SI_ASYNCNL = -60,		/* Sent by asynch name lookup completion.  */
 # define SI_ASYNCNL	SI_ASYNCNL
-  SI_TKILL = -6,		/* Sent by tkill. */
+  SI_TKILL = -6,		/* Sent by tkill.  */
 # define SI_TKILL	SI_TKILL
-  SI_SIGIO,			/* Sent by queued SIGIO. */
+  SI_SIGIO,			/* Sent by queued SIGIO.  */
 # define SI_SIGIO	SI_SIGIO
   SI_MESGQ,			/* Sent by real time mesq state change.  */
 # define SI_MESGQ	SI_MESGQ
@@ -149,7 +159,7 @@ enum
 # define ILL_ILLOPN	ILL_ILLOPN
   ILL_ILLADR,			/* Illegal addressing mode.  */
 # define ILL_ILLADR	ILL_ILLADR
-  ILL_ILLTRP,			/* Illegal trap. */
+  ILL_ILLTRP,			/* Illegal trap.  */
 # define ILL_ILLTRP	ILL_ILLTRP
   ILL_PRVOPC,			/* Privileged opcode.  */
 # define ILL_PRVOPC	ILL_PRVOPC
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
index 2dd4cab85c..9ae38cd8d0 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -36,7 +36,7 @@
 #define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
 
 
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 /* Structure describing file characteristics.  */
 struct stat
   {
diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure
index 8ee636fb99..c081795aa1 100755
--- a/sysdeps/unix/sysv/linux/mips/configure
+++ b/sysdeps/unix/sysv/linux/mips/configure
@@ -42,7 +42,7 @@ BEGIN { print "#include <sgidefs.h>"; }
 	name = $2;
 	sub (/_O32_/, "_", name);
 	print;
-	print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
+	print "#if _MIPS_SIM == _ABIO32";
 	print "# define " name " " $2;
 	print "#endif";
 	next;
@@ -51,7 +51,7 @@ BEGIN { print "#include <sgidefs.h>"; }
 	name = $2;
 	sub (/_N32_/, "_", name);
 	print;
-	print "#if _MIPS_SIM == _MIPS_SIM_NABI32";
+	print "#if _MIPS_SIM == _ABIN32";
 	print "# define " name " " $2;
 	print "#endif";
 	next;
@@ -60,7 +60,7 @@ BEGIN { print "#include <sgidefs.h>"; }
 	name = $2;
 	sub (/_N64_/, "_", name);
 	print;
-	print "#if _MIPS_SIM == _MIPS_SIM_ABI64";
+	print "#if _MIPS_SIM == _ABI64";
 	print "# define " name " " $2;
 	print "#endif";
 	next;
diff --git a/sysdeps/unix/sysv/linux/mips/configure.in b/sysdeps/unix/sysv/linux/mips/configure.in
index 6783bc2b4a..67d965dfda 100644
--- a/sysdeps/unix/sysv/linux/mips/configure.in
+++ b/sysdeps/unix/sysv/linux/mips/configure.in
@@ -42,7 +42,7 @@ BEGIN { print "#include <sgidefs.h>"; }
 	name = $2;
 	sub (/_O32_/, "_", name);
 	print;
-	print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
+	print "#if _MIPS_SIM == _ABIO32";
 	print "# define " name " " $2;
 	print "#endif";
 	next;
@@ -51,7 +51,7 @@ BEGIN { print "#include <sgidefs.h>"; }
 	name = $2;
 	sub (/_N32_/, "_", name);
 	print;
-	print "#if _MIPS_SIM == _MIPS_SIM_NABI32";
+	print "#if _MIPS_SIM == _ABIN32";
 	print "# define " name " " $2;
 	print "#endif";
 	next;
@@ -60,7 +60,7 @@ BEGIN { print "#include <sgidefs.h>"; }
 	name = $2;
 	sub (/_N64_/, "_", name);
 	print;
-	print "#if _MIPS_SIM == _MIPS_SIM_ABI64";
+	print "#if _MIPS_SIM == _ABI64";
 	print "# define " name " " $2;
 	print "#endif";
 	next;
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h
index 6a4c4093d8..cab1e7110e 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel_stat.h
@@ -3,7 +3,7 @@
    userland data structures are not identical, because of different
    padding.  */
 /* Definition of `struct stat' used in the kernel.  */
-#if _MIPS_SIM != _MIPS_SIM_ABI32
+#if _MIPS_SIM != _ABIO32
 struct kernel_stat
   {
     unsigned int st_dev;
diff --git a/sysdeps/unix/sysv/linux/mips/pread.c b/sysdeps/unix/sysv/linux/mips/pread.c
index 8fba0340b8..d0947bea42 100644
--- a/sysdeps/unix/sysv/linux/mips/pread.c
+++ b/sysdeps/unix/sysv/linux/mips/pread.c
@@ -20,6 +20,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <sgidefs.h>
 #include <unistd.h>
 #include <endian.h>
 
@@ -55,14 +56,14 @@ __libc_pread (fd, buf, count, offset)
 {
   ssize_t result;
 
-#if _MIPS_SIM != _MIPS_SIM_ABI64
+#if _MIPS_SIM != _ABI64
   assert (sizeof (offset) == 4);
 #endif
 
   if (SINGLE_THREAD_P)
     {
       /* First try the syscall.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
       result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
 			       offset);
 #else
@@ -80,7 +81,7 @@ __libc_pread (fd, buf, count, offset)
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   /* First try the syscall.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
   result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
 #else
   result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
diff --git a/sysdeps/unix/sysv/linux/mips/pread64.c b/sysdeps/unix/sysv/linux/mips/pread64.c
index 238c8e0d8b..e8a45da5b1 100644
--- a/sysdeps/unix/sysv/linux/mips/pread64.c
+++ b/sysdeps/unix/sysv/linux/mips/pread64.c
@@ -19,6 +19,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <sgidefs.h>
 #include <unistd.h>
 #include <endian.h>
 
@@ -58,7 +59,7 @@ __libc_pread64 (fd, buf, count, offset)
   if (SINGLE_THREAD_P)
     {
      /* First try the syscall.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
       result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
 			       offset);
 #else
@@ -77,7 +78,7 @@ __libc_pread64 (fd, buf, count, offset)
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   /* First try the syscall.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
   result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
 #else
   result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
diff --git a/sysdeps/unix/sysv/linux/mips/ptrace.c b/sysdeps/unix/sysv/linux/mips/ptrace.c
index af8266d78f..19d7c2d927 100644
--- a/sysdeps/unix/sysv/linux/mips/ptrace.c
+++ b/sysdeps/unix/sysv/linux/mips/ptrace.c
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <sgidefs.h>
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <sys/user.h>
@@ -28,7 +29,7 @@
 #include <bp-checks.h>
 #include <sgidefs.h>
 
-#if  _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _ABIN32
 __extension__ typedef long long int reg_type;
 #else
 typedef long int reg_type;
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite.c b/sysdeps/unix/sysv/linux/mips/pwrite.c
index d0e3fe538e..130515af6d 100644
--- a/sysdeps/unix/sysv/linux/mips/pwrite.c
+++ b/sysdeps/unix/sysv/linux/mips/pwrite.c
@@ -20,6 +20,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <sgidefs.h>
 #include <unistd.h>
 #include <endian.h>
 
@@ -55,14 +56,14 @@ __libc_pwrite (fd, buf, count, offset)
 {
   ssize_t result;
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM != _ABI64
   assert (sizeof (offset) == 4);
 #endif
 
   if (SINGLE_THREAD_P)
     {
       /* First try the syscall.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
       result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
 			       offset);
 #else
@@ -80,7 +81,7 @@ __libc_pwrite (fd, buf, count, offset)
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   /* First try the syscall.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
   result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
 #else
   result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite64.c b/sysdeps/unix/sysv/linux/mips/pwrite64.c
index 109b2c5946..e4908fa779 100644
--- a/sysdeps/unix/sysv/linux/mips/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/mips/pwrite64.c
@@ -19,6 +19,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <sgidefs.h>
 #include <unistd.h>
 #include <endian.h>
 
@@ -54,7 +55,7 @@ __libc_pwrite64 (fd, buf, count, offset)
   if (SINGLE_THREAD_P)
     {
      /* First try the syscall.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
       result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
 			       offset);
 #else
@@ -74,7 +75,7 @@ __libc_pwrite64 (fd, buf, count, offset)
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   /* First try the syscall.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
   result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
 #else
   result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
diff --git a/sysdeps/unix/sysv/linux/mips/sigaction.c b/sysdeps/unix/sysv/linux/mips/sigaction.c
index 83b71debc9..09fbe79316 100644
--- a/sysdeps/unix/sysv/linux/mips/sigaction.c
+++ b/sysdeps/unix/sysv/linux/mips/sigaction.c
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <sgidefs.h>
 #include <signal.h>
 #include <string.h>
 
@@ -40,7 +41,7 @@ int __libc_missing_rt_sigs;
 
 #endif
 
-#if _MIPS_SIM != _MIPS_SIM_ABI32
+#if _MIPS_SIM != _ABIO32
 
 # ifdef __NR_rt_sigreturn
 static void restore_rt (void) asm ("__restore_rt");
@@ -82,7 +83,7 @@ __libc_sigaction (sig, act, oact)
 	  memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kernel_sigset_t));
 	  kact.sa_flags = act->sa_flags;
 # ifdef HAVE_SA_RESTORER
-#  if _MIPS_SIM == _MIPS_SIM_ABI32
+#  if _MIPS_SIM == _ABIO32
 	  kact.sa_restorer = act->sa_restorer;
 #  else
 	  kact.sa_restorer = &restore_rt;
@@ -140,7 +141,7 @@ __libc_sigaction (sig, act, oact)
       oact->sa_mask.__val[0] = k_osigact.sa_mask;
       oact->sa_flags = k_osigact.sa_flags;
 # ifdef HAVE_SA_RESTORER
-#  if _MIPS_SIM == _MIPS_SIM_ABI32
+#  if _MIPS_SIM == _ABIO32
       oact->sa_restorer = k_osigact.sa_restorer;
 #  else
       oact->sa_restorer = &restore;
@@ -177,7 +178,7 @@ asm						\
    );
 
 /* The return code for realtime-signals.  */
-#if _MIPS_SIM != _MIPS_SIM_ABI32
+#if _MIPS_SIM != _ABIO32
 # ifdef __NR_rt_sigreturn
 RESTORE (restore_rt, __NR_rt_sigreturn)
 # endif
diff --git a/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h b/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
index 2b50647c4c..f453c8d9b5 100644
--- a/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
@@ -20,7 +20,7 @@
 
 #include <sgidefs.h>
 
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 
 #define SIGCONTEXT unsigned long _code, struct sigcontext *
 #define SIGCONTEXT_EXTRA_ARGS _code,
diff --git a/sysdeps/unix/sysv/linux/mips/sys/procfs.h b/sysdeps/unix/sysv/linux/mips/sys/procfs.h
index cb84677175..2bf07be3e9 100644
--- a/sysdeps/unix/sysv/linux/mips/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/mips/sys/procfs.h
@@ -25,6 +25,7 @@
    used on Linux.  */
 
 #include <features.h>
+#include <sgidefs.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/user.h>
@@ -34,7 +35,7 @@
 #define ELF_NGREG	45
 #define ELF_NFPREG	33
 
-#if _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _ABIN32
 __extension__ typedef unsigned long long elf_greg_t;
 #else
 typedef unsigned long elf_greg_t;
@@ -65,7 +66,7 @@ struct elf_prstatus
   {
     struct elf_siginfo pr_info;		/* Info associated with signal.  */
     short int pr_cursig;		/* Current signal.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _ABIN32
     __extension__ unsigned long long int pr_sigpend;
     __extension__ unsigned long long int pr_sighold;
 #else
@@ -93,7 +94,7 @@ struct elf_prpsinfo
     char pr_sname;			/* Char for pr_state.  */
     char pr_zomb;			/* Zombie.  */
     char pr_nice;			/* Nice val.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _ABIN32
     __extension__ unsigned long long int pr_flag;
 #else
     unsigned long int pr_flag;		/* Flags.  */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/ptrace.h b/sysdeps/unix/sysv/linux/mips/sys/ptrace.h
index 9badeb3a82..d05853da77 100644
--- a/sysdeps/unix/sysv/linux/mips/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/mips/sys/ptrace.h
@@ -124,7 +124,7 @@ enum __ptrace_request
    appear (those that are used for the particular request) as:
      pid_t PID, void *ADDR, int DATA, void *ADDR2
    after REQUEST.  */
-#if _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _ABIN32
 __extension__ extern long long int ptrace
   (enum __ptrace_request __request, ...) __THROW;
 #else
diff --git a/sysdeps/unix/sysv/linux/mips/sys/tas.h b/sysdeps/unix/sysv/linux/mips/sys/tas.h
index 006e1614c7..e5180f9475 100644
--- a/sysdeps/unix/sysv/linux/mips/sys/tas.h
+++ b/sysdeps/unix/sysv/linux/mips/sys/tas.h
@@ -21,7 +21,6 @@
 #define _SYS_TAS_H 1
 
 #include <features.h>
-
 #include <sgidefs.h>
 
 __BEGIN_DECLS
@@ -43,7 +42,7 @@ _test_and_set (int *p, int v) __THROW
     ("/* Inline test and set */\n"
      "1:\n\t"
      ".set	push\n\t"
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
      ".set	mips2\n\t"
 #endif
      "ll	%0,%3\n\t"
diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
index c03566b1ff..ddb499f20c 100644
--- a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
@@ -22,14 +22,13 @@
 #define _SYS_UCONTEXT_H	1
 
 #include <features.h>
+#include <sgidefs.h>
 #include <signal.h>
 
 /* We need the signal context definitions even if they are not used
    included in <signal.h>.  */
 #include <bits/sigcontext.h>
 
-#include <sgidefs.h>
-
 /* Type for general register.  Even in o32 we assume 64-bit registers,
    like the kernel.  */
 __extension__ typedef unsigned long long int greg_t;
@@ -54,7 +53,7 @@ typedef struct fpregset {
 
 
 /* Context to describe whole processor state.  */
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 /* Earlier versions of glibc for mips had an entirely different
    definition of mcontext_t, that didn't even resemble the
    corresponding kernel data structure.  Since all legitimate uses of
diff --git a/sysdeps/unix/sysv/linux/mips/sys/user.h b/sysdeps/unix/sysv/linux/mips/sys/user.h
index dc3ee837d3..d5b3b0508b 100644
--- a/sysdeps/unix/sysv/linux/mips/sys/user.h
+++ b/sysdeps/unix/sysv/linux/mips/sys/user.h
@@ -32,7 +32,7 @@
    instead of included separately, doesn't change in any way the
    licensing status of a program that includes user.h.  Since this is
    for gdb alone, and gdb is GPLed, no surprises here.  */
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 /*
  * Various register offset definitions for debuggers, core file
  * examiners and whatnot.
@@ -100,7 +100,7 @@
 
 #endif /* __ASM_MIPS_REG_H */
 
-#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */
+#else /* _MIPS_SIM != _ABIO32 */
 
 /*
  * Various register offset definitions for debuggers, core file
@@ -170,9 +170,9 @@
 
 #endif /* _ASM_REG_H */
 
-#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
+#endif /* _MIPS_SIM != _ABIO32 */
 
-#if _MIPS_SIM == _MIPS_SIM_ABI32
+#if _MIPS_SIM == _ABIO32
 
 struct user
 {