summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/alpha/dl-machine.h8
-rw-r--r--sysdeps/alpha/setjmp.S6
-rw-r--r--sysdeps/generic/_G_config.h9
-rw-r--r--sysdeps/generic/bits/confname.h30
-rw-r--r--sysdeps/generic/bits/resource.h26
-rw-r--r--sysdeps/generic/bits/statfs.h10
-rw-r--r--sysdeps/generic/bits/types.h17
-rw-r--r--sysdeps/generic/memcmp.c2
-rw-r--r--sysdeps/generic/memset.c3
-rw-r--r--sysdeps/generic/strchr.c5
-rw-r--r--sysdeps/generic/strlen.c7
-rw-r--r--sysdeps/generic/sys/mman.h10
-rw-r--r--sysdeps/i386/dl-machine.h8
-rw-r--r--sysdeps/i386/elf/start.S7
-rw-r--r--sysdeps/i386/setjmp.S8
-rw-r--r--sysdeps/i386/sys/ucontext.h120
-rw-r--r--sysdeps/libm-i387/s_fma.S32
-rw-r--r--sysdeps/libm-i387/s_fmaf.S32
-rw-r--r--sysdeps/libm-i387/s_fmal.S32
-rw-r--r--sysdeps/libm-i387/s_llrint.S2
-rw-r--r--sysdeps/libm-i387/s_llrintf.S34
-rw-r--r--sysdeps/libm-i387/s_llrintl.S34
-rw-r--r--sysdeps/libm-i387/s_lrint.S2
-rw-r--r--sysdeps/libm-i387/s_lrintf.S33
-rw-r--r--sysdeps/libm-i387/s_lrintl.S33
-rw-r--r--sysdeps/libm-i387/s_scalbln.c2
-rw-r--r--sysdeps/libm-i387/s_scalblnf.c2
-rw-r--r--sysdeps/libm-i387/s_scalblnl.c2
-rw-r--r--sysdeps/libm-i387/s_scalbn.S2
-rw-r--r--sysdeps/libm-i387/s_scalbnf.S2
-rw-r--r--sysdeps/libm-i387/s_scalbnl.S2
-rw-r--r--sysdeps/libm-ieee754/s_clog10.c65
-rw-r--r--sysdeps/libm-ieee754/s_clog10f.c61
-rw-r--r--sysdeps/libm-ieee754/s_clog10l.c61
-rw-r--r--sysdeps/libm-ieee754/s_fma.c28
-rw-r--r--sysdeps/libm-ieee754/s_fmaf.c28
-rw-r--r--sysdeps/libm-ieee754/s_fmal.c28
-rw-r--r--sysdeps/libm-ieee754/s_llrint.c227
-rw-r--r--sysdeps/libm-ieee754/s_llrintf.c78
-rw-r--r--sysdeps/libm-ieee754/s_llrintl.c86
-rw-r--r--sysdeps/libm-ieee754/s_llround.c151
-rw-r--r--sysdeps/libm-ieee754/s_llroundf.c63
-rw-r--r--sysdeps/libm-ieee754/s_llroundl.c78
-rw-r--r--sysdeps/libm-ieee754/s_lrint.c225
-rw-r--r--sysdeps/libm-ieee754/s_lrintf.c78
-rw-r--r--sysdeps/libm-ieee754/s_lrintl.c86
-rw-r--r--sysdeps/libm-ieee754/s_lround.c143
-rw-r--r--sysdeps/libm-ieee754/s_lroundf.c63
-rw-r--r--sysdeps/libm-ieee754/s_lroundl.c78
-rw-r--r--sysdeps/libm-ieee754/s_nextafterl.c2
-rw-r--r--sysdeps/libm-ieee754/s_nextafterx.c98
-rw-r--r--sysdeps/libm-ieee754/s_nextafterxf.c78
-rw-r--r--sysdeps/libm-ieee754/s_nextafterxl.c1
-rw-r--r--sysdeps/libm-ieee754/s_scalbln.c70
-rw-r--r--sysdeps/libm-ieee754/s_scalblnf.c63
-rw-r--r--sysdeps/libm-ieee754/s_scalblnl.c71
-rw-r--r--sysdeps/libm-ieee754/s_scalbn.c4
-rw-r--r--sysdeps/libm-ieee754/s_scalbnf.c4
-rw-r--r--sysdeps/libm-ieee754/s_scalbnl.c4
-rw-r--r--sysdeps/m68k/dl-machine.h13
-rw-r--r--sysdeps/m68k/m68020/bits/string.h26
-rw-r--r--sysdeps/mach/hurd/bits/fcntl.h76
-rw-r--r--sysdeps/mach/hurd/bits/stat.h64
-rw-r--r--sysdeps/mach/hurd/sys/param.h4
-rw-r--r--sysdeps/posix/open64.c43
-rw-r--r--sysdeps/posix/tempname.c8
-rw-r--r--sysdeps/powerpc/dl-machine.h8
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h12
-rw-r--r--sysdeps/sparc/sparc32/setjmp.S6
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h8
-rw-r--r--sysdeps/sparc/sparc64/sub_n.S4
-rw-r--r--sysdeps/stub/fstatfs.c4
-rw-r--r--sysdeps/stub/fstatfs64.c (renamed from sysdeps/stub/setenv.c)34
-rw-r--r--sysdeps/stub/fxstat.c2
-rw-r--r--sysdeps/stub/fxstat64.c (renamed from sysdeps/stub/morecore.c)40
-rw-r--r--sysdeps/stub/getrlimit64.c (renamed from sysdeps/stub/putenv.c)12
-rw-r--r--sysdeps/stub/lseek64.c49
-rw-r--r--sysdeps/stub/lxstat64.c (renamed from sysdeps/stub/lxstat.c)6
-rw-r--r--sysdeps/stub/open64.c52
-rw-r--r--sysdeps/stub/pread64.c43
-rw-r--r--sysdeps/stub/pwrite64.c43
-rw-r--r--sysdeps/stub/readdir64.c (renamed from sysdeps/stub/getenv.c)16
-rw-r--r--sysdeps/stub/readdir64_r.c (renamed from sysdeps/stub/sbrk.c)19
-rw-r--r--sysdeps/stub/setrlimit64.c34
-rw-r--r--sysdeps/stub/statfs64.c31
-rw-r--r--sysdeps/stub/sysd-stdio.c116
-rw-r--r--sysdeps/stub/sysdep.h3
-rw-r--r--sysdeps/stub/tempname.c7
-rw-r--r--sysdeps/stub/xstat64.c36
-rw-r--r--sysdeps/unix/bsd/bits/fcntl.h65
-rw-r--r--sysdeps/unix/bsd/bits/stat.h2
-rw-r--r--sysdeps/unix/bsd/bsd4.4/wait3.c2
-rw-r--r--sysdeps/unix/bsd/osf/alpha/bits/stat.h2
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/resource.h42
-rw-r--r--sysdeps/unix/sysv/i386/i686/time.S27
-rw-r--r--sysdeps/unix/sysv/i386/time.S6
-rw-r--r--sysdeps/unix/sysv/linux/_G_config.h15
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/dirent.h50
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h79
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/stat.h2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/types.h21
-rw-r--r--sysdeps/unix/sysv/linux/bits/dirent.h25
-rw-r--r--sysdeps/unix/sysv/linux/bits/fcntl.h84
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h115
-rw-r--r--sysdeps/unix/sysv/linux/bits/stat.h45
-rw-r--r--sysdeps/unix/sysv/linux/bits/statfs.h36
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h23
-rw-r--r--sysdeps/unix/sysv/linux/getsysstats.c6
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c1
-rw-r--r--sysdeps/unix/sysv/linux/llseek.c6
-rw-r--r--sysdeps/unix/sysv/linux/lseek64.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/fcntl.h94
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/stat.h51
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/statfs.h40
-rw-r--r--sysdeps/unix/sysv/linux/poll.c5
-rw-r--r--sysdeps/unix/sysv/linux/readv.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h80
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/ioctls.h8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h23
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S13
-rw-r--r--sysdeps/unix/sysv/linux/sys/mman.h10
-rw-r--r--sysdeps/unix/sysv/linux/sys/param.h6
-rw-r--r--sysdeps/unix/sysv/linux/writev.c4
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/bits/stat.h4
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h2
-rw-r--r--sysdeps/wordsize-32/inttypes.h29
-rw-r--r--sysdeps/wordsize-64/inttypes.h27
128 files changed, 3274 insertions, 1150 deletions
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index d3eb242c04..3f65ae99a3 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -353,6 +353,14 @@ elf_machine_fixup_plt(struct link_map *l, const Elf64_Rela *reloc,
      hasn't made it into Icache yet, so there's nothing to clean up.  */
 }
 
+/* Return the final value of a plt relocation.  */
+static inline Elf64_Addr
+elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
+		       Elf64_Addr value)
+{
+  return value + reloc->r_addend;
+}
+
 #endif /* !dl_machine_h */
 
 #ifdef RESOLVE
diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S
index 48fe33b3ec..ae3ceb517d 100644
--- a/sysdeps/alpha/setjmp.S
+++ b/sysdeps/alpha/setjmp.S
@@ -70,11 +70,11 @@ END(__sigsetjmp)
 /* Put these traditional entry points in the same file so that we can
    elide much of the nonsense in trying to jmp to the real function.  */
 
-ENTRY(_setjmp)
+ENTRY(__setjmp)
 	ldgp	gp, 0(pv)
 	mov	0, a1
 	br	$sigsetjmp_local
-END(_setjmp)
+END(__setjmp)
 
 ENTRY(setjmp)
 	ldgp	gp, 0(pv)
@@ -82,5 +82,5 @@ ENTRY(setjmp)
 	br	$sigsetjmp_local
 END(setjmp)
 
-weak_extern(_setjmp)
+weak_alias(__setjmp, _setjmp)
 weak_extern(setjmp)
diff --git a/sysdeps/generic/_G_config.h b/sysdeps/generic/_G_config.h
index 84a552b41e..a9a182169b 100644
--- a/sysdeps/generic/_G_config.h
+++ b/sysdeps/generic/_G_config.h
@@ -15,16 +15,19 @@
    hold any value corresponding to members of the extended character
    set, as well as at least one value that does not correspond to any
    member of the extended character set.  */
-#define _WINT_T
+# define _WINT_T
 typedef unsigned int wint_t;
 #endif
 #define _G_size_t	size_t
 #define _G_fpos_t	__off_t
+#define _G_fpos64_t	__off_t
 #define _G_ssize_t	__ssize_t
 #define _G_off_t	__off_t
+#define _G_off64_t	__off_t
 #define	_G_pid_t	__pid_t
 #define	_G_uid_t	__uid_t
 #define _G_wint_t	wint_t
+#define _G_stat64	stat
 
 typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
 typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
@@ -57,9 +60,9 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 
 
 #if defined (__cplusplus) || defined (__STDC__)
-#define _G_ARGS(ARGLIST) ARGLIST
+# define _G_ARGS(ARGLIST) ARGLIST
 #else
-#define _G_ARGS(ARGLIST) ()
+# define _G_ARGS(ARGLIST) ()
 #endif
 
 #endif	/* _G_config.h */
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
index 5b5cf742b6..6926cad0ad 100644
--- a/sysdeps/generic/bits/confname.h
+++ b/sysdeps/generic/bits/confname.h
@@ -1,5 +1,5 @@
 /* `sysconf', `pathconf', and `confstr' NAME values.  Generic version.
-   Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -97,7 +97,7 @@ enum
     _SC_SHARED_MEMORY_OBJECTS,
 #define	_SC_SHARED_MEMORY_OBJECTS	_SC_SHARED_MEMORY_OBJECTS
     _SC_AIO_LISTIO_MAX,
-#define	_SC_AIO_LIST_MAX		_SC_AIO_LIST_MAX
+#define	_SC_AIO_LISTIO_MAX		_SC_AIO_LISTIO_MAX
     _SC_AIO_MAX,
 #define	_SC_AIO_MAX			_SC_AIO_MAX
     _SC_AIO_PRIO_DELTA_MAX,
@@ -316,10 +316,32 @@ enum
 #define	_SC_NL_TEXTMAX			_SC_NL_TEXTMAX
   };
 
-#ifdef __USE_POSIX2
+#if (defined __USE_POSIX2 || defined __USE_FILE_OFFSET64 \
+     || defined __USE_LARGEFILE64 || defined __USE_LARGEFILE)
 /* Values for the NAME argument to `confstr'.  */
 enum
   {
-    _CS_PATH			/* The default search path.  */
+    _CS_PATH,			/* The default search path.  */
+#define _CS_PATH		_CS_PATH
+
+#if (defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \
+     || defined __USE_LARGEFILE)
+    _CS_LFS_CFLAGS = 1000,
+# define _CS_LFS_CFLAGS		_CS_LFS_CFLAGS
+    _CS_LFS_LDFLAGS,
+# define _CS_LFS_LDFLAGS	_CS_LFS_LDFLAGS
+    _CS_LFS_LIBS,
+# define _CS_LFS_LIBS		_CS_LFS_LIBS
+    _CS_LFS_LINTFLAGS,
+# define _CS_LFS_LINTFLAGS	_CS_LFS_LINTFLAGS
+    _CS_LFS64_CFLAGS,
+# define _CS_LFS64_CFLAGS	_CS_LFS64_CFLAGS
+    _CS_LFS64_LDFLAGS,
+# define _CS_LFS64_LDFLAGS	_CS_LFS64_LDFLAGS
+    _CS_LFS64_LIBS,
+# define _CS_LFS64_LIBS		_CS_LFS64_LIBS
+    _CS_LFS64_LINTFLAGS
+# define _CS_LFS64_LINTFLAGS	_CS_LFS64_LINTFLAGS
+#endif
   };
 #endif
diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h
index 2c35c12a47..46cf9a7af5 100644
--- a/sysdeps/generic/bits/resource.h
+++ b/sysdeps/generic/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  4.4 BSD/generic GNU version.
-   Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -65,14 +65,34 @@ enum __rlimit_resource
 #define RLIM_INFINITY RLIM_INFINITY
   };
 
+/* Type for resource quantity measurement.  */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+#endif
+
 struct rlimit
   {
     /* The current (soft) limit.  */
-    int rlim_cur;
+    rlim_t rlim_cur;
     /* The hard limit.  */
-    int rlim_max;
+    rlim_t rlim_max;
   };
 
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+  {
+    /* The current (soft) limit.  */
+    rlim64_t rlim_cur;
+    /* The hard limit.  */
+    rlim64_t rlim_max;
+ };
+#endif
+
 /* Whose usage statistics do you want?  */
 enum __rusage_who
 /* The macro definitions are necessary because some programs want
diff --git a/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h
index 10bc0728b2..9fa3388801 100644
--- a/sysdeps/generic/bits/statfs.h
+++ b/sysdeps/generic/bits/statfs.h
@@ -38,11 +38,11 @@ struct statfs
   {
     unsigned int f_type;
     unsigned int f_bsize;
-    unsigned int f_blocks;
-    unsigned int f_bfree;
-    unsigned int f_bavail;
-    unsigned int f_files;
-    unsigned int f_ffree;
+    __fsblkcnt_t f_blocks;
+    __fsblkcnt_t f_bfree;
+    __fsblkcnt_t f_bavail;
+    __fsblkcnt_t f_files;
+    __fsblkcnt_t f_ffree;
     __fsid_t f_fsid;
     unsigned int f_namelen;
     unsigned int f_spare[6];
diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h
index c264adc917..fdb36f0b54 100644
--- a/sysdeps/generic/bits/types.h
+++ b/sysdeps/generic/bits/types.h
@@ -65,6 +65,8 @@ typedef int __pid_t;		/* Type of process identifications.  */
 typedef int __ssize_t;		/* Type of a byte count, or error.  */
 typedef __u_quad_t __fsid_t;	/* Type of file system IDs.  */
 typedef long int __clock_t;	/* Type of CPU usage counts.  */
+typedef long int __rlim_t;	/* Type for resource measurement.  */
+typedef __quad_t __rlim64_t;	/* Type for resource measurement (LFS).  */
 
 /* Everythin' else.  */
 typedef long int __daddr_t;	/* The type of a disk address.  */
@@ -91,4 +93,19 @@ typedef struct
 
 typedef unsigned long int __fd_mask;
 
+
+/* Types from the Large File Support interface.  */
+
+/* Type to count number os disk blocks.  */
+typedef long int __blkcnt_t;
+typedef __quad_t __blkcnt64_t;
+
+/* Type to count file system blocks.  */
+typedef unsigned int __fsblkcnt_t;
+typedef __u_quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes.  */
+typedef unsigned long int __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
 #endif /* bits/types.h */
diff --git a/sysdeps/generic/memcmp.c b/sysdeps/generic/memcmp.c
index 8fa371192c..844cdc6afb 100644
--- a/sysdeps/generic/memcmp.c
+++ b/sysdeps/generic/memcmp.c
@@ -132,6 +132,7 @@ memcmp_common_alignment (srcp1, srcp2, len)
 
   switch (len % 4)
     {
+    default: /* Avoid warning about uninitialized local variables.  */
     case 2:
       a0 = ((op_t *) srcp1)[0];
       b0 = ((op_t *) srcp2)[0];
@@ -233,6 +234,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
 
   switch (len % 4)
     {
+    default: /* Avoid warning about uninitialized local variables.  */
     case 2:
       a1 = ((op_t *) srcp1)[0];
       a2 = ((op_t *) srcp1)[1];
diff --git a/sysdeps/generic/memset.c b/sysdeps/generic/memset.c
index 1369698652..239dc21e3c 100644
--- a/sysdeps/generic/memset.c
+++ b/sysdeps/generic/memset.c
@@ -38,7 +38,8 @@ memset (dstpp, c, len)
       cccc |= cccc << 8;
       cccc |= cccc << 16;
       if (OPSIZ > 4)
-	cccc |= cccc << 32;
+	/* Do the shift in two steps to avoid warning if long has 32 bits.  */
+	cccc |= (cccc << 16) << 16;
 
       /* There are at least some bytes to set.
 	 No need to test for LEN == 0 in this alignment loop.  */
diff --git a/sysdeps/generic/strchr.c b/sysdeps/generic/strchr.c
index 3663382556..7c1eb9578a 100644
--- a/sysdeps/generic/strchr.c
+++ b/sysdeps/generic/strchr.c
@@ -63,7 +63,7 @@ strchr (s, c)
   switch (sizeof (longword))
     {
     case 4: magic_bits = 0x7efefeffL; break;
-    case 8: magic_bits = (0x7efefefeL << 32) | 0xfefefeffL; break;
+    case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
     default:
       abort ();
     }
@@ -72,7 +72,8 @@ strchr (s, c)
   charmask = c | (c << 8);
   charmask |= charmask << 16;
   if (sizeof (longword) > 4)
-    charmask |= charmask << 32;
+    /* Do the shift in two steps to avoid a warning if long has 32 bits.  */
+    charmask |= (charmask << 16) << 16;
   if (sizeof (longword) > 8)
     abort ();
 
diff --git a/sysdeps/generic/strlen.c b/sysdeps/generic/strlen.c
index 1fb8b1c97c..b031df8103 100644
--- a/sysdeps/generic/strlen.c
+++ b/sysdeps/generic/strlen.c
@@ -60,9 +60,10 @@ strlen (str)
   if (sizeof (longword) > 4)
     {
       /* 64-bit version of the magic.  */
-      magic_bits = (0x7efefefeL << 32) | 0xfefefeffL;
-      himagic = (himagic << 32) | himagic;
-      lomagic = (lomagic << 32) | lomagic;
+      /* Do the shift in two steps to avoid a warning if long has 32 bits.  */
+      magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
+      himagic = ((himagic << 16) << 16) | himagic;
+      lomagic = ((lomagic << 16) << 16) | lomagic;
     }
   if (sizeof (longword) > 8)
     abort ();
diff --git a/sysdeps/generic/sys/mman.h b/sysdeps/generic/sys/mman.h
index 6484e028c9..6e41a923d5 100644
--- a/sysdeps/generic/sys/mman.h
+++ b/sysdeps/generic/sys/mman.h
@@ -91,8 +91,18 @@ __BEGIN_DECLS
 
 extern __caddr_t __mmap __P ((__caddr_t __addr, size_t __len, int __prot,
 			      int __flags, int __fd, __off_t __offset));
+#ifndef __USE_FILE_OFFSET64
 extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
 			    int __flags, int __fd, __off_t __offset));
+#else
+extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			    int __flags, int __fd, __off_t __offset))
+     __asm__ ("mmap64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern __caddr_t mmap64 __P ((__caddr_t __addr, size_t __len, int __prot,
+			      int __flags, int __fd, __off64_t __offset));
+#endif
 
 /* Deallocate any mapping for the region starting at ADDR and extending LEN
    bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 0ac67c05d9..c347a515a4 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -290,6 +290,14 @@ elf_machine_fixup_plt (struct link_map *map, const Elf32_Rel *reloc,
   *reloc_addr = value;
 }
 
+/* Return the final value of a plt relocation.  */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
+		       Elf32_Addr value)
+{
+  return value;
+}
+
 #endif /* !dl_machine_h */
 
 #ifdef RESOLVE
diff --git a/sysdeps/i386/elf/start.S b/sysdeps/i386/elf/start.S
index 706e5c963f..7416c0ace9 100644
--- a/sysdeps/i386/elf/start.S
+++ b/sysdeps/i386/elf/start.S
@@ -94,6 +94,13 @@ _start:
 	call exit
 	hlt			/* Crash if somehow `exit' does return.  */
 
