about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog67
-rw-r--r--Makerules2
-rw-r--r--csu/initfini.c1
-rw-r--r--elf/elf.h18
-rw-r--r--libio/Versions6
-rw-r--r--libio/fileops.c77
-rw-r--r--libio/libioP.h16
-rw-r--r--libio/oldfileops.c13
-rw-r--r--libio/vsnprintf.c1
-rw-r--r--math/atest-exp.c8
-rw-r--r--math/atest-exp2.c8
-rw-r--r--math/atest-sincos.c14
-rw-r--r--sysdeps/unix/sysv/linux/i386/Versions3
-rw-r--r--sysdeps/unix/sysv/linux/i386/i686/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h4
16 files changed, 194 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index f671589ef7..107d0d1c97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,69 @@
-1998-08-23  Ricahrd Henderson  <rth@cygnus.com>
+1998-08-23  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/unix/sysv/linux/i386/Versions [GLIBC_2.1]: Add
+	__modify_ldt and modify_ldt.
+	* sysdeps/unix/sysv/linux/i386/syscalls.list: Add modify_ldt.
+
+	* sysdeps/unix/sysv/linux/i386/sysdep.h (SYSCALL_ERROR_HANDLER):
+	Use orl $-1 instead of movl $-1 to save two bytes.
+	* sysdeps/unix/sysv/linux/i386/i686/sysdep.h (SYSCALL_ERROR_HANDLER):
+	Likewise.
+
+1998-08-17  H.J. Lu  <hjl@gnu.org>
+ 
+	* libio/Versions (_IO_do_write, _IO_file_attach, 
+	_IO_file_close_it, _IO_file_finish, _IO_file_fopen, 
+	_IO_file_init, _IO_file_overflow, _IO_file_seekoff, 
+	_IO_file_setbuf, _IO_file_sync, _IO_file_underflow, 
+	_IO_file_write, _IO_file_xsputn): Added to GLIBC_2.1. 
+
+	* libio/fileops.c (_IO_do_write, _IO_file_attach, 
+	_IO_file_close_it, _IO_file_finish, _IO_file_fopen, 
+	_IO_file_init, _IO_file_overflow, _IO_file_seekoff, 
+	_IO_file_setbuf, _IO_file_sync, _IO_file_underflow, 
+	_IO_file_write, _IO_file_xsputn): Change the prefix to 
+	"_IO_new_". Added to GLIBC_2.1. 
+ 
+	* libio/libioP.h (_IO_do_write, _IO_file_attach, 
+	_IO_file_close_it, _IO_file_finish, _IO_file_fopen, 
+	_IO_file_init, _IO_file_overflow, _IO_file_seekoff, 
+	_IO_file_setbuf, _IO_file_sync, _IO_file_underflow, 
+	_IO_file_write, _IO_file_xsputn): Add prototypes for the prefix 
+	"_IO_new_". 
+ 
+	* libio/oldfileops.c (_IO_do_write, _IO_file_attach, 
+	_IO_file_close_it, _IO_file_finish, _IO_file_fopen, 
+	_IO_file_init, _IO_file_overflow, _IO_file_seekoff, 
+	_IO_file_setbuf, _IO_file_sync, _IO_file_underflow, 
+	_IO_file_write, _IO_file_xsputn): Added to GLIBC_2.0. 
+ 
+1998-08-23  Richard Henderson  <rth@cygnus.com>
+
+	* Makeconfig (LDFLAGS): Remove.
+
+	* csu/initfini.c: Return to .text before __gmon_start__. 
+
+	* elf/elf.h (EM_FAKE_ALPHA): Rename from EM_OLD_ALPHA. 
+	(STO_MIPS_*): Rename from STO_*. 
+	(STB_MIPS_SPLIT_COMMON): Rename from STB_SPLIT_COMMON. 
+	(STO_ALPHA_NOPV, STO_ALPHA_STD_GPLOAD): New. 
+
+	* math/atest-exp.c (mpn_bitsize): Fix bit location calculation. 
+	(main): e3s is negative on zero. 
+	* math/atest-exp2.c: Likewise. 
+	* math/atest-sincos.c: Likewise.
+
+1998-08-23  Andreas Jaeger  <aj@arthur.rhein-neckar.de> 
+ 
+	* Makerules (install): Add comment about absolute paths. 
+ 
+1998-08-23  Ulrich Drepper  <drepper@cygnus.com>
+
+	* libio/vsnprintf.c (_IO_vsnprintf): Set first byte of destination
+	array to NUL to handle maxlen==1 case correctly.
+	Patch by HJ Lu.
+
+1998-08-23  Richard Henderson  <rth@cygnus.com>
 
 	* sysdeps/alpha/elf/crtbegin.S: Fix .prologue; no pv used.
 	* sysdeps/alpha/elf/crtend.S: Likewise.
