diff -ruN glibc-2.0.7/Makeconfig glibc-2.0.7-patched/Makeconfig
--- glibc-2.0.7/Makeconfig	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/Makeconfig	Wed Jun  7 15:41:44 2000
@@ -389,12 +389,11 @@
 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
 				       $(filter -Wl$(comma)-rpath-link=%,\
 						$(sysdep-LDFLAGS)))))
-#define built-program-cmd
-#$(elf-objpfx)$(rtld-installed-name) \
-#  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-#  $(built-program-file)
-#endef
-built-program-cmd = $(built-program-file)
+define built-program-cmd
+$(elf-objpfx)$(rtld-installed-name) \
+  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+  $(built-program-file)
+endef
 endif
 
 ifndef LD
diff -ruN glibc-2.0.7/elf/ldconfig.c glibc-2.0.7-patched/elf/ldconfig.c
--- glibc-2.0.7/elf/ldconfig.c	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/elf/ldconfig.c	Wed Dec 31 16:00:00 1969
@@ -1,869 +0,0 @@
-/*
- * ldconfig - update shared library symlinks
- *
- * usage: ldconfig [-DvnNX] [-f conf] [-C cache] dir ...
- *        ldconfig -l [-Dv] lib ...
- *        ldconfig -p
- *        -D: debug mode, don't update links
- *        -v: verbose mode, print things as we go
- *        -n: don't process standard directories
- *        -N: don't update the library cache
- *        -X: don't update the library links
- *        -l: library mode, manually link libraries
- *        -p: print the current library cache
- *        -f conf: use conf instead of /etc/ld.so.conf
- *        -C cache: us cache instead of /etc/ld.so.cache
- *        dir ...: directories to process
- *        lib ...: libraries to link
- *
- * Copyright 1994-1996 David Engel and Mitch D'Souza
- *
- * This program may be used for any purpose as long as this
- * copyright notice is kept.
- */
-
-#include <stdio.h>
-#include <alloca.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <getopt.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <a.out.h>
-#include <link.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-#define VERSION		"970402"
-
-/* default config file */
-#ifndef LDSO_CONF
-#define LDSO_CONF	"/etc/ld.so.conf"
-#endif
-/* default cache file */
-#ifndef LDSO_CACHE
-#define LDSO_CACHE	"/etc/ld.so.cache"
-#endif
-
-#ifndef LDSO_CACHE_MAGIC
-#define LDSO_CACHE_MAGIC	"ld.so-"
-#endif
-#define LDSO_CACHE_MAGIC_LEN	(sizeof LDSO_CACHE_MAGIC -1)
-#ifndef LDSO_CACHE_VER
-#define LDSO_CACHE_VER		"1.7.0"
-#endif
-#define LDSO_CACHE_VER_LEN	(sizeof LDSO_CACHE_VER -1)
-
-#define DIR_SEP		":, \t\n"
-
-#define LIB_DLL		0
-#define LIB_ELF		1
-#define LIB_ELF_LIBC5	2
-#define LIB_ELF_LIBC6	3
-
-char *___strtok = NULL;
-
-/* For SunOS */
-#ifndef PATH_MAX
-#include <limits.h>
-#define PATH_MAX _POSIX_PATH_MAX
-#endif
-
-/* For SunOS */
-#ifndef N_MAGIC
-#define N_MAGIC(exec) ((exec).a_magic & 0xffff)
-#endif
-
-#define EXIT_OK    0
-#define EXIT_FATAL 128
-
-static char *prog = NULL;
-static int debug = 0;		/* debug mode */
-static int verbose = 0;		/* verbose mode */
-static int libmode = 0;		/* library mode */
-static int nocache = 0;		/* don't build cache */
-static int nolinks = 0;		/* don't update links */
-
-static const char *conffile = LDSO_CONF;	/* default config file */
-static const char *cachefile = LDSO_CACHE;	/* default cache file */
-static void cache_print(void);
-static void cache_dolib(const char *dir, const char *so, int libtype);
-static void cache_write(void);
-
-static char *readsoname(char *name, FILE *file, int *type);
-
-static void warn(const char *fmt, ...)
-{
-    va_list ap;
-
-    fprintf(stderr, "%s: warning: ", prog);
-
-    va_start(ap, fmt);
-    vfprintf(stderr, fmt, ap);
-    va_end(ap);
-
-    fprintf(stderr, "\n");
-
-    return;
-}
-
-static void error(const char *fmt, ...)
-{
-    va_list ap;
-
-    fprintf(stderr, "%s: ", prog);
-
-    va_start(ap, fmt);
-    vfprintf(stderr, fmt, ap);
-    va_end(ap);
-
-    fprintf(stderr, "\n");
-
-    exit(EXIT_FATAL);
-}
-
-static void *xmalloc(size_t size)
-{
-    void *ptr;
-    if ((ptr = malloc(size)) == NULL)
-	error("out of memory");
-    return ptr;
-}
-
-static char *xstrdup(const char *str)
-{
-    char *ptr;
-    char *strdup(const char *);
-    if ((ptr = strdup(str)) == NULL)
-	error("out of memory");
-    return ptr;
-}
-
-/* if shared library, return a malloced copy of the soname and set the
-   type, else return NULL */
-static char *is_shlib(const char *dir, const char *name, int *type,
-	int *islink)
-{
-    char *good = NULL;
-    char *cp, *cp2;
-    FILE *file;
-    struct exec exec;
-    const ElfW(Ehdr) *elf_hdr;
-    struct stat statbuf;
-    char buff[4096];
-
-    /* see if name is of the form libZ.so* */
-    if ((strncmp(name, "lib", 3) == 0 || strncmp(name, "ld-", 3) == 0) && \
-	name[strlen(name)-1] != '~' && (cp = strstr(name, ".so")))
-    {
-	/* find the start of the Vminor part, if any */
-	if (cp[3] == '.' && (cp2 = strchr(cp + 4, '.')))
-	    cp = cp2;
-	else
-	    cp = cp + strlen(cp);
-
-	/* construct the full path name */
-	sprintf(buff, "%s%s%s", dir, (*dir && strcmp(dir, "/")) ?
-		"/" : "", name);
-
-	/* first, make sure it's a regular file */
-	if (lstat(buff, &statbuf))
-	    warn("can't lstat %s (%s), skipping", buff, strerror(errno));
-	else if (!S_ISREG(statbuf.st_mode) && !S_ISLNK(statbuf.st_mode))
-	    warn("%s is not a regular file or symlink, skipping", 
-		 buff, strerror(errno));
-	else
-	{
-	    /* is it a regular file or a symlink */
-	    *islink = S_ISLNK(statbuf.st_mode);
-
-	    /* then try opening it */
-	    if (!(file = fopen(buff, "rb")))
-		warn("can't open %s (%s), skipping", buff, strerror(errno));
-	    else
-	    {
-		/* now make sure it's a shared library */
-		if (fread(&exec, sizeof exec, 1, file) < 1)
-		    warn("can't read header from %s, skipping", buff);
-		else if (N_MAGIC(exec) != ZMAGIC && N_MAGIC(exec) != QMAGIC)
-		{
-		    elf_hdr = (const ElfW(Ehdr) *) &exec;
-		    if (elf_hdr->e_ident[0] != 0x7f ||
-			strncmp(&elf_hdr->e_ident[1], "ELF",3) != 0)
-		    {
-		        /* silently ignore linker scripts */
-		        if (strncmp((char *)&exec, "/* GNU ld", 9) != 0)
-			    warn("%s is not a shared library, skipping", buff);
-		    }
-		    else
-		    {
-		        /* always call readsoname to update type */
-		        *type = LIB_ELF;
-		        good = readsoname(buff, file, type);
-			if (good == NULL || *islink)
-			{
-			    if (good != NULL)
-				free(good);
-			    good = xstrdup(name);
-			}
-			else
-			{
-			    /* if the soname does not match the filename,
-			       issue a warning, but only in debug mode. */
-			    int len = strlen(good);
-			    if (debug && (strncmp(good, name, len) != 0 ||
-				(name[len] != '\0' && name[len] != '.')))
-				warn("%s has inconsistent soname (%s)",
-				     buff, good);
-			}
-		    }
-		}
-		else
-		{
-		    if (*islink)
-			good = xstrdup(name);
-		    else
-		    {
-			good = xmalloc(cp - name + 1);
-			strncpy(good, name, cp - name);
-			good[cp - name] = '\0';
-		    }
-		    *type = LIB_DLL;
-		}
-		fclose(file);
-	    }
-	}
-    }
-
-    return good;
-}
-
-/* update the symlink to new library */
-static void link_shlib(const char *dir, const char *file, const char *so)
-{
-    int change = -1;
-    char libname[4096];
-    char linkname[4096];
-    struct stat libstat;
-    struct stat linkstat;
-
-    /* construct the full path names */
-    sprintf(libname, "%s/%s", dir, file);
-    sprintf(linkname, "%s/%s", dir, so);
-
-    /* see if a link already exists */
-    if (!stat(linkname, &linkstat))
-    {
-	/* now see if it's the one we want */
-	if (stat(libname, &libstat))
-	    warn("can't stat %s (%s)", libname, strerror(errno));
-	else if (libstat.st_dev == linkstat.st_dev &&
-	    libstat.st_ino == linkstat.st_ino)
-	    change = 0;
-    }
-
-    /* then update the link, if required */
-    if (change && !nolinks)
-    {
-	if (!lstat(linkname, &linkstat) && remove(linkname))
-	    warn("can't unlink %s (%s)", linkname, strerror(errno));
-	else if (symlink(file, linkname))
-	    warn("can't link %s to %s (%s)", linkname, file, strerror(errno));
-	else
-	    change = 1;
-    }
-
-    /* some people like to know what we're doing */
-    if (verbose)
-	printf("\t%s => %s%s\n", so, file,
-	       change < 0 ? " (SKIPPED)" :
-	       (change > 0 ? " (changed)" : ""));
-
-    return;
-}
-
-/* figure out which library is greater */
-static int libcmp(char *p1, char *p2)
-{
-    while (*p1)
-    {
-	if (isdigit(*p1) && isdigit(*p2))
-	{
-	    /* must compare this numerically */
-	    int v1, v2;
-	    v1 = strtoul(p1, &p1, 10);
-	    v2 = strtoul(p2, &p2, 10);
-	    if (v1 != v2)
-		return v1 - v2;
-	}
-	else if (isdigit(*p1) && !isdigit(*p2))
-	    return 1;
-	else if (!isdigit(*p1) && isdigit(*p2))
-	    return -1;
-	else if (*p1 != *p2)
-	    return *p1 - *p2;
-	else
-	    p1++, p2++;
-    }
-
-    return *p1 - *p2;
-}
-
-struct lib
-{
-    char *so;			/* soname of a library */
-    char *name;			/* name of a library */
-    int libtype;		/* type of a library */
-    int islink;			/* is it a symlink */
-    struct lib *next;		/* next library in list */
-};
-
-/* update all shared library links in a directory */
-static void scan_dir(const char *name)
-{
-    DIR *dir;
-    struct dirent *ent;
-    char *so;
-    struct lib *lp, *libs = NULL;
-    int libtype, islink;
-
-    /* let 'em know what's going on */
-    if (verbose)
-	printf("%s:\n", name);
-
-    /* if we can't open it, we can't do anything */
-    if ((dir = opendir(name)) == NULL)
-    {
-	warn("can't open %s (%s), skipping", name, strerror(errno));
-	return;
-    }
-
-    /* yes, we have to look at every single file */
-    while ((ent = readdir(dir)) != NULL)
-    {
-	/* if it's not a shared library, don't bother */
-	if ((so = is_shlib(name, ent->d_name, &libtype, &islink)) == NULL)
-	    continue;
-
-	/* have we already seen one with the same so name? */
-	for (lp = libs; lp; lp = lp->next)
-	{
-	    if (strcmp(so, lp->so) == 0)
-	    {
-	        /* we have, which one do we want to use? */
-	        if ((!islink && lp->islink) ||
-		    (islink == lp->islink && 
-		     libcmp(ent->d_name, lp->name) > 0))
-		{
-		    /* let's use the new one */
-		    free(lp->name);
-		    lp->name = xstrdup(ent->d_name);
-		    lp->libtype = libtype;
-		    lp->islink = islink;
-		} 
-		break;
-	    }
-	}
-
-	/* congratulations, you're the first one we've seen */
-	if (!lp)
-	{
-	    lp = xmalloc(sizeof *lp);
-	    lp->so = xstrdup(so);
-	    lp->name = xstrdup(ent->d_name);
-	    lp->libtype = libtype;
-	    lp->islink = islink;
-	    lp->next = libs;
-	    libs = lp;
-	}
-
-	free(so);
-    }
-
-    /* don't need this any more */
-    closedir(dir);
-
-    /* now we have all the latest libs, update the links */
-    for (lp = libs; lp; lp = lp->next)
-    {
-        if (!lp->islink)
-	    link_shlib(name, lp->name, lp->so);
-	if (!nocache)
-	    cache_dolib(name, lp->so, lp->libtype);
-    }
-
-    /* always try to clean up after ourselves */
-    while (libs)
-    {
-	lp = libs->next;
-	free(libs->so);
-	free(libs->name);
-	free(libs);
-	libs = lp;
-    }
-
-    return;
-}
-
-/* return the list of system-specific directories */
-static char *get_extpath(void)
-{
-    char *res = NULL, *cp;
-    FILE *file;
-    struct stat stat;
-
-    if ((file = fopen(conffile, "r")) != NULL)
-    {
-	fstat(fileno(file), &stat);
-	res = xmalloc(stat.st_size + 1);
-	fread(res, 1, stat.st_size, file);
-	fclose(file);
-	res[stat.st_size] = '\0';
-
-	/* convert comments fo spaces */
-	for (cp = res; *cp; /*nada*/) {
-	  if (*cp == '#') {
-	    do
-	      *cp++ = ' ';
-	    while (*cp && *cp != '\n');
-	  } else {
-	    cp++;
-	  }
-	}	  
-    }
-
-    return res;
-}
-
-int main(int argc, char **argv)
-{
-    int i, c;
-    int nodefault = 0;
-    int printcache = 0;
-    char *cp, *so;
-    const char *dir;
-    char *extpath;
-    int libtype, islink;
-
-    prog = argv[0];
-    opterr = 0;
-
-    while ((c = getopt(argc, argv, "DdvnNXlpf:C:")) != EOF)
-	switch (c)
-	{
-	case 'D':
-	    debug = 1;		/* debug mode */
-	    nocache = 1;
-	    nolinks = 1;
-	    verbose = 1;
-	    break;
-	case 'd':		/* obsolete, for dynamic linker. */
-	    break;
-	case 'v':
-	    verbose = 1;	/* verbose mode */
-	    break;
-	case 'n':
-	    nodefault = 1;	/* no default dirs */
-	    nocache = 1;
-	    break;
-	case 'N':
-	    nocache = 1;	/* don't build cache */
-	    break;
-	case 'X':
-	    nolinks = 1;	/* don't update links */
-	    break;
-	case 'l':
-	    libmode = 1;	/* library mode */
-	    break;
-	case 'p':
-	    printcache = 1;	/* print cache */
-	    break;
-	case 'f':
-	    conffile = optarg;	/* alternate conf file */
-	    break;
-	case 'C':
-	    cachefile = optarg;	/* alternate cache file */
-	    break;
-	default:
-	    fprintf(stderr, "usage: %s [-DvnNX] [-f conf] [-C cache] dir ...\n", prog);
-	    fprintf(stderr, "       %s -l [-Dv] lib ...\n", prog);
-	    fprintf(stderr, "       %s -p\n", prog);
-	    exit(EXIT_FATAL);
-	    break;
-
-	/* THE REST OF THESE ARE UNDOCUMENTED AND MAY BE REMOVED
-	   IN FUTURE VERSIONS. */
-	}
-
-    /* allow me to introduce myself, hi, my name is ... */
-    if (verbose)
-	printf("%s: version %s\n", argv[0], VERSION);
-
-    if (printcache)
-    {
-	/* print the cache -- don't you trust me? */
-	cache_print();
-	exit(EXIT_OK);
-    }
-    else if (libmode)
-    {
-	/* so you want to do things manually, eh? */
-
-	/* ok, if you're so smart, which libraries do we link? */
-	for (i = optind; i < argc; i++)
-	{
-	    /* split into directory and file parts */
-	    if (!(cp = strrchr(argv[i], '/')))
-	    {
-		dir = "";	/* no dir, only a filename */
-		cp = argv[i];
-	    }
-	    else
-	    {
-		if (cp == argv[i])
-		    dir = "/";	/* file in root directory */
-		else
-		    dir = argv[i];
-		*cp++ = '\0';	/* neither of the above */
-	    }
-
-	    /* we'd better do a little bit of checking */
-	    if ((so = is_shlib(dir, cp, &libtype, &islink)) == NULL)
-		error("%s%s%s is not a shared library", dir,
-		      (*dir && strcmp(dir, "/")) ? "/" : "", cp);
-
-	    /* so far, so good, maybe he knows what he's doing */
-	    link_shlib(dir, cp, so);
-	}
-    }
-    else
-    {
-	/* the lazy bum want's us to do all the work for him */
-
-	/* don't cache dirs on the command line */
-	int nocache_save = nocache;
-	nocache = 1;
-
-	/* OK, which directories should we do? */
-	for (i = optind; i < argc; i++)
-	    scan_dir(argv[i]);
-
-	/* restore the desired caching state */
-	nocache = nocache_save;
-
-	/* look ma, no defaults */
-	if (!nodefault)
-	{
-	    /* I guess the defaults aren't good enough */
-	    if ((extpath = get_extpath()))
-	    {
-		for (cp = strtok(extpath, DIR_SEP); cp;
-		     cp = strtok(NULL, DIR_SEP))
-		    scan_dir(cp);
-		free(extpath);
-	    }
-
-	    /* everybody needs these, don't they? */
-	    scan_dir("/usr/lib");
-	    scan_dir("/lib");
-	}
-
-	if (!nocache)
-	    cache_write();
-    }
-
-    exit(EXIT_OK);
-}
-
-typedef struct liblist
-{
-    int flags;
-    int sooffset;
-    int liboffset;
-    char *soname;
-    char *libname;
-    struct liblist *next;
-} liblist_t;
-
-typedef struct
-{
-    int flags;
-    int sooffset;
-    int liboffset;
-} libentry_t;
-
-typedef struct
-{
-    char magic   [LDSO_CACHE_MAGIC_LEN];
-    char version [LDSO_CACHE_VER_LEN];
-    int nlibs;
-} header_t;
-
-static header_t magic = { LDSO_CACHE_MAGIC, LDSO_CACHE_VER, 0 };
-static liblist_t *lib_head = NULL;
-
-static int liblistcomp(liblist_t *x, liblist_t *y)
-{
-    int res;
-
-    if ((res = libcmp(x->soname, y->soname)) == 0)
-    {
-        res = libcmp(strrchr(x->libname, '/') + 1,
-		     strrchr(y->libname, '/') + 1);
-    }
-
-    return res;
-}
-
-static void cache_dolib(const char *dir, const char *so, int libtype)
-{
-    char fullpath[PATH_MAX];
-    liblist_t *new_lib, *cur_lib;
-
-    magic.nlibs++;
-    sprintf(fullpath, "%s/%s", dir, so);
-    new_lib = xmalloc(sizeof (liblist_t));
-    new_lib->flags = libtype;
-    new_lib->soname = xstrdup(so);
-    new_lib->libname = xstrdup(fullpath);
-
-    if (lib_head == NULL || liblistcomp(new_lib, lib_head) > 0)
-    {
-        new_lib->next = lib_head;
-	lib_head = new_lib;
-    }
-    else
-    {
-        for (cur_lib = lib_head; cur_lib->next != NULL &&
-	     liblistcomp(new_lib, cur_lib->next) <= 0;
-	     cur_lib = cur_lib->next)
-	    /* nothing */;
-	new_lib->next = cur_lib->next;
-	cur_lib->next = new_lib;
-    }
-}
-
-static void cache_write(void)
-{
-    int cachefd;
-    int stroffset = 0;
-    char tempfile[4096];
-    liblist_t *cur_lib;
-
-    if (!magic.nlibs)
-	return;
-
-    sprintf(tempfile, "%s~", cachefile);
-
-    if (unlink(tempfile) && errno != ENOENT)
-        error("can't unlink %s (%s)", tempfile, strerror(errno));
-
-    if ((cachefd = creat(tempfile, 0644)) < 0)
-	error("can't create %s (%s)", tempfile, strerror(errno));
-
-    if (write(cachefd, &magic, sizeof (header_t)) != sizeof (header_t))
-	error("can't write %s (%s)", tempfile, strerror(errno));
-
-    for (cur_lib = lib_head; cur_lib != NULL; cur_lib = cur_lib->next)
-    {
-        cur_lib->sooffset = stroffset;
-	stroffset += strlen(cur_lib->soname) + 1;
-	cur_lib->liboffset = stroffset;
-	stroffset += strlen(cur_lib->libname) + 1;
-	if (write(cachefd, cur_lib, sizeof (libentry_t)) !=
-	    sizeof (libentry_t))
-	    error("can't write %s (%s)", tempfile, strerror(errno));
-    }
-
-    for (cur_lib = lib_head; cur_lib != NULL; cur_lib = cur_lib->next)
-    {
-      if (write(cachefd, cur_lib->soname, strlen(cur_lib->soname) + 1)
-	  != strlen(cur_lib->soname) + 1)
-	  error("can't write %s (%s)", tempfile, strerror(errno));
-      if (write(cachefd, cur_lib->libname, strlen(cur_lib->libname) + 1)
-	  != strlen(cur_lib->libname) + 1)
-	  error("can't write %s (%s)", tempfile, strerror(errno));
-    }
-
-    if (close(cachefd))
-        error("can't close %s (%s)", tempfile, strerror(errno));
-
-    if (chmod(tempfile, 0644))
-	error("can't chmod %s (%s)", tempfile, strerror(errno));
-
-    if (rename(tempfile, cachefile))
-	error("can't rename %s (%s)", tempfile, strerror(errno));
-}
-
-static void cache_print(void)
-{
-    caddr_t c;
-    struct stat st;
-    int fd = 0;
-    char *strs;
-    header_t *header;
-    libentry_t *libent;
-
-    if (stat(cachefile, &st) || (fd = open(cachefile, O_RDONLY))<0)
-	error("can't read %s (%s)", cachefile, strerror(errno));
-    if ((c = mmap(0,st.st_size, PROT_READ, MAP_SHARED ,fd, 0)) == (caddr_t)-1)
-	error("can't map %s (%s)", cachefile, strerror(errno));
-    close(fd);
-
-    if (memcmp(((header_t *)c)->magic, LDSO_CACHE_MAGIC, LDSO_CACHE_MAGIC_LEN))
-	error("%s cache corrupt", cachefile);
-
-    if (memcmp(((header_t *)c)->version, LDSO_CACHE_VER, LDSO_CACHE_VER_LEN))
-	error("wrong cache version - expected %s", LDSO_CACHE_VER);
-
-    header = (header_t *)c;
-    libent = (libentry_t *)(c + sizeof (header_t));
-    strs = (char *)&libent[header->nlibs];
-
-    printf("%d libs found in cache `%s' (version %s)\n",
-	    header->nlibs, cachefile, LDSO_CACHE_VER);
-
-    for (fd = 0; fd < header->nlibs; fd++)
-    {
-	printf("\t%s ", strs + libent[fd].sooffset);
-	switch (libent[fd].flags) 
-	{
-	  case LIB_DLL:
-	    printf("(DLL)");
-	    break;
-	  case LIB_ELF:
-	    printf("(ELF)");
-	    break;
-	  case LIB_ELF_LIBC5:
-	  case LIB_ELF_LIBC6:
-	    printf("(ELF-libc%d)", libent[fd].flags + 3);
-	    break;
-	  default:
-	    printf("(unknown)");
-	    break;
-	}
-	printf(" => %s\n", strs + libent[fd].liboffset);
-    }
-
-    munmap (c,st.st_size);
-}
-
-struct needed_tab
-{
-  const char *soname;
-  int type;
-};
-
-struct needed_tab needed_tab[] = {
-  { "libc.so.5",    LIB_ELF_LIBC5 },
-  { "libm.so.5",    LIB_ELF_LIBC5 },
-  { "libdl.so.1",   LIB_ELF_LIBC5 },
-  { "libc.so.6",    LIB_ELF_LIBC6 },
-  { "libm.so.6",    LIB_ELF_LIBC6 },
-  { "libdl.so.2",   LIB_ELF_LIBC6 },
-  { NULL,           LIB_ELF }
-};
-
-static char *readsoname(char *name, FILE *infile, int *type)
-{
-  const ElfW(Ehdr) *epnt;
-  const ElfW(Phdr) *ppnt;
-  int i, j;
-  char *header;
-  unsigned int dynamic_addr = 0;
-  unsigned int dynamic_size = 0;
-  int strtab_val = 0;
-  int needed_val;
-  int loadaddr = -1;
-  const ElfW(Dyn) *dpnt;
-  struct stat st;
-  char *needed;
-  char *soname = NULL;
-  int multi_libcs = 0;
-
-  *type = LIB_ELF;
-
-  if (fstat(fileno(infile), &st))
-    return NULL;
-  header = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fileno(infile), 0);
-  if (header == (caddr_t)-1)
-    return NULL;
-
-  epnt = (const ElfW(Ehdr) *)header;
-  if ((char*)(epnt+1) > (char*)(header + st.st_size))
-    goto skip;
-
-  ppnt = (const ElfW(Phdr) *)&header[epnt->e_phoff];
-  if ((char*)ppnt < (char*)header ||
-      (char*)(ppnt+epnt->e_phnum) > (char*)(header + st.st_size))
-    goto skip;
-
-  for(i = 0; i < epnt->e_phnum; i++)
-  {
-    if (loadaddr == -1 && ppnt->p_type == PT_LOAD) 
-      loadaddr = (ppnt->p_vaddr & 0xfffff000) -
-	(ppnt->p_offset & 0xfffff000);
-    if(ppnt->p_type == 2)
-    {
-      dynamic_addr = ppnt->p_offset;
-      dynamic_size = ppnt->p_filesz;
-    };
-    ppnt++;
-  };
-    
-  dpnt = (const ElfW(Dyn) *) &header[dynamic_addr];
-  dynamic_size = dynamic_size / sizeof(const ElfW(Dyn));
-  if ((char*)dpnt < (char*)header ||
-      (char*)(dpnt+dynamic_size) > (char*)(header + st.st_size))
-    goto skip;
-  
-  while (dpnt->d_tag != DT_NULL)
-  {
-    if (dpnt->d_tag == DT_STRTAB)
-      strtab_val = dpnt->d_un.d_val;
-    dpnt++;
-  };
-
-  if (!strtab_val)
-    goto skip;
-
-  dpnt = (const ElfW(Dyn) *) &header[dynamic_addr];
-  while (dpnt->d_tag != DT_NULL)
-  {
-    if (dpnt->d_tag == DT_SONAME || dpnt->d_tag == DT_NEEDED)
-    {
-      needed_val = dpnt->d_un.d_val;
-      if (needed_val + strtab_val - loadaddr >= 0 ||
-	  needed_val + strtab_val - loadaddr < st.st_size)
-      {
-	needed = (char *) (header - loadaddr + strtab_val + needed_val);
-
-	if (dpnt->d_tag == DT_SONAME)
-	  soname = xstrdup(needed);
-
-	for (j = 0; needed_tab[j].soname != NULL; j++)
-	{
-	  if (strcmp(needed, needed_tab[j].soname) == 0)
-	  {
-	    if (*type != LIB_ELF && *type != needed_tab[j].type)
-	      multi_libcs = 1;
-	    *type = needed_tab[j].type;
-	  }
-	}
-      }
-    }
-    dpnt++;
-  };
-  
-  if (multi_libcs)
-    warn("%s appears to be for multiple libc's", name);
-
- skip:
-  munmap(header, st.st_size);
-
-  return soname;
-}
diff -ruN glibc-2.0.7/linuxthreads/internals.h glibc-2.0.7-patched/linuxthreads/internals.h
--- glibc-2.0.7/linuxthreads/internals.h	Tue Jul  7 12:07:22 1998
+++ glibc-2.0.7-patched/linuxthreads/internals.h	Wed Jun  7 15:35:03 2000
@@ -81,7 +81,7 @@
   struct pthread_start_args p_start_args; /* arguments for thread creation */
   void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE]; /* thread-specific data */
   void * p_libc_specific[_LIBC_TSD_KEY_N]; /* thread-specific data for libc */