+/* To fulfill the System V/i386 ABI we need this symbol.  Yuck, it's so
+   meaningless since we don't support machines < 80386.  */
+	.section .rodata
+	.globl _fp_hw
+	.long 3
+	.size _fp_hw, 4
+
 /* Define a symbol for the first piece of initialized data.  */
 	.data
 	.globl __data_start
diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
index 1ba3fc5a75..598eef78e7 100644
--- a/sysdeps/i386/setjmp.S
+++ b/sysdeps/i386/setjmp.S
@@ -20,6 +20,7 @@
 #include <sysdep.h>
 #define _ASM
 #include <bits/setjmp.h>
+#include <asm-syntax.h>
 
 	/* Binary compatibility entry point.  */
 ENTRY (__setjmp)
@@ -47,9 +48,10 @@ ENTRY (__sigsetjmp)
            we can't save and restore our caller's value.  Instead, we do an
            indirect jump through the GOT, using for the temporary register
            %ecx, which is call-clobbered.  */
-	call here
-here:	popl %ecx
-	addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx
+	call L(here)
+L(here):
+	popl %ecx
+	addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ecx
 	movl C_SYMBOL_NAME(__sigjmp_save@GOT)(%ecx), %ecx
 	jmp *%ecx
 #else
diff --git a/sysdeps/i386/sys/ucontext.h b/sysdeps/i386/sys/ucontext.h
new file mode 100644
index 0000000000..17b6b6c76b
--- /dev/null
+++ b/sysdeps/i386/sys/ucontext.h
@@ -0,0 +1,120 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* System V/i386 ABI compliant context switching support.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+/* Type for general register.  */
+typedef int greg_t;
+
+/* Number of general registers.  */
+#define NGREG	19
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NGREG];
+
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  GS = 0,
+#define GS	GS
+  FS,
+#define FS	FS
+  ES,
+#define ES	ES
+  DS,
+#define DS	DS
+  EDI
+#define EDI	EDI
+  ESI
+#define ESI	ESI
+  EBP,
+#define EBP	EBP
+  ESP,
+#define ESP	ESP
+  EBX,
+#define EBX	EBX
+  EDX,
+#define EDX	EDX
+  ECX,
+#define ECX	ECX
+  EAX,
+#define EAX	EAX
+  TRAPNO,
+#define TRAPNO	TRAPNO
+  ERR,
+#define ERR	ERR
+  EIP,
+#define EIP	EIP
+  CS,
+#define CS	CS
+  EFL,
+#define EFL	EFL
+  UESP,
+#define UESP	UESP
+  SS
+#define SS	SS
+};
+
+/* Structure to describe FPU registers.  */
+typedef struct fpregset
+  {
+    union
+      {
+	struct fpchip_state
+	  {
+	    int state[27];
+	    int status;
+	  } fpchip_state;
+
+	struct fp_emul_space
+	  {
+	    char fp_emul[246];
+	    char fp_epad[2];
+	  } fp_emul_space;
+
+	int f_fpregs[62];
+      } fp_reg_set;
+
+    long int f_wregs[33];
+  } fpregset_t;
+
+/* Context to describe whole processor state.  */
+typedef struct
+  {
+    gregset_t gregs;
+    fpregset_t fpregs;
+  } mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext
+  {
+    unsigned long int uc_flags;
+    struct ucontext *uc_links;
+    __sigset_t uc_sigmask;
+    stack_t uc_stack;
+    mcontext_t uc_mcontext;
+    long int uc_filler[5];
+  } ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/libm-i387/s_fma.S b/sysdeps/libm-i387/s_fma.S
new file mode 100644
index 0000000000..deeac574a7
--- /dev/null
+++ b/sysdeps/libm-i387/s_fma.S
@@ -0,0 +1,32 @@
+/* Compute (X * Y) + Z as ternary operation.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+	.text
+ENTRY(__fma)
+	fldl	4(%esp)		// x
+	fldl	12(%esp)	// x : y
+	fmulp			// x * y
+	fldl	20(%esp)	// z : x * y
+	fmulp			// (x * y) + z
+	ret
+END(__fma)
+weak_alias (__fma, fma)
diff --git a/sysdeps/libm-i387/s_fmaf.S b/sysdeps/libm-i387/s_fmaf.S
new file mode 100644
index 0000000000..726c49d12c
--- /dev/null
+++ b/sysdeps/libm-i387/s_fmaf.S
@@ -0,0 +1,32 @@
+/* Compute (X * Y) + Z as ternary operation.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+	.text
+ENTRY(__fmaf)
+	flds	4(%esp)		// x
+	flds	8(%esp)		// x : y
+	fmulp			// x * y
+	flds	12(%esp)	// z : x * y
+	fmulp			// (x * y) + z
+	ret
+END(__fmaf)
+weak_alias (__fmaf, fmaf)
diff --git a/sysdeps/libm-i387/s_fmal.S b/sysdeps/libm-i387/s_fmal.S
new file mode 100644
index 0000000000..be8b557902
--- /dev/null
+++ b/sysdeps/libm-i387/s_fmal.S
@@ -0,0 +1,32 @@
+/* Compute (X * Y) + Z as ternary operation.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+	.text
+ENTRY(__fmal)
+	fldt	4(%esp)		// x
+	fldt	16(%esp)	// x : y
+	fmulp			// x * y
+	fldt	28(%esp)	// z : x * y
+	fmulp			// (x * y) + z
+	ret
+END(__fmal)
+weak_alias (__fmal, fmal)
diff --git a/sysdeps/libm-i387/s_llrint.S b/sysdeps/libm-i387/s_llrint.S
index 49bfebc993..6109ec45c3 100644
--- a/sysdeps/libm-i387/s_llrint.S
+++ b/sysdeps/libm-i387/s_llrint.S
@@ -23,7 +23,7 @@
 
 	.text
 ENTRY(__llrint)
-	fldt	4(%esp)
+	fldl	4(%esp)
 	subl	$8, %esp
 	fistpll	(%esp)
 	fwait
diff --git a/sysdeps/libm-i387/s_llrintf.S b/sysdeps/libm-i387/s_llrintf.S
new file mode 100644
index 0000000000..c1e1c225c0
--- /dev/null
+++ b/sysdeps/libm-i387/s_llrintf.S
@@ -0,0 +1,34 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+	.text
+ENTRY(__llrintf)
+	flds	4(%esp)
+	subl	$8, %esp
+	fistpll	(%esp)
+	fwait
+	popl	%eax
+	popl	%edx
+	ret
+END(__llrintf)
+weak_alias (__llrintf, llrintf)
diff --git a/sysdeps/libm-i387/s_llrintl.S b/sysdeps/libm-i387/s_llrintl.S
new file mode 100644
index 0000000000..d894897d5e
--- /dev/null
+++ b/sysdeps/libm-i387/s_llrintl.S
@@ -0,0 +1,34 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+	.text
+ENTRY(__llrintl)
+	fldt	4(%esp)
+	subl	$8, %esp
+	fistpll	(%esp)
+	fwait
+	popl	%eax
+	popl	%edx
+	ret
+END(__llrintl)
+weak_alias (__llrintl, llrintl)
diff --git a/sysdeps/libm-i387/s_lrint.S b/sysdeps/libm-i387/s_lrint.S
index 3be4ca7903..40956ab0d0 100644
--- a/sysdeps/libm-i387/s_lrint.S
+++ b/sysdeps/libm-i387/s_lrint.S
@@ -23,7 +23,7 @@
 
 	.text
 ENTRY(__lrint)
-	fldt	4(%esp)
+	fldl	4(%esp)
 	subl	$4, %esp
 	fistpl	(%esp)
 	fwait
diff --git a/sysdeps/libm-i387/s_lrintf.S b/sysdeps/libm-i387/s_lrintf.S
new file mode 100644
index 0000000000..2f49bdbabe
--- /dev/null
+++ b/sysdeps/libm-i387/s_lrintf.S
@@ -0,0 +1,33 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+	.text
+ENTRY(__lrintf)
+	flds	4(%esp)
+	subl	$4, %esp
+	fistpl	(%esp)
+	fwait
+	popl	%eax
+	ret
+END(__lrintf)
+weak_alias (__lrintf, lrintf)
diff --git a/sysdeps/libm-i387/s_lrintl.S b/sysdeps/libm-i387/s_lrintl.S
new file mode 100644
index 0000000000..3a06c91b29
--- /dev/null
+++ b/sysdeps/libm-i387/s_lrintl.S
@@ -0,0 +1,33 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+	.text
+ENTRY(__lrintl)
+	fldt	4(%esp)
+	subl	$4, %esp
+	fistpl	(%esp)
+	fwait
+	popl	%eax
+	ret
+END(__lrintl)
+weak_alias (__lrintl, lrintl)
diff --git a/sysdeps/libm-i387/s_scalbln.c b/sysdeps/libm-i387/s_scalbln.c
new file mode 100644
index 0000000000..1009713fbc
--- /dev/null
+++ b/sysdeps/libm-i387/s_scalbln.c
@@ -0,0 +1,2 @@
+/* Nothing to do.  This function is the same as scalbn.  So we define an
+   alias.  */
diff --git a/sysdeps/libm-i387/s_scalblnf.c b/sysdeps/libm-i387/s_scalblnf.c
new file mode 100644
index 0000000000..5e558c3540
--- /dev/null
+++ b/sysdeps/libm-i387/s_scalblnf.c
@@ -0,0 +1,2 @@
+/* Nothing to do.  This function is the same as scalbnf.  So we define an
+   alias.  */
diff --git a/sysdeps/libm-i387/s_scalblnl.c b/sysdeps/libm-i387/s_scalblnl.c
new file mode 100644
index 0000000000..cda2ec11c8
--- /dev/null
+++ b/sysdeps/libm-i387/s_scalblnl.c
@@ -0,0 +1,2 @@
+/* Nothing to do.  This function is the same as scalbnl.  So we define an
+   alias.  */
diff --git a/sysdeps/libm-i387/s_scalbn.S b/sysdeps/libm-i387/s_scalbn.S
index 709b7a47f5..ea9e25f094 100644
--- a/sysdeps/libm-i387/s_scalbn.S
+++ b/sysdeps/libm-i387/s_scalbn.S
@@ -15,3 +15,5 @@ ENTRY(__scalbn)
 	ret
 END (__scalbn)
 weak_alias (__scalbn, scalbn)
+strong_alias (__scalbn, __scalbln)
+weak_alias (__scalbn, scalbln)
diff --git a/sysdeps/libm-i387/s_scalbnf.S b/sysdeps/libm-i387/s_scalbnf.S
index ce92113844..dc8cfb4296 100644
--- a/sysdeps/libm-i387/s_scalbnf.S
+++ b/sysdeps/libm-i387/s_scalbnf.S
@@ -15,3 +15,5 @@ ENTRY(__scalbnf)
 	ret
 END (__scalbnf)
 weak_alias (__scalbnf, scalbnf)
+strong_alias (__scalbnf, __scalblnf)
+weak_alias (__scalbnf, scalblnf)
diff --git a/sysdeps/libm-i387/s_scalbnl.S b/sysdeps/libm-i387/s_scalbnl.S
index 09e06457b8..295494b3d2 100644
--- a/sysdeps/libm-i387/s_scalbnl.S
+++ b/sysdeps/libm-i387/s_scalbnl.S
@@ -16,3 +16,5 @@ ENTRY(__scalbnl)
 	ret
 END (__scalbnl)
 weak_alias (__scalbnl, scalbnl)
+strong_alias (__scalbnl, __scalblnl)
+weak_alias (__scalbnl, scalblnl)
diff --git a/sysdeps/libm-ieee754/s_clog10.c b/sysdeps/libm-ieee754/s_clog10.c
new file mode 100644
index 0000000000..5a9de75733
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_clog10.c
@@ -0,0 +1,65 @@
+/* Compute complex base 10 logarithm.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__clog10 (__complex__ double x)
+{
+  __complex__ double result;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      /* Real and imaginary part are 0.0.  */
+      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+      __imag__ result = __copysign (__imag__ result, __imag__ x);
+      /* Yes, the following line raises an exception.  */
+      __real__ result = -1.0 / fabs (__real__ x);
+    }
+  else if (rcls != FP_NAN && icls != FP_NAN)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x,
+							  __imag__ x));
+      __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = __nan ("");
+      if (rcls == FP_INFINITE || icls == FP_INFINITE)
+	/* Real or imaginary part is infinite.  */
+	__real__ result = HUGE_VAL;
+      else
+	__real__ result = __nan ("");
+    }
+
+  return result;
+}
+weak_alias (__clog10, clog10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__clog10, __clog10l)
+weak_alias (__clog10, clog10l)
+#endif
diff --git a/sysdeps/libm-ieee754/s_clog10f.c b/sysdeps/libm-ieee754/s_clog10f.c
new file mode 100644
index 0000000000..4e2fa83edf
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_clog10f.c
@@ -0,0 +1,61 @@
+/* Compute complex base 10 logarithm.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__clog10f (__complex__ float x)
+{
+  __complex__ float result;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      /* Real and imaginary part are 0.0.  */
+      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+      __imag__ result = __copysignf (__imag__ result, __imag__ x);
+      /* Yes, the following line raises an exception.  */
+      __real__ result = -1.0 / fabsf (__real__ x);
+    }
+  else if (rcls != FP_NAN && icls != FP_NAN)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x,
+							    __imag__ x));
+      __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = __nanf ("");
+      if (rcls == FP_INFINITE || icls == FP_INFINITE)
+	/* Real or imaginary part is infinite.  */
+	__real__ result = HUGE_VALF;
+      else
+	__real__ result = __nanf ("");
+    }
+
+  return result;
+}
+weak_alias (__clog10f, clog10f)
diff --git a/sysdeps/libm-ieee754/s_clog10l.c b/sysdeps/libm-ieee754/s_clog10l.c
new file mode 100644
index 0000000000..bf7d394c42
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_clog10l.c
@@ -0,0 +1,61 @@
+/* Compute complex natural logarithm.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__clog10l (__complex__ long double x)
+{
+  __complex__ long double result;
+  int rcls = fpclassify (__real__ x);
+  int icls = fpclassify (__imag__ x);
+
+  if (rcls == FP_ZERO && icls == FP_ZERO)
+    {
+      /* Real and imaginary part are 0.0.  */
+      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+      __imag__ result = __copysignl (__imag__ result, __imag__ x);
+      /* Yes, the following line raises an exception.  */
+      __real__ result = -1.0 / fabsl (__real__ x);
+    }
+  else if (rcls != FP_NAN && icls != FP_NAN)
+    {
+      /* Neither real nor imaginary part is NaN.  */
+      __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x,
+							    __imag__ x));
+      __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
+    }
+  else
+    {
+      __imag__ result = __nanl ("");
+      if (rcls == FP_INFINITE || icls == FP_INFINITE)
+	/* Real or imaginary part is infinite.  */
+	__real__ result = HUGE_VALL;
+      else
+	__real__ result = __nanl ("");
+    }
+
+  return result;
+}
+weak_alias (__clog10l, clog10l)
diff --git a/sysdeps/libm-ieee754/s_fma.c b/sysdeps/libm-ieee754/s_fma.c
new file mode 100644
index 0000000000..53974dc40c
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fma.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+double
+__fma (double x, double y, double z)
+{
+  return (x * y) + z;
+}
+weak_alias (__fma, fma)
diff --git a/sysdeps/libm-ieee754/s_fmaf.c b/sysdeps/libm-ieee754/s_fmaf.c
new file mode 100644
index 0000000000..44e5e15def
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fmaf.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+float
+__fmaf (float x, float y, float z)
+{
+  return (x * y) + z;
+}
+weak_alias (__fmaf, fmaf)
diff --git a/sysdeps/libm-ieee754/s_fmal.c b/sysdeps/libm-ieee754/s_fmal.c
new file mode 100644
index 0000000000..f73751f4db
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fmal.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+long double
+__fmal (long double x, long double y, long double z)
+{
+  return (x * y) + z;
+}
+weak_alias (__fmal, fmal)
diff --git a/sysdeps/libm-ieee754/s_llrint.c b/sysdeps/libm-ieee754/s_llrint.c
index faae106ece..a50ba96952 100644
--- a/sysdeps/libm-ieee754/s_llrint.c
+++ b/sysdeps/libm-ieee754/s_llrint.c
@@ -23,9 +23,7 @@
 
 #include "math_private.h"
 
-#ifdef NO_LONG_DOUBLE
-/* The `long double' is in fact the IEEE `double' type.  */
-static long double two52[2] =
+static const long double two52[2] =
 {
   4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
  -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
@@ -33,210 +31,65 @@ static long double two52[2] =
 
 
 long long int
-__llrint (long double x)
+__llrint (double x)
 {
-  int32_t j0,sx;
-  u_int32_t i0, i1, i;
-  long double t, w;
+  int32_t j0;
+  u_int32_t i1, i0;
   long long int result;
+  volatile double w;
+  double t;
+  int sx;
 
   EXTRACT_WORDS (i0, i1, x);
-
-  sx = i0 >> 31;
   j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+  sx = i0 >> 31;
+  i0 &= 0xfffff;
+  i0 |= 0x100000;
 
   if (j0 < 20)
     {
-      if (j0 < 0)
-	{
-	  if (((i0 & 0x7fffffff) | i1) == 0)
-	    /* The number is 0.  */
-	    result = 0;
-	  else
-	    {
-	      i1 |= i0;
-	      i0 &= 0xfffe0000;
-	      i0 |= ((i1 | -i1) >> 12) & 0x80000;
-	      SET_HIGH_WORD (x, i0);
-	      w = two52[sx] + x;
-	      t = w - two52[sx];
-	      GET_HIGH_WORD (i0, t);
-	      if ((i0 & 0x7fffffff) >= 0x3fff0000)
-		result = sx ? -1 : 1;
-	      else
-		result = 0;
-	    }
-	}
+      if (j0 < -1)
+	return 0;
       else
 	{
-	  u_int32_t i = 0x000fffff >> j0;
-	  if (((i0 & i) | i1) == 0)
-	    {
-	      /* X is not integral.  */
-	      i >>= 1;
-	      if (((i0 & i) | i1) != 0)
-		{
-		  if (j0 == 19)
-		    i1 = 0x40000000;
-		  else
-		    i0 = (i0 & (~i)) | (0x20000 >> j0);
-
-		  INSERT_WORDS (x, i0, i1);
-		  w = two52[sx] + x;
-		  x = w - two52[sx];
-		  EXTRACT_WORDS (i0, i1, x);
-
-		  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
-		}
-	    }
-
-	  result = ((i0 >> (20 - j0)) & 0xfffff) | (0x00100000 >> (20 - j0));
-	  if (sx)
-	    result = -result;
+	  w = two52[sx] + x;
+	  t = w - two52[sx];
+	  EXTRACT_WORDS (i0, i1, t);
+	  i0 = i & 0xfffff;
+	  i0 |= 0x100000;
+	  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+
+	  result = i0 >> (20 - j0);
 	}
     }
-  else if ((unsigned int) j0 < sizeof (long long int) * 8 && j0 < 53)
-    {
-      i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
-      if ((i1 & i) != 0)
-	{
-	  /* x is not integral.  */
-	  i >>= 1;
-	  if ((i1 & i) != 0)
-	    i1 = (i1 & (~i)) | (0x40000000 >> (j0 - 20));
-	}
-
-      INSERT_WORDS (x, i0, i1);
-      w = two52[sx] + x;
-      x = w - two52[sx];
-      EXTRACT_WORDS (i0, i1, x);
-
-      j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
-
-      result = i0 | 0x00100000;
-      if (j0 > 20)
-	{
-	  result <<= j0 - 20;
-	  result |= i1 >> (52 - j0);
-	}
-      if (sx)
-	result = -result;
-    }
-  else
-    /* Too large.  The number is either +-inf or NaN or it is too
-       large to be effected by rounding.  The standard leaves it
-       undefined what to return when the number is too large to fit in
-       a `long int'.  */
-    result = (long long int) x;
-
-  return result;
-}
-
-#else
-static long double two63[2] =
-{
-  9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
- -9.223372036854775808000000e+18  /* 0xC03E, 0x00000000, 0x00000000 */
-};
-
-
-long long int
-__llrint (long double x)
-{
-  int32_t se,j0,sx;
-  u_int32_t i0, i1, i;
-  long long int result;
-  long double w, t;
-
-  GET_LDOUBLE_WORDS (se, i0, i1, x);
-
-  sx = (se >> 15) & 1;
-  j0 = (se & 0x7fff) - 0x3fff;
-
-  if (j0 < 31)
+  else if (j0 < (int32_t) (8 * sizeof (long long int)))
     {
-      if (j0 < 0)
-	{
-	  if (((se & 0x7fff) | i0 | i1) == 0)
-	    /* The number is 0.  */
-	    result = 0;
-	  else
-	    {
-	      i1 |= i0;
-	      i0 &= 0xe0000000;
-	      i0 |= (i1 | -i1) & 0x80000000;
-	      SET_LDOUBLE_MSW (x, i0);
-	      w = two63[sx] + x;
-	      t = w - two63[sx];
-	      GET_LDOUBLE_EXP (i0, t);
-	      if ((i0 & 0x7fff) >= 0x3fff)
-		result = sx ? -1 : 1;
-	      else
-		result = 0;
-	    }
-	}
+      if (j0 >= 52)
+	result = ((long long int) i0 << (j0 - 20)) | (i1 << (j0 - 52));
       else
 	{
-	  u_int32_t i = 0x7fffffff >> j0;
-	  if (((i0 & i) | i1) == 0)
-	    {
-	      /* X is not integral.  */
-	      i >>= 1;
-	      if (((i0 & i) | i1) != 0)
-		{
-		  if (j0 == 31)
-		    i1 = 0x40000000;
-		  else
-		    i0 = (i0 & (~i)) | (0x20000000 >> j0);
-
-		  SET_LDOUBLE_WORDS (x, se, i0, i1);
-		  w = two63[sx] + x;
-		  x = w - two63[sx];
-		  GET_LDOUBLE_WORDS (se, i0, i1, x);
-
-		  sx = (se >> 15) & 1;
-		  j0 = (se & 0x7fff) - 0x3fff;
-		}
-	    }
-
-
-	  result = i0 >> (31 - j0);
+	  w = two52[sx] + x;
+	  t = w - two52[sx];
+	  EXTRACT_WORDS (i0, i1, t);
+	  i0 = i & 0xfffff;
+	  i0 |= 0x100000;
+	  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+
+	  result = ((long long int) i0 << (j0 - 20)) | (j >> (52 - j0));
 	}
     }
-  else if ((unsigned int) j0 < sizeof (long long int) * 8 && j0 < 64)
+  else
     {
-      i = ((u_int32_t) (0xffffffff)) >> (j0 - 31);
-      if ((i1 & i) != 0)
-	{
-	  /* x is not integral.  */
-	  i >>= 1;
-	  if ((i1 & i) != 0)
-	    i1 = (i1 & (~i)) | (0x40000000 >> (j0 - 31));
-	}
-
-      SET_LDOUBLE_WORDS (x, se, i0, i1);
-      w = two63[sx] + x;
-      x = w - two63[sx];
-      GET_LDOUBLE_WORDS (se, i0, i1, x);
-
-      j0 = (se & 0x7fff) - 0x3fff;
-
-      result = i0;
-      if (j0 > 31)
-	{
-	  result <<= j0 - 31;
-	  result |= i1 >> (63 - j0);
-	}
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long long int) x;
     }
-  else
-    /* Too large.  The number is either +-inf or NaN or it is too
-       large to be effected by rounding.  The standard leaves it
-       undefined what to return when the number is too large to fit in
-       a `long int'.  */
-    result = (long long int) x;
 
-  return result;
+  return sx ? -result : result;
 }