diff --git a/Makerules b/Makerules
index d8fe9775f1..c17ea781b9 100644
--- a/Makerules
+++ b/Makerules
@@ -688,6 +688,8 @@ ifndef subdir
 # link script.  It contains references for the various libraries we need.
 # The libc.so object is not complete since some functions are only defined
 # in libc_nonshared.a.
+# We need to use absolute paths since otherwise local copies (if they exist)  
+# of the files are taken by the linker. 
 install: $(inst_libdir)/libc.so
 $(inst_libdir)/libc.so: $(common-objpfx)libc.so$(libc.so-version) \
 			$(inst_libdir)/$(patsubst %,$(libtype.oS),\
diff --git a/csu/initfini.c b/csu/initfini.c
index b05d36ae9a..1f74f203a3 100644
--- a/csu/initfini.c
+++ b/csu/initfini.c
@@ -83,6 +83,7 @@ _init (void)
   SECTION(".init");
 }
 asm ("END_INIT");
+SECTION(".text");
 
 /* This version of __gmon_start__ is used if no other is found.  By providing
    a default function we avoid the need to test whether the pointer is NULL,
diff --git a/elf/elf.h b/elf/elf.h
index dfcadf3cf2..4557667334 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -184,7 +184,7 @@ typedef struct
 #define EM_RH32		38		/* TRW RH32 */
 #define EM_MMA		39		/* Fujitsu MMA */
 #define EM_ARM		40		/* ARM */
-#define EM_OLD_ALPHA	41		/* Digital Alpha */
+#define EM_FAKE_ALPHA	41		/* Digital Alpha */
 #define EM_SH		42		/* Hitachi SH */
 #define EM_SPARCV9	43		/* SPARC v9 64-bit */
 #define EM_TRICORE	44		/* Siemens Tricore */
@@ -1006,14 +1006,14 @@ typedef struct
 /* Symbol tables.  */
 
 /* MIPS specific values for `st_other'.  */
-#define STO_DEFAULT		0x0
-#define STO_INTERNAL		0x1
-#define STO_HIDDEN		0x2
-#define STO_PROTECTED		0x3
-#define STO_SC_ALIGN_UNUSED	0xff
+#define STO_MIPS_DEFAULT		0x0
+#define STO_MIPS_INTERNAL		0x1
+#define STO_MIPS_HIDDEN			0x2
+#define STO_MIPS_PROTECTED		0x3
+#define STO_MIPS_SC_ALIGN_UNUSED	0xff
 
 /* MIPS specific values for `st_info'.  */
-#define STB_SPLIT_COMMON	13
+#define STB_MIPS_SPLIT_COMMON		13
 
 /* Entries found in sections of type SHT_MIPS_GPTAB.  */
 
@@ -1306,6 +1306,10 @@ typedef Elf32_Addr Elf32_Conflict;
 
 #define SHF_ALPHA_GPREL		0x10000000
 
+/* Legal values for st_other field of Elf64_Sym.  */
+#define STO_ALPHA_NOPV		0x80	/* No PV required.  */
+#define STO_ALPHA_STD_GPLOAD	0x88	/* PV only used for initial ldgp.  */
+
 /* Alpha relocs.  */
 
 #define R_ALPHA_NONE		0	/* No reloc */
