about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--argp/argp.h2
-rw-r--r--elf/elf.h51
-rw-r--r--stdlib/jrand48_r.c4
-rw-r--r--sysdeps/i386/bits/select.h19
-rw-r--r--sysdeps/i386/bzero.c20
-rw-r--r--sysdeps/i386/memcopy.h42
-rw-r--r--sysdeps/i386/memset.c21
8 files changed, 130 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog
index dab3ad25bc..42f195acee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+1998-08-25 11:43  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf/elf.h: Add syminfo stuff and other DT_* from Solaris' ELF.
+
+1998-08-25  Bernd Schmidt  <crux@Pool.Informatik.RWTH-Aachen.DE>
+
+	* argp/argp.h: Use __inline__ not inline.
+
+	* sysdeps/i386/bits/select.h (FD_ZERO): Rewrite asm not to indicate
+	an input register as being clobbered.
+	* sysdeps/i386/memset.c (memset): Likewise.
+	* sysdeps/i386/bzero.c (__bzero): Likewise.
+	* sysdeps/i386/memcopy.h ({BYTE,WORD}_COPY_[FB]WD): Likewise.
+
+1998-08-25  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* stdlib/jrand48_r.c (__jrand48_r): Set also upper half of result.
+	Fixes PR libc/757 (Reported by Michael Creutz <creutz@bnl.gov).
+
 1998-08-24 16:34  Ulrich Drepper  <drepper@cygnus.com>
 
 	* debug/catchsegv.sh: Handle text preceding backtrace better.
