[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r2549 - in /fsf/trunk/libc: ./ nptl/ nptl/sysdeps/pthread/ nptl/sysdeps/sh/ nptl/sysdeps/unix/sysv/linux/sh/ nptl/sysdeps/un...



Author: eglibc
Date: Mon Jun 18 00:03:13 2007
New Revision: 2549

Log:
Import glibc-mainline for 2007-06-18

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/allocatestack.c
    fsf/trunk/libc/nptl/sysdeps/pthread/pt-initfini.c
    fsf/trunk/libc/nptl/sysdeps/sh/tcb-offsets.sym
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
    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/pthread_barrier_wait.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_wait.S
    fsf/trunk/libc/sysdeps/generic/initfini.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/ptrace.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Jun 18 00:03:13 2007
@@ -1,3 +1,22 @@
+2007-06-17  Andreas Schwab  <schwab@xxxxxxx>
+
+	* sysdeps/generic/initfini.c: Tell gcc about the nonstandard sections.
+
+2007-06-16  Andreas Jaeger  <aj@xxxxxxx>
+
+	[BZ #4125]
+	* sysdeps/unix/sysv/linux/sys/ptrace.h
+	(PTRACE_O_TRACESYSGOOD, PTRACE_O_TRACEFORK,
+	PTRACE_O_TRACEVFORK, PTRACE_O_TRACECLONE, PTRACE_O_TRACEEXEC,
+	PTRACE_O_TRACEVFORKDONE, PTRACE_O_TRACEEXIT, PTRACE_O_MASK,
+	PTRACE_EVENT_FORK, PTRACE_EVENT_VFORK, PTRACE_EVENT_CLONE,
+	PTRACE_EVENT_EXEC, PTRACE_EVENT_VFORK_DONE, PTRACE_EVENT_EXIT):
+	Define.
+	* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h: Likewise.
+	* sysdeps/unix/sysv/linux/s390/sys/ptrace.h: Likewise.
+
 2007-06-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #4599]

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Mon Jun 18 00:03:13 2007
@@ -1,3 +1,62 @@
+2007-06-17  Andreas Schwab  <schwab@xxxxxxx>
+
+	* sysdeps/pthread/pt-initfini.c: Tell gcc about the nonstandard
+	sections.
+
+2007-06-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* allocatestack.c (allocate_stack): Make code compile if
+	__ASSUME_PRIVATE_FUTEX is set.
+
+2007-06-17  Kaz Kojima  <kkojima@xxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S:
+	(__pthread_rwlock_rdlock): Don't use non SH-3/4 instruction.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S:
+	(__pthread_rwlock_wrlock): Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S:
+	(pthread_rwlock_timedrdlock): Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S:
+	(pthread_rwlock_timedwrlock): Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S:
+	(__pthread_rwlock_unlock): Likewise.
+
+2007-06-10  Kaz Kojima  <kkojima@xxxxxxxxxxxxxx>
+
+	* sysdeps/sh/tcb-offsets.sym: Add PRIVATE_FUTEX.
+	* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h: Include endian.h.
+	Split __flags into __flags, __shared, __pad1 and __pad2.
+	* sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S: Use private
+        futexes if they are available.
+	* sysdeps/unix/sysv/linux/sh/lowlevellock.S: Adjust so that change
+        in libc-lowlevellock.S allow using private futexes.
+	* sysdeps/unix/sysv/linux/sh/lowlevellock.h: Define
+	FUTEX_PRIVATE_FLAG.  Add additional parameter to lll_futex_wait,
+	lll_futex_timed_wait and lll_futex_wake.  Change lll_futex_wait
+	to call lll_futex_timed_wait.  Add lll_private_futex_wait,
+	lll_private_futex_timed_wait and lll_private_futex_wake.
+	(lll_robust_mutex_unlock): Fix typo.
+	* sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S: Use private
+        field in futex command setup.
+	* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Use
+	COND_NWAITERS_SHIFT instead of COND_CLOCK_BITS.
+	* sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_once.S: Use private futexes
+        if they are available.  Remove clear_once_control.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S: Use private
+	futexes if they are available.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sem_post.S: Add private futex support.
+	Wake only when there are waiters.
+	* sysdeps/unix/sysv/linux/sh/sem_wait.S: Add private futex
+	support.  Indicate that there are waiters.  Remove unnecessary
+        extra cancellation test.
+	* sysdeps/unix/sysv/linux/sh/sem_timedwait.S: Likewise.  Removed
+	left-over duplication of __sem_wait_cleanup.
+
 2007-06-07  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Add additional

Modified: fsf/trunk/libc/nptl/allocatestack.c
==============================================================================
--- fsf/trunk/libc/nptl/allocatestack.c (original)
+++ fsf/trunk/libc/nptl/allocatestack.c Mon Jun 18 00:03:13 2007
@@ -516,9 +516,11 @@
 	  __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
+#ifndef __ASSUME_PRIVATE_FUTEX
 	  /* The thread must know when private futexes are supported.  */
 	  pd->header.private_futex = THREAD_GETMEM (THREAD_SELF,
                                                     header.private_futex);
+#endif
 
 #ifdef NEED_DL_SYSINFO
 	  /* Copy the sysinfo value from the parent.  */

Modified: fsf/trunk/libc/nptl/sysdeps/pthread/pt-initfini.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/pt-initfini.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/pt-initfini.c Mon Jun 18 00:03:13 2007
@@ -72,7 +72,7 @@
 }
 
 SECTION (".init");
-extern void _init (void);
+extern void __attribute__ ((section (".init"))) _init (void);
 void
 _init (void)
 {
@@ -93,7 +93,7 @@
 asm ("\n/*@_fini_PROLOG_BEGINS*/");
 
 SECTION (".fini");
-extern void _fini (void);
+extern void __attribute__ ((section (".fini"))) _fini (void);
 void
 _fini (void)
 {

Modified: fsf/trunk/libc/nptl/sysdeps/sh/tcb-offsets.sym
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/sh/tcb-offsets.sym (original)
+++ fsf/trunk/libc/nptl/sysdeps/sh/tcb-offsets.sym Mon Jun 18 00:03:13 2007
@@ -10,3 +10,6 @@
 TLS_PRE_TCB_SIZE	sizeof (struct pthread)
 MUTEX_FUTEX		offsetof (pthread_mutex_t, __data.__lock)
 POINTER_GUARD		offsetof (tcbhead_t, pointer_guard)
+#ifndef __ASSUME_PRIVATE_FUTEX
+PRIVATE_FUTEX		offsetof (struct pthread, header.private_futex)
+#endif

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h Mon Jun 18 00:03:13 2007
@@ -1,4 +1,5 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -19,6 +20,8 @@
 
 #ifndef _BITS_PTHREADTYPES_H
 #define _BITS_PTHREADTYPES_H	1
+
+#include <endian.h>
 
 #define __SIZEOF_PTHREAD_ATTR_T 36
 #define __SIZEOF_PTHREAD_MUTEX_T 24
@@ -127,9 +130,21 @@
     unsigned int __writer_wakeup;
     unsigned int __nr_readers_queued;
     unsigned int __nr_writers_queued;
+#if __BYTE_ORDER == __BIG_ENDIAN
+    unsigned char __pad1;
+    unsigned char __pad2;
+    unsigned char __shared;
     /* FLAGS must stay at this position in the structure to maintain
        binary compatibility.  */
-    unsigned int __flags;
+    unsigned char __flags;
+#else
+    /* FLAGS must stay at this position in the structure to maintain
+       binary compatibility.  */
+    unsigned char __flags;
+    unsigned char __shared;
+    unsigned char __pad1;
+    unsigned char __pad2;
+#endif
     pthread_t __writer;
   } __data;
   char __size[__SIZEOF_PTHREAD_RWLOCK_T];

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 Mon Jun 18 00:03:13 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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
@@ -16,4 +16,32 @@
    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 Mon Jun 18 00:03:13 2007
@@ -24,8 +24,24 @@
 
 #define SYS_gettimeofday	__NR_gettimeofday
 #define SYS_futex		240
-#define FUTEX_WAIT		0
-#define FUTEX_WAKE		1
+#ifndef FUTEX_WAIT
+# define FUTEX_WAIT		0
+# define FUTEX_WAKE		1
+#endif
+
+#ifndef LOAD_FUTEX_WAIT
+# if FUTEX_WAIT == 0
+#  define LOAD_FUTEX_WAIT(reg,tmp) \
+	xor	reg, reg
+# else
+#  define LOAD_FUTEX_WAIT(reg,tmp) \
+	mov	#FUTEX_WAIT, reg; \
+	extu.b	reg, reg
+# endif
+# define LOAD_FUTEX_WAKE(reg,tmp) \
+	mov	#FUTEX_WAKE, reg; \
+	extu.b	reg, reg
+#endif
 
 
 	.globl	__lll_mutex_lock_wait
@@ -40,7 +56,7 @@
 	mov	r4, r6
 	mov	r5, r8
 	mov	#0, r7		/* No timeout.  */
-	mov	#FUTEX_WAIT, r5
+	LOAD_FUTEX_WAIT (r5, r0)
 
 	mov	#2, r4
 	cmp/eq	r4, r6
@@ -133,7 +149,7 @@
 	bt	8f
 
 	mov	r8, r4
-	mov	#FUTEX_WAIT, r5
+	LOAD_FUTEX_WAIT (r5, r0)
 	mov	r10, r6
 	mov	r15, r7
 	mov	#SYS_futex, r3
@@ -192,7 +208,7 @@
 	.align	5
 	cfi_startproc
 __lll_mutex_unlock_wake:
-	mov	#FUTEX_WAKE, r5
+	LOAD_FUTEX_WAKE (r5, r0)
 	mov	#1, r6		/* Wake one thread.  */
 	mov	#0, r7
 	mov.l	r7, @r4		/* Stores 0.  */
@@ -261,7 +277,10 @@
 	bt	4f
 
 	mov	r8, r4
-	mov	#FUTEX_WAIT, r5
+	/* XXX The kernel so far uses global futex for the wakeup at
+	   all times.  */
+	mov	#0, r5
+	extu.b	r5, r5
 	mov	r2, r6
 	mov	r15, r7
 	mov	#SYS_futex, r3

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 Mon Jun 18 00:03:13 2007
@@ -22,6 +22,7 @@
 #include <time.h>
 #include <sys/param.h>
 #include <bits/pthreadtypes.h>
+#include <kernel-features.h>
 
 #define SYS_futex		240
 #define FUTEX_WAIT		0
@@ -29,6 +30,14 @@
 #define FUTEX_LOCK_PI		6
 #define FUTEX_UNLOCK_PI		7
 #define FUTEX_TRYLOCK_PI	8
+#define FUTEX_PRIVATE_FLAG	128
+
+
+/* Values for 'private' parameter of locking macros.  Yes, the
+   definition seems to be backwards.  But it is not.  The bit will be
+   reversed before passing to the system call.  */
+#define LLL_PRIVATE    0
+#define LLL_SHARED     FUTEX_PRIVATE_FLAG
 
 
 /* Initializer for compatibility lock.  */
@@ -251,7 +260,7 @@
 		and %2,%0\n\
 		mov.l %0,@%1\n\
 	     1: mov r1,r15"\
-		: "=&r" (__result) : "r" (__futex), "r" (FUTEX_TID_MASK) \
+		: "=&r" (__result) : "r" (__futex), "r" (FUTEX_WAITERS) \
 		: "r0", "r1", "memory");	\
 	    if (__result) \
 	      __lll_mutex_unlock_wake (__futex); })
@@ -269,7 +278,7 @@
 	     1: mov r1,r15"\
 		: "=&r" (__ignore) : "r" (__futex), "r" (FUTEX_OWNER_DIED) \
 		: "r0", "r1", "memory");	\
-	    lll_futex_wake (__futex, 1); })
+	    lll_futex_wake (__futex, 1, 0); })
 
 #define lll_mutex_islocked(futex) \
   (futex != 0)