-};
+} __attribute__ ((aligned(32)));
 
 /* The type of thread handles. */
 
diff -ruN glibc-2.0.7/linuxthreads/manager.c glibc-2.0.7-patched/linuxthreads/manager.c
--- glibc-2.0.7/linuxthreads/manager.c	Tue Jul  7 12:06:54 1998
+++ glibc-2.0.7-patched/linuxthreads/manager.c	Wed Jun  7 15:35:03 2000
@@ -25,7 +25,6 @@
 #include <sys/mman.h>           /* for mmap */
 #include <sys/time.h>
 #include <sys/wait.h>           /* for waitpid macros */
-#include <linux/tasks.h>
 
 #include "pthread.h"
 #include "internals.h"
diff -ruN glibc-2.0.7/stdlib/fpioconst.c glibc-2.0.7-patched/stdlib/fpioconst.c
--- glibc-2.0.7/stdlib/fpioconst.c	Fri Jan 30 19:29:13 1998
+++ glibc-2.0.7-patched/stdlib/fpioconst.c	Wed Jun  7 15:35:03 2000
@@ -54,6 +54,7 @@
     0xd8d99f72, 0x12152f87, 0x6bde50c6, 0xcf4a6e70, 0xd595d80f, 0x26b2716e,
     0xadc666b0, 0x1d153624, 0x3c42d35a, 0x63ff540e, 0xcc5573c0, 0x65f9ef17,
     0x55bc28f2, 0x80dcc7f7, 0xf46eeddc, 0x5fdcefce, 0x000553f7 };