diff --git a/libio/Versions b/libio/Versions
index 7cc09454c3..c9d74d3773 100644
--- a/libio/Versions
+++ b/libio/Versions
@@ -83,6 +83,12 @@ libc {
     # functions used in other libraries
     _IO_fclose; _IO_fopen; _IO_fdopen; __asprintf;
 
+    # functions used in libstdc++
+    _IO_do_write; _IO_file_attach; _IO_file_close_it; _IO_file_finish;
+    _IO_file_fopen; _IO_file_init; _IO_file_overflow; _IO_file_seekoff;
+    _IO_file_setbuf; _IO_file_sync; _IO_file_underflow;
+    _IO_file_write; _IO_file_xsputn;
+
     # Changed getline function in libio.
     _IO_getline_info;
 
diff --git a/libio/fileops.c b/libio/fileops.c
index 5a5f9d9db2..a2017f23bc 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -105,7 +105,7 @@ extern int errno;
 
 
 void
-_IO_file_init (fp)
+_IO_new_file_init (fp)
      _IO_FILE *fp;
 {
   /* POSIX.1 allows another file handle to be used to change the position
@@ -119,7 +119,7 @@ _IO_file_init (fp)
 }
 
 int
-_IO_file_close_it (fp)
+_IO_new_file_close_it (fp)
      _IO_FILE *fp;
 {
   int write_status, close_status;
@@ -146,7 +146,7 @@ _IO_file_close_it (fp)
 }
 
 void
-_IO_file_finish (fp, dummy)
+_IO_new_file_finish (fp, dummy)
      _IO_FILE *fp;
      int dummy;
 {
@@ -192,7 +192,7 @@ _IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64)
 }
 
 _IO_FILE *
-_IO_file_fopen (fp, filename, mode, is32not64)
+_IO_new_file_fopen (fp, filename, mode, is32not64)
      _IO_FILE *fp;
      const char *filename;
      const char *mode;
@@ -250,7 +250,7 @@ _IO_file_fopen (fp, filename, mode, is32not64)
 }
 
 _IO_FILE *
-_IO_file_attach (fp, fd)
+_IO_new_file_attach (fp, fd)
      _IO_FILE *fp;
      int fd;
 {
@@ -269,7 +269,7 @@ _IO_file_attach (fp, fd)
 }
 
 _IO_FILE *
-_IO_file_setbuf (fp, p, len)
+_IO_new_file_setbuf (fp, p, len)
      _IO_FILE *fp;
      char *p;
      _IO_ssize_t len;
@@ -288,7 +288,7 @@ _IO_file_setbuf (fp, p, len)
    Then mark FP as having empty buffers. */
 
 int
-_IO_do_write (fp, data, to_do)
+_IO_new_do_write (fp, data, to_do)
      _IO_FILE *fp;
      const char *data;
      _IO_size_t to_do;
@@ -322,7 +322,7 @@ _IO_do_write (fp, data, to_do)
 }
 
 int
-_IO_file_underflow (fp)
+_IO_new_file_underflow (fp)
      _IO_FILE *fp;
 {
   _IO_ssize_t count;
@@ -377,7 +377,7 @@ _IO_file_underflow (fp)
 }
 
 int
-_IO_file_overflow (f, ch)
+_IO_new_file_overflow (f, ch)
       _IO_FILE *f;
       int ch;
 {
@@ -428,7 +428,7 @@ _IO_file_overflow (f, ch)
 }
 
 int
-_IO_file_sync (fp)
+_IO_new_file_sync (fp)
      _IO_FILE *fp;
 {
   _IO_ssize_t delta;
@@ -462,7 +462,7 @@ _IO_file_sync (fp)
 }
 
 _IO_fpos64_t
-_IO_file_seekoff (fp, offset, dir, mode)
+_IO_new_file_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
      _IO_off64_t offset;
      int dir;
@@ -664,7 +664,7 @@ _IO_file_close (fp)
 }
 
 _IO_ssize_t