@@ -294,24 +303,11 @@
 	trapa #0x14"
 # endif
 
-#define lll_futex_wait(futex, val) \
-  ({									      \
-    int __status;							      \
-    register unsigned long __r3 asm ("r3") = SYS_futex;			      \
-    register unsigned long __r4 asm ("r4") = (unsigned long) (futex);	      \
-    register unsigned long __r5 asm ("r5") = FUTEX_WAIT;		      \
-    register unsigned long __r6 asm ("r6") = (unsigned long) (val);	      \
-    register unsigned long __r7 asm ("r7") = 0;				      \
-    __asm __volatile (SYSCALL_WITH_INST_PAD				      \
-		      : "=z" (__status)					      \
-		      : "r" (__r3), "r" (__r4), "r" (__r5),		      \
-			"r" (__r6), "r" (__r7)				      \
-		      : "memory", "t");					      \
-    __status;								      \
-  })
-
-
-#define lll_futex_timed_wait(futex, val, timeout) \
+#define lll_futex_wait(futex, val, private) \
+  lll_futex_timed_wait (futex, val, NULL, private)
+
+
+#define lll_futex_timed_wait(futex, val, timeout, private) \
   ({									      \
     int __status;							      \
     register unsigned long __r3 asm ("r3") = SYS_futex;			      \
@@ -328,7 +324,7 @@
   })
 
 
-#define lll_futex_wake(futex, nr) \
+#define lll_futex_wake(futex, nr, private) \
   do {									      \
     int __ignore;							      \
     register unsigned long __r3 asm ("r3") = SYS_futex;			      \
@@ -342,6 +338,81 @@
 			"r" (__r6), "r" (__r7)				      \
 		      : "memory", "t");					      \
   } while (0)
