Browse Source

Patch from David McCullough <davidm@lineo.com>:

* reduce the sigset types to 32 bits (I've mentioned this before)
  I think I saw this change go in for another platform anyway ;-)

* Do not use _IO_FILE as it clashes with the C++ libraries which know
  too much about how glibc workds :-(

* Do not use _G_va_list for the same reason.

* remove the CTORS/DTORS from crt0.S for ARM as the compiler provided
  crtbegin.o and crtend.o have these (and only these) already in them and
  you get multiple defined errs :-(
Eric Andersen 23 years ago
parent
commit
0ee72c0b15

+ 16 - 15
include/stdio.h

@@ -46,14 +46,15 @@ __BEGIN_DECLS
 
 
 /* when you add or change fields here, be sure to change the initialization
 /* when you add or change fields here, be sure to change the initialization
  * in stdio_init and fopen */
  * in stdio_init and fopen */
-struct _IO_FILE {
+
+struct _UC_FILE {
   unsigned char *bufpos;   /* the next byte to write to or read from */
   unsigned char *bufpos;   /* the next byte to write to or read from */
   unsigned char *bufread;  /* the end of data returned by last read() */
   unsigned char *bufread;  /* the end of data returned by last read() */
   unsigned char *bufwrite; /* 1 + highest address writable by macro */
   unsigned char *bufwrite; /* 1 + highest address writable by macro */
   unsigned char *bufstart; /* the start of the buffer */
   unsigned char *bufstart; /* the start of the buffer */
   unsigned char *bufend;   /* the end of the buffer; ie the byte after the last
   unsigned char *bufend;   /* the end of the buffer; ie the byte after the last
                               malloc()ed byte */
                               malloc()ed byte */
-  struct _IO_FILE * next;
+  struct _UC_FILE * next;
 
 
   int fd; /* the file descriptor associated with the stream */
   int fd; /* the file descriptor associated with the stream */
 
 
@@ -61,7 +62,8 @@ struct _IO_FILE {
   unsigned char ungot;
   unsigned char ungot;
   char unbuf[2];	   /* The buffer for 'unbuffered' streams */
   char unbuf[2];	   /* The buffer for 'unbuffered' streams */
 };
 };
-typedef struct _IO_FILE FILE;
+
+typedef struct _UC_FILE FILE;
 
 
 # define __FILE_defined	1
 # define __FILE_defined	1
 #endif /* FILE not defined.  */
 #endif /* FILE not defined.  */
@@ -71,7 +73,7 @@ typedef struct _IO_FILE FILE;
 #if !defined ____FILE_defined && defined __need___FILE
 #if !defined ____FILE_defined && defined __need___FILE
 
 
 /* The opaque type of streams.  This is the definition used elsewhere.  */
 /* The opaque type of streams.  This is the definition used elsewhere.  */
-typedef struct _IO_FILE __FILE;
+typedef struct _UC_FILE __FILE;
 
 
 # define ____FILE_defined	1
 # define ____FILE_defined	1
 #endif /* __FILE not defined.  */
 #endif /* __FILE not defined.  */
@@ -82,7 +84,6 @@ typedef struct _IO_FILE __FILE;
 #undef _STDIO_USES_IOSTREAM
 #undef _STDIO_USES_IOSTREAM
 
 
 #include <stdarg.h>
 #include <stdarg.h>
-typedef va_list _G_va_list;
 
 
 /* The type of the second argument to `fgetpos' and `fsetpos'.  */
 /* The type of the second argument to `fgetpos' and `fsetpos'.  */
 #ifndef __USE_FILE_OFFSET64
 #ifndef __USE_FILE_OFFSET64
@@ -300,13 +301,13 @@ extern int sprintf (char *__restrict __s,
 
 
 /* Write formatted output to S from argument list ARG.  */
 /* Write formatted output to S from argument list ARG.  */
 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
-		     _G_va_list __arg) __THROW;
+		     va_list __arg) __THROW;
 /* Write formatted output to stdout from argument list ARG.  */
 /* Write formatted output to stdout from argument list ARG.  */
-extern int vprintf (__const char *__restrict __format, _G_va_list __arg)
+extern int vprintf (__const char *__restrict __format, va_list __arg)
      __THROW;
      __THROW;
 /* Write formatted output to S from argument list ARG.  */
 /* Write formatted output to S from argument list ARG.  */
 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
-		     _G_va_list __arg) __THROW;
+		     va_list __arg) __THROW;
 
 
 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
 /* Maximum chars of output to write in MAXLEN.  */
 /* Maximum chars of output to write in MAXLEN.  */