-#endif
 
 weak_alias (__llrint, llrint)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__llrint, __llrintl)
+weak_alias (__llrint, llrintl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_llrintf.c b/sysdeps/libm-ieee754/s_llrintf.c
new file mode 100644
index 0000000000..f73afd0fd2
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_llrintf.c
@@ -0,0 +1,78 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+static const double two23[2] =
+{
+  8.3886080000e+06, /* 0x4B000000 */
+ -8.3886080000e+06, /* 0xCB000000 */
+};
+
+
+long long int
+__llrintf (float x)
+{
+  int32_t j0;
+  u_int32_t i, i0;
+  volatile float w;
+  float t;
+  long long int result;
+  int sx;
+
+  GET_FLOAT_WORD (i, x);
+
+  sx = i0 >> 31;
+  j0 = ((i0 >> 23) & 0xff) - 0x7f;
+  i0 = i & 0x7fffff;
+  i0 |= 0x800000;
+
+  if (j0 < (int32_t) (sizeof (long long int) * 8))
+    {
+      if (j0 < -1)
+	return 0;
+      else if (j0 >= 23)
+	result = (long long int) i0 << (j0 - 23);
+      else
+	{
+	  w = two23[sx] + x;
+	  t = w - two23[sx];
+	  GET_FLOAT_WORD (i, t);
+	  i0 = i & 0x7fffff;
+	  i0 |= 0x800000;
+	  j0 = ((i0 >> 23) & 0xff) - 0x7f;
+
+	  result = i0 >> (23 - j0);
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long long int) x;
+    }
+
+  return sx ? -result : result;
+}
+
+weak_alias (__llrintf, llrintf)
diff --git a/sysdeps/libm-ieee754/s_llrintl.c b/sysdeps/libm-ieee754/s_llrintl.c
new file mode 100644
index 0000000000..29fc3a300d
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_llrintl.c
@@ -0,0 +1,86 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+static const long double two63[2] =
+{
+  9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
+ -9.223372036854775808000000e+18  /* 0xC03E, 0x00000000, 0x00000000 */
+};
+
+
+long long int
+__llrintl (long double x)
+{
+  int32_t se,j0;
+  u_int32_t i0, i1, i;
+  long long int result;
+  volatile long double w;
+  long double t;
+  int sx;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+
+  sx = (se >> 15) & 1;
+  j0 = (se & 0x7fff) - 0x3fff;
+
+  if (j0 < 31)
+    {
+      if (j0 < -1)
+	return 0;
+      else
+	{
+	  w = two63[sx] + x;
+	  t = w - two63[sx];
+	  GET_LDOUBLE_WORDS (se, i0, i1, t);
+	  j0 = (se & 0x7fff) - 0x3fff;
+
+	  result = i0 >> (31 - j0);
+	}
+    }
+  else if (j0 < (int32_t) (8 * sizeof (long long int)))
+    {
+      if (j0 >= 63)
+	result = ((long long int) i0 << (j0 - 31)) | (i1 << (j0 - 63));
+      else
+	{
+	  w = two63[sx] + x;
+	  t = w - two63[sx];
+	  GET_LDOUBLE_WORDS (se, i0, i1, t);
+	  j0 = (se & 0x7fff) - 0x3fff;
+
+	  result = ((long long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long long int) x;
+    }
+
+  return sx ? -result : result;
+}
+
+weak_alias (__llrintl, llrintl)
diff --git a/sysdeps/libm-ieee754/s_llround.c b/sysdeps/libm-ieee754/s_llround.c
index aee0e31fc0..1deb630e96 100644
--- a/sysdeps/libm-ieee754/s_llround.c
+++ b/sysdeps/libm-ieee754/s_llround.c
@@ -1,4 +1,4 @@
-/* Round long double value to long long int.
+/* Round double value to long long int.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,157 +23,56 @@
 #include "math_private.h"
 
 
-#ifdef NO_LONG_DOUBLE
-/* The `long double' is in fact the IEEE `double' type.  */
-
 long long int
-__llround (long double x)
+__llround (double x)
 {
   int32_t j0;
   u_int32_t i1, i0;
   long long int result;
+  int sign;
 
   EXTRACT_WORDS (i0, i1, x);
   j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+  sign = (i0 & 0x80000000) != 0 ? -1 : 1;
+  i0 &= 0xfffff;
+  i0 |= 0x100000;
+
   if (j0 < 20)
     {
       if (j0 < 0)
-	result = j0 < -1 ? 0 : ((i0 & 0x80000000) ? -1 : 1);
+	return j0 < -1 ? 0 : sign;
       else
 	{
-	  u_int32_t i = 0xfffff >> j0;
-	  if (((i0 & i) | i1) == 0)
-	    result = (long long int) ((i0 & 0xfffff) | 0x100000) >> j0;
-	  else
-	    {
-	      /* X is not integral.  */
-	      u_int32_t j = i0 + (0x80000 >> j0);
-              if (j < i0)
-		result = (long long int) 0x80000 >> (20 - j0);
-	      else
-		result = (j | 0x100000) >> (20 - j0);
-	    }
+	  i0 += 0x80000 >> j0;
+
+	  result = i0 >> (20 - j0);
 	}
     }
-  else if (j0 >= 8 * sizeof (long long int) || j0 > 51)
-    {
-      /* The number is too large.  It is left implementation defined
-	 what happens.  */
-      result = (long long int) x;
-    }
-  else
+  else if (j0 < (int32_t) (8 * sizeof (long long int)))
     {
-      u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
-      if ((i1 & i) != 0)
+      if (j0 >= 52)
+	result = ((long long int) i0 << (j0 - 20)) | (i1 << (j0 - 52));
+      else
 	{
-	  /* x is not integral.  */
 	  u_int32_t j = i1 + (0x80000000 >> (j0 - 20));
 	  if (j < i1)
-	    {
-	      j = i0 + 1;
-	      if ((j & 0xfffff) == 0)
-		{
-		  if (sizeof (long long int) <= 4)
-		    /* Overflow.  */
-		    result = (long long int) x;
-		  else
-		    result = 1ll << (j0 + 1);
-		}
-	      else
-		result = ((long long int) ((i0 & 0xfffff) | 0x100000)
-			  << (j0 - 31));
-	    }
-	  else
-	    {
-	      result = ((long long int) ((i0 & 0xfffff) | 0x100000)
-			<< (j0 - 31));
-	      if (sizeof (long long int) > 4 && j0 > 31)
-		result |= j >> (63 - j0);
-	    }
-	}
-      else
-	{
-	  result = (long long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
-	  if (sizeof (long long int) > 4 && j0 > 31)
-	    result |= i1 >> (63 - j0);
-	}
-    }
+	    ++i0;
 
-  return i0 & 0x80000000 ? -result : result;
-}
-#else
-long long int
-__llround (long double x)
-{
-  int32_t j0;
-  u_int32_t se, i1, i0;
-  long long int result;
-
-  GET_LDOUBLE_WORDS (se, i0, i1, x);
-  j0 = (se & 0x7fff) - 0x3fff;
-  if (j0 < 31)
-    {
-      if (j0 < 0)
-	result = j0 < -1 ? 0 : 1;
-      else
-	{
-	  u_int32_t i = 0x7fffffff >> j0;
-	  if (((i0 & i) | i1) == 0)
-	    result = (long long int) i0 >> j0;
-	  else
-	    {
-	      /* X is not integral.  */
-	      u_int32_t j = i0 + (0x40000000 >> j0);
-              if (j < i0)
-		result = 0x80000000l >> (30 - j0);
-	      else
-		result = j >> (31 - j0);
-	    }
+	  result = ((long long int) i0 << (j0 - 20)) | (j >> (52 - j0));
 	}
     }
-  else if ((unsigned int) j0 >= 8 * sizeof (long long int) || j0 > 62)
+  else
     {
       /* The number is too large.  It is left implementation defined
 	 what happens.  */
-      result = (long long int) x;
-    }
-  else
-    {
-      u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 31);
-      if ((i1 & i) != 0)
-	{
-	  /* x is not integral.  */
-	  u_int32_t j = i1 + (0x80000000 >> (j0 - 31));
-	  if (j < i1)
-	    {
-	      j = i0 + 1;
-	      if (j == 0)
-		{
-		  if (sizeof (long long int) <= 4)
-		    /* Overflow.  */
-		    result = (long long int) x;
-		  else
-		    result = 1ll << (j0 + 1);
-		}
-	      else
-		result = (long long int) i0 << (j0 - 31);
-	    }
-	  else
-	    {
-	      result = (long long int) i0 << (j0 - 31);
-	      if (sizeof (long long int) > 4 && j0 > 31)
-		result |= j >> (63 - j0);
-	    }
-	}
-      else
-	{
-	  result = (long long int) i0 << (j0 - 31);
-	  if (sizeof (long long int) > 4 && j0 > 31)
-	    result |= i1 >> (63 - j0);
-	}
+      return (long long int) x;
     }
 
-  return se & 0x8000 ? -result : result;
+  return sign * result;
 }
-#endif
+
 weak_alias (__llround, llround)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__llround, __llroundl)
+weak_alias (__llround, llroundl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_llroundf.c b/sysdeps/libm-ieee754/s_llroundf.c
new file mode 100644
index 0000000000..87ed1a3117
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_llroundf.c
@@ -0,0 +1,63 @@
+/* Round float value to long long int.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+long long int
+__llroundf (float x)
+{
+  int32_t j0;
+  u_int32_t i;
+  long long int result;
+  int sign;
+
+  GET_FLOAT_WORD (i, x);
+  j0 = ((i >> 23) & 0xff) - 0x7f;
+  sign = (i & 0x80000000) != 0 ? -1 : 1;
+  i &= 0x7fffff;
+  i |= 0x800000;
+
+  if (j0 < (int32_t) (8 * sizeof (long long int)))
+    {
+      if (j0 < 0)
+	return j0 < -1 ? 0 : sign;
+      else if (j0 >= 23)
+	result = (long int) i << (j0 - 23);
+      else
+	{
+	  i += 0x400000 >> j0;
+
+	  result = i >> (23 - j0);
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long long int) x;
+    }
+
+  return sign * result;
+}
+
+weak_alias (__llroundf, llroundf)
diff --git a/sysdeps/libm-ieee754/s_llroundl.c b/sysdeps/libm-ieee754/s_llroundl.c
new file mode 100644
index 0000000000..959b1e3fe9
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_llroundl.c
@@ -0,0 +1,78 @@
+/* Round long double value to long long int.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+long long int
+__llroundl (long double x)
+{
+  int32_t j0;
+  u_int32_t se, i1, i0;
+  long long int result;
+  int sign;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  j0 = (se & 0x7fff) - 0x3fff;
+  sign = (se & 0x8000) != 0 ? -1 : 1;
+
+  if (j0 < 31)
+    {
+      if (j0 < 0)
+	return j0 < -1 ? 0 : sign;
+      else
+	{
+	  u_int32_t j = i0 + (0x40000000 >> j0);
+	  if (j < i0)
+	    {
+	      j >>= 1;
+	      j |= 0x80000000;
+	      ++j0;
+	    }
+
+	  result = j >> (31 - j0);
+	}
+    }
+  else if (j0 < (int32_t) (8 * sizeof (long long int)))
+    {
+      if (j0 >= 63)
+	result = ((long long int) i0 << (j0 - 31)) | (i1 << (j0 - 63));
+      else
+	{
+	  u_int32_t j = i1 + (0x80000000 >> (j0 - 31));
+	  if (j < i1)
+	    ++i0;
+
+	  result = ((long long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long long int) x;
+    }
+
+  return sign * result;
+}
+
+weak_alias (__llroundl, llroundl)
diff --git a/sysdeps/libm-ieee754/s_lrint.c b/sysdeps/libm-ieee754/s_lrint.c
index 6779f974bd..0ccd06a061 100644
--- a/sysdeps/libm-ieee754/s_lrint.c
+++ b/sysdeps/libm-ieee754/s_lrint.c
@@ -23,9 +23,7 @@
 
 #include "math_private.h"
 
-#ifdef NO_LONG_DOUBLE
-/* The `long double' is in fact the IEEE `double' type.  */
-static long double two52[2] =
+static const double two52[2] =
 {
   4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
  -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
@@ -33,210 +31,65 @@ static long double two52[2] =
 
 
 long int
-__lrint (long double x)
+__lrint (double x)
 {
-  int32_t j0,sx;
+  int32_t j0;
   u_int32_t i0,i1,i;
-  long double t, w;
+  volatile double w;
+  double t;
   long int result;
+  int sx;
 
   EXTRACT_WORDS (i0, i1, x);
-
-  sx = i0 >> 31;
   j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+  sx = i0 >> 31;
+  i0 &= 0xfffff;
+  i0 |= 0x100000;
 
   if (j0 < 20)
     {
-      if (j0 < 0)
-	{
-	  if (((i0 & 0x7fffffff) | i1) == 0)
-	    /* The number is 0.  */
-	    result = 0;
-	  else
-	    {
-	      i1 |= i0;
-	      i0 &= 0xfffe0000;
-	      i0 |= ((i1 | -i1) >> 12) & 0x80000;
-	      SET_HIGH_WORD (x, i0);
-	      w = two52[sx] + x;
-	      t = w - two52[sx];
-	      GET_HIGH_WORD (i0, t);
-	      if ((i0 & 0x7fffffff) >= 0x3fff0000)
-		result = sx ? -1 : 1;
-	      else
-		result = 0;
-	    }
-	}
+      if (j0 < -1)
+	return 0;
       else
 	{
-	  u_int32_t i = 0x000fffff >> j0;
-	  if (((i0 & i) | i1) == 0)
-	    {
-	      /* X is not integral.  */
-	      i >>= 1;
-	      if (((i0 & i) | i1) != 0)
-		{
-		  if (j0 == 19)
-		    i1 = 0x40000000;
-		  else
-		    i0 = (i0 & (~i)) | (0x20000 >> j0);
-
-		  INSERT_WORDS (x, i0, i1);
-		  w = two52[sx] + x;
-		  x = w - two52[sx];
-		  EXTRACT_WORDS (i0, i1, x);
-
-		  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
-		}
-	    }
-
-	  result = ((i0 >> (20 - j0)) & 0xfffff) | (0x00100000 >> (20 - j0));
-	  if (sx)
-	    result = -result;
+	  w = two52[sx] + x;
+	  t = w - two52[sx];
+	  EXTRACT_WORDS (i0, i1, t);
+	  i0 = i & 0xfffff;
+	  i0 |= 0x100000;
+	  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+
+	  result = i0 >> (20 - j0);
 	}
     }
-  else if ((unsigned int) j0 < sizeof (long int) * 8 && j0 < 53)
+  else if (j0 < (int32_t) (8 * sizeof (long int)))
     {
-      i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
-      if ((i1 & i) != 0)
-	{
-	  /* x is not integral.  */
-	  i >>= 1;
-	  if ((i1 & i) != 0)
-	    i1 = (i1 & (~i)) | (0x40000000 >> (j0 - 20));
-	}
-
-      INSERT_WORDS (x, i0, i1);
-      w = two52[sx] + x;
-      x = w - two52[sx];
-      EXTRACT_WORDS (i0, i1, x);
-
-      j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
-
-      result = i0 | 0x00100000;
-      if (j0 > 20)
-	{
-	  result <<= j0 - 20;
-	  result |= i1 >> (52 - j0);
-	}
-      if (sx)
-	result = -result;
-    }
-  else
-    /* Too large.  The number is either +-inf or NaN or it is too
-       large to be effected by rounding.  The standard leaves it
-       undefined what to return when the number is too large to fit in
-       a `long int'.  */
-    result = (long int) x;
-
-  return result;
-}
-
-#else
-static long double two63[2] =
-{
-  9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
- -9.223372036854775808000000e+18  /* 0xC03E, 0x00000000, 0x00000000 */
-};
-
-
-long int
-__lrint (long double x)
-{
-  int32_t se,j0,sx;
-  u_int32_t i0,i1,i;
-  long int result;
-  long double w, t;
-
-  GET_LDOUBLE_WORDS (se, i0, i1, x);
-
-  sx = (se >> 15) & 1;
-  j0 = (se & 0x7fff) - 0x3fff;
-
-  if (j0 < 31)
-    {
-      if (j0 < 0)
-	{
-	  if (((se & 0x7fff) | i0 | i1) == 0)
-	    /* The number is 0.  */
-	    result = 0;
-	  else
-	    {
-	      i1 |= i0;
-	      i0 &= 0xe0000000;
-	      i0 |= (i1 | -i1) & 0x80000000;
-	      SET_LDOUBLE_MSW (x, i0);
-	      w = two63[sx] + x;
-	      t = w - two63[sx];
-	      GET_LDOUBLE_EXP (i0, t);
-	      if ((i0 & 0x7fff) >= 0x3fff)
-		result = sx ? -1 : 1;
-	      else
-		result = 0;
-	    }
-	}
+      if (j0 >= 52)
+	result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52));
       else
 	{
-	  u_int32_t i = 0x7fffffff >> j0;
-	  if (((i0 & i) | i1) == 0)
-	    {
-	      /* X is not integral.  */
-	      i >>= 1;
-	      if (((i0 & i) | i1) != 0)
-		{
-		  if (j0 == 31)
-		    i1 = 0x40000000;
-		  else
-		    i0 = (i0 & (~i)) | (0x20000000 >> j0);
-
-		  SET_LDOUBLE_WORDS (x, se, i0, i1);
-		  w = two63[sx] + x;
-		  x = w - two63[sx];
-		  GET_LDOUBLE_WORDS (se, i0, i1, x);
-
-		  sx = (se >> 15) & 1;
-		  j0 = (se & 0x7fff) - 0x3fff;
-		}
-	    }
-
-
-	  result = i0 >> (31 - j0);
+	  w = two52[sx] + x;
+	  t = w - two52[sx];
+	  EXTRACT_WORDS (i0, i1, t);
+	  i0 = i & 0xfffff;
+	  i0 |= 0x100000;
+	  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+
+	  result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0));
 	}
     }
-  else if ((unsigned int) j0 < sizeof (long int) * 8 && j0 < 64)
+  else
     {
-      i = ((u_int32_t) (0xffffffff)) >> (j0 - 31);
-      if ((i1 & i) != 0)
-	{
-	  /* x is not integral.  */
-	  i >>= 1;
-	  if ((i1 & i) != 0)
-	    i1 = (i1 & (~i)) | (0x40000000 >> (j0 - 31));
-	}
-
-      SET_LDOUBLE_WORDS (x, se, i0, i1);
-      w = two63[sx] + x;
-      x = w - two63[sx];
-      GET_LDOUBLE_WORDS (se, i0, i1, x);
-
-      j0 = (se & 0x7fff) - 0x3fff;
-
-      result = i0;
-      if (j0 > 31)
-	{
-	  result <<= j0 - 31;
-	  result |= i1 >> (63 - j0);
-	}
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long int) x;
     }