+#ifndef __mips__
 static const mp_limb_t _ten_p9[] =
   { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -195,9 +196,13 @@
     0xd868b275, 0x8bd2b496, 0x1c5563f4, 0xc234d8f5, 0xf868e970, 0xf9151fff,
     0xae7be4a2, 0x271133ee, 0xbb0fd922, 0x25254932, 0xa60a9fc0, 0x104bcd64,
     0x30290145, 0x00000062 };
-
 /* This value is the index of the last array element.  */
 #define _LAST_POW10	12
+#else
+/* This value is the index of the last array element.  */
+#define _LAST_POW10	8
+#endif
+
 
 #elif BITS_PER_MP_LIMB == 64
 
@@ -228,6 +233,7 @@
     0x12152f87d8d99f72, 0xcf4a6e706bde50c6, 0x26b2716ed595d80f,
     0x1d153624adc666b0, 0x63ff540e3c42d35a, 0x65f9ef17cc5573c0,
     0x80dcc7f755bc28f2, 0x5fdcefcef46eeddc, 0x00000000000553f7 };
+#ifndef __mips__
 static const mp_limb_t _ten_p9[] =
   { 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
     0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
@@ -372,6 +378,11 @@
 
 /* This value is the index of the last array element.  */
 #define _LAST_POW10	12
+#else
+/* This value is the index of the last array element.  */
+#define _LAST_POW10	8
+#endif
+
 
 #else
 #  error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
@@ -392,10 +403,12 @@
     { _ten_p6, sizeof (_ten_p6) / sizeof (_ten_p6[0]),		213,	 210 },
     { _ten_p7, sizeof (_ten_p7) / sizeof (_ten_p7[0]),		426,	 422 },
     { _ten_p8, sizeof (_ten_p8) / sizeof (_ten_p8[0]),	  	851,	 848 },
+#ifndef __mips__
     { _ten_p9, sizeof (_ten_p9) / sizeof (_ten_p9[0]),	 	1701,	1698 },
     { _ten_p10, sizeof (_ten_p10) / sizeof (_ten_p10[0]),	3402,	3399 },
     { _ten_p11, sizeof (_ten_p11) / sizeof (_ten_p11[0]),	6804,	6800 },
     { _ten_p12, sizeof (_ten_p12) / sizeof (_ten_p12[0]), 	13607, 13604 }
+#endif
   };
 
 #if LAST_POW10 > _LAST_POW10
diff -ruN glibc-2.0.7/stdlib/fpioconst.h glibc-2.0.7-patched/stdlib/fpioconst.h
--- glibc-2.0.7/stdlib/fpioconst.h	Fri Jan 30 19:29:13 1998
+++ glibc-2.0.7-patched/stdlib/fpioconst.h	Wed Jun  7 15:35:03 2000
@@ -32,7 +32,11 @@
    XXX These should be defined in <float.h>.  For the time being, we have the
    IEEE754 values here.  */
 
+#if LDBL_MAX_10_EXP == 308
+#define LDBL_MAX_10_EXP_LOG	8 /* = floor(log_2(LDBL_MAX_10_EXP)) */
+#else
 #define LDBL_MAX_10_EXP_LOG	12 /* = floor(log_2(LDBL_MAX_10_EXP)) */
+#endif
 #define DBL_MAX_10_EXP_LOG	8 /* = floor(log_2(DBL_MAX_10_EXP)) */
 #define FLT_MAX_10_EXP_LOG	5 /* = floor(log_2(FLT_MAX_10_EXP)) */
 
diff -ruN glibc-2.0.7/sysdeps/mips/bzero.S glibc-2.0.7-patched/sysdeps/mips/bzero.S
--- glibc-2.0.7/sysdeps/mips/bzero.S	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/mips/bzero.S	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,26 @@
+/* $Id$
+ *
+ * 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
+ * for more details.
+ */
+#include <sys/asm.h>
+#include <sys/regdef.h>
+
+	.align	5
+LEAF(__bzero)
+	.set	noreorder
+	.cpload	t9
+	.set	reorder
+
+	move	a2, a1
+	move	a1, zero
+#ifdef __PIC__
+	la	jp, memset
+	jr	jp
+#else
+	j	memset
+#endif
+	END(__bzero)
+
+weak_alias(__bzero, bzero)
diff -ruN glibc-2.0.7/sysdeps/mips/dbl2mpn.c glibc-2.0.7-patched/sysdeps/mips/dbl2mpn.c
--- glibc-2.0.7/sysdeps/mips/dbl2mpn.c	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/mips/dbl2mpn.c	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,25 @@
+/*
+   Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdeps/ieee754/dbl2mpn.c>
+
+/* On MIPS `long double' is the same thing as `double' therefore this is
+   just an alias.  */
+
+strong_alias(__mpn_extract_double, __mpn_extract_long_double)
diff -ruN glibc-2.0.7/sysdeps/mips/dl-machine.h glibc-2.0.7-patched/sysdeps/mips/dl-machine.h
--- glibc-2.0.7/sysdeps/mips/dl-machine.h	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/sysdeps/mips/dl-machine.h	Wed Jun  7 15:35:03 2000
@@ -38,7 +38,8 @@
 			     "li $2, 4004\n\t"
 			     "syscall" : :
 			     "r" (fd), "r" (string), "r" (len) :
-			     "$2", "$3", "$4", "$5", "$6", "$7");
+			     "$2", "$3", "$4", "$5", "$6", "$7","$8","$9", \
+			     "$10","$11","$12","$13","$14","$15","$24");
 }
 
 static inline int __rtld_debug_strlen(char *s)
@@ -64,7 +65,8 @@
 	}
 }
 
-#define printk(s)  __rtld_debug_write(1, s, __rtld_debug_strlen(s))
+#define printk(s)  __rtld_debug_write(2, s, __rtld_debug_strlen(s))
+#define printkaddr(x)  __rtld_debug_printaddr((unsigned long)(x))
 #endif
 
 /* Translate a processor specific dynamic tag to the index
@@ -135,6 +137,10 @@
 /* The MSB of got[1] of a gnu object is set to identify gnu objects. */
 #define ELF_MIPS_GNU_GOT1_MASK 0x80000000
 
+/* GNU Binutils upto 2.9.1 produce a wrong relocation.  Bit 30 of got[1]
+   marks good objects.  */
+#define ELF_MIPS_GNU_GOT1_OK	0x40000000
+
 /* Relocate GOT. */
 static inline void
 elf_machine_got_rel (struct link_map *map)