@@ -315,7 +316,7 @@ extern int snprintf (char *__restrict __s, size_t __maxlen,
      __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
      __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
 
 
 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
-		      __const char *__restrict __format, _G_va_list __arg)
+		      __const char *__restrict __format, va_list __arg)
      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
 #endif
 #endif
 
 
@@ -323,7 +324,7 @@ extern int vsnprintf (char *__restrict __s, size_t __maxlen,
 /* Write formatted output to a string dynamically allocated with `malloc'.
 /* Write formatted output to a string dynamically allocated with `malloc'.
    Store the address of the string in *PTR.  */
    Store the address of the string in *PTR.  */
 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
-		      _G_va_list __arg)
+		      va_list __arg)
      __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
      __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
 extern int __asprintf (char **__restrict __ptr,
 extern int __asprintf (char **__restrict __ptr,
 		       __const char *__restrict __fmt, ...)
 		       __const char *__restrict __fmt, ...)
@@ -334,7 +335,7 @@ extern int asprintf (char **__restrict __ptr,
 
 
 /* Write formatted output to a file descriptor.  */
 /* Write formatted output to a file descriptor.  */
 extern int vdprintf (int __fd, __const char *__restrict __fmt,
 extern int vdprintf (int __fd, __const char *__restrict __fmt,
-		     _G_va_list __arg)
+		     va_list __arg)
      __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
      __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
      __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
      __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
@@ -353,16 +354,16 @@ extern int sscanf (__const char *__restrict __s,
 #ifdef	__USE_ISOC99
 #ifdef	__USE_ISOC99
 /* Read formatted input from S into argument list ARG.  */
 /* Read formatted input from S into argument list ARG.  */
 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
-		    _G_va_list __arg)
+		    va_list __arg)
      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
 
 
 /* Read formatted input from stdin into argument list ARG.  */
 /* Read formatted input from stdin into argument list ARG.  */
-extern int vscanf (__const char *__restrict __format, _G_va_list __arg)
+extern int vscanf (__const char *__restrict __format, va_list __arg)
      __THROW __attribute__ ((__format__ (__scanf__, 1, 0)));
      __THROW __attribute__ ((__format__ (__scanf__, 1, 0)));
 
 
 /* Read formatted input from S into argument list ARG.  */
 /* Read formatted input from S into argument list ARG.  */
 extern int vsscanf (__const char *__restrict __s,
 extern int vsscanf (__const char *__restrict __s,
-		    __const char *__restrict __format, _G_va_list __arg)
+		    __const char *__restrict __format, va_list __arg)
      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
 #endif /* Use ISO C9x.  */
 #endif /* Use ISO C9x.  */
 
 
@@ -636,7 +637,7 @@ extern int obstack_printf (struct obstack *__restrict __obstack,
 			   __const char *__restrict __format, ...) __THROW;
 			   __const char *__restrict __format, ...) __THROW;
 extern int obstack_vprintf (struct obstack *__restrict __obstack,
 extern int obstack_vprintf (struct obstack *__restrict __obstack,
 			    __const char *__restrict __format,
 			    __const char *__restrict __format,
-			    _G_va_list __args) __THROW;
+			    va_list __args) __THROW;
 #endif /* Use GNU.  */
 #endif /* Use GNU.  */
 
 
 
 

+ 10 - 66
libc/sysdeps/linux/arm/bits/sigset.h

@@ -24,11 +24,7 @@ typedef int __sig_atomic_t;
 
 
 /* A `sigset_t' has a bit for each signal.  */
 /* A `sigset_t' has a bit for each signal.  */
 
 
-# define _SIGSET_NWORDS	(1024 / (8 * sizeof (unsigned long int)))
+typedef unsigned long __sigset_t;
-typedef struct
-  {
-    unsigned long int __val[_SIGSET_NWORDS];
-  } __sigset_t;
 
 
 #endif
 #endif
 
 
@@ -47,79 +43,27 @@ typedef struct
 # endif
 # endif
 
 
 /* Return a mask that includes the bit for SIG only.  */
 /* Return a mask that includes the bit for SIG only.  */
-# define __sigmask(sig) \
+# define __sigmask(sig) (1L << ((sig) - 1))
-  (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int))))
-
-/* Return the word index for SIG.  */
-# define __sigword(sig)	(((sig) - 1) / (8 * sizeof (unsigned long int)))
 
 
 # if defined __GNUC__ && __GNUC__ >= 2
 # if defined __GNUC__ && __GNUC__ >= 2