-  else
-    /* Too large.  The number is either +-inf or NaN or it is too
-       large to be effected by rounding.  The standard leaves it
-       undefined what to return when the number is too large to fit in
-       a `long int'.  */
-    result = (long int) x;
 
-  return result;
+  return sx ? -result : result;
 }
-#endif
 
 weak_alias (__lrint, lrint)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lrint, __lrintl)
+weak_alias (__lrint, lrintl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_lrintf.c b/sysdeps/libm-ieee754/s_lrintf.c
new file mode 100644
index 0000000000..6d74b362f5
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_lrintf.c
@@ -0,0 +1,78 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+static const double two23[2] =
+{
+  8.3886080000e+06, /* 0x4B000000 */
+ -8.3886080000e+06, /* 0xCB000000 */
+};
+
+
+long int
+__lrintf (float x)
+{
+  int32_t j0;
+  u_int32_t i, i0;
+  volatile float w;
+  float t;
+  long int result;
+  int sx;
+
+  GET_FLOAT_WORD (i, x);
+
+  sx = i0 >> 31;
+  j0 = ((i0 >> 23) & 0xff) - 0x7f;
+  i0 = i & 0x7fffff;
+  i0 |= 0x800000;
+
+  if (j0 < (int32_t) (sizeof (long int) * 8))
+    {
+      if (j0 < -1)
+	return 0;
+      else if (j0 >= 23)
+	result = (long int) i0 << (j0 - 23);
+      else
+	{
+	  w = two23[sx] + x;
+	  t = w - two23[sx];
+	  GET_FLOAT_WORD (i, t);
+	  i0 = i & 0x7fffff;
+	  i0 |= 0x800000;
+	  j0 = ((i0 >> 23) & 0xff) - 0x7f;
+
+	  result = i0 >> (23 - j0);
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long int) x;
+    }
+
+  return sx ? -result : result;
+}
+
+weak_alias (__lrintf, lrintf)
diff --git a/sysdeps/libm-ieee754/s_lrintl.c b/sysdeps/libm-ieee754/s_lrintl.c
new file mode 100644
index 0000000000..8607851669
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_lrintl.c
@@ -0,0 +1,86 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+static const long double two63[2] =
+{
+  9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
+ -9.223372036854775808000000e+18  /* 0xC03E, 0x00000000, 0x00000000 */
+};
+
+
+long int
+__lrintl (long double x)
+{
+  int32_t se,j0;
+  u_int32_t i0,i1,i;
+  long int result;
+  volatile long double w;
+  long double t;
+  int sx;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+
+  sx = (se >> 15) & 1;
+  j0 = (se & 0x7fff) - 0x3fff;
+
+  if (j0 < 31)
+    {
+      if (j0 < -1)
+	return 0;
+      else
+	{
+	  w = two63[sx] + x;
+	  t = w - two63[sx];
+	  GET_LDOUBLE_WORDS (se, i0, i1, t);
+	  j0 = (se & 0x7fff) - 0x3fff;
+
+	  result = i0 >> (31 - j0);
+	}
+    }
+  else if (j0 < (int32_t) (8 * sizeof (long int)))
+    {
+      if (j0 >= 63)
+	result = ((long int) i0 << (j0 - 31)) | (i1 << (j0 - 63));
+      else
+	{
+	  w = two63[sx] + x;
+	  t = w - two63[sx];
+	  GET_LDOUBLE_WORDS (se, i0, i1, t);
+	  j0 = (se & 0x7fff) - 0x3fff;
+
+	  result = ((long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long int) x;
+    }
+
+  return sx ? -result : result;
+}
+
+weak_alias (__lrintl, lrintl)
diff --git a/sysdeps/libm-ieee754/s_lround.c b/sysdeps/libm-ieee754/s_lround.c
index 974dbde050..a6468ba78a 100644
--- a/sysdeps/libm-ieee754/s_lround.c
+++ b/sysdeps/libm-ieee754/s_lround.c
@@ -1,4 +1,4 @@
-/* Round long double value to long int.
+/* Round double value to long int.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,13 +23,8 @@
 #include "math_private.h"
 
 
-#ifdef NO_LONG_DOUBLE
-/* The `long double' is in fact the IEEE `double' type.  */
-
-/* This code does not presently work.  */
-
 long int
-__lround (long double x)
+__lround (double x)
 {
   int32_t j0;
   u_int32_t i1, i0;
@@ -40,138 +35,44 @@ __lround (long double x)
   j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
   sign = (i0 & 0x80000000) != 0 ? -1 : 1;
   i0 &= 0xfffff;
+  i0 |= 0x100000;
+
   if (j0 < 20)
     {
       if (j0 < 0)
-	result = j0 < -1 ? 0 : sign;
+	return j0 < -1 ? 0 : sign;
       else
 	{
-	  u_int32_t i = 0xfffff >> j0;
-	  i0 |= 0x100000;
-	  if (((i0 & i) | i1) == 0)
-	    result = i0 >> j0;
-	  else
-	    /* X is not integral.  */
-	    result = (i0 + (0x80000 >> j0)) >> (20 - j0);
+	  i0 += 0x80000 >> j0;
+
+	  result = i0 >> (20 - j0);
 	}
     }
-  else if (j0 >= 8 * sizeof (long int) || j0 > 51)
-    {
-      /* The number is too large.  It is left implementation defined
-	 what happens.  */
-      return (long int) x;
-    }
-  else
+  else if (j0 < (int32_t) (8 * sizeof (long int)))
     {
-      u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
-      if ((i1 & i) != 0)
+      if (j0 >= 52)
+	result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52));
+      else
 	{
-	  /* x is not integral.  */
 	  u_int32_t j = i1 + (0x80000000 >> (j0 - 20));
 	  if (j < i1)
-	    {
-	      j = i0 + 1;
-	      if ((j & 0xfffff) == 0)
-		{
-		  if (sizeof (long int) <= 4)
-		    /* Overflow.  */
-		    result = (long int) x;
-		  else
-		    result = 1l << (j0 + 1);
-		}
-	      else
-		result = (long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
-	    }
-	  else
-	    {
-	      result = (long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
-	      if (sizeof (long int) > 4 && j0 > 31)
-		result |= j >> (63 - j0);
-	    }
-	}
-      else
-	{
-	  result = (long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
-	  if (sizeof (long int) > 4 && j0 > 31)
-	    result |= i1 >> (63 - j0);
-	}
-    }
-
-  return sign * result;
-}
-#else
-long int
-__lround (long double x)
-{
-  int32_t j0;
-  u_int32_t se, i1, i0;
-  long int result;
+	    ++i0;
 
-  GET_LDOUBLE_WORDS (se, i0, i1, x);
-  j0 = (se & 0x7fff) - 0x3fff;
-  if (j0 < 31)
-    {
-      if (j0 < 0)
-	result = j0 < -1 ? 0 : 1;
-      else
-	{
-	  u_int32_t i = 0x7fffffff >> j0;
-	  if (((i0 & i) | i1) == 0)
-	    result = (long int) i0 >> j0;
-	  else
-	    {
-	      /* X is not integral.  */
-	      u_int32_t j = i0 + (0x40000000 >> j0);
-              if (j < i0)
-		result = 0x80000000l >> (30 - j0);
-	      else
-		result = j >> (31 - j0);
-	    }
+	  result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0));
 	}
     }
-  else if ((unsigned int) j0 >= 8 * sizeof (long int) || j0 > 62)
+  else
     {
       /* The number is too large.  It is left implementation defined
 	 what happens.  */
-      result = (long int) x;
-    }
-  else
-    {
-      u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 31);
-      if ((i1 & i) != 0)
-	{
-	  /* x is not integral.  */
-	  u_int32_t j = i1 + (0x80000000 >> (j0 - 31));
-	  if (j < i1)
-	    {
-	      j = i0 + 1;
-	      if (j == 0)
-		{
-		  if (sizeof (long int) <= 4)
-		    /* Overflow.  */
-		    result = (long int) x;
-		  else
-		    result = 1l << (j0 + 1);
-		}
-	      else
-		result = (long int) i0 << (j0 - 31);
-	    }
-	  else
-	    {
-	      result = (long int) i0 << (j0 - 31);
-	      if (sizeof (long int) > 4 && j0 > 31)
-		result |= j >> (63 - j0);
-	    }
-	}
-      else
-	{
-	  result = (long int) i0 << (j0 - 31);
-	  if (sizeof (long int) > 4 && j0 > 31)
-	    result |= i1 >> (63 - j0);
-	}
+      return (long int) x;
     }
 
-  return se & 0x8000 ? -result : result;
+  return sign * result;
 }
-#endif
+
 weak_alias (__lround, lround)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lround, __lroundl)
+weak_alias (__lround, lroundl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_lroundf.c b/sysdeps/libm-ieee754/s_lroundf.c
new file mode 100644
index 0000000000..0d3889c24a
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_lroundf.c
@@ -0,0 +1,63 @@
+/* Round float value to long int.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+long int
+__lroundf (float x)
+{
+  int32_t j0;
+  u_int32_t i;
+  long int result;
+  int sign;
+
+  GET_FLOAT_WORD (i, x);
+  j0 = ((i >> 23) & 0xff) - 0x7f;
+  sign = (i & 0x80000000) != 0 ? -1 : 1;
+  i &= 0x7fffff;
+  i |= 0x800000;
+
+  if (j0 < (int32_t) (8 * sizeof (long int)))
+    {
+      if (j0 < 0)
+	return j0 < -1 ? 0 : sign;
+      else if (j0 >= 23)
+	result = (long int) i << (j0 - 23);
+      else
+	{
+	  i += 0x400000 >> j0;
+
+	  result = i >> (23 - j0);
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long int) x;
+    }
+
+  return sign * result;
+}
+
+weak_alias (__lroundf, lroundf)
diff --git a/sysdeps/libm-ieee754/s_lroundl.c b/sysdeps/libm-ieee754/s_lroundl.c
new file mode 100644
index 0000000000..d8b7db4b5c
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_lroundl.c
@@ -0,0 +1,78 @@
+/* Round long double value to long int.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+long int
+__lroundl (long double x)
+{
+  int32_t j0;
+  u_int32_t se, i1, i0;
+  long int result;
+  int sign;
+
+  GET_LDOUBLE_WORDS (se, i0, i1, x);
+  j0 = (se & 0x7fff) - 0x3fff;
+  sign = (se & 0x8000) != 0 ? -1 : 1;
+
+  if (j0 < 31)
+    {
+      if (j0 < 0)
+	return j0 < -1 ? 0 : sign;
+      else
+	{
+	  u_int32_t j = i0 + (0x40000000 >> j0);
+	  if (j < i0)
+	    {
+	      j >>= 1;
+	      j |= 0x80000000;
+	      ++j0;
+	    }
+
+	  result = j >> (31 - j0);
+	}
+    }
+  else if (j0 < (int32_t) (8 * sizeof (long int)))
+    {
+      if (j0 >= 63)
+	result = ((long int) i0 << (j0 - 31)) | (i1 << (j0 - 63));
+      else
+	{
+	  u_int32_t j = i1 + (0x80000000 >> (j0 - 31));
+	  if (j < i1)
+	    ++i0;
+
+	  result = ((long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long int) x;
+    }
+
+  return sign * result;
+}
+
+weak_alias (__lroundl, lroundl)
diff --git a/sysdeps/libm-ieee754/s_nextafterl.c b/sysdeps/libm-ieee754/s_nextafterl.c
index 1d3fc86c44..d7bdf026e7 100644
--- a/sysdeps/libm-ieee754/s_nextafterl.c
+++ b/sysdeps/libm-ieee754/s_nextafterl.c
@@ -97,3 +97,5 @@ static char rcsid[] = "$NetBSD: $";
 	return x;
 }
 weak_alias (__nextafterl, nextafterl)
+strong_alias (__nextafterl, __nextafterxl)
+weak_alias (__nextafterl, nextafterxl)
diff --git a/sysdeps/libm-ieee754/s_nextafterx.c b/sysdeps/libm-ieee754/s_nextafterx.c
new file mode 100644
index 0000000000..745ceaf34d
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nextafterx.c
@@ -0,0 +1,98 @@
+/* s_nextafterx.c
+ * Conversion freom s_nextafter.c by Ulrich Drepper, Cygnus Support,
+ * drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* IEEE functions
+ *	nextafterx(x,y)
+ *	return the next machine floating-point number of x in the
+ *	direction toward y.
+ *   Special cases:
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	double __nextafterx(double x, long double y)
+#else
+	double __nextafterx(x,y)
+	double x;
+	long double y;
+#endif
+{
+	int32_t hx,ix,iy;
+	u_int32_t lx,hy,ly,esy;
+
+	EXTRACT_WORDS(hx,lx,x);
+	GET_LDOUBLE_WORDS(esy,hy,ly,y);
+	ix = hx&0x7fffffff;		/* |x| */
+	iy = esy&0x7fff;		/* |y| */
+
+	if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) ||   /* x is nan */
+	   ((iy>=0x7fff)&&((hy|ly)|-(hy|ly))!=0))           /* y is nan */
+	   return x+y;
+	if((long double) x==y) return x;	/* x=y, return x */
+	if((ix|lx)==0) {			/* x == 0 */
+	    double x2;
+	    INSERT_WORDS(x,esy&0x8000?0x80000000:0,1);/* return +-minsub */
+	    x2 = x*x;
+	    if(x2==x) return x2; else return x;	/* raise underflow flag */
+	}
+	if(hx>=0) {				/* x > 0 */
+	    if (esy>=0x8000||((ix>>20)&0x7ff)>iy
+		|| (((ix>>20)&0x7ff)==iy
+		    && (((hx<<11)|(lx>>21))>(hy&0x7fffffff)
+			|| (((hx<<11)|(lx>>21))==(hy&0x7fffffff)
+			    && (lx<<11)>ly)))) {	/* x > y, x -= ulp */
+		if(lx==0) hx -= 1;
+		lx -= 1;
+	    } else {				/* x < y, x += ulp */
+		lx += 1;
+		if(lx==0) hx += 1;
+	    }
+	} else {				/* x < 0 */
+	    if (esy<0x8000||((ix>>20)&0x7ff)>iy
+		|| (((ix>>20)&0x7ff)==iy
+		    && (((hx<<11)|(lx>>21))>(hy&0x7fffffff)
+			|| (((hx<<11)|(lx>>21))==(hy&0x7fffffff)
+			    && (lx<<11)>ly))))	{/* x < y, x -= ulp */
+		if(lx==0) hx -= 1;
+		lx -= 1;
+	    } else {				/* x > y, x += ulp */
+		lx += 1;
+		if(lx==0) hx += 1;
+	    }
+	}
+	hy = hx&0x7ff00000;
+	if(hy>=0x7ff00000) return x+x;	/* overflow  */
+	if(hy<0x00100000) {		/* underflow */
+	    double x2 = x*x;
+	    if(x2!=x) {		/* raise underflow flag */
+	        INSERT_WORDS(x2,hx,lx);
+		return x2;
+	    }
+	}
+	INSERT_WORDS(x,hx,lx);
+	return x;
+}
+weak_alias (__nextafterx, nextafterx)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__nextafterx, __nextafterxl)
+weak_alias (__nextafterx, nextafterxl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_nextafterxf.c b/sysdeps/libm-ieee754/s_nextafterxf.c
new file mode 100644
index 0000000000..7e870805e2
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nextafterxf.c
@@ -0,0 +1,78 @@
+/* s_nextafterxf.c -- float version of s_nextafter.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	float __nextafterxf(float x, long double y)
+#else
+	float __nextafterxf(x,y)
+	float x;
+	log double y;
+#endif
+{
+	int32_t hx,ix,iy;
+	u_int32_t hy,ly,esy;
+
+	GET_FLOAT_WORD(hx,x);
+	GET_LDOUBLE_WORDS(esy,hy,ly,y);
+	ix = hx&0x7fffffff;		/* |x| */
+	iy = esy&0x7fff;		/* |y| */
+
+	if((ix>0x7f800000) ||   /* x is nan */
+	   (iy>=0x7fff&&((hy|ly)|-(hy|ly))!=0))     /* y is nan */
+	   return x+y;
+	if((long double) x==y) return y;	/* x=y, return y */
+	if(ix==0) {				/* x == 0 */
+	    float x2;
+	    SET_FLOAT_WORD(x,(esy&0x8000?0x80000000:0)|1);/* return +-minsub*/
+	    x2 = x*x;
+	    if(x2==x) return x2; else return x;	/* raise underflow flag */
+	}
+	if(hx>=0) {				/* x > 0 */
+	    if(esy>=0x8000||((ix>>23)&0xff)>iy
+	       || (((ix>>23)&0xff)==iy
+		   && ((ix&0x7fffff)<<8)>(hy&0x7fffffff))) {/* x > y, x -= ulp */
+		hx -= 1;
+	    } else {				/* x < y, x += ulp */
+		hx += 1;
+	    }
+	} else {				/* x < 0 */
+	    if(esy<0x8000||((ix>>23)&0xff)>iy
+	       || (((ix>>23)&0xff)==iy
+		   && ((ix&0x7fffff)<<8)>(hy&0x7fffffff))) {/* x < y, x -= ulp */
+		hx -= 1;
+	    } else {				/* x > y, x += ulp */
+		hx += 1;
+	    }
+	}
+	hy = hx&0x7f800000;
+	if(hy>=0x7f800000) return x+x;	/* overflow  */
+	if(hy<0x00800000) {		/* underflow */
+	    float x2 = x*x;
+	    if(x2!=x) {		/* raise underflow flag */
+	        SET_FLOAT_WORD(x2,hx);
+		return x2;
+	    }
+	}
+	SET_FLOAT_WORD(x,hx);
+	return x;
+}
+weak_alias (__nextafterxf, nextafterxf)
diff --git a/sysdeps/libm-ieee754/s_nextafterxl.c b/sysdeps/libm-ieee754/s_nextafterxl.c
new file mode 100644
index 0000000000..73c3610fc1
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nextafterxl.c
@@ -0,0 +1 @@
+/* This function is the same as nextafterl so we use an alias there.  */
diff --git a/sysdeps/libm-ieee754/s_scalbln.c b/sysdeps/libm-ieee754/s_scalbln.c
new file mode 100644
index 0000000000..aa6134f093
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_scalbln.c
@@ -0,0 +1,70 @@
+/* @(#)s_scalbn.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $";
+#endif
+
+/*
+ * scalbn (double x, int n)
+ * scalbn(x,n) returns x* 2**n  computed by  exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+huge   = 1.0e+300,
+tiny   = 1.0e-300;
+
+#ifdef __STDC__
+	double __scalbln (double x, long int n)
+#else
+	double __scalbln (x,n)
+	double x; long int n;
+#endif
+{
+	int32_t k,hx,lx;
+	EXTRACT_WORDS(hx,lx,x);
+        k = (hx&0x7ff00000)>>20;		/* extract exponent */
+        if (k==0) {				/* 0 or subnormal x */
+            if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+	    x *= two54;
+	    GET_HIGH_WORD(hx,x);
+	    k = ((hx&0x7ff00000)>>20) - 54;
+	    }
+        if (k==0x7ff) return x+x;		/* NaN or Inf */
+        k = k+n;
+        if (n> 50000 || k >  0x7fe)
+	  return huge*__copysign(huge,x); /* overflow  */
+	if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/
+        if (k > 0) 				/* normal result */
+	    {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
+        if (k <= -54)
+	  return tiny*__copysign(tiny,x); 	/*underflow*/
+        k += 54;				/* subnormal result */
+	SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
+        return x*twom54;
+}
+weak_alias (__scalbln, scalbln)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__scalbln, __scalblnl)
+weak_alias (__scalbln, scalblnl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_scalblnf.c b/sysdeps/libm-ieee754/s_scalblnf.c
new file mode 100644
index 0000000000..4ed48733cf
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_scalblnf.c
@@ -0,0 +1,63 @@
+/* s_scalbnf.c -- float version of s_scalbn.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_scalbnf.c,v 1.4 1995/05/10 20:48:10 jtc Exp $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const float
+#else
+static float
+#endif
+two25   =  3.355443200e+07,	/* 0x4c000000 */
+twom25  =  2.9802322388e-08,	/* 0x33000000 */
+huge   = 1.0e+30,
+tiny   = 1.0e-30;
+
+#ifdef __STDC__
+	float __scalblnf (float x, long int n)
+#else
+	float __scalblnf (x,n)
+	float x; long int n;
+#endif
+{
+	int32_t k,ix;
+	GET_FLOAT_WORD(ix,x);
+        k = (ix&0x7f800000)>>23;		/* extract exponent */
+        if (k==0) {				/* 0 or subnormal x */
+            if ((ix&0x7fffffff)==0) return x; /* +-0 */
+	    x *= two25;
+	    GET_FLOAT_WORD(ix,x);
+	    k = ((ix&0x7f800000)>>23) - 25;
+	    }
+        if (k==0xff) return x+x;		/* NaN or Inf */
+        k = k+n;
+        if (n> 50000 || k >  0xfe)
+	  return huge*copysignf(huge,x); /* overflow  */
+	if (n< -50000)
+	  return tiny*copysignf(tiny,x);	/*underflow*/
+        if (k > 0) 				/* normal result */
+	    {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;}
+        if (k <= -25)
+	    return tiny*copysignf(tiny,x);	/*underflow*/
+        k += 25;				/* subnormal result */
+	SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23));
+        return x*twom25;
+}
+weak_alias (__scalblnf, scalblnf)
diff --git a/sysdeps/libm-ieee754/s_scalblnl.c b/sysdeps/libm-ieee754/s_scalblnl.c
new file mode 100644
index 0000000000..aafb73e688
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_scalblnl.c
@@ -0,0 +1,71 @@
+/* s_scalbnl.c -- long double version of s_scalbn.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * scalbnl (long double x, int n)
+ * scalbnl(x,n) returns x* 2**n  computed by  exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+two63   =  4.50359962737049600000e+15,
+twom63  =  1.08420217248550443400e-19;
+huge   = 1.0e+4900L,
+tiny   = 1.0e-4900L;
+
+#ifdef __STDC__
+	long double __scalblnl (long double x, long int n)
+#else
+	long double __scalblnl (x,n)
+	long double x; long int n;
+#endif
+{
+	int32_t k,es,hx,lx;
+	GET_LDOUBLE_WORDS(es,hx,lx,x);
+        k = es&0x7fff;				/* extract exponent */
+        if (k==0) {				/* 0 or subnormal x */
+            if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+	    x *= two63;
+	    GET_LDOUBLE_EXP(es,x);
+	    k = (hx&0x7fff) - 63;
+	    }
+        if (k==0x7fff) return x+x;		/* NaN or Inf */
+        k = k+n;
+        if (n> 50000 || k > 0x7ffe)
+	  return huge*__copysignl(huge,x); /* overflow  */
+	if (n< -50000)
+	  return tiny*__copysignl(tiny,x);
+        if (k > 0) 				/* normal result */
+	    {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;}
+        if (k <= -63)
+	    return tiny*__copysignl(tiny,x); 	/*underflow*/
+        k += 54;				/* subnormal result */
+	SET_LDOUBLE_EXP(x,(es&0x8000)|k);
+        return x*twom63;
+}
+weak_alias (__scalblnl, scalblnl)
diff --git a/sysdeps/libm-ieee754/s_scalbn.c b/sysdeps/libm-ieee754/s_scalbn.c
index 0ce0ffdf2f..3dbfe8fef0 100644
--- a/sysdeps/libm-ieee754/s_scalbn.c
+++ b/sysdeps/libm-ieee754/s_scalbn.c
@@ -35,10 +35,10 @@ huge   = 1.0e+300,
 tiny   = 1.0e-300;
 
 #ifdef __STDC__