+
+
+#define lll_private_futex_wait(futex, val) \
+  lll_private_futex_timed_wait (futex, val, NULL)
+
+
+#ifdef __ASSUME_PRIVATE_FUTEX
+# define lll_private_futex_timed_wait(futex, val, timeout) \
+  ({									      \
+    int __status;							      \
+    register unsigned long __r3 asm ("r3") = SYS_futex;			      \
+    register unsigned long __r4 asm ("r4") = (unsigned long) (futex);	      \
+    register unsigned long __r5 asm ("r5") = FUTEX_WAIT | FUTEX_PRIVATE_FLAG; \
+    register unsigned long __r6 asm ("r6") = (unsigned long) (val);	      \
+    register unsigned long __r7 asm ("r7") = (timeout);			      \
+    __asm __volatile (SYSCALL_WITH_INST_PAD				      \
+		      : "=z" (__status)					      \
+		      : "r" (__r3), "r" (__r4), "r" (__r5),		      \
+			"r" (__r6), "r" (__r7)				      \
+		      : "memory", "t");					      \
+    __status;								      \
+  })
+
+
+# define lll_private_futex_wake(futex, nr) \
+  do {									      \
+    int __ignore;							      \
+    register unsigned long __r3 asm ("r3") = SYS_futex;			      \
+    register unsigned long __r4 asm ("r4") = (unsigned long) (futex);	      \
+    register unsigned long __r5 asm ("r5") = FUTEX_WAKE | FUTEX_PRIVATE_FLAG; \
+    register unsigned long __r6 asm ("r6") = (unsigned long) (nr);	      \
+    register unsigned long __r7 asm ("r7") = 0;				      \
+    __asm __volatile (SYSCALL_WITH_INST_PAD				      \
+		      : "=z" (__ignore)					      \
+		      : "r" (__r3), "r" (__r4), "r" (__r5),		      \
+			"r" (__r6), "r" (__r7)				      \
+		      : "memory", "t");					      \
+  } while (0)
+
+
+#else
+# define lll_private_futex_timed_wait(futex, val, timeout) \
+  ({									      \
+    int __status;							      \
+    register unsigned long __r3 asm ("r3") = SYS_futex;			      \
+    register unsigned long __r4 asm ("r4") = (unsigned long) (futex);	      \
+    register unsigned long __r5 asm ("r5");				      \
+    register unsigned long __r6 asm ("r6") = (unsigned long) (val);	      \
+    register unsigned long __r7 asm ("r7") = (timeout);			      \
+    __r5 = THREAD_GETMEM (THREAD_SELF, header.private_futex);		      \
+    __asm __volatile (SYSCALL_WITH_INST_PAD				      \
+		      : "=z" (__status)					      \
+		      : "r" (__r3), "r" (__r4), "r" (__r5),		      \
+			"r" (__r6), "r" (__r7)				      \
+		      : "memory", "t");					      \
+    __status;								      \
+  })
+
+
+# define lll_private_futex_wake(futex, nr) \
+  do {									      \
+    int __ignore;							      \
+    register unsigned long __r3 asm ("r3") = SYS_futex;			      \
+    register unsigned long __r4 asm ("r4") = (unsigned long) (futex);	      \
+    register unsigned long __r5 asm ("r5") = FUTEX_WAKE;		      \
+    register unsigned long __r6 asm ("r6") = (unsigned long) (nr);	      \
+    register unsigned long __r7 asm ("r7") = 0;				      \
+    __r5 |= THREAD_GETMEM (THREAD_SELF,	header.private_futex);		      \
+    __asm __volatile (SYSCALL_WITH_INST_PAD				      \
+		      : "=z" (__ignore)					      \
+		      : "r" (__r3), "r" (__r4), "r" (__r5),		      \
+			"r" (__r6), "r" (__r7)				      \
+		      : "memory", "t");					      \
+  } while (0)
+#endif
 
 
 /* The states of a lock are:
@@ -367,7 +438,7 @@
   do {									      \
     __typeof (tid) *__tid = &(tid);					      \
     while (*__tid != 0)							      \
-      lll_futex_wait (__tid, *__tid);					      \
+      lll_futex_wait (__tid, *__tid, 0);				      \
   } while (0)
 
 extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)

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 Mon Jun 18 00:03:13 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
@@ -65,7 +65,13 @@
 #if CURR_EVENT != 0
 	add	#CURR_EVENT, r4
 #endif
+#if FUTEX_WAIT == 0
+	mov.l	@(PRIVATE,r8), r5
+#else
 	mov	#FUTEX_WAIT, r5
+	mov.l	@(PRIVATE,r8), r0
+	or	r0, r5
+#endif
 	mov	#0, r7
 8:
 	mov	#SYS_futex, r3
@@ -118,6 +124,8 @@
 #endif
 	mov	#0, r7
 	mov	#FUTEX_WAKE, r5
+	mov.l	@(PRIVATE,r8), r0
+	or	r0, r5
 	mov	#SYS_futex, r3
 	extu.b	r3, r3
 	trapa	#0x14

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 Mon Jun 18 00:03:13 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
@@ -120,7 +120,7 @@
 	mov.l	@(cond_futex,r8), r0
 	add	r2, r0
 	mov.l	r0, @(cond_futex,r8)
-	mov	#(1 << clock_bits), r2
+	mov	#(1 << nwaiters_shift), r2
 	mov.l	@(cond_nwaiters,r8), r0
 	add	r2, r0
 	mov.l	r0, @(cond_nwaiters,r8)
@@ -136,7 +136,7 @@
 #ifdef __NR_clock_gettime
 	/* Get the clock number.	 */
 	mov.l	@(cond_nwaiters,r8), r4
-	mov	#((1 << clock_bits) - 1), r0
+	mov	#((1 << nwaiters_shift) - 1), r0
 	and	r0, r4
 	/* Only clocks 0 and 1 are allowed.  Both are handled in the
 	   kernel.  */
@@ -323,7 +323,7 @@
 	mov.l	r1,@(woken_seq+4,r8)
 
 24:
-	mov	#(1 << clock_bits), r2
+	mov	#(1 << nwaiters_shift), r2
 	mov.l	@(cond_nwaiters,r8),r0
 	sub	r2, r0
 	mov.l	r0,@(cond_nwaiters,r8)
@@ -335,7 +335,7 @@
 	not	r0, r0
 	cmp/eq	#0, r0
 	bf/s	25f
-	 mov	#((1 << clock_bits) - 1), r1
+	 mov	#((1 << nwaiters_shift) - 1), r1
 	not	r1, r1
 	mov.l	@(cond_nwaiters,r8),r0
 	tst	r1, r0
@@ -557,7 +557,7 @@
 	mov.l	r1,@(woken_seq+4,r8)
 
 3:
-	mov	#(1 << clock_bits), r2
+	mov	#(1 << nwaiters_shift), r2
 	mov.l	@(cond_nwaiters,r8),r0
 	sub	r2, r0
 	mov.l	r0,@(cond_nwaiters,r8)
@@ -570,7 +570,7 @@
 	not	r0, r0
 	cmp/eq	#0, r0
 	bf/s	4f
-	 mov	#((1 << clock_bits) - 1), r1
+	 mov	#((1 << nwaiters_shift) - 1), r1
 	not	r1, r1
 	mov.l	@(cond_nwaiters,r8),r0
 	tst	r1, r0

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 Mon Jun 18 00:03:13 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
@@ -107,7 +107,7 @@
 	mov.l	@(cond_futex,r8),r0
 	add	r2, r0
 	mov.l	r0,@(cond_futex,r8)
-	mov	#(1 << clock_bits), r2
+	mov	#(1 << nwaiters_shift), r2
 	mov.l	@(cond_nwaiters,r8), r0
 	add	r2, r0
 	mov.l	r0, @(cond_nwaiters,r8)
@@ -197,7 +197,7 @@
 	mov.l	r1,@(woken_seq+4,r8)
 
 16:
-	mov	#(1 << clock_bits), r2
+	mov	#(1 << nwaiters_shift), r2
 	mov.l	@(cond_nwaiters,r8),r0
 	sub	r2, r0
 	mov.l	r0,@(cond_nwaiters,r8)
@@ -209,7 +209,7 @@
 	not	r0, r0
 	cmp/eq	#0, r0
 	bf/s	17f
-	 mov	#((1 << clock_bits) - 1), r1
+	 mov	#((1 << nwaiters_shift) - 1), r1
 	not	r1, r1
 	mov.l	@(cond_nwaiters,r8),r0
 	tst	r1, r0
@@ -421,7 +421,7 @@
 	mov.l	r1,@(woken_seq+4,r8)
 
 3:
-	mov	#(1 << clock_bits), r2
+	mov	#(1 << nwaiters_shift), r2
 	mov.l	@(cond_nwaiters,r8),r0
 	sub	r2, r0
 	mov.l	r0,@(cond_nwaiters,r8)
@@ -434,7 +434,7 @@
 	not	r0, r0
 	cmp/eq	#0, r0
 	bf/s	4f
-	 mov	#((1 << clock_bits) - 1), r1
+	 mov	#((1 << nwaiters_shift) - 1), r1
 	not	r1, r1
 	mov.l	@(cond_nwaiters,r8),r0
 	tst	r1, r0

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 Mon Jun 18 00:03:13 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,11 +18,13 @@
 
 #include <unwindbuf.h>
 #include <sysdep.h>
+#include <kernel-features.h>
 #include "lowlevel-atomic.h"
 