-_IO_file_write (f, data, n)
+_IO_new_file_write (f, data, n)
      _IO_FILE *f;
      const void *data;
      _IO_ssize_t n;
@@ -688,7 +688,7 @@ _IO_file_write (f, data, n)
 }
 
 _IO_size_t
-_IO_file_xsputn (f, data, n)
+_IO_new_file_xsputn (f, data, n)
      _IO_FILE *f;
      const void *data;
      _IO_size_t n;
@@ -761,7 +761,7 @@ _IO_file_xsputn (f, data, n)
       dont_write = block_size >= 128 ? to_do % block_size : 0;
 
       count = to_do - dont_write;
-      if (_IO_do_write (f, s, count) == EOF)
+      if (_IO_new_do_write (f, s, count) == EOF)
 	return n - to_do;
       to_do = dont_write;
 
@@ -865,23 +865,56 @@ _IO_file_xsgetn (fp, data, n)
 struct _IO_jump_t _IO_file_jumps =
 {
   JUMP_INIT_DUMMY,
-  JUMP_INIT(finish, _IO_file_finish),
-  JUMP_INIT(overflow, _IO_file_overflow),
-  JUMP_INIT(underflow, _IO_file_underflow),
+  JUMP_INIT(finish, _IO_new_file_finish),
+  JUMP_INIT(overflow, _IO_new_file_overflow),
+  JUMP_INIT(underflow, _IO_new_file_underflow),
   JUMP_INIT(uflow, _IO_default_uflow),
   JUMP_INIT(pbackfail, _IO_default_pbackfail),
-  JUMP_INIT(xsputn, _IO_file_xsputn),
+  JUMP_INIT(xsputn, _IO_new_file_xsputn),
   JUMP_INIT(xsgetn, _IO_file_xsgetn),
-  JUMP_INIT(seekoff, _IO_file_seekoff),
+  JUMP_INIT(seekoff, _IO_new_file_seekoff),
   JUMP_INIT(seekpos, _IO_default_seekpos),
-  JUMP_INIT(setbuf, _IO_file_setbuf),
-  JUMP_INIT(sync, _IO_file_sync),
+  JUMP_INIT(setbuf, _IO_new_file_setbuf),
+  JUMP_INIT(sync, _IO_new_file_sync),
   JUMP_INIT(doallocate, _IO_file_doallocate),
   JUMP_INIT(read, _IO_file_read),
-  JUMP_INIT(write, _IO_file_write),
+  JUMP_INIT(write, _IO_new_file_write),
   JUMP_INIT(seek, _IO_file_seek),
   JUMP_INIT(close, _IO_file_close),
   JUMP_INIT(stat, _IO_file_stat),
   JUMP_INIT(showmanyc, _IO_default_showmanyc),
   JUMP_INIT(imbue, _IO_default_imbue)
 };