-	double __scalbn (double x, long int n)
+	double __scalbn (double x, int n)
 #else
 	double __scalbn (x,n)
-	double x; long int n;
+	double x; int n;
 #endif
 {
 	int32_t k,hx,lx;
diff --git a/sysdeps/libm-ieee754/s_scalbnf.c b/sysdeps/libm-ieee754/s_scalbnf.c
index 4799c825c9..11b77bd6c2 100644
--- a/sysdeps/libm-ieee754/s_scalbnf.c
+++ b/sysdeps/libm-ieee754/s_scalbnf.c
@@ -31,10 +31,10 @@ huge   = 1.0e+30,
 tiny   = 1.0e-30;
 
 #ifdef __STDC__
-	float __scalbnf (float x, long int n)
+	float __scalbnf (float x, int n)
 #else
 	float __scalbnf (x,n)
-	float x; long int n;
+	float x; int n;
 #endif
 {
 	int32_t k,ix;
diff --git a/sysdeps/libm-ieee754/s_scalbnl.c b/sysdeps/libm-ieee754/s_scalbnl.c
index 3e80d85136..4e1d08ef90 100644
--- a/sysdeps/libm-ieee754/s_scalbnl.c
+++ b/sysdeps/libm-ieee754/s_scalbnl.c
@@ -39,10 +39,10 @@ huge   = 1.0e+4900L,
 tiny   = 1.0e-4900L;
 
 #ifdef __STDC__
-	long double __scalbnl (long double x, long int n)
+	long double __scalbnl (long double x, int n)
 #else
 	long double __scalbnl (x,n)
-	long double x; long int n;
+	long double x; int n;
 #endif
 {
 	int32_t k,es,hx,lx;
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index cc0fb56189..1d2045dd87 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -223,7 +223,16 @@ static inline void
 elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
 		       Elf32_Addr *reloc_addr, Elf32_Addr value)
 {
-  *reloc_addr = value + reloc->r_addend;
+  *reloc_addr = value;
+}
+
+/* Return the final value of a plt relocation.  On the m68k the JMP_SLOT
+   relocation ignores the addend.  */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
+		       Elf32_Addr value)
+{
+  return value;
 }
 
 #endif /* !dl_machine_h */
@@ -272,7 +281,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  break;
 	case R_68K_GLOB_DAT:
 	case R_68K_JMP_SLOT:
-	  *reloc_addr = value + reloc->r_addend;
+	  *reloc_addr = value;
 	  break;
 	case R_68K_8:
 	  *(char *) reloc_addr = value + reloc->r_addend;
diff --git a/sysdeps/m68k/m68020/bits/string.h b/sysdeps/m68k/m68020/bits/string.h
new file mode 100644
index 0000000000..6462ef0d83
--- /dev/null
+++ b/sysdeps/m68k/m68020/bits/string.h
@@ -0,0 +1,26 @@
+/* Optimized, inlined string functions.  m680x0 version, x >= 2.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _STRING_H
+# error "Never use <bits/string.h> directly; include <string.h> instead."
+#endif
+
+/* Currently the only purpose of this file is to tell the generic inline
+   macros that unaligned memory access is possible.  */
+#define _STRING_ARCH_unaligned	1
diff --git a/sysdeps/mach/hurd/bits/fcntl.h b/sysdeps/mach/hurd/bits/fcntl.h
index c3d187ae0e..102c2a574f 100644
--- a/sysdeps/mach/hurd/bits/fcntl.h
+++ b/sysdeps/mach/hurd/bits/fcntl.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 /* File access modes.  These are understood by io servers; they can be
@@ -29,10 +29,10 @@
 
 /* In GNU, read and write are bits (unlike BSD).  */
 #ifdef __USE_GNU
-#define	O_READ		O_RDONLY /* Open for reading.  */
-#define O_WRITE		O_WRONLY /* Open for writing.  */
-#define	O_EXEC		0x0004	/* Open for execution.  */
-#define O_NORW		0	/* Open without R/W access.  */
+# define O_READ		O_RDONLY /* Open for reading.  */
+# define O_WRITE	O_WRONLY /* Open for writing.  */
+# define O_EXEC		0x0004	/* Open for execution.  */
+# define O_NORW		0	/* Open without R/W access.  */
 #endif
 /* POSIX.1 standard names.  */
 #define	O_RDONLY	0x0001	/* Open read-only.  */
@@ -49,8 +49,8 @@
 #define	O_CREAT		0x0010	/* Create file if it doesn't exist.  */
 #define	O_EXCL		0x0020	/* Fail if file already exists.  */
 #ifdef __USE_GNU
-#define	O_NOLINK	0x0040	/* No name mappings on final component.  */
-#define	O_NOTRANS	0x0080	/* No translator on final component. */
+# define O_NOLINK	0x0040	/* No name mappings on final component.  */
+# define O_NOTRANS	0x0080	/* No translator on final component. */
 #endif
 
 
@@ -62,16 +62,16 @@
 
 #define	O_APPEND	0x0100	/* Writes always append to the file.  */
 #ifdef __USE_BSD
-#define	O_ASYNC		0x0200	/* Send SIGIO to owner when data is ready.  */
-#define	O_FSYNC		0x0400	/* Synchronous writes.  */
-#define	O_SYNC		O_FSYNC
+# define O_ASYNC	0x0200	/* Send SIGIO to owner when data is ready.  */
+# define O_FSYNC	0x0400	/* Synchronous writes.  */
+# define O_SYNC		O_FSYNC
 #endif
 #ifdef __USE_GNU
-#define	O_NOATIME	0x0800	/* Don't set access time on read (owner).  */
+# define O_NOATIME	0x0800	/* Don't set access time on read (owner).  */
 #endif
 #ifdef	__USE_MISC
-#define	O_SHLOCK	0x00020000 /* Open with shared file lock.  */
-#define	O_EXLOCK	0x00040000 /* Open with exclusive file lock.  */
+# define O_SHLOCK	0x00020000 /* Open with shared file lock.  */
+# define O_EXLOCK	0x00040000 /* Open with exclusive file lock.  */
 #endif
 
 
@@ -92,13 +92,13 @@
 
 #define	O_NONBLOCK	0x0008	/* Non-blocking open or non-blocking I/O.  */
 #ifdef __USE_BSD
-#define	O_NDELAY	O_NONBLOCK /* Deprecated.  */
+# define O_NDELAY	O_NONBLOCK /* Deprecated.  */
 #endif
 
 
 #ifdef __USE_GNU
 /* Mask of bits which are understood by io servers.  */
-#define O_HURD		(0xffff | O_EXLOCK | O_SHLOCK)
+# define O_HURD		(0xffff | O_EXLOCK | O_SHLOCK)
 #endif
 
 
@@ -113,7 +113,7 @@
    and are not preserved once the file has been opened.  */
 
 #ifdef __USE_GNU
-#define	O_IGNORE_CTTY	0x00080000 /* Don't do any ctty magic at all.  */
+# define O_IGNORE_CTTY	0x00080000 /* Don't do any ctty magic at all.  */
 #endif
 /* `open' never assigns a controlling terminal in GNU.  */
 #define	O_NOCTTY	0	/* Don't assign a controlling terminal.  */
@@ -121,20 +121,20 @@
 
 #ifdef __USE_BSD
 /* Bits in the file status flags returned by F_GETFL.  */
-#define FREAD		O_RDONLY
-#define	FWRITE		O_WRONLY
+# define FREAD		O_RDONLY
+# define FWRITE		O_WRONLY
 
 /* Traditional BSD names the O_* bits.  */
-#define FASYNC		O_ASYNC
-#define FCREAT		O_CREAT
-#define FEXCL		O_EXCL
-#define FTRUNC		O_TRUNC
-#define FNOCTTY		O_NOCTTY
-#define FFSYNC		O_FSYNC
-#define FSYNC		O_SYNC
-#define FAPPEND		O_APPEND
-#define FNONBLOCK	O_NONBLOCK
-#define FNDELAY		O_NDELAY
+# define FASYNC		O_ASYNC
+# define FCREAT		O_CREAT
+# define FEXCL		O_EXCL
+# define FTRUNC		O_TRUNC
+# define FNOCTTY	O_NOCTTY
+# define FFSYNC		O_FSYNC
+# define FSYNC		O_SYNC
+# define FAPPEND	O_APPEND
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 #endif
 
 
@@ -145,8 +145,8 @@
 #define	F_GETFL		3	/* Get file status flags.  */
 #define	F_SETFL		4	/* Set file status flags.  */
 #ifdef __USE_BSD
-#define	F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
-#define	F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
+# define F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
+# define F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
 #endif
 #define	F_GETLK		7	/* Get record locking info.  */
 #define	F_SETLK		8	/* Set record locking info (non-blocking).  */
@@ -164,10 +164,26 @@ struct flock
   {
     int l_type;		/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
     int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
     __off_t l_start;	/* Offset where the lock begins.  */
     __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    int l_type;		/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
     __pid_t l_pid;	/* Process holding the lock.  */
   };
+#endif
 
 /* Values for the `l_type' field of a `struct flock'.  */
 #define	F_RDLCK	1	/* Read lock.  */
diff --git a/sysdeps/mach/hurd/bits/stat.h b/sysdeps/mach/hurd/bits/stat.h
index 2110a73aae..4679c589ee 100644
--- a/sysdeps/mach/hurd/bits/stat.h
+++ b/sysdeps/mach/hurd/bits/stat.h
@@ -39,7 +39,11 @@ struct stat
     __fsid_t st_fsid;		/* File system ID.  */
 #define	st_dev	st_fsid
 
+#ifndef __USE_FILE_OFFSET64
     __ino_t st_ino;		/* File number.  */
+#else
+    __ino64_t st_ino;		/* File number.  */
+#endif
     unsigned int st_gen;	/* To detect reuse of file numbers.  */
     __dev_t st_rdev;		/* Device if special file.  */
     __mode_t st_mode;		/* File mode.  */
@@ -48,7 +52,11 @@ struct stat
     __uid_t st_uid;		/* Owner.  */
     __gid_t st_gid;		/* Owning group.  */
 
+#ifndef __USE_FILE_OFFSET64
     __off_t st_size;		/* Size in bytes.  */
+#else
+    __off64_t st_size;		/* Size in bytes.  */
+#endif
 
     __time_t st_atime;		/* Access time, seconds */
     unsigned long int st_atime_usec; /* and microseconds.  */
@@ -59,9 +67,56 @@ struct stat
 
     unsigned int st_blksize;	/* Optimal size for I/O.  */
 
-#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
+#ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.
+				   Not related to `st_blksize'.  */
+#else
+    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.
+				   Not related to `st_blksize'.  */
+#endif
+
+    __uid_t st_author;		/* File author.  */
+
+    unsigned int st_flags;	/* User-defined flags.
+				   High 16 bits can be set only by root.  */
 
-    unsigned int st_blocks;	/* Number of 512-byte blocks allocated.
+#ifndef __USE_FILE_OFFSET64
+# define _SPARE_SIZE	((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11)
+#else
+# define _SPARE_SIZE	((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
+#endif
+    int st_spare[_SPARE_SIZE];	/* Room for future expansion.  */
+#undef _SPARE_SIZE
+  };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+    int st_fstype;		/* File system type.  */
+    __fsid_t st_fsid;		/* File system ID.  */
+# define st_dev	st_fsid
+
+    __ino64_t st_ino;		/* File number.  */
+    unsigned int st_gen;	/* To detect reuse of file numbers.  */
+    __dev_t st_rdev;		/* Device if special file.  */
+    __mode_t st_mode;		/* File mode.  */
+    __nlink_t st_nlink;		/* Number of links.  */
+
+    __uid_t st_uid;		/* Owner.  */
+    __gid_t st_gid;		/* Owning group.  */
+
+    __off64_t st_size;		/* Size in bytes.  */
+
+    __time_t st_atime;		/* Access time, seconds */
+    unsigned long int st_atime_usec; /* and microseconds.  */
+    __time_t st_mtime;		/* Modification time, seconds */
+    unsigned long int st_mtime_usec; /* and microseconds.  */
+    __time_t st_ctime;		/* Status change time, seconds */
+    unsigned long int st_ctime_usec; /* and microseconds.  */
+
+    unsigned int st_blksize;	/* Optimal size for I/O.  */
+
+    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.
 				   Not related to `st_blksize'.  */
 
     __uid_t st_author;		/* File author.  */
@@ -69,10 +124,13 @@ struct stat
     unsigned int st_flags;	/* User-defined flags.
 				   High 16 bits can be set only by root.  */
 
-#define _SPARE_SIZE	((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11)
+#define _SPARE_SIZE	((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
     int st_spare[_SPARE_SIZE];	/* Room for future expansion.  */
 #undef _SPARE_SIZE
   };
+#endif
+
+#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
 /* Encoding of the file mode.  */
 
diff --git a/sysdeps/mach/hurd/sys/param.h b/sysdeps/mach/hurd/sys/param.h
index 55d47f74de..bd9ca412ba 100644
--- a/sysdeps/mach/hurd/sys/param.h
+++ b/sysdeps/mach/hurd/sys/param.h
@@ -71,7 +71,7 @@
 #include <endian.h>
 #include <limits.h>
 #ifdef notyet
-#include <ufs/param.h>
+# include <ufs/param.h>
 #endif
 
 
@@ -113,7 +113,7 @@
 
 /* Macros for counting and rounding.  */
 #ifndef howmany
-#define	howmany(x, y)	(((x)+((y)-1))/(y))
+# define howmany(x, y)	(((x)+((y)-1))/(y))
 #endif
 #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))
 #define powerof2(x)	((((x)-1)&(x))==0)
diff --git a/sysdeps/posix/open64.c b/sysdeps/posix/open64.c
new file mode 100644
index 0000000000..e409891980
--- /dev/null
+++ b/sysdeps/posix/open64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <fcntl.h>
+#include <stdarg.h>
+
+/* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,
+   a third argument is the file protection.  */
+int
+__open64 (file, oflag)
+     const char *file;
+     int oflag;
+{
+  int mode;
+
+  if (oflag & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, oflag);
+      mode = va_arg (arg, int);
+      va_end (arg);
+    }
+  else
+    mode = 0;
+
+  return __open (file, oflag | O_LARGEFILE, mode);
+}
+weak_alias (__open64, open64)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index 3b82d3d366..291817c9ef 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -83,7 +83,7 @@ static const char letters[] =
 char *
 __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
 		      const char *pfx, int dir_search, size_t *lenptr,
-		      FILE **streamptr)
+		      FILE **streamptr, int large_file)
 {
   int saverrno = errno;
   static const char tmpdir[] = P_tmpdir;
@@ -186,7 +186,13 @@ __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
       if (streamptr != NULL)
 	{
 	  /* Try to create the file atomically.  */
+#ifdef _G_OPEN64
+	  int fd = (large_file
+		    ? __open (buf, O_RDWR|O_CREAT|O_EXCL, 0666)
+		    : _G_OPEN64 (buf, O_RDWR|O_CREAT|O_EXCL, 0666));
+#else
 	  int fd = __open (buf, O_RDWR|O_CREAT|O_EXCL, 0666);
+#endif
 	  if (fd >= 0)
 	    {
 	      /* We got a new file that did not previously exist.
diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h
index beabc1d4ff..6ab79e79ac 100644
--- a/sysdeps/powerpc/dl-machine.h
+++ b/sysdeps/powerpc/dl-machine.h
@@ -613,6 +613,14 @@ elf_machine_fixup_plt(struct link_map *map, const Elf32_Rela *reloc,
   MODIFIED_CODE (reloc_addr);
 }
 
+/* Return the final value of a plt relocation.  */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
+		       Elf32_Addr value)
+{
+  return value + reloc->r_addend;
+}
+
 #endif /* dl_machine_h */
 
 #ifdef RESOLVE
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 288a140245..224c6bafff 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -240,6 +240,8 @@ static inline void
 elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
 		       Elf32_Addr *reloc_addr, Elf32_Addr value)
 {
+  extern unsigned long _dl_hwcap;
+
   /* For thread safety, write the instructions from the bottom and
      flush before we overwrite the critical "b,a".  This of course
      need not be done during bootstrapping, since there are no threads.
@@ -258,6 +260,14 @@ elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
 #endif
 }
 
+/* Return the final value of a plt relocation.  */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
+		       Elf32_Addr value)
+{
+  return value + reloc->r_addend;
+}
+
 #ifdef RESOLVE
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
@@ -268,8 +278,6 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 		  const Elf32_Sym *sym, const struct r_found_version *version,
 		  Elf32_Addr *const reloc_addr)
 {
-  extern unsigned long _dl_hwcap;
-
   if (ELF32_R_TYPE (reloc->r_info) == R_SPARC_RELATIVE)
     {
 #ifndef RTLD_BOOTSTRAP
diff --git a/sysdeps/sparc/sparc32/setjmp.S b/sysdeps/sparc/sparc32/setjmp.S
index 58d94119ef..44dcadb66e 100644
--- a/sysdeps/sparc/sparc32/setjmp.S
+++ b/sysdeps/sparc/sparc32/setjmp.S
@@ -22,10 +22,10 @@
 #define _ASM 1
 #include <bits/setjmp.h>
 
-ENTRY(_setjmp)
+ENTRY(__setjmp)
 	b	1f
 	 set	0, %o1
-END(_setjmp)
+END(__setjmp)
 
 ENTRY(setjmp)
 	set	1, %o1
@@ -46,5 +46,5 @@ ENTRY (__sigsetjmp)
 	 mov	%g1, %o7
 END(__sigsetjmp)
 
-weak_extern(_setjmp)
+weak_alias(__setjmp, _setjmp)
 weak_extern(setjmp)
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index 226623152d..354fea6ce5 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -85,6 +85,14 @@ elf_machine_fixup_plt(struct link_map *map, const Elf64_Rela *reloc,
     }
 }
 
+/* Return the final value of a plt relocation.  */
+static inline Elf64_Addr
+elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
+		       Elf64_Addr value)
+{
+  return value + reloc->r_addend;
+}
+
 #ifdef RESOLVE
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
diff --git a/sysdeps/sparc/sparc64/sub_n.S b/sysdeps/sparc/sparc64/sub_n.S
index 93f8a8235d..403d50c704 100644
--- a/sysdeps/sparc/sparc64/sub_n.S
+++ b/sysdeps/sparc/sparc64/sub_n.S
@@ -1,7 +1,7 @@
 /* SPARC v9 __mpn_sub_n -- Subtract two limb vectors of the same length > 0
    and store difference in a third limb vector.
 
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
 
    This file is part of the GNU MP Library.
 
@@ -43,7 +43,7 @@ ENTRY(__mpn_sub_n)
 	ldx [%o1+%o5],%g2		! load s1 limb
 	addcc %g1,%o4,%g1		! add s2 limb and carry variable
 	movcc %xcc,0,%o4		! if carry-out, o4 was 1; clear it
-	subcc %g1,%g2,%g1		! subtract s1 limb from sum
+	subcc %g2,%g1,%g1		! subtract s1 limb from sum
 	stx %g1,[%o0+%o5]		! store result
 	add %o5,8,%o5			! increment address index
 	brnz,pt %g3,1b
diff --git a/sysdeps/stub/fstatfs.c b/sysdeps/stub/fstatfs.c
index 71502c5e9f..e7c40d8006 100644
--- a/sysdeps/stub/fstatfs.c
+++ b/sysdeps/stub/fstatfs.c
@@ -1,4 +1,4 @@
-/* fstatfs -- Return information about the filesystem on which FD resides.
+/* Return information about the filesystem on which FD resides.
    Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -28,6 +28,6 @@ __fstatfs (int fd, struct statfs *buf)
   __set_errno (ENOSYS);
   return -1;
 }
-stub_warning (statfs)
+stub_warning (fstatfs)
 
 weak_alias (__fstatfs, fstatfs)
diff --git a/sysdeps/stub/setenv.c b/sysdeps/stub/fstatfs64.c
index 15ba9bd524..b2dba0f38b 100644
--- a/sysdeps/stub/setenv.c
+++ b/sysdeps/stub/fstatfs64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
+/* Return information about the filesystem on which FD resides.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,36 +17,15 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <stdlib.h>
 #include <errno.h>
+#include <sys/statfs.h>
+#include <stddef.h>
 
+/* Return information about the filesystem on which FD resides.  */
 int
-setenv (name, value, replace)
-     const char *name;
-     const char *value;
-     int replace;
+fstatfs64 (int fd, struct statfs64 *buf)
 {
   __set_errno (ENOSYS);
   return -1;
 }
-
-stub_warning (setenv)
-
-void
-unsetenv (name)
-     const char *name;
-{
-  __set_errno (ENOSYS);
-}
-
-stub_warning (unsetenv)
-
-
-int
-clearenv (void)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (clearenv)
+stub_warning (fstatfs64)
diff --git a/sysdeps/stub/fxstat.c b/sysdeps/stub/fxstat.c
index 21c9098d17..0110c5fda0 100644
--- a/sysdeps/stub/fxstat.c
+++ b/sysdeps/stub/fxstat.c
@@ -44,6 +44,6 @@ __fxstat (int vers, int fd, struct stat *buf)
   __set_errno (ENOSYS);
   return -1;
 }
-stub_warning (__fxstat)
+stub_warning (fstat)
 
 weak_alias (__fxstat, _fxstat)
diff --git a/sysdeps/stub/morecore.c b/sysdeps/stub/fxstat64.c
index c2b1cb1985..93ec312d3e 100644
--- a/sysdeps/stub/morecore.c
+++ b/sysdeps/stub/fxstat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,22 +16,32 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <stddef.h>
 #include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
 
-#define	_MALLOC_INTERNAL
-#include <malloc.h>
-
-/* Allocate INCREMENT more bytes of data space,
-   and return the start of data space, or NULL on errors.
-   If INCREMENT is negative, shrink data space.  */
-__ptr_t
-__default_morecore (increment)
-     ptrdiff_t increment;
+/* Get information about the file descriptor FD in BUF.  */
+int
+__fxstat64 (int vers, int fd, struct stat64 *buf)
 {
+  if (vers != _STAT_VER)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+  else if (buf == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
   __set_errno (ENOSYS);
-  return NULL;
+  return -1;
 }
-
-
-stub_warning (__default_morecore)
+stub_warning (fstat64)
diff --git a/sysdeps/stub/putenv.c b/sysdeps/stub/getrlimit64.c
index 68a4a4552f..6f12cad84b 100644
--- a/sysdeps/stub/putenv.c
+++ b/sysdeps/stub/getrlimit64.c
@@ -16,18 +16,16 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <sys/resource.h>
 #include <errno.h>
-#include <stdlib.h>
 
-/* Put STRING, which is of the form "NAME=VALUE", in the environment.
-   If there is no `=', remove NAME from the environment.  */
+/* Put the soft and hard limits for RESOURCE in *RLIMITS.
+   Returns 0 if successful, -1 if not (and sets errno).  */
 int
