summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-10-13 01:27:24 +0000
committerUlrich Drepper <drepper@redhat.com>1997-10-13 01:27:24 +0000
commit1ea89a402d892b68b193e2e4390d8eb33ed686e7 (patch)
tree5e14832655316159895c8ee546fd73e4c1a72914
parentdfd2257ad98eb0f6eab167e5fe5ff68ca87172e3 (diff)
downloadglibc-1ea89a402d892b68b193e2e4390d8eb33ed686e7.tar.gz
glibc-1ea89a402d892b68b193e2e4390d8eb33ed686e7.tar.xz
glibc-1ea89a402d892b68b193e2e4390d8eb33ed686e7.zip
1997-10-13 03:14  Ulrich Drepper  <drepper@cygnus.com>

	* libc.map: Move _IO_fopen, fopen, _IO_stdin_, _IO_stdout_,
	_IO_stderr_, _IO_list_all, and freopen to GLIBC_2.1 version.
	* include/libc-symbol.h: Define define_symbol.
	* libio/Makefile [$(versioning)=yes] (routines): Add oldiofopen and
	oldfreopen.
	[$(versioning)=yes] (aux): Add oldfileops and oldstdfiles.
	* libio/fileops.c: Use _IO_FILE_complete when accessing _offset field.
	* libio/freopen.c: Use versioning.
	* libio/iofopen.c: Likewise.  Generate object of type
	_IO_FILE_complete.
	* libio/iofopen64.c: Generate object of type _IO_FILE_complete.
	* libio/iolibio.h: Declare _IO_{old,new}_fopen and __{old,new}_freopen.
	Define _IO_old_freopen.
	* libio/libio.h: Remove _offset field from _IO_FILE.  Rename _unused2
	field to _old_offset.  Declare _IO_std*_ streams as of type
	_IO_FILE_complete.
	* libio/libioP.h: Define _IO_FILE_complete.
	Declare callbacks for old fileops implementation.
	* libio/stdfile.c: Define standard stream of type _IO_FILE_complete.
	* libio/stdio.c: Correctly address FILE part of standard streams.
	* libio/oldfileops.c: New file.
	* libio/oldfreopen.c: New file.
	* libio/oldiofopen.c: New file.
	* libio/oldstdfiles.c: New file.

	* sysdeps/i386/fpu/bits/mathinline.h: Define fma optimization.

	* sysdeps/libm-i387/e_scalb.S: Make sure code gets into .text section.
	* sysdeps/libm-i387/e_scalbl.S: Likewise.
	* sysdeps/libm-i387/s_fma.S: Fix typo.
	* sysdeps/libm-i387/s_fmaf.S: Likewise.
	* sysdeps/libm-i387/s_fmal.S: Likewise.

1997-10-12 20:14  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* sysdeps/stub/getsid.c: Add a stub_warning.
	* sysdeps/stub/mmap.c: Likewise.
	* sysdeps/stub/munmap.c: Likewise.

	* sysdeps/libm-ieee754/s_fma.c: New file.
	* sysdeps/libm-ieee754/s_fmaf.c: New file.
	* sysdeps/libm-ieee754/s_fmal.c: New file.
	* sysdeps/libm-ieee754/s_llrintf.c: New file.
	* sysdeps/libm-ieee754/s_llrintl.c: New file.
	* sysdeps/libm-ieee754/s_lrintf.c: New file.
	* sysdeps/libm-ieee754/s_lrintl.c: New file.
-rw-r--r--ChangeLog55
-rw-r--r--include/libc-symbols.h7
-rw-r--r--libc.map13
-rw-r--r--libio/Makefile8
-rw-r--r--libio/fileops.c40
-rw-r--r--libio/freopen.c4
-rw-r--r--libio/iofopen.c31
-rw-r--r--libio/iofopen64.c18
-rw-r--r--libio/iolibio.h7
-rw-r--r--libio/libio.h8
-rw-r--r--libio/libioP.h31
-rw-r--r--libio/oldfileops.c720
-rw-r--r--libio/oldfreopen.c46
-rw-r--r--libio/oldiofopen.c65
-rw-r--r--libio/oldstdfiles.c55
-rw-r--r--libio/stdfiles.c31
-rw-r--r--libio/stdio.c6
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h34
-rw-r--r--sysdeps/libm-i387/e_scalb.S2
-rw-r--r--sysdeps/libm-i387/e_scalbl.S2
-rw-r--r--sysdeps/libm-i387/s_fma.S2
-rw-r--r--sysdeps/libm-i387/s_fmaf.S2
-rw-r--r--sysdeps/libm-i387/s_fmal.S2
-rw-r--r--sysdeps/stub/getsid.c1
-rw-r--r--sysdeps/stub/mmap.c1
-rw-r--r--sysdeps/stub/munmap.c1
26 files changed, 1101 insertions, 91 deletions
diff --git a/ChangeLog b/ChangeLog
index 40e559d74a..b361b136dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+1997-10-13 03:14  Ulrich Drepper  <drepper@cygnus.com>
+
+	* libc.map: Move _IO_fopen, fopen, _IO_stdin_, _IO_stdout_,
+	_IO_stderr_, _IO_list_all, and freopen to GLIBC_2.1 version.
+	* include/libc-symbol.h: Define define_symbol.
+	* libio/Makefile [$(versioning)=yes] (routines): Add oldiofopen and
+	oldfreopen.
+	[$(versioning)=yes] (aux): Add oldfileops and oldstdfiles.
+	* libio/fileops.c: Use _IO_FILE_complete when accessing _offset field.
+	* libio/freopen.c: Use versioning.
+	* libio/iofopen.c: Likewise.  Generate object of type
+	_IO_FILE_complete.
+	* libio/iofopen64.c: Generate object of type _IO_FILE_complete.
+	* libio/iolibio.h: Declare _IO_{old,new}_fopen and __{old,new}_freopen.
+	Define _IO_old_freopen.
+	* libio/libio.h: Remove _offset field from _IO_FILE.  Rename _unused2
+	field to _old_offset.  Declare _IO_std*_ streams as of type
+	_IO_FILE_complete.
+	* libio/libioP.h: Define _IO_FILE_complete.
+	Declare callbacks for old fileops implementation.
+	* libio/stdfile.c: Define standard stream of type _IO_FILE_complete.
+	* libio/stdio.c: Correctly address FILE part of standard streams.
+	* libio/oldfileops.c: New file.
+	* libio/oldfreopen.c: New file.
+	* libio/oldiofopen.c: New file.
+	* libio/oldstdfiles.c: New file.
+
+	* sysdeps/i386/fpu/bits/mathinline.h: Define fma optimization.
+
+	* sysdeps/libm-i387/e_scalb.S: Make sure code gets into .text section.
+	* sysdeps/libm-i387/e_scalbl.S: Likewise.
+	* sysdeps/libm-i387/s_fma.S: Fix typo.
+	* sysdeps/libm-i387/s_fmaf.S: Likewise.
+	* sysdeps/libm-i387/s_fmal.S: Likewise.
+
+1997-10-12 20:14  Zack Weinberg  <zack@rabi.phys.columbia.edu>
+
+	* sysdeps/stub/getsid.c: Add a stub_warning.
+	* sysdeps/stub/mmap.c: Likewise.
+	* sysdeps/stub/munmap.c: Likewise.
+
 1997-10-12 05:09  Ulrich Drepper  <drepper@cygnus.com>
 
 	* libio/Makefile (routines): Remove iofprintf.