-#define SYS_futex	240
-#define FUTEX_WAIT	0
-#define FUTEX_WAKE	1
+#define SYS_futex		240
+#define FUTEX_WAIT		0
+#define FUTEX_WAKE		1
+#define FUTEX_PRIVATE_FLAG	128
 
 	.comm	__fork_generation, 4, 4
 
@@ -95,7 +97,19 @@
 	bf	3f	/* Different for generation -> run initializer.  */
 
 	/* Somebody else got here first.  Wait.  */
-	mov	#FUTEX_WAIT, r5
+#if __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r5
+	extu.b	r5, r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r5
+# if FUTEX_WAIT != 0
+	mov	#FUTEX_WAIT, r0
+	or	r0, r5
+# endif
+#endif
 	mov	r3, r6
 	mov	#0, r7
 	mov	#SYS_futex, r3
@@ -157,7 +171,17 @@
 	INC (@r9, r2)
 	/* Wake up all other threads.  */
 	mov	r9, r4
-	mov	#FUTEX_WAKE, r5
+#if __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r5
+	extu.b	r5, r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r5
+	mov	#FUTEX_WAKE, r0
+	or	r0, r5
+#endif
 	mov	#-1, r6
 	shlr	r6		/* r6 = 0x7fffffff */
 	mov	#0, r7
@@ -192,7 +216,17 @@
 	mov	#0, r7
 	mov.l	r7, @r9
 	mov	r9, r4
-	mov	#FUTEX_WAKE, r5
+#if __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r5
+	mov	#FUTEX_WAKE, r0
+	or	r0, r5
+#endif
+	extu.b	r5, r5
 	mov	#-1, r6
 	shlr	r6		/* r6 = 0x7fffffff */
 	mov	#SYS_futex, r3
@@ -208,6 +242,10 @@
 	sleep
 	cfi_endproc
 
+#if !__ASSUME_PRIVATE_FUTEX
+.Lpfoff:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
 	.align	2
 .Lsigsetjmp:
 	.long	__sigsetjmp@PLT-(.Lsigsetjmp0-.)
@@ -224,23 +262,3 @@
 
 	.globl	pthread_once
 pthread_once = __pthread_once
-
-
-	.type	clear_once_control,@function
-	.align	5
-clear_once_control:
-	mov	#0, r0
-	mov.l	r0, @r4
-
-	mov	#FUTEX_WAKE, r5
-	mov	#-1, r6
-	shlr	r6		/* r6 = 0x7fffffff */
-	mov	#0, r7
-	mov	#SYS_futex, r3
-	extu.b	r3, r3
-	trapa	#0x14
-	SYSCALL_INST_PAD
-
-	rts
-	 nop
-	.size	clear_once_control,.-clear_once_control

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 Mon Jun 18 00:03:13 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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
@@ -20,11 +20,13 @@
 #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
@@ -55,7 +57,8 @@
 	mov.l	@(WRITERS_QUEUED,r8), r0
 	tst	r0, r0
 	bt	5f
-	mov.l	@(FLAGS,r8), r0
+	mov	#FLAGS, r0
+	mov.b	@(r0,r8), r0
 	tst	r0, r0
 	bt	5f
 3:
@@ -75,9 +78,28 @@
 	tst	r2, r2
 	bf	10f
 11:
+#if __ASSUME_PRIVATE_FUTEX
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
+	xor	r0, r5
+	extu.b	r5, r5
+#else
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	extu.b	r5, r5
+# if FUTEX_WAIT != 0
+	mov	#FUTEX_WAIT, r0
+	or	r0, r5
+# endif
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r0
+	xor	r0, r5
+#endif
 	mov	r8, r4
 	add	#READERS_WAKEUP, r4
-	mov	#FUTEX_WAIT, r5
 	mov	r9, r6
 	mov	#0, r7
 	mov	#SYS_futex, r3
@@ -123,6 +145,11 @@
 	mov.l	@r15+, r12
 	rts
 	 mov	r3, r0
+
+#if !__ASSUME_PRIVATE_FUTEX
+.Lpfoff:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
 
 1:
 	mov	r8, r5

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 Mon Jun 18 00:03:13 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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
@@ -20,12 +20,14 @@
 #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
@@ -59,7 +61,8 @@
 	mov.l	@(WRITERS_QUEUED,r8), r0
 	tst	r0, r0
 	bt	5f
-	mov.l	@(FLAGS,r8), r0
+	mov	#FLAGS, r0
+	mov.b	@(r0,r8), r0
 	tst	r0, r0
 	bt	5f
 3:
@@ -117,7 +120,26 @@
 
 	/* Futex call.  */
 	mov	r15, r7
-	mov	#FUTEX_WAIT, r5
+#if __ASSUME_PRIVATE_FUTEX
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
+	xor	r0, r5
+	extu.b	r5, r5
+#else
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	extu.b	r5, r5
+# if FUTEX_WAIT != 0
+	mov	#FUTEX_WAIT, r0
+	or	r0, r5
+# endif
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r0
+	xor	r0, r5
+#endif
 	mov	r10, r6
 	mov	r8, r4
 	add	#READERS_WAKEUP, r4
@@ -176,6 +198,10 @@
 	rts
 	 mov	r3, r0
 
+#if !__ASSUME_PRIVATE_FUTEX
+.Lpfoff:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
 	.align	2
 .L1k0:
 	.long	1000

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 Mon Jun 18 00:03:13 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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
@@ -20,12 +20,14 @@
 #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
@@ -114,7 +116,26 @@
 
 	/* Futex call.  */
 	mov	r15, r7
-	mov	#FUTEX_WAIT, r5
+#if __ASSUME_PRIVATE_FUTEX
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
+	xor	r0, r5
+	extu.b	r5, r5
+#else
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	extu.b	r5, r5
+# if FUTEX_WAIT != 0
+	mov	#FUTEX_WAIT, r0
+	or	r0, r5
+# endif
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r0
+	xor	r0, r5
+#endif
 	mov	r10, r6
 	mov	r8, r4
 	add	#WRITERS_WAKEUP, r4
@@ -175,6 +196,10 @@
 	rts
 	 mov	r3, r0
 
+#if !__ASSUME_PRIVATE_FUTEX
+.Lpfoff:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
 .L1k1:
 	.word	1000
 	.align	2

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 Mon Jun 18 00:03:13 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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,11 +18,13 @@
 
 #include <sysdep.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
@@ -87,7 +89,24 @@
 	bf	7f
 
 8:
-	mov	#FUTEX_WAKE, r5
+#if __ASSUME_PRIVATE_FUTEX
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r0
+	xor	r0, r5
+	extu.b	r5, r5
+#else
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	extu.b	r5, r5
+	mov	#FUTEX_WAKE, r0
+	or	r0, r5
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r0
+	xor	r0, r5
+#endif
 	mov	#SYS_futex, r3
 	mov	#0, r7
 	extu.b	r3, r3
@@ -154,6 +173,10 @@
 	bra	8b
 	 mov.l	@r15+, r4
 
+#if !__ASSUME_PRIVATE_FUTEX
+.Lpfoff:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
 	.align	2
 .Lwait8:	
 	.long	__lll_mutex_lock_wait-.Lwait8b

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 Mon Jun 18 00:03:13 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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
@@ -20,11 +20,13 @@
 #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
@@ -74,7 +76,26 @@
 11:
 	mov	r8, r4
 	add	#WRITERS_WAKEUP, r4
-	mov	#FUTEX_WAIT, r5
+#if __ASSUME_PRIVATE_FUTEX
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
+	xor	r0, r5
+	extu.b	r5, r5
+#else
+	mov	#PSHARED, r0
+	mov.b	@(r0,r8), r5
+	extu.b	r5, r5
+# if FUTEX_WAIT != 0
+	mov	#FUTEX_WAIT, r0
+	or	r0, r5
+# endif
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r0
+	xor	r0, r5
+#endif
 	mov	r9, r6
 	mov	#0, r7
 	mov	#SYS_futex, r3