diff --git a/argp/argp.h b/argp/argp.h
index 8b6485e80e..8045e3b456 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -531,7 +531,7 @@ extern void *__argp_input __P ((__const struct argp *argp,
 # endif
 
 # ifndef ARGP_EI
-#  define ARGP_EI extern inline
+#  define ARGP_EI extern __inline__
 # endif
 
 ARGP_EI void
diff --git a/elf/elf.h b/elf/elf.h
index 4557667334..a797cb520b 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -309,6 +309,38 @@ typedef struct
   Elf64_Xword	st_size;		/* Symbol size */
 } Elf64_Sym;
 
+/* The syminfo section if available contains additional information about
+   every dynamic symbol.  */
+
+typedef struct
+{
+  Elf32_Half si_boundto;		/* Direct bindings, symbol bound to */
+  Elf32_Half si_flags;			/* Per symbol flags */
+} Elf32_Syminfo;
+
+typedef struct
+{
+  Elf64_Half si_boundto;		/* Direct bindings, symbol bound to */
+  Elf64_Half si_flags;			/* Per symbol flags */
+} Elf64_Syminfo;
+
+/* Possible values for si_boundto.  */
+#define SYMINFO_BT_SELF		0xffff	/* Symbol bound to self */
+#define SYMINFO_BT_PARENT	0xfffe	/* Symbol bound to parent */
+#define SYMINFO_BT_LOWRESERVE	0xff00	/* Beginning of reserved entries */
+
+/* Possible bitmasks for si_flags.  */
+#define SYMINFO_FLG_DIRECT	0x0001	/* Direct bound symbol */
+#define SYMINFO_FLG_PASSTHRU	0x0002	/* Pass-thru symbol for translator */
+#define SYMINFO_FLG_COPY	0x0004	/* Symbol is a copy-reloc */
+#define SYMINFO_FLG_LAZYLOAD	0x0008	/* Symbol bound to object to be lazy
+					   loaded */
+/* Syminfo version values.  */
+#define SYMINFO_NONE		0
+#define SYMINFO_CURRENT		1
+#define SYMINFO_NUM		2
+
+
 /* Special section index.  */
 
 #define SHN_UNDEF	0		/* No section, undefined symbol.  */
@@ -530,6 +562,25 @@ typedef struct
 #define DT_HIPROC	0x7fffffff	/* End of processor-specific */
 #define	DT_PROCNUM	DT_MIPS_NUM	/* Most used by any processor */
 
+/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
+   Dyn.d_un.d_val field of the Elf*_Dyn structure.  This follows Sun's
+   approach.  */
+#define DT_VALRNGLO	0x6ffffd00
+#define DT_POSFLAG_1	0x6ffffdfd	/* Flags for DT_* entries, effecting
+					   the following DT_* entry.  */
+#define DT_SYMINSZ	0x6ffffdfe	/* Size of syminfo table (in bytes) */
+#define DT_SYMINENT	0x6ffffdff	/* Entry size of syminfo */
+#define DT_VALRNGHI	0x6ffffdff
+
+/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
+   Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
+
+   If any adjustment is made to the ELF object after it has been
+   built these entries will need to be adjusted.  */
+#define DT_ADDRRNGLO	0x6ffffe00
+#define DT_SYMINFO	0x6ffffeff	/* syminfo table */
+#define DT_ADDRRNGHI	0x6ffffeff
+
 /* The versioning entry types.  The next are defined as part of the
    GNU extension.  */
 #define DT_VERSYM	0x6ffffff0
diff --git a/stdlib/jrand48_r.c b/stdlib/jrand48_r.c
index ce4c8b0a95..95f3ec62b2 100644
--- a/stdlib/jrand48_r.c
+++ b/stdlib/jrand48_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -31,7 +31,7 @@ __jrand48_r (xsubi, buffer, result)
 
   /* Store the result.  */
   if (sizeof (unsigned short int) == 2)
-    *result = (xsubi[2] & 0x7fff) | xsubi[1];
+    *result = ((xsubi[2] & 0x7fff) << 16) | xsubi[1];
   else
     *result = xsubi[2] & 0x7fffffffl;
 
diff --git a/sysdeps/i386/bits/select.h b/sysdeps/i386/bits/select.h
index f2ab43ebbb..f21407f81f 100644
--- a/sysdeps/i386/bits/select.h
+++ b/sysdeps/i386/bits/select.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,12 +24,17 @@
 #if defined __GNUC__ && __GNUC__ >= 2
 
 # define __FD_ZERO(fdsetp) \
-  __asm__ __volatile__ ("cld; rep; stosl"				      \
-			: "=m" ((fdsetp)->fds_bits[__FDELT (__FD_SETSIZE)])   \
-			: "a" (0), "c" (sizeof (__fd_set)		      \
-					/ sizeof (__fd_mask)),		      \
-			  "D" (&(fdsetp)->fds_bits[0])			      \
-			:"cx","di","memory")
+  do {									      \
+    int __d0, __d1;							      \
+    __asm__ __volatile__ ("cld; rep; stosl"				      \
+			  : "=m" ((fdsetp)->fds_bits[__FDELT (__FD_SETSIZE)]),\
+			    "=&c" (__d0), "=&D" (__d1)			      \
+			  : "a" (0), "1" (sizeof (__fd_set)		      \
+					  / sizeof (__fd_mask)),	      \
+			    "2" (&(fdsetp)->fds_bits[0])		      \
+			  : "memory");					      \
+  } while (0)
+
 # define __FD_SET(fd, fdsetp) \
   __asm__ __volatile__ ("btsl %1,%0"					      \
 			: "=m" ((fdsetp)->fds_bits[__FDELT (fd)])	      \
diff --git a/sysdeps/i386/bzero.c b/sysdeps/i386/bzero.c
index 99f2352dc6..80574cca6a 100644
--- a/sysdeps/i386/bzero.c
+++ b/sysdeps/i386/bzero.c
@@ -1,6 +1,6 @@
 /* bzero -- set a block of memory to zero.  For Intel 80x86, x>=3.
    This file is part of the GNU C Library.
-   Copyright (C) 1991, 1992, 1993, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1993, 1997, 1998 Free Software Foundation, Inc.
    Contributed by Torbjorn Granlund (tege@sics.se).
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,7 @@ __bzero (dstpp, len)
      size_t len;
 {
   /* N.B.: This code is almost verbatim from memset.c.  */
-
+  int d0;
   unsigned long int dstp = (unsigned long int) dstpp;
 
   /* This explicit register allocation
@@ -55,25 +55,25 @@ __bzero (dstpp, len)
       /* Fill bytes until DSTP is aligned on a longword boundary.  */
       asm volatile ("rep\n"
 		    "stosb" /* %0, %2, %3 */ :
-		    "=D" (dstp) :
-		    "0" (dstp), "c" ((-dstp) % OPSIZ), "a" (x) :
-		    "cx");
+		    "=D" (dstp), "=c" (d0) :
+		    "0" (dstp), "1" ((-dstp) % OPSIZ), "a" (x) :
+		    "memory");
 
       /* Fill longwords.  */
       asm volatile ("rep\n"
 		    "stosl" /* %0, %2, %3 */ :
-		    "=D" (dstp) :
-		    "0" (dstp), "c" (len / OPSIZ), "a" (x) :
-		    "cx");
+		    "=D" (dstp), "=c" (d0) :
+		    "0" (dstp), "1" (len / OPSIZ), "a" (x) :
+		    "memory");
       len %= OPSIZ;
     }
 
   /* Write the last few bytes.  */
   asm volatile ("rep\n"
 		"stosb" /* %0, %2, %3 */ :
-		"=D" (dstp) :
+		"=D" (dstp), "=c" (d0) :
 		"0" (dstp), "c" (len), "a" (x) :
-		"cx");
+		"memory");
 }
 weak_alias (__bzero, bzero)
 