@@ -409,11 +415,13 @@
 
 #ifdef __linux__
 #define _RTLD_PROLOGUE "\n\t.globl __start" \
-                       "\n\t.ent __start\n\t__start:\n\t"
+                       "\n\t.ent __start\n\t__start:\n\t" \
+                       "\n\t.type __start,@function\n\t"
 #define _RTLD_EPILOGUE "\t.end __start\n"
 #else /* !(__linux__) */
 #define _RTLD_PROLOGUE "\n\t.globl _start" \
-                       "\n\t.ent _start\n\t_start:\n\t"
+                       "\n\t.ent _start\n\t_start:\n\t" \
+                       "\n\t.type _start,@function\n\t"
 #define _RTLD_EPILOGUE "\t.end _start\n"
 #endif
 
@@ -513,10 +521,18 @@
     case R_MIPS_REL32:
       {
 	Elf32_Addr undo = 0;
+	ElfW(Addr) *got;
 
-	if (ELFW(ST_BIND) (sym->st_info) == STB_LOCAL
+	got = (ElfW(Addr) *) ((void *) map->l_addr
+			      + map->l_info[DT_PLTGOT]->d_un.d_ptr);
+	if ((ELFW(ST_BIND) (sym->st_info) == STB_LOCAL
 	    && (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION
 		|| ELFW(ST_TYPE) (sym->st_info) == STT_NOTYPE))
+	    || ((got[1] & ELF_MIPS_GNU_GOT1_MASK) == 0)	/* Not a GNU object  */
+	    || (got[1] & ELF_MIPS_GNU_GOT1_OK)		/* Good GNU object  */
+	    || (map->l_info[DT_MIPS (TIME_STAMP)]	/* Old workaround */
+		&& map->l_info[DT_MIPS (TIME_STAMP)]->d_un.d_val
+		   == 11717580))
 	  {
 	    *reloc_addr += map->l_addr;
 	    break;
diff -ruN glibc-2.0.7/sysdeps/mips/elf/start.S glibc-2.0.7-patched/sysdeps/mips/elf/start.S
--- glibc-2.0.7/sysdeps/mips/elf/start.S	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/sysdeps/mips/elf/start.S	Wed Jun  7 15:35:03 2000
@@ -61,6 +61,7 @@
 #endif
 	.text	
 	.globl ENTRY_POINT
+	.type ENTRY_POINT,@function
 ENTRY_POINT:
 	subu	$29, 16
 #ifdef __PIC__
@@ -150,8 +151,3 @@
 	.long 0
 	.weak data_start
 	data_start = __data_start
-
-	.comm errno, 4, 4
-#ifdef __ELF__
-	.type errno, @object
-#endif
diff -ruN glibc-2.0.7/sysdeps/mips/fpu_control.h glibc-2.0.7-patched/sysdeps/mips/fpu_control.h
--- glibc-2.0.7/sysdeps/mips/fpu_control.h	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/sysdeps/mips/fpu_control.h	Wed Jun  7 15:35:03 2000
@@ -74,7 +74,7 @@
 /* The fdlibm code requires strict IEEE double precision arithmetic,
    and no interrupts for exceptions, rounding to nearest.  */
 
-#define _FPU_DEFAULT  0x00000600
+#define _FPU_DEFAULT  0x00000000
 
 /* IEEE:  same as above, but exceptions */
 #define _FPU_IEEE     0x00000F80
diff -ruN glibc-2.0.7/sysdeps/mips/ldbl2mpn.c glibc-2.0.7-patched/sysdeps/mips/ldbl2mpn.c
--- glibc-2.0.7/sysdeps/mips/ldbl2mpn.c	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/mips/ldbl2mpn.c	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,21 @@
+/*
+   Copyright (C) 1998 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.  */
+
+/* On MIPS `long double' is the same thing as `double' therefore this is
+   just an alias defined in dbl2mpn.c.  */
diff -ruN glibc-2.0.7/sysdeps/mips/memset.S glibc-2.0.7-patched/sysdeps/mips/memset.S
--- glibc-2.0.7/sysdeps/mips/memset.S	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/mips/memset.S	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,112 @@
+/* $Id: memset.S,v 1.2 1998/04/25 17:01:45 ralf Exp $
+ *
+ * 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
+ * for more details.
+ *
+ * Copyright (C) 1998 by Ralf Baechle
+ */
+#include <sys/asm.h>
+#include <sys/regdef.h>
+
+#define EX(insn,reg,addr,handler)			\
+9:	insn	reg, addr
+
+#define F_FILL64(dst, offset, val, fixup)		\
+	EX(sw, val, (offset + 0x00)(dst), fixup);	\
+	EX(sw, val, (offset + 0x04)(dst), fixup);	\
+	EX(sw, val, (offset + 0x08)(dst), fixup);	\
+	EX(sw, val, (offset + 0x0c)(dst), fixup);	\
+	EX(sw, val, (offset + 0x10)(dst), fixup);	\
+	EX(sw, val, (offset + 0x14)(dst), fixup);	\
+	EX(sw, val, (offset + 0x18)(dst), fixup);	\
+	EX(sw, val, (offset + 0x1c)(dst), fixup);	\
+	EX(sw, val, (offset + 0x20)(dst), fixup);	\
+	EX(sw, val, (offset + 0x24)(dst), fixup);	\
+	EX(sw, val, (offset + 0x28)(dst), fixup);	\
+	EX(sw, val, (offset + 0x2c)(dst), fixup);	\
+	EX(sw, val, (offset + 0x30)(dst), fixup);	\
+	EX(sw, val, (offset + 0x34)(dst), fixup);	\
+	EX(sw, val, (offset + 0x38)(dst), fixup);	\
+	EX(sw, val, (offset + 0x3c)(dst), fixup)
+
+/*
+ * memset(void *s, int c, size_t n)
+ *
+ * a0: start of area to clear
+ * a1: char to fill with
+ * a2: size of area to clear
+ */
+	.set	noreorder
+	.align	5
+LEAF(memset)
+	.cpload	t9
+	beqz	a1, 1f
+	 move	v0, a0				/* result */
+
+	andi	a1, 0xff			/* spread fillword */
+	sll	t1, a1, 8
+	or	a1, t1
+	sll	t1, a1, 16
+	or	a1, t1
+1:
+
+	sltiu	t0, a2, 4			/* very small region? */
+	bnez	t0, small_memset
+	 andi	t0, a0, 3			/* aligned? */
+
+	beqz	t0, 1f
+	 subu	t0, 4				/* alignment in bytes */
+
+#ifdef __MIPSEB__
+	EX(swl, a1, (a0), first_fixup)		/* make word aligned */
+#endif
+#ifdef __MIPSEL__
+	EX(swr, a1, (a0), first_fixup)		/* make word aligned */
+#endif
+	subu	a0, t0				/* word align ptr */
+	addu	a2, t0				/* correct size */
+
+1:	ori	t1, a2, 0x3f			/* # of full blocks */
+	xori	t1, 0x3f
+	beqz	t1, memset_partial		/* no block to fill */
+	 andi	t0, a2, 0x3c
+
+	addu	t1, a0				/* end address */
+	.set	reorder
+1:	addiu	a0, 64
+	F_FILL64(a0, -64, a1, fwd_fixup)
+	bne	t1, a0, 1b
+	.set	noreorder
+
+memset_partial:
+	la	t1, 2f				/* where to start */
+	subu	t1, t0
+	jr	t1
+	 addu	a0, t0				/* dest ptr */
+
+	F_FILL64(a0, -64, a1, partial_fixup)	/* ... but first do wrds ... */
+2:	andi	a2, 3				/* 0 <= n <= 3 to go */
+
+	beqz	a2, 1f
+	 addu	a0, a2				/* What's left */
+#ifdef __MIPSEB__
+	EX(swr, a1, -1(a0), last_fixup)
+#endif
+#ifdef __MIPSEL__
+	EX(swl, a1, -1(a0), last_fixup)
+#endif
+1:	jr	ra
+	 move	a2, zero
+
+small_memset:
+	beqz	a2, 2f
+	 addu	t1, a0, a2
+
+1:	addiu	a0, 1				/* fill bytewise */
+	bne	t1, a0, 1b
+	 sb	a1, -1(a0)
+
+2:	jr	ra				/* done */
+	 move	a2, zero
+	END(memset)
diff -ruN glibc-2.0.7/sysdeps/mips/mpn2dbl.c glibc-2.0.7-patched/sysdeps/mips/mpn2dbl.c
--- glibc-2.0.7/sysdeps/mips/mpn2dbl.c	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/mips/mpn2dbl.c	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,22 @@
+/*
+   Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdeps/ieee754/mpn2dbl.c>
+
+strong_alias(__mpn_construct_double, __mpn_construct_long_double)
diff -ruN glibc-2.0.7/sysdeps/mips/mpn2ldbl.c glibc-2.0.7-patched/sysdeps/mips/mpn2ldbl.c
--- glibc-2.0.7/sysdeps/mips/mpn2ldbl.c	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/mips/mpn2ldbl.c	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,20 @@
+/* Copyright (C) 1998 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.  */
+
+/* On MIPS `long double' is the same thing as `double' therefore this is
+   just an alias defined in mpn2dbl.c.  */
diff -ruN glibc-2.0.7/sysdeps/unix/mips/sysdep.S glibc-2.0.7-patched/sysdeps/unix/mips/sysdep.S
--- glibc-2.0.7/sysdeps/unix/mips/sysdep.S	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/sysdeps/unix/mips/sysdep.S	Wed Jun  7 15:35:03 2000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1993, 1994, 1998 Free Software Foundation, Inc.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -20,15 +20,58 @@
 #define _ERRNO_H
 #include <errnos.h>
 
-	.comm errno, 4
-#ifdef __ELF__
-	.type errno, @object
-#endif
+#ifdef _LIBC_REENTRANT
 
+ENTRY(__syscall_error)
+#ifdef __PIC__
 	.set noreorder
+	.set	noat
+	move	$1, $31
+	bltzal	$0, 0f
+	nop
+0:	.cpload	$31
+	move	$31, $1
+	.set	at
+	.set	reorder
+#endif
+	subu	sp, 32
+#ifdef __PIC__
+	.cprestore 16
+#endif
+	sw	v0, 20(sp)
+	sw	ra, 24(sp)
+
+#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
+	/* We translate the system's EWOULDBLOCK error into EAGAIN.
+	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
+	   EWOULDBLOCK_sys is the original number.  */
+	bne	v0, EWOULDBLOCK_sys, skip
+	nop
+	li	v0, EAGAIN
+skip:
+#endif
+	/* Store it the "real" variable ... */
+	sw v0, errno
+
+	/* Find our per-thread errno address  */
+	jal	__errno_location
+
+	/* Store the error value.  */
+	lw	t0, 20(sp)
+	sw	t0, 0(v0)
+
+	/* And just kick back a -1.  */
+	lw	ra, 24(sp)
+	addiu	sp, 32
+	li	v0, -1
+	j	ra
+	END(__syscall_error)
+
+#else /* _LIBC_REENTRANT */
 
 ENTRY(__syscall_error)
 #ifdef __PIC__
+	.set	noreorder
 	.set	noat
 	move	$1, $31
 	bltzal	$0, 0f
@@ -36,13 +79,13 @@
 0:	.cpload	$31
 	move	$31, $1
 	.set	at
+	.set	reorder
 #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.
 	   EWOULDBLOCK_sys is the original number.  */
 	bne v0, EWOULDBLOCK_sys, skip
-	nop
 	li v0, EAGAIN
 skip:
 #endif
@@ -50,10 +93,7 @@
 	sw v0, errno
 
 	/* And just kick back a -1.  */
-	j ra
 	li v0, -1
+	j ra
 	END(__syscall_error)
-
-/* We provide this alias for compatilility with other Unices
-   like IRIX 5  */
-weak_alias (__syscall_error, syscall_error)
+#endif /* _LIBC_REENTRANT */
diff -ruN glibc-2.0.7/sysdeps/unix/mips/sysdep.h glibc-2.0.7-patched/sysdeps/unix/mips/sysdep.h
--- glibc-2.0.7/sysdeps/unix/mips/sysdep.h	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/sysdeps/unix/mips/sysdep.h	Wed Jun  7 15:35:03 2000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1998 Free Software Foundation, Inc.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -28,13 +28,13 @@
   .ent name,0;								      \
   name##:
 
-/* Note that while it's better structurally, going back to call syscall_error
+/* 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;						      \
+  99: la t9,__syscall_error;						      \
   jr t9;								      \
   ENTRY(name)								      \
   .set noreorder;							      \
@@ -47,7 +47,7 @@
 #else
 #define PSEUDO(name, syscall_name, args) \
   .align 2;								      \
-  99: j syscall_error;							      \
+  99: j __syscall_error;						      \
   ENTRY(name)								      \
   .set noreorder;							      \
   li v0, SYS_##syscall_name;						      \
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/Makefile glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/Makefile
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/Makefile	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/Makefile	Wed Jun  7 15:35:03 2000
@@ -1,3 +1,7 @@
+ifeq ($(subdir), posix)
+sysdep_routines += s_pause
+endif
+
 ifeq ($(subdir), signal)
 #sysdep_routines += sigsuspend
 endif
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/errnos.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/errnos.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/errnos.h	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/errnos.h	Wed Jun  7 15:35:03 2000
@@ -43,7 +43,7 @@
 #   endif /* _LIBC_REENTRANT */
 #  endif /* _LIBC */
 
-#  if defined __USE_REENTRANT && (!defined _LIBC || defined _LIBC_REENTRANT)
+#  if !defined _LIBC || defined _LIBC_REENTRANT
 /* When using threads, errno is a per-thread value.  */
 #   define errno (*__errno_location ())
 #  endif
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/fcntlbits.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/fcntlbits.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/fcntlbits.h	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/fcntlbits.h	Wed Jun  7 15:35:03 2000
@@ -42,7 +42,7 @@
 #define O_EXCL		0x0400	/* not fcntl */
 #define O_NOCTTY	0x0800	/* not fcntl */
 #define O_FSYNC		O_SYNC
-#define O_ASYNC		020000
+#define O_ASYNC		0x1000
 
 #define O_NDELAY	O_NONBLOCK
 
@@ -73,7 +73,7 @@
 /* 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
+#define LOCK_NB		4	/* or'd with one of the above to prevent
 				   blocking */
 #define LOCK_UN		8	/* remove lock */
 
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/pause.c glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/pause.c
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/pause.c	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/pause.c	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,48 @@
+/* Copyright (C) 1991, 1996, 2000 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 <signal.h>
+#include <unistd.h>
+
+
+/* Suspend the process until a signal arrives.
+   This always returns -1 and sets errno to EINTR.  */
+
+extern int __sys_pause(void);
+
+int
+__libc_pause (void)
+{
+  static int must_emulate = 0;
+
+  if (!must_emulate)
+    {
+      int errno_saved = errno;
+      int retval = __sys_pause();
+
+      if (retval >= 0 || errno != ENOSYS)
+	return retval;
+
+      __set_errno(errno_saved);
+      must_emulate = 1;
+    }
+
+  return __sigpause (__sigblock (0), 0);
+}
+weak_alias (__libc_pause, pause)
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/regdef.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/regdef.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/regdef.h	Wed Jun  7 15:33:39 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/regdef.h	Wed Jun  7 15:35:03 2000
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1994, 1995 by Ralf Baechle.
+Copyright (C) 1994, 1995, 1996, 1997, 1998 by Ralf Baechle.
 
 This file is part of the GNU C Library.
 
@@ -24,7 +24,7 @@
 /*
  * The real definitions come from the Linux kernel sources
  */
-#include <asm/regdef.h>
-#include <asm/fpregdef.h>
+#include <sys/regdef.h>
+#include <sys/fpregdef.h>
 
 #endif /* _REGDEF_H */
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/resourcebits.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/resourcebits.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/resourcebits.h	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/resourcebits.h	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,200 @@
+/* Bit values & structures for resource limits.  Linux/MIPS version.
+   Copyright (C) 1994, 1996, 2000 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.  */
+
+/*
+ * Resource limits
+ */
+#define RLIMIT_CPU 0			/* CPU time in ms */
+#define RLIMIT_FSIZE 1			/* Maximum filesize */
+#define RLIMIT_DATA 2			/* max data size */
+#define RLIMIT_STACK 3			/* max stack size */
+#define RLIMIT_CORE 4			/* max core file size */
+#define RLIMIT_NOFILE 5			/* max number of open files */
+#define RLIMIT_AS 6			/* mapped memory */
+#define RLIMIT_RSS 7			/* max resident set size */
+#define RLIMIT_NPROC 8			/* max number of processes */
+#define RLIMIT_MEMLOCK 9		/* max locked-in-memory address space */
+
+#define RLIM_NLIMITS 10			/* Number of limit flavors.  */
+
+/* Transmute defines to enumerations.  The macro re-definitions are
+   necessary because some programs want to test for operating system
+   features with #ifdef RUSAGE_SELF.  In ISO C the reflexive
+   definition is a no-op.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+{
+  /* Per-process CPU limit, in seconds.  */
+  _RLIMIT_CPU = RLIMIT_CPU,
+#undef RLIMIT_CPU
+  RLIMIT_CPU = _RLIMIT_CPU,
+#define RLIMIT_CPU RLIMIT_CPU
+
+  /* Largest file that can be created, in bytes.  */
+  _RLIMIT_FSIZE = RLIMIT_FSIZE,
+#undef RLIMIT_FSIZE
+  RLIMIT_FSIZE = _RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE RLIMIT_FSIZE
+
+  /* Maximum size of data segment, in bytes.  */
+  _RLIMIT_DATA = RLIMIT_DATA,
+#undef RLIMIT_DATA
+  RLIMIT_DATA = _RLIMIT_DATA,
+#define	RLIMIT_DATA RLIMIT_DATA
+
+  /* Maximum size of stack segment, in bytes.  */
+  _RLIMIT_STACK = RLIMIT_STACK,
+#undef RLIMIT_STACK
+  RLIMIT_STACK = _RLIMIT_STACK,
+#define	RLIMIT_STACK RLIMIT_STACK
+
+  /* Largest core file that can be created, in bytes.  */
+  _RLIMIT_CORE = RLIMIT_CORE,
+#undef RLIMIT_CORE
+  RLIMIT_CORE = _RLIMIT_CORE,
+#define	RLIMIT_CORE RLIMIT_CORE
+
+  /* Largest resident set size, in bytes.
+     This affects swapping; processes that are exceeding their
+     resident set size will be more likely to have physical memory
+     taken from them.  */
+  _RLIMIT_RSS = RLIMIT_RSS,
+#undef RLIMIT_RSS
+  RLIMIT_RSS = _RLIMIT_RSS,
+#define	RLIMIT_RSS RLIMIT_RSS
+
+  /* Number of open files.  */
+  _RLIMIT_NOFILE = RLIMIT_NOFILE,
+#undef RLIMIT_NOFILE
+  RLIMIT_NOFILE = _RLIMIT_NOFILE,
+  RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
+#define RLIMIT_NOFILE RLIMIT_NOFILE
+#define RLIMIT_OFILE RLIMIT_OFILE
+
+  /* Address space limit (?) */
+  _RLIMIT_AS = RLIMIT_AS,
+#undef RLIMIT_AS
+  RLIMIT_AS = _RLIMIT_AS,
+#define RLIMIT_AS RLIMIT_AS
+
+  /* Number of processes.  */
+  _RLIMIT_NPROC = RLIMIT_NPROC,
+#undef RLIMIT_NPROC
+  RLIMIT_NPROC = _RLIMIT_NPROC,
+#define RLIMIT_NPROC RLIMIT_NPROC
+
+  /* Locked-in-memory address space.  */
+  _RLIMIT_MEMLOCK = RLIMIT_MEMLOCK,
+#undef RLIMIT_MEMLOCK
+  RLIMIT_MEMLOCK = _RLIMIT_MEMLOCK,
+#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK
+
+  RLIMIT_NLIMITS = RLIM_NLIMITS,
+#undef RLIM_NLIMITS
+  RLIM_NLIMITS = RLIMIT_NLIMITS,
+#define RLIMIT_NLIMITS RLIMIT_NLIMITS
+#define RLIM_NLIMITS RLIM_NLIMITS
+
+  /* Value to indicate that there is no limit.  */
+  RLIM_INFINITY = (long int)(~0UL >> 1)
+#define RLIM_INFINITY RLIM_INFINITY
+};
+
+struct rlimit
+{
+  /* The current (soft) limit.  */
+  long int rlim_cur;
+  /* The hard limit.  */
+  long int rlim_max;
+};
+
+/* Whose usage statistics do you want?  */
+enum __rusage_who
+{
+  /* The calling process.  */
+  RUSAGE_SELF = 0,
+#define RUSAGE_SELF RUSAGE_SELF
+
+  /* All of its terminated child processes.  */
+  RUSAGE_CHILDREN = -1,
+#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+
+  /* Both.  */
+  RUSAGE_BOTH = -2
+#define RUSAGE_BOTH RUSAGE_BOTH
+};
+
+#include <sys/time.h>		/* For `struct timeval'.  */
+
+/* Structure which says how much of each resource has been used.  */
+struct rusage
+{
+  /* Total amount of user time used.  */
+  struct timeval ru_utime;
+  /* Total amount of system time used.  */
+  struct timeval ru_stime;
+  /* Maximum resident set size (in kilobytes).  */
+  long int ru_maxrss;
+  /* Amount of sharing of text segment memory
+     with other processes (kilobyte-seconds).  */
+  long int ru_ixrss;
+  /* Amount of data segment memory used (kilobyte-seconds).  */
+  long int ru_idrss;
+  /* Amount of stack memory used (kilobyte-seconds).  */
+  long int ru_isrss;
+  /* Number of soft page faults (i.e. those serviced by reclaiming
+     a page from the list of pages awaiting reallocation.  */
+  long int ru_minflt;
+  /* Number of hard page faults (i.e. those that required I/O).  */
+  long int ru_majflt;
+  /* Number of times a process was swapped out of physical memory.  */
+  long int ru_nswap;
+  /* Number of input operations via the file system.  Note: This
+     and `ru_oublock' do not include operations with the cache.  */
+  long int ru_inblock;
+  /* Number of output operations via the file system.  */
+  long int ru_oublock;
+  /* Number of IPC messages sent.  */
+  long int ru_msgsnd;
+  /* Number of IPC messages received.  */
+  long int ru_msgrcv;
+  /* Number of signals delivered.  */
+  long int ru_nsignals;
+  /* Number of voluntary context switches, i.e. because the process
+     gave up the process before it had to (usually to wait for some
+     resource to be available).  */
+  long int ru_nvcsw;
+  /* Number of involuntary context switches, i.e. a higher priority process
+     became runnable or the current process used up its time slice.  */
+  long int ru_nivcsw;
+};
+
+/* Priority limits.  */
+#define PRIO_MIN	-20	/* Minimum priority a process can have.  */
+#define PRIO_MAX	20	/* Maximum priority a process can have.  */
+
+/* The type of the WHICH argument to `getpriority' and `setpriority',
+   indicating what flavor of entity the WHO argument specifies.  */
+enum __priority_which
+{
+  PRIO_PROCESS = 0,		/* WHO is a process ID.  */
+  PRIO_PGRP = 1,		/* WHO is a process group ID.  */
+  PRIO_USER = 2			/* WHO is a user ID.  */
+};
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sgidefs.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sgidefs.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sgidefs.h	Wed Jun  7 15:33:40 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sgidefs.h	Wed Jun  7 15:35:03 2000
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1996 by Ralf Baechle.
+Copyright (C) 1996, 1998 by Ralf Baechle.
 
 This file is part of the GNU C Library.
 
@@ -22,8 +22,90 @@
 #define _SGIDEFS_H
 
 /*
- * The real definitions come from the Linux kernel sources
+ * There are compilers out there that don't define _MIPS_ISA, _MIPS_SIM,
+ * _MIPS_SZINT, _MIPS_SZLONG, _MIPS_SZPTR.  So we notify the user about this
+ * problem.  The kernel sources are aware of this problem, so we don't warn
+ * when compiling the kernel.
  */
-#include <asm/sgidefs.h>
+#if !defined(_MIPS_ISA) && !defined(__KERNEL__)
+#warning "Macro _MIPS_ISA has not been defined by specs file"
+#endif
+
+#if !defined(_MIPS_SIM) && !defined(__KERNEL__)
+#warning "Macro _MIPS_SIM has not been defined by specs file"
+#endif
+
+#if !defined(_MIPS_SZINT) && !defined(__KERNEL__)
+#warning "Macro _MIPS_SZINT has not been defined by specs file"
+#endif
+
+#if !defined(_MIPS_SZLONG) && !defined(__KERNEL__)
+#warning "Macro _MIPS_SZLONG has not been defined by specs file"
+#endif
+
+#if !defined(_MIPS_SZPTR) && !defined(__KERNEL__)
+#warning "Macro _MIPS_SZPTR has not been defined by specs file"
+#endif
+
+#if (!defined(_MIPS_ISA) || \
+     !defined(_MIPS_SIM) || \
+     !defined(_MIPS_SZINT) || \
+     !defined(_MIPS_SZLONG) || \
+     !defined(_MIPS_SZPTR)) && !defined(__KERNEL__)
+#warning "Please update your GCC to GCC 2.7.2-4 or newer"
+#endif
+
+/*
+ * Now lets try our best to supply some reasonable default values for
+ * whatever defines GCC didn't supply.  This cannot be done correct for
+ * all possible combinations of options, so be careful with your options
+ * to GCC.  Best bet is to keep your fingers off the a.out GCC and use
+ * ELF GCC 2.7.2-3 where possible.
+ */
+#ifndef _MIPS_ISA
+#if __mips == 1
+#define _MIPS_ISA	_MIPS_ISA_MIPS1
+/* It is impossible to handle the -mips2 case correct.  */
+#elif __mips == 3
+#define _MIPS_ISA	_MIPS_ISA_MIPS3
+#elif __mips == 4
+#define _MIPS_ISA	_MIPS_ISA_MIPS4
+#else /* __mips must be 5 */
+#define _MIPS_ISA	_MIPS_ISA_MIPS5
+#endif
+#endif
+#ifndef _MIPS_SIM
+#define _MIPS_SIM	_MIPS_SIM_ABI32
+#endif
+#ifndef _MIPS_SZINT
+#define _MIPS_SZINT	32
+#endif
+#ifndef _MIPS_SZLONG
+#define _MIPS_SZLONG	32
+#endif
+#ifndef _MIPS_SZPTR
+#define _MIPS_SZPTR	32
+#endif
+
+/*
+ * Definitions for the ISA level
+ */
+#define _MIPS_ISA_MIPS1 1
+#define _MIPS_ISA_MIPS2 2
+#define _MIPS_ISA_MIPS3 3
+#define _MIPS_ISA_MIPS4 4
+#define _MIPS_ISA_MIPS5 5
+
+/*
+ * 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
 
 #endif /* _SGIDEFS_H */
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/socketbits.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/socketbits.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/socketbits.h	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/socketbits.h	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,273 @@
+/* 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	_SOCKETBITS_H
+
+#define	_SOCKETBITS_H	1
+#include <features.h>
+
+#define	__need_size_t
+#define __need_NULL
+#include <stddef.h>
+
+
+__BEGIN_DECLS
+
+/* Type for length arguments in socket calls.  */
+typedef unsigned int socklen_t;
+
+/* Protocol families.  */
+#define	PF_UNSPEC	0	/* Unspecified.  */
+#define	PF_LOCAL	1	/* Local to host (pipes and file-domain).  */
+#define	PF_UNIX		PF_LOCAL /* Old BSD name for PF_LOCAL.  */
+#define	PF_FILE		PF_LOCAL /* POSIX name for PF_LOCAL.  */
+#define	PF_INET		2	/* IP protocol family.  */
+#define	PF_AX25		3	/* Amateur Radio AX.25.  */
+#define	PF_IPX		4	/* Novell Internet Protocol.  */
+#define	PF_APPLETALK	5	/* Don't use this.  */
+#define	PF_NETROM	6	/* Amateur radio NetROM.  */
+#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_SECURITY	14	/* Security callback pseudo AF */
+#define	pseudo_PF_KEY	15	/* PF_KEY key management API */
+#define	PF_NETLINK	16
+#define	PF_ROUTE	PF_NETLINK /* Alias to emulate 4.4BSD */
+#define	PF_PACKET	17	/* Packet family                */
+#define	PF_MAX		32	/* For now.. */
+
+/* Address families.  */
+#define	AF_UNSPEC	PF_UNSPEC
+#define	AF_LOCAL	PF_LOCAL
+#define	AF_UNIX		PF_UNIX
+#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_SECURITY	PF_SECURITY
+#define	AF_KEY		pseudo_PF_KEY
+#define	AF_NETLINK	PF_NETLINK
+#define	AF_ROUTE	PF_ROUTE
+#define	AF_PACKET	PF_PACKET
+#define	AF_MAX		PF_MAX
+
+/* Socket level values.  Others are defined in the appropriate headers.
+
+   XXX These definitions also should go into the appropriate headers as
+   far as they are available.  */
+#define SOL_IPV6        41
+#define SOL_ICMPV6	58
+#define SOL_RAW		255
+#define SOL_AX25        257
+#define SOL_ATALK	258
+#define SOL_NETROM	259
+#define SOL_ROSE	260
+#define SOL_DECNET	261
+#define SOL_X25		262
+
+/* Maximum queue length specifiable by listen.  */
+#define SOMAXCONN	128
+
+/* Get the definition of the macro to define the common sockaddr members.  */
+#include <sockaddrcom.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.  */
+    socklen_t msg_namelen;	/* Length of address data.  */
+
+    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
+    size_t msg_iovlen;		/* Number of elements in the vector.  */
+
+    __ptr_t msg_control;	/* Ancillary data (eg BSD filedesc passing). */
+    size_t msg_controllen;	/* Ancillary data buffer length.  */
+
+    int msg_flags;		/* Flags on received message.  */
+  };
+
+/* Structure used for storage of ancillary data object information.  */
+struct cmsghdr
+  {
+    size_t cmsg_len;		/* Length of data in cmsg_data plus length
+				   of cmsghdr structure.  */
+    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;
+}
+
+/* Socket level message types.  This must match the definitions in
+   <linux/socket.h>.  */
+enum
+  {
+    SCM_RIGHTS = 0x01,         /* Data array contains access rights.  */
+#define SCM_RIGHTS SCM_RIGHTS
+    __SCM_CREDENTIALS = 0x02,  /* Data array is `struct ucred'.  */
+    __SCM_CONNECT = 0x03       /* Data array is `struct scm_connect'.  */
+  };
+
+
+/* Get socket manipulation related information from kernel headers.  */
+
+#include <asm/sockios.h>
+
+/*
+ * For setsockoptions(2)
+ *
+ * This defines are ABI conformant as far as Linux supports these ...
+ */
+#define SOL_SOCKET	0xffff
+
+
+#define SO_DEBUG	0x0001	/* Record debugging information.  */
+#define SO_REUSEADDR	0x0004	/* Allow reuse of local addresses.  */
+#define SO_KEEPALIVE	0x0008	/* Keep connections alive and send
+				   SIGPIPE when they die.  */
+#define SO_DONTROUTE	0x0010	/* Don't do local routing.  */
+#define SO_BROADCAST	0x0020	/* Allow transmission of
+				   broadcast messages.  */
+#define SO_LINGER	0x0080	/* Block on close of a reliable
+				   socket to transmit pending data.  */
+#define SO_OOBINLINE 0x0100	/* Receive out-of-band data in-band.  */
+#if 0
+To add: #define SO_REUSEPORT 0x0200	/* Allow local address and port reuse.  */
+#endif
+
+#define SO_TYPE		0x1008	/* Compatible name for SO_STYLE.  */
+#define SO_STYLE	SO_TYPE	/* Synonym */
+#define SO_ERROR	0x1007	/* get error status and clear */
+#define SO_SNDBUF	0x1001	/* Send buffer size. */
+#define SO_RCVBUF	0x1002	/* Receive buffer. */
+#define SO_SNDLOWAT	0x1003	/* send low-water mark */
+#define SO_RCVLOWAT	0x1004	/* receive low-water mark */
+#define SO_SNDTIMEO	0x1005	/* send timeout */
+#define SO_RCVTIMEO 	0x1006	/* receive timeout */
+
+/* linux-specific, might as well be the same as on i386 */
+#define SO_NO_CHECK	11
+#define SO_PRIORITY	12
+#define SO_BSDCOMPAT	14
+
+#define SO_PASSCRED	17
+#define SO_PEERCRED	18
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define SO_SECURITY_AUTHENTICATION		22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT	23
+#define SO_SECURITY_ENCRYPTION_NETWORK		24
+
+#define SO_BINDTODEVICE		25
+
+/* Socket filtering */
+#define SO_ATTACH_FILTER        26
+#define SO_DETACH_FILTER        27
+
+/* Socket types. */
+
+#define SOCK_DGRAM	1		/* datagram (conn.less) socket	*/
+#define SOCK_STREAM	2		/* stream (connection) socket	*/
+#define SOCK_RAW	3		/* raw socket			*/
+#define SOCK_RDM	4		/* reliably-delivered message	*/
+#define SOCK_SEQPACKET	5		/* sequential packet socket	*/
+#define SOCK_PACKET	10		/* linux specific way of	*/
+					/* getting packets at the dev	*/
+					/* level.  For writing rarp and	*/
+					/* other similar things on the	*/
+					/* user level.			*/
+
+
+/* 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
+
+#endif /* socketbits.h */
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/statfsbuf.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/statfsbuf.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/statfsbuf.h	Wed Jun  7 15:33:40 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/statfsbuf.h	Wed Jun  7 15:35:03 2000
@@ -19,6 +19,8 @@
 #ifndef _STATFSBUF_H
 #define _STATFSBUF_H
 