+
+
+#if defined PIC && DO_VERSIONING
+default_symbol_version (_IO_new_do_write, _IO_do_write, GLIBC_2.1);
+default_symbol_version (_IO_new_file_attach, _IO_file_attach, GLIBC_2.1);
+default_symbol_version (_IO_new_file_close_it, _IO_file_close_it, GLIBC_2.1);
+default_symbol_version (_IO_new_file_finish, _IO_file_finish, GLIBC_2.1);
+default_symbol_version (_IO_new_file_fopen, _IO_file_fopen, GLIBC_2.1);
+default_symbol_version (_IO_new_file_init, _IO_file_init, GLIBC_2.1);
+default_symbol_version (_IO_new_file_setbuf, _IO_file_setbuf, GLIBC_2.1);
+default_symbol_version (_IO_new_file_sync, _IO_file_sync, GLIBC_2.1);
+default_symbol_version (_IO_new_file_overflow, _IO_file_overflow, GLIBC_2.1);
+default_symbol_version (_IO_new_file_seekoff, _IO_file_seekoff, GLIBC_2.1);
+default_symbol_version (_IO_new_file_underflow, _IO_file_underflow, GLIBC_2.1);
+default_symbol_version (_IO_new_file_write, _IO_file_write, GLIBC_2.1);
+default_symbol_version (_IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2.1);
+#else
+# ifdef strong_alias
+strong_alias (_IO_new_do_write, _IO_do_write);
+strong_alias (_IO_new_file_attach, _IO_file_attach);
+strong_alias (_IO_new_file_close_it, _IO_file_close_it);
+strong_alias (_IO_new_file_finish, _IO_file_finish);
+strong_alias (_IO_new_file_fopen, _IO_file_fopen);
+strong_alias (_IO_new_file_init, _IO_file_init);
+strong_alias (_IO_new_file_setbuf, _IO_file_setbuf);
+strong_alias (_IO_new_file_sync, _IO_file_sync);
+strong_alias (_IO_new_file_overflow, _IO_file_overflow);
+strong_alias (_IO_new_file_seekoff, _IO_file_seekoff);
+strong_alias (_IO_new_file_underflow, _IO_file_underflow);
+strong_alias (_IO_new_file_write, _IO_file_write);
+strong_alias (_IO_new_file_xsputn, _IO_file_xsputn);
+# endif
+#endif
diff --git a/libio/libioP.h b/libio/libioP.h
index 004c95ab8d..bf5638fb19 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -340,6 +340,7 @@ 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_new_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 int _IO_cleanup __P ((void));
@@ -389,6 +390,21 @@ 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_new_file_attach __P ((_IO_FILE *, int));
+extern int _IO_new_file_close_it __P ((_IO_FILE *));
+extern void _IO_new_file_finish __P ((_IO_FILE *, int));
+extern _IO_FILE* _IO_new_file_fopen __P ((_IO_FILE *, const char *, const char *,
+					  int));
+extern void _IO_new_file_init __P ((_IO_FILE *));
+extern _IO_FILE* _IO_new_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
+extern int _IO_new_file_sync __P ((_IO_FILE *));
+extern int _IO_new_file_underflow __P ((_IO_FILE *));
+extern int _IO_new_file_overflow __P ((_IO_FILE *, int));
+extern _IO_fpos64_t _IO_new_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_ssize_t _IO_new_file_write __P ((_IO_FILE *, const void *,
+					    _IO_ssize_t));
+extern _IO_size_t _IO_new_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
+
 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));
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index ae710b1539..59de8d8818 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -721,5 +721,18 @@ struct _IO_jump_t _IO_old_file_jumps =
   JUMP_INIT(stat, _IO_file_stat)
 };
 
+symbol_version (_IO_old_do_write, _IO_do_write, GLIBC_2.0);
+symbol_version (_IO_old_file_attach, _IO_file_attach, GLIBC_2.0);
+symbol_version (_IO_old_file_close_it, _IO_file_close_it, GLIBC_2.0);
+symbol_version (_IO_old_file_finish, _IO_file_finish, GLIBC_2.0);
+symbol_version (_IO_old_file_fopen, _IO_file_fopen, GLIBC_2.0);
+symbol_version (_IO_old_file_init, _IO_file_init, GLIBC_2.0);
+symbol_version (_IO_old_file_setbuf, _IO_file_setbuf, GLIBC_2.0);
+symbol_version (_IO_old_file_sync, _IO_file_sync, GLIBC_2.0);
+symbol_version (_IO_old_file_overflow, _IO_file_overflow, GLIBC_2.0);
+symbol_version (_IO_old_file_seekoff, _IO_file_seekoff, GLIBC_2.0);
+symbol_version (_IO_old_file_underflow, _IO_file_underflow, GLIBC_2.0);
+symbol_version (_IO_old_file_write, _IO_file_write, GLIBC_2.0);
+symbol_version (_IO_old_file_xsputn, _IO_file_xsputn, GLIBC_2.0);
 
 #endif /* PIC && DO_VERSIONING */
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index 5ac2317579..e223e5dec2 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -124,6 +124,7 @@ _IO_vsnprintf (string, maxlen, format, args)
 
   _IO_init ((_IO_FILE *) &sf, 0);
   _IO_JUMPS ((_IO_FILE *) &sf) = &_IO_strn_jumps;