-putenv (string)
-     const char *string;
+getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
 {
   __set_errno (ENOSYS);
   return -1;
 }
 
-
-stub_warning (putenv)
+stub_warning (getrlimit64)
diff --git a/sysdeps/stub/lseek64.c b/sysdeps/stub/lseek64.c
new file mode 100644
index 0000000000..71d58ba1a6
--- /dev/null
+++ b/sysdeps/stub/lseek64.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Seek to OFFSET on FD, starting from WHENCE.  */
+off64_t
+lseek64 (fd, offset, whence)
+     int fd;
+     off64_t offset;
+     int whence;
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+  switch (whence)
+    {
+    case SEEK_SET:
+    case SEEK_CUR:
+    case SEEK_END:
+      break;
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (lseek64)
diff --git a/sysdeps/stub/lxstat.c b/sysdeps/stub/lxstat64.c
index 3a7d64bedb..78e0b82bde 100644
--- a/sysdeps/stub/lxstat.c
+++ b/sysdeps/stub/lxstat64.c
@@ -23,7 +23,7 @@
 /* Get file information about FILE in BUF.
    If FILE is a symbolic link, do not follow it.  */
 int
-__lxstat (int vers, const char *file, struct stat *buf)
+__lxstat64 (int vers, const char *file, struct stat64 *buf)
 {
   if (vers != _STAT_VER || file == NULL || buf == NULL)
     {
@@ -34,6 +34,4 @@ __lxstat (int vers, const char *file, struct stat *buf)
   __set_errno (ENOSYS);
   return -1;
 }
-stub_warning (__lxstat)
-
-weak_alias (__lxstat, _lxstat)
+stub_warning (lstat64)
diff --git a/sysdeps/stub/open64.c b/sysdeps/stub/open64.c
new file mode 100644
index 0000000000..c020d887bd
--- /dev/null
+++ b/sysdeps/stub/open64.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stddef.h>
+
+/* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,
+   a third argument is the file protection.  */
+int
+__open64 (file, oflag)
+     const char *file;
+     int oflag;
+{
+  int mode;
+
+  if (file == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  if (oflag & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, oflag);
+      mode = va_arg (arg, int);
+      va_end (arg);
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__open64, open64)
+
+stub_warning (open64)
diff --git a/sysdeps/stub/pread64.c b/sysdeps/stub/pread64.c
new file mode 100644
index 0000000000..4223646576
--- /dev/null
+++ b/sysdeps/stub/pread64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Read NBYTES into BUF from FD at the given position OFFSET without
+   changing the file pointer.  Return the number read or -1.  */
+ssize_t
+pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
+{
+  if (nbytes == 0)
+    return 0;
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+  if (buf == NULL || offset < 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (pread64)
diff --git a/sysdeps/stub/pwrite64.c b/sysdeps/stub/pwrite64.c
new file mode 100644
index 0000000000..c8c77a1880
--- /dev/null
+++ b/sysdeps/stub/pwrite64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Write NBYTES of BUF to FD at given position OFFSET without changing
+   the file position.  Return the number written, or -1.  */
+ssize_t
+pwrite64 (int fd, const void *buf, size_t nbytes, off64_t offset)
+{
+  if (nbytes == 0)
+    return 0;
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+  if (buf == NULL || offset < 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (pwrite64)
diff --git a/sysdeps/stub/getenv.c b/sysdeps/stub/readdir64.c
index ec378f63cc..fbf4bf4d54 100644
--- a/sysdeps/stub/getenv.c
+++ b/sysdeps/stub/readdir64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,16 +17,14 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <stdlib.h>
+#include <stddef.h>
+#include <dirent.h>
 
-/* Return the value of the environment variable NAME.  */
-char *
-getenv (name)
-     const char *name;
+/* Read a directory entry from DIRP.  */
+struct dirent64 *
+readdir64 (DIR *dirp)
 {
   __set_errno (ENOSYS);
   return NULL;
 }
-
-
-stub_warning (getenv)
+stub_warning (readdir64)
diff --git a/sysdeps/stub/sbrk.c b/sysdeps/stub/readdir64_r.c
index a85b1bdb3e..cb143cb40c 100644
--- a/sysdeps/stub/sbrk.c
+++ b/sysdeps/stub/readdir64_r.c
@@ -17,17 +17,16 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
 
-/* Extend the process's data space by INCREMENT.
-   If INCREMENT is negative, shrink data space by - INCREMENT.
-   Return the address of the start of data space, or -1 for errors.  */
-void *
-__sbrk (increment)
-     int increment;
+/* Read a directory entry from DIRP, store result in ENTRY and return
+   pointer to result in *RESULT.  */
+int
+readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
 {
   __set_errno (ENOSYS);
-  return (void *) -1;
+  *result = NULL;
+  return -1;
 }
-stub_warning (sbrk)
-
-weak_alias (__sbrk, sbrk)
+stub_warning (readdir64_r)
diff --git a/sysdeps/stub/setrlimit64.c b/sysdeps/stub/setrlimit64.c
new file mode 100644
index 0000000000..0f223f246c
--- /dev/null
+++ b/sysdeps/stub/setrlimit64.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sys/resource.h>
+#include <errno.h>
+
+/* Set the soft and hard limits for RESOURCE to *RLIMITS.
+   Only the super-user can increase hard limits.
+   Return 0 if successful, -1 if not (and sets errno).  */
+int
+setrlimit64 (resource, rlimits)
+     enum __rlimit_resource resource;
+     struct rlimit64 *rlimits;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (setrlimit64)
diff --git a/sysdeps/stub/statfs64.c b/sysdeps/stub/statfs64.c
new file mode 100644
index 0000000000..51cde7dd27
--- /dev/null
+++ b/sysdeps/stub/statfs64.c
@@ -0,0 +1,31 @@
+/* Return information about the filesystem on which FILE resides.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <sys/statfs.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FILE resides.  */
+int
+statfs64 (const char *file, struct statfs64 *buf)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (statfs64)
diff --git a/sysdeps/stub/sysd-stdio.c b/sysdeps/stub/sysd-stdio.c
deleted file mode 100644
index 2c2dc3c1f2..0000000000
--- a/sysdeps/stub/sysd-stdio.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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 <stdio.h>
-
-
-/* Read up to N chars into BUF from COOKIE.
-   Return how many chars were read, 0 for EOF or -1 for error.  */
-int
-__stdio_read (cookie, buf, n)
-     void *cookie;
-     register char *buf;
-     register size_t n;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-/* Write up to N chars from BUF to COOKIE.
-   Return how many chars were written or -1 for error.  */
-int
-__stdio_write (cookie, buf, n)
-     void *cookie;
-     register const char *buf;
-     register size_t n;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-/* Move COOKIE's file position *POS bytes, according to WHENCE.
-   The new file position is stored in *POS.
-   Returns zero if successful, nonzero if not.  */
-int
-__stdio_seek (cookie, pos, whence)
-     void *cookie;
-     fpos_t *pos;
-     int whence;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-/* Close the file associated with COOKIE.
-   Return 0 for success or -1 for failure.  */
-int
-__stdio_close (cookie)
-      void *cookie;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-/* Return the POSIX.1 file descriptor associated with COOKIE,
-   or -1 for errors.  If COOKIE does not relate to any POSIX.1 file
-   descriptor, this should return -1 with errno set to EOPNOTSUPP.  */
-int
-__stdio_fileno (cookie)
-     void *cookie;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-/* Open FILENAME with the mode in M.
-   Store the magic cookie associated with the opened file in *COOKIEPTR.
-   Return zero on success and nonzero on failure.  */
-int
-__stdio_open (filename, m, cookieptr)
-     const char *filename;
-     __io_mode m;
-     void **cookieptr;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-/* Open FILENAME with the mode in M.  Use the same magic cookie
-   already in *COOKIEPTR if possible, closing the old cookie with CLOSEFN.  */
-int
-__stdio_reopen (filename, m, cookieptr)
-     const char *filename;
-     __io_mode m;
-     void **cookieptr;
-     __io_close_fn closefn;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (__stdio_read)
-stub_warning (__stdio_write)
-stub_warning (__stdio_seek)
-stub_warning (__stdio_close)
-stub_warning (__stdio_fileno)
-stub_warning (__stdio_open)
-stub_warning (__stdio_reopen)
diff --git a/sysdeps/stub/sysdep.h b/sysdeps/stub/sysdep.h
deleted file mode 100644
index 8c3184bf03..0000000000
--- a/sysdeps/stub/sysdep.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* This file should contain any system-dependent types and macros
-   that will be used by many parts of the library.  It should also
-   contain declarations for any functions defined in sysdep.c.  */
diff --git a/sysdeps/stub/tempname.c b/sysdeps/stub/tempname.c
index b93b948ca6..d87c54f86a 100644
--- a/sysdeps/stub/tempname.c
+++ b/sysdeps/stub/tempname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 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
@@ -26,7 +26,8 @@
    Return the generated filename or NULL if one could not
    be generated, putting the length of the string in *LENPTR.  */
 char *
-__stdio_gen_tempname (buf, bufsize, dir, pfx, dir_search, lenptr, streamptr)
+__stdio_gen_tempname (buf, bufsize, dir, pfx, dir_search, lenptr, streamptr,
+		      large_file)
      char *buf;
      size_t bufsize;
      const char *dir;
@@ -34,11 +35,11 @@ __stdio_gen_tempname (buf, bufsize, dir, pfx, dir_search, lenptr, streamptr)
      int dir_search;
      size_t *lenptr;
      FILE **streamptr;
+     int large_file;
 {
   *lenptr = 0;
   __set_errno (ENOSYS);
   return NULL;
 }
 
-
 stub_warning (__stdio_gen_tempname)
diff --git a/sysdeps/stub/xstat64.c b/sysdeps/stub/xstat64.c
new file mode 100644
index 0000000000..8eb1d177df
--- /dev/null
+++ b/sysdeps/stub/xstat64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <stddef.h>
+
+/* Get file information about FILE in BUF.  */
+int
+__xstat64 (int vers, const char *file, struct stat64 *buf)
+{
+  if (vers != _STAT_VER || file == NULL || buf == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (stat64)
diff --git a/sysdeps/unix/bsd/bits/fcntl.h b/sysdeps/unix/bsd/bits/fcntl.h
index 3d9bcb5c60..8565170fa5 100644
--- a/sysdeps/unix/bsd/bits/fcntl.h
+++ b/sysdeps/unix/bsd/bits/fcntl.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 
@@ -35,10 +35,10 @@
 /* Apparently not assigning a controlling terminal is the default
    behavior in BSD, so no bit is required to request that behavior.  */
 #define	O_NOCTTY	0	/* Don't assign a controlling terminal.  */
-#if	defined (__USE_BSD) || defined (__USE_SVID)
-#define	O_ASYNC		0x0040	/* Send SIGIO to owner when data is ready.  */
-#define	O_FSYNC		0x2000	/* Synchronous writes.  */
-#define	O_SYNC		O_FSYNC
+#if defined __USE_BSD || defined __USE_SVID
+# define O_ASYNC		0x0040	/* Send SIGIO to owner when data is ready.  */
+# define O_FSYNC		0x2000	/* Synchronous writes.  */
+# define O_SYNC		O_FSYNC
 #endif
 
 /* File status flags for `open' and `fcntl'.  */
@@ -48,7 +48,7 @@
 #ifdef __USE_BSD
 /* BSD before 4.4 doesn't support POSIX.1 O_NONBLOCK,
    but O_NDELAY is close.  */
-#define	O_NDELAY	O_NONBLOCK
+# define O_NDELAY	O_NONBLOCK
 #endif
 
 #ifdef __USE_BSD
@@ -56,26 +56,29 @@
    These are all the O_* flags, plus FREAD and FWRITE, which are
    independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
    given to `open'.  */
-#define FREAD		1
-#define	FWRITE		2
+# define FREAD		1
+# define FWRITE		2
 
 /* Traditional BSD names the O_* bits.  */
-#define FASYNC		O_ASYNC
-#define FCREAT		O_CREAT
-#define FEXCL		O_EXCL
-#define FTRUNC		O_TRUNC
-#define FNOCTTY		O_NOCTTY
-#define FFSYNC		O_FSYNC
-#define FSYNC		O_SYNC
-#define FAPPEND		O_APPEND
-#define FNONBLOCK	O_NONBLOCK
-#define FNDELAY		O_NDELAY
+# define FASYNC		O_ASYNC
+# define FCREAT		O_CREAT
+# define FEXCL		O_EXCL
+# define FTRUNC		O_TRUNC
+# define FNOCTTY	O_NOCTTY
+# define FFSYNC		O_FSYNC
+# define FSYNC		O_SYNC
+# define FAPPEND	O_APPEND
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 #endif
 
 /* Mask for file access modes.  This is system-dependent in case
    some system ever wants to define some other flavor of access.  */
 #define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
 
+/* XXX missing */
+#define O_LARGEFILE	0
+
 /* Values for the second argument to `fcntl'.  */
 #define	F_DUPFD	  	0	/* Duplicate file descriptor.  */
 #define	F_GETFD		1	/* Get file descriptor flags.  */
@@ -83,13 +86,18 @@
 #define	F_GETFL		3	/* Get file status flags.  */
 #define	F_SETFL		4	/* Set file status flags.  */
 #ifdef __USE_BSD
-#define	F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
-#define	F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
+# define F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
+# define F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
 #endif
 #define	F_GETLK		7	/* Get record locking info.  */
 #define	F_SETLK		8	/* Set record locking info (non-blocking).  */
 #define	F_SETLKW	9	/* Set record locking info (blocking).  */
 
+/* XXX missing */
+#define F_GETLK64	7	/* Get record locking info.  */
+#define F_SETLK64	8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	9	/* Set record locking info (blocking).  */
+
 /* File descriptor flags used with F_GETFD and F_SETFD.  */
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
@@ -102,12 +110,29 @@ struct flock
   {
     short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
     __off_t l_start;	/* Offset where the lock begins.  */
     __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
     short int l_pid;	/* Process holding the lock.  */
     short int l_xxx;	/* Reserved for future use.  */
   };
 
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    short int l_pid;	/* Process holding the lock.  */
+    short int l_xxx;	/* Reserved for future use.  */
+  };
+#endif
+
 /* Values for the `l_type' field of a `struct flock'.  */
 #define	F_RDLCK	1	/* Read lock.  */
 #define	F_WRLCK	2	/* Write lock.  */
diff --git a/sysdeps/unix/bsd/bits/stat.h b/sysdeps/unix/bsd/bits/stat.h
index 037433f388..71130f3fcb 100644
--- a/sysdeps/unix/bsd/bits/stat.h
+++ b/sysdeps/unix/bsd/bits/stat.h
@@ -56,7 +56,7 @@ struct stat
     unsigned long int st_blksize; /* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
-    unsigned long int st_blocks; /* Number of 512-byte blocks allocated.  */
+    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
 
     long int st_spare[2];
   };
diff --git a/sysdeps/unix/bsd/bsd4.4/wait3.c b/sysdeps/unix/bsd/bsd4.4/wait3.c
index 5caee579b7..b3802aee69 100644
--- a/sysdeps/unix/bsd/bsd4.4/wait3.c
+++ b/sysdeps/unix/bsd/bsd4.4/wait3.c
@@ -27,7 +27,7 @@
    children; otherwise don't.  */
 pid_t
 __wait3 (stat_loc, options, usage)
-     __WAIT_STATUS_DEFN stat_loc;
+     __WAIT_STATUS stat_loc;
      int options;
      struct rusage *usage;
 {
diff --git a/sysdeps/unix/bsd/osf/alpha/bits/stat.h b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
index 752d4eede1..ab0fa48f68 100644
--- a/sysdeps/unix/bsd/osf/alpha/bits/stat.h
+++ b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
@@ -49,7 +49,7 @@ struct stat
     unsigned int st_blksize;	/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
-    int st_blocks;		/* Number of 512-byte blocks allocated.  */
+    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
     unsigned int st_flags;
     unsigned int st_gen;
   };
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
index ff55773e69..f51262d92d 100644
--- a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
@@ -22,6 +22,8 @@
    and `setrlimit' are not system calls, these are the values used by the C
    library to emulate them.  */
 
+#include <bits/types.h>
+
 /* Kinds of resource limit.  */
 enum __rlimit_resource
   {
@@ -52,19 +54,47 @@ enum __rlimit_resource
 #define	RLIMIT_NOFILE	RLIMIT_NOFILE
 #define	RLIMIT_OFILE	RLIMIT_OFILE
 
-    RLIM_NLIMITS,
-
-    RLIM_INFINITY = 0x7fffffff /* Value to indicate that there is no limit.  */
-#define RLIM_INFINITY RLIM_INFINITY
+    RLIM_NLIMITS
   };
 
+/* Value to indicate that there is no limit.  */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY 0x7fffffff
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffL
+#endif
+
+
+/* Type to represent quantities in resource limits.  */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+
 struct rlimit
   {
     /* The current (soft) limit.  */
-    int rlim_cur;
+    rlim_t rlim_cur;
+    /* The hard limit.  */
+    rlim_t rlim_max;
+  };
+
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+
+struct rlimit64
+  {
+    /* The current (soft) limit.  */
+    rlim64_t rlim_cur;
     /* The hard limit.  */
-    int rlim_max;
+    rlim64_t rlim_max;
   };
+#endif
 
 /* Whose usage statistics do you want?  */
 enum __rusage_who
diff --git a/sysdeps/unix/sysv/i386/i686/time.S b/sysdeps/unix/sysv/i386/i686/time.S
new file mode 100644
index 0000000000..c5d27635c9
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/i686/time.S
@@ -0,0 +1,27 @@
+/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+#include <asm-syntax.h>
+
+SYSCALL (time, 1)
+	movl 4(%esp), %edx	/* Put passed pointer in %edx.  */
+	testl %edx, %edx	/* Is it non-nil?  */
+	cmovnel %eax, (%edx)	/* Yes; store the time there.  */
+	ret
+PSEUDO_END (time)
diff --git a/sysdeps/unix/sysv/i386/time.S b/sysdeps/unix/sysv/i386/time.S
index 3a7069c848..158ae6c31e 100644
--- a/sysdeps/unix/sysv/i386/time.S
+++ b/sysdeps/unix/sysv/i386/time.S
@@ -17,11 +17,13 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
+#include <asm-syntax.h>
 
 SYSCALL (time, 1)
 	movl 4(%esp), %edx	/* Put passed pointer in %edx.  */
 	testl %edx, %edx	/* Is it non-nil?  */
-	je null
+	je L(null)
 	movl %eax, (%edx)	/* Yes; store the time there.  */
-null:	ret
+L(null):
+	ret
 PSEUDO_END (time)
diff --git a/sysdeps/unix/sysv/linux/_G_config.h b/sysdeps/unix/sysv/linux/_G_config.h
index 8dc9221519..ccb84ad8f7 100644
--- a/sysdeps/unix/sysv/linux/_G_config.h
+++ b/sysdeps/unix/sysv/linux/_G_config.h
@@ -15,16 +15,19 @@
    hold any value corresponding to members of the extended character
    set, as well as at least one value that does not correspond to any
    member of the extended character set.  */
-#define _WINT_T
+# define _WINT_T
 typedef unsigned int wint_t;
 #endif
 #define _G_size_t	size_t
 #define _G_fpos_t	__off_t
+#define _G_fpos64_t	__off64_t
 #define _G_ssize_t	__ssize_t
 #define _G_off_t	__off_t
+#define _G_off64_t	__off64_t
 #define	_G_pid_t	__pid_t
 #define	_G_uid_t	__uid_t
 #define _G_wint_t	wint_t
+#define _G_stat64	stat
 
 typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
 typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
@@ -45,6 +48,10 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 #define _G_HAVE_MMAP 1
 #define _G_HAVE_LONG_DOUBLE_IO 1
 
+#define _G_OPEN64	open64
+#define _G_LSEEK64	lseek64
+#define _G_FSTAT64	fstat64
+
 /* This is defined by <bits/stat.h> if `st_blksize' exists.  */
 #define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
 
@@ -53,15 +60,15 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 /* These are the vtbl details for ELF.  */
 #define _G_NAMES_HAVE_UNDERSCORE 0
 #define _G_VTABLE_LABEL_HAS_LENGTH 1
-#define _G_USING_THUNKS
+#define _G_USING_THUNKS	1
 #define _G_VTABLE_LABEL_PREFIX "__vt_"
 #define _G_VTABLE_LABEL_PREFIX_ID __vt_
 
 
 #if defined (__cplusplus) || defined (__STDC__)
-#define _G_ARGS(ARGLIST) ARGLIST
+# define _G_ARGS(ARGLIST) ARGLIST
 #else
-#define _G_ARGS(ARGLIST) ()
+# define _G_ARGS(ARGLIST) ()
 #endif
 
 #endif	/* _G_config.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/dirent.h b/sysdeps/unix/sysv/linux/alpha/bits/dirent.h
new file mode 100644
index 0000000000..4d717e4194
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/dirent.h
@@ -0,0 +1,50 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _BITS_DIRENT_H
+#define _BITS_DIRENT_H	1
+
+/* We don't have to make a difference for __USE_FILE_OFFSET64.  */
+struct dirent
+  {
+    long int d_ino;
+    __off_t d_off;
+    unsigned short int d_reclen;
+    unsigned char d_type;
+    char d_name[256];		/* We must not include limits.h! */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct dirent64
+  {
+    __ino64_t d_ino;
+    __off64_t d_off;
+    unsigned short int d_reclen;
+    unsigned char d_type;
+    char d_name[256];		/* We must not include limits.h! */
+  };
+#endif
+
+#define d_fileno	d_ino	/* Backwards compatibility.  */
+
+#undef  _DIRENT_HAVE_D_NAMLEN
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
+
+#endif /* bits/dirent.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index b70502f21a..14840649ea 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 
@@ -27,8 +27,8 @@
 
 /* In GNU, read and write are bits (unlike BSD).  */
 #ifdef __USE_GNU
-#define	O_READ		O_RDONLY /* Open for reading.  */
-#define O_WRITE		O_WRONLY /* Open for writing.  */
+# define O_READ		O_RDONLY /* Open for reading.  */
+# define O_WRITE	O_WRONLY /* Open for writing.  */
 #endif
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -48,25 +48,36 @@
 #define O_FSYNC		O_SYNC
 #define O_ASYNC		020000	/* fcntl, for BSD compatibility */
 
-#define F_DUPFD		0	/* dup */
-#define F_GETFD		1	/* get f_flags */
-#define F_SETFD		2	/* set f_flags */
-#define F_GETFL		3	/* more flags (cloexec) */
-#define F_SETFL		4
-#define F_GETLK		7
-#define F_SETLK		8
-#define F_SETLKW	9
-
-#define F_SETOWN	5	/*  for sockets. */
-#define F_GETOWN	6	/*  for sockets. */
+/* XXX missing */
+#define O_LARGEFILE	0
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#define F_GETLK		7	/* Get record locking info.  */
+#define F_SETLK		8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	9	/* Set record locking info (blocking).  */
+
+/* XXX missing */
+#define F_GETLK64	7	/* Get record locking info.  */
+#define F_SETLK64	8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	9	/* Set record locking info (blocking).  */
+
+#ifdef __USE_BSD
+# define F_SETOWN	5	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	6	/* Set owner of socket (receiver of SIGIO).  */
+#endif
 
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
-/* for posix fcntl() and lockf() */
-#define F_RDLCK		1
-#define F_WRLCK		2
-#define F_UNLCK		8
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf() */
+#define F_RDLCK		1	/* Read lock.  */
+#define F_WRLCK		2	/* Write lock.  */
+#define F_UNLCK		8	/* Remove lock.  */
 
 /* for old implementation of bsd flock () */
 #define F_EXLCK		16	/* or 3 */
@@ -79,22 +90,34 @@
 				   blocking */
 #define LOCK_UN		8	/* remove lock */
 
+/* We don't need to support __USE_FILE_OFFSET64.  */
 struct flock
   {
-    short int l_type;
-    short int l_whence;
-    __off_t l_start;
-    __off_t l_len;
-    __pid_t l_pid;
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
   };
+#endif
 
 
 /* Define some more compatibility macros to be backward compatible with
    BSD systems which did not managed to hide these kernel macros.  */
 #ifdef	__USE_BSD
-#define	FAPPEND		O_APPEND
-#define	FFSYNC		O_FSYNC
-#define	FASYNC		O_ASYNC
-#define	FNONBLOCK	O_NONBLOCK
-#define	FNDELAY		O_NDELAY
+# define FAPPEND		O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY		O_NDELAY
 #endif /* Use BSD.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
index 768b8192ff..cc2a2eac90 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
@@ -46,7 +46,7 @@ struct stat
     __time_t st_ctime;		/* Time of last status change.  */
     unsigned int st_blksize;	/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
-    int st_blocks;		/* Nr. of 512-byte blocks allocated.  */
+    __blkcnt_t st_blocks;	/* Nr. of 512-byte blocks allocated.  */
     unsigned int st_flags;
     unsigned int st_gen;
   };
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h
index 9a4666a508..cf2668a0e6 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/types.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h
@@ -27,9 +27,9 @@
 
 /* Convenience types.  */
 typedef unsigned char __u_char;
-typedef unsigned short __u_short;
+typedef unsigned short int __u_short;
 typedef unsigned int __u_int;
-typedef unsigned long __u_long;
+typedef unsigned long int __u_long;
 typedef unsigned long int __u_quad_t;
 typedef long int __quad_t;
 typedef signed char __int8_t;
@@ -52,6 +52,8 @@ typedef long int __off_t;		/* Type of file sizes and offsets.  */
 typedef __quad_t __loff_t;		/* Type of file sizes and offsets.  */
 typedef int __pid_t;			/* Type of process identifications.  */
 typedef long int __ssize_t;		/* Type of a byte count, or error.  */
+typedef long int __rlim_t;		/* Type of resource counts.  */
+typedef long int __rlim64_t;		/* Type of resource counts (LFS).  */
 
 typedef struct
   {
@@ -92,4 +94,19 @@ typedef struct
 
 typedef int __key_t;
 
+
+/* Types from the Large File Support interface.  */
+
+/* Type to count number os disk blocks.  */
+typedef int __blkcnt_t;
+typedef __quad_t __blkcnt64_t;
+
+/* Type to count file system blocks.  */
+typedef unsigned int __fsblkcnt_t;
+typedef __u_quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes.  */
+typedef unsigned long int __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
 #endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/bits/dirent.h b/sysdeps/unix/sysv/linux/bits/dirent.h
index ccf5080151..1f8ff1e3d0 100644
--- a/sysdeps/unix/sysv/linux/bits/dirent.h
+++ b/sysdeps/unix/sysv/linux/bits/dirent.h
@@ -16,17 +16,34 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _DIRENTRY_H
-#define _DIRENTRY_H	1
+#ifndef _BITS_DIRENT_H
+#define _BITS_DIRENT_H	1
 
 struct dirent
   {
-    long int d_ino;
+#ifndef __USE_FILE_OFFSET64
+    __ino_t d_ino;
     __off_t d_off;
+#else
+    __ino64_t d_ino;
+    __off64_t d_off;
+#endif
     unsigned short int d_reclen;
     unsigned char d_type;
     char d_name[256];		/* We must not include limits.h! */
   };
+
+#ifdef __USE_LARGEFILE64
+struct dirent64
+  {
+    __ino64_t d_ino;
+    __off64_t d_off;
+    unsigned short int d_reclen;
+    unsigned char d_type;
+    char d_name[256];		/* We must not include limits.h! */
+  };
+#endif
+
 #define d_fileno	d_ino	/* Backwards compatibility.  */
 
 #undef  _DIRENT_HAVE_D_NAMLEN
@@ -34,4 +51,4 @@ struct dirent
 #define _DIRENT_HAVE_D_OFF
 #define _DIRENT_HAVE_D_TYPE
 
-#endif /* _DIRENTRY_H */
+#endif /* bits/dirent.h */
diff --git a/sysdeps/unix/sysv/linux/bits/fcntl.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
index 62c3052d8c..302fa00498 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 
@@ -27,8 +27,8 @@
 
 /* In GNU, read and write are bits (unlike BSD).  */
 #ifdef __USE_GNU
-#define	O_READ		O_RDONLY /* Open for reading.  */
-#define O_WRITE		O_WRONLY /* Open for writing.  */
+# define O_READ		O_RDONLY /* Open for reading.  */
+# define O_WRITE	O_WRONLY /* Open for writing.  */
 #endif
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -47,25 +47,36 @@
 #define O_FSYNC		O_SYNC
 #define O_ASYNC		020000
 
-#define F_DUPFD		0	/* dup */
-#define F_GETFD		1	/* get f_flags */
-#define F_SETFD		2	/* set f_flags */
-#define F_GETFL		3	/* more flags (cloexec) */
-#define F_SETFL		4
-#define F_GETLK		5
-#define F_SETLK		6
-#define F_SETLKW	7
-
-#define F_SETOWN	8	/*  for sockets. */
-#define F_GETOWN	9	/*  for sockets. */
+/* XXX missing */
+#define O_LARGEFILE	0
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#define F_GETLK		5	/* Get record locking info.  */
+#define F_SETLK		6	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	7	/* Set record locking info (blocking).  */
+
+/* XXX missing */
+#define F_GETLK64	5	/* Get record locking info.  */
+#define F_SETLK64	6	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	7	/* Set record locking info (blocking).  */
+
+#ifdef __USE_BSD
+# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
+#endif
 
-/* for F_[GET|SET]FL */
+/* For F_[GET|SET]FL.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
-/* for posix fcntl() and lockf() */
-#define F_RDLCK		0
-#define F_WRLCK		1
-#define F_UNLCK		2
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		0	/* Read lock.  */
+#define F_WRLCK		1	/* Write lock.  */
+#define F_UNLCK		2	/* Remove lock.  */
 
 /* for old implementation of bsd flock () */
 #define F_EXLCK		4	/* or 3 */
@@ -80,20 +91,35 @@
 
 struct flock
   {
-    short int l_type;
-    short int l_whence;
-    __off_t l_start;
-    __off_t l_len;
-    __pid_t l_pid;
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    __pid_t l_pid;	/* Process holding the lock.  */
   };
 
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+#endif
 
 /* Define some more compatibility macros to be backward compatible with
    BSD systems which did not managed to hide these kernel macros.  */
 #ifdef	__USE_BSD
-#define	FAPPEND		O_APPEND
-#define	FFSYNC		O_FSYNC
-#define	FASYNC		O_ASYNC
-#define	FNONBLOCK	O_NONBLOCK
-#define	FNDELAY		O_NDELAY
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 #endif /* Use BSD.  */
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 05cae83244..9ee6ea5b27 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux version.
-   Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <asm/resource.h>
+#include <bits/types.h>
 
 /* Transmute defines to enumerations.  The macro re-definitions are
    necessary because some programs want to test for operating system
@@ -103,13 +104,33 @@ enum __rlimit_resource
 #define RLIM_INFINITY RLIM_INFINITY
 };
 
+/* Type for resource quantity measurement.  */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+#endif
+
 struct rlimit
-{
-  /* The current (soft) limit.  */
-  long int rlim_cur;
-  /* The hard limit.  */
-  long int rlim_max;
-};
+  {
+    /* The current (soft) limit.  */
+    rlim_t rlim_cur;
+    /* The hard limit.  */
+    rlim_t rlim_max;
+  };
+
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+  {
+    /* The current (soft) limit.  */
+    rlim64_t rlim_cur;
+    /* The hard limit.  */
+    rlim64_t rlim_max;
+ };
+#endif
 
 /* Whose usage statistics do you want?  */
 enum __rusage_who
@@ -131,46 +152,46 @@ enum __rusage_who
 
 /* 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;
-};
+  {
+    /* 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.  */
diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h
index 1c6e5f84ca..aab025890c 100644
--- a/sysdeps/unix/sysv/linux/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/bits/stat.h
@@ -39,18 +39,29 @@ struct stat
   {
     __dev_t st_dev;			/* Device.  */
     unsigned short int __pad1;
+#ifndef __USE_FILE_OFFSET64
     __ino_t st_ino;			/* File serial number.	*/
+#else
+    __ino64_t st_ino;			/* File serial number.	*/
+#endif
     __mode_t st_mode;			/* File mode.  */
     __nlink_t st_nlink;			/* Link count.  */
     __uid_t st_uid;			/* User ID of the file's owner.	*/
     __gid_t st_gid;			/* Group ID of the file's group.*/
     __dev_t st_rdev;			/* Device number, if device.  */
     unsigned short int __pad2;
+#ifndef __USE_FILE_OFFSET64
     __off_t st_size;			/* Size of file, in bytes.  */
+#else
+    __off64_t st_size;			/* Size of file, in bytes.  */
+#endif
     unsigned long int st_blksize;	/* Optimal block size for I/O.  */
-#define	_STATBUF_ST_BLKSIZE		/* Tell code we have this member.  */
 
-    unsigned long int st_blocks;	/* Number of 512-byte blocks allocated.  */
+#ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+#else
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+#endif
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int __unused1;
     __time_t st_mtime;			/* Time of last modification.  */
@@ -61,6 +72,36 @@ struct stat
     unsigned long int __unused5;
   };
 
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+    __dev_t st_dev;			/* Device.  */
+    unsigned short int __pad1;
+
+    __ino64_t st_ino;			/* File serial number.	*/
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned short int __pad2;
+    __off64_t st_size;			/* Size of file, in bytes.  */
+    unsigned long int st_blksize;	/* Optimal block size for I/O.  */
+
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int __unused1;
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int __unused2;
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int __unused3;
+    unsigned long int __unused4;
+    unsigned long int __unused5;
+  };
+#endif
+
+#define	_STATBUF_ST_BLKSIZE		/* Tell code we have this member.  */
+
 /* Encoding of the file mode.  */
 
 #define	__S_IFMT	0170000	/* These bits determine file type.  */
diff --git a/sysdeps/unix/sysv/linux/bits/statfs.h b/sysdeps/unix/sysv/linux/bits/statfs.h
index 8b9501423c..c79c80e84c 100644
--- a/sysdeps/unix/sysv/linux/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/bits/statfs.h
@@ -23,20 +23,44 @@
 #ifndef _BITS_STATFS_H
 #define _BITS_STATFS_H
 
-#include <bits/types.h>  /* for __fsid_t */
+#include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/
 
 struct statfs
   {
     int f_type;
     int f_bsize;
-    int f_blocks;
-    int f_bfree;
-    int f_bavail;
-    int f_files;
-    int f_ffree;
+#ifndef __USE_FILE_OFFSET64
+    __fsblkcnt_t f_blocks;
+    __fsblkcnt_t f_bfree;
+    __fsblkcnt_t f_bavail;
+    __fsblkcnt_t f_files;
+    __fsblkcnt_t f_ffree;
+#else
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+#endif
     __fsid_t f_fsid;
     int f_namelen;
     int f_spare[6];
   };
 
+#ifdef __USE_LARGEFILE64
+struct statfs64
+  {
+    int f_type;
+    int f_bsize;
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+    __fsid_t f_fsid;
+    int f_namelen;
+    int f_spare[6];
+  };
+#endif
+
 #endif	/* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index 34f4682b3c..daa94336de 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -65,6 +65,8 @@ typedef long int __off_t;		/* Type of file sizes and offsets.  */
 typedef __quad_t __loff_t;		/* Type of file sizes and offsets.  */
 typedef int __pid_t;			/* Type of process identifications.  */
 typedef int __ssize_t;			/* Type of a byte count, or error.  */
+typedef long int __rlim_t;		/* Type of resource counts.  */
+typedef __quad_t __rlim64_t;		/* Type of resource counts (LFS).  */
 
 typedef struct
   {
@@ -100,4 +102,25 @@ typedef struct
 
 typedef int __key_t;
 
+
+/* Types from the Large File Support interface.  */
+
+/* Type to count number os disk blocks.  */
+typedef __u_long __blkcnt_t;
+typedef __u_quad_t __blkcnt64_t;
+
+/* Type to count file system blocks.  */
+typedef long int __fsblkcnt_t;
+typedef __quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes.  */
+typedef __u_long __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
+/* Type of file serial numbers.  */
+typedef __u_long __ino64_t;
+
+/* Type of file sizes and offsets.  */
+typedef __loff_t __off64_t;
+
 #endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 2b855c7a84..dd1c77a99e 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -1,5 +1,5 @@
-/* getsysstats - Determine various system internal values, Linux version.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+/* Determine various system internal values, Linux version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -30,6 +30,7 @@
 
 /* Determine the path to the /proc filesystem if available.  */
 static char *
+internal_function
 get_proc_path (char *buffer, size_t bufsize)
 {
   FILE *fp;
@@ -115,6 +116,7 @@ weak_alias (__get_nprocs, get_nprocs_conf)
 /* General function to get information about memory status from proc
    filesystem.  */
 static int
+internal_function
 phys_pages_info (const char *format)
 {
   FILE *fp;
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 36863db486..2e0bc5bf8f 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -28,6 +28,7 @@
 /* Try to get a socket to talk to the kernel.  */
 #if defined SIOGIFINDEX || defined SIOGIFNAME
 static int
+internal_function
 opensock (void)
 {
   /* Cache the last AF that worked, to avoid many redundant calls to
diff --git a/sysdeps/unix/sysv/linux/llseek.c b/sysdeps/unix/sysv/linux/llseek.c
index a1284db6be..31dd86f232 100644
--- a/sysdeps/unix/sysv/linux/llseek.c
+++ b/sysdeps/unix/sysv/linux/llseek.c
@@ -1,5 +1,5 @@
 /* Long-long seek operation.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,7 +25,7 @@ extern int __sys_llseek (int fd, off_t offset_hi, off_t offset_lo,
 
 /* Seek to OFFSET on FD, starting from WHENCE.  */
 loff_t
-llseek (int fd, loff_t offset, int whence)
+__llseek (int fd, loff_t offset, int whence)
 {
   loff_t result;
 
@@ -33,3 +33,5 @@ llseek (int fd, loff_t offset, int whence)
 				 (off_t) (offset & 0xffffffff),
 				 &result, whence) ?: result);
 }
+weak_alias (__llseek, llseek)
+weak_alias (__llseek, lseek64)
diff --git a/sysdeps/unix/sysv/linux/lseek64.c b/sysdeps/unix/sysv/linux/lseek64.c
new file mode 100644
index 0000000000..d81e98fb51
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/lseek64.c
@@ -0,0 +1 @@
+/* We don't need a definition since the llseek function is what we need.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
index 2586140fdc..09d6fb6d4c 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 #include <sys/types.h>
@@ -26,8 +26,8 @@
 
 /* In GNU, read and write are bits (unlike BSD).  */
 #ifdef __USE_GNU
-#define O_READ		O_RDONLY	/* Open for reading.  */
-#define O_WRITE		O_WRONLY	/* Open for writing.  */
+# define O_READ		O_RDONLY	/* Open for reading.  */
+# define O_WRITE	O_WRONLY	/* Open for writing.  */
 #endif
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -47,25 +47,36 @@
 
 #define O_NDELAY	O_NONBLOCK
 
-#define F_DUPFD		0	/* dup */
-#define F_GETFD		1	/* get f_flags */
-#define F_SETFD		2	/* set f_flags */
-#define F_GETFL		3	/* more flags (cloexec) */
-#define F_SETFL		4
-#define F_GETLK		14
-#define F_SETLK		6
-#define F_SETLKW	7
-
-#define F_SETOWN	24	/*  for sockets. */
-#define F_GETOWN	23	/*  for sockets. */
+/* XXX missing */
+#define O_LARGEFILE	0
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#define F_GETLK		14	/* Get record locking info.  */
+#define F_SETLK		6	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	7	/* Set record locking info (blocking).  */
+
+/* XXX missing */
+#define F_GETLK64	14	/* Get record locking info.  */
+#define F_SETLK64	6	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	7	/* Set record locking info (blocking).  */
+
+#ifdef __USE_BSD
+# define F_SETOWN	5	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	6	/* Set owner of socket (receiver of SIGIO).  */
+#endif
 
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
-/* for posix fcntl() and lockf() */
-#define F_RDLCK		0
-#define F_WRLCK		1
-#define F_UNLCK		2
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		0	/* Read lock.  */
+#define F_WRLCK		1	/* Write lock.  */
+#define F_UNLCK		2	/* Remove lock.  */
 
 /* for old implementation of bsd flock () */
 #define F_EXLCK		4	/* or 3 */
@@ -78,23 +89,42 @@
 				   blocking */
 #define LOCK_UN		8	/* remove lock */
 
-typedef struct flock {
-	short l_type;
-	short l_whence;
-	__off_t l_start;
-	__off_t l_len;
-	long  l_sysid;			/* XXX */
-	__pid_t l_pid;
-	long  pad[4];			/* XXX */
-} flock_t;
+typedef struct flock
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    long int l_sysid;	/* XXX */
+    __pid_t l_pid;	/* Process holding the lock.  */
+    long int pad[4];	/* XXX */
+  } flock_t;
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    long int l_sysid;	/* XXX */
+    __pid_t l_pid;	/* Process holding the lock.  */
+    long int pad[4];	/* XXX */
+  };
+#endif
 
 
 /* Define some more compatibility macros to be backward compatible with
    BSD systems which did not managed to hide these kernel macros.  */
 #ifdef	__USE_BSD
-#define	FAPPEND		O_APPEND
-#define	FFSYNC		O_FSYNC
-#define FASYNC		O_ASYNC
-#define	FNONBLOCK	O_NONBLOCK
-#define	FNDELAY		O_NDELAY
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 #endif /* Use BSD.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
index a797b34c38..f27a75eb9a 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -39,14 +39,22 @@ struct stat
   {
     unsigned long int st_dev;
     long int st_pad1[3];
+#ifndef __USE_FILE_OFFSET64
     __ino_t st_ino;		/* File serial number.		*/
+#else
+    __ino64_t st_ino;		/* File serial number.		*/
+#endif
     __mode_t st_mode;		/* File mode.  */
     __nlink_t st_nlink;		/* Link count.  */
     __uid_t st_uid;		/* User ID of the file's owner.	*/
     __gid_t st_gid;		/* Group ID of the file's group.*/
     unsigned long int st_rdev;	/* Device number, if device.  */
     long int st_pad2[2];
+#ifndef __USE_FILE_OFFSET64
     __off_t st_size;		/* Size of file, in bytes.  */
+#else
+    __off64_t st_size;		/* Size of file, in bytes.  */
+#endif
     /* SVR4 added this extra long to allow for expansion of off_t.  */
     long int st_pad3;
     /*
@@ -60,8 +68,11 @@ struct stat
     __time_t st_ctime;		/* Time of last status change.  */
     long int __reserved2;
     long int st_blksize;	/* Optimal block size for I/O.  */
-#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
-    long int st_blocks;		/* Number of 512-byte blocks allocated.  */
+#ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
+#else
+    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
+#endif
     char st_fstype[16];		/* Filesystem type name */
     long int st_pad4[8];
     /* Linux specific fields */
@@ -69,6 +80,42 @@ struct stat
     unsigned int st_gen;
   };
 
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+    unsigned long int st_dev;
+    long int st_pad1[3];
+    __ino64_t st_ino;		/* File serial number.		*/
+    __mode_t st_mode;		/* File mode.  */
+    __nlink_t st_nlink;		/* Link count.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    unsigned long int st_rdev;	/* Device number, if device.  */
+    long int st_pad2[2];
+    __off64_t st_size;		/* Size of file, in bytes.  */
+    /* SVR4 added this extra long to allow for expansion of off_t.  */
+    long int st_pad3;
+    /*
+     * Actually this should be timestruc_t st_atime, st_mtime and
+     * st_ctime but we don't have it under Linux.
+     */
+    __time_t st_atime;		/* Time of last access.  */
+    long int __reserved0;
+    __time_t st_mtime;		/* Time of last modification.  */
+    long int __reserved1;
+    __time_t st_ctime;		/* Time of last status change.  */
+    long int __reserved2;
+    long int st_blksize;	/* Optimal block size for I/O.  */
+    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
+    char st_fstype[16];		/* Filesystem type name */
+    long int st_pad4[8];
+    /* Linux specific fields */
+    unsigned int st_flags;
+    unsigned int st_gen;
+  };
+#endif
+
+#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
 /* Encoding of the file mode.  */
 
diff --git a/sysdeps/unix/sysv/linux/mips/bits/statfs.h b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
index 3b2306147c..2727b27257 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
@@ -23,22 +23,52 @@
 #ifndef _BITS_STATFS_H
 #define _BITS_STATFS_H
 
+#include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/
+
 struct statfs
   {
     long int f_type;
 #define f_fstyp f_type
     long int f_bsize;
     long int f_frsize;	/* Fragment size - unsupported */
-    long int f_blocks;
-    long int f_bfree;
-    long int f_files;
-    long int f_ffree;
+#ifndef __USE_FILE_OFFSET64
+    __fsblkcnt_t f_blocks;
+    __fsblkcnt_t f_bfree;
+    __fsblkcnt_t f_files;
+    __fsblkcnt_t f_ffree;
+    __fsblkcnt_t f_bavail;
+#else
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+    __fsblkcnt64_t f_bavail;
+#endif
+
+	/* Linux specials */
+    __fsid_t f_fsid;
+    long int f_namelen;
+    long int f_spare[6];
+  };
+
+#ifdef __USE_LARGEFILE64
+struct statfs64
+  {
+    long int f_type;
+#define f_fstyp f_type
+    long int f_bsize;
+    long int f_frsize;	/* Fragment size - unsupported */
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+    __fsblkcnt64_t f_bavail;
 
 	/* Linux specials */
-    long int f_bavail;
     __fsid_t f_fsid;
     long int f_namelen;
     long int f_spare[6];
   };
+#endif
 
 #endif	/* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index b92139aab4..f6e71b79b6 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -25,7 +25,7 @@ extern int __syscall_poll __P ((struct pollfd *fds, unsigned int nfds,
 weak_extern (__syscall_poll)
 
 static int __emulate_poll __P ((struct pollfd *fds, unsigned long int nfds,
-				int timeout));
+				int timeout)) internal_function;
 
 /* The real implementation.  */
 int
@@ -58,5 +58,6 @@ poll (fds, nfds, timeout)
 
 
 /* Get the emulation code.  */
-#define poll(fds, nfds, timeout) static __emulate_poll (fds, nfds, timeout)
+#define poll(fds, nfds, timeout) \
+  static internal_function __emulate_poll (fds, nfds, timeout)
 #include <sysdeps/unix/bsd/poll.c>
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index 2c215ce920..10cd519609 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -24,7 +24,7 @@
 
 extern ssize_t __syscall_readv __P ((int, __const struct iovec *, int));
 static ssize_t __atomic_readv_replacement __P ((int, __const struct iovec *,
-						int));
+						int)) internal_function;
 
 
 /* Not all versions of the kernel support the large number of records.  */
@@ -56,5 +56,5 @@ __readv (fd, vector, count)
 }
 weak_alias (__readv, readv)
 
-#define __readv static __atomic_readv_replacement
+#define __readv static internal_function __atomic_readv_replacement
 #include <sysdeps/posix/readv.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index ca4d34c14e..9e8c589b9a 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -24,8 +24,8 @@
 
 /* In GNU, read and write are bits (unlike BSD). */
 #ifdef __USE_GNU
-#define O_READ          O_RDONLY /* Open for reading. */
-#define O_WRITE         O_WRONLY /* Open for writing. */
+# define O_READ		O_RDONLY /* Open for reading. */
+# define O_WRITE	O_WRONLY /* Open for writing. */
 #endif
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
@@ -44,24 +44,35 @@
 #define O_NDELAY	(0x0004 | O_NONBLOCK)
 #define O_NOCTTY	0x8000	/* not fcntl */
 
-#define F_DUPFD		0	/* dup */
-#define F_GETFD		1	/* get f_flags */
-#define F_SETFD		2	/* set f_flags */
-#define F_GETFL		3	/* more flags (cloexec) */
-#define F_SETFL		4
-#define F_GETOWN	5	/*  for sockets. */
-#define F_SETOWN	6	/*  for sockets. */
-#define F_GETLK		7
-#define F_SETLK		8
-#define F_SETLKW	9
+/* XXX missing */
+#define O_LARGEFILE	0
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#ifdef __USE_BSD
+# define F_GETOWN	5	/* Get owner of socket (receiver of SIGIO).  */
+# define F_SETOWN	6	/* Set owner of socket (receiver of SIGIO).  */
+#endif
+#define F_GETLK		7	/* Get record locking info.  */
+#define F_SETLK		8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	9	/* Set record locking info (blocking).  */
+
+/* XXX missing */
+#define F_GETLK64	7	/* Get record locking info.  */
+#define F_SETLK64	8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	9	/* Set record locking info (blocking).  */
 
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
-/* for posix fcntl() and lockf() */
-#define F_RDLCK		1
-#define F_WRLCK		2
-#define F_UNLCK		3
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		1	/* Read lock.  */
+#define F_WRLCK		2	/* Write lock.  */
+#define F_UNLCK		3	/* Remove lock.  */
 
 /* for old implementation of bsd flock () */
 #define F_EXLCK		4	/* or 3 */
@@ -76,22 +87,39 @@
 
 struct flock
   {
-    short int l_type;
-    short int l_whence;
-    __off_t l_start;
-    __off_t l_len;
-    __pid_t l_pid;
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    __pid_t l_pid;	/* Process holding the lock.  */
     short int __unused;
   };
 
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+    short int __unused;
+  };
+#endif
+
 /* Define some more compatibility macros to be backward compatible with
    BSD systems which did not managed to hide these kernel macros.  */
 #ifdef	__USE_BSD