@@ -36,9 +77,9 @@
 	* math/bits/mathcalls.h: Add nextafterx, scalbln, fma, lrint, llrint,
 	lround, and llround.
 	Change second argument of scalbn to `int'.
-	* sysdeps/libm-ieee754/s_fma.S: New file.
-	* sysdeps/libm-ieee754/s_fmaf.S: New file.
-	* sysdeps/libm-ieee754/s_fmal.S: New file.
+	* sysdeps/libm-ieee754/s_fma.c: New file.
+	* sysdeps/libm-ieee754/s_fmaf.c: New file.
+	* sysdeps/libm-ieee754/s_fmal.c: New file.
 	* sysdeps/libm-i387/s_fma.S: New file.
 	* sysdeps/libm-i387/s_fmaf.S: New file.
 	* sysdeps/libm-i387/s_fmal.S: New file.
@@ -51,10 +92,10 @@
 	* sysdeps/libm-ieee754/s_llrint.c: Remove version which works on
 	80bit double.
 	* sysdeps/libm-ieee754/s_lrint.c: Likewise.
-	* sysdeps/libm-ieee754/s_llrintf.S: New file.
-	* sysdeps/libm-ieee754/s_llrintl.S: New file.
-	* sysdeps/libm-ieee754/s_lrintf.S: New file.
-	* sysdeps/libm-ieee754/s_lrintl.S: New file.
+	* sysdeps/libm-ieee754/s_llrintf.c: New file.
+	* sysdeps/libm-ieee754/s_llrintl.c: New file.
+	* sysdeps/libm-ieee754/s_lrintf.c: New file.
+	* sysdeps/libm-ieee754/s_lrintl.c: New file.
 	* sysdeps/libm-i387/s_scalbln.c: New file.  Empty file.
 	* sysdeps/libm-i387/s_scalblnf.c: New file.  Empty file.
 	* sysdeps/libm-i387/s_scalblnl.c: New file.  Empty file.
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 66d7eed0d0..b7433eef42 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -325,4 +325,11 @@ extern const char _libc_intl_domainname[];
 # endif	/* ELF.  */
 #endif	/* Have GNU ld.  */
 
+#if DO_VERSIONING
+# define symbol_version(real, name, version) \
+     __asm__ (".symver " #real "," #name "@" #version)
+#else
+# define symbol_version(real, name, version)
+#endif
+
 #endif /* libc-symbols.h */
diff --git a/libc.map b/libc.map
index 20469efbe9..01c45a06f8 100644
--- a/libc.map
+++ b/libc.map
@@ -3,7 +3,6 @@ GLIBC_2.0 {
     # global variables
     _errno; _itoa_lower_digits; _itoa_upper_digits;
     __ctype_b; __ctype_tolower; __ctype_toupper;
-    _IO_stderr_; _IO_stdin_; _IO_stdout_;
     _nl_msg_cat_cntr; __environ; _environ; _res;
     ___brk_addr; __curbrk; _nl_current_LC_CTYPE; _libc_intl_domainname;
     _sys_errlist; _sys_siglist; __progname; _nl_default_dirname;
@@ -86,7 +85,7 @@ GLIBC_2.0 {
     _IO_remove_marker; _IO_marker_difference; _IO_marker_delta;
     _IO_seekmark; _IO_unsave_markers; _IO_str_overflow;
     _IO_str_underflow; _IO_str_init_static; _IO_str_init_readonly;
-    _IO_str_seekoff; _IO_str_pbackfail; _IO_list_all; _IO_file_jumps;
+    _IO_str_seekoff; _IO_str_pbackfail; _IO_file_jumps;
     _IO_peekc_locked;
     __vsscanf; __vfscanf; __vsnprintf;
     _rpc_dtablesize; _null_auth; _seterr_reply;
@@ -178,9 +177,9 @@ GLIBC_2.0 {
     ferror_unlocked; fexecve; fflush; fflush_unlocked; ffs; fgetc;
     fgetgrent; fgetgrent_r; fgetpos; fgetpos64; fgetpwent; fgetpwent_r; fgets;
     fgetspent; fgetspent_r; fileno; fileno_unlocked; finite; finitef;
-    finitel; flock; flockfile; fmtmsg; fnmatch; fopen; fopen64; fopencookie;
+    finitel; flock; flockfile; fmtmsg; fnmatch; fopen64; fopencookie;
     fork; fpathconf; fprintf; fputc; fputc_unlocked; fputs; fread; free;
-    freeaddrinfo; freopen; freopen64; frexp; frexpf; frexpl; fscanf; fseek;
+    freeaddrinfo; freopen64; frexp; frexpf; frexpl; fscanf; fseek;
     fseeko; fseeko64; fsetpos; fsetpos64; fstatfs; fstatfs64; fsync; ftell;
     ftello; ftello64; ftime; ftok; ftruncate; ftruncate64; ftrylockfile;
     fts_children; fts_close; fts_open; fts_read; fts_set; ftw; ftw64;
@@ -417,3 +416,9 @@ GLIBC_2.0 {
   local:
     *;
 };
+
+GLIBC_2.1 {
+  global:
+    _IO_fopen; fopen; _IO_stdin_; _IO_stdout_; _IO_stderr_; _IO_list_all;
+    freopen;
+} GLIBC_2.0;
\ No newline at end of file
diff --git a/libio/Makefile b/libio/Makefile
index 4df874d722..3e9f6eae39 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -42,6 +42,10 @@ all: # Make this the default target; it will be defined in Rules.
 
 include ../Makeconfig
 
+ifeq ($(versioning),yes)
+routines += oldiofopen oldfreopen
+endif
+
 CPPFLAGS-.o += -DIO_DEBUG
 
 ifneq (,$(filter %REENTRANT, $(defines)))
@@ -54,6 +58,10 @@ endif
 aux	:=								      \
 	fileops genops stdfiles stdio strops
 
+ifeq ($(versioning),yes)
+aux	+= oldfileops oldstdfiles
+endif
+
 distribute := iolibio.h libioP.h strfile.h Banner
 
 include ../Rules
diff --git a/libio/fileops.c b/libio/fileops.c
index ccfce3c776..e82e2b36bd 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -109,10 +109,11 @@ void
 _IO_file_init (fp)
      _IO_FILE *fp;
 {
+  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   /* POSIX.1 allows another file handle to be used to change the position
      of our file descriptor.  Hence we actually don't know the actual
      position before we do the first fseek (and until a following fflush). */
-  fp->_offset = _IO_pos_BAD;
+  fc->_offset = _IO_pos_BAD;
   fp->_IO_file_flags |= CLOSED_FILEBUF_FLAGS;
 
   _IO_link_in(fp);
@@ -123,6 +124,7 @@ int
 _IO_file_close_it (fp)
      _IO_FILE *fp;
 {
+  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   int write_status, close_status;
   if (!_IO_file_is_open (fp))
     return EOF;
@@ -141,7 +143,7 @@ _IO_file_close_it (fp)
   _IO_un_link (fp);
   fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
   fp->_fileno = EOF;
-  fp->_offset = _IO_pos_BAD;
+  fc->_offset = _IO_pos_BAD;
 
   return close_status ? close_status : write_status;
 }
@@ -221,6 +223,7 @@ _IO_file_attach (fp, fd)
      _IO_FILE *fp;
      int fd;
 {
+  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   if (_IO_file_is_open (fp))
     return NULL;
   fp->_fileno = fd;
@@ -228,7 +231,7 @@ _IO_file_attach (fp, fd)
   fp->_flags |= _IO_DELETE_DONT_CLOSE;
   /* Get the current position of the file. */
   /* We have to do that since that may be junk. */
-  fp->_offset = _IO_pos_BAD;
+  fc->_offset = _IO_pos_BAD;
   if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
       == _IO_pos_BAD && errno != ESPIPE)
     return NULL;
@@ -260,6 +263,7 @@ _IO_do_write (fp, data, to_do)
      const char *data;
      _IO_size_t to_do;
 {
+  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   _IO_size_t count;
   if (to_do == 0)
     return 0;
@@ -269,14 +273,14 @@ _IO_do_write (fp, data, to_do)
        is not needed nor desirable for Unix- or Posix-like systems.
        Instead, just indicate that offset (before and after) is
        unpredictable. */
-    fp->_offset = _IO_pos_BAD;
+    fc->_offset = _IO_pos_BAD;
   else if (fp->_IO_read_end != fp->_IO_write_base)
     {
       _IO_fpos64_t new_pos
 	= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
       if (new_pos == _IO_pos_BAD)
 	return EOF;
-      fp->_offset = new_pos;
+      fc->_offset = new_pos;
     }
   count = _IO_SYSWRITE (fp, data, to_do);
   if (fp->_cur_column)
@@ -292,6 +296,7 @@ int
 _IO_file_underflow (fp)
      _IO_FILE *fp;
 {
+  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   _IO_ssize_t count;
 #if 0
   /* SysV does not make this test; take it out for compatibility */
@@ -338,8 +343,8 @@ _IO_file_underflow (fp)
   fp->_IO_read_end += count;
   if (count == 0)
     return EOF;
-  if (fp->_offset != _IO_pos_BAD)
-    _IO_pos_adjust (fp->_offset, count);
+  if (fc->_offset != _IO_pos_BAD)
+    _IO_pos_adjust (fc->_offset, count);
   return *(unsigned char *) fp->_IO_read_ptr;
 }
 
@@ -398,6 +403,7 @@ int
 _IO_file_sync (fp)
      _IO_FILE *fp;
 {
+  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   _IO_size_t delta;
   int retval = 0;
 
@@ -424,7 +430,7 @@ _IO_file_sync (fp)
 	retval = EOF;
     }
   if (retval != EOF)
-    fp->_offset = _IO_pos_BAD;
+    fc->_offset = _IO_pos_BAD;
   /* FIXME: Cleanup - can this be shared? */
   /*    setg(base(), ptr, ptr); */
   _IO_cleanup_region_end (1);
@@ -438,6 +444,7 @@ _IO_file_seekoff (fp, offset, dir, mode)
      int dir;
      int mode;
 {
+  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   _IO_fpos64_t result;
   _IO_off64_t delta, new_offset;
   long count;
@@ -473,10 +480,10 @@ _IO_file_seekoff (fp, offset, dir, mode)
     case _IO_seek_cur:
       /* Adjust for read-ahead (bytes is buffer). */
       offset -= fp->_IO_read_end - fp->_IO_read_ptr;
-      if (fp->_offset == _IO_pos_BAD)
+      if (fc->_offset == _IO_pos_BAD)
 	goto dumb;
       /* Make offset absolute, assuming current pointer is file_ptr(). */
-      offset += _IO_pos_as_off (fp->_offset);
+      offset += _IO_pos_as_off (fc->_offset);
 
       dir = _IO_seek_set;
       break;
@@ -497,11 +504,11 @@ _IO_file_seekoff (fp, offset, dir, mode)
   /* At this point, dir==_IO_seek_set. */
 
   /* If destination is within current buffer, optimize: */
-  if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
+  if (fc->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
       && !_IO_in_backup (fp))
     {
       /* Offset relative to start of main get area. */
-      _IO_fpos64_t rel_offset = (offset - fp->_offset
+      _IO_fpos64_t rel_offset = (offset - fc->_offset
 				 + (fp->_IO_read_end - fp->_IO_read_base));
       if (rel_offset >= 0)
 	{
@@ -575,7 +582,7 @@ _IO_file_seekoff (fp, offset, dir, mode)
   _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
 	    fp->_IO_buf_base + count);
   _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
-  fp->_offset = result + count;
+  fc->_offset = result + count;
   _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
   return offset;
  dumb:
@@ -584,7 +591,7 @@ _IO_file_seekoff (fp, offset, dir, mode)
   result = _IO_SYSSEEK (fp, offset, dir);
   if (result != EOF)
     _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
-  fp->_offset = result;
+  fc->_offset = result;
   _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
   _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
   return result;
@@ -637,6 +644,7 @@ _IO_file_write (f, data, n)
      const void *data;
      _IO_ssize_t n;
 {
+  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) f;
   _IO_ssize_t to_do = n;
   while (to_do > 0)
     {
@@ -650,8 +658,8 @@ _IO_file_write (f, data, n)
       data = (void *) ((char *) data + count);
     }
   n -= to_do;
-  if (f->_offset >= 0)
-    f->_offset += n;
+  if (fc->_offset >= 0)
+    fc->_offset += n;
   return n;
 }
 
diff --git a/libio/freopen.c b/libio/freopen.c
index ff57d6033d..c443bbc2eb 100644
--- a/libio/freopen.c
+++ b/libio/freopen.c
@@ -27,7 +27,7 @@
 #include "stdio.h"
 
 FILE*
-freopen (filename, mode, fp)
+__new_freopen (filename, mode, fp)
      const char* filename;
      const char* mode;
      FILE* fp;
@@ -42,3 +42,5 @@ freopen (filename, mode, fp)
   _IO_cleanup_region_end (1);
   return result;
 }
+
+symbol_version (__new_freopen, freopen, GLIBC_2.1);
diff --git a/libio/iofopen.c b/libio/iofopen.c
index 5019e9a798..c27b69bc1b 100644
--- a/libio/iofopen.c
+++ b/libio/iofopen.c
@@ -29,13 +29,13 @@
 #endif
 
 _IO_FILE *
-_IO_fopen (filename, mode)
+_IO_new_fopen (filename, mode)
      const char *filename;
      const char *mode;
 {
   struct locked_FILE
   {
-    struct _IO_FILE_plus fp;
+    struct _IO_FILE_complete fp;
 #ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
 #endif
@@ -44,21 +44,28 @@ _IO_fopen (filename, mode)
   if (new_f == NULL)
     return NULL;
 #ifdef _IO_MTSAFE_IO
-  new_f->fp.file._lock = &new_f->lock;
+  new_f->fp.plus.file._lock = &new_f->lock;
 #endif
-  _IO_init (&new_f->fp.file, 0);
-  _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
-  _IO_file_init (&new_f->fp.file);
+  _IO_init (&new_f->fp.plus.file, 0);
+  _IO_JUMPS (&new_f->fp.plus.file) = &_IO_file_jumps;
+  _IO_file_init (&new_f->fp.plus.file);
 #if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fp.vtable = NULL;
+  new_f->fp.plus.vtable = NULL;
 #endif
-  if (_IO_file_fopen (&new_f->fp.file, filename, mode, 0) != NULL)
-        return (_IO_FILE *) &new_f->fp;
-  _IO_un_link (&new_f->fp.file);
+  if (_IO_file_fopen (&new_f->fp.plus.file, filename, mode, 0) != NULL)
+        return (_IO_FILE *) &new_f->fp.plus;
+  _IO_un_link (&new_f->fp.plus.file);
   free (new_f);
   return NULL;
 }
 
-#ifdef weak_alias
-weak_alias (_IO_fopen, fopen)
+#ifdef DO_VERSIONING
+strong_alias (_IO_new_fopen, __new_fopen)
+symbol_version (_IO_new_fopen, _IO_fopen, GLIBC_2.1);
+symbol_version (__new_fopen, fopen, GLIBC_2.1);
+#else
+# ifdef weak_alias
+weak_symbol (_IO_new_fopen, _IO_fopen)
+weak_symbol (_IO_new_fopen, fopen)
+# endif
 #endif
diff --git a/libio/iofopen64.c b/libio/iofopen64.c
index cdd508d08a..fc6ccc0b92 100644
--- a/libio/iofopen64.c
+++ b/libio/iofopen64.c
@@ -36,7 +36,7 @@ _IO_fopen64 (filename, mode)
 #ifdef _G_OPEN64
   struct locked_FILE
   {
-    struct _IO_FILE_plus fp;
+    struct _IO_FILE_complete fp;
 #ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
 #endif
@@ -45,17 +45,17 @@ _IO_fopen64 (filename, mode)
   if (new_f == NULL)
     return NULL;
 #ifdef _IO_MTSAFE_IO
-  new_f->fp.file._lock = &new_f->lock;
+  new_f->fp.plus.file._lock = &new_f->lock;
 #endif
-  _IO_init (&new_f->fp.file, 0);
-  _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
-  _IO_file_init (&new_f->fp.file);
+  _IO_init (&new_f->fp.plus.file, 0);
+  _IO_JUMPS (&new_f->fp.plus.file) = &_IO_file_jumps;
+  _IO_file_init (&new_f->fp.plus.file);
 #if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fp.vtable = NULL;
+  new_f->fp.plus.vtable = NULL;
 #endif
-  if (_IO_file_fopen (&new_f->fp.file, filename, mode, 1) != NULL)
-        return (_IO_FILE *) &new_f->fp;
-  _IO_un_link (&new_f->fp.file);
+  if (_IO_file_fopen (&new_f->fp.plus.file, filename, mode, 1) != NULL)
+        return (_IO_FILE *) &new_f->fp.plus;
+  _IO_un_link (&new_f->fp.plus.file);
   free (new_f);
   return NULL;
 #else
diff --git a/libio/iolibio.h b/libio/iolibio.h
index bcf8bbd775..bb5506444f 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -14,6 +14,8 @@ extern int _IO_fgetpos __P((_IO_FILE*, _IO_fpos_t*));
 extern int _IO_fgetpos64 __P((_IO_FILE*, _IO_fpos64_t*));
 extern char* _IO_fgets __P((char*, int, _IO_FILE*));
 extern _IO_FILE *_IO_fopen __P((const char*, const char*));
+extern _IO_FILE *_IO_old_fopen __P((const char*, const char*));
+extern _IO_FILE *_IO_new_fopen __P((const char*, const char*));
 extern _IO_FILE *_IO_fopen64 __P((const char*, const char*));
 extern int _IO_fprintf __P((_IO_FILE*, const char*, ...));
 extern int _IO_fputs __P((const char*, _IO_FILE*));
@@ -50,6 +52,8 @@ extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...));
 #define _IO_vprintf(FORMAT, ARGS) _IO_vfprintf(_IO_stdout, FORMAT, ARGS)
 #define _IO_freopen(FILENAME, MODE, FP) \
   (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 0))
+#define _IO_old_freopen(FILENAME, MODE, FP) \
+  (_IO_file_close_it(FP), _IO_old_file_fopen(FP, FILENAME, MODE))
 #define _IO_freopen64(FILENAME, MODE, FP) \
   (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 1))
 #define _IO_fileno(FP) ((FP)->_fileno)
@@ -58,6 +62,9 @@ extern _IO_FILE* _IO_popen __P((const char*, const char*));
 #define _IO_setbuf(_FP, _BUF) _IO_setbuffer(_FP, _BUF, _IO_BUFSIZ)
 #define _IO_setlinebuf(_FP) _IO_setvbuf(_FP, NULL, 1, 0)
 
+_IO_FILE *__new_freopen __P ((const char *, const char *, _IO_FILE *));
+_IO_FILE *__old_freopen __P ((const char *, const char *, _IO_FILE *));
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/libio/libio.h b/libio/libio.h
index ad5583f486..2e9e62ad61 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -207,7 +207,7 @@ struct _IO_FILE {
 
   int _fileno;
   int _blksize;
-  _IO_off_t _unused2;	/* This used to be _offset but it's too small.  */
+  _IO_off_t _old_offset; /* This used to be _offset but it's too small.  */
 
 #define __HAVE_COLUMN /* temporary */
   /* 1+column number of pbase(); 0 is unknown. */
@@ -218,16 +218,14 @@ struct _IO_FILE {
   /*  char* _save_gptr;  char* _save_egptr; */
 
   _IO_lock_t *_lock;
-
-  _IO_off64_t _offset;
 };
 
 #ifndef __cplusplus
 typedef struct _IO_FILE _IO_FILE;
 #endif
 
-struct _IO_FILE_plus;
-extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;
+struct _IO_FILE_complete;
+extern struct _IO_FILE_complete _IO_stdin_, _IO_stdout_, _IO_stderr_;
 #define _IO_stdin ((_IO_FILE*)(&_IO_stdin_))
 #define _IO_stdout ((_IO_FILE*)(&_IO_stdout_))
 #define _IO_stderr ((_IO_FILE*)(&_IO_stderr_))
diff --git a/libio/libioP.h b/libio/libioP.h
index 5fe9598c0d..97c3206c4d 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -267,6 +267,17 @@ struct _IO_FILE_plus
   const struct _IO_jump_t *vtable;
 };
 
+/* We had to extend _IO_FILE but this isn't easily possible without
+   compatibility problems.  So we mimic the C++ way to do this which
+   especially takes care that the position of the vtable stays the
+   same.  */
+struct _IO_FILE_complete
+{
+  struct _IO_FILE_plus plus;;
+  _IO_off64_t _offset;
+  int _unused2[16];	/* Make sure we don't get into trouble again.  */
+};
+
 /* Generic functions */
 
 extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
@@ -321,10 +332,13 @@ extern int _IO_default_showmanyc __P ((_IO_FILE *));
 extern void _IO_default_imbue __P ((_IO_FILE *, void *));
 
 extern struct _IO_jump_t _IO_file_jumps;
+extern struct _IO_jump_t _IO_new_file_jumps;
+extern struct _IO_jump_t _IO_old_file_jumps;
 extern struct _IO_jump_t _IO_streambuf_jumps;
 extern struct _IO_jump_t _IO_proc_jumps;
 extern struct _IO_jump_t _IO_str_jumps;
 extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
+extern int _IO_old_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
 extern int _IO_flush_all __P ((void));
 extern void _IO_cleanup __P ((void));
 extern void _IO_flush_all_linebuffered __P ((void));
@@ -367,6 +381,23 @@ extern int _IO_file_close_it __P ((_IO_FILE *));
 extern _IO_fpos64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
 extern void _IO_file_finish __P ((_IO_FILE *, int));
 
+extern _IO_FILE* _IO_old_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
+extern _IO_fpos64_t _IO_old_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int,
+					       int));
+extern _IO_size_t _IO_old_file_xsputn __P ((_IO_FILE *, const void *,
+					    _IO_size_t));
+extern int _IO_old_file_underflow __P ((_IO_FILE *));
+extern int _IO_old_file_overflow __P ((_IO_FILE *, int));
+extern void _IO_old_file_init __P ((_IO_FILE *));
+extern _IO_FILE* _IO_old_file_attach __P ((_IO_FILE *, int));
+extern _IO_FILE* _IO_old_file_fopen __P ((_IO_FILE *, const char *,
+					  const char *));
+extern _IO_ssize_t _IO_old_file_write __P ((_IO_FILE *, const void *,
+					    _IO_ssize_t));
+extern int _IO_old_file_sync __P ((_IO_FILE *));
+extern int _IO_old_file_close_it __P ((_IO_FILE *));
+extern void _IO_old_file_finish __P ((_IO_FILE *, int));
+
 /* Jumptable functions for proc_files. */
 extern _IO_FILE* _IO_proc_open __P ((_IO_FILE *, const char *, const char *));
 extern int _IO_proc_close __P ((_IO_FILE *));
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
new file mode 100644
index 0000000000..ab4445c594
--- /dev/null
+++ b/libio/oldfileops.c
@@ -0,0 +1,720 @@
+/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU IO Library.
+   Written by Per Bothner <bothner@cygnus.com>.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This 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
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this library; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.
+
+   As a special exception, if you link this library with files
+   compiled with a GNU compiler to produce an executable, this does
+   not cause the resulting executable to be covered by the GNU General
+   Public License.  This exception does not however invalidate any
+   other reasons why the executable file might be covered by the GNU
+   General Public License.  */
+
+/* This is a compatibility file.  If we don't build the libc with
+   versioning don't compile this file.  */
+#if DO_VERSIONING
+
+
+#ifndef _POSIX_SOURCE
+# define _POSIX_SOURCE
+#endif
+#include "libioP.h"
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+
+
+#ifdef _LIBC
+# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
+# define close(FD) __close (FD)
+# define fstat(FD, Statbuf) __fstat (FD, Statbuf)
+# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
+# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
+# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)
+#endif
+
+/* An fstream can be in at most one of put mode, get mode, or putback mode.
+   Putback mode is a variant of get mode.
+
+   In a filebuf, there is only one current position, instead of two
+   separate get and put pointers.  In get mode, the current position
+   is that of gptr(); in put mode that of pptr().
+
+   The position in the buffer that corresponds to the position
+   in external file system is normally _IO_read_end, except in putback
+   mode, when it is _IO_save_end.
+   If the field _fb._offset is >= 0, it gives the offset in
+   the file as a whole corresponding to eGptr(). (?)
+
+   PUT MODE:
+   If a filebuf is in put mode, then all of _IO_read_ptr, _IO_read_end,
+   and _IO_read_base are equal to each other.  These are usually equal
+   to _IO_buf_base, though not necessarily if we have switched from
+   get mode to put mode.  (The reason is to maintain the invariant
+   that _IO_read_end corresponds to the external file position.)
+   _IO_write_base is non-NULL and usually equal to _IO_base_base.
+   We also have _IO_write_end == _IO_buf_end, but only in fully buffered mode.
+   The un-flushed character are those between _IO_write_base and _IO_write_ptr.
+
+   GET MODE:
+   If a filebuf is in get or putback mode, eback() != egptr().
+   In get mode, the unread characters are between gptr() and egptr().
+   The OS file position corresponds to that of egptr().
+
+   PUTBACK MODE:
+   Putback mode is used to remember "excess" characters that have
+   been sputbackc'd in a separate putback buffer.
+   In putback mode, the get buffer points to the special putback buffer.
+   The unread characters are the characters between gptr() and egptr()
+   in the putback buffer, as well as the area between save_gptr()
+   and save_egptr(), which point into the original reserve buffer.
+   (The pointers save_gptr() and save_egptr() are the values
+   of gptr() and egptr() at the time putback mode was entered.)
+   The OS position corresponds to that of save_egptr().
+
+   LINE BUFFERED OUTPUT:
+   During line buffered output, _IO_write_base==base() && epptr()==base().
+   However, ptr() may be anywhere between base() and ebuf().
+   This forces a call to filebuf::overflow(int C) on every put.
+   If there is more space in the buffer, and C is not a '\n',
+   then C is inserted, and pptr() incremented.
+
+   UNBUFFERED STREAMS:
+   If a filebuf is unbuffered(), the _shortbuf[1] is used as the buffer.
+*/
+
+#define CLOSED_FILEBUF_FLAGS \
+  (_IO_IS_FILEBUF+_IO_NO_READS+_IO_NO_WRITES+_IO_TIED_PUT_GET)
+
+
+void
+_IO_old_file_init (fp)
+     _IO_FILE *fp;
+{
+  /* POSIX.1 allows another file handle to be used to change the position
+     of our file descriptor.  Hence we actually don't know the actual
+     position before we do the first fseek (and until a following fflush). */
+  fp->_old_offset = _IO_pos_BAD;
+  fp->_IO_file_flags |= CLOSED_FILEBUF_FLAGS;
+
+  _IO_link_in(fp);
+  fp->_fileno = -1;
+}
+
+int
+_IO_old_file_close_it (fp)
+     _IO_FILE *fp;
+{
+  int write_status, close_status;
+  if (!_IO_file_is_open (fp))
+    return EOF;
+
+  write_status = _IO_do_flush (fp);
+
+  _IO_unsave_markers(fp);
+
+  close_status = _IO_SYSCLOSE (fp);
+
+  /* Free buffer. */
+  _IO_setb (fp, NULL, NULL, 0);
+  _IO_setg (fp, NULL, NULL, NULL);
+  _IO_setp (fp, NULL, NULL);
+
+  _IO_un_link (fp);
+  fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
+  fp->_fileno = EOF;
+  fp->_old_offset = _IO_pos_BAD;
+
+  return close_status ? close_status : write_status;
+}
+
+void
+_IO_old_file_finish (fp, dummy)
+     _IO_FILE *fp;
+     int dummy;
+{
+  if (_IO_file_is_open (fp))
+    {
+      _IO_do_flush (fp);
+      if (!(fp->_flags & _IO_DELETE_DONT_CLOSE))
+	_IO_SYSCLOSE (fp);
+    }
+  _IO_default_finish (fp, 0);
+}
+
+_IO_FILE *
+_IO_old_file_fopen (fp, filename, mode)
+     _IO_FILE *fp;
+     const char *filename;
+     const char *mode;
+{
+  int oflags = 0, omode;
+  int read_write, fdesc;
+  int oprot = 0666;
+  if (_IO_file_is_open (fp))
+    return 0;
+  switch (*mode++)
+    {
+    case 'r':
+      omode = O_RDONLY;
+      read_write = _IO_NO_WRITES;
+      break;
+    case 'w':
+      omode = O_WRONLY;
+      oflags = O_CREAT|O_TRUNC;
+      read_write = _IO_NO_READS;
+      break;
+    case 'a':
+      omode = O_WRONLY;
+      oflags = O_CREAT|O_APPEND;
+      read_write = _IO_NO_READS|_IO_IS_APPENDING;
+      break;
+    default:
+      __set_errno (EINVAL);
+      return NULL;
+    }
+  if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
+    {
+      omode = O_RDWR;
+      read_write &= _IO_IS_APPENDING;
+    }
+  fdesc = open (filename, omode|oflags, oprot);
+  if (fdesc < 0)
+    return NULL;
+  fp->_fileno = fdesc;
+  _IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
+  if (read_write & _IO_IS_APPENDING)
+    if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
+	== _IO_pos_BAD && errno != ESPIPE)
+      return NULL;
+  _IO_link_in (fp);
+  return fp;
+}
+
+_IO_FILE *
+_IO_old_file_attach (fp, fd)
+     _IO_FILE *fp;
+     int fd;
+{
+  if (_IO_file_is_open (fp))
+    return NULL;
+  fp->_fileno = fd;
+  fp->_flags &= ~(_IO_NO_READS+_IO_NO_WRITES);
+  fp->_flags |= _IO_DELETE_DONT_CLOSE;
+  /* Get the current position of the file. */
+  /* We have to do that since that may be junk. */
+  fp->_old_offset = _IO_pos_BAD;
+  if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
+      == _IO_pos_BAD && errno != ESPIPE)
+    return NULL;
+  return fp;
+}
+
+_IO_FILE *
+_IO_old_file_setbuf (fp, p, len)
+     _IO_FILE *fp;
+     char *p;
+     _IO_ssize_t len;
+{
+    if (_IO_default_setbuf (fp, p, len) == NULL)
+      return NULL;
+
+    fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
+      = fp->_IO_buf_base;
+    _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+
+    return fp;
+}
+
+/* Write TO_DO bytes from DATA to FP.
+   Then mark FP as having empty buffers. */
+
+int
+_IO_old_do_write (fp, data, to_do)
+     _IO_FILE *fp;
+     const char *data;
+     _IO_size_t to_do;
+{
+  _IO_size_t count;
+  if (to_do == 0)
+    return 0;
+  if (fp->_flags & _IO_IS_APPENDING)
+    /* On a system without a proper O_APPEND implementation,
+       you would need to sys_seek(0, SEEK_END) here, but is
+       is not needed nor desirable for Unix- or Posix-like systems.
+       Instead, just indicate that offset (before and after) is
+       unpredictable. */
+    fp->_old_offset = _IO_pos_BAD;
+  else if (fp->_IO_read_end != fp->_IO_write_base)
+    {
+      _IO_pos_t new_pos
+	= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
+      if (new_pos == _IO_pos_BAD)
+	return EOF;
+      fp->_old_offset = new_pos;
+    }
+  count = _IO_SYSWRITE (fp, data, to_do);
+  if (fp->_cur_column)
+    fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, to_do) + 1;
+  _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+  fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base;
+  fp->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+		       ? fp->_IO_buf_base : fp->_IO_buf_end);
+  return count != to_do ? EOF : 0;
+}
+
+int
+_IO_old_file_underflow (fp)
+     _IO_FILE *fp;
+{
+  _IO_ssize_t count;
+#if 0
+  /* SysV does not make this test; take it out for compatibility */
+  if (fp->_flags & _IO_EOF_SEEN)
+    return (EOF);
+#endif
+
+  if (fp->_flags & _IO_NO_READS)
+    {
+      __set_errno (EBADF);
+      return EOF;
+    }
+  if (fp->_IO_read_ptr < fp->_IO_read_end)
+    return *(unsigned char *) fp->_IO_read_ptr;
+
+  if (fp->_IO_buf_base == NULL)
+    _IO_doallocbuf (fp);
+
+  /* Flush all line buffered files before reading. */
+  /* FIXME This can/should be moved to genops ?? */
+  if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
+    _IO_flush_all_linebuffered ();
+
+  _IO_switch_to_get_mode (fp);
+
+  /* This is very tricky. We have to adjust those
+     pointers before we call _IO_SYSREAD () since
+     we may longjump () out while waiting for
+     input. Those pointers may be screwed up. H.J. */
+  fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base;
+  fp->_IO_read_end = fp->_IO_buf_base;
+  fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
+    = fp->_IO_buf_base;
+
+  count = _IO_SYSREAD (fp, fp->_IO_buf_base,
+		       fp->_IO_buf_end - fp->_IO_buf_base);
+  if (count <= 0)
+    {
+      if (count == 0)
+	fp->_flags |= _IO_EOF_SEEN;
+      else
+	fp->_flags |= _IO_ERR_SEEN, count = 0;
+  }
+  fp->_IO_read_end += count;
+  if (count == 0)
+    return EOF;
+  if (fp->_old_offset != _IO_pos_BAD)
+    _IO_pos_adjust (fp->_old_offset, count);
+  return *(unsigned char *) fp->_IO_read_ptr;
+}
+
+int
+_IO_old_file_overflow (f, ch)
+      _IO_FILE *f;
+      int ch;
+{
+  if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
+    {
+      f->_flags |= _IO_ERR_SEEN;
+      __set_errno (EBADF);
+      return EOF;
+    }
+  /* If currently reading or no buffer allocated. */
+  if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0)
+    {
+      /* Allocate a buffer if needed. */
+      if (f->_IO_write_base == 0)
+	{
+	  _IO_doallocbuf (f);
+	  _IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
+	}
+      /* Otherwise must be currently reading.
+	 If _IO_read_ptr (and hence also _IO_read_end) is at the buffer end,
+	 logically slide the buffer forwards one block (by setting the
+	 read pointers to all point at the beginning of the block).  This
+	 makes room for subsequent output.
+	 Otherwise, set the read pointers to _IO_read_end (leaving that
+	 alone, so it can continue to correspond to the external position). */
+      if (f->_IO_read_ptr == f->_IO_buf_end)
+	f->_IO_read_end = f->_IO_read_ptr = f->_IO_buf_base;
+      f->_IO_write_ptr = f->_IO_read_ptr;
+      f->_IO_write_base = f->_IO_write_ptr;
+      f->_IO_write_end = f->_IO_buf_end;
+      f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
+
+      if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+	f->_IO_write_end = f->_IO_write_ptr;
+      f->_flags |= _IO_CURRENTLY_PUTTING;
+    }
+  if (ch == EOF)
+    return _IO_do_flush (f);
+  if (f->_IO_write_ptr == f->_IO_buf_end ) /* Buffer is really full */
+    if (_IO_do_flush (f) == EOF)
+      return EOF;
+  *f->_IO_write_ptr++ = ch;
+  if ((f->_flags & _IO_UNBUFFERED)
+      || ((f->_flags & _IO_LINE_BUF) && ch == '\n'))
+    if (_IO_do_flush (f) == EOF)
+      return EOF;
+  return (unsigned char) ch;
+}
+
+int
+_IO_old_file_sync (fp)
+     _IO_FILE *fp;
+{
+  _IO_size_t delta;
+  int retval = 0;
+
+  _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+  _IO_flockfile (fp);
+  /*    char* ptr = cur_ptr(); */
+  if (fp->_IO_write_ptr > fp->_IO_write_base)
+    if (_IO_do_flush(fp)) return EOF;
+  delta = fp->_IO_read_ptr - fp->_IO_read_end;
+  if (delta != 0)
+    {
+#ifdef TODO
+      if (_IO_in_backup (fp))
+	delta -= eGptr () - Gbase ();
+#endif
+      _IO_off_t new_pos = _IO_SYSSEEK (fp, delta, 1);
+      if (new_pos != (_IO_off_t) EOF)
+	fp->_IO_read_end = fp->_IO_read_ptr;
+#ifdef ESPIPE
+      else if (errno == ESPIPE)
+	; /* Ignore error from unseekable devices. */
+#endif
+      else
+	retval = EOF;
+    }
+  if (retval != EOF)
+    fp->_old_offset = _IO_pos_BAD;
+  /* FIXME: Cleanup - can this be shared? */
+  /*    setg(base(), ptr, ptr); */
+  _IO_cleanup_region_end (1);
+  return retval;
+}
+
+_IO_fpos64_t
+_IO_old_file_seekoff (fp, offset, dir, mode)
+     _IO_FILE *fp;
+     _IO_off64_t offset;
+     int dir;
+     int mode;
+{
+  _IO_pos_t result;
+  _IO_off64_t delta, new_offset;
+  long count;
+  /* POSIX.1 8.2.3.7 says that after a call the fflush() the file
+     offset of the underlying file must be exact.  */
+  int must_be_exact = (fp->_IO_read_base == fp->_IO_read_end
+		       && fp->_IO_write_base == fp->_IO_write_ptr);
+
+  if (mode == 0)
+    dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
+
+  /* Flush unwritten characters.
+     (This may do an unneeded write if we seek within the buffer.
+     But to be able to switch to reading, we would need to set
+     egptr to ptr.  That can't be done in the current design,
+     which assumes file_ptr() is eGptr.  Anyway, since we probably
+     end up flushing when we close(), it doesn't make much difference.)
+     FIXME: simulate mem-papped files. */
+
+  if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp))
+    if (_IO_switch_to_get_mode (fp))
+      return EOF;
+
+  if (fp->_IO_buf_base == NULL)
+    {
+      _IO_doallocbuf (fp);
+      _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+      _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+    }
+
+  switch (dir)
+    {
+    case _IO_seek_cur:
+      /* Adjust for read-ahead (bytes is buffer). */
+      offset -= fp->_IO_read_end - fp->_IO_read_ptr;
+      if (fp->_old_offset == _IO_pos_BAD)
+	goto dumb;
+      /* Make offset absolute, assuming current pointer is file_ptr(). */
+      offset += _IO_pos_as_off (fp->_old_offset);
+
+      dir = _IO_seek_set;
+      break;
+    case _IO_seek_set:
+      break;
+    case _IO_seek_end:
+      {
+	struct stat st;
+	if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
+	  {
+	    offset += st.st_size;
+	    dir = _IO_seek_set;
+	  }
+	else
+	  goto dumb;
+      }
+    }
+  /* At this point, dir==_IO_seek_set. */
+
+  /* If destination is within current buffer, optimize: */
+  if (fp->_old_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
+      && !_IO_in_backup (fp))
+    {
+      /* Offset relative to start of main get area. */
+      _IO_pos_t rel_offset = (offset - fp->_old_offset
+			      + (fp->_IO_read_end - fp->_IO_read_base));
+      if (rel_offset >= 0)
+	{
+#if 0
+	  if (_IO_in_backup (fp))
+	    _IO_switch_to_main_get_area (fp);
+#endif
+	  if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
+	    {
+	      _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
+			fp->_IO_read_end);
+	      _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+	      return offset;
+	    }
+#ifdef TODO
+	    /* If we have streammarkers, seek forward by reading ahead. */
+	    if (_IO_have_markers (fp))
+	      {
+		int to_skip = rel_offset
+		  - (fp->_IO_read_ptr - fp->_IO_read_base);
+		if (ignore (to_skip) != to_skip)
+		  goto dumb;
+		return offset;
+	      }
+#endif
+	}
+#ifdef TODO
+      if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
+	{
+	  if (!_IO_in_backup (fp))
+	    _IO_switch_to_backup_area (fp);
+	  gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
+	  return offset;
+	}
+#endif
+    }
+
+#ifdef TODO
+  _IO_unsave_markers (fp);
+#endif
+
+  if (fp->_flags & _IO_NO_READS)
+    goto dumb;
+
+  /* Try to seek to a block boundary, to improve kernel page management. */
+  new_offset = offset & ~(fp->_IO_buf_end - fp->_IO_buf_base - 1);
+  delta = offset - new_offset;
+  if (delta > fp->_IO_buf_end - fp->_IO_buf_base)
+    {
+      new_offset = offset;
+      delta = 0;
+    }
+  result = _IO_SYSSEEK (fp, new_offset, 0);
+  if (result < 0)
+    return EOF;
+  if (delta == 0)
+    count = 0;
+  else
+    {
+      count = _IO_SYSREAD (fp, fp->_IO_buf_base,
+			   (must_be_exact
+			    ? delta : fp->_IO_buf_end - fp->_IO_buf_base));
+      if (count < delta)
+	{
+	  /* We weren't allowed to read, but try to seek the remainder. */
+	  offset = count == EOF ? delta : delta-count;
+	  dir = _IO_seek_cur;
+	  goto dumb;
+	}
+    }
+  _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
+	    fp->_IO_buf_base + count);
+  _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+  fp->_old_offset = result + count;
+  _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+  return offset;
+ dumb:
+
+  _IO_unsave_markers (fp);
+  result = _IO_SYSSEEK (fp, offset, dir);
+  if (result != EOF)
+    _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
+  fp->_old_offset = result;
+  _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
+  _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+  return result;
+}
+
+_IO_ssize_t
+_IO_old_file_write (f, data, n)
+     _IO_FILE *f;
+     const void *data;
+     _IO_ssize_t n;
+{
+  _IO_ssize_t to_do = n;
+  while (to_do > 0)
+    {
+      _IO_ssize_t count = write (f->_fileno, data, to_do);
+      if (count == EOF)
+	{
+	  f->_flags |= _IO_ERR_SEEN;
+	  break;
+        }
+      to_do -= count;
+      data = (void *) ((char *) data + count);
+    }
+  n -= to_do;
+  if (f->_old_offset >= 0)
+    f->_old_offset += n;
+  return n;
+}
+
+_IO_size_t
+_IO_old_file_xsputn (f, data, n)
+     _IO_FILE *f;
+     const void *data;
+     _IO_size_t n;
+{
+  register const char *s = (char *) data;
+  _IO_size_t to_do = n;
+  int must_flush = 0;
+  _IO_size_t count;
+
+  if (n <= 0)
+    return 0;
+  /* This is an optimized implementation.
+     If the amount to be written straddles a block boundary
+     (or the filebuf is unbuffered), use sys_write directly. */
+
+  /* First figure out how much space is available in the buffer. */
+  count = f->_IO_write_end - f->_IO_write_ptr; /* Space available. */
+  if ((f->_flags & _IO_LINE_BUF) && (f->_flags & _IO_CURRENTLY_PUTTING))
+    {
+      count = f->_IO_buf_end - f->_IO_write_ptr;
+      if (count >= n)
+	{
+	  register const char *p;
+	  for (p = s + n; p > s; )
+	    {
+	      if (*--p == '\n')
+		{
+		  count = p - s + 1;
+		  must_flush = 1;
+		  break;
+		}
+	    }
+	}
+    }
+  /* Then fill the buffer. */
+  if (count > 0)
+    {
+      if (count > to_do)
+	count = to_do;
+      if (count > 20)
+	{
+	  memcpy (f->_IO_write_ptr, s, count);
+	  s += count;
+	}
+      else
+	{
+	  register char *p = f->_IO_write_ptr;
+	  register int i = (int) count;
+	  while (--i >= 0)
+	    *p++ = *s++;
+	}
+      f->_IO_write_ptr += count;
+      to_do -= count;
+    }
+  if (to_do + must_flush > 0)
+    {
+      _IO_size_t block_size, dont_write;
+      /* Next flush the (full) buffer. */
+      if (__overflow (f, EOF) == EOF)
+	return n - to_do;
+
+      /* Try to maintain alignment: write a whole number of blocks.
+	 dont_write is what gets left over. */
+      block_size = f->_IO_buf_end - f->_IO_buf_base;
+      dont_write = block_size >= 128 ? to_do % block_size : 0;
+
+      count = to_do - dont_write;
+      if (_IO_do_write (f, s, count) == EOF)
+	return n - to_do;
+      to_do = dont_write;
+
+      /* Now write out the remainder.  Normally, this will fit in the
+	 buffer, but it's somewhat messier for line-buffered files,
+	 so we let _IO_default_xsputn handle the general case. */
+      if (dont_write)
+	to_do -= _IO_default_xsputn (f, s+count, dont_write);
+    }
+  return n - to_do;
+}
+
+
+struct _IO_jump_t _IO_old_file_jumps =
+{
+  JUMP_INIT_DUMMY,
+  JUMP_INIT(finish, _IO_old_file_finish),
+  JUMP_INIT(overflow, _IO_old_file_overflow),
+  JUMP_INIT(underflow, _IO_old_file_underflow),
+  JUMP_INIT(uflow, _IO_default_uflow),
+  JUMP_INIT(pbackfail, _IO_default_pbackfail),
+  JUMP_INIT(xsputn, _IO_old_file_xsputn),
+  JUMP_INIT(xsgetn, _IO_default_xsgetn),
+  JUMP_INIT(seekoff, _IO_old_file_seekoff),
+  JUMP_INIT(seekpos, _IO_default_seekpos),
+  JUMP_INIT(setbuf, _IO_old_file_setbuf),
+  JUMP_INIT(sync, _IO_file_sync),
+  JUMP_INIT(doallocate, _IO_file_doallocate),
+  JUMP_INIT(read, _IO_file_read),
+  JUMP_INIT(write, _IO_file_write),
+  JUMP_INIT(seek, _IO_file_seek),
+  JUMP_INIT(close, _IO_file_close),
+  JUMP_INIT(stat, _IO_file_stat)
+};
+
+
+#endif /* DO_VERSIONING */
diff --git a/libio/oldfreopen.c b/libio/oldfreopen.c
new file mode 100644
index 0000000000..705965c336
--- /dev/null
+++ b/libio/oldfreopen.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU IO Library.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This 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
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this library; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.
+
+   As a special exception, if you link this library with files
+   compiled with a GNU compiler to produce an executable, this does
+   not cause the resulting executable to be covered by the GNU General
+   Public License.  This exception does not however invalidate any
+   other reasons why the executable file might be covered by the GNU
+   General Public License.  */
+
+#include "libioP.h"
+#include "stdio.h"
+
+FILE*
+__old_freopen (filename, mode, fp)
+     const char* filename;
+     const char* mode;
+     FILE* fp;
+{
+  FILE *result;
+  CHECK_FILE (fp, NULL);
+  if (!(fp->_flags & _IO_IS_FILEBUF))
+    return NULL;
+  _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+  _IO_flockfile (fp);
+  result = _IO_old_freopen (filename, mode, fp);
+  _IO_cleanup_region_end (1);
+  return result;
+}
+
+symbol_version (__old_freopen, freopen,);
diff --git a/libio/oldiofopen.c b/libio/oldiofopen.c
new file mode 100644
index 0000000000..c37ec0309a
--- /dev/null
+++ b/libio/oldiofopen.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU IO Library.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This 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
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this library; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.
+
+   As a special exception, if you link this library with files
+   compiled with a GNU compiler to produce an executable, this does
+   not cause the resulting executable to be covered by the GNU General
+   Public License.  This exception does not however invalidate any
+   other reasons why the executable file might be covered by the GNU
+   General Public License.  */
+
+#include "libioP.h"
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
+
+
+_IO_FILE *
+_IO_old_fopen (filename, mode)
+     const char *filename;
+     const char *mode;
+{
+  struct locked_FILE
+  {
+    struct _IO_FILE_plus fp;
+#ifdef _IO_MTSAFE_IO
+    _IO_lock_t lock;
+#endif
+  } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+
+  if (new_f == NULL)
+    return NULL;
+#ifdef _IO_MTSAFE_IO
+  new_f->fp.file._lock = &new_f->lock;
+#endif
+  _IO_init (&new_f->fp.file, 0);
+  _IO_JUMPS (&new_f->fp.file) = &_IO_old_file_jumps;
+  _IO_file_init (&new_f->fp.file);
+#if  !_IO_UNIFIED_JUMPTABLES
+  new_f->fp.vtable = NULL;
+#endif
+  if (_IO_old_file_fopen (&new_f->fp.file, filename, mode) != NULL)
+        return (_IO_FILE *) &new_f->fp;
+  _IO_un_link (&new_f->fp.file);
+  free (new_f);
+  return NULL;
+}
+
+strong_alias (_IO_old_fopen, __old_fopen)
+symbol_version (_IO_old_fopen, _IO_fopen,);
+symbol_version (__old_fopen, fopen,);
diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c
new file mode 100644
index 0000000000..d34a8680c3
--- /dev/null
+++ b/libio/oldstdfiles.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU IO Library.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This 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
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this library; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.
+
+   As a special exception, if you link this library with files
+   compiled with a GNU compiler to produce an executable, this does
+   not cause the resulting executable to be covered by the GNU General
+   Public License.  This exception does not however invalidate any
+   other reasons why the executable file might be covered by the GNU
+   General Public License.  */
+
+
+/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr
+   for C code.  Compare stdstreams.cc.
+   (The difference is that here the vtable field is set to 0,
+   so the objects defined are not valid C++ objects.  On the other
+   hand, we don't need a C++ compiler to build this file.) */
+
+#include "libioP.h"
+
+#ifdef _IO_MTSAFE_IO
+#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \
+  static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
+  struct _IO_FILE_plus INAME \
+    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_old_file_jumps}; \
+  symbol_version (INAME, NAME,)
+#else
+#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \
+  struct _IO_FILE_plus INAME \
+    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_old_file_jumps}; \
+  symbol_version (INAME, NAME,)
+#endif
+
+DEF_STDFILE(_IO_old_stdin_, _IO_stdin_, 0, 0, _IO_NO_WRITES);
+DEF_STDFILE(_IO_old_stdout_, _IO_stdout_, 1, &_IO_old_stdin_.file,
+	    _IO_NO_READS);
+DEF_STDFILE(_IO_old_stderr_, _IO_stderr_, 2, &_IO_old_stdout_.file,
+            _IO_NO_READS+_IO_UNBUFFERED);
+
+_IO_FILE *_IO_old_list_all = &_IO_old_stderr_.file;
+symbol_version (_IO_old_list_all, _IO_list_all,);
diff --git a/libio/stdfiles.c b/libio/stdfiles.c
index da921321a6..f5113b2973 100644
--- a/libio/stdfiles.c
+++ b/libio/stdfiles.c
@@ -33,26 +33,23 @@
 #include "libioP.h"
 
 #ifdef _IO_MTSAFE_IO
-#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \
   static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
-  struct _IO_FILE_plus NAME \
-    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps}
+  struct _IO_FILE_complete INAME \
+    = {{FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps},}; \
+  symbol_version (INAME, NAME, GLIBC_2.1)
 #else
-#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
-  struct _IO_FILE_plus NAME \
-    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps}
+#define DEF_STDFILE(INAME, FD, CHAIN, FLAGS) \
+  struct _IO_FILE_complete INAME \
+    = {{FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps},}; \
+  symbol_version (INAME, NAME, GLIBC_2.1)
 #endif
 
-DEF_STDFILE(_IO_stdin_, 0, 0, _IO_NO_WRITES);
-DEF_STDFILE(_IO_stdout_, 1, &_IO_stdin_.file, _IO_NO_READS);
-DEF_STDFILE(_IO_stderr_, 2, &_IO_stdout_.file,
+DEF_STDFILE(_IO_new_stdin_, _IO_stdin_, 0, 0, _IO_NO_WRITES);
+DEF_STDFILE(_IO_new_stdout_, _IO_stdout_, 1, &_IO_new_stdin_.plus.file,
+	    _IO_NO_READS);
+DEF_STDFILE(_IO_new_stderr_, _IO_stderr_, 2, &_IO_new_stdout_.plus.file,
             _IO_NO_READS+_IO_UNBUFFERED);
 
-_IO_FILE *_IO_list_all = &_IO_stderr_.file;
-
-#ifdef _G_USING_THUNKS
-#if defined(__GNUC__) && __GNUC__ >= 2
-const
-#endif
-int _libio_using_thunks = 1;
-#endif
+_IO_FILE *_IO_new_list_all = &_IO_new_stderr_.plus.file;
+symbol_version (_IO_new_list_all, _IO_list_all, GLIBC_2.1);
diff --git a/libio/stdio.c b/libio/stdio.c
index 27c298c184..c8b3ba5a00 100644
--- a/libio/stdio.c
+++ b/libio/stdio.c
@@ -32,6 +32,6 @@
 #undef stdin
 #undef stdout
 #undef stderr
-FILE *stdin = &_IO_stdin_.file;
-FILE *stdout = &_IO_stdout_.file;
-FILE *stderr = &_IO_stderr_.file;
+FILE *stdin = &_IO_stdin_.plus.file;
+FILE *stdout = &_IO_stdout_.plus.file;
+FILE *stderr = &_IO_stderr_.plus.file;
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index edb6ee01d7..482b47e3b3 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -125,9 +125,21 @@
   __inline_mathcode_ (double, func, arg, code)				      \
   __inline_mathcode_ (float, __CONCAT(func,f), arg, code)		      \
   __inline_mathcode_ (long double, __CONCAT(func,l), arg, code)
+# define __inline_mathcode2(func, arg1, arg2, code) \
+  __inline_mathcode2_ (double, func, arg1, arg2, code)			      \
+  __inline_mathcode2_ (float, __CONCAT(func,f), arg1, arg2, code)	      \
+  __inline_mathcode2_ (long double, __CONCAT(func,l), arg1, arg2, code)
+# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
+  __inline_mathcode3_ (double, func, arg1, arg2, arg3, code)		      \
+  __inline_mathcode3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code)	      \
+  __inline_mathcode3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code)
 #else
 # define __inline_mathcode(func, arg, code) \
-  __inline_mathcode_ (double, func, arg, code)
+  __inline_mathcode_ (double, func, (arg), code)
+# define __inline_mathcode2(func, arg1, arg2, code) \
+  __inline_mathcode2_ (double, func, arg1, arg2, code)
+# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
+  __inline_mathcode3_ (double, func, arg1, arg2, arg3, code)
 #endif
 
 #define __inline_mathcode_(float_type, func, arg, code) \
@@ -137,17 +149,6 @@
     code;								      \
   }
 
-
-#if defined __USE_MISC || defined __USE_ISOC9X
-# define __inline_mathcode2(func, arg1, arg2, code)			      \
-  __inline_mathcode2_ (double, func, arg1, arg2, code)			      \
-  __inline_mathcode2_ (float, __CONCAT(func,f), arg1, arg2, code)	      \
-  __inline_mathcode2_ (long double, __CONCAT(func,l), arg1, arg2, code)
-#else
-# define __inline_mathcode2(func, arg1, arg2, code) \
-  __inline_mathcode2_ (double, func, arg1, arg2, code)
-#endif
-
 #define __inline_mathcode2_(float_type, func, arg1, arg2, code) \
   __MATH_INLINE float_type func (float_type, float_type);		      \
   __MATH_INLINE float_type func (float_type arg1, float_type arg2)	      \
@@ -155,6 +156,14 @@
     code;								      \
   }
 
+#define __inline_mathcode3_(float_type, func, arg1, arg2, arg3, code) \
+  __MATH_INLINE float_type func (float_type, float_type, float_type);	      \
+  __MATH_INLINE float_type func (float_type arg1, float_type arg2,	      \
+				 float_type arg3)			      \
+  {									      \
+    code;								      \
+  }
+
 
 /* Miscellaneous functions */
 
@@ -493,6 +502,7 @@ ldexpl (long double __x, int __y)
   __ldexp_code;
 }
 
+__inline_mathcode3 (fma, __x, __y, __z, return (__x * __y) + __z)
 #endif
 
 
diff --git a/sysdeps/libm-i387/e_scalb.S b/sysdeps/libm-i387/e_scalb.S
index 790f1c1d56..b4c23ca595 100644
--- a/sysdeps/libm-i387/e_scalb.S
+++ b/sysdeps/libm-i387/e_scalb.S
@@ -34,7 +34,7 @@ minus_zero:
 #define MOX(op,x,f) op(,x,f)
 #endif
 
-
+	.text
 ENTRY(__ieee754_scalb)
 	fldl	12(%esp)
 	fxam
diff --git a/sysdeps/libm-i387/e_scalbl.S b/sysdeps/libm-i387/e_scalbl.S
index e272614acf..33eb7323dc 100644
--- a/sysdeps/libm-i387/e_scalbl.S
+++ b/sysdeps/libm-i387/e_scalbl.S
@@ -36,7 +36,7 @@ minus_zero:
 #define MOX(op,x,f) op(,x,f)
 #endif
 
-
+	.text
 ENTRY(__ieee754_scalbl)
 	fldt	16(%esp)
 	fxam
diff --git a/sysdeps/libm-i387/s_fma.S b/sysdeps/libm-i387/s_fma.S
index deeac574a7..b472c70a0d 100644
--- a/sysdeps/libm-i387/s_fma.S
+++ b/sysdeps/libm-i387/s_fma.S
@@ -26,7 +26,7 @@ ENTRY(__fma)
 	fldl	12(%esp)	// x : y
 	fmulp			// x * y
 	fldl	20(%esp)	// z : x * y
-	fmulp			// (x * y) + z
+	faddp			// (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
index 726c49d12c..17939a819c 100644
--- a/sysdeps/libm-i387/s_fmaf.S
+++ b/sysdeps/libm-i387/s_fmaf.S
@@ -26,7 +26,7 @@ ENTRY(__fmaf)
 	flds	8(%esp)		// x : y
 	fmulp			// x * y
 	flds	12(%esp)	// z : x * y
-	fmulp			// (x * y) + z
+	faddp			// (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
index be8b557902..c15fca8dab 100644
--- a/sysdeps/libm-i387/s_fmal.S
+++ b/sysdeps/libm-i387/s_fmal.S
@@ -26,7 +26,7 @@ ENTRY(__fmal)
 	fldt	16(%esp)	// x : y
 	fmulp			// x * y
 	fldt	28(%esp)	// z : x * y
-	fmulp			// (x * y) + z
+	faddp			// (x * y) + z
 	ret
 END(__fmal)
 weak_alias (__fmal, fmal)
diff --git a/sysdeps/stub/getsid.c b/sysdeps/stub/getsid.c
index 8d2af8b070..5c65311ce0 100644
--- a/sysdeps/stub/getsid.c
+++ b/sysdeps/stub/getsid.c
@@ -27,3 +27,4 @@ getsid (pid_t pid)
   __set_errno (ENOSYS);
   return (pid_t) -1;
 }
+stub_warning (getsid)
diff --git a/sysdeps/stub/mmap.c b/sysdeps/stub/mmap.c
index 6b557764ee..02fb8d780d 100644
--- a/sysdeps/stub/mmap.c
+++ b/sysdeps/stub/mmap.c
@@ -36,4 +36,5 @@ __mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
   return (caddr_t) -1;
 }
 
+stub_warning (mmap)
 weak_alias (__mmap, mmap)
diff --git a/sysdeps/stub/munmap.c b/sysdeps/stub/munmap.c
index 9c96042c26..4802a58f7f 100644
--- a/sysdeps/stub/munmap.c
+++ b/sysdeps/stub/munmap.c
@@ -30,4 +30,5 @@ __munmap (caddr_t addr, size_t len)
   return -1;
 }
 
+stub_warning (munmap)
 weak_alias (__munmap, munmap)