@@ -152,6 +173,10 @@
 	bra	7b
 	 mov	#0, r3
 
+#if !__ASSUME_PRIVATE_FUTEX
+.Lpfoff:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
 .Ltidoff:
 	.word	TID - TLS_PRE_TCB_SIZE
 

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 Mon Jun 18 00:03:13 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 <structsem.h>
 #include "lowlevel-atomic.h"
 
 
@@ -34,11 +35,14 @@
 	.align	5
 __new_sem_post:
 	mov	#1, r3
-	XADD (r3, @r4, r2)
-
+	XADD (r3, @(VALUE,r4), r2)
+	mov.l	@(NWAITERS,r4), r2
+	tst	r2, r2
+	bt	2f
 	mov	#FUTEX_WAKE, r5
-	mov	r2, r6
-	add	#1, r6
+	mov.l	@(PRIVATE,r4), r1
+	or	r1, r5
+	mov	#1, r6
 	mov	#0, r7
 	mov	#SYS_futex, r3
 	extu.b	r3, r3
@@ -47,6 +51,7 @@
 
 	cmp/pz	r0
 	bf	1f
+2:
 	rts
 	 mov	#0, r0
 

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 Mon Jun 18 00:03:13 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
@@ -20,32 +20,25 @@
 #include <shlib-compat.h>
 #include <pthread-errnos.h>
 #include <tcb-offsets.h>
+#include <structsem.h>
 #include "lowlevel-atomic.h"
 
 
 #define SYS_gettimeofday	__NR_gettimeofday
 #define SYS_futex		240
 #define FUTEX_WAIT		0
-#define FUTEX_WAKE		1
+
+#if VALUE != 0
+# error "code needs to be rewritten for VALUE != 0"
+#endif
 
 	.text
 
 	.globl	sem_timedwait
 	.type	sem_timedwait,@function
 	.align	5
-	cfi_startproc
 sem_timedwait:
-	/* First check for cancellation.  */
-	stc	gbr, r0
-	mov.w	.Lchand, r1
-	mov.l	@(r0,r1), r0
-	mov	#0xf9, r1
-	and	r1, r0
-	cmp/eq	#8, r0
-	bf	0f
-	bra	10f
-	 stc	gbr, r0
-0:
+.LSTARTCODE:
 	mov.l	@r4, r0
 2:
 	tst	r0, r0
@@ -62,22 +55,17 @@
 1:
 	/* Check whether the timeout value is valid.  */
 	mov.l	r8, @-r15
-	cfi_adjust_cfa_offset(4)
-	cfi_rel_offset (r8, 0)
+.Lpush_r8:
 	mov.l	r9, @-r15
-	cfi_adjust_cfa_offset(4)
-	cfi_rel_offset (r9, 0)
+.Lpush_r9:
 	mov.l	r10, @-r15
-	cfi_adjust_cfa_offset(4)
-	cfi_rel_offset (r10, 0)
+.Lpush_r10:
 	mov.l	r12, @-r15
-	cfi_adjust_cfa_offset(4)
-	cfi_rel_offset (r12, 0)
+.Lpush_r12:
 	sts.l	pr, @-r15
-	cfi_adjust_cfa_offset(4)
-	cfi_rel_offset (pr, 0)
+.Lpush_pr:
 	add	#-8, r15
-	cfi_adjust_cfa_offset(8)
+.Lalloc:
 	mov	r4, r8
 	mov	r5, r9
 
@@ -87,13 +75,9 @@
 	cmp/hs	r1, r0
 	bt/s	6f
 	 mov	#EINVAL, r0
+	INC (@(NWAITERS,r8),r2)
+
 7:
-	mov.l	.Lenable0, r1
-	bsrf	r1
-	 nop
-.Lenable0b:
-	mov	r0, r10
-
 	/* Compute relative timeout.  */
 	mov	r15, r4
 	mov	#0, r5
@@ -124,9 +108,21 @@
 	mov.l	r2, @r15
 	mov.l	r3, @(4,r15)
 
-	/* Futex call.  */
+.LcleanupSTART:
+	mov.l	.Lenable0, r1
+	bsrf	r1
+	 nop
+.Lenable0b:
+	mov	r0, r10
+
 	mov	r8, r4
-	mov	#FUTEX_WAIT, r5
+#if FUTEX_WAIT == 0
+	mov.l	@(PRIVATE,r8), r5
+#else
+	mov.l	@(PRIVATE,r8), r5
+	mov	#FUTEX_WAIT, r0
+	or	r0, r5
+#endif
 	mov	#0, r6
 	mov	r15, r7
 	mov	#SYS_futex, r3
@@ -140,6 +136,7 @@
 	 mov	r0, r10
 .Ldisable0b:	
 	mov	r10, r0
+.LcleanupEND:
 
 	tst	r0, r0
 	bt	9f
@@ -158,6 +155,10 @@
 	bf/s	8b
 	 mov	r2, r0
 
+	DEC (@(NWAITERS,r8), r2)
+	mov	#0, r0
+
+10:
 	add	#8, r15
 	lds.l	@r15+, pr
 	mov.l	@r15+, r12
@@ -165,12 +166,12 @@
 	mov.l	@r15+, r9
 	mov.l	@r15+, r8
 	rts
-	 mov	#0, r0
+	 nop
 
 3:
 	neg	r0, r0
 6:
-	mov	r0, r8
+	mov	r0, r10
 	mova	.Lgot2, r0
 	mov.l	.Lgot2, r12
 	add	r0, r12
@@ -180,46 +181,20 @@
 	stc	gbr, r1
 	mov.l	@(r0, r12), r0
 	add	r1, r0
-	mov.l	r8, @r0
+	mov.l	r10, @r0
 #else
 	mov.l	.Lerrloc2, r1
 	bsrf	r1
 	 nop
 .Lerrloc2b:
-	mov.l	r8, @r0
-#endif
-	add	#8, r15
-	lds.l	@r15+, pr
-	mov.l	@r15+, r12
-	mov.l	@r15+, r10
-	mov.l	@r15+, r9
-	mov.l	@r15+, r8
-	rts
+	mov.l	r10, @r0
+#endif
+	DEC (@(NWAITERS,r8), r2)
+	bra	10b
 	 mov	#-1, r0
-
-10:
-	/* Canceled.  */
-	mov.w	.Lresult, r1
-	mov	#-1, r2
-	mov.l	r2, @(r0,r1)
-	mov.w	.Lchand, r0
-	or.b	#0x10, @(r0,gbr)
-	stc	gbr, r0
-	mov.w	.Lclbuf, r1
-	mov.l	.Lunwind, r2
-	braf	r2
-	 mov.l	@(r0,r1), r4
-.Lunwindb:
-	cfi_endproc
 
 .L1k:
 	.word	1000
-.Lchand:
-	.word	CANCELHANDLING - TLS_PRE_TCB_SIZE
-.Lresult:
-	.word	RESULT - TLS_PRE_TCB_SIZE
-.Lclbuf:
-	.word	CLEANUP_JMP_BUF - TLS_PRE_TCB_SIZE
 	.align	2
 .L1g:
 	.long	1000000000
@@ -236,6 +211,151 @@
 	.long	__pthread_enable_asynccancel-.Lenable0b
 .Ldisable0:
 	.long	__pthread_disable_asynccancel-.Ldisable0b
-.Lunwind:
-	.long	HIDDEN_JUMPTARGET (__pthread_unwind)-.Lunwindb
 	.size	sem_timedwait,.-sem_timedwait