diff --git a/sysdeps/i386/memcopy.h b/sysdeps/i386/memcopy.h
index 576f996957..68ce91e095 100644
--- a/sysdeps/i386/memcopy.h
+++ b/sysdeps/i386/memcopy.h
@@ -1,5 +1,5 @@
 /* memcopy.h -- definitions for memory copy functions.  i386 version.
-   Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Torbjorn Granlund (tege@sics.se).
 
@@ -25,19 +25,23 @@
 
 #undef	BYTE_COPY_FWD
 #define BYTE_COPY_FWD(dst_bp, src_bp, nbytes)				      \
-  asm volatile(/* Clear the direction flag, so copying goes forward.  */      \
-	       "cld\n"							      \
-	       /* Copy bytes.  */					      \
-	       "rep\n"							      \
-	       "movsb" :						      \
-	       "=D" (dst_bp), "=S" (src_bp) :				      \
-	       "0" (dst_bp), "1" (src_bp), "c" (nbytes) :		      \
-	       "cx")
+  do {									      \
+    int __d0;								      \
+    asm volatile(/* Clear the direction flag, so copying goes forward.  */    \
+		 "cld\n"						      \
+		 /* Copy bytes.  */					      \
+		 "rep\n"						      \
+		 "movsb" :						      \
+		 "=D" (dst_bp), "=S" (src_bp), "=c" (__d0) :		      \
+		 "0" (dst_bp), "1" (src_bp), "2" (nbytes) :		      \
+		 "memory");						      \
+  } while (0)
 
 #undef	BYTE_COPY_BWD
 #define BYTE_COPY_BWD(dst_ep, src_ep, nbytes)				      \
   do									      \
     {									      \
+      int __d0;								      \
       asm volatile(/* Set the direction flag, so copying goes backwards.  */  \
 		   "std\n"						      \
 		   /* Copy bytes.  */					      \
@@ -45,9 +49,9 @@
 		   "movsb\n"						      \
 		   /* Clear the dir flag.  Convention says it should be 0. */ \
 		   "cld" :						      \
-		   "=D" (dst_ep), "=S" (src_ep) :			      \
-		   "0" (dst_ep - 1), "1" (src_ep - 1), "c" (nbytes) :	      \
-		   "cx");						      \
+		   "=D" (dst_ep), "=S" (src_ep), "=c" (__d0) :		      \
+		   "0" (dst_ep - 1), "1" (src_ep - 1), "2" (nbytes) :	      \
+		   "memory");						      \
       dst_ep += 1;							      \
       src_ep += 1;							      \
     } while (0)