-#define	FAPPEND		O_APPEND
-#define	FFSYNC		O_FSYNC
-#define	FASYNC		O_ASYNC
-#define	FNONBLOCK	O_NONBLOCK
-#define	FNDELAY		O_NDELAY
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 #endif /* Use BSD.  */
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
index 46867d8e41..b33493ee46 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
@@ -33,10 +33,10 @@
 #undef  TCSETS
 #undef  TCSETSW
 #undef  TCSETSF
-#define TCGETS	_IOR ('T', 8, struct __kernel_termios)
-#define TCSETS	_IOW ('T', 9, struct __kernel_termios)
-#define TCSETSW	_IOW ('T', 10, struct __kernel_termios)
-#define TCSETSF	_IOW ('T', 11, struct __kernel_termios)
+#define TCGETS	_IOR ('T', 8, char[36])
+#define TCSETS	_IOW ('T', 9, char[36])
+#define TCSETSW	_IOW ('T', 10, char[36])
+#define TCSETSF	_IOW ('T', 11, char[36])
 
 #include <linux/sockios.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index 462f7c2998..a417928863 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -27,9 +27,9 @@
 
 /* Convenience types.  */
 typedef unsigned char __u_char;
-typedef unsigned short __u_short;
+typedef unsigned short int __u_short;
 typedef unsigned int __u_int;