+  string[0] = '\0';
   _IO_str_init_static ((_IO_FILE *) &sf, string, maxlen - 1, string);
   ret = _IO_vfprintf ((_IO_FILE *) &sf, format, args);
 
diff --git a/math/atest-exp.c b/math/atest-exp.c
index 4cab953e46..4aef38d50e 100644
--- a/math/atest-exp.c
+++ b/math/atest-exp.c
@@ -96,11 +96,11 @@ mpn_bitsize(const mp_limb_t *SRC_PTR, mp_size_t SIZE)
    for (i = SIZE - 1; i > 0; i--)
      if (SRC_PTR[i] != 0)
        break;
-   for (j = mpbpl - 1; j > 0; j--)
-     if ((SRC_PTR[i] & 1 << j) != 0)
+   for (j = mpbpl - 1; j >= 0; j--)
+     if ((SRC_PTR[i] & (mp_limb_t)1 << j) != 0)
        break;
 
-   return i * 32 + j;
+   return i * mpbpl + j;
 }
 
 int
@@ -141,7 +141,7 @@ main (void)
 
       e2s = mpn_bitsize (e2,SZ);
       e3s = mpn_bitsize (e3,SZ);
-      if (e3s > 1 && e2s - e3s < 54)
+      if (e3s >= 0 && e2s - e3s < 54)
 	{
 #if PRINT_ERRORS
 	  printf ("%06x ", i * (0x100000 / (1 << N2)));
diff --git a/math/atest-exp2.c b/math/atest-exp2.c
index 7243944c66..059e4ccf02 100644
--- a/math/atest-exp2.c
+++ b/math/atest-exp2.c
@@ -147,11 +147,11 @@ mpn_bitsize(const mp_limb_t *SRC_PTR, mp_size_t SIZE)
   for (i = SIZE - 1; i > 0; --i)
     if (SRC_PTR[i] != 0)
       break;
-  for (j = mpbpl - 1; j > 0; --j)
-    if ((SRC_PTR[i] & 1 << j) != 0)
+  for (j = mpbpl - 1; j >= 0; --j)
+    if ((SRC_PTR[i] & (mp_limb_t)1 << j) != 0)
       break;
 
-  return i * 32 + j;
+  return i * mpbpl + j;
 }
 
 int
@@ -192,7 +192,7 @@ main (void)
 
       e2s = mpn_bitsize (e2, SZ);
       e3s = mpn_bitsize (e3, SZ);
-      if (e3s > 1 && e2s - e3s < 54)
+      if (e3s >= 0 && e2s - e3s < 54)
 	{
 #if PRINT_ERRORS
 	  printf ("%06x ", i * (0x100000 / (1 << N2)));
diff --git a/math/atest-sincos.c b/math/atest-sincos.c
index 2f4187c9c0..4dbbffb9ca 100644
--- a/math/atest-sincos.c
+++ b/math/atest-sincos.c
@@ -132,11 +132,11 @@ mpn_bitsize (const mp_limb_t *SRC_PTR, mp_size_t SIZE)
    for (i = SIZE - 1; i > 0; i--)
      if (SRC_PTR[i] != 0)
        break;
-   for (j = mpbpl - 1; j > 0; j--)
-     if ((SRC_PTR[i] & 1 << j) != 0)
+   for (j = mpbpl - 1; j >= 0; j--)
+     if ((SRC_PTR[i] & (mp_limb_t)1 << j) != 0)
        break;
 
-   return i * 32 + j;
+   return i * mpbpl + j;
 }
 
 int