+
+	.type	sem_wait_cleanup,@function
+sem_wait_cleanup:
+ 	DEC (@(NWAITERS,r8), r2)
+.LcallUR:
+	mov.l	.Lresume, r1
+#ifdef PIC
+	add	r12, r1
+#endif
+	jsr	@r1
+	 nop
+	sleep
+
+	.align	2
+.Lresume:
+#ifdef PIC
+	.long	_Unwind_Resume@GOTOFF
+#else
+	.long	_Unwind_Resume
+#endif
+.LENDCODE:
+	.size	sem_wait_cleanup,.-sem_wait_cleanup
+
+
+	.section .gcc_except_table,"a",@progbits
+.LexceptSTART:
+	.byte	0xff				! @LPStart format (omit)
+	.byte	0xff				! @TType format (omit)
+	.byte	0x01				! call-site format
+						! DW_EH_PE_uleb128
+	.uleb128 .Lcstend-.Lcstbegin
+.Lcstbegin:
+	.uleb128 .LcleanupSTART-.LSTARTCODE
+	.uleb128 .LcleanupEND-.LcleanupSTART
+	.uleb128 sem_wait_cleanup-.LSTARTCODE
+	.uleb128  0
+	.uleb128 .LcallUR-.LSTARTCODE
+	.uleb128 .LENDCODE-.LcallUR
+	.uleb128 0
+	.uleb128  0
+.Lcstend:
+
+
+	.section .eh_frame,"a",@progbits
+.LSTARTFRAME:
+	.ualong	.LENDCIE-.LSTARTCIE		! Length of the CIE.
+.LSTARTCIE:
+	.ualong	0				! CIE ID.
+	.byte	1				! Version number.
+#ifdef SHARED
+	.string	"zPLR"				! NUL-terminated augmentation
+						! string.
+#else
+	.string	"zPL"				! NUL-terminated augmentation
+						! string.
+#endif
+	.uleb128 1				! Code alignment factor.
+	.sleb128 -4				! Data alignment factor.
+	.byte	0x11				! Return address register
+						! column.
+#ifdef SHARED
+	.uleb128 7				! Augmentation value length.
+	.byte	0x9b				! Personality: DW_EH_PE_pcrel
+						! + DW_EH_PE_sdata4
+						! + DW_EH_PE_indirect
+	.ualong	DW.ref.__gcc_personality_v0-.
+	.byte	0x1b				! LSDA Encoding: DW_EH_PE_pcrel
+						! + DW_EH_PE_sdata4.
+	.byte	0x1b				! FDE Encoding: DW_EH_PE_pcrel
+						! + DW_EH_PE_sdata4.
+#else
+	.uleb128 6				! Augmentation value length.
+	.byte	0x0				! Personality: absolute
+	.ualong	__gcc_personality_v0
+	.byte	0x0				! LSDA Encoding: absolute
+#endif
+	.byte 0x0c				! DW_CFA_def_cfa
+	.uleb128 0xf
+	.uleb128 0
+	.align 4
+.LENDCIE:
+
+	.ualong	.LENDFDE-.LSTARTFDE		! Length of the FDE.
+.LSTARTFDE:
+	.ualong	.LSTARTFDE-.LSTARTFRAME		! CIE pointer.
+#ifdef SHARED
+	.ualong	.LSTARTCODE-.			! PC-relative start address
+						! of the code.
+#else
+	.ualong	.LSTARTCODE			! Start address of the code.
+#endif
+	.ualong	.LENDCODE-.LSTARTCODE		! Length of the code.
+	.uleb128 4				! Augmentation size
+#ifdef SHARED
+	.ualong	.LexceptSTART-.
+#else
+	.ualong	.LexceptSTART
+#endif
+
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lpush_r8-.LSTARTCODE
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 4
+	.byte   0x88				! DW_CFA_offset r8
+        .uleb128 1
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lpush_r9-.Lpush_r8
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 8
+	.byte   0x89				! DW_CFA_offset r9
+        .uleb128 2
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lpush_r10-.Lpush_r9
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 12
+	.byte   0x8a				! DW_CFA_offset r10
+        .uleb128 3
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lpush_r12-.Lpush_r10
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 16
+	.byte   0x8c				! DW_CFA_offset r12
+        .uleb128 4
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lpush_pr-.Lpush_r12
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 20
+	.byte	0x91				! DW_CFA_offset pr
+	.uleb128 5
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lalloc-.Lpush_pr
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 28
+	.align	4
+.LENDFDE:
+
+
+#ifdef SHARED
+	.hidden	DW.ref.__gcc_personality_v0
+	.weak	DW.ref.__gcc_personality_v0
+	.section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
+	.align	4
+	.type	DW.ref.__gcc_personality_v0, @object
+	.size	DW.ref.__gcc_personality_v0, 4
+DW.ref.__gcc_personality_v0:
+	.long	__gcc_personality_v0
+#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 Mon Jun 18 00:03:13 2007
@@ -20,44 +20,35 @@
 #include <shlib-compat.h>
 #include <pthread-errnos.h>
 #include <tcb-offsets.h>
+#include <structsem.h>
 #include "lowlevel-atomic.h"
 
 
 #define SYS_gettimeofday	__NR_gettimeofday
 #define SYS_futex		240
 #define FUTEX_WAIT		0
-#define FUTEX_WAKE		1
+
+#if VALUE != 0
+# error "code needs to be rewritten for VALUE != 0"
+#endif
 
 	.text
 
 	.globl	__new_sem_wait
 	.type	__new_sem_wait,@function
 	.align	5
-	cfi_startproc
 __new_sem_wait:
-	/* First check for cancellation.  */
-	stc	gbr, r0
-	mov.w	.Lchand, r1
-	mov.l	@(r0,r1), r0
-	mov	#0xf9, r1
-	and	r1, r0
-	cmp/eq	#8, r0
-	bt	5f
-
+.LSTARTCODE:
 	mov.l	r8, @-r15
-	cfi_adjust_cfa_offset(4)
-	cfi_rel_offset (r8, 0)
+.Lpush_r8:
 	mov.l	r10, @-r15
-	cfi_adjust_cfa_offset(4)
-	cfi_rel_offset (r10, 0)
+.Lpush_r10:
 	mov.l	r12, @-r15
-	cfi_adjust_cfa_offset(4)
-	cfi_rel_offset (r12, 0)
+.Lpush_r12:
 	sts.l	pr, @-r15
-	cfi_adjust_cfa_offset(4)
-	cfi_rel_offset (pr, 0)
+.Lpush_pr:
 	mov	r4, r8
-3:
+
 	mov.l	@r8, r0
 2:
 	tst	r0, r0
@@ -68,10 +59,21 @@
 	CMPXCHG (r4, @r8, r3, r2)
 	bf/s	2b
 	 mov	r2, r0
-	bra	9f
-	 mov	#0, r0
-
+7:
+	mov	#0, r0
+9:
+	lds.l	@r15+, pr
+	mov.l	@r15+, r12
+	mov.l	@r15+, r10
+	rts
+	 mov.l	@r15+, r8
+
+.Lafter_ret:
 1:
+	INC (@(NWAITERS,r8),r2)
+	
+.LcleanupSTART:
+6:
 	mov.l	.Lenable0, r1
 	bsrf	r1
 	 nop
@@ -79,7 +81,13 @@
 	mov	r0, r10
 
 	mov	r8, r4
-	mov	#FUTEX_WAIT, r5
+#if FUTEX_WAIT == 0
+	mov.l	@(PRIVATE,r8), r5
+#else
+	mov.l	@(PRIVATE,r8), r5
+	mov	#FUTEX_WAIT, r0
+	or	r0, r5
+#endif
 	mov	#0, r6
 	mov	#0, r7
 	mov	#SYS_futex, r3
@@ -93,14 +101,35 @@
 	 mov	r0, r10
 .Ldisable0b:	
 	mov	r10, r0
+.LcleanupEND:
 
 	tst	r0, r0