-#  define __sigemptyset(set) \
+#  define __sigemptyset(set) (*(set) = 0)
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
+#  define __sigfillset(set) (*(set) = ~0)
-		    sigset_t *__set = (set);				      \
-		    while (--__cnt >= 0) __set->__val[__cnt] = 0;	      \
-		    0; }))
-#  define __sigfillset(set) \
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
-		    sigset_t *__set = (set);				      \
-		    while (--__cnt >= 0) __set->__val[__cnt] = ~0UL;	      \
-		    0; }))
 
 
 #  ifdef __USE_GNU
 #  ifdef __USE_GNU
 /* The POSIX does not specify for handling the whole signal set in one
 /* The POSIX does not specify for handling the whole signal set in one
    command.  This is often wanted and so we define three more functions
    command.  This is often wanted and so we define three more functions
    here.  */
    here.  */
-#   define __sigisemptyset(set) \
+#   define __sigisemptyset(set) (*(set) == 0)
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
+#   define __sigandset(dest, left, right) (*(dest) = *(left) & *(right))
-		    const sigset_t *__set = (set);			      \
+#   define __sigorset(dest, left, right) (*(dest) = *(left) | *(right))
-		    int __ret = __set->__val[--__cnt];			      \
-		    while (!__ret && --__cnt >= 0)			      \
-			__ret = __set->__val[__cnt];			      \
-		    __ret == 0; }))
-#   define __sigandset(dest, left, right) \
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
-		    sigset_t *__dest = (dest);				      \
-		    const sigset_t *__left = (left);			      \
-		    const sigset_t *__right = (right);			      \
-		    while (--__cnt >= 0)				      \
-		      __dest->__val[__cnt] = (__left->__val[__cnt]	      \
-					      & __right->__val[__cnt]);	      \
-		    0; }))
-#   define __sigorset(dest, left, right) \
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
-		    sigset_t *__dest = (dest);				      \
-		    const sigset_t *__left = (left);			      \
-		    const sigset_t *__right = (right);			      \
-		    while (--__cnt >= 0)				      \
-		      __dest->__val[__cnt] = (__left->__val[__cnt]	      \
-					      | __right->__val[__cnt]);	      \
-		    0; }))
 #  endif
 #  endif
 # endif
 # endif
 
 
 /* These functions needn't check for a bogus signal number -- error
 /* These functions needn't check for a bogus signal number -- error
    checking is done in the non __ versions.  */
    checking is done in the non __ versions.  */
 
 
-extern int __sigismember (__const __sigset_t *, int);
+# define __sigismember(set, sig) (*(set) & (1L << ((sig)-1)))
-extern int __sigaddset (__sigset_t *, int);
+# define __sigaddset(set, sig) (*(set) |= (1L << ((sig)-1)))
-extern int __sigdelset (__sigset_t *, int);
+# define __sigdelset(set, sig) (*(set) &= ~(1L << ((sig)-1)))
-
-# ifdef __USE_EXTERN_INLINES
-#  define __SIGSETFN(NAME, BODY, CONST)					      \
-  _EXTERN_INLINE int							      \
-  NAME (CONST __sigset_t *__set, int __sig)				      \
-  {									      \
-    unsigned long int __mask = __sigmask (__sig);			      \
-    unsigned long int __word = __sigword (__sig);			      \
-    return BODY;							      \
-  }
-
-__SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, __const)
-__SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), )
-__SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), )
-
-#  undef __SIGSETFN
-# endif
-
 
 
 #endif /* ! _SIGSET_H_fns.  */
 #endif /* ! _SIGSET_H_fns.  */

+ 2 - 0
libc/sysdeps/linux/arm/crt0.S

@@ -62,6 +62,7 @@ _start:
 	/* Ok, now run uClibc's main() -- shouldn't return */
 	/* Ok, now run uClibc's main() -- shouldn't return */
 	bl	__uClibc_main
 	bl	__uClibc_main
 
 
+#if 0 /* this is already provided by crtbegin/crtend in the arm-elf compiler */
 /* a little bit of stuff to support C++ */
 /* a little bit of stuff to support C++ */
 	.section .ctors,"aw"
 	.section .ctors,"aw"
 	.align 4
 	.align 4
@@ -74,3 +75,4 @@ __CTOR_LIST__:
 	.global __DTOR_LIST__
 	.global __DTOR_LIST__
 __DTOR_LIST__:
 __DTOR_LIST__:
 	.long -1
 	.long -1
+#endif

+ 10 - 69
libc/sysdeps/linux/sh/bits/sigset.h

@@ -24,11 +24,7 @@ typedef int __sig_atomic_t;
 
 
 /* A `sigset_t' has a bit for each signal.  */
 /* A `sigset_t' has a bit for each signal.  */
 
 