@@ -56,14 +60,15 @@
 #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes)		      \
   do									      \
     {									      \
+      int __d0;								      \
       asm volatile(/* Clear the direction flag, so copying goes forward.  */  \
 		   "cld\n"						      \
 		   /* Copy longwords.  */				      \
 		   "rep\n"						      \
 		   "movsl" :						      \
-		   "=D" (dst_bp), "=S" (src_bp) :			      \
-		   "0" (dst_bp), "1" (src_bp), "c" ((nbytes) / 4) :	      \
-		   "cx");						      \
+ 		   "=D" (dst_bp), "=S" (src_bp), "=c" (__d0) :		      \
+		   "0" (dst_bp), "1" (src_bp), "2" ((nbytes) / 4) :	      \
+		   "memory");						      \
       (nbytes_left) = (nbytes) % 4;					      \
     } while (0)
 
@@ -71,6 +76,7 @@
 #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes)		      \
   do									      \
     {									      \
+      int __d0;								      \
       asm volatile(/* Set the direction flag, so copying goes backwards.  */  \
 		   "std\n"						      \
 		   /* Copy longwords.  */				      \
@@ -78,9 +84,9 @@
 		   "movsl\n"						      \
 		   /* Clear the dir flag.  Convention says it should be 0. */ \
 		   "cld" :						      \
-		   "=D" (dst_ep), "=S" (src_ep) :			      \
-		   "0" (dst_ep - 4), "1" (src_ep - 4), "c" ((nbytes) / 4) :   \
-		   "cx");						      \
+		   "=D" (dst_ep), "=S" (src_ep), "=c" (__d0) :		      \
+		   "0" (dst_ep - 4), "1" (src_ep - 4), "2" ((nbytes) / 4) :   \
+		   "memory");						      \
       dst_ep += 4;							      \
       src_ep += 4;							      \
       (nbytes_left) = (nbytes) % 4;					      \
diff --git a/sysdeps/i386/memset.c b/sysdeps/i386/memset.c
index 0cb6578df6..e7a8bc6d73 100644
--- a/sysdeps/i386/memset.c
+++ b/sysdeps/i386/memset.c
@@ -1,6 +1,6 @@
 /* Set a block of memory to some byte value.
    For Intel 80x86, x>=3.
-   Copyright (C) 1991, 1992, 1993, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1993, 1997, 1998 Free Software Foundation, Inc.
    Contributed by Torbjorn Granlund (tege@sics.se).
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,6 +28,7 @@
 void *
 memset (void *dstpp, int c, size_t len)
 {
+  int d0;
   unsigned long int dstp = (unsigned long int) dstpp;
 
   /* This explicit register allocation
@@ -55,25 +56,25 @@ memset (void *dstpp, int c, size_t len)
       /* Fill bytes until DSTP is aligned on a longword boundary.  */
       asm volatile("rep\n"
 		   "stosb" /* %0, %2, %3 */ :
-		   "=D" (dstp) :
-		   "0" (dstp), "c" ((-dstp) % OPSIZ), "a" (x) :
-		   "cx");
+		   "=D" (dstp), "=c" (d0) :
+		   "0" (dstp), "1" ((-dstp) % OPSIZ), "a" (x) :
+		   "memory");
 
       /* Fill longwords.  */
       asm volatile("rep\n"
 		   "stosl" /* %0, %2, %3 */ :
-		   "=D" (dstp) :
-		   "0" (dstp), "c" (len / OPSIZ), "a" (x) :
-		   "cx");
+		   "=D" (dstp), "=c" (d0) :
+		   "0" (dstp), "1" (len / OPSIZ), "a" (x) :
+		   "memory");
       len %= OPSIZ;
     }
 
   /* Write the last few bytes.  */
   asm volatile("rep\n"
 	       "stosb" /* %0, %2, %3 */ :
-	       "=D" (dstp) :
-	       "0" (dstp), "c" (len), "a" (x) :
-	       "cx");
+	       "=D" (dstp), "=c" (d0) :
+	       "0" (dstp), "1" (len), "a" (x) :
+	       "memory");
 
   return dstpp;
 }