-typedef unsigned long __u_long;
+typedef unsigned long int __u_long;
 typedef unsigned long int __u_quad_t;
 typedef long int __quad_t;
 typedef signed char __int8_t;
@@ -45,13 +45,15 @@ typedef __quad_t *__qaddr_t;
 typedef __u_long __dev_t;		/* Type of device numbers.  */
 typedef __u_int __uid_t;		/* Type of user identifications.  */
 typedef __u_int __gid_t;		/* Type of group identifications.  */
-typedef __u_int __ino_t;		/* Type of file serial numbers.  */
+typedef __u_long __ino_t;		/* Type of file serial numbers.  */
 typedef __u_int __mode_t;		/* Type of file attribute bitmasks.  */
 typedef __u_int __nlink_t; 		/* Type of file link counts.  */
 typedef long int __off_t;		/* Type of file sizes and offsets.  */
 typedef __quad_t __loff_t;		/* Type of file sizes and offsets.  */
 typedef int __pid_t;			/* Type of process identifications.  */
 typedef long long int __ssize_t;	/* Type of a byte count, or error.  */
+typedef long int __rlim_t;		/* Type of resource counts.  */
+typedef long int __rlim64_t;		/* Type of resource counts (LFS).  */
 
 typedef struct
   {
@@ -92,4 +94,19 @@ typedef struct
 
 typedef int __key_t;
 
+
+/* Types from the Large File Support interface.  */
+
+/* Type to count number os disk blocks.  */
+typedef long int __blkcnt_t;
+typedef __quad_t __blkcnt64_t;
+
+/* Type to count file system blocks.  */
+typedef unsigned int __fsblkcnt_t;
+typedef __u_quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes.  */
+typedef unsigned long int __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
 #endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
index fcb752e3ec..dd509a7e8a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
@@ -2,7 +2,7 @@
 struct kernel_stat
   {
     unsigned int st_dev;
-    unsigned int st_ino;
+    unsigned long int st_ino;
     unsigned int st_mode;
     short int st_nlink;
     unsigned int st_uid;
@@ -18,5 +18,5 @@ struct kernel_stat
     unsigned long int __unused2;
   };
 
-#define _HAVE___UNUSED1 
-#define _HAVE___UNUSED2 
+#define _HAVE___UNUSED1
+#define _HAVE___UNUSED2
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
index fcc5cb5a48..65a1d34836 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
@@ -29,21 +29,15 @@
 
 /* int _setjmp(jmp_buf) */
 
-.weak _setjmp
-ENTRY(_setjmp)
-
+ENTRY(__setjmp)
 	ba	__sigsetjmp_local
 	 set	0, %o1
-
-END(setjmp)
+END(__setjmp)
 
 /* int setjmp(jmp_buf) */
 
-.weak setjmp
 ENTRY(setjmp)
-
 	set	1, %o1
-
 END(setjmp)
 
 /* int __sigsetjmp(jmp_buf, savemask)  */
@@ -65,3 +59,6 @@ __sigsetjmp_local:
 	 mov	%g1, %o0
 
 END(__sigsetjmp)
+
+weak_alias(__setjmp, _setjmp)
+weak_extern(setjmp)
diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h
index c8f512c00c..129702e33c 100644
--- a/sysdeps/unix/sysv/linux/sys/mman.h
+++ b/sysdeps/unix/sysv/linux/sys/mman.h
@@ -44,8 +44,18 @@ __BEGIN_DECLS
 
 extern __caddr_t __mmap __P ((__caddr_t __addr, size_t __len, int __prot,
 			      int __flags, int __fd, __off_t __offset));
+#ifndef __USE_FILE_OFFSET64
 extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
 			    int __flags, int __fd, __off_t __offset));
+#else
+extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			    int __flags, int __fd, __off_t __offset))
+     __asm__ ("mmap64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern __caddr_t mmap64 __P ((__caddr_t __addr, size_t __len, int __prot,
+			      int __flags, int __fd, __off64_t __offset));
+#endif
 
 /* Deallocate any mapping for the region starting at ADDR and extending LEN
    bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
diff --git a/sysdeps/unix/sysv/linux/sys/param.h b/sysdeps/unix/sysv/linux/sys/param.h
index d5f6239cd2..c2a56a2c29 100644
--- a/sysdeps/unix/sysv/linux/sys/param.h
+++ b/sysdeps/unix/sysv/linux/sys/param.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,7 +28,7 @@
 
 #define	NBBY		CHAR_BIT
 #ifndef	NGROUPS
-#define	NGROUPS		NGROUPS_MAX
+# define NGROUPS		NGROUPS_MAX
 #endif
 #define	MAXSYMLINKS	5
 #define	CANBSIZ		MAX_CANON
@@ -47,7 +47,7 @@
 
 /* Macros for counting and rounding.  */
 #ifndef howmany
-#define	howmany(x, y)	(((x)+((y)-1))/(y))
+# define howmany(x, y)	(((x)+((y)-1))/(y))
 #endif
 #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))
 #define powerof2(x)	((((x)-1)&(x))==0)
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
index 31e794fb04..3b3c5b65fc 100644
--- a/sysdeps/unix/sysv/linux/writev.c
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -24,7 +24,7 @@
 
 extern ssize_t __syscall_writev __P ((int, const struct iovec *, int));
 static ssize_t __atomic_writev_replacement __P ((int, const struct iovec *,
-						 int));
+						 int)) internal_function;
 
 
 /* Not all versions of the kernel support the large number of records.  */
@@ -56,5 +56,5 @@ __writev (fd, vector, count)
 }
 weak_alias (__writev, writev)
 
-#define __writev static __atomic_writev_replacement
+#define __writev static internal_function __atomic_writev_replacement
 #include <sysdeps/posix/writev.c>
diff --git a/sysdeps/unix/sysv/sysv4/i386/bits/stat.h b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
index 9b6fed083d..f3f4473032 100644
--- a/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
+++ b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
@@ -58,7 +58,7 @@ struct stat
     long st_blksize;		/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
-    long st_blocks;		/* Number of 512-byte blocks allocated.  */
+    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
     char st_fstype[16];		/* The type of this filesystem.  */
     int st_aclcnt;
     unsigned long st_level;
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
index ea5f1f4279..82ab37fd93 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
+++ b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
@@ -52,7 +52,7 @@ struct stat
     __time_t st_ctime;		/* Time of last status change.  */
     unsigned long int st_ctime_usec;
 
-    long st_blksize;		/* Optimal block size for I/O.  */
+    __blkcnt_t st_blksize;	/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
     long st_blocks;		/* Number of 512-byte blocks allocated.  */
diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h
index a5ff12e663..c0582c1876 100644
--- a/sysdeps/wordsize-32/inttypes.h
+++ b/sysdeps/wordsize-32/inttypes.h
@@ -341,4 +341,33 @@ typedef unsigned long long int uint_fast64_t;
 #define SCNoPTR		"o"
 #define SCNxPTR		"x"
 
+
+/* Macros for string conversion.  */
+
+/* Like `strtol' but convert to `intmax_t'.  */
+#define strtoimax(nptr, endptr, base) \
+    __strtoll_internal (nptr, endptr, base, 0)
+
+#ifndef __strtoll_internal_defined
+extern long long int __strtoll_internal __P ((__const char *__restrict __nptr,
+					      char **__restrict __endptr,
+					      int __base, int __group));
+# define __strtoll_internal_defined	1
+#endif
+
+
+/* Like `strtoul' but convert to `uintmax_t'.  */
+#define strtoumax(nptr, endptr, base) \
+    __strtoull_internal (nptr, endptr, base, 0)
+
+#ifndef __strtoull_internal_defined
+extern unsigned long long int __strtoull_internal __P ((__const char *
+							__restrict __nptr,
+							char **
+							__restrict __endptr,
+							int __base,
+							int __group));
+# define __strtoull_internal_defined	1
+#endif
+
 #endif /* inttypes.h */
diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h
index f1dd2ffee0..2a2628428d 100644
--- a/sysdeps/wordsize-64/inttypes.h
+++ b/sysdeps/wordsize-64/inttypes.h
@@ -341,4 +341,31 @@ typedef unsigned long int uint_fast64_t;
 #define SCNoPTR		"lo"
 #define SCNxPTR		"lx"
 
+
+/* Macros for string conversion.  */
+
+/* Like `strtol' but convert to `intmax_t'.  */
+#define strtoimax(nptr, endptr, base) \
+    __strtol_internal (nptr, endptr, base, 0)
+
+#ifndef __strtol_internal_defined
+extern long int __strtol_internal __P ((__const char *__restrict __nptr,
+					char **__restrict __endptr,
+					int __base, int __group));
+# define __strtol_internal_defined	1
+#endif
+
+
+/* Like `strtoul' but convert to `uintmax_t'.  */
+#define strtoumax(nptr, endptr, base) \
+    __strtoul_internal (nptr, endptr, base, 0)
+
+#ifndef __strtoul_internal_defined
+extern unsigned long int __strtoul_internal __P ((__const char *
+						  __restrict __nptr,
+						  char **__restrict __endptr,
+						  int __base, int __group));
+# define __strtoul_internal_defined	1
+#endif
+
 #endif /* inttypes.h */