-# define _SIGSET_NWORDS	(1024 / (8 * sizeof (unsigned long int)))
+typedef unsigned long __sigset_t;
-typedef struct
-  {
-    unsigned long int __val[_SIGSET_NWORDS];
-  } __sigset_t;
 
 
 #endif
 #endif
 
 
@@ -47,82 +43,27 @@ typedef struct
 # endif
 # endif
 
 
 /* Return a mask that includes the bit for SIG only.  */
 /* Return a mask that includes the bit for SIG only.  */
-# define __sigmask(sig) \
+# define __sigmask(sig) (1L << ((sig) - 1))
-  (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int))))
-
-/* Return the word index for SIG.  */
-# define __sigword(sig)	(((sig) - 1) / (8 * sizeof (unsigned long int)))
 
 
 # if defined __GNUC__ && __GNUC__ >= 2
 # if defined __GNUC__ && __GNUC__ >= 2
-#  define __sigemptyset(set) \
+#  define __sigemptyset(set) (*(set) = 0)
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
+#  define __sigfillset(set) (*(set) = ~0)
-		    sigset_t *__set = (set);				      \
-		    while (--__cnt >= 0) __set->__val[__cnt] = 0;	      \
-		    0; }))
-#  define __sigfillset(set) \
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
-		    sigset_t *__set = (set);				      \
-		    while (--__cnt >= 0) __set->__val[__cnt] = ~0UL;	      \
-		    0; }))
 
 
 #  ifdef __USE_GNU
 #  ifdef __USE_GNU
 /* The POSIX does not specify for handling the whole signal set in one
 /* The POSIX does not specify for handling the whole signal set in one
    command.  This is often wanted and so we define three more functions
    command.  This is often wanted and so we define three more functions
    here.  */
    here.  */
-#   define __sigisemptyset(set) \
+#   define __sigisemptyset(set) (*(set) == 0)
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
+#   define __sigandset(dest, left, right) (*(dest) = *(left) & *(right))
-		    const sigset_t *__set = (set);			      \
+#   define __sigorset(dest, left, right) (*(dest) = *(left) | *(right))
-		    int __ret = __set->__val[--__cnt];			      \
-		    while (!__ret && --__cnt >= 0)			      \
-			__ret = __set->__val[__cnt];			      \
-		    __ret == 0; }))
-#   define __sigandset(dest, left, right) \
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
-		    sigset_t *__dest = (dest);				      \
-		    const sigset_t *__left = (left);			      \
-		    const sigset_t *__right = (right);			      \
-		    while (--__cnt >= 0)				      \
-		      __dest->__val[__cnt] = (__left->__val[__cnt]	      \
-					      & __right->__val[__cnt]);	      \
-		    0; }))
-#   define __sigorset(dest, left, right) \
-  (__extension__ ({ int __cnt = _SIGSET_NWORDS;				      \
-		    sigset_t *__dest = (dest);				      \
-		    const sigset_t *__left = (left);			      \
-		    const sigset_t *__right = (right);			      \
-		    while (--__cnt >= 0)				      \
-		      __dest->__val[__cnt] = (__left->__val[__cnt]	      \
-					      | __right->__val[__cnt]);	      \
-		    0; }))
 #  endif
 #  endif
 # endif
 # endif
 
 
-__BEGIN_DECLS
-
 /* These functions needn't check for a bogus signal number -- error
 /* These functions needn't check for a bogus signal number -- error
    checking is done in the non __ versions.  */
    checking is done in the non __ versions.  */
 
 
-extern int __sigismember (__const __sigset_t *, int);
+# define __sigismember(set, sig) (*(set) & (1L << ((sig)-1)))
-extern int __sigaddset (__sigset_t *, int);
+# define __sigaddset(set, sig) (*(set) |= (1L << ((sig)-1)))
-extern int __sigdelset (__sigset_t *, int);
+# define __sigdelset(set, sig) (*(set) &= ~(1L << ((sig)-1)))
-
-# ifdef __USE_EXTERN_INLINES
-#  define __SIGSETFN(NAME, BODY, CONST)					      \
-  _EXTERN_INLINE int							      \
-  NAME (CONST __sigset_t *__set, int __sig)				      \
-  {									      \
-    unsigned long int __mask = __sigmask (__sig);			      \
-    unsigned long int __word = __sigword (__sig);			      \
-    return BODY;							      \
-  }
-
-__SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, __const)
-__SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), )
-__SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), )
-
-#  undef __SIGSETFN
-# endif
-
-__END_DECLS
 
 
 #endif /* ! _SIGSET_H_fns.  */
 #endif /* ! _SIGSET_H_fns.  */