@@ -188,8 +188,8 @@ main (void)
       s3s = mpn_bitsize (s3, SZ);
       c2s = mpn_bitsize (c2, SZ);
       c3s = mpn_bitsize (c3, SZ);
-      if (s3s > 1 && s2s - s3s < 54
-	  || c3s > 1 && c2s - c3s < 54
+      if (s3s >= 0 && s2s - s3s < 54
+	  || c3s >= 0 && c2s - c3s < 54
 	  || 0)
 	{
 #if PRINT_ERRORS
@@ -204,8 +204,8 @@ main (void)
 	  print_mpn_hex (c2, (FRAC / 4) + 1);
 	  putchar ('\n');
 	  printf (" %c%c    ",
-		  s2s-s3s < 54 ? s2s - s3s == 53 ? 'e' : 'F' : 'P',
-		  c2s-c3s < 54 ? c2s - c3s == 53 ? 'e' : 'F' : 'P');
+		  s3s >= 0 && s2s-s3s < 54 ? s2s - s3s == 53 ? 'e' : 'F' : 'P',
+		  c3s >= 0 && c2s-c3s < 54 ? c2s - c3s == 53 ? 'e' : 'F' : 'P');
 	  print_mpn_hex (s3, (FRAC / 4) + 1);
 	  putchar (' ');
 	  print_mpn_hex (c3, (FRAC / 4) + 1);
diff --git a/sysdeps/unix/sysv/linux/i386/Versions b/sysdeps/unix/sysv/linux/i386/Versions
index 1ec868a57c..87b0167a15 100644
--- a/sysdeps/unix/sysv/linux/i386/Versions
+++ b/sysdeps/unix/sysv/linux/i386/Versions
@@ -4,4 +4,7 @@ libc {
 
     vm86;
   }
+  GLIBC_2.1 {
+    __modify_ldt; modify_ldt;
+  }
 }
diff --git a/sysdeps/unix/sysv/linux/i386/i686/sysdep.h b/sysdeps/unix/sysv/linux/i386/i686/sysdep.h
index 3f1391f8a4..4a4ee9361b 100644
--- a/sysdeps/unix/sysv/linux/i386/i686/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/i686/sysdep.h
@@ -43,7 +43,7 @@
   popl %ecx;								      \
   popl %ebx;								      \
   movl %ecx, (%eax);							      \
-  movl $-1, %eax;							      \
+  orl $-1, %eax;							      \
   jmp L(pseudo_end);
 /* A quick note: it is assumed that the call to `__errno_location' does
    not modify the stack!  */
@@ -58,7 +58,7 @@
   subl %eax, %edx;							      \
   movl errno@GOT(%ecx), %ecx;						      \
   movl %edx, (%ecx);							      \
-  movl $-1, %eax;							      \
+  orl $-1, %eax;							      \
   jmp L(pseudo_end);
 # endif	/* _LIBC_REENTRANT */
 #endif	/* PIC */
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index a66ccc0a12..2c167b9bdd 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -1,5 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
+modify_ldt	EXTRA	modify_ldt	3	__modify_ldt	modify_ldt
 s_chown		chown	chown		3	__syscall_chown
 s_getgroups	getgroups getgroups	2	__syscall_getgroups
 s_llseek	llseek	_llseek		5	__sys_llseek
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 8c046efed7..f9c70f410f 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -86,7 +86,7 @@
   popl %ecx;								      \
   popl %ebx;								      \
   movl %ecx, (%eax);							      \
-  movl $-1, %eax;							      \
+  orl $-1, %eax;							      \
   jmp L(pseudo_end);
 /* A quick note: it is assumed that the call to `__errno_location' does
    not modify the stack!  */
@@ -99,7 +99,7 @@
   subl %eax, %edx;							      \
   movl errno@GOT(%ecx), %ecx;						      \
   movl %edx, (%ecx);							      \
-  movl $-1, %eax;							      \
+  orl $-1, %eax;							      \
   jmp L(pseudo_end);
 #endif	/* _LIBC_REENTRANT */
 #endif	/* PIC */