From: Ulrich Drepper Date: Wed, 8 Jan 2003 00:22:00 +0000 (+0000) Subject: Update. X-Git-Tag: upstream/2.20~13309 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5facfdac0a9a10f9b0b145d6e3b1348a751f2ff;p=platform%2Fupstream%2Flinaro-glibc.git Update. 2003-01-06 Philip Blundell * sysdeps/unix/arm/sysdep.S (syscall_error): Optimise a little. [__LIBC_REENTRANT]: Unify PIC and non-PIC cases. * sysdeps/unix/sysv/linux/arm/sysdep.h (PSEUDO): Remove .type directive. (PSEUDO_RET): Use SYSCALL_ERROR in place of __syscall_error. (SYSCALL_ERROR): New. (SYSCALL_ERROR_HANDLER) [NOT_IN_libc]: Provide local copy of error handling code. (INTERNAL_SYSCALL): Define. (INLINE_SYSCALL): Use it. (INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Define. * sysdeps/unix/sysv/linux/arm/socket.S (__socket): Use SYSCALL_ERROR in place of __syscall_error. 2003-01-07 Jakub Jelinek * sysdeps/ia64/bits/byteswap.h [__GNUC__ >= 2] (__bswap_16, __bswap_32, __bswap_64): Put x into temporary variable to avoid warnings. [!__GNUC__] (__bswap_16, __bswap_32, __bswap_64): Change into static (inline) functions. * sysdeps/s390/bits/byteswap.h [__GNUC__ >= 2] (__bswap_16, __bswap_32, __bswap_64): Put x into temporary variable to avoid warnings. [!__GNUC__] (__bswap_16, __bswap_32, __bswap_64): Change into static (inline) functions. * sysdeps/i386/bits/byteswap.h [!__GNUC__] (__bswap_16, __bswap_32): Likewise. 2003-01-07 Jakub Jelinek * sysdeps/unix/sysv/linux/alpha/adjtime.c (ntp_adjtime): New weak alias. --- diff --git a/ChangeLog b/ChangeLog index 704edc0..a7536f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +2003-01-06 Philip Blundell + + * sysdeps/unix/arm/sysdep.S (syscall_error): Optimise a little. + [__LIBC_REENTRANT]: Unify PIC and non-PIC cases. + + * sysdeps/unix/sysv/linux/arm/sysdep.h (PSEUDO): Remove .type + directive. + (PSEUDO_RET): Use SYSCALL_ERROR in place of __syscall_error. + (SYSCALL_ERROR): New. + (SYSCALL_ERROR_HANDLER) [NOT_IN_libc]: Provide local copy of error + handling code. + (INTERNAL_SYSCALL): Define. + (INLINE_SYSCALL): Use it. + (INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Define. + * sysdeps/unix/sysv/linux/arm/socket.S (__socket): Use + SYSCALL_ERROR in place of __syscall_error. + +2003-01-07 Jakub Jelinek + + * sysdeps/ia64/bits/byteswap.h [__GNUC__ >= 2] (__bswap_16, + __bswap_32, __bswap_64): Put x into temporary variable + to avoid warnings. + [!__GNUC__] (__bswap_16, __bswap_32, __bswap_64): Change into static + (inline) functions. + * sysdeps/s390/bits/byteswap.h [__GNUC__ >= 2] (__bswap_16, + __bswap_32, __bswap_64): Put x into temporary variable + to avoid warnings. + [!__GNUC__] (__bswap_16, __bswap_32, __bswap_64): Change into static + (inline) functions. + * sysdeps/i386/bits/byteswap.h [!__GNUC__] (__bswap_16, __bswap_32): + Likewise. + +2003-01-07 Jakub Jelinek + + * sysdeps/unix/sysv/linux/alpha/adjtime.c (ntp_adjtime): New weak + alias. + 2003-01-07 Jakub Jelinek * elf/rtld.c (_rtld_global): Remove _dl_dynamic_weak initializer. diff --git a/nptl/ChangeLog b/nptl/ChangeLog index aa422d3..3afa3e6 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,5 +1,7 @@ 2003-01-07 Jakub Jelinek + * pthreadP.h (__pthread_cond_timedwait): Add prototype. + * sysdeps/unix/sysv/linux/i386/dl-sysdep.h (RTLD_CORRECT_DYNAMIC_WEAK): Remove. (DL_SYSINFO_IMPLEMENTATION): Change into .text section and back. diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index b298524..3223291 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -260,6 +260,9 @@ extern int __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *cond_attr); extern int __pthread_cond_signal (pthread_cond_t *cond); extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex); +extern int __pthread_cond_timedwait (pthread_cond_t *cond, + pthread_mutex_t *mutex, + const struct timespec *abstime); extern int __pthread_condattr_destroy (pthread_condattr_t *attr); extern int __pthread_condattr_init (pthread_condattr_t *attr); extern int __pthread_key_create (pthread_key_t *key, void (*destr) (void *)); diff --git a/nptl_db/ChangeLog b/nptl_db/ChangeLog index c15ba3f..d4a4ad0 100644 --- a/nptl_db/ChangeLog +++ b/nptl_db/ChangeLog @@ -1,4 +1,8 @@ -2003-01-05 Ulrich Drepper +2003-01-07 Jakub Jelinek + + * td_ta_event_getmsg.c: Include assert.h. + +-2003-01-05 Ulrich Drepper * Makefile (libthread_db.so-no-z-defs): Define. diff --git a/nptl_db/td_ta_event_getmsg.c b/nptl_db/td_ta_event_getmsg.c index 919ba65..ae3f8e7 100644 --- a/nptl_db/td_ta_event_getmsg.c +++ b/nptl_db/td_ta_event_getmsg.c @@ -1,5 +1,5 @@ /* Retrieve event. - Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1999. @@ -18,6 +18,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h index db8b15d..0d7d75c 100644 --- a/sysdeps/i386/bits/byteswap.h +++ b/sysdeps/i386/bits/byteswap.h @@ -28,8 +28,9 @@ #define __bswap_constant_16(x) \ ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) -#if defined __GNUC__ && __GNUC__ >= 2 -# define __bswap_16(x) \ +#ifdef __GNUC__ +# if __GNUC__ >= 2 +# define __bswap_16(x) \ (__extension__ \ ({ register unsigned short int __v, __x = (x); \ if (__builtin_constant_p (__x)) \ @@ -40,24 +41,31 @@ : "0" (__x) \ : "cc"); \ __v; })) -#else +# else /* This is better than nothing. */ -# define __bswap_16(x) \ +# define __bswap_16(x) \ (__extension__ \ ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); })) +# endif +#else +static __inline unsigned short int +__bswap_16 (unsigned short int __bsx) +{ + return __bswap_constant_16 (__bsx); +} #endif - /* Swap bytes in 32 bit value. */ #define __bswap_constant_32(x) \ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) -#if defined __GNUC__ && __GNUC__ >= 2 +#ifdef __GNUC__ +# if __GNUC__ >= 2 /* To swap the bytes in a word the i486 processors and up provide the `bswap' opcode. On i386 we have to use three instructions. */ -# if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__ -# define __bswap_32(x) \ +# if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__ +# define __bswap_32(x) \ (__extension__ \ ({ register unsigned int __v, __x = (x); \ if (__builtin_constant_p (__x)) \ @@ -70,8 +78,8 @@ : "0" (__x) \ : "cc"); \ __v; })) -# else -# define __bswap_32(x) \ +# else +# define __bswap_32(x) \ (__extension__ \ ({ register unsigned int __v, __x = (x); \ if (__builtin_constant_p (__x)) \ @@ -79,11 +87,18 @@ else \ __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); \ __v; })) -# endif -#else -# define __bswap_32(x) \ +# endif +# else +# define __bswap_32(x) \ (__extension__ \ ({ register unsigned int __x = (x); __bswap_constant_32 (__x); })) +# endif +#else +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __bswap_constant_32 (__bsx); +} #endif diff --git a/sysdeps/ia64/bits/byteswap.h b/sysdeps/ia64/bits/byteswap.h index 285102c..6862aa0 100644 --- a/sysdeps/ia64/bits/byteswap.h +++ b/sysdeps/ia64/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2000, 2002, 2003 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 @@ -31,18 +31,22 @@ #if defined __GNUC__ && __GNUC__ >= 2 # define __bswap_16(x) \ (__extension__ \ - ({ register unsigned short int __v; \ + ({ register unsigned short int __v, __x = (x); \ if (__builtin_constant_p (x)) \ - __v = __bswap_constant_16 (x); \ + __v = __bswap_constant_16 (__x); \ else \ __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \ "mux1 %0 = %0, @rev ;;" \ : "=r" (__v) \ - : "r" ((unsigned short int) (x))); \ + : "r" ((unsigned short int) (__x))); \ __v; })) #else /* This is better than nothing. */ -# define __bswap_16(x) __bswap_constant_16 (x) +static __inline unsigned short int +__bswap_16 (unsigned short int __bsx) +{ + return __bswap_constant_16 (__bsx); +} #endif @@ -54,17 +58,21 @@ #if defined __GNUC__ && __GNUC__ >= 2 # define __bswap_32(x) \ (__extension__ \ - ({ register unsigned int __v; \ + ({ register unsigned int __v, __x = (x); \ if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (x); \ + __v = __bswap_constant_32 (__x); \ else \ __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \ "mux1 %0 = %0, @rev ;;" \ : "=r" (__v) \ - : "r" ((unsigned int) (x))); \ + : "r" ((unsigned int) (__x))); \ __v; })) #else -# define __bswap_32(x) __bswap_constant_32 (x) +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __bswap_constant_32 (__bsx); +} #endif @@ -82,17 +90,21 @@ #if defined __GNUC__ && __GNUC__ >= 2 # define __bswap_64(x) \ (__extension__ \ - ({ register unsigned long int __v; \ + ({ register unsigned long int __v, __x = (x); \ if (__builtin_constant_p (x)) \ - __v = __bswap_constant_64 (x); \ + __v = __bswap_constant_64 (__x); \ else \ __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \ : "=r" (__v) \ - : "r" ((unsigned long int) (x))); \ + : "r" ((unsigned long int) (__x))); \ __v; })) #else -# define __bswap_64(x) __bswap_constant_64 (x) +static __inline unsigned long int +__bswap_64 (unsigned long int __bsx) +{ + return __bswap_constant_64 (__bsx); +} #endif #endif /* _BITS_BYTESWAP_H */ diff --git a/sysdeps/s390/bits/byteswap.h b/sysdeps/s390/bits/byteswap.h index 6a4b4ae..d0e31b8 100644 --- a/sysdeps/s390/bits/byteswap.h +++ b/sysdeps/s390/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. s390 version. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -35,11 +35,11 @@ # if __WORDSIZE == 64 # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __v; \ + ({ unsigned short int __v, __x = (x); \ if (__builtin_constant_p (x)) \ - __v = __bswap_constant_16 (x); \ + __v = __bswap_constant_16 (__x); \ else { \ - unsigned short int __tmp = (unsigned short int) (x); \ + unsigned short int __tmp = (unsigned short int) (__x); \ __asm__ __volatile__ ( \ "lrvh %0,%1" \ : "=&d" (__v) : "m" (__tmp) ); \ @@ -48,11 +48,11 @@ # else # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __v; \ + ({ unsigned short int __v, __x = (x); \ if (__builtin_constant_p (x)) \ - __v = __bswap_constant_16 (x); \ + __v = __bswap_constant_16 (__x); \ else { \ - unsigned short int __tmp = (unsigned short int) (x); \ + unsigned short int __tmp = (unsigned short int) (__x); \ __asm__ __volatile__ ( \ "sr %0,%0\n" \ "la 1,%1\n" \ @@ -64,7 +64,11 @@ # endif #else /* This is better than nothing. */ -#define __bswap_16(x) __bswap_constant_16 (x) +static __inline unsigned short int +__bswap_16 (unsigned short int __bsx) +{ + return __bswap_constant_16 (__bsx); +} #endif /* Swap bytes in 32 bit value. */ @@ -76,11 +80,11 @@ # if __WORDSIZE == 64 # define __bswap_32(x) \ (__extension__ \ - ({ unsigned int __v; \ + ({ unsigned int __v, __x = (x); \ if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (x); \ + __v = __bswap_constant_32 (__x); \ else { \ - unsigned int __tmp = (unsigned int) (x); \ + unsigned int __tmp = (unsigned int) (__x); \ __asm__ __volatile__ ( \ "lrv %0,%1" \ : "=&d" (__v) : "m" (__tmp)); \ @@ -89,11 +93,11 @@ # else # define __bswap_32(x) \ (__extension__ \ - ({ unsigned int __v; \ + ({ unsigned int __v, __x = (x); \ if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (x); \ + __v = __bswap_constant_32 (__x); \ else { \ - unsigned int __tmp = (unsigned int) (x); \ + unsigned int __tmp = (unsigned int) (__x); \ __asm__ __volatile__ ( \ "la 1,%1\n" \ "icm %0,8,3(1)\n" \ @@ -105,7 +109,11 @@ __v; })) # endif #else -# define __bswap_32(x) __bswap_constant_32 (x) +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __bswap_constant_32 (__bsx); +} #endif /* Swap bytes in 64 bit value. */ @@ -119,11 +127,11 @@ # if __WORDSIZE == 64 # define __bswap_64(x) \ (__extension__ \ - ({ unsigned long __w; \ + ({ unsigned long __w, __x = (x); \ if (__builtin_constant_p (x)) \ - __w = __bswap_constant_64 (x); \ + __w = __bswap_constant_64 (__x); \ else { \ - unsigned long __tmp = (unsigned long) (x); \ + unsigned long __tmp = (unsigned long) (__x); \ __asm__ __volatile__ ( \ "lrvg %0,%1" \ : "=&d" (__w) : "m" (__tmp)); \ @@ -140,7 +148,11 @@ __r.__ll; }) # endif #else -# define __bswap_64(x) __bswap_constant_64 (x) +static __inline unsigned long long int +__bswap_64 (unsigned long long int __bsx) +{ + return __bswap_constant_64 (__bsx); +} #endif #endif /* _BITS_BYTESWAP_H */ diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S index 6487caa..5fc80a8 100644 --- a/sysdeps/unix/arm/sysdep.S +++ b/sysdeps/unix/arm/sysdep.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,94,95,96,97,98,2002,03 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 @@ -37,42 +37,34 @@ syscall_error: moveq r0, $EAGAIN /* Yes; translate it to EAGAIN. */ #endif -#ifndef PIC - ldr r1, _errno_loc - str r0, [r1] #ifdef _LIBC_REENTRANT - stmdb sp!, {r0, lr} - /* put another copy of r0 at a specific errno location */ - bl C_SYMBOL_NAME(__errno_location) - ldmia sp!, {r1, lr} + str lr, [sp, #-4]! + str r0, [sp, #-4]! + bl PLTJMP(C_SYMBOL_NAME(__errno_location)) + ldr r1, [sp], #4 str r1, [r0] -#endif + mvn r0, $0 + ldr pc, [sp], #4 #else - stmdb sp!,{r10, lr} - @ we have to establish our PIC register - ldr r10, 1f - add r10, pc, r10 -0: ldr r1, 2f - ldr r1, [r10, r1] - @ store a copy in _errno_loc +#ifndef PIC + ldr r1, 1f str r0, [r1] -#ifdef _LIBC_REENTRANT - @ and another copy in thread copy of _errno_loc - mov r10, r0 - bl __errno_location(PLT) - str r10, [r0] -#endif - ldmia sp!, {r10, lr} - b 4f -1: .word _GLOBAL_OFFSET_TABLE_ - 0b - 4 -2: .word C_SYMBOL_NAME(errno)(GOT) -4: -#endif mvn r0, $0 RETINSTR(mov, pc, r14) -#ifndef PIC -_errno_loc: .long C_SYMBOL_NAME(errno) +1: .long C_SYMBOL_NAME(errno) +#else + @ we have to establish our PIC register + ldr r2, 1f + ldr r1, 2f +0: add r2, pc, r2 + str r0, [r1, r2] + mvn r0, $0 + RETINSTR(mov, pc, r14) + +1: .word _GLOBAL_OFFSET_TABLE_ - 0b - 8 +2: .word C_SYMBOL_NAME(errno)(GOTOFF) +#endif #endif #undef __syscall_error diff --git a/sysdeps/unix/sysv/linux/alpha/adjtime.c b/sysdeps/unix/sysv/linux/alpha/adjtime.c index 2bed884..34df942 100644 --- a/sysdeps/unix/sysv/linux/alpha/adjtime.c +++ b/sysdeps/unix/sysv/linux/alpha/adjtime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2002, 2003 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 @@ -191,5 +191,6 @@ __adjtimex_tv64 (struct timex *tx) strong_alias (__adjtimex_tv64, __adjtimex_internal); strong_alias (__adjtimex_tv64, __adjtimex_tv64p); +weak_alias (__adjtimex_tv64, ntp_adjtime); versioned_symbol (libc, __adjtimex_tv64, __adjtimex, GLIBC_2_1); versioned_symbol (libc, __adjtimex_tv64p, adjtimex, GLIBC_2_1); diff --git a/sysdeps/unix/sysv/linux/arm/socket.S b/sysdeps/unix/sysv/linux/arm/socket.S index 2672de7..f4ccc54 100644 --- a/sysdeps/unix/sysv/linux/arm/socket.S +++ b/sysdeps/unix/sysv/linux/arm/socket.S @@ -79,7 +79,7 @@ ENTRY (__socket) /* r0 is < 0 if there was an error. */ cmn r0, $124 RETINSTR(movcc, pc, r14) - b PLTJMP(syscall_error) + b PLTJMP(SYSCALL_ERROR) PSEUDO_END (__socket) diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index cdb1d8e..e7caaa1 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -49,14 +49,13 @@ #undef PSEUDO #define PSEUDO(name, syscall_name, args) \ .text; \ - .type syscall_error,%function; \ ENTRY (name); \ DO_CALL (syscall_name, args); \ cmn r0, $4096; #define PSEUDO_RET \ RETINSTR(movcc, pc, lr); \ - b PLTJMP(__syscall_error) + b PLTJMP(SYSCALL_ERROR) #undef ret #define ret PSEUDO_RET @@ -65,7 +64,22 @@ SYSCALL_ERROR_HANDLER \ END (name) -#define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ +#if NOT_IN_libc +# define SYSCALL_ERROR __local_syscall_error +# define SYSCALL_ERROR_HANDLER \ +__local_syscall_error: \ + str lr, [sp, #-4]!; \ + str r0, [sp, #-4]!; \ + bl PLTJMP(C_SYMBOL_NAME(__errno_location)); \ + ldr r1, [sp], #4; \ + rsb r1, r1, #0; \ + str r1, [r0]; \ + mvn r0, #0; \ + ldr pc, [sp], #4; +#else +# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ +# define SYSCALL_ERROR __syscall_error +#endif /* Linux takes system call args in registers: syscall number in the SWI instruction @@ -123,7 +137,17 @@ /* Define a macro which expands into the inline wrapper code for a system call. */ #undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ +#define INLINE_SYSCALL(name, nr, args...) \ + ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result), 0)) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result)); \ + _sys_result = (unsigned int) -1; \ + } \ + (int) _sys_result; }) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, nr, args...) \ ({ unsigned int _sys_result; \ { \ register int _a1 asm ("a1"); \ @@ -134,13 +158,14 @@ : "a1", "memory"); \ _sys_result = _a1; \ } \ - if (_sys_result >= (unsigned int) -4095) \ - { \ - __set_errno (-_sys_result); \ - _sys_result = (unsigned int) -1; \ - } \ (int) _sys_result; }) +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) + #define LOAD_ARGS_0() #define ASM_ARGS_0 #define LOAD_ARGS_1(a1) \