+#include <gnu/types.h>
+
 struct statfs {
 	long		f_type;
 #define f_fstyp f_type
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sys/asm.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sys/asm.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sys/asm.h	Wed Jun  7 15:33:40 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sys/asm.h	Wed Jun  7 15:35:03 2000
@@ -21,9 +21,359 @@
 #ifndef _SYS_ASM_H
 #define _SYS_ASM_H
 
+#include <asm/sgidefs.h>
+
+#ifndef CAT
+#ifdef __STDC__
+#define __CAT(str1,str2) str1##str2
+#else
+#define __CAT(str1,str2) str1/**/str2
+#endif
+#define CAT(str1,str2) __CAT(str1,str2)
+#endif
+
 /*
- * The real definitions come from the Linux kernel sources
+ * Macros to handle different pointer/register sizes for 32/64-bit code
+ *
+ * 64 bit address space isn't used yet, so we may use the R3000 32 bit
+ * defines for now.
  */
-#include <asm/asm.h>
+#define PTR	.word
+#define PTRSIZE	4
+#define PTRLOG	2
+
+/*
+ * PIC specific declarations
+ * Not used for the kernel but here seems to be the right place.
+ */
+#ifdef __PIC__
+#define CPRESTORE(register)                             \
+		.cprestore register
+#define CPADD(register)                                 \
+		.cpadd	register
+#define CPLOAD(register)                                \
+		.cpload	register
+#else
+#define CPRESTORE(register)
+#define CPADD(register)
+#define CPLOAD(register)
+#endif
+
+/*
+ * LEAF - declare leaf routine
+ */
+#define	LEAF(symbol)                                    \
+		.globl	symbol;                         \
+		.align	2;                              \
+		.type	symbol,@function;               \
+		.ent	symbol,0;                       \
+symbol:		.frame	sp,0,ra
+
+/*
+ * NESTED - declare nested routine entry point
+ */
+#define	NESTED(symbol, framesize, rpc)                  \
+		.globl	symbol;                         \
+		.align	2;                              \
+		.type	symbol,@function;               \
+		.ent	symbol,0;                       \
+symbol:		.frame	sp, framesize, rpc
+
+/*
+ * END - mark end of function
+ */
+#define	END(function)                                   \
+		.end	function;		        \
+		.size	function,.-function
+
+/*
+ * EXPORT - export definition of symbol
+ */
+#define	EXPORT(symbol)                                  \
+		.globl	symbol;                         \
+symbol:
+
+/*
+ * ABS - export absolute symbol
+ */
+#define	ABS(symbol,value)                               \
+		.globl	symbol;                         \
+symbol		=	value
+
+#define	PANIC(msg)                                      \
+		.set	push;				\
+		.set	reorder;                        \
+		la	a0,8f;                          \
+		jal	panic;                          \
+9:		b	9b;                             \
+		.set	pop;				\
+		TEXT(msg)
+
+/*
+ * Print formated string
+ */
+#define PRINT(string)                                   \
+		.set	push;				\
+		.set	reorder;                        \
+		la	a0,8f;                          \
+		jal	printk;                         \
+		.set	pop;				\
+		TEXT(string)
+
+#define	TEXT(msg)                                       \
+		.data;                                  \
+8:		.asciiz	msg;                            \
+		.previous;
+
+/*
+ * Build text tables
+ */
+#define TTABLE(string)                                  \
+		.text;                                  \
+		.word	1f;                             \
+		.previous;                              \
+		.data;                                  \
+1:		.asciz	string;                         \
+		.previous
+
+/*
+ * MIPS IV pref instruction.
+ * Use with .set noreorder only!
+ *
+ * MIPS IV implementations are free to treat this as a nop.  The R5000
+ * is one of them.  So we should have an option not to use this instruction.
+ */
+#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5)
+#define PREF(hint,addr)                                 \
+		pref	hint,addr
+#define PREFX(hint,addr)                                \
+		prefx	hint,addr
+#else
+#define PREF
+#define PREFX
+#endif
+
+/*
+ * MIPS ISA IV/V movn/movz instructions and equivalents for older CPUs.
+ */
+#if _MIPS_ISA == _MIPS_ISA_MIPS1
+#define MOVN(rd,rs,rt)                                  \
+		.set	push;				\
+		.set	reorder;			\
+		beqz	rt,9f;                          \
+		move	rd,rs;                          \
+		.set	pop;				\
+9:
+#define MOVZ(rd,rs,rt)                                  \
+		.set	push;				\
+		.set	reorder;			\
+		bnez	rt,9f;                          \
+		move	rd,rt;                          \
+		.set	pop;				\
+9:
+#endif /* _MIPS_ISA == _MIPS_ISA_MIPS1 */
+#if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3)
+#define MOVN(rd,rs,rt)                                  \
+		.set	push;				\
+		.set	noreorder;			\
+		bnezl	rt,9f;                          \
+		move	rd,rs;                          \
+		.set	pop;				\
+9:
+#define MOVZ(rd,rs,rt)                                  \
+		.set	push;				\
+		.set	noreorder;			\
+		beqzl	rt,9f;                          \
+		movz	rd,rs;                          \
+		.set	pop;				\
+9:
+#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) */
+#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5)
+#define MOVN(rd,rs,rt)                                  \
+		movn	rd,rs,rt
+#define MOVZ(rd,rs,rt)                                  \
+		movz	rd,rs,rt
+#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) */
+
+/*
+ * Stack alignment
+ */
+#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
+#define ALSZ	7
+#define ALMASK	~7
+#endif
+#if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
+    (_MIPS_ISA == _MIPS_ISA_MIPS5)
+#define ALSZ	15
+#define ALMASK	~15
+#endif
+
+/*
+ * Size of a register
+ */
+#ifdef __mips64
+#define SZREG	8
+#else
+#define SZREG	4
+#endif
+
+/*
+ * Use the following macros in assemblercode to load/store registers,
+ * pointers etc.
+ */
+#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
+#define REG_S sw
+#define REG_L lw
+#define PTR_SUBU subu
+#define PTR_ADDU addu
+#endif
+#if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
+    (_MIPS_ISA == _MIPS_ISA_MIPS5)
+#define REG_S sd
+#define REG_L ld
+/* We still live in a 32 bit address space ...  */
+#define PTR_SUBU subu
+#define PTR_ADDU addu
+#endif
+
+/*
+ * How to add/sub/load/store/shift C int variables.
+ */
+#if (_MIPS_SZINT == 32)
+#define INT_ADD	add
+#define INT_ADDI	addi
+#define INT_ADDU	addu
+#define INT_ADDIU	addiu
+#define INT_SUB	add
+#define INT_SUBI	subi
+#define INT_SUBU	subu
+#define INT_SUBIU	subu
+#define INT_L		lw
+#define INT_S		sw
+#define LONG_SLL	sll
+#define LONG_SLLV	sllv
+#define LONG_SRL	srl
+#define LONG_SRLV	srlv
+#define LONG_SRA	sra
+#define LONG_SRAV	srav
+#endif
+
+#if (_MIPS_SZINT == 64)
+#define INT_ADD	dadd
+#define INT_ADDI	daddi
+#define INT_ADDU	daddu
+#define INT_ADDIU	daddiu
+#define INT_SUB	dadd
+#define INT_SUBI	dsubi
+#define INT_SUBU	dsubu
+#define INT_SUBIU	dsubu
+#define INT_L		ld
+#define INT_S		sd
+#define LONG_SLL	dsll
+#define LONG_SLLV	dsllv
+#define LONG_SRL	dsrl
+#define LONG_SRLV	dsrlv
+#define LONG_SRA	dsra
+#define LONG_SRAV	dsrav
+#endif
+
+/*
+ * How to add/sub/load/store/shift C long variables.
+ */
+#if (_MIPS_SZLONG == 32)
+#define LONG_ADD	add
+#define LONG_ADDI	addi
+#define LONG_ADDU	addu
+#define LONG_ADDIU	addiu
+#define LONG_SUB	add
+#define LONG_SUBI	subi
+#define LONG_SUBU	subu
+#define LONG_SUBIU	subu
+#define LONG_L		lw
+#define LONG_S		sw
+#define LONG_SLL	sll
+#define LONG_SLLV	sllv
+#define LONG_SRL	srl
+#define LONG_SRLV	srlv
+#define LONG_SRA	sra
+#define LONG_SRAV	srav
+#endif
+
+#if (_MIPS_SZLONG == 64)
+#define LONG_ADD	dadd
+#define LONG_ADDI	daddi
+#define LONG_ADDU	daddu
+#define LONG_ADDIU	daddiu
+#define LONG_SUB	dadd
+#define LONG_SUBI	dsubi
+#define LONG_SUBU	dsubu
+#define LONG_SUBIU	dsubu
+#define LONG_L		ld
+#define LONG_S		sd
+#define LONG_SLL	dsll
+#define LONG_SLLV	dsllv
+#define LONG_SRL	dsrl
+#define LONG_SRLV	dsrlv
+#define LONG_SRA	dsra
+#define LONG_SRAV	dsrav
+#endif
+
+/*
+ * How to add/sub/load/store/shift pointers.
+ */
+#if (_MIPS_SZLONG == 32)
+#define PTR_ADD	add
+#define PTR_ADDI	addi
+#define PTR_ADDU	addu
+#define PTR_ADDIU	addiu
+#define PTR_SUB		add
+#define PTR_SUBI	subi
+#define PTR_SUBU	subu
+#define PTR_SUBIU	subu
+#define PTR_L		lw
+#define PTR_S		sw
+#define PTR_SLL		sll
+#define PTR_SLLV	sllv
+#define PTR_SRL		srl
+#define PTR_SRLV	srlv
+#define PTR_SRA		sra
+#define PTR_SRAV	srav
+
+#define PTR_SCALESHIFT	2
+#endif
+
+#if (_MIPS_SZLONG == 64)
+#define PTR_ADD	dadd
+#define PTR_ADDI	daddi
+#define PTR_ADDU	daddu
+#define PTR_ADDIU	daddiu
+#define PTR_SUB		dadd
+#define PTR_SUBI	dsubi
+#define PTR_SUBU	dsubu
+#define PTR_SUBIU	dsubu
+#define PTR_L		ld
+#define PTR_S		sd
+#define PTR_SLL		dsll
+#define PTR_SLLV	dsllv
+#define PTR_SRL		dsrl
+#define PTR_SRLV	dsrlv
+#define PTR_SRA		dsra
+#define PTR_SRAV	dsrav
+
+#define PTR_SCALESHIFT	3
+#endif
+
+/*
+ * Some cp0 registers were extended to 64bit for MIPS III.
+ */
+#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
+#define MFC0	mfc0
+#define MTC0	mtc0
+#endif
+#if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
+    (_MIPS_ISA == _MIPS_ISA_MIPS5)
+#define MFC0	dmfc0
+#define MTC0	dmtc0
+#endif
 
 #endif /* _SYS_ASM_H */
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sys/fpregdef.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sys/fpregdef.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sys/fpregdef.h	Wed Jun  7 15:33:40 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sys/fpregdef.h	Wed Jun  7 15:35:03 2000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998  Ralf Baechle
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -20,8 +20,42 @@
 #define _SYS_FPREGDEF_H
 
 /*
- * The real definitions come from the Linux kernel sources
+ * These definitions only cover the R3000-ish 16/32 register model.
+ * But we're trying to be R3000 friendly anyway ...
  */
-#include <asm/fpregdef.h>
+#define fv0	$f0      /* return value */
+#define fv0f	$f1
+#define fv1	$f2
+#define fv1f	$f3
+#define fa0	$f12     /* argument registers */
+#define fa0f	$f13
+#define fa1	$f14
+#define fa1f	$f15
+#define ft0	$f4      /* caller saved */
+#define ft0f	$f5
+#define ft1	$f6
+#define ft1f	$f7
+#define ft2	$f8
+#define ft2f	$f9
+#define ft3	$f10
+#define ft3f	$f11
+#define ft4	$f16
+#define ft4f	$f17
+#define ft5	$f18
+#define ft5f	$f19
+#define fs0	$f20     /* callee saved */
+#define fs0f	$f21
+#define fs1	$f22
+#define fs1f	$f23
+#define fs2	$f24
+#define fs2f	$f25
+#define fs3	$f26
+#define fs3f	$f27
+#define fs4	$f28
+#define fs4f	$f29
+#define fs5	$f30
+#define fs5f	$f31
+
+#define fcr31	$31      /* FPU status register */
 
 #endif /* _SYS_FPREGDEF_H */
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sys/regdef.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sys/regdef.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sys/regdef.h	Wed Jun  7 15:33:40 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sys/regdef.h	Wed Jun  7 15:35:03 2000
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1994, 1995 by Ralf Baechle.
+Copyright (C) 1994, 1995, 1996, 1997, 1998 by Ralf Baechle.
 
 This file is part of the GNU C Library.
 
@@ -18,13 +18,45 @@
 not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#ifndef _REGDEF_H
-#define _REGDEF_H
+#ifndef _SYS_REGDEF_H
+#define _SYS_REGDEF_H
 
 /*
- * The real definitions come from the Linux kernel sources
+ * Symbolic register names for 32 bit ABI
  */
-#include <asm/regdef.h>
-#include <asm/fpregdef.h>
+#define zero    $0      /* wired zero */
+#define AT      $1      /* assembler temp  - uppercase because of ".set at" */
+#define v0      $2      /* return value */
+#define v1      $3
+#define a0      $4      /* argument registers */
+#define a1      $5
+#define a2      $6
+#define a3      $7
+#define t0      $8      /* caller saved */
+#define t1      $9
+#define t2      $10
+#define t3      $11
+#define t4      $12
+#define t5      $13
+#define t6      $14
+#define t7      $15
+#define s0      $16     /* callee saved */
+#define s1      $17
+#define s2      $18
+#define s3      $19
+#define s4      $20
+#define s5      $21
+#define s6      $22
+#define s7      $23
+#define t8      $24     /* caller saved */
+#define t9      $25
+#define jp      $25     /* PIC jump register */
+#define k0      $26     /* kernel scratch */
+#define k1      $27
+#define gp      $28     /* global pointer */
+#define sp      $29     /* stack pointer */
+#define fp      $30     /* frame pointer */
+#define s8	$30	/* same like fp! */
+#define ra      $31     /* return address */
 
-#endif /* _REGDEF_H */
+#endif /* _SYS_REGDEF_H */
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sys/timex.h glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sys/timex.h
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sys/timex.h	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sys/timex.h	Wed Jun  7 15:35:03 2000
@@ -0,0 +1,263 @@
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef	_SYS_TIMEX_H
+
+#define	_SYS_TIMEX_H	1
+#include <features.h>
+
+#include <sys/time.h>
+
+/*****************************************************************************
+ *                                                                           *
+ * Copyright (c) David L. Mills 1993                                         *
+ *                                                                           *
+ * Permission to use, copy, modify, and distribute this software and its     *
+ * documentation for any purpose and without fee is hereby granted, provided *
+ * that the above copyright notice appears in all copies and that both the   *
+ * copyright notice and this permission notice appear in supporting          *
+ * documentation, and that the name University of Delaware not be used in    *
+ * advertising or publicity pertaining to distribution of the software       *
+ * without specific, written prior permission.  The University of Delaware   *
+ * makes no representations about the suitability this software for any      *
+ * purpose.  It is provided "as is" without express or implied warranty.     *
+ *                                                                           *
+ *****************************************************************************/
+
+/*
+ * Modification history timex.h
+ *
+ * 29 Dec 97	Russell King
+ *	Moved CLOCK_TICK_RATE, CLOCK_TICK_FACTOR and FINETUNE to asm/timex.h
+ *	for ARM machines
+ *
+ *  9 Jan 97    Adrian Sun
+ *      Shifted LATCH define to allow access to alpha machines.
+ *
+ * 26 Sep 94	David L. Mills
+ *	Added defines for hybrid phase/frequency-lock loop.
+ *
+ * 19 Mar 94	David L. Mills
+ *	Moved defines from kernel routines to header file and added new
+ *	defines for PPS phase-lock loop.
+ *
+ * 20 Feb 94	David L. Mills
+ *	Revised status codes and structures for external clock and PPS
+ *	signal discipline.
+ *
+ * 28 Nov 93	David L. Mills
+ *	Adjusted parameters to improve stability and increase poll
+ *	interval.
+ *
+ * 17 Sep 93    David L. Mills
+ *      Created file $NTP/include/sys/timex.h
+ * 07 Oct 93    Torsten Duwe
+ *      Derived linux/timex.h
+ * 1995-08-13    Torsten Duwe
+ *      kernel PLL updated to 1994-12-13 specs (rfc-1589)
+ * 1997-08-30    Ulrich Windl
+ *      Added new constant NTP_PHASE_LIMIT
+ */
+
+/*
+ * The following defines establish the engineering parameters of the PLL
+ * model. The HZ variable establishes the timer interrupt frequency, 100 Hz
+ * for the SunOS kernel, 256 Hz for the Ultrix kernel and 1024 Hz for the
+ * OSF/1 kernel. The SHIFT_HZ define expresses the same value as the
+ * nearest power of two in order to avoid hardware multiply operations.
+ */
+#define SHIFT_HZ 7		/* log2(HZ) */
+
+/*
+ * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
+ * for a slightly underdamped convergence characteristic. SHIFT_KH
+ * establishes the damping of the FLL and is chosen by wisdom and black
+ * art.
+ *
+ * MAXTC establishes the maximum time constant of the PLL. With the
+ * SHIFT_KG and SHIFT_KF values given and a time constant range from
+ * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours,
+ * respectively.
+ */
+#define SHIFT_KG 6		/* phase factor (shift) */
+#define SHIFT_KF 16		/* PLL frequency factor (shift) */
+#define SHIFT_KH 2		/* FLL frequency factor (shift) */
+#define MAXTC 6			/* maximum time constant (shift) */
+
+/*
+ * The SHIFT_SCALE define establishes the decimal point of the time_phase
+ * variable which serves as an extension to the low-order bits of the
+ * system clock variable. The SHIFT_UPDATE define establishes the decimal
+ * point of the time_offset variable which represents the current offset
+ * with respect to standard time. The FINEUSEC define represents 1 usec in
+ * scaled units.
+ *
+ * SHIFT_USEC defines the scaling (shift) of the time_freq and
+ * time_tolerance variables, which represent the current frequency
+ * offset and maximum frequency tolerance.
+ *
+ * FINEUSEC is 1 us in SHIFT_UPDATE units of the time_phase variable.
+ */
+#define SHIFT_SCALE 22		/* phase scale (shift) */
+#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* time offset scale (shift) */
+#define SHIFT_USEC 16		/* frequency offset scale (shift) */
+#define FINEUSEC (1L << SHIFT_SCALE) /* 1 us in phase units */
+
+#define MAXPHASE 512000L        /* max phase error (us) */
+#define MAXFREQ (512L << SHIFT_USEC)  /* max frequency error (ppm) */
+#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */
+#define MINSEC 16L              /* min interval between updates (s) */
+#define MAXSEC 1200L            /* max interval between updates (s) */
+#define	NTP_PHASE_LIMIT	(MAXPHASE << 5)	/* beyond max. dispersion */
+
+/*
+ * The following defines are used only if a pulse-per-second (PPS)
+ * signal is available and connected via a modem control lead, such as
+ * produced by the optional ppsclock feature incorporated in the Sun
+ * asynch driver. They establish the design parameters of the frequency-
+ * lock loop used to discipline the CPU clock oscillator to the PPS
+ * signal.
+ *
+ * PPS_AVG is the averaging factor for the frequency loop, as well as
+ * the time and frequency dispersion.
+ *
+ * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum
+ * calibration intervals, respectively, in seconds as a power of two.
+ *
+ * PPS_VALID is the maximum interval before the PPS signal is considered
+ * invalid and protocol updates used directly instead.
+ *
+ * MAXGLITCH is the maximum interval before a time offset of more than
+ * MAXTIME is believed.
+ */
+#define PPS_AVG 2		/* pps averaging constant (shift) */
+#define PPS_SHIFT 2		/* min interval duration (s) (shift) */
+#define PPS_SHIFTMAX 8		/* max interval duration (s) (shift) */
+#define PPS_VALID 120		/* pps signal watchdog max (s) */
+#define MAXGLITCH 30		/* pps signal glitch max (s) */
+
+/*
+ * Pick up the architecture specific timex specifications
+ */
+#define CLOCK_TICK_RATE	1193180 /* Underlying HZ */
+#define CLOCK_TICK_FACTOR	20	/* Factor of both 1000000 and CLOCK_TICK_RATE */
+#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
+	(1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
+		<< (SHIFT_SCALE-SHIFT_HZ)) / HZ)
+
+
+/* LATCH is used in the interval timer and ftape setup. */
+#define LATCH  ((CLOCK_TICK_RATE + HZ/2) / HZ)	/* For divider */
+
+/*
+ * syscall interface - used (mainly by NTP daemon)
+ * to discipline kernel clock oscillator
+ */
+struct timex {
+	unsigned int modes;	/* mode selector */
+	long offset;		/* time offset (usec) */
+	long freq;		/* frequency offset (scaled ppm) */
+	long maxerror;		/* maximum error (usec) */
+	long esterror;		/* estimated error (usec) */
+	int status;		/* clock command/status */
+	long constant;		/* pll time constant */
+	long precision;		/* clock precision (usec) (read only) */
+	long tolerance;		/* clock frequency tolerance (ppm)
+				 * (read only)
+				 */
+	struct timeval time;	/* (read only) */
+	long tick;		/* (modified) usecs between clock ticks */
+
+	long ppsfreq;           /* pps frequency (scaled ppm) (ro) */
+	long jitter;            /* pps jitter (us) (ro) */
+	int shift;              /* interval duration (s) (shift) (ro) */
+	long stabil;            /* pps stability (scaled ppm) (ro) */
+	long jitcnt;            /* jitter limit exceeded (ro) */
+	long calcnt;            /* calibration intervals (ro) */
+	long errcnt;            /* calibration errors (ro) */
+	long stbcnt;            /* stability limit exceeded (ro) */
+
+	int  :32; int  :32; int  :32; int  :32;
+	int  :32; int  :32; int  :32; int  :32;
+	int  :32; int  :32; int  :32; int  :32;
+};
+
+/*
+ * Mode codes (timex.mode)
+ */
+#define ADJ_OFFSET		0x0001	/* time offset */
+#define ADJ_FREQUENCY		0x0002	/* frequency offset */
+#define ADJ_MAXERROR		0x0004	/* maximum time error */
+#define ADJ_ESTERROR		0x0008	/* estimated time error */
+#define ADJ_STATUS		0x0010	/* clock status */
+#define ADJ_TIMECONST		0x0020	/* pll time constant */
+#define ADJ_TICK		0x4000	/* tick value */
+#define ADJ_OFFSET_SINGLESHOT	0x8001	/* old-fashioned adjtime */
+
+/* xntp 3.4 compatibility names */
+#define MOD_OFFSET	ADJ_OFFSET
+#define MOD_FREQUENCY	ADJ_FREQUENCY
+#define MOD_MAXERROR	ADJ_MAXERROR
+#define MOD_ESTERROR	ADJ_ESTERROR
+#define MOD_STATUS	ADJ_STATUS
+#define MOD_TIMECONST	ADJ_TIMECONST
+#define MOD_CLKB	ADJ_TICK
+#define MOD_CLKA	ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */
+
+
+/*
+ * Status codes (timex.status)
+ */
+#define STA_PLL		0x0001	/* enable PLL updates (rw) */
+#define STA_PPSFREQ	0x0002	/* enable PPS freq discipline (rw) */
+#define STA_PPSTIME	0x0004	/* enable PPS time discipline (rw) */
+#define STA_FLL		0x0008	/* select frequency-lock mode (rw) */
+
+#define STA_INS		0x0010	/* insert leap (rw) */
+#define STA_DEL		0x0020	/* delete leap (rw) */
+#define STA_UNSYNC	0x0040	/* clock unsynchronized (rw) */
+#define STA_FREQHOLD	0x0080	/* hold frequency (rw) */
+
+#define STA_PPSSIGNAL	0x0100	/* PPS signal present (ro) */
+#define STA_PPSJITTER	0x0200	/* PPS signal jitter exceeded (ro) */
+#define STA_PPSWANDER	0x0400	/* PPS signal wander exceeded (ro) */
+#define STA_PPSERROR	0x0800	/* PPS signal calibration error (ro) */
+
+#define STA_CLOCKERR	0x1000	/* clock hardware fault (ro) */
+
+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
+    STA_PPSERROR | STA_CLOCKERR) /* read-only bits */
+
+/*
+ * Clock states (time_state)
+ */
+#define TIME_OK		0	/* clock synchronized, no leap second */
+#define TIME_INS	1	/* insert leap second */
+#define TIME_DEL	2	/* delete leap second */
+#define TIME_OOP	3	/* leap second in progress */
+#define TIME_WAIT	4	/* leap second has occurred */
+#define TIME_ERROR	5	/* clock not synchronized */
+#define TIME_BAD	TIME_ERROR /* bw compat */
+
+__BEGIN_DECLS
+
+extern int __adjtimex __P ((struct timex *__ntx));
+
+__END_DECLS
+
+#endif /* sys/timex.h */
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/syscalls.list glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/syscalls.list
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/syscalls.list	Wed Jun  7 15:33:40 2000
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/syscalls.list	Wed Jun  7 15:35:03 2000
@@ -8,6 +8,8 @@
 cacheflush	-	cacheflush	3	_flush_cache	cacheflush
 sysmips		-	sysmips		4	__sysmips	sysmips
 
+s_pause		-	pause		0	__sys_pause	 pause
+
 # override select.S in parent directory:
 select		-	select		5	__select	select
 sigsuspend	-	sigsuspend	1	__sigsuspend	sigsuspend
diff -ruN glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sysdep.S glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sysdep.S
--- glibc-2.0.7/sysdeps/unix/sysv/linux/mips/sysdep.S	Wed Dec 31 16:00:00 1969
+++ glibc-2.0.7-patched/sysdeps/unix/sysv/linux/mips/sysdep.S	Wed Jun  7 15:35:04 2000
@@ -0,0 +1,35 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* Because the Linux version is in fact MIPS/ELF and the start.? file
+   for this system (sysdeps/mips/elf/start.S) is also used by The Hurd
+   and therefore this files must not contain the definition of the
+   `errno' variable (I don't know why, ask Roland), we have to define
+   it somewhere else.
+
+   ...and this place is here.  */
+	.bss
+	.globl	errno
+	.type	errno,@object
+	.size	errno,4
+errno:	.word	4
+	.text
+
+#include <sysdeps/unix/mips/sysdep.S>
