[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r3030 - in /fsf/trunk/libc: ./ elf/ intl/ localedata/ localedata/locales/ nptl/ nptl/sysdeps/unix/sysv/linux/sh/ rt/ stdlib/
- To: commits@xxxxxxxxxx
- Subject: [commits] r3030 - in /fsf/trunk/libc: ./ elf/ intl/ localedata/ localedata/locales/ nptl/ nptl/sysdeps/unix/sysv/linux/sh/ rt/ stdlib/
- From: eglibc@xxxxxxxxxx
- Date: Sat, 04 Aug 2007 07:02:45 -0000
Author: eglibc
Date: Sat Aug 4 00:02:44 2007
New Revision: 3030
Log:
Import glibc-mainline for 2007-08-04
Added:
fsf/trunk/libc/stdlib/tst-strtod5.c
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/elf/dl-load.c
fsf/trunk/libc/intl/dcigettext.c
fsf/trunk/libc/intl/finddomain.c
fsf/trunk/libc/localedata/ChangeLog
fsf/trunk/libc/localedata/locales/translit_combining
fsf/trunk/libc/nptl/ChangeLog
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S
fsf/trunk/libc/rt/aio.h
fsf/trunk/libc/rt/mqueue.h
fsf/trunk/libc/stdlib/Makefile
fsf/trunk/libc/stdlib/strtod_l.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Aug 4 00:02:44 2007
@@ -1,3 +1,27 @@
+2007-08-03 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * rt/aio.h: Add __nonnull attributes.
+
+2007-08-03 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Properly handle -0.
+ * stdlib/Makefile (tests): Add tst-strtod5.
+ (tst-strtod5-ENV): New.
+ * stdlib/tst-strtod5.c: New file.
+
+ * intl/dcigettext.c (_nl_find_msg): Free encoding if __gconv_open
+ failed.
+ * intl/finddomain.c (_nl_find_domain): Free normalized_codeset
+ on failure.
+
+ * elf/dl-load.c (decompose_rpath): Free copy if result couldn't be
+ allocated.
+
+2007-08-03 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * rt/mqueue.h (mq_timedreceive, mq_timedsend): Fix nonnull argument
+ numbers.
+
2007-08-02 Ulrich Drepper <drepper@xxxxxxxxxx>
* io/Makefile (aux): Add have_o_cloexec.
Modified: fsf/trunk/libc/elf/dl-load.c
==============================================================================
--- fsf/trunk/libc/elf/dl-load.c (original)
+++ fsf/trunk/libc/elf/dl-load.c Sat Aug 4 00:02:44 2007
@@ -578,6 +578,7 @@
* sizeof (*result));
if (result == NULL)
{
+ free (copy);
errstring = N_("cannot create cache for search path");
signal_error:
_dl_signal_error (ENOMEM, NULL, NULL, errstring);
Modified: fsf/trunk/libc/intl/dcigettext.c
==============================================================================
--- fsf/trunk/libc/intl/dcigettext.c (original)
+++ fsf/trunk/libc/intl/dcigettext.c Sat Aug 4 00:02:44 2007
@@ -949,7 +949,10 @@
nothing to do. Otherwise do not use the
translation at all. */
if (__builtin_expect (r != __GCONV_NULCONV, 1))
- return NULL;
+ {
+ free ((char *) encoding);
+ return NULL;
+ }
convd->conv = (__gconv_t) -1;
}
Modified: fsf/trunk/libc/intl/finddomain.c
==============================================================================
--- fsf/trunk/libc/intl/finddomain.c (original)
+++ fsf/trunk/libc/intl/finddomain.c Sat Aug 4 00:02:44 2007
@@ -143,7 +143,7 @@
if (retval == NULL)
/* This means we are out of core. */
- return NULL;
+ goto out;
if (retval->decided <= 0)
_nl_load_domain (retval, domainbinding);
@@ -159,6 +159,7 @@
}
}
+out:
/* The space for normalized_codeset is dynamically allocated. Free it. */
if (mask & XPG_NORM_CODESET)
free ((void *) normalized_codeset);
Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Sat Aug 4 00:02:44 2007
@@ -1,3 +1,7 @@
+2007-08-03 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * locales/translit_combining: Add U0141 and U0142.
+
2007-07-30 Jakub Jelinek <jakub@xxxxxxxxxx>
* tst-strptime.c (do_test): Use %tu in fmt string for ptrdiff_t value.
Modified: fsf/trunk/libc/localedata/locales/translit_combining
==============================================================================
--- fsf/trunk/libc/localedata/locales/translit_combining (original)
+++ fsf/trunk/libc/localedata/locales/translit_combining Sat Aug 4 00:02:44 2007
@@ -472,6 +472,10 @@
<U013D> <U004C>
% LATIN SMALL LETTER L WITH CARON
<U013E> <U006C>
+% LATIN CAPITAL LETTER L WITH STROKE
+<U0141> <U004C>
+% LATIN SMALL LETTER L WITH STROKE
+<U0142> <U006C>
% LATIN CAPITAL LETTER N WITH ACUTE
<U0143> <U004E>
% LATIN SMALL LETTER N WITH ACUTE
Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Sat Aug 4 00:02:44 2007
@@ -1,3 +1,121 @@
+2007-08-01 Kaz Kojima <kkojima@xxxxxxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S: Remove
+ definitions for private futexes.
+ * sysdeps/unix/sysv/linux/sh/lowlevellock.S: Include
+ kernel-features.h and lowlevellock.h. Use private futexes if
+ they are available.
+ (__lll_lock_wait_private, __lll_unlock_wake_private): New.
+ (__lll_mutex_lock_wait): Rename to
+ (__lll_lock_wait): ... this. Don't compile in for libc.so.
+ (__lll_mutex_timedlock_wait): Rename to ...
+ (__lll_timedlock_wait): ... this. Use __NR_gettimeofday.
+ Don't compile in for libc.so.
+ (__lll_mutex_unlock_wake): Rename to ...
+ (__lll_unlock_wake): ... this. Don't compile in for libc.so.
+ (__lll_timedwait_tid): Use __NR_gettimeofday.
+ * sysdeps/unix/sysv/linux/sh/lowlevellock.h: Allow including
+ the header from assembler. Renamed all lll_mutex_* resp.
+ lll_robust_mutex_* macros to lll_* resp. lll_robust_*.
+ Renamed all LLL_MUTEX_LOCK_* macros to LLL_LOCK_*.
+ (FUTEX_CMP_REQUEUE, FUTEX_WAKE_OP, FUTEX_OP_CLEAR_WAKE_IF_GT_ONE):
+ Define.
+ (__lll_lock_wait_private): Add prototype.
+ (__lll_lock_wait, __lll_timedlock_wait, __lll_robust_lock_wait,
+ __lll_robust_timedlock_wait, __lll_unlock_wake_private,
+ __lll_unlock_wake): Likewise.
+ (lll_lock): Add private argument. Call __lll_lock_wait_private
+ if private is constant LLL_PRIVATE.
+ (lll_robust_lock, lll_cond_lock, lll_robust_cond_lock,
+ lll_timedlock, lll_robust_timedlock): Add private argument.
+ (lll_unlock): Add private argument. Call __lll_unlock_wake_private
+ if private is constant LLL_PRIVATE.
+ (lll_robust_unlock, lll_robust_dead): Add private argument.
+ (lll_lock_t): Remove.
+ (__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake,
+ __lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait,
+ lll_cond_wake, lll_cond_broadcast): Remove.
+ * sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S: Include
+ kernel-features.h and lowlevellock.h.
+ (SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Remove.
+ (LOAD_FUTEX_WAIT): Define.
+ (__lll_robust_mutex_lock_wait): Rename to ...
+ (__lll_robust_lock_wait): ... this. Add private argument.
+ Use LOAD_FUTEX_WAIT macro.
+ (__lll_robust_mutex_timedlock_wait): Rename to ...
+ (__lll_robust_timedlock_wait): ... this. Add private argument.
+ Use __NR_gettimeofday. Use LOAD_FUTEX_WAIT macro.
+ * sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S: Include
+ lowlevellock.h.
+ (SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Remove.
+ (pthread_barrier_wait): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*.
+ * sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S: Include
+ lowlevellock.h and pthread-errnos.h.
+ (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE,
+ FUTEX_CMP_REQUEUE, EINVAL): Remove.
+ (__pthread_cond_broadcast): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*.
+ * sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S: Include
+ lowlevellock.h and pthread-errnos.h.
+ (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE, EINVAL): Remove.
+ (__pthread_cond_signal): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*.
+ * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Include
+ lowlevellock.h.
+ (SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE): Remove.
+ (__pthread_cond_timedwait): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*. Use __NR_gettimeofday.
+ (__condvar_tw_cleanup): Likewise.
+ * sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Include
+ lowlevellock.h.
+ (SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Remove.
+ (__pthread_cond_wait): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*.
+ ( __condvar_w_cleanup): Likewise.
+ * sysdeps/unix/sysv/linux/sh/pthread_once.S: Include lowlevellock.h.
+ (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove.
+ * sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S: Include
+ lowlevellock.h.
+ (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove.
+ (__pthread_rwlock_rdlock): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*.
+ * sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S: Include
+ lowlevellock.h.
+ (SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE,
+ FUTEX_PRIVATE_FLAG): Remove.
+ (pthread_rwlock_timedrdlock): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*. Use __NR_gettimeofday.
+ * sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S: Include
+ lowlevellock.h.
+ (SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE,
+ FUTEX_PRIVATE_FLAG): Remove.
+ (pthread_rwlock_timedwrlock): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*. Use __NR_gettimeofday.
+ * sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S: Include
+ lowlevellock.h.
+ (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove.
+ (__pthread_rwlock_unlock): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*.
+ * sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S: Include
+ lowlevellock.h.
+ (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove.
+ (__pthread_rwlock_wrlock): Use __lll_{lock,unlock}_* instead of
+ __lll_mutex_{lock,unlock}_*.
+ * sysdeps/unix/sysv/linux/sh/sem_post.S: Include lowlevellock.h.
+ (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove.
+ (__new_sem_post): Use standard initial exec code sequences.
+ * sysdeps/unix/sysv/linux/sh/sem_timedwait.S: Include
+ lowlevellock.h.
+ (SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE,
+ FUTEX_PRIVATE_FLAG): Remove.
+ (sem_timedwait): Use __NR_gettimeofday. Use standard initial
+ exec code sequences.
+ * sysdeps/unix/sysv/linux/sh/sem_trywait.S: Include lowlevellock.h.
+ (__new_sem_trywait): Use standard initial exec code sequences.
+ * sysdeps/unix/sysv/linux/sh/sem_wait.S: Include lowlevellock.h.
+ (__new_sem_wait): Use standard initial exec code sequences.
+
2007-07-31 Anton Blanchard <anton@xxxxxxxxx>
* sysdeps/unix/sysv/linux/powerpc/sem_post.c (__new_sem_post):
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S Sat Aug 4 00:02:44 2007
@@ -16,32 +16,4 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <kernel-features.h>
-
-/* All locks in libc are private. Use the kernel feature if possible. */
-#define FUTEX_PRIVATE_FLAG 128
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define FUTEX_WAIT (0 | FUTEX_PRIVATE_FLAG)
-# define FUTEX_WAKE (1 | FUTEX_PRIVATE_FLAG)
-#else
-# define LOAD_FUTEX_WAIT(reg,tmp) \
- stc gbr, tmp ; \
- mov.w 99f, reg ; \
- add reg, tmp ; \
- bra 98f ; \
- mov.l @tmp, reg ; \
-99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
-98:
-
-# define LOAD_FUTEX_WAKE(reg,tmp) \
- stc gbr, tmp ; \
- mov.w 99f, reg ; \
- add reg, tmp ; \
- mov.l @tmp, reg ; \
- bra 98f ; \
- mov #FUTEX_WAKE, tmp ; \
-99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
-98: or tmp, reg
-#endif
-
#include "lowlevellock.S"
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S Sat Aug 4 00:02:44 2007
@@ -18,45 +18,112 @@
#include <sysdep.h>
#include <pthread-errnos.h>
+#include <kernel-features.h>
+#include <lowlevellock.h>
#include "lowlevel-atomic.h"
.text
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_futex 240
-#ifndef FUTEX_WAIT
-# define FUTEX_WAIT 0
-# define FUTEX_WAKE 1
-#endif
-
-#ifndef LOAD_FUTEX_WAIT
+#ifdef __ASSUME_PRIVATE_FUTEX
+# define LOAD_PRIVATE_FUTEX_WAIT(reg,tmp,tmp2) \
+ mov #(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg; \
+ extu.b reg, reg
+# define LOAD_PRIVATE_FUTEX_WAKE(reg,tmp,tmp2) \
+ mov #(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg; \
+ extu.b reg, reg
+# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \
+ mov #(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), tmp; \
+ extu.b tmp, tmp; \
+ xor tmp, reg
+# define LOAD_FUTEX_WAKE(reg,tmp,tmp2) \
+ mov #(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), tmp; \
+ extu.b tmp, tmp; \
+ xor tmp, reg
+#else
# if FUTEX_WAIT == 0
-# define LOAD_FUTEX_WAIT(reg,tmp) \
- xor reg, reg
+# define LOAD_PRIVATE_FUTEX_WAIT(reg,tmp,tmp2) \
+ stc gbr, tmp ; \
+ mov.w 99f, reg ; \
+ add reg, tmp ; \
+ bra 98f ; \
+ mov.l @tmp, reg ; \
+99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
+98:
# else
-# define LOAD_FUTEX_WAIT(reg,tmp) \
- mov #FUTEX_WAIT, reg; \
- extu.b reg, reg
+# define LOAD_PRIVATE_FUTEX_WAIT(reg,tmp,tmp2) \
+ stc gbr, tmp ; \
+ mov.w 99f, reg ; \
+ add reg, tmp ; \
+ mov.l @tmp, reg ; \
+ bra 98f ; \
+ mov #FUTEX_WAIT, tmp ; \
+99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
+98: or tmp, reg
+# endif
+# define LOAD_PRIVATE_FUTEX_WAKE(reg,tmp,tmp2) \
+ stc gbr, tmp ; \
+ mov.w 99f, reg ; \
+ add reg, tmp ; \
+ mov.l @tmp, reg ; \
+ bra 98f ; \
+ mov #FUTEX_WAKE, tmp ; \
+99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
+98: or tmp, reg
+# if FUTEX_WAIT == 0
+# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \
+ stc gbr, tmp ; \
+ mov.w 99f, tmp2 ; \
+ add tmp2, tmp ; \
+ mov.l @tmp, tmp2 ; \
+ bra 98f ; \
+ mov #FUTEX_PRIVATE_FLAG, tmp
+99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
+98: extu.b tmp, tmp ; \
+ xor tmp, reg ; \
+ and tmp2, reg
+# else
+# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \
+ stc gbr, tmp ; \
+ mov.w 99f, tmp2 ; \
+ add tmp2, tmp ; \
+ mov.l @tmp, tmp2 ; \
+ bra 98f ; \
+ mov #FUTEX_PRIVATE_FLAG, tmp
+99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
+98: extu.b tmp, tmp ; \
+ xor tmp, reg ; \
+ and tmp2, reg ; \
+ mov #FUTEX_WAIT, tmp ; \
+ or tmp, reg
# endif
# define LOAD_FUTEX_WAKE(reg,tmp) \
- mov #FUTEX_WAKE, reg; \
- extu.b reg, reg
+ stc gbr, tmp ; \
+ mov.w 99f, tmp2 ; \
+ add tmp2, tmp ; \
+ mov.l @tmp, tmp2 ; \
+ bra 98f ; \
+ mov #FUTEX_PRIVATE_FLAG, tmp
+99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
+98: extu.b tmp, tmp ; \
+ xor tmp, reg ; \
+ and tmp2, reg ; \
+ mov #FUTEX_WAKE, tmp ; \
+ or tmp, reg
#endif
-
- .globl __lll_mutex_lock_wait
- .type __lll_mutex_lock_wait,@function
- .hidden __lll_mutex_lock_wait
- .align 5
- cfi_startproc
-__lll_mutex_lock_wait:
+ .globl __lll_lock_wait_private
+ .type __lll_lock_wait_private,@function
+ .hidden __lll_lock_wait_private
+ .align 5
+ cfi_startproc
+__lll_lock_wait_private:
mov.l r8, @-r15
cfi_adjust_cfa_offset(4)
cfi_rel_offset (r8, 0)
mov r4, r6
mov r5, r8
mov #0, r7 /* No timeout. */
- LOAD_FUTEX_WAIT (r5, r0)
+ LOAD_PRIVATE_FUTEX_WAIT (r5, r0, r1)
mov #2, r4
cmp/eq r4, r6
@@ -79,22 +146,67 @@
ret
mov r2, r0
cfi_endproc
- .size __lll_mutex_lock_wait,.-__lll_mutex_lock_wait
-
+ .size __lll_lock_wait_private,.-__lll_lock_wait_private
#ifdef NOT_IN_libc
- .globl __lll_mutex_timedlock_wait
- .type __lll_mutex_timedlock_wait,@function
- .hidden __lll_mutex_timedlock_wait
- .align 5
- cfi_startproc
-__lll_mutex_timedlock_wait:
+ .globl __lll_lock_wait
+ .type __lll_lock_wait,@function
+ .hidden __lll_lock_wait
+ .align 5
+ cfi_startproc
+__lll_lock_wait:
+ mov.l r9, @-r15
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r9, 0)
+ mov.l r8, @-r15
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r8, 0)
+ mov r6, r9
+ mov r4, r6
+ mov r5, r8
+ mov #0, r7 /* No timeout. */
+ mov r9, r5
+ LOAD_FUTEX_WAIT (r5, r0, r1)
+
+ mov #2, r4
+ cmp/eq r4, r6
+ bf 2f
+
+1:
+ mov r8, r4
+ mov #SYS_futex, r3
+ extu.b r3, r3
+ trapa #0x14
+ SYSCALL_INST_PAD
+
+2:
+ mov #2, r6
+ XCHG (r6, @r8, r2)
+ tst r2, r2
+ bf 1b
+
+ mov.l @r15+, r8
+ mov.l @r15+, r9
+ ret
+ mov r2, r0
+ cfi_endproc
+ .size __lll_lock_wait,.-__lll_lock_wait
+
+ .globl __lll_timedlock_wait
+ .type __lll_timedlock_wait,@function
+ .hidden __lll_timedlock_wait
+ .align 5
+ cfi_startproc
+__lll_timedlock_wait:
/* Check for a valid timeout value. */
mov.l @(4,r6), r1
mov.l .L1g, r0
cmp/hs r0, r1
bt 3f
+ mov.l r11, @-r15
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r11, 0)
mov.l r10, @-r15
cfi_adjust_cfa_offset(4)
cfi_rel_offset (r10, 0)
@@ -104,6 +216,7 @@
mov.l r8, @-r15
cfi_adjust_cfa_offset(4)
cfi_rel_offset (r8, 0)
+ mov r7, r11
mov r4, r10
mov r6, r9
mov r5, r8
@@ -116,7 +229,7 @@
/* Get current time. */
mov r15, r4
mov #0, r5
- mov #SYS_gettimeofday, r3
+ mov #__NR_gettimeofday, r3
trapa #0x12
SYSCALL_INST_PAD
@@ -149,7 +262,8 @@
bt 8f
mov r8, r4
- LOAD_FUTEX_WAIT (r5, r0)
+ mov r11, r5
+ LOAD_FUTEX_WAIT (r5, r0, r1)
mov r10, r6
mov r15, r7
mov #SYS_futex, r3
@@ -169,8 +283,9 @@
add #8, r15
mov.l @r15+, r8
mov.l @r15+, r9
+ mov.l @r15+, r10
rts
- mov.l @r15+, r10
+ mov.l @r15+, r11
7:
/* Check whether the time expired. */
mov #-ETIMEDOUT, r1
@@ -198,17 +313,16 @@
.L1g:
.long 1000000000
- .size __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait
+ .size __lll_timedlock_wait,.-__lll_timedlock_wait
#endif
-
- .globl __lll_mutex_unlock_wake
- .type __lll_mutex_unlock_wake,@function
- .hidden __lll_mutex_unlock_wake
- .align 5
- cfi_startproc
-__lll_mutex_unlock_wake:
- LOAD_FUTEX_WAKE (r5, r0)
+ .globl __lll_unlock_wake_private
+ .type __lll_unlock_wake_private,@function
+ .hidden __lll_unlock_wake_private
+ .align 5
+ cfi_startproc
+__lll_unlock_wake_private:
+ LOAD_PRIVATE_FUTEX_WAKE (r5, r0, r1)
mov #1, r6 /* Wake one thread. */
mov #0, r7
mov.l r7, @r4 /* Stores 0. */
@@ -219,10 +333,28 @@
rts
nop
cfi_endproc
- .size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake
-
+ .size __lll_unlock_wake_private,.-__lll_unlock_wake_private
#ifdef NOT_IN_libc
+ .globl __lll_unlock_wake
+ .type __lll_unlock_wake,@function
+ .hidden __lll_unlock_wake
+ .align 5
+ cfi_startproc
+__lll_unlock_wake:
+ LOAD_FUTEX_WAKE (r5, r0, r1)
+ mov #1, r6 /* Wake one thread. */
+ mov #0, r7
+ mov.l r7, @r4 /* Stores 0. */
+ mov #SYS_futex, r3
+ extu.b r3, r3
+ trapa #0x14
+ SYSCALL_INST_PAD
+ rts
+ nop
+ cfi_endproc
+ .size __lll_unlock_wake,.-__lll_unlock_wake
+
.globl __lll_timedwait_tid
.type __lll_timedwait_tid,@function
.hidden __lll_timedwait_tid
@@ -246,7 +378,7 @@
/* Get current time. */
mov r15, r4
mov #0, r5
- mov #SYS_gettimeofday, r3
+ mov #__NR_gettimeofday, r3
trapa #0x12
SYSCALL_INST_PAD
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h Sat Aug 4 00:02:44 2007
@@ -19,19 +19,24 @@
#ifndef _LOWLEVELLOCK_H
#define _LOWLEVELLOCK_H 1
+#ifndef __ASSEMBLER__
#include <time.h>
#include <sys/param.h>
#include <bits/pthreadtypes.h>
#include <kernel-features.h>
+#endif
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
+#define FUTEX_CMP_REQUEUE 4
+#define FUTEX_WAKE_OP 5
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_PRIVATE_FLAG 128
+#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1)
/* Values for 'private' parameter of locking macros. Yes, the
definition seems to be backwards. But it is not. The bit will be
@@ -64,20 +69,30 @@
# endif
#endif
+#ifndef __ASSEMBLER__
/* Initializer for compatibility lock. */
-#define LLL_MUTEX_LOCK_INITIALIZER (0)
-#define LLL_MUTEX_LOCK_INITIALIZER_LOCKED (1)
-#define LLL_MUTEX_LOCK_INITIALIZER_WAITERS (2)
-
-extern int __lll_mutex_lock_wait (int val, int *__futex) attribute_hidden;
-extern int __lll_mutex_timedlock_wait (int val, int *__futex,
- const struct timespec *abstime)
- attribute_hidden;
-extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden;
-
-
-#define lll_mutex_trylock(futex) \
+#define LLL_LOCK_INITIALIZER (0)
+#define LLL_LOCK_INITIALIZER_LOCKED (1)
+#define LLL_LOCK_INITIALIZER_WAITERS (2)
+
+extern int __lll_lock_wait_private (int val, int *__futex)
+ attribute_hidden;
+extern int __lll_lock_wait (int val, int *__futex, int private)
+ attribute_hidden;
+extern int __lll_timedlock_wait (int val, int *__futex,
+ const struct timespec *abstime, int private)
+ attribute_hidden;
+extern int __lll_robust_lock_wait (int val, int *__futex, int private)
+ attribute_hidden;
+extern int __lll_robust_timedlock_wait (int val, int *__futex,
+ const struct timespec *abstime,
+ int private)
+ attribute_hidden;
+extern int __lll_unlock_wake_private (int *__futex) attribute_hidden;
+extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
+
+#define lll_trylock(futex) \
({ unsigned char __result; \
__asm __volatile ("\
.align 2\n\
@@ -94,12 +109,12 @@
negc %0,%0"\
: "=r" (__result) \
: "r" (&(futex)), \
- "r" (LLL_MUTEX_LOCK_INITIALIZER_LOCKED), \
- "r" (LLL_MUTEX_LOCK_INITIALIZER) \
+ "r" (LLL_LOCK_INITIALIZER_LOCKED), \
+ "r" (LLL_LOCK_INITIALIZER) \
: "r0", "r1", "r2", "t", "memory"); \
__result; })
-#define lll_robust_mutex_trylock(futex, id) \
+#define lll_robust_trylock(futex, id) \
({ unsigned char __result; \
__asm __volatile ("\
.align 2\n\
@@ -117,11 +132,11 @@
: "=r" (__result) \
: "r" (&(futex)), \
"r" (id), \
- "r" (LLL_MUTEX_LOCK_INITIALIZER) \
+ "r" (LLL_LOCK_INITIALIZER) \
: "r0", "r1", "r2", "t", "memory"); \
__result; })
-#define lll_mutex_cond_trylock(futex) \
+#define lll_cond_trylock(futex) \
({ unsigned char __result; \
__asm __volatile ("\
.align 2\n\
@@ -138,13 +153,13 @@
negc %0,%0"\
: "=r" (__result) \
: "r" (&(futex)), \
- "r" (LLL_MUTEX_LOCK_INITIALIZER_WAITERS), \
- "r" (LLL_MUTEX_LOCK_INITIALIZER) \
+ "r" (LLL_LOCK_INITIALIZER_WAITERS), \
+ "r" (LLL_LOCK_INITIALIZER) \
: "r0", "r1", "r2", "t", "memory"); \
__result; })
-#define lll_mutex_lock(futex) \
- (void) ({ int __result, val, *__futex = &(futex); \
+#define lll_lock(futex, private) \
+ (void) ({ int __result, *__futex = &(futex); \
__asm __volatile ("\
.align 2\n\
mova 1f,r0\n\
@@ -159,10 +174,17 @@
: "=&r" (__result) : "r" (1), "r" (__futex) \
: "r0", "r1", "t", "memory"); \
if (__result) \
- __lll_mutex_lock_wait (__result, __futex); })
-
-#define lll_robust_mutex_lock(futex, id) \
- ({ int __result, val, *__futex = &(futex); \
+ { \
+ if (__builtin_constant_p (private) \
+ && (private) == LLL_PRIVATE) \
+ __lll_lock_wait_private (__result, __futex); \
+ else \
+ __lll_lock_wait (__result, __futex, (private)); \
+ } \
+ })
+
+#define lll_robust_lock(futex, id, private) \
+ ({ int __result, *__futex = &(futex); \
__asm __volatile ("\
.align 2\n\
mova 1f,r0\n\
@@ -177,13 +199,13 @@
: "=&r" (__result) : "r" (id), "r" (__futex) \
: "r0", "r1", "t", "memory"); \
if (__result) \
- __result = __lll_robust_mutex_lock_wait (__result, __futex); \
+ __result = __lll_robust_lock_wait (__result, __futex, private); \
__result; })
/* Special version of lll_mutex_lock which causes the unlock function to
always wakeup waiters. */
-#define lll_mutex_cond_lock(futex) \
- (void) ({ int __result, val, *__futex = &(futex); \
+#define lll_cond_lock(futex, private) \
+ (void) ({ int __result, *__futex = &(futex); \
__asm __volatile ("\
.align 2\n\
mova 1f,r0\n\
@@ -198,10 +220,10 @@
: "=&r" (__result) : "r" (2), "r" (__futex) \
: "r0", "r1", "t", "memory"); \
if (__result) \
- __lll_mutex_lock_wait (__result, __futex); })
-
-#define lll_robust_mutex_cond_lock(futex, id) \
- ({ int __result, val, *__futex = &(futex); \
+ __lll_lock_wait (__result, __futex, private); })
+
+#define lll_robust_cond_lock(futex, id, private) \
+ ({ int __result, *__futex = &(futex); \
__asm __volatile ("\
.align 2\n\
mova 1f,r0\n\
@@ -216,11 +238,11 @@
: "=&r" (__result) : "r" (id | FUTEX_WAITERS), "r" (__futex) \
: "r0", "r1", "t", "memory"); \
if (__result) \
- __result = __lll_robust_mutex_lock_wait (__result, __futex); \
+ __result = __lll_robust_lock_wait (__result, __futex, private); \
__result; })
-#define lll_mutex_timedlock(futex, timeout) \
- ({ int __result, val, *__futex = &(futex); \
+#define lll_timedlock(futex, timeout, private) \
+ ({ int __result, *__futex = &(futex); \
__asm __volatile ("\
.align 2\n\
mova 1f,r0\n\
@@ -235,11 +257,11 @@
: "=&r" (__result) : "r" (1), "r" (__futex) \
: "r0", "r1", "t", "memory"); \
if (__result) \
- __result = __lll_mutex_timedlock_wait (__result, __futex, timeout); \
+ __result = __lll_timedlock_wait (__result, __futex, timeout, private); \
__result; })
-#define lll_robust_mutex_timedlock(futex, timeout, id) \
- ({ int __result, val, *__futex = &(futex); \
+#define lll_robust_timedlock(futex, timeout, id, private) \
+ ({ int __result, *__futex = &(futex); \
__asm __volatile ("\
.align 2\n\
mova 1f,r0\n\
@@ -254,11 +276,11 @@
: "=&r" (__result) : "r" (id), "r" (__futex) \
: "r0", "r1", "t", "memory"); \
if (__result) \
- __result = __lll_robust_mutex_timedlock_wait (__result, __futex, \
- timeout); \
+ __result = __lll_robust_timedlock_wait (__result, __futex, \
+ timeout, private); \
__result; })
-#define lll_mutex_unlock(futex) \
+#define lll_unlock(futex, private) \
(void) ({ int __result, *__futex = &(futex); \
__asm __volatile ("\
.align 2\n\
@@ -272,9 +294,16 @@
: "=&r" (__result) : "r" (__futex) \
: "r0", "r1", "memory"); \
if (__result) \
- __lll_mutex_unlock_wake (__futex); })
-
-#define lll_robust_mutex_unlock(futex) \
+ { \
+ if (__builtin_constant_p (private) \
+ && (private) == LLL_PRIVATE) \
+ __lll_unlock_wake_private (__futex); \
+ else \
+ __lll_unlock_wake (__futex, (private)); \
+ } \
+ })
+
+#define lll_robust_unlock(futex, private) \
(void) ({ int __result, *__futex = &(futex); \
__asm __volatile ("\
.align 2\n\
@@ -288,9 +317,9 @@
: "=&r" (__result) : "r" (__futex), "r" (FUTEX_WAITERS) \
: "r0", "r1", "memory"); \
if (__result) \
- __lll_mutex_unlock_wake (__futex); })
-
-#define lll_robust_mutex_dead(futex) \
+ __lll_unlock_wake (__futex, private); })
+
+#define lll_robust_dead(futex, private) \
(void) ({ int __ignore, *__futex = &(futex); \
__asm __volatile ("\
.align 2\n\
@@ -303,22 +332,7 @@
1: mov r1,r15"\
: "=&r" (__ignore) : "r" (__futex), "r" (FUTEX_OWNER_DIED) \
: "r0", "r1", "memory"); \
- lll_futex_wake (__futex, 1, LLL_SHARED); })
-
-#define lll_mutex_islocked(futex) \
- (futex != 0)
-
-
-/* We have a separate internal lock implementation which is not tied
- to binary compatibility. */
-
-/* Type for lock object. */
-typedef int lll_lock_t;
-
-/* Initializers for lock. */
-#define LLL_LOCK_INITIALIZER (0)
-#define LLL_LOCK_INITIALIZER_LOCKED (1)
-
+ lll_futex_wake (__futex, 1, private); })
# ifdef NEED_SYSCALL_INST_PAD
# define SYSCALL_WITH_INST_PAD "\
@@ -367,25 +381,14 @@
} while (0)
-/* The states of a lock are:
- 0 - untaken
- 1 - taken by one user
- 2 - taken by more users */
-
-#define lll_trylock(futex) lll_mutex_trylock (futex)
-#define lll_lock(futex) lll_mutex_lock (futex)
-#define lll_unlock(futex) lll_mutex_unlock (futex)
-
#define lll_islocked(futex) \
(futex != LLL_LOCK_INITIALIZER)
-
/* The kernel notifies a process with uses CLONE_CLEARTID via futex
wakeup when the clone terminates. The memory location contains the
thread ID while the clone is running and is reset to zero
afterwards. */
-extern int __lll_wait_tid (int *tid) attribute_hidden;
#define lll_wait_tid(tid) \
do { \
__typeof (tid) *__tid = &(tid); \
@@ -407,24 +410,6 @@
} \
__result; })
-
-/* Conditional variable handling. */
-
-extern void __lll_cond_wait (pthread_cond_t *cond) attribute_hidden;
-extern int __lll_cond_timedwait (pthread_cond_t *cond,
- const struct timespec *abstime)
- attribute_hidden;
-extern void __lll_cond_wake (pthread_cond_t *cond) attribute_hidden;
-extern void __lll_cond_broadcast (pthread_cond_t *cond) attribute_hidden;
-
-
-#define lll_cond_wait(cond) \
- __lll_cond_wait (cond)
-#define lll_cond_timedwait(cond, abstime) \
- __lll_cond_timedwait (cond, abstime)
-#define lll_cond_wake(cond) \
- __lll_cond_wake (cond)
-#define lll_cond_broadcast(cond) \
- __lll_cond_broadcast (cond)
+#endif /* !__ASSEMBLER__ */
#endif /* lowlevellock.h */
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S Sat Aug 4 00:02:44 2007
@@ -1,4 +1,5 @@
-/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006, 2007
+ 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
@@ -18,31 +19,64 @@
#include <sysdep.h>
#include <pthread-errnos.h>
+#include <lowlevellock.h>
#include <lowlevelrobustlock.h>
+#include <kernel-features.h>
#include "lowlevel-atomic.h"
.text
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
#define FUTEX_WAITERS 0x80000000
#define FUTEX_OWNER_DIED 0x40000000
-
- .globl __lll_robust_mutex_lock_wait
- .type __lll_robust_mutex_lock_wait,@function
- .hidden __lll_robust_mutex_lock_wait
+#ifdef __ASSUME_PRIVATE_FUTEX
+# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \
+ mov #(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), tmp; \
+ extu.b tmp, tmp; \
+ xor tmp, reg
+#else
+# if FUTEX_WAIT == 0
+# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \
+ stc gbr, tmp ; \
+ mov.w 99f, tmp2 ; \
+ add tmp2, tmp ; \
+ mov.l @tmp, tmp2 ; \
+ bra 98f ; \
+ mov #FUTEX_PRIVATE_FLAG, tmp
+99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
+98: extu.b tmp, tmp ; \
+ xor tmp, reg ; \
+ and tmp2, reg
+# else
+# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \
+ stc gbr, tmp ; \
+ mov.w 99f, tmp2 ; \
+ add tmp2, tmp ; \
+ mov.l @tmp, tmp2 ; \
+ bra 98f ; \
+ mov #FUTEX_PRIVATE_FLAG, tmp
+99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \
+98: extu.b tmp, tmp ; \
+ xor tmp, reg ; \
+ and tmp2, reg ; \
+ mov #FUTEX_WAIT, tmp ; \
+ or tmp, reg
+# endif
+#endif
+
+ .globl __lll_robust_lock_wait
+ .type __lll_robust_lock_wait,@function
+ .hidden __lll_robust_lock_wait
.align 5
cfi_startproc
-__lll_robust_mutex_lock_wait:
+__lll_robust_lock_wait:
mov.l r8, @-r15
cfi_adjust_cfa_offset(4)
cfi_rel_offset (r8, 0)
mov r5, r8
mov #0, r7 /* No timeout. */
- mov #FUTEX_WAIT, r5
+ mov r6, r5
+ LOAD_FUTEX_WAIT (r5, r0, r1)
4:
mov r4, r6
@@ -90,21 +124,24 @@
.long FUTEX_WAITERS
.Ltidoff:
.word TID - TLS_PRE_TCB_SIZE
- .size __lll_robust_mutex_lock_wait,.-__lll_robust_mutex_lock_wait
-
-
- .globl __lll_robust_mutex_timedlock_wait
- .type __lll_robust_mutex_timedlock_wait,@function
- .hidden __lll_robust_mutex_timedlock_wait
+ .size __lll_robust_lock_wait,.-__lll_robust_lock_wait
+
+
+ .globl __lll_robust_timedlock_wait
+ .type __lll_robust_timedlock_wait,@function
+ .hidden __lll_robust_timedlock_wait
.align 5
cfi_startproc
-__lll_robust_mutex_timedlock_wait:
+__lll_robust_timedlock_wait:
/* Check for a valid timeout value. */
mov.l @(4,r6), r1
mov.l .L1g, r0
cmp/hs r0, r1
bt 3f
+ mov.l r11, @-r15
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset (r11, 0)
mov.l r10, @-r15
cfi_adjust_cfa_offset(4)
cfi_rel_offset (r10, 0)
@@ -114,6 +151,7 @@
mov.l r8, @-r15
cfi_adjust_cfa_offset(4)
cfi_rel_offset (r8, 0)
+ mov r7, r11
mov r4, r10
mov r6, r9
mov r5, r8
@@ -126,7 +164,7 @@
/* Get current time. */
mov r15, r4
mov #0, r5
- mov #SYS_gettimeofday, r3
+ mov #__NR_gettimeofday, r3
trapa #0x12
SYSCALL_INST_PAD
@@ -167,7 +205,8 @@
2:
mov r8, r4
- mov #FUTEX_WAIT, r5
+ mov r11, r5
+ LOAD_FUTEX_WAIT (r5, r0, r1)
mov r10, r6
mov r15, r7
mov #SYS_futex, r3
@@ -196,8 +235,9 @@
add #8, r15
mov.l @r15+, r8
mov.l @r15+, r9
+ mov.l @r15+, r10
rts
- mov.l @r15+, r10
+ mov.l @r15+, r11
7:
/* Check whether the time expired. */
@@ -221,4 +261,4 @@
.word TID - TLS_PRE_TCB_SIZE
.L1k:
.word 1000
- .size __lll_robust_mutex_timedlock_wait,.-__lll_robust_mutex_timedlock_wait
+ .size __lll_robust_timedlock_wait,.-__lll_robust_timedlock_wait
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S Sat Aug 4 00:02:44 2007
@@ -17,13 +17,9 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <lowlevellock.h>
#include <lowlevelbarrier.h>
#include "lowlevel-atomic.h"
-
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-
.text
@@ -152,6 +148,10 @@
mov.l @r15+, r9
1:
+ mov.l @(PRIVATE,r8), r6
+ mov #LLL_SHARED, r0
+ extu.b r0, r0
+ xor r0, r6
mov r2, r4
mov r8, r5
mov.l .Lwait0, r1
@@ -162,6 +162,10 @@
nop
4:
+ mov.l @(PRIVATE,r8), r5
+ mov #LLL_SHARED, r0
+ extu.b r0, r0
+ xor r0, r5
mov r8, r4
mov.l .Lwake0, r1
bsrf r1
@@ -172,6 +176,10 @@
6:
mov r6, r9
+ mov.l @(PRIVATE,r8), r5
+ mov #LLL_SHARED, r0
+ extu.b r0, r0
+ xor r0, r5
mov r8, r4
mov.l .Lwake1, r1
bsrf r1
@@ -182,6 +190,10 @@
9:
mov r6, r9
+ mov.l @(PRIVATE,r8), r5
+ mov #LLL_SHARED, r0
+ extu.b r0, r0
+ xor r0, r5
mov r8, r4
mov.l .Lwake2, r1
bsrf r1
@@ -194,11 +206,11 @@
.Lall:
.long 0x7fffffff
.Lwait0:
- .long __lll_mutex_lock_wait-.Lwait0b
+ .long __lll_lock_wait-.Lwait0b
.Lwake0:
- .long __lll_mutex_unlock_wake-.Lwake0b
+ .long __lll_unlock_wake-.Lwake0b
.Lwake1:
- .long __lll_mutex_unlock_wake-.Lwake1b
+ .long __lll_unlock_wake-.Lwake1b
.Lwake2:
- .long __lll_mutex_unlock_wake-.Lwake2b
+ .long __lll_unlock_wake-.Lwake2b
.size pthread_barrier_wait,.-pthread_barrier_wait
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S Sat Aug 4 00:02:44 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006, 2007 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
@@ -18,18 +18,12 @@
#include <sysdep.h>
#include <shlib-compat.h>
+#include <lowlevellock.h>
#include <lowlevelcond.h>
#include <kernel-features.h>
#include <pthread-pi-defines.h>
+#include <pthread-errnos.h>
#include "lowlevel-atomic.h"
-
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_REQUEUE 3
-#define FUTEX_CMP_REQUEUE 4
-
-#define EINVAL 22
.text
@@ -162,10 +156,12 @@
#if cond_lock != 0
add #cond_lock, r5
#endif
- mov.l .Lmwait5, r1
+ mov #LLL_SHARED, r6
+ extu.b r6, r6
+ mov.l .Lwait5, r1
bsrf r1
mov r2, r4
-.Lmwait5b:
+.Lwait5b:
bra 2b
nop
@@ -175,10 +171,11 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake5, r1
+ mov #LLL_SHARED, r5
+ mov.l .Lwake5, r1
bsrf r1
- nop
-.Lmwake5b:
+ extu.b r5, r5
+.Lwake5b:
bra 6b
nop
@@ -188,10 +185,11 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake6, r1
+ mov #LLL_SHARED, r5
+ mov.l .Lwake6, r1
bsrf r1
- nop
-.Lmwake6b:
+ extu.b r5, r5
+.Lwake6b:
bra 8b
nop
@@ -208,12 +206,12 @@
nop
.align 2
-.Lmwait5:
- .long __lll_mutex_lock_wait-.Lmwait5b
-.Lmwake5:
- .long __lll_mutex_unlock_wake-.Lmwake5b
-.Lmwake6:
- .long __lll_mutex_unlock_wake-.Lmwake6b
+.Lwait5:
+ .long __lll_lock_wait-.Lwait5b
+.Lwake5:
+ .long __lll_unlock_wake-.Lwake5b
+.Lwake6:
+ .long __lll_unlock_wake-.Lwake6b
.size __pthread_cond_broadcast, .-__pthread_cond_broadcast
versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
GLIBC_2_3_2)
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S Sat Aug 4 00:02:44 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007 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
@@ -18,16 +18,11 @@
#include <sysdep.h>
#include <shlib-compat.h>
+#include <lowlevellock.h>
#include <lowlevelcond.h>
#include <kernel-features.h>
+#include <pthread-errnos.h>
#include "lowlevel-atomic.h"
-
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_REQUEUE 3
-
-#define EINVAL 22
.text
@@ -108,10 +103,12 @@
#if cond_lock != 0
add #cond_lock, r5
#endif
- mov.l .Lmwait4, r1
+ mov #LLL_SHARED, r6
+ extu.b r6, r6
+ mov.l .Lwait4, r1
bsrf r1
mov r2, r4
-.Lmwait4b:
+.Lwait4b:
bra 2b
nop
@@ -121,18 +118,19 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake4, r1
+ mov #LLL_SHARED, r5
+ mov.l .Lwake4, r1
bsrf r1
- nop
-.Lmwake4b:
+ extu.b r5, r5
+.Lwake4b:
bra 6b
nop
.align 2
-.Lmwait4:
- .long __lll_mutex_lock_wait-.Lmwait4b
-.Lmwake4:
- .long __lll_mutex_unlock_wake-.Lmwake4b
+.Lwait4:
+ .long __lll_lock_wait-.Lwait4b
+.Lwake4:
+ .long __lll_unlock_wake-.Lwake4b
.size __pthread_cond_signal, .-__pthread_cond_signal
versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
GLIBC_2_3_2)
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S Sat Aug 4 00:02:44 2007
@@ -18,15 +18,10 @@
#include <sysdep.h>
#include <shlib-compat.h>
+#include <lowlevellock.h>
#include <lowlevelcond.h>
#include <pthread-errnos.h>
#include "lowlevel-atomic.h"
-
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-
.text
@@ -164,7 +159,7 @@
mov r15, r4
add #16, r4
mov #0, r5
- mov #SYS_gettimeofday, r3
+ mov #__NR_gettimeofday, r3
trapa #0x12
SYSCALL_INST_PAD
@@ -182,7 +177,7 @@
mov r15, r4
add #16, r4
mov #0, r5
- mov #SYS_gettimeofday, r3
+ mov #__NR_gettimeofday, r3
trapa #0x12
SYSCALL_INST_PAD
@@ -403,10 +398,12 @@
#if cond_lock != 0
add #cond_lock, r5
#endif
- mov.l .Lmwait2, r1
+ mov #LLL_SHARED, r6
+ extu.b r6, r6
+ mov.l .Lwait2, r1
bsrf r1
mov r2, r4
-.Lmwait2b:
+.Lwait2b:
bra 2b
nop
@@ -416,10 +413,11 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake2, r1
- bsrf r1
- nop
-.Lmwake2b:
+ mov #LLL_SHARED, r5
+ mov.l .Lmwait2, r1
+ bsrf r1
+ extu.b r5, r5
+.Lmwait2b:
bra 4b
nop
@@ -429,10 +427,12 @@
#if cond_lock != 0
add #cond_lock, r5
#endif
- mov.l .Lmwait3, r1
+ mov #LLL_SHARED, r6
+ extu.b r6, r6
+ mov.l .Lwait3, r1
bsrf r1
mov r2, r4
-.Lmwait3b:
+.Lwait3b:
bra 6b
nop
@@ -442,10 +442,11 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake3, r1
- bsrf r1
- nop
-.Lmwake3b:
+ mov #LLL_SHARED, r5
+ mov.l .Lmwait3, r1
+ bsrf r1
+ extu.b r5, r5
+.Lmwait3b:
bra 11b
nop
@@ -464,25 +465,26 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake4, r1
- bsrf r1
- nop
-.Lmwake4b:
+ mov #LLL_SHARED, r5
+ mov.l .Lmwait4, r1
+ bsrf r1
+ extu.b r5, r5
+.Lmwait4b:
17:
bra 18b
mov.l @(24,r15), r0
.align 2
+.Lwait2:
+ .long __lll_lock_wait-.Lwait2b
.Lmwait2:
- .long __lll_mutex_lock_wait-.Lmwait2b
-.Lmwake2:
- .long __lll_mutex_unlock_wake-.Lmwake2b
+ .long __lll_unlock_wake-.Lmwait2b
+.Lwait3:
+ .long __lll_lock_wait-.Lwait3b
.Lmwait3:
- .long __lll_mutex_lock_wait-.Lmwait3b
-.Lmwake3:
- .long __lll_mutex_unlock_wake-.Lmwake3b
-.Lmwake4:
- .long __lll_mutex_unlock_wake-.Lmwake4b
+ .long __lll_unlock_wake-.Lmwait3b
+.Lmwait4:
+ .long __lll_unlock_wake-.Lmwait4b
.size __pthread_cond_timedwait, .-__pthread_cond_timedwait
versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
GLIBC_2_3_2)
@@ -507,10 +509,12 @@
#if cond_lock != 0
add #cond_lock, r5
#endif
- mov.l .Lmwait5, r1
+ mov #LLL_SHARED, r6
+ extu.b r6, r6
+ mov.l .Lwait5, r1
bsrf r1
mov r2, r4
-.Lmwait5b:
+.Lwait5b:
1:
mov.l @(broadcast_seq,r8), r0
@@ -600,10 +604,11 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake5, r1
- bsrf r1
- nop
-.Lmwake5b:
+ mov #LLL_SHARED, r5
+ mov.l .Lmwait5, r1
+ bsrf r1
+ extu.b r5, r5
+.Lmwait5b:
2:
/* Wake up all waiters to make sure no signal gets lost. */
@@ -636,10 +641,10 @@
sleep
.align 2
+.Lwait5:
+ .long __lll_lock_wait-.Lwait5b
.Lmwait5:
- .long __lll_mutex_lock_wait-.Lmwait5b
-.Lmwake5:
- .long __lll_mutex_unlock_wake-.Lmwake5b
+ .long __lll_unlock_wake-.Lmwait5b
.Lmlocki5:
.long __pthread_mutex_cond_lock-.Lmlocki5b
.Lresume:
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S Sat Aug 4 00:02:44 2007
@@ -18,13 +18,9 @@
#include <sysdep.h>
#include <shlib-compat.h>
+#include <lowlevellock.h>
#include <lowlevelcond.h>
#include "lowlevel-atomic.h"
-
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-
.text
@@ -267,10 +263,12 @@
#if cond_lock != 0
add #cond_lock, r5
#endif
- mov.l .Lmwait0, r1
+ mov #LLL_SHARED, r6
+ extu.b r6, r6
+ mov.l .Lwait0, r1
bsrf r1
mov r2, r4
-.Lmwait0b:
+.Lwait0b:
bra 2b
nop
3:
@@ -279,10 +277,11 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake0, r1
- bsrf r1
- nop
-.Lmwake0b:
+ mov #LLL_SHARED, r5
+ mov.l .Lwake0, r1
+ bsrf r1
+ extu.b r5, r5
+.Lwake0b:
bra 4b
nop
@@ -292,10 +291,12 @@
#if cond_lock != 0
add #cond_lock, r5
#endif
- mov.l .Lmwait1, r1
+ mov #LLL_SHARED, r6
+ extu.b r6, r6
+ mov.l .Lwait1, r1
bsrf r1
mov r2, r4
-.Lmwait1b:
+.Lwait1b:
bra 6b
nop
@@ -305,10 +306,11 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake1, r1
- bsrf r1
- nop
-.Lmwake1b:
+ mov #LLL_SHARED, r5
+ mov.l .Lwake1, r1
+ bsrf r1
+ extu.b r5, r5
+.Lwake1b:
bra 11b
nop
@@ -327,26 +329,27 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake2, r1
- bsrf r1
- nop
-.Lmwake2b:
+ mov #LLL_SHARED, r5
+ mov.l .Lwake2, r1
+ bsrf r1
+ extu.b r5, r5
+.Lwake2b:
13:
bra 14b
mov.l @(12,r15), r0
.align 2
-.Lmwait0:
- .long __lll_mutex_lock_wait-.Lmwait0b
-.Lmwake0:
- .long __lll_mutex_unlock_wake-.Lmwake0b
-.Lmwait1:
- .long __lll_mutex_lock_wait-.Lmwait1b
-.Lmwake1:
- .long __lll_mutex_unlock_wake-.Lmwake1b
-.Lmwake2:
- .long __lll_mutex_unlock_wake-.Lmwake2b
+.Lwait0:
+ .long __lll_lock_wait-.Lwait0b
+.Lwake0:
+ .long __lll_unlock_wake-.Lwake0b
+.Lwait1:
+ .long __lll_lock_wait-.Lwait1b
+.Lwake1:
+ .long __lll_unlock_wake-.Lwake1b
+.Lwake2:
+ .long __lll_unlock_wake-.Lwake2b
.size __pthread_cond_wait, .-__pthread_cond_wait
versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
GLIBC_2_3_2)
@@ -371,10 +374,12 @@
#if cond_lock != 0
add #cond_lock, r5
#endif
- mov.l .Lmwait3, r1
+ mov #LLL_SHARED, r6
+ extu.b r6, r6
+ mov.l .Lwait3, r1
bsrf r1
mov r2, r4
-.Lmwait3b:
+.Lwait3b:
1:
mov.l @(broadcast_seq,r8), r0
@@ -464,10 +469,11 @@
#if cond_lock != 0
add #cond_lock, r4
#endif
- mov.l .Lmwake3, r1
- bsrf r1
- nop
-.Lmwake3b:
+ mov #LLL_SHARED, r5
+ mov.l .Lwake3, r1
+ bsrf r1
+ extu.b r5, r5
+.Lwake3b:
2:
/* Wake up all waiters to make sure no signal gets lost. */
@@ -500,10 +506,10 @@
sleep
.align 2
-.Lmwait3:
- .long __lll_mutex_lock_wait-.Lmwait3b
-.Lmwake3:
- .long __lll_mutex_unlock_wake-.Lmwake3b
+.Lwait3:
+ .long __lll_lock_wait-.Lwait3b
+.Lwake3:
+ .long __lll_unlock_wake-.Lwake3b
.Lmlocki3:
.long __pthread_mutex_cond_lock-.Lmlocki3b
.Lresume:
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S Sat Aug 4 00:02:44 2007
@@ -19,12 +19,9 @@
#include <unwindbuf.h>
#include <sysdep.h>
#include <kernel-features.h>
+#include <lowlevellock.h>
#include "lowlevel-atomic.h"
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.comm __fork_generation, 4, 4
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S Sat Aug 4 00:02:44 2007
@@ -17,16 +17,12 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <lowlevellock.h>
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
#include <kernel-features.h>
#include "lowlevel-atomic.h"
-
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -156,10 +152,12 @@
#if MUTEX != 0
add #MUTEX, r5
#endif
- mov r2, r4
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r6
+ extu.b r6, r6
mov.l .Lwait0, r1
bsrf r1
- nop
+ mov r2, r4
.Lwait0b:
bra 2b
nop
@@ -182,6 +180,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake0, r1
bsrf r1
nop
@@ -210,6 +211,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake1, r1
bsrf r1
nop
@@ -222,23 +226,25 @@
#if MUTEX != 0
add #MUTEX, r5
#endif
- mov r2, r4
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r6
+ extu.b r6, r6
mov.l .Lwait1, r1
bsrf r1
- nop
+ mov r2, r4
.Lwait1b:
bra 13b
nop
.align 2
.Lwait0:
- .long __lll_mutex_lock_wait-.Lwait0b
+ .long __lll_lock_wait-.Lwait0b
.Lwake0:
- .long __lll_mutex_unlock_wake-.Lwake0b
+ .long __lll_unlock_wake-.Lwake0b
.Lwait1:
- .long __lll_mutex_lock_wait-.Lwait1b
+ .long __lll_lock_wait-.Lwait1b
.Lwake1:
- .long __lll_mutex_unlock_wake-.Lwake1b
+ .long __lll_unlock_wake-.Lwake1b
.size __pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock
.globl pthread_rwlock_rdlock
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S Sat Aug 4 00:02:44 2007
@@ -17,17 +17,12 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <lowlevellock.h>
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
#include <kernel-features.h>
#include "lowlevel-atomic.h"
-
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -92,7 +87,7 @@
/* Get current time. */
mov r15, r4
mov #0, r5
- mov #SYS_gettimeofday, r3
+ mov #__NR_gettimeofday, r3
trapa #0x12
SYSCALL_INST_PAD
@@ -213,10 +208,12 @@
#if MUTEX != 0
add #MUTEX, r5
#endif
- mov r2, r4
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r6
+ extu.b r6, r6
mov.l .Lwait2, r1
bsrf r1
- nop
+ mov r2, r4
.Lwait2b:
bra 2b
nop
@@ -239,6 +236,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake2, r1
bsrf r1
nop
@@ -267,6 +267,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake3, r1
bsrf r1
nop
@@ -279,10 +282,12 @@
#if MUTEX != 0
add #MUTEX, r5
#endif
- mov r2, r4
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r6
+ extu.b r6, r6
mov.l .Lwait3, r1
bsrf r1
- nop
+ mov r2, r4
.Lwait3b:
bra 13b
nop
@@ -297,11 +302,11 @@
.align 2
.Lwait2:
- .long __lll_mutex_lock_wait-.Lwait2b
+ .long __lll_lock_wait-.Lwait2b
.Lwake2:
- .long __lll_mutex_unlock_wake-.Lwake2b
+ .long __lll_unlock_wake-.Lwake2b
.Lwait3:
- .long __lll_mutex_lock_wait-.Lwait3b
+ .long __lll_lock_wait-.Lwait3b
.Lwake3:
- .long __lll_mutex_unlock_wake-.Lwake3b
+ .long __lll_unlock_wake-.Lwake3b
.size pthread_rwlock_timedrdlock,.-pthread_rwlock_timedrdlock
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S Sat Aug 4 00:02:44 2007
@@ -17,17 +17,12 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <lowlevellock.h>
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
#include <kernel-features.h>
#include "lowlevel-atomic.h"
-
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -88,7 +83,7 @@
/* Get current time. */
mov r15, r4
mov #0, r5
- mov #SYS_gettimeofday, r3
+ mov #__NR_gettimeofday, r3
trapa #0x12
SYSCALL_INST_PAD
@@ -211,10 +206,12 @@
#if MUTEX != 0
add #MUTEX, r5
#endif
- mov r2, r4
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r6
+ extu.b r6, r6
mov.l .Lwait6, r1
bsrf r1
- nop
+ mov r2, r4
.Lwait6b:
bra 2b
nop
@@ -232,6 +229,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake6, r1
bsrf r1
nop
@@ -255,6 +255,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake7, r1
bsrf r1
nop
@@ -267,10 +270,12 @@
#if MUTEX != 0
add #MUTEX, r5
#endif
- mov r2, r4
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r6
+ extu.b r6, r6
mov.l .Lwait7, r1
bsrf r1
- nop
+ mov r2, r4
.Lwait7b:
bra 13b
nop
@@ -281,11 +286,11 @@
.align 2
.Lwait6:
- .long __lll_mutex_lock_wait-.Lwait6b
+ .long __lll_lock_wait-.Lwait6b
.Lwake6:
- .long __lll_mutex_unlock_wake-.Lwake6b
+ .long __lll_unlock_wake-.Lwake6b
.Lwait7:
- .long __lll_mutex_lock_wait-.Lwait7b
+ .long __lll_lock_wait-.Lwait7b
.Lwake7:
- .long __lll_mutex_unlock_wake-.Lwake7b
+ .long __lll_unlock_wake-.Lwake7b
.size pthread_rwlock_timedwrlock,.-pthread_rwlock_timedwrlock
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S Sat Aug 4 00:02:44 2007
@@ -17,14 +17,10 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <lowlevellock.h>
#include <lowlevelrwlock.h>
#include <kernel-features.h>
#include "lowlevel-atomic.h"
-
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -138,10 +134,12 @@
#if MUTEX != 0
add #MUTEX, r5
#endif
- mov r2, r4
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r6
+ extu.b r6, r6
mov.l .Lwait8, r1
bsrf r1
- nop
+ mov r2, r4
.Lwait8b:
bra 2b
nop
@@ -150,6 +148,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake8, r1
bsrf r1
nop
@@ -164,6 +165,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake9, r1
bsrf r1
nop
@@ -179,11 +183,11 @@
#endif
.align 2
.Lwait8:
- .long __lll_mutex_lock_wait-.Lwait8b
+ .long __lll_lock_wait-.Lwait8b
.Lwake8:
- .long __lll_mutex_unlock_wake-.Lwake8b
+ .long __lll_unlock_wake-.Lwake8b
.Lwake9:
- .long __lll_mutex_unlock_wake-.Lwake9b
+ .long __lll_unlock_wake-.Lwake9b
.size __pthread_rwlock_unlock,.-__pthread_rwlock_unlock
.globl pthread_rwlock_unlock
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S Sat Aug 4 00:02:44 2007
@@ -17,16 +17,12 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <lowlevellock.h>
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <tcb-offsets.h>
#include <kernel-features.h>
#include "lowlevel-atomic.h"
-
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-#define FUTEX_PRIVATE_FLAG 128
.text
@@ -145,10 +141,12 @@
#if MUTEX != 0
add #MUTEX, r5
#endif
- mov r2, r4
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r6
+ extu.b r6, r6
mov.l .Lwait4, r1
bsrf r1
- nop
+ mov r2, r4
.Lwait4b:
bra 2b
nop
@@ -166,6 +164,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake4, r1
bsrf r1
nop
@@ -192,6 +193,9 @@
#if MUTEX != 0
add #MUTEX, r4
#endif
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r5
+ extu.b r5, r5
mov.l .Lwake5, r1
bsrf r1
nop
@@ -204,23 +208,25 @@
#if MUTEX != 0
add #MUTEX, r5
#endif
- mov r2, r4
+ mov #PSHARED, r0
+ mov.b @(r0,r8), r6
+ extu.b r6, r6
mov.l .Lwait5, r1
bsrf r1
- nop
+ mov r2, r4
.Lwait5b:
bra 13b
nop
.align 2
.Lwait4:
- .long __lll_mutex_lock_wait-.Lwait4b
+ .long __lll_lock_wait-.Lwait4b
.Lwake4:
- .long __lll_mutex_unlock_wake-.Lwake4b
+ .long __lll_unlock_wake-.Lwake4b
.Lwait5:
- .long __lll_mutex_lock_wait-.Lwait5b
+ .long __lll_lock_wait-.Lwait5b
.Lwake5:
- .long __lll_mutex_unlock_wake-.Lwake5b
+ .long __lll_unlock_wake-.Lwake5b
.globl pthread_rwlock_wrlock
pthread_rwlock_wrlock = __pthread_rwlock_wrlock
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S Sat Aug 4 00:02:44 2007
@@ -20,13 +20,9 @@
#include <shlib-compat.h>
#include <pthread-errnos.h>
#include <structsem.h>
+#include <lowlevellock.h>
#include "lowlevel-atomic.h"
-
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
.text
@@ -65,7 +61,12 @@
mov.l .Lerrno3, r0
stc gbr, r1
mov.l @(r0, r12), r0
- add r1, r0
+ bra .Lexit
+ add r1, r0
+ .align 2
+.Lerrno3:
+ .long errno@GOTTPOFF
+.Lexit:
#else
mov.l .Lerrloc3, r1
bsrf r1
@@ -81,10 +82,7 @@
.align 2
.Lgot3:
.long _GLOBAL_OFFSET_TABLE_
-#if USE___THREAD
-.Lerrno3:
- .long errno@GOTTPOFF
-#else
+#if !USE___THREAD
.Lerrloc3:
.long __errno_location@PLT-(.Lerrloc3b-.)
#endif
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S Sat Aug 4 00:02:44 2007
@@ -21,12 +21,9 @@
#include <pthread-errnos.h>
#include <tcb-offsets.h>
#include <structsem.h>
+#include <lowlevellock.h>
#include "lowlevel-atomic.h"
-
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_futex 240
-#define FUTEX_WAIT 0
#if VALUE != 0
# error "code needs to be rewritten for VALUE != 0"
@@ -81,7 +78,7 @@
/* Compute relative timeout. */
mov r15, r4
mov #0, r5
- mov #SYS_gettimeofday, r3
+ mov #__NR_gettimeofday, r3
trapa #0x12
SYSCALL_INST_PAD
@@ -180,15 +177,19 @@
mov.l .Lerrno2, r0
stc gbr, r1
mov.l @(r0, r12), r0
- add r1, r0
- mov.l r10, @r0
+ bra .Lexit
+ add r1, r0
+ .align 2
+.Lerrno2:
+ .long errno@GOTTPOFF
+.Lexit:
#else
mov.l .Lerrloc2, r1
bsrf r1
nop
.Lerrloc2b:
+#endif
mov.l r10, @r0
-#endif
DEC (@(NWAITERS,r8), r2)
bra 10b
mov #-1, r0
@@ -200,10 +201,7 @@
.long 1000000000
.Lgot2:
.long _GLOBAL_OFFSET_TABLE_
-#if USE___THREAD
-.Lerrno2:
- .long errno@GOTTPOFF
-#else
+#if !USE___THREAD
.Lerrloc2:
.long __errno_location@PLT-(.Lerrloc2b-.)
#endif
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S Sat Aug 4 00:02:44 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007 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
@@ -19,6 +19,7 @@
#include <sysdep.h>
#include <shlib-compat.h>
#include <pthread-errnos.h>
+#include <lowlevellock.h>
#include "lowlevel-atomic.h"
@@ -60,15 +61,19 @@
mov.l .Lerrno1, r0
stc gbr, r1
mov.l @(r0, r12), r0
- add r1, r0
- mov.l r8, @r0
+ bra .Lexit
+ add r1, r0
+ .align 2
+.Lerrno1:
+ .long errno@GOTTPOFF
+.Lexit:
#else
mov.l .Lerrloc1, r1
bsrf r1
nop
.Lerrloc1b:
+#endif
mov.l r8, @r0
-#endif
lds.l @r15+, pr
mov.l @r15+, r8
mov.l @r15+, r12
@@ -78,10 +83,7 @@
.align 2
.Lgot1:
.long _GLOBAL_OFFSET_TABLE_
-#if USE___THREAD
-.Lerrno1:
- .long errno@GOTTPOFF
-#else
+#if !USE___THREAD
.Lerrloc1:
.long __errno_location@PLT-(.Lerrloc1b-.)
#endif
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S Sat Aug 4 00:02:44 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007 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
@@ -21,12 +21,9 @@
#include <pthread-errnos.h>
#include <tcb-offsets.h>
#include <structsem.h>
+#include <lowlevellock.h>
#include "lowlevel-atomic.h"
-
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_futex 240
-#define FUTEX_WAIT 0
#if VALUE != 0
# error "code needs to be rewritten for VALUE != 0"
@@ -138,24 +135,26 @@
mov.l .Lerrno0, r0
stc gbr, r1
mov.l @(r0, r12), r0
- add r1, r0
- mov.l r8, @r0
+ bra .Lexit
+ add r1, r0
+ .align 2
+.Lerrno0:
+ .long errno@GOTTPOFF
+.Lexit:
#else
mov.l .Lerrloc0, r1
bsrf r1
nop
.Lerrloc0b:
+#endif
mov.l r8, @r0
-#endif
bra 9b
mov #-1, r0
+ .align 2
.Lgot0:
.long _GLOBAL_OFFSET_TABLE_
-#if USE___THREAD
-.Lerrno0:
- .long errno@GOTTPOFF
-#else
+#if !USE___THREAD
.Lerrloc0:
.long __errno_location@PLT-(.Lerrloc0b-.)
#endif
Modified: fsf/trunk/libc/rt/aio.h
==============================================================================
--- fsf/trunk/libc/rt/aio.h (original)
+++ fsf/trunk/libc/rt/aio.h Sat Aug 4 00:02:44 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000,2003,2004,2007 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
@@ -136,25 +136,26 @@
/* Allow user to specify optimization. */
#ifdef __USE_GNU
-extern void aio_init (__const struct aioinit *__init) __THROW;
+extern void aio_init (__const struct aioinit *__init) __THROW __nonnull ((1));
#endif
#ifndef __USE_FILE_OFFSET64
/* Enqueue read request for given number of bytes and the given priority. */
-extern int aio_read (struct aiocb *__aiocbp) __THROW;
+extern int aio_read (struct aiocb *__aiocbp) __THROW __nonnull ((1));
/* Enqueue write request for given number of bytes and the given priority. */
-extern int aio_write (struct aiocb *__aiocbp) __THROW;
+extern int aio_write (struct aiocb *__aiocbp) __THROW __nonnull ((1));
/* Initiate list of I/O requests. */
extern int lio_listio (int __mode,
struct aiocb *__const __list[__restrict_arr],
- int __nent, struct sigevent *__restrict __sig) __THROW;
+ int __nent, struct sigevent *__restrict __sig)
+ __THROW __nonnull ((2));
/* Retrieve error status associated with AIOCBP. */
-extern int aio_error (__const struct aiocb *__aiocbp) __THROW;
+extern int aio_error (__const struct aiocb *__aiocbp) __THROW __nonnull ((1));
/* Return status associated with AIOCBP. */
-extern __ssize_t aio_return (struct aiocb *__aiocbp) __THROW;
+extern __ssize_t aio_return (struct aiocb *__aiocbp) __THROW __nonnull ((1));
/* Try to cancel asynchronous I/O requests outstanding against file
descriptor FILDES. */
@@ -166,26 +167,30 @@
This function is a cancellation point and therefore not marked with
__THROW. */
extern int aio_suspend (__const struct aiocb *__const __list[], int __nent,
- __const struct timespec *__restrict __timeout);
+ __const struct timespec *__restrict __timeout)
+ __nonnull ((1));
/* Force all operations associated with file desriptor described by
`aio_fildes' member of AIOCBP. */
-extern int aio_fsync (int __operation, struct aiocb *__aiocbp) __THROW;
+extern int aio_fsync (int __operation, struct aiocb *__aiocbp)
+ __THROW __nonnull ((2));
#else
# ifdef __REDIRECT_NTH
-extern int __REDIRECT_NTH (aio_read, (struct aiocb *__aiocbp), aio_read64);
-extern int __REDIRECT_NTH (aio_write, (struct aiocb *__aiocbp), aio_write64);
+extern int __REDIRECT_NTH (aio_read, (struct aiocb *__aiocbp), aio_read64)
+ __nonnull ((1));
+extern int __REDIRECT_NTH (aio_write, (struct aiocb *__aiocbp), aio_write64)
+ __nonnull ((1));
extern int __REDIRECT_NTH (lio_listio,
(int __mode,
struct aiocb *__const __list[__restrict_arr],
int __nent, struct sigevent *__restrict __sig),
- lio_listio64);
+ lio_listio64) __nonnull ((2));
extern int __REDIRECT_NTH (aio_error, (__const struct aiocb *__aiocbp),
- aio_error64);
+ aio_error64) __nonnull ((1));
extern __ssize_t __REDIRECT_NTH (aio_return, (struct aiocb *__aiocbp),
- aio_return64);
+ aio_return64) __nonnull ((1));
extern int __REDIRECT_NTH (aio_cancel,
(int __fildes, struct aiocb *__aiocbp),
@@ -194,11 +199,11 @@
extern int __REDIRECT_NTH (aio_suspend,
(__const struct aiocb *__const __list[], int __nent,
__const struct timespec *__restrict __timeout),
- aio_suspend64);
+ aio_suspend64) __nonnull ((1));
extern int __REDIRECT_NTH (aio_fsync,
(int __operation, struct aiocb *__aiocbp),
- aio_fsync64);
+ aio_fsync64) __nonnull ((2));
# else
# define aio_read aio_read64
@@ -213,24 +218,27 @@
#endif
#ifdef __USE_LARGEFILE64
-extern int aio_read64 (struct aiocb64 *__aiocbp) __THROW;
-extern int aio_write64 (struct aiocb64 *__aiocbp) __THROW;
+extern int aio_read64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1));
+extern int aio_write64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1));
extern int lio_listio64 (int __mode,
struct aiocb64 *__const __list[__restrict_arr],
int __nent, struct sigevent *__restrict __sig)
- __THROW;
-
-extern int aio_error64 (__const struct aiocb64 *__aiocbp) __THROW;
-extern __ssize_t aio_return64 (struct aiocb64 *__aiocbp) __THROW;
+ __THROW __nonnull ((2));
+
+extern int aio_error64 (__const struct aiocb64 *__aiocbp)
+ __THROW __nonnull ((1));
+extern __ssize_t aio_return64 (struct aiocb64 *__aiocbp)
+ __THROW __nonnull ((1));
extern int aio_cancel64 (int __fildes, struct aiocb64 *__aiocbp) __THROW;
extern int aio_suspend64 (__const struct aiocb64 *__const __list[], int __nent,
__const struct timespec *__restrict __timeout)
- __THROW;
-
-extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp) __THROW;
+ __THROW __nonnull ((1));
+
+extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp)
+ __THROW __nonnull ((2));
#endif
__END_DECLS
Modified: fsf/trunk/libc/rt/mqueue.h
==============================================================================
--- fsf/trunk/libc/rt/mqueue.h (original)
+++ fsf/trunk/libc/rt/mqueue.h Sat Aug 4 00:02:44 2007
@@ -80,14 +80,14 @@
size_t __msg_len,
unsigned int *__restrict __msg_prio,
__const struct timespec *__restrict __abs_timeout)
- __nonnull ((1, 4));
+ __nonnull ((2, 5));
/* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
on full message queue if ABS_TIMEOUT expires. */
extern int mq_timedsend (mqd_t __mqdes, __const char *__msg_ptr,
size_t __msg_len, unsigned int __msg_prio,
__const struct timespec *__abs_timeout)
- __nonnull ((1, 4));
+ __nonnull ((2, 5));
#endif
__END_DECLS
Modified: fsf/trunk/libc/stdlib/Makefile
==============================================================================
--- fsf/trunk/libc/stdlib/Makefile (original)
+++ fsf/trunk/libc/stdlib/Makefile Sat Aug 4 00:02:44 2007
@@ -68,7 +68,7 @@
tst-limits tst-rand48 bug-strtod tst-setcontext \
test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
- tst-makecontext tst-strtod4
+ tst-makecontext tst-strtod4 tst-strtod5
include ../Makeconfig
@@ -115,6 +115,7 @@
tst-strtod-ENV = LOCPATH=$(common-objpfx)localedata
tst-strtod3-ENV = LOCPATH=$(common-objpfx)localedata
tst-strtod4-ENV = LOCPATH=$(common-objpfx)localedata
+tst-strtod5-ENV = LOCPATH=$(common-objpfx)localedata
testmb2-ENV = LOCPATH=$(common-objpfx)localedata
# Run a test on the header files we use.
Modified: fsf/trunk/libc/stdlib/strtod_l.c
==============================================================================
--- fsf/trunk/libc/stdlib/strtod_l.c (original)
+++ fsf/trunk/libc/stdlib/strtod_l.c Sat Aug 4 00:02:44 2007
@@ -700,7 +700,8 @@
#endif
/* If TP is at the start of the digits, there was no correctly
grouped prefix of the string; so no number found. */
- RETURN (0.0, tp == start_of_digits ? (base == 16 ? cp - 1 : nptr) : tp);
+ RETURN (negative ? -0.0 : 0.0,
+ tp == start_of_digits ? (base == 16 ? cp - 1 : nptr) : tp);
}
/* Remember first significant digit and read following characters until the
@@ -759,7 +760,7 @@
if (tp < startp)
/* The number is validly grouped, but consists
only of zeroes. The whole value is zero. */
- RETURN (0.0, tp);
+ RETURN (negative ? -0.0 : 0.0, tp);
/* Recompute DIG_NO so we won't read more digits than
are properly grouped. */
@@ -862,7 +863,7 @@
{
/* Overflow or underflow. */
__set_errno (ERANGE);
- result = (exp_negative ? 0.0 :
+ result = (exp_negative ? (negative ? -0.0 : 0.0) :
negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL);
}
Added: fsf/trunk/libc/stdlib/tst-strtod5.c
==============================================================================
--- fsf/trunk/libc/stdlib/tst-strtod5.c (added)
+++ fsf/trunk/libc/stdlib/tst-strtod5.c Sat Aug 4 00:02:44 2007
@@ -1,0 +1,88 @@
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#define NBSP "\xc2\xa0"
+
+static const struct
+{
+ const char *in;
+ int group;
+ double expected;
+} tests[] =
+ {
+ { "0", 0, 0.0 },
+ { "000", 0, 0.0 },
+ { "-0", 0, -0.0 },
+ { "-000", 0, -0.0 },
+ { "0,", 0, 0.0 },
+ { "-0,", 0, -0.0 },
+ { "0,0", 0, 0.0 },
+ { "-0,0", 0, -0.0 },
+ { "0e-10", 0, 0.0 },
+ { "-0e-10", 0, -0.0 },
+ { "0,e-10", 0, 0.0 },
+ { "-0,e-10", 0, -0.0 },
+ { "0,0e-10", 0, 0.0 },
+ { "-0,0e-10", 0, -0.0 },
+ { "0e-1000000", 0, 0.0 },
+ { "-0e-1000000", 0, -0.0 },
+ { "0,0e-1000000", 0, 0.0 },
+ { "-0,0e-1000000", 0, -0.0 },
+ { "0", 1, 0.0 },
+ { "000", 1, 0.0 },
+ { "-0", 1, -0.0 },
+ { "-000", 1, -0.0 },
+ { "0e-10", 1, 0.0 },
+ { "-0e-10", 1, -0.0 },
+ { "0e-1000000", 1, 0.0 },
+ { "-0e-1000000", 1, -0.0 },
+ { "000"NBSP"000"NBSP"000", 1, 0.0 },
+ { "-000"NBSP"000"NBSP"000", 1, -0.0 }
+ };
+#define NTESTS (sizeof (tests) / sizeof (tests[0]))
+
+
+static int
+do_test (void)
+{
+ if (setlocale (LC_ALL, "cs_CZ.UTF-8") == NULL)
+ {
+ puts ("could not set locale");
+ return 1;
+ }
+
+ int status = 0;
+
+ for (int i = 0; i < NTESTS; ++i)
+ {
+ char *ep;
+ double r;
+
+ if (tests[i].group)
+ r = __strtod_internal (tests[i].in, &ep, 1);
+ else
+ r = strtod (tests[i].in, &ep);
+
+ if (*ep != '\0')
+ {
+ printf ("%d: got rest string \"%s\", expected \"\"\n", i, ep);
+ status = 1;
+ }
+
+ if (r != tests[i].expected
+ || copysign (10.0, r) != copysign (10.0, tests[i].expected))
+ {
+ printf ("%d: got wrong results %g, expected %g\n",
+ i, r, tests[i].expected);
+ status = 1;
+ }
+ }
+
+ return status;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"