-	bt	3b
+	bt	3f
 	cmp/eq	#-EWOULDBLOCK, r0
-	bt	3b
+	bf	4f
+
+3:
+	mov.l	@r8, r0
+5:
+	tst	r0, r0
+	bt	6b
+
+	mov	r0, r3
+	mov	r0, r4
+	add	#-1, r3
+	CMPXCHG (r4, @r8, r3, r2)
+	bf/s	5b
+	 mov	r2, r0
+
+	DEC (@(NWAITERS,r8), r2)
+	bra	7b
+	 nop
+
+4:
 	neg	r0, r0
-
-	mov	r0, r8
+	mov	r0, r4
+	DEC (@(NWAITERS,r8), r2)
+	mov	r4, r8
 	mova	.Lgot0, r0
 	mov.l	.Lgot0, r12
 	add	r0, r12
@@ -118,36 +147,9 @@
 .Lerrloc0b:
 	mov.l	r8, @r0
 #endif
-	mov	#-1, r0
-9:
-	lds.l	@r15+, pr
-	mov.l	@r15+, r12
-	mov.l	@r15+, r10
-	rts
-	 mov.l	@r15+, r8
-5:
-	/* Canceled.  */
-	stc	gbr, r0
-	mov.w	.Lresult, r1
-	mov	#-1, r2
-	mov.l	r2, @(r0,r1)
-	mov.w	.Lchand, r0
-	or.b	#0x10, @(r0,gbr)
-	stc	gbr, r0
-	mov.w	.Lclbuf, r1
-	mov.l	.Lunwind, r2
-	braf	r2
-	 mov.l	@(r0,r1), r4
-.Lunwindb:
-	cfi_endproc
-
-.Lchand:
-	.word	CANCELHANDLING - TLS_PRE_TCB_SIZE
-.Lresult:
-	.word	RESULT - TLS_PRE_TCB_SIZE
-.Lclbuf:
-	.word	CLEANUP_JMP_BUF - TLS_PRE_TCB_SIZE
-	.align	2
+	bra	9b
+	 mov	#-1, r0
+
 .Lgot0:
 	.long	_GLOBAL_OFFSET_TABLE_
 #if USE___THREAD
@@ -161,7 +163,143 @@
 	.long	__pthread_enable_asynccancel-.Lenable0b
 .Ldisable0:
 	.long	__pthread_disable_asynccancel-.Ldisable0b
-.Lunwind:
-	.long	HIDDEN_JUMPTARGET (__pthread_unwind)-.Lunwindb
 	.size	__new_sem_wait,.-__new_sem_wait
 	versioned_symbol(libpthread, __new_sem_wait, sem_wait, GLIBC_2_1)
+
+
+	.type	sem_wait_cleanup,@function
+sem_wait_cleanup:
+ 	DEC (@(NWAITERS,r8), r2)
+.LcallUR:
+	mov.l	.Lresume, r1
+#ifdef PIC
+	add	r12, r1
+#endif
+	jsr	@r1
+	 nop
+	sleep
+
+	.align	2
+.Lresume:
+#ifdef PIC
+	.long	_Unwind_Resume@GOTOFF
+#else
+	.long	_Unwind_Resume
+#endif
+.LENDCODE:
+	.size	sem_wait_cleanup,.-sem_wait_cleanup
+
+
+	.section .gcc_except_table,"a",@progbits
+.LexceptSTART:
+	.byte	0xff				! @LPStart format (omit)
+	.byte	0xff				! @TType format (omit)
+	.byte	0x01				! call-site format
+						! DW_EH_PE_uleb128
+	.uleb128 .Lcstend-.Lcstbegin
+.Lcstbegin:
+	.uleb128 .LcleanupSTART-.LSTARTCODE
+	.uleb128 .LcleanupEND-.LcleanupSTART
+	.uleb128 sem_wait_cleanup-.LSTARTCODE
+	.uleb128  0
+	.uleb128 .LcallUR-.LSTARTCODE
+	.uleb128 .LENDCODE-.LcallUR
+	.uleb128 0
+	.uleb128  0
+.Lcstend:
+
+
+	.section .eh_frame,"a",@progbits
+.LSTARTFRAME:
+	.ualong	.LENDCIE-.LSTARTCIE		! Length of the CIE.
+.LSTARTCIE:
+	.ualong	0				! CIE ID.
+	.byte	1				! Version number.
+#ifdef SHARED
+	.string	"zPLR"				! NUL-terminated augmentation
+						! string.
+#else
+	.string	"zPL"				! NUL-terminated augmentation
+						! string.
+#endif
+	.uleb128 1				! Code alignment factor.
+	.sleb128 -4				! Data alignment factor.
+	.byte	0x11				! Return address register
+						! column.
+#ifdef SHARED
+	.uleb128 7				! Augmentation value length.
+	.byte	0x9b				! Personality: DW_EH_PE_pcrel
+						! + DW_EH_PE_sdata4
+						! + DW_EH_PE_indirect
+	.ualong	DW.ref.__gcc_personality_v0-.
+	.byte	0x1b				! LSDA Encoding: DW_EH_PE_pcrel
+						! + DW_EH_PE_sdata4.
+	.byte	0x1b				! FDE Encoding: DW_EH_PE_pcrel
+						! + DW_EH_PE_sdata4.
+#else
+	.uleb128 6				! Augmentation value length.
+	.byte	0x0				! Personality: absolute
+	.ualong	__gcc_personality_v0
+	.byte	0x0				! LSDA Encoding: absolute
+#endif
+	.byte 0x0c				! DW_CFA_def_cfa
+	.uleb128 0xf
+	.uleb128 0
+	.align 4
+.LENDCIE:
+
+	.ualong	.LENDFDE-.LSTARTFDE		! Length of the FDE.
+.LSTARTFDE:
+	.ualong	.LSTARTFDE-.LSTARTFRAME		! CIE pointer.
+#ifdef SHARED
+	.ualong	.LSTARTCODE-.			! PC-relative start address
+						! of the code.
+#else
+	.ualong	.LSTARTCODE			! Start address of the code.
+#endif
+	.ualong	.LENDCODE-.LSTARTCODE		! Length of the code.
+	.uleb128 4				! Augmentation size
+#ifdef SHARED
+	.ualong	.LexceptSTART-.
+#else
+	.ualong	.LexceptSTART
+#endif
+
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lpush_r8-.LSTARTCODE
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 4
+	.byte   0x88				! DW_CFA_offset r8
+        .uleb128 1
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lpush_r10-.Lpush_r8
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 8
+	.byte   0x8a				! DW_CFA_offset r10
+        .uleb128 2
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lpush_r12-.Lpush_r10
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 12
+	.byte   0x8c				! DW_CFA_offset r12
+        .uleb128 3
+	.byte	4				! DW_CFA_advance_loc4
+	.ualong	.Lpush_pr-.Lpush_r12
+	.byte	14				! DW_CFA_def_cfa_offset
+	.uleb128 16
+	.byte   0x91				! DW_CFA_offset pr
+        .uleb128 4
+	.align	4
+.LENDFDE:
+
+
+#ifdef SHARED
+	.hidden	DW.ref.__gcc_personality_v0
+	.weak	DW.ref.__gcc_personality_v0
+	.section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
+	.align	4
+	.type	DW.ref.__gcc_personality_v0, @object
+	.size	DW.ref.__gcc_personality_v0, 4
+DW.ref.__gcc_personality_v0:
+	.long	__gcc_personality_v0
+#endif

Modified: fsf/trunk/libc/sysdeps/generic/initfini.c
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/initfini.c (original)
+++ fsf/trunk/libc/sysdeps/generic/initfini.c Mon Jun 18 00:03:13 2007
@@ -81,7 +81,7 @@
 }
 
 SECTION (".init");
-extern void _init (void);
+extern void __attribute__ ((section (".init"))) _init (void);
 void
 _init (void)
 {
@@ -107,7 +107,7 @@
 asm ("\n/*@_fini_PROLOG_BEGINS*/");
 
 SECTION (".fini");
-extern void _fini (void);
+extern void __attribute__ ((section (".fini"))) _fini (void);
 void
 _fini (void)
 {

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h Mon Jun 18 00:03:13 2007
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux/ia64 version.
-   Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2001, 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
@@ -127,6 +127,28 @@
     struct ia64_fpreg fr[128];
   };
 
+/* Options set using PTRACE_SETOPTIONS.  */
+enum __ptrace_setoptions {
+  PTRACE_O_TRACESYSGOOD	= 0x00000001,
+  PTRACE_O_TRACEFORK	= 0x00000002,
+  PTRACE_O_TRACEVFORK   = 0x00000004,
+  PTRACE_O_TRACECLONE	= 0x00000008,
+  PTRACE_O_TRACEEXEC	= 0x00000010,
+  PTRACE_O_TRACEVFORKDONE = 0x00000020,
+  PTRACE_O_TRACEEXIT	= 0x00000040,
+  PTRACE_O_MASK		= 0x0000007f
+};
+
+/* Wait extended result codes for the above trace options.  */
+enum __ptrace_eventcodes {
+  PTRACE_EVENT_FORK	= 1,
+  PTRACE_EVENT_VFORK	= 2,
+  PTRACE_EVENT_CLONE	= 3,
+  PTRACE_EVENT_EXEC	= 4,
+  PTRACE_EVENT_VFORK_DONE = 5,
+  PTRACE_EVENT_EXIT	= 6
+};
+
 /* Perform process tracing functions.  REQUEST is one of the values
    above, and determines the action to be taken.
    For all requests except PTRACE_TRACEME, PID specifies the process to be

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h Mon Jun 18 00:03:13 2007
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2001, 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
@@ -99,6 +99,28 @@
 #define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
+/* Options set using PTRACE_SETOPTIONS.  */
+enum __ptrace_setoptions {
+  PTRACE_O_TRACESYSGOOD	= 0x00000001,
+  PTRACE_O_TRACEFORK	= 0x00000002,
+  PTRACE_O_TRACEVFORK   = 0x00000004,
+  PTRACE_O_TRACECLONE	= 0x00000008,
+  PTRACE_O_TRACEEXEC	= 0x00000010,
+  PTRACE_O_TRACEVFORKDONE = 0x00000020,
+  PTRACE_O_TRACEEXIT	= 0x00000040,
+  PTRACE_O_MASK		= 0x0000007f
+};
+
+/* Wait extended result codes for the above trace options.  */
+enum __ptrace_eventcodes {
+  PTRACE_EVENT_FORK	= 1,
+  PTRACE_EVENT_VFORK	= 2,
+  PTRACE_EVENT_CLONE	= 3,
+  PTRACE_EVENT_EXEC	= 4,
+  PTRACE_EVENT_VFORK_DONE = 5,
+  PTRACE_EVENT_EXIT	= 6
+};
+
 /* Perform process tracing functions.  REQUEST is one of the values
    above, and determines the action to be taken.
    For all requests except PTRACE_TRACEME, PID specifies the process to be

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/sys/ptrace.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/sys/ptrace.h Mon Jun 18 00:03:13 2007
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2006, 2007 Free Software Foundation, Inc.
    Contributed by Denis Joseph Barrow (djbarrow@xxxxxxxxxx).
    This file is part of the GNU C Library.
 
@@ -138,6 +138,28 @@
 #define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
+/* Options set using PTRACE_SETOPTIONS.  */
+enum __ptrace_setoptions {
+  PTRACE_O_TRACESYSGOOD	= 0x00000001,
+  PTRACE_O_TRACEFORK	= 0x00000002,
+  PTRACE_O_TRACEVFORK   = 0x00000004,
+  PTRACE_O_TRACECLONE	= 0x00000008,
+  PTRACE_O_TRACEEXEC	= 0x00000010,
+  PTRACE_O_TRACEVFORKDONE = 0x00000020,
+  PTRACE_O_TRACEEXIT	= 0x00000040,
+  PTRACE_O_MASK		= 0x0000007f
+};
+
+/* Wait extended result codes for the above trace options.  */
+enum __ptrace_eventcodes {
+  PTRACE_EVENT_FORK	= 1,
+  PTRACE_EVENT_VFORK	= 2,
+  PTRACE_EVENT_CLONE	= 3,
+  PTRACE_EVENT_EXEC	= 4,
+  PTRACE_EVENT_VFORK_DONE = 5,
+  PTRACE_EVENT_EXIT	= 6
+};
+
 /* Perform process tracing functions.  REQUEST is one of the values
    above, and determines the action to be taken.
    For all requests except PTRACE_TRACEME, PID specifies the process to be

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h Mon Jun 18 00:03:13 2007
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux/SPARC version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -183,6 +183,28 @@
 #define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
+/* Options set using PTRACE_SETOPTIONS.  */
+enum __ptrace_setoptions {
+  PTRACE_O_TRACESYSGOOD	= 0x00000001,
+  PTRACE_O_TRACEFORK	= 0x00000002,
+  PTRACE_O_TRACEVFORK   = 0x00000004,
+  PTRACE_O_TRACECLONE	= 0x00000008,
+  PTRACE_O_TRACEEXEC	= 0x00000010,
+  PTRACE_O_TRACEVFORKDONE = 0x00000020,
+  PTRACE_O_TRACEEXIT	= 0x00000040,
+  PTRACE_O_MASK		= 0x0000007f
+};
+
+/* Wait extended result codes for the above trace options.  */
+enum __ptrace_eventcodes {
+  PTRACE_EVENT_FORK	= 1,
+  PTRACE_EVENT_VFORK	= 2,
+  PTRACE_EVENT_CLONE	= 3,
+  PTRACE_EVENT_EXEC	= 4,
+  PTRACE_EVENT_VFORK_DONE = 5,
+  PTRACE_EVENT_EXIT	= 6
+};
+
 /* Perform process tracing functions.  REQUEST is one of the values
    above, and determines the action to be taken.
    For all requests except PTRACE_TRACEME, PID specifies the process to be

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/ptrace.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/ptrace.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/ptrace.h Mon Jun 18 00:03:13 2007
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 1996-1999,2000,2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-1999,2000,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
@@ -129,6 +129,29 @@
 #define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
+
+/* Options set using PTRACE_SETOPTIONS.  */
+enum __ptrace_setoptions {
+  PTRACE_O_TRACESYSGOOD	= 0x00000001,
+  PTRACE_O_TRACEFORK	= 0x00000002,
+  PTRACE_O_TRACEVFORK   = 0x00000004,
+  PTRACE_O_TRACECLONE	= 0x00000008,
+  PTRACE_O_TRACEEXEC	= 0x00000010,
+  PTRACE_O_TRACEVFORKDONE = 0x00000020,
+  PTRACE_O_TRACEEXIT	= 0x00000040,
+  PTRACE_O_MASK		= 0x0000007f
+};
+
+/* Wait extended result codes for the above trace options.  */
+enum __ptrace_eventcodes {
+  PTRACE_EVENT_FORK	= 1,
+  PTRACE_EVENT_VFORK	= 2,
+  PTRACE_EVENT_CLONE	= 3,
+  PTRACE_EVENT_EXEC	= 4,
+  PTRACE_EVENT_VFORK_DONE = 5,
+  PTRACE_EVENT_EXIT	= 6
+};
+
 /* Perform process tracing functions.  REQUEST is one of the values
    above, and determines the action to be taken.
    For all requests except PTRACE_TRACEME, PID specifies the process to be