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

r5011 - in glibc-package/trunk/debian: . patches patches/hurd-i386



Author: sthibault
Date: 2011-10-28 23:42:45 +0000 (Fri, 28 Oct 2011)
New Revision: 5011

Added:
   glibc-package/trunk/debian/patches/hurd-i386/tg-____longjmp_chk.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-__i686_defined.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-_dl_random.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-bits_atomic.h_multiple_threads.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-check_native.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-dl-sysdep.c_SHARED.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-extern_inline.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-grantpt.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-gscope.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-ptrmangle.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-regenerate_errno.h.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-strtoul_PLT.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-struct_stat.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-tls.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-tlsdesc.sym.diff
Removed:
   glibc-package/trunk/debian/patches/hurd-i386/submitted-ECANCELED.diff
   glibc-package/trunk/debian/patches/hurd-i386/submitted-dl-sysdep.diff
   glibc-package/trunk/debian/patches/hurd-i386/submitted-extern_inline.diff
   glibc-package/trunk/debian/patches/hurd-i386/submitted-ptr-mangle.diff
   glibc-package/trunk/debian/patches/hurd-i386/submitted-stat.diff
   glibc-package/trunk/debian/patches/hurd-i386/submitted-strtoul.diff
   glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-_dl_random.diff
   glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-atomic-no-multiple_threads.diff
   glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-check_native.diff
   glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-gscope.diff
   glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-i686.diff
   glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-longjmp_chk.diff
   glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-ptsname.diff
   glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-tls-support.diff
Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-tls.diff
   glibc-package/trunk/debian/patches/series
   glibc-package/trunk/debian/patches/series.hurd-i386
Log:
  * patches/hurd-i386/{unsubmitted-gscope.diff,unsubmitted-_dl_random.diff,
    submitted-ECANCELED.diff, submitted-dl-sysdep.diff,
    unsubmitted-check_native.diff, submitted-extern_inline.diff,
    submitted-ptr-mangle.diff, submitted-stat.diff,
    unsubmitted-tls-support.diff, unsubmitted-longjmp_chk.diff,
    unsubmitted-ptsname.diff, submitted-strtoul.diff,
    unsubmitted-atomic-no-multiple_threads.diff, unsubmitted-i686.diff}:
    Update to topgit version, and rename to 
    tg-tlsdesc.sym.diff, tg-struct_stat.diff, tg-gscope.diff,
    tg-tg-_dl_random.diff, bits_atomic.h_multiple_threads.diff,
    tg-tg-dl-sysdep.c_SHARED.diff, __i686_defined.diff,
    tg-tg-regenerate_errno.h.diff, tg-ptrmangle.diff, strtoul_PLT.diff,
    tg-tg-tls.diff, tg-extern_inline.diff, tg-grantpt.diff, check_native.diff,
    tg-tg-____longjmp_chk.diff.


Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/changelog	2011-10-28 23:42:45 UTC (rev 5011)
@@ -8,6 +8,20 @@
   [ Samuel Thibault ]
   * patches/hurd-i386/submitted-setresid.diff: New patch to fix -1 passed to
     setres[ug]id.  Closes: #645285.
+  * patches/hurd-i386/{unsubmitted-gscope.diff,unsubmitted-_dl_random.diff,
+    submitted-ECANCELED.diff, submitted-dl-sysdep.diff,
+    unsubmitted-check_native.diff, submitted-extern_inline.diff,
+    submitted-ptr-mangle.diff, submitted-stat.diff,
+    unsubmitted-tls-support.diff, unsubmitted-longjmp_chk.diff,
+    unsubmitted-ptsname.diff, submitted-strtoul.diff,
+    unsubmitted-atomic-no-multiple_threads.diff, unsubmitted-i686.diff}:
+    Update to topgit version, and rename to 
+    tg-tlsdesc.sym.diff, tg-struct_stat.diff, tg-gscope.diff,
+    tg-tg-_dl_random.diff, bits_atomic.h_multiple_threads.diff,
+    tg-tg-dl-sysdep.c_SHARED.diff, __i686_defined.diff,
+    tg-tg-regenerate_errno.h.diff, tg-ptrmangle.diff, strtoul_PLT.diff,
+    tg-tg-tls.diff, tg-extern_inline.diff, tg-grantpt.diff, check_native.diff,
+    tg-tg-____longjmp_chk.diff.
 
   [ Petr Salinger ]
   * kfreebsd/local-sysdeps.diff: update to revision 3763 (from glibc-bsd).

Deleted: glibc-package/trunk/debian/patches/hurd-i386/submitted-ECANCELED.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/submitted-ECANCELED.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/submitted-ECANCELED.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,32 +0,0 @@
-Regenerate errnos.
-
-http://www.cygwin.com/ml/libc-alpha/2007-08/msg00050.html
-
-t/regenerate_errno.h
-
----
- sysdeps/mach/hurd/bits/errno.h |    6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
---- a/sysdeps/mach/hurd/bits/errno.h
-+++ b/sysdeps/mach/hurd/bits/errno.h
-@@ -212,8 +212,8 @@
- #define	EPROTO          _HURD_ERRNO (116)/* Protocol error */
- 	ETIME           = _HURD_ERRNO (117),
- #define	ETIME           _HURD_ERRNO (117)/* Timer expired */
--	ECANCELED       = _HURD_ERRNO (118),
--#define	ECANCELED       _HURD_ERRNO (118)/* Operation canceled */
-+	ECANCELED       = _HURD_ERRNO (119),
-+#define	ECANCELED       _HURD_ERRNO (119)/* Operation canceled */
- 
- 	/* Errors from <mach/message.h>.  */
- 	EMACH_SEND_IN_PROGRESS          = 0x10000001,
-@@ -297,7 +297,7 @@
- 
- };
- 
--#define	_HURD_ERRNOS	119
-+#define	_HURD_ERRNOS	120
- 
- /* User-visible type of error codes.  It is ok to use `int' or
-    `kern_return_t' for these, but with `error_t' the debugger prints

Deleted: glibc-package/trunk/debian/patches/hurd-i386/submitted-dl-sysdep.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/submitted-dl-sysdep.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/submitted-dl-sysdep.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,29 +0,0 @@
-http://sourceware.org/ml/libc-alpha/2009-01/msg00037.html
-
-2009-01-31  Samuel Thibault  <samuel.thibault@ens-lyon.org>
-
-	* sysdeps/mach/hurd/dl-sysdep.c: Include code only #ifdef SHARED.
-
-t/dl-sysdep.c_SHARED
-
----
- sysdeps/mach/hurd/dl-sysdep.c |    4 ++++
- 1 file changed, 4 insertions(+)
-
---- a/sysdeps/mach/hurd/dl-sysdep.c
-+++ b/sysdeps/mach/hurd/dl-sysdep.c
-@@ -42,6 +42,8 @@
- #include <dl-machine.h>
- #include <dl-procinfo.h>
- 
-+#ifdef SHARED
-+
- extern void __mach_init (void);
- 
- extern int _dl_argc;
-@@ -669,3 +671,5 @@
- {
-   /* This no-op definition only gets used if libc is not linked in.  */
- }
-+
-+#endif /* SHARED */

Deleted: glibc-package/trunk/debian/patches/hurd-i386/submitted-extern_inline.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/submitted-extern_inline.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/submitted-extern_inline.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,662 +0,0 @@
-Fix compilation of extern inlines with recent gcc.
-
-http://www.cygwin.com/ml/libc-alpha/2007-11/msg00058.html
-
-t/extern_inline
-
----
- hurd/hurd.h                             |    4 ++++
- hurd/hurd/fd.h                          |   20 ++++++++++++++++++++
- hurd/hurd/port.h                        |   31 +++++++++++++++++++++++++++++++
- hurd/hurd/signal.h                      |   16 +++++++++++++---
- hurd/hurd/threadvar.h                   |    5 +++++
- hurd/hurd/userlink.h                    |   14 ++++++++++++++
- mach/lock-intern.h                      |   20 ++++++++++++++++++++
- mach/mach/mig_support.h                 |    3 +++
- mach/spin-lock.c                        |    1 +
- ports/sysdeps/mach/alpha/machine-lock.h |   12 ++++++++++++
- ports/sysdeps/mach/alpha/machine-sp.h   |    4 ++++
- sysdeps/generic/machine-lock.h          |   12 ++++++++++++
- sysdeps/generic/machine-sp.h            |    4 ++++
- sysdeps/mach/i386/machine-lock.h        |   12 ++++++++++++
- sysdeps/mach/powerpc/machine-lock.h     |   12 ++++++++++++
- sysdeps/mach/powerpc/machine-sp.h       |    4 ++++
- 16 files changed, 171 insertions(+), 3 deletions(-)
-
---- a/hurd/hurd.h
-+++ b/hurd/hurd.h
-@@ -48,6 +48,9 @@
- #define _HURD_H_EXTERN_INLINE __extern_inline
- #endif
- 
-+int __hurd_fail (error_t err);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_H_EXTERN_INLINE int
- __hurd_fail (error_t err)
- {
-@@ -77,6 +80,7 @@
-   errno = err;
-   return -1;
- }
-+#endif
- 
- /* Basic ports and info, initialized by startup.  */
- 
---- a/hurd/hurd/fd.h
-+++ b/hurd/hurd/fd.h
-@@ -60,6 +60,9 @@
-    NULL.  The cell is unlocked; when ready to use it, lock it and check for
-    it being unused.  */
- 
-+struct hurd_fd *_hurd_fd_get (int fd);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_FD_H_EXTERN_INLINE struct hurd_fd *
- _hurd_fd_get (int fd)
- {
-@@ -90,6 +93,7 @@
- 
-   return descriptor;
- }
-+#endif
- 
- 
- /* Evaluate EXPR with the variable `descriptor' bound to a pointer to the
-@@ -137,6 +141,9 @@
- /* Check if ERR should generate a signal.
-    Returns the signal to take, or zero if none.  */
- 
-+int _hurd_fd_error_signal (error_t err);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_FD_H_EXTERN_INLINE int
- _hurd_fd_error_signal (error_t err)
- {
-@@ -153,11 +160,15 @@
-       return 0;
-     }
- }
-+#endif
- 
- /* Handle an error from an RPC on a file descriptor's port.  You should
-    always use this function to handle errors from RPCs made on file
-    descriptor ports.  Some errors are translated into signals.  */
- 
-+error_t _hurd_fd_error (int fd, error_t err);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_FD_H_EXTERN_INLINE error_t
- _hurd_fd_error (int fd, error_t err)
- {
-@@ -170,20 +181,28 @@
-     }
-   return err;
- }
-+#endif
- 
- /* Handle error code ERR from an RPC on file descriptor FD's port.
-    Set `errno' to the appropriate error code, and always return -1.  */
- 
-+int __hurd_dfail (int fd, error_t err);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_FD_H_EXTERN_INLINE int
- __hurd_dfail (int fd, error_t err)
- {
-   errno = _hurd_fd_error (fd, err);
-   return -1;
- }
-+#endif
- 
- /* Likewise, but do not raise SIGPIPE on EPIPE if flags contain
-    MSG_NOSIGNAL.  */
- 
-+int __hurd_sockfail (int fd, int flags, error_t err);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_FD_H_EXTERN_INLINE int
- __hurd_sockfail (int fd, int flags, error_t err)
- {
-@@ -192,6 +211,7 @@
-   errno = err;
-   return -1;
- }
-+#endif
- 
- /* Set up *FD to have PORT its server port, doing appropriate ctty magic.
-    Does no locking or unlocking.  */
---- a/hurd/hurd/port.h
-+++ b/hurd/hurd/port.h
-@@ -62,6 +62,9 @@
- 
- /* Initialize *PORT to INIT.  */
- 
-+void _hurd_port_init (struct hurd_port *port, mach_port_t init);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_PORT_H_EXTERN_INLINE void
- _hurd_port_init (struct hurd_port *port, mach_port_t init)
- {
-@@ -69,6 +72,7 @@
-   port->users = NULL;
-   port->port = init;
- }
-+#endif
- 
- 
- /* Cleanup function for non-local exits.  */
-@@ -77,6 +81,11 @@
- /* Get a reference to *PORT, which is locked.
-    Pass return value and LINK to _hurd_port_free when done.  */
- 
-+mach_port_t
-+_hurd_port_locked_get (struct hurd_port *port,
-+		       struct hurd_userlink *link);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_PORT_H_EXTERN_INLINE mach_port_t
- _hurd_port_locked_get (struct hurd_port *port,
- 		       struct hurd_userlink *link)
-@@ -92,9 +101,15 @@
-   __spin_unlock (&port->lock);
-   return result;
- }
-+#endif
- 
- /* Same, but locks PORT first.  */
- 
-+mach_port_t
-+_hurd_port_get (struct hurd_port *port,
-+		struct hurd_userlink *link);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_PORT_H_EXTERN_INLINE mach_port_t
- _hurd_port_get (struct hurd_port *port,
- 		struct hurd_userlink *link)
-@@ -106,10 +121,17 @@
-   HURD_CRITICAL_END;
-   return result;
- }
-+#endif
- 
- 
- /* Free a reference gotten with `USED_PORT = _hurd_port_get (PORT, LINK);' */
- 
-+void
-+_hurd_port_free (struct hurd_port *port,
-+		 struct hurd_userlink *link,
-+		 mach_port_t used_port);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_PORT_H_EXTERN_INLINE void
- _hurd_port_free (struct hurd_port *port,
- 		 struct hurd_userlink *link,
-@@ -129,11 +151,15 @@
-   if (dealloc)
-     __mach_port_deallocate (__mach_task_self (), used_port);
- }
-+#endif
- 
- 
- /* Set *PORT's port to NEWPORT.  NEWPORT's reference is consumed by PORT->port.
-    PORT->lock is locked.  */
- 
-+void _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_PORT_H_EXTERN_INLINE void
- _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport)
- {
-@@ -144,9 +170,13 @@
-   if (old != MACH_PORT_NULL)
-     __mach_port_deallocate (__mach_task_self (), old);
- }
-+#endif
- 
- /* Same, but locks PORT first.  */
- 
-+void _hurd_port_set (struct hurd_port *port, mach_port_t newport);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_PORT_H_EXTERN_INLINE void
- _hurd_port_set (struct hurd_port *port, mach_port_t newport)
- {
-@@ -155,6 +185,7 @@
-   _hurd_port_locked_set (port, newport);
-   HURD_CRITICAL_END;
- }
-+#endif
- 
- 
- #endif	/* hurd/port.h */
---- a/hurd/hurd/signal.h
-+++ b/hurd/hurd/signal.h
-@@ -131,15 +131,17 @@
- #define _HURD_SIGNAL_H_EXTERN_INLINE __extern_inline
- #endif
- 
-+#ifdef __USE_EXTERN_INLINES
- _HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
- _hurd_self_sigstate (void)
- {
--  struct hurd_sigstate **location =
-+  struct hurd_sigstate **location = (struct hurd_sigstate **)
-     (void *) __hurd_threadvar_location (_HURD_THREADVAR_SIGSTATE);
-   if (*location == NULL)
-     *location = _hurd_thread_sigstate (__mach_thread_self ());
-   return *location;
- }
-+#endif
- 
- /* Thread listening on our message port; also called the "signal thread".  */
- 
-@@ -166,10 +168,13 @@
-    interrupted lest the signal handler try to take the same lock and
-    deadlock result.  */
- 
-+void *_hurd_critical_section_lock (void);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_SIGNAL_H_EXTERN_INLINE void *
- _hurd_critical_section_lock (void)
- {
--  struct hurd_sigstate **location =
-+  struct hurd_sigstate **location = (struct hurd_sigstate **)
-     (void *) __hurd_threadvar_location (_HURD_THREADVAR_SIGSTATE);
-   struct hurd_sigstate *ss = *location;
-   if (ss == NULL)
-@@ -191,7 +196,11 @@
-      _hurd_critical_section_unlock to unlock it.  */
-   return ss;
- }
-+#endif
- 
-+void _hurd_critical_section_unlock (void *our_lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_SIGNAL_H_EXTERN_INLINE void
- _hurd_critical_section_unlock (void *our_lock)
- {
-@@ -201,7 +210,7 @@
-   else
-     {
-       /* It was us who acquired the critical section lock.  Unlock it.  */
--      struct hurd_sigstate *ss = our_lock;
-+      struct hurd_sigstate *ss = (struct hurd_sigstate *) our_lock;
-       sigset_t pending;
-       __spin_lock (&ss->lock);
-       __spin_unlock (&ss->critical_section_lock);
-@@ -214,6 +223,7 @@
- 	__msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
-     }
- }
-+#endif
- 
- /* Convenient macros for simple uses of critical sections.
-    These two must be used as a pair at the same C scoping level.  */
---- a/hurd/hurd/threadvar.h
-+++ b/hurd/hurd/threadvar.h
-@@ -82,6 +82,8 @@
- 
- extern unsigned long int *__hurd_threadvar_location_from_sp
-   (enum __hurd_threadvar_index __index, void *__sp);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_THREADVAR_H_EXTERN_INLINE unsigned long int *
- __hurd_threadvar_location_from_sp (enum __hurd_threadvar_index __index,
- 				   void *__sp)
-@@ -93,6 +95,7 @@
- 	   : (unsigned long int *) ((__stack & __hurd_threadvar_stack_mask) +
- 				    __hurd_threadvar_stack_offset))[__index];
- }
-+#endif
- 
- #include <machine-sp.h>		/* Define __thread_stack_pointer.  */
- 
-@@ -106,12 +109,14 @@
- 	the same stack frame by different threads.  */
-      __attribute__ ((__const__));
- 
-+#ifdef __USE_EXTERN_INLINES
- _HURD_THREADVAR_H_EXTERN_INLINE unsigned long int *
- __hurd_threadvar_location (enum __hurd_threadvar_index __index)
- {
-   return __hurd_threadvar_location_from_sp (__index,
- 					    __thread_stack_pointer ());
- }
-+#endif
- 
- 
- #endif	/* hurd/threadvar.h */
---- a/hurd/hurd/userlink.h
-+++ b/hurd/hurd/userlink.h
-@@ -77,6 +77,11 @@
- 
- /* Attach LINK to the chain of users at *CHAINP.  */
- 
-+void
-+_hurd_userlink_link (struct hurd_userlink **chainp,
-+		     struct hurd_userlink *link);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_USERLINK_H_EXTERN_INLINE void
- _hurd_userlink_link (struct hurd_userlink **chainp,
- 		     struct hurd_userlink *link)
-@@ -97,11 +102,15 @@
-   link->thread.prevp = thread_chainp;
-   *thread_chainp = link;
- }
-+#endif
- 
- 
- /* Detach LINK from its chain.  Returns nonzero iff this was the
-    last user of the resource and it should be deallocated.  */
- 
-+int _hurd_userlink_unlink (struct hurd_userlink *link);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_USERLINK_H_EXTERN_INLINE int
- _hurd_userlink_unlink (struct hurd_userlink *link)
- {
-@@ -124,6 +133,7 @@
- 
-   return dealloc;
- }
-+#endif
- 
- 
- /* Clear all users from *CHAINP.  Call this when the resource *CHAINP
-@@ -132,6 +142,9 @@
-    value is zero, someone is still using the resource and they will
-    deallocate it when they are finished.  */
- 
-+int _hurd_userlink_clear (struct hurd_userlink **chainp);
-+
-+#ifdef __USE_EXTERN_INLINES
- _HURD_USERLINK_H_EXTERN_INLINE int
- _hurd_userlink_clear (struct hurd_userlink **chainp)
- {
-@@ -144,5 +157,6 @@
-   *chainp = NULL;
-   return 0;
- }
-+#endif
- 
- #endif	/* hurd/userlink.h */
---- a/mach/lock-intern.h
-+++ b/mach/lock-intern.h
-@@ -29,11 +29,15 @@
- 
- /* Initialize LOCK.  */
- 
-+void __spin_lock_init (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE void
- __spin_lock_init (__spin_lock_t *__lock)
- {
-   *__lock = __SPIN_LOCK_INITIALIZER;
- }
-+#endif
- 
- 
- /* Lock LOCK, blocking if we can't get it.  */
-@@ -41,12 +45,16 @@
- 
- /* Lock the spin lock LOCK.  */
- 
-+void __spin_lock (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE void
- __spin_lock (__spin_lock_t *__lock)
- {
-   if (! __spin_try_lock (__lock))
-     __spin_lock_solid (__lock);
- }
-+#endif
- 
- /* Name space-clean internal interface to mutex locks.
- 
-@@ -71,27 +79,39 @@
- 
- /* Lock the mutex lock LOCK.  */
- 
-+void __mutex_lock (void *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE void
- __mutex_lock (void *__lock)
- {
-   if (! __spin_try_lock ((__spin_lock_t *) __lock))
-     __mutex_lock_solid (__lock);
- }
-+#endif
- 
- /* Unlock the mutex lock LOCK.  */
- 
-+void __mutex_unlock (void *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE void
- __mutex_unlock (void *__lock)
- {
-   __spin_unlock ((__spin_lock_t *) __lock);
-   __mutex_unlock_solid (__lock);
- }
-+#endif
-+
- 
-+int __mutex_trylock (void *__lock);
- 
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE int
- __mutex_trylock (void *__lock)
- {
-   return __spin_try_lock ((__spin_lock_t *) __lock);
- }
-+#endif
- 
- #endif /* lock-intern.h */
---- a/mach/mach/mig_support.h
-+++ b/mach/mach/mig_support.h
-@@ -67,6 +67,8 @@
- /* Idiocy support function.  */
- extern vm_size_t mig_strncpy (char *__dst, const char *__src, vm_size_t __len);
- extern vm_size_t __mig_strncpy (char *__dst, const char *__src, vm_size_t);
-+
-+#ifdef __USE_EXTERN_INLINES
- __extern_inline vm_size_t
- __mig_strncpy (char *__dst, const char *__src, vm_size_t __len)
- {
-@@ -77,6 +79,7 @@
- {
-   return __mig_strncpy (__dst, __src, __len);
- }
-+#endif
- 
- 
- 
---- a/mach/spin-lock.c
-+++ b/mach/spin-lock.c
-@@ -1,3 +1,4 @@
-+#define __USE_EXTERN_INLINES 1
- #define _EXTERN_INLINE /* Empty to define the real functions.  */
- #include "spin-lock.h"
- 
---- a/sysdeps/generic/machine-lock.h
-+++ b/sysdeps/generic/machine-lock.h
-@@ -35,14 +35,21 @@
- 
- /* Unlock LOCK.  */
- 
-+void __spin_unlock (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE void
- __spin_unlock (__spin_lock_t *__lock)
- {
-   *__lock = 0;
- }
-+#endif
- 
- /* Try to lock LOCK; return nonzero if we locked it, zero if another has.  */
- 
-+int __spin_try_lock (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE int
- __spin_try_lock (__spin_lock_t *__lock)
- {
-@@ -51,14 +58,19 @@
-   *__lock = 1;
-   return 1;
- }
-+#endif
- 
- /* Return nonzero if LOCK is locked.  */
- 
-+int __spin_lock_locked (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE int
- __spin_lock_locked (__spin_lock_t *__lock)
- {
-   return *__lock != 0;
- }
-+#endif
- 
- 
- #endif /* machine-lock.h */
---- a/sysdeps/generic/machine-sp.h
-+++ b/sysdeps/generic/machine-sp.h
-@@ -26,11 +26,15 @@
- #define _EXTERN_INLINE __extern_inline
- #endif
- 
-+void * __thread_stack_pointer (void);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE void *
- __thread_stack_pointer (void)
- {
-   register void *__sp__ ("{STACK-POINTER}");
-   return __sp__;
- }
-+#endif
- 
- #endif	/* machine-sp.h */
---- a/sysdeps/mach/i386/machine-lock.h
-+++ b/sysdeps/mach/i386/machine-lock.h
-@@ -35,6 +35,9 @@
- 
- /* Unlock LOCK.  */
- 
-+void __spin_unlock (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE void
- __spin_unlock (__spin_lock_t *__lock)
- {
-@@ -43,9 +46,13 @@
- 		       : "=&r" (__unlocked), "=m" (*__lock) : "0" (0)
- 		       : "memory");
- }
-+#endif
- 
- /* Try to lock LOCK; return nonzero if we locked it, zero if another has.  */
- 
-+int __spin_try_lock (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE int
- __spin_try_lock (__spin_lock_t *__lock)
- {
-@@ -55,14 +62,19 @@
- 		      : "memory");
-   return !__locked;
- }
-+#endif
- 
- /* Return nonzero if LOCK is locked.  */
- 
-+int __spin_lock_locked (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE int
- __spin_lock_locked (__spin_lock_t *__lock)
- {
-   return *__lock != 0;
- }
-+#endif
- 
- 
- #endif /* machine-lock.h */
---- a/sysdeps/mach/powerpc/machine-lock.h
-+++ b/sysdeps/mach/powerpc/machine-lock.h
-@@ -35,6 +35,9 @@
- 
- /* Unlock LOCK.  */
- 
-+void __spin_unlock (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE void
- __spin_unlock (__spin_lock_t *__lock)
- {
-@@ -45,9 +48,13 @@
- 	bne-	0b\n\
- " : "=&r" (__locked) : "r" (__lock), "r" (0) : "cr0");
- }
-+#endif
- 
- /* Try to lock LOCK; return nonzero if we locked it, zero if another has.  */
- 
-+int __spin_try_lock (register __spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE int
- __spin_try_lock (register __spin_lock_t *__lock)
- {
-@@ -59,9 +66,13 @@
- " : "=&r" (__rtn) : "r" (__lock), "r" (1) : "cr0");
-   return !__rtn;
- }
-+#endif
- 
- /* Return nonzero if LOCK is locked.  */
- 
-+int __spin_lock_locked (__spin_lock_t *__lock);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE int
- __spin_lock_locked (__spin_lock_t *__lock)
- {
-@@ -73,6 +84,7 @@
- " : "=&r" (__rtn) : "r" (__lock) : "cr0");
-   return __rtn;
- }
-+#endif
- 
- 
- #endif /* machine-lock.h */
---- a/sysdeps/mach/powerpc/machine-sp.h
-+++ b/sysdeps/mach/powerpc/machine-sp.h
-@@ -31,6 +31,9 @@
- # endif
- #endif
- 
-+void * __thread_stack_pointer (void);
-+
-+#ifdef __USE_EXTERN_INLINES
- _EXTERN_INLINE void *
- __thread_stack_pointer (void)
- {
-@@ -38,5 +41,6 @@
-   __asm__ ("mr %0, 1" : "=r" (__sp__));
-   return __sp__;
- }
-+#endif
- 
- #endif	/* machine-sp.h */

Deleted: glibc-package/trunk/debian/patches/hurd-i386/submitted-ptr-mangle.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/submitted-ptr-mangle.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/submitted-ptr-mangle.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,29 +0,0 @@
-2007-11-12  Aurelien Jarno  <aurelien@aurel32.net>
-	    Thomas Schwinge  <tschwinge@gnu.org>
-
-	* sysdeps/mach/i386/sysdep.h (PTR_MANGLE, PTR_DEMANGLE): Define.
-
-t/ptrmangle
-
----
- sysdeps/mach/i386/sysdep.h |    9 +++++++++
- 1 file changed, 9 insertions(+)
-
---- a/sysdeps/mach/i386/sysdep.h
-+++ b/sysdeps/mach/i386/sysdep.h
-@@ -55,6 +55,15 @@
- 
- #define STACK_GROWTH_DOWN
- 
-+/* Pointer mangling is not yet supported for Hurd.  */
-+#ifdef __ASSEMBLER__
-+#define PTR_MANGLE(var)
-+#define PTR_DEMANGLE(var)
-+#else
-+#define PTR_MANGLE(var) (void) (var)
-+#define PTR_DEMANGLE(var) (void) (var)
-+#endif
-+
- /* Get the machine-independent Mach definitions.  */
- #include <sysdeps/mach/sysdep.h>
- 

Deleted: glibc-package/trunk/debian/patches/hurd-i386/submitted-stat.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/submitted-stat.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/submitted-stat.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,122 +0,0 @@
-Needed for HEAD and glibc-2_7-branch.
-
-
-<http://sources.redhat.com/ml/libc-alpha/2002-12/msg00011.html>
-
-Reported on <http://savannah.gnu.org/bugs/?18216>.
-
-
-2007-10-05  Thomas Schwinge  <tschwinge@gnu.org>
-
-	* sysdeps/mach/hurd/bits/stat.h (struct stat): Align to what is done
-	for Linux: use nsec instead of usec, as well as:
-	[__USE_MISC] (st_atim, st_mtim, st_ctim): Provide these ``struct
-	timespec''s.
-	(struct stat64): Likewise.
-	(_STATBUF_ST_NSEC): Define.
-	* sysdeps/mach/hurd/xstatconv.c (xstat64_conv): Adapt to that.
-
-t/struct_stat
-
----
- sysdeps/mach/hurd/bits/stat.h |   56 ++++++++++++++++++++++++++++++++----------
- sysdeps/mach/hurd/xstatconv.c |    9 ++----
- 2 files changed, 46 insertions(+), 19 deletions(-)
-
---- a/sysdeps/mach/hurd/bits/stat.h
-+++ b/sysdeps/mach/hurd/bits/stat.h
-@@ -59,12 +59,27 @@
-     __off64_t st_size;		/* Size in bytes.  */
- #endif
- 
--    __time_t st_atime;		/* Access time, seconds */
--    unsigned long int st_atime_usec; /* and microseconds.  */
--    __time_t st_mtime;		/* Modification time, seconds */
--    unsigned long int st_mtime_usec; /* and microseconds.  */
--    __time_t st_ctime;		/* Status change time, seconds */
--    unsigned long int st_ctime_usec; /* and microseconds.  */
-+#ifdef __USE_MISC
-+    /* Nanosecond resolution timestamps are stored in a format
-+       equivalent to 'struct timespec'.  This is the type used
-+       whenever possible but the Unix namespace rules do not allow the
-+       identifier 'timespec' to appear in the <sys/stat.h> header.
-+       Therefore we have to handle the use of this header in strictly
-+       standard-compliant sources special.  */
-+    struct timespec st_atim;		/* Time of last access.  */
-+    struct timespec st_mtim;		/* Time of last modification.  */
-+    struct timespec st_ctim;		/* Time of last status change.  */
-+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
-+# define st_mtime st_mtim.tv_sec
-+# define st_ctime st_ctim.tv_sec
-+#else
-+    __time_t st_atime;			/* Time of last access.  */
-+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
-+    __time_t st_mtime;			/* Time of last modification.  */
-+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
-+    __time_t st_ctime;			/* Time of last status change.  */
-+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-+#endif
- 
-     __blksize_t st_blksize;	/* Optimal size for I/O.  */
- 
-@@ -108,12 +123,24 @@
- 
-     __off64_t st_size;		/* Size in bytes.  */
- 
--    __time_t st_atime;		/* Access time, seconds */
--    unsigned long int st_atime_usec; /* and microseconds.  */
--    __time_t st_mtime;		/* Modification time, seconds */
--    unsigned long int st_mtime_usec; /* and microseconds.  */
--    __time_t st_ctime;		/* Status change time, seconds */
--    unsigned long int st_ctime_usec; /* and microseconds.  */
-+#ifdef __USE_MISC
-+    /* Nanosecond resolution timestamps are stored in a format
-+       equivalent to 'struct timespec'.  This is the type used
-+       whenever possible but the Unix namespace rules do not allow the
-+       identifier 'timespec' to appear in the <sys/stat.h> header.
-+       Therefore we have to handle the use of this header in strictly
-+       standard-compliant sources special.  */
-+    struct timespec st_atim;		/* Time of last access.  */
-+    struct timespec st_mtim;		/* Time of last modification.  */
-+    struct timespec st_ctim;		/* Time of last status change.  */
-+#else
-+    __time_t st_atime;			/* Time of last access.  */
-+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
-+    __time_t st_mtime;			/* Time of last modification.  */
-+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
-+    __time_t st_ctime;			/* Time of last status change.  */
-+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-+#endif
- 
-     __blksize_t st_blksize;	/* Optimal size for I/O.  */
- 
-@@ -131,7 +158,10 @@
-   };
- #endif
- 
--#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
-+/* Tell code we have these members.  */
-+#define	_STATBUF_ST_BLKSIZE
-+/* Nanosecond resolution time values are supported.  */
-+#define _STATBUF_ST_NSEC
- 
- /* Encoding of the file mode.  */
- 
---- a/sysdeps/mach/hurd/xstatconv.c
-+++ b/sysdeps/mach/hurd/xstatconv.c
-@@ -42,12 +42,9 @@
-   buf->st_uid = buf64->st_uid;
-   buf->st_gid = buf64->st_gid;
-   buf->st_size = buf64->st_size;
--  buf->st_atime = buf64->st_atime;
--  buf->st_atime_usec = buf64->st_atime_usec;
--  buf->st_mtime = buf64->st_mtime;
--  buf->st_mtime_usec = buf64->st_mtime_usec;
--  buf->st_ctime = buf64->st_ctime;
--  buf->st_ctime_usec = buf64->st_ctime_usec;
-+  buf->st_atim = buf64->st_atim;
-+  buf->st_mtim = buf64->st_mtim;
-+  buf->st_ctim = buf64->st_ctim;
-   buf->st_blksize = buf64->st_blksize;
-   buf->st_blocks = buf64->st_blocks;
-   buf->st_author = buf64->st_author;

Deleted: glibc-package/trunk/debian/patches/hurd-i386/submitted-strtoul.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/submitted-strtoul.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/submitted-strtoul.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,22 +0,0 @@
-2007-11-02  Aurelien Jarno  <aurelien@aurel32.net>
-
-	* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Use 
-	  __strtoul_internal instead of strtoul.
-
-t/strtoul_PLT
-
----
- hurd/lookup-retry.c |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/hurd/lookup-retry.c
-+++ b/hurd/lookup-retry.c
-@@ -194,7 +194,7 @@
- 		  char *end;
- 		  int save = errno;
- 		  errno = 0;
--		  fd = (int) strtoul (&retryname[3], &end, 10);
-+		  fd = (int) __strtoul_internal (&retryname[3], &end, 10, 0);
- 		  if (end == NULL || errno || /* Malformed number.  */
- 		      /* Check for excess text after the number.  A slash
- 			 is valid; it ends the component.  Anything else

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-____longjmp_chk.diff (from rev 5010, glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-longjmp_chk.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-____longjmp_chk.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-____longjmp_chk.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,155 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] ____longjmp_chk
+
+____longjmp_chk for GNU Hurd on i386.
+
+---
+ sysdeps/mach/hurd/i386/Makefile           |    4 +
+ sysdeps/mach/hurd/i386/____longjmp_chk.S  |  108 +++++++++++++++++++++++++++++
+ sysdeps/mach/hurd/i386/signal-defines.sym |   10 +++
+ 3 files changed, 122 insertions(+), 0 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/i386/Makefile b/sysdeps/mach/hurd/i386/Makefile
+index 0eef17e..5f98809 100644
+--- a/sysdeps/mach/hurd/i386/Makefile
++++ b/sysdeps/mach/hurd/i386/Makefile
+@@ -2,3 +2,7 @@ ifeq ($(subdir),misc)
+ sysdep_routines += ioperm
+ sysdep_headers += sys/io.h
+ endif
++
++ifeq ($(subdir),debug)
++gen-as-const-headers += signal-defines.sym
++endif
+diff --git a/sysdeps/mach/hurd/i386/____longjmp_chk.S b/sysdeps/mach/hurd/i386/____longjmp_chk.S
+new file mode 100644
+index 0000000..fc7ae7a
+--- /dev/null
++++ b/sysdeps/mach/hurd/i386/____longjmp_chk.S
+@@ -0,0 +1,108 @@
++/* Copyright (C) 2001,2004,2005,2006,2009 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
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++#include <sysdep.h>
++#include <jmpbuf-offsets.h>
++#include <asm-syntax.h>
++
++#include <signal-defines.h>
++/* #include <signal.h> */
++#define SS_ONSTACK 1
++
++
++	.section .rodata.str1.1,"aMS",@progbits,1
++	.type	longjmp_msg,@object
++longjmp_msg:
++	.string "longjmp causes uninitialized stack frame"
++	.size	longjmp_msg, .-longjmp_msg
++
++
++#ifdef PIC
++# define CALL_FAIL	movl	%ebx, %ecx; /* TODO: what's this mov good for? */ \
++			cfi_register(%ebx,%ecx);			      \
++			LOAD_PIC_REG (bx);				      \
++			leal	longjmp_msg@GOTOFF(%ebx), %eax;		      \
++			call	HIDDEN_JUMPTARGET(__fortify_fail)
++#else
++# define CALL_FAIL	movl	$longjmp_msg, %eax;			      \
++			call	HIDDEN_JUMPTARGET(__fortify_fail)
++#endif
++
++
++	.text
++ENTRY (____longjmp_chk)
++	movl	4(%esp), %ecx	/* User's jmp_buf in %ecx.  */
++
++	/* Save the return address now.  */
++	movl	(JB_PC*4)(%ecx), %edx
++	/* Get the stack pointer.  */
++	movl	(JB_SP*4)(%ecx), %edi
++	cfi_undefined(%edi)
++	PTR_DEMANGLE (%edx)
++	PTR_DEMANGLE (%edi)
++
++	cmpl	%edi, %esp
++	/* Jumping to a higher-address frame is always allowed.  */
++	jbe	.Lok
++
++	/* Passing here, we're either about to do something invalid, or we're
++	executing on an alternative signal stack.  */
++
++	/* TODO: need locking?  */
++	/* struct hurd_sigstate * _hurd_self_sigstate (void) */
++	call	_hurd_self_sigstate
++	/* TODO: %eax and %eax->sigaltstack are always valid?  */
++
++	testl	$SS_ONSTACK, (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_FLAGS__OFFSET)(%eax)
++	/* Fail if SS_ONSTACK is not set.  */
++	jz	.Lfail
++
++	movl	(HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SP__OFFSET)(%eax), %ebx
++	addl	(HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SIZE__OFFSET)(%eax), %ebx
++	subl	%edi, %ebx
++	cmpl	(HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SIZE__OFFSET)(%eax), %ebx
++	/* TODO: comment this calculation.  */
++	jae	.Lok
++
++.Lfail:	CALL_FAIL
++
++.Lok:	/* We add unwind information for the target here.  */
++	cfi_def_cfa(%ecx, 0)
++	cfi_register(%eip, %edx)
++	cfi_register(%esp, %edi)
++	cfi_offset(%ebx, JB_BX*4)
++	cfi_offset(%esi, JB_SI*4)
++	cfi_offset(%edi, JB_DI*4)
++	cfi_offset(%ebp, JB_BP*4)
++
++	movl	8(%esp), %eax	/* Second argument is return value.  */
++	movl	%edi, %esp
++
++	/* Restore registers.  */
++	movl	(JB_BX*4)(%ecx), %ebx
++	movl	(JB_SI*4)(%ecx), %esi
++	movl	(JB_DI*4)(%ecx), %edi
++	movl	(JB_BP*4)(%ecx), %ebp
++	cfi_restore(%ebx)
++	cfi_restore(%esi)
++	cfi_restore(%edi)
++	cfi_restore(%ebp)
++
++	/* Jump to saved PC.  */
++	jmp	*%edx
++END (____longjmp_chk)
+diff --git a/sysdeps/mach/hurd/i386/signal-defines.sym b/sysdeps/mach/hurd/i386/signal-defines.sym
+new file mode 100644
+index 0000000..9521bd7
+--- /dev/null
++++ b/sysdeps/mach/hurd/i386/signal-defines.sym
+@@ -0,0 +1,10 @@
++#include <hurd/signal.h>
++#include <signal.h>
++
++--
++
++HURD_SIGSTATE__SIGALTSTACK__OFFSET	offsetof(struct hurd_sigstate, sigaltstack)
++
++SIGALTSTACK__SS_SP__OFFSET		offsetof(struct sigaltstack, ss_sp)
++SIGALTSTACK__SS_SIZE__OFFSET		offsetof(struct sigaltstack, ss_size)
++SIGALTSTACK__SS_FLAGS__OFFSET		offsetof(struct sigaltstack, ss_flags)
+-- 
+tg: (0234227..) t/____longjmp_chk (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-__i686_defined.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-i686.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-__i686_defined.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-__i686_defined.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,50 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] t/__i686_defined
+
+Reported roughly a thousand times on glibc mailing lists (with different kinds
+of patches).
+
+First: <http://sources.redhat.com/ml/libc-alpha/2002-10/msg00157.html>
+
+<http://sourceware.org/bugzilla/show_bug.cgi?id=411>
+
+---
+
+    ../sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef"
+    ../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+    ../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+    ../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+    ../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.'
+    ../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+    ../sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `' in .size directive
+    ../sysdeps/i386/fpu/s_frexp.S:66: Error: ".endif" without ".if"
+    ../sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx' after expression
+    make[2]: *** [/home/thomas/data-local/tmp/gnu-0/src/glibc.obj/math/s_frexp.os] Error 1
+    make[2]: Leaving directory `/media/data-local/thomas/tmp/gnu-0/src/glibc/math'
+    make[1]: *** [math/subdir_lib] Error 2
+    make[1]: Leaving directory `/media/data-local/thomas/tmp/gnu-0/src/glibc'
+    make: *** [all] Error 2
+
+ sysdeps/i386/sysdep.h |    7 +++++++
+ 1 files changed, 7 insertions(+), 0 deletions(-)
+
+diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
+index a8a9e57..5cba790 100644
+--- a/sysdeps/i386/sysdep.h
++++ b/sysdeps/i386/sysdep.h
+@@ -22,6 +22,13 @@
+ 
+ #ifdef	__ASSEMBLER__
+ 
++/* This macro will be defined to 1 if GCC has been configured with
++   --with-arch=i686, causing build failures with __i686.get_pc_thunk.  */
++#if defined __i686
++#undef __i686
++#define __i686 __i686
++#endif
++
+ /* Syntactic details of assembler.  */
+ 
+ #ifdef HAVE_ELF
+-- 
+tg: (0234227..) t/__i686_defined (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-_dl_random.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-_dl_random.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-_dl_random.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-_dl_random.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,32 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] _dl_random
+
+_dl_random
+
+---
+
+    /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: In function `security_init':
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/rtld.c:844: undefined reference to `_dl_random'
+    /media/data/home/thomas/tmp/gnu-2/bin/../lib/gcc/i586-pc-gnu/4.3.3/../../../../i586-pc-gnu/bin/ld: /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: relocation R_386_GOTOFF against undefined hidden symbol `_dl_random' can not be used when making a shared object
+    /media/data/home/thomas/tmp/gnu-2/bin/../lib/gcc/i586-pc-gnu/4.3.3/../../../../i586-pc-gnu/bin/ld: final link failed: Bad value
+    collect2: ld returned 1 exit status
+    make[2]: *** [/media/Stalin/tmp/glibc.hurd.gnu-2/elf/ld.so] Error 1
+
+ sysdeps/mach/hurd/dl-sysdep.c |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
+index 6f27874..83643cb 100644
+--- a/sysdeps/mach/hurd/dl-sysdep.c
++++ b/sysdeps/mach/hurd/dl-sysdep.c
+@@ -59,6 +59,8 @@ void *__libc_stack_end;
+ hp_timing_t _dl_cpuclock_offset;
+ #endif
+ 
++/* TODO: this is never properly initialized in here.  */
++void *_dl_random attribute_relro = NULL;
+ 
+ struct hurd_startup_data *_dl_hurd_data;
+ 
+-- 
+tg: (0234227..) t/_dl_random (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-bits_atomic.h_multiple_threads.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-atomic-no-multiple_threads.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-bits_atomic.h_multiple_threads.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-bits_atomic.h_multiple_threads.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,287 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] bits_atomic.h_multiple_threads
+
+TODO.  bits/atomic.h for GNU Hurd.
+    
+Source: Debian, eglibc-2.10/debian/patches/hurd-i386/local-atomic-no-multiple_threads.diff, r3536.
+Author: TBD.
+
+We always at least start the sigthread anyway.  For now, let's avoid forking
+the file (which would mean having to maintain it).
+
+Need to override sysdeps/i386/i486/bits/atomic.h to remove Linuxisms.
+
+---
+ sysdeps/i386/i486/bits/atomic.h |  107 +++++++++++++-------------------------
+ 1 files changed, 37 insertions(+), 70 deletions(-)
+
+diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h
+index 72986ca..ec94ff8 100644
+--- a/sysdeps/i386/i486/bits/atomic.h
++++ b/sysdeps/i386/i486/bits/atomic.h
+@@ -87,35 +87,26 @@ typedef uintmax_t uatomic_max_t;
+ 
+ #define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \
+   ({ __typeof (*mem) ret;						      \
+-     __asm __volatile ("cmpl $0, %%gs:%P5\n\t"                                \
+-                       "je 0f\n\t"                                            \
+-                       "lock\n"                                               \
+-                       "0:\tcmpxchgb %b2, %1"				      \
++     __asm __volatile ("lock\n"                                               \
++                       "\tcmpxchgb %b2, %1"				      \
+ 		       : "=a" (ret), "=m" (*mem)			      \
+-		       : "q" (newval), "m" (*mem), "0" (oldval),	      \
+-			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
++		       : "q" (newval), "m" (*mem), "0" (oldval));	      \
+      ret; })
+ 
+ #define __arch_c_compare_and_exchange_val_16_acq(mem, newval, oldval) \
+   ({ __typeof (*mem) ret;						      \
+-     __asm __volatile ("cmpl $0, %%gs:%P5\n\t"                                \
+-                       "je 0f\n\t"                                            \
+-                       "lock\n"                                               \
+-                       "0:\tcmpxchgw %w2, %1"				      \
++     __asm __volatile ("lock\n"                                               \
++                       "\tcmpxchgw %w2, %1"				      \
+ 		       : "=a" (ret), "=m" (*mem)			      \
+-		       : "r" (newval), "m" (*mem), "0" (oldval),	      \
+-			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
++		       : "r" (newval), "m" (*mem), "0" (oldval));	      \
+      ret; })
+ 
+ #define __arch_c_compare_and_exchange_val_32_acq(mem, newval, oldval) \
+   ({ __typeof (*mem) ret;						      \
+-     __asm __volatile ("cmpl $0, %%gs:%P5\n\t"                                \
+-                       "je 0f\n\t"                                            \
+-                       "lock\n"                                               \
+-                       "0:\tcmpxchgl %2, %1"				      \
++     __asm __volatile ("lock\n"                                               \
++                       "\tcmpxchgl %2, %1"				      \
+ 		       : "=a" (ret), "=m" (*mem)			      \
+-		       : "r" (newval), "m" (*mem), "0" (oldval),	      \
+-			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
++		       : "r" (newval), "m" (*mem), "0" (oldval));	      \
+      ret; })
+ 
+ /* XXX We do not really need 64-bit compare-and-exchange.  At least
+@@ -156,10 +147,8 @@ typedef uintmax_t uatomic_max_t;
+ #  define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \
+   ({ __typeof (*mem) ret;						      \
+      __asm __volatile ("xchgl %2, %%ebx\n\t"				      \
+-		       "cmpl $0, %%gs:%P7\n\t"				      \
+-		       "je 0f\n\t"					      \
+ 		       "lock\n"						      \
+-		       "0:\tcmpxchg8b %1\n\t"				      \
++		       "\tcmpxchg8b %1\n\t"				      \
+ 		       "xchgl %2, %%ebx"				      \
+ 		       : "=A" (ret), "=m" (*mem)			      \
+ 		       : "DS" (((unsigned long long int) (newval))	      \
+@@ -167,8 +156,7 @@ typedef uintmax_t uatomic_max_t;
+ 			 "c" (((unsigned long long int) (newval)) >> 32),     \
+ 			 "m" (*mem), "a" (((unsigned long long int) (oldval)) \
+ 					  & 0xffffffff),		      \
+-			 "d" (((unsigned long long int) (oldval)) >> 32),     \
+-			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
++			 "d" (((unsigned long long int) (oldval)) >> 32));    \
+      ret; })
+ # else
+ #  define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
+@@ -185,18 +173,15 @@ typedef uintmax_t uatomic_max_t;
+ 
+ #  define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \
+   ({ __typeof (*mem) ret;						      \
+-     __asm __volatile ("cmpl $0, %%gs:%P7\n\t"				      \
+-		       "je 0f\n\t"					      \
+-		       "lock\n"						      \
+-		       "0:\tcmpxchg8b %1"				      \
++     __asm __volatile ("lock\n"						      \
++		       "\tcmpxchg8b %1"				      \
+ 		       : "=A" (ret), "=m" (*mem)			      \
+ 		       : "b" (((unsigned long long int) (newval))	      \
+ 			      & 0xffffffff),				      \
+ 			 "c" (((unsigned long long int) (newval)) >> 32),     \
+ 			 "m" (*mem), "a" (((unsigned long long int) (oldval)) \
+ 					  & 0xffffffff),		      \
+-			 "d" (((unsigned long long int) (oldval)) >> 32),     \
+-			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
++			 "d" (((unsigned long long int) (oldval)) >> 32));    \
+      ret; })
+ # endif
+ #endif
+@@ -231,18 +216,15 @@ typedef uintmax_t uatomic_max_t;
+      if (sizeof (*mem) == 1)						      \
+        __asm __volatile (lock "xaddb %b0, %1"				      \
+ 			 : "=q" (__result), "=m" (*mem)			      \
+-			 : "0" (__addval), "m" (*mem),			      \
+-			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
++			 : "0" (__addval), "m" (*mem));			      \
+      else if (sizeof (*mem) == 2)					      \
+        __asm __volatile (lock "xaddw %w0, %1"				      \
+ 			 : "=r" (__result), "=m" (*mem)			      \
+-			 : "0" (__addval), "m" (*mem),			      \
+-			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
++			 : "0" (__addval), "m" (*mem));			      \
+      else if (sizeof (*mem) == 4)					      \
+        __asm __volatile (lock "xaddl %0, %1"				      \
+ 			 : "=r" (__result), "=m" (*mem)			      \
+-			 : "0" (__addval), "m" (*mem),			      \
+-			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
++			 : "0" (__addval), "m" (*mem));			      \
+      else								      \
+        {								      \
+ 	 __typeof (mem) __memp = (mem);					      \
+@@ -264,7 +246,7 @@ typedef uintmax_t uatomic_max_t;
+ #endif
+ 
+ #define __arch_exchange_and_add_cprefix \
+-  "cmpl $0, %%gs:%P4\n\tje 0f\n\tlock\n0:\t"
++  "lock\n\t"
+ 
+ #define catomic_exchange_and_add(mem, value) \
+   __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, __arch_c,    \
+@@ -280,18 +262,15 @@ typedef uintmax_t uatomic_max_t;
+     else if (sizeof (*mem) == 1)					      \
+       __asm __volatile (lock "addb %b1, %0"				      \
+ 			: "=m" (*mem)					      \
+-			: "iq" (value), "m" (*mem),			      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "iq" (value), "m" (*mem));			      \
+     else if (sizeof (*mem) == 2)					      \
+       __asm __volatile (lock "addw %w1, %0"				      \
+ 			: "=m" (*mem)					      \
+-			: "ir" (value), "m" (*mem),			      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "ir" (value), "m" (*mem));			      \
+     else if (sizeof (*mem) == 4)					      \
+       __asm __volatile (lock "addl %1, %0"				      \
+ 			: "=m" (*mem)					      \
+-			: "ir" (value), "m" (*mem),			      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "ir" (value), "m" (*mem));			      \
+     else								      \
+       {									      \
+ 	__typeof (value) __addval = (value);				      \
+@@ -309,7 +288,7 @@ typedef uintmax_t uatomic_max_t;
+   __arch_add_body (LOCK_PREFIX, __arch, mem, value)
+ 
+ #define __arch_add_cprefix \
+-  "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t"
++  "lock\n\t"
+ 
+ #define catomic_add(mem, value) \
+   __arch_add_body (__arch_add_cprefix, __arch_c, mem, value)
+@@ -358,18 +337,15 @@ typedef uintmax_t uatomic_max_t;
+     if (sizeof (*mem) == 1)						      \
+       __asm __volatile (lock "incb %b0"					      \
+ 			: "=m" (*mem)					      \
+-			: "m" (*mem),					      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "m" (*mem));					      \
+     else if (sizeof (*mem) == 2)					      \
+       __asm __volatile (lock "incw %w0"					      \
+ 			: "=m" (*mem)					      \
+-			: "m" (*mem),					      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "m" (*mem));					      \
+     else if (sizeof (*mem) == 4)					      \
+       __asm __volatile (lock "incl %0"					      \
+ 			: "=m" (*mem)					      \
+-			: "m" (*mem),					      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "m" (*mem));					      \
+     else								      \
+       {									      \
+ 	__typeof (mem) __memp = (mem);					      \
+@@ -385,7 +361,7 @@ typedef uintmax_t uatomic_max_t;
+ #define atomic_increment(mem) __arch_increment_body (LOCK_PREFIX, __arch, mem)
+ 
+ #define __arch_increment_cprefix \
+-  "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t"
++  "lock\n\t"
+ 
+ #define catomic_increment(mem) \
+   __arch_increment_body (__arch_increment_cprefix, __arch_c, mem)
+@@ -415,18 +391,15 @@ typedef uintmax_t uatomic_max_t;
+     if (sizeof (*mem) == 1)						      \
+       __asm __volatile (lock "decb %b0"					      \
+ 			: "=m" (*mem)					      \
+-			: "m" (*mem),					      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "m" (*mem));					      \
+     else if (sizeof (*mem) == 2)					      \
+       __asm __volatile (lock "decw %w0"					      \
+ 			: "=m" (*mem)					      \
+-			: "m" (*mem),					      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "m" (*mem));					      \
+     else if (sizeof (*mem) == 4)					      \
+       __asm __volatile (lock "decl %0"					      \
+ 			: "=m" (*mem)					      \
+-			: "m" (*mem),					      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "m" (*mem));					      \
+     else								      \
+       {									      \
+ 	__typeof (mem) __memp = (mem);					      \
+@@ -442,7 +415,7 @@ typedef uintmax_t uatomic_max_t;
+ #define atomic_decrement(mem) __arch_decrement_body (LOCK_PREFIX, __arch, mem)
+ 
+ #define __arch_decrement_cprefix \
+-  "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t"
++  "lock\n\t"
+ 
+ #define catomic_decrement(mem) \
+   __arch_decrement_body (__arch_decrement_cprefix, __arch_c, mem)
+@@ -513,24 +486,21 @@ typedef uintmax_t uatomic_max_t;
+     if (sizeof (*mem) == 1)						      \
+       __asm __volatile (lock "andb %b1, %0"				      \
+ 			: "=m" (*mem)					      \
+-			: "iq" (mask), "m" (*mem),			      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "iq" (mask), "m" (*mem));			      \
+     else if (sizeof (*mem) == 2)					      \
+       __asm __volatile (lock "andw %w1, %0"				      \
+ 			: "=m" (*mem)					      \
+-			: "ir" (mask), "m" (*mem),			      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "ir" (mask), "m" (*mem));			      \
+     else if (sizeof (*mem) == 4)					      \
+       __asm __volatile (lock "andl %1, %0"				      \
+ 			: "=m" (*mem)					      \
+-			: "ir" (mask), "m" (*mem),			      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "ir" (mask), "m" (*mem));			      \
+     else								      \
+       abort ();								      \
+   } while (0)
+ 
+ #define __arch_cprefix \
+-  "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t"
++  "lock\n\t"
+ 
+ #define atomic_and(mem, mask) __arch_and_body (LOCK_PREFIX, mem, mask)
+ 
+@@ -542,18 +512,15 @@ typedef uintmax_t uatomic_max_t;
+     if (sizeof (*mem) == 1)						      \
+       __asm __volatile (lock "orb %b1, %0"				      \
+ 			: "=m" (*mem)					      \
+-			: "iq" (mask), "m" (*mem),			      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "iq" (mask), "m" (*mem));			      \
+     else if (sizeof (*mem) == 2)					      \
+       __asm __volatile (lock "orw %w1, %0"				      \
+ 			: "=m" (*mem)					      \
+-			: "ir" (mask), "m" (*mem),			      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "ir" (mask), "m" (*mem));			      \
+     else if (sizeof (*mem) == 4)					      \
+       __asm __volatile (lock "orl %1, %0"				      \
+ 			: "=m" (*mem)					      \
+-			: "ir" (mask), "m" (*mem),			      \
+-			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
++			: "ir" (mask), "m" (*mem));			      \
+     else								      \
+       abort ();								      \
+   } while (0)
+-- 
+tg: (0234227..) t/bits_atomic.h_multiple_threads (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-check_native.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-check_native.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-check_native.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-check_native.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,35 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] check_native
+
+2008-11-23  Thomas Schwinge  <tschwinge@gnu.org>
+
+	* sysdeps/mach/hurd/check_native.c: New file.
+
+For now only a dummy.
+
+---
+
+    make[2]: *** No rule to make target `/media/Stalin/tmp/glibc.hurd.gnu-2/inet/check_native.o', needed by `/media/Stalin/tmp/glibc.hurd.gnu-2/inet/stamp.o'.  Stop.
+    make[2]: Leaving directory `/media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/inet'
+    make[1]: *** [inet/subdir_lib] Error 2
+
+ sysdeps/mach/hurd/check_native.c |    9 +++++++++
+ 1 files changed, 9 insertions(+), 0 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/check_native.c b/sysdeps/mach/hurd/check_native.c
+new file mode 100644
+index 0000000..8a829aa
+--- /dev/null
++++ b/sysdeps/mach/hurd/check_native.c
+@@ -0,0 +1,9 @@
++#include <stdint.h>
++
++void
++__check_native (uint32_t a1_index, int *a1_native,
++		uint32_t a2_index, int *a2_native)
++{
++#warning __check_native() not yet implemented
++  return;
++}
+-- 
+tg: (0234227..) t/check_native (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-dl-sysdep.c_SHARED.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/submitted-dl-sysdep.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-dl-sysdep.c_SHARED.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-dl-sysdep.c_SHARED.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,61 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] Hurd: dl-sysdep.c: Include code only #ifdef SHARED.
+
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+---
+
+2009-01-31  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/mach/hurd/dl-sysdep.c: Include code only #ifdef SHARED.
+
+---
+
+Earlier submission:
+<http://sourceware.org/ml/libc-alpha/2009-01/msg00037.html>.
+
+Error message:
+
+    [...]/glibc.hurd.gnu-2/libc.a(dl-sysdep.o): In function `_dl_important_hwcaps':
+    [...]/glibc/git/glibc.hurd/elf/../sysdeps/mach/hurd/dl-sysdep.c:653: multiple definition of `_dl_important_hwcaps'
+    [...]/glibc.hurd.gnu-2/libc.a(dl-support.o):[...]/glibc/git/glibc.hurd/elf/dl-support.c:313: first defined here
+    [...]/glibc.hurd.gnu-2/libc.a(dl-sysdep.o):(.data.rel.ro+0x0): multiple definition of `__libc_enable_secure'
+    [...]/glibc.hurd.gnu-2/libc.a(init-first.o):(.data.rel.ro+0x0): first defined here
+    [...]/glibc.hurd.gnu-2/libc.a(dl-sysdep.o): In function `use_init_port':
+    [...]/glibc/git/glibc.hurd/elf/../sysdeps/mach/hurd/dl-sysdep.c:302: multiple definition of `__libc_multiple_libcs'
+    [...]/glibc.hurd.gnu-2/libc.a(init-first.o):(.data+0x0): first defined here
+    [...]/glibc.hurd.gnu-2/libc.a(dl-sysdep.o):(.data.rel.ro+0x8): multiple definition of `__libc_stack_end'
+    [...]/glibc.hurd.gnu-2/libc.a(dl-support.o):(.data.rel.ro+0x4): first defined here
+    [...]/glibc.hurd.gnu-2/libc.a(dl-sysdep.o): In function `go.11385':
+    dl-sysdep.c:(.text+0xb22): undefined reference to `_dl_argc'
+    dl-sysdep.c:(.text+0xbb2): undefined reference to `_dl_skip_args'
+    dl-sysdep.c:(.text+0xbca): undefined reference to `_dl_skip_args'
+    dl-sysdep.c:(.text+0xbfc): undefined reference to `_dl_start_user'
+    collect2: ld returned 1 exit status
+    make[2]: *** [[...]/glibc.hurd.gnu-2/elf/sln] Error 1
+    make[2]: Leaving directory `[...]/glibc/git/glibc.hurd/elf'
+
+ sysdeps/mach/hurd/dl-sysdep.c |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
+index 6f27874..055f8a4 100644
+--- a/sysdeps/mach/hurd/dl-sysdep.c
++++ b/sysdeps/mach/hurd/dl-sysdep.c
+@@ -18,6 +18,8 @@
+    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA.  */
+ 
++#ifdef SHARED
++
+ #include <hurd.h>
+ #include <link.h>
+ #include <unistd.h>
+@@ -669,3 +671,5 @@ _dl_init_first (int argc, ...)
+ {
+   /* This no-op definition only gets used if libc is not linked in.  */
+ }
++
++#endif /* SHARED */
+-- 
+tg: (0234227..) t/dl-sysdep.c_SHARED (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-extern_inline.diff (from rev 5010, glibc-package/trunk/debian/patches/hurd-i386/submitted-extern_inline.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-extern_inline.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-extern_inline.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,693 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] extern_inline
+
+Fix some ``extern inline'' stuff.
+
+glibc-2.8/debian/patches/hurd-i386/submitted-extern_inline.diff 3057
+
+Probably all done by Samuel Thibault.
+
+---
+ hurd/hurd.h                             |    4 ++++
+ hurd/hurd/fd.h                          |   20 ++++++++++++++++++++
+ hurd/hurd/port.h                        |   31 +++++++++++++++++++++++++++++++
+ hurd/hurd/signal.h                      |   16 +++++++++++++---
+ hurd/hurd/threadvar.h                   |    5 +++++
+ hurd/hurd/userlink.h                    |   14 ++++++++++++++
+ mach/lock-intern.h                      |   20 ++++++++++++++++++++
+ mach/mach/mig_support.h                 |    3 +++
+ mach/spin-lock.c                        |    1 +
+ sysdeps/generic/machine-lock.h          |   12 ++++++++++++
+ sysdeps/generic/machine-sp.h            |    4 ++++
+ sysdeps/mach/i386/machine-lock.h        |   12 ++++++++++++
+ sysdeps/mach/powerpc/machine-lock.h     |   12 ++++++++++++
+ sysdeps/mach/powerpc/machine-sp.h       |    4 ++++
+ 14 files changed, 155 insertions(+), 3 deletions(-)
+
+diff --git a/hurd/hurd.h b/hurd/hurd.h
+index 642ea43..2ce1da0 100644
+--- a/hurd/hurd.h
++++ b/hurd/hurd.h
+@@ -48,6 +48,9 @@
+ #define _HURD_H_EXTERN_INLINE __extern_inline
+ #endif
+ 
++int __hurd_fail (error_t err);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_H_EXTERN_INLINE int
+ __hurd_fail (error_t err)
+ {
+@@ -77,6 +80,7 @@ __hurd_fail (error_t err)
+   errno = err;
+   return -1;
+ }
++#endif
+ 
+ /* Basic ports and info, initialized by startup.  */
+ 
+diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h
+index 2473476..034e7ca 100644
+--- a/hurd/hurd/fd.h
++++ b/hurd/hurd/fd.h
+@@ -60,6 +60,9 @@ extern struct mutex _hurd_dtable_lock; /* Locks those two variables.  */
+    NULL.  The cell is unlocked; when ready to use it, lock it and check for
+    it being unused.  */
+ 
++struct hurd_fd *_hurd_fd_get (int fd);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_FD_H_EXTERN_INLINE struct hurd_fd *
+ _hurd_fd_get (int fd)
+ {
+@@ -90,6 +93,7 @@ _hurd_fd_get (int fd)
+ 
+   return descriptor;
+ }
++#endif
+ 
+ 
+ /* Evaluate EXPR with the variable `descriptor' bound to a pointer to the
+@@ -137,6 +141,9 @@ _hurd_fd_get (int fd)
+ /* Check if ERR should generate a signal.
+    Returns the signal to take, or zero if none.  */
+ 
++int _hurd_fd_error_signal (error_t err);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_FD_H_EXTERN_INLINE int
+ _hurd_fd_error_signal (error_t err)
+ {
+@@ -153,11 +160,15 @@ _hurd_fd_error_signal (error_t err)
+       return 0;
+     }
+ }
++#endif
+ 
+ /* Handle an error from an RPC on a file descriptor's port.  You should
+    always use this function to handle errors from RPCs made on file
+    descriptor ports.  Some errors are translated into signals.  */
+ 
++error_t _hurd_fd_error (int fd, error_t err);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_FD_H_EXTERN_INLINE error_t
+ _hurd_fd_error (int fd, error_t err)
+ {
+@@ -170,20 +181,28 @@ _hurd_fd_error (int fd, error_t err)
+     }
+   return err;
+ }
++#endif
+ 
+ /* Handle error code ERR from an RPC on file descriptor FD's port.
+    Set `errno' to the appropriate error code, and always return -1.  */
+ 
++int __hurd_dfail (int fd, error_t err);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_FD_H_EXTERN_INLINE int
+ __hurd_dfail (int fd, error_t err)
+ {
+   errno = _hurd_fd_error (fd, err);
+   return -1;
+ }
++#endif
+ 
+ /* Likewise, but do not raise SIGPIPE on EPIPE if flags contain
+    MSG_NOSIGNAL.  */
+ 
++int __hurd_sockfail (int fd, int flags, error_t err);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_FD_H_EXTERN_INLINE int
+ __hurd_sockfail (int fd, int flags, error_t err)
+ {
+@@ -192,6 +211,7 @@ __hurd_sockfail (int fd, int flags, error_t err)
+   errno = err;
+   return -1;
+ }
++#endif
+ 
+ /* Set up *FD to have PORT its server port, doing appropriate ctty magic.
+    Does no locking or unlocking.  */
+diff --git a/hurd/hurd/port.h b/hurd/hurd/port.h
+index a1803c3..30769c9 100644
+--- a/hurd/hurd/port.h
++++ b/hurd/hurd/port.h
+@@ -62,6 +62,9 @@ struct hurd_port
+ 
+ /* Initialize *PORT to INIT.  */
+ 
++void _hurd_port_init (struct hurd_port *port, mach_port_t init);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_PORT_H_EXTERN_INLINE void
+ _hurd_port_init (struct hurd_port *port, mach_port_t init)
+ {
+@@ -69,6 +72,7 @@ _hurd_port_init (struct hurd_port *port, mach_port_t init)
+   port->users = NULL;
+   port->port = init;
+ }
++#endif
+ 
+ 
+ /* Cleanup function for non-local exits.  */
+@@ -77,6 +81,11 @@ extern void _hurd_port_cleanup (void *, jmp_buf, int);
+ /* Get a reference to *PORT, which is locked.
+    Pass return value and LINK to _hurd_port_free when done.  */
+ 
++mach_port_t
++_hurd_port_locked_get (struct hurd_port *port,
++		       struct hurd_userlink *link);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_PORT_H_EXTERN_INLINE mach_port_t
+ _hurd_port_locked_get (struct hurd_port *port,
+ 		       struct hurd_userlink *link)
+@@ -92,9 +101,15 @@ _hurd_port_locked_get (struct hurd_port *port,
+   __spin_unlock (&port->lock);
+   return result;
+ }
++#endif
+ 
+ /* Same, but locks PORT first.  */
+ 
++mach_port_t
++_hurd_port_get (struct hurd_port *port,
++		struct hurd_userlink *link);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_PORT_H_EXTERN_INLINE mach_port_t
+ _hurd_port_get (struct hurd_port *port,
+ 		struct hurd_userlink *link)
+@@ -106,10 +121,17 @@ _hurd_port_get (struct hurd_port *port,
+   HURD_CRITICAL_END;
+   return result;
+ }
++#endif
+ 
+ 
+ /* Free a reference gotten with `USED_PORT = _hurd_port_get (PORT, LINK);' */
+ 
++void
++_hurd_port_free (struct hurd_port *port,
++		 struct hurd_userlink *link,
++		 mach_port_t used_port);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_PORT_H_EXTERN_INLINE void
+ _hurd_port_free (struct hurd_port *port,
+ 		 struct hurd_userlink *link,
+@@ -129,11 +151,15 @@ _hurd_port_free (struct hurd_port *port,
+   if (dealloc)
+     __mach_port_deallocate (__mach_task_self (), used_port);
+ }
++#endif
+ 
+ 
+ /* Set *PORT's port to NEWPORT.  NEWPORT's reference is consumed by PORT->port.
+    PORT->lock is locked.  */
+ 
++void _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_PORT_H_EXTERN_INLINE void
+ _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport)
+ {
+@@ -144,9 +170,13 @@ _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport)
+   if (old != MACH_PORT_NULL)
+     __mach_port_deallocate (__mach_task_self (), old);
+ }
++#endif
+ 
+ /* Same, but locks PORT first.  */
+ 
++void _hurd_port_set (struct hurd_port *port, mach_port_t newport);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_PORT_H_EXTERN_INLINE void
+ _hurd_port_set (struct hurd_port *port, mach_port_t newport)
+ {
+@@ -155,6 +185,7 @@ _hurd_port_set (struct hurd_port *port, mach_port_t newport)
+   _hurd_port_locked_set (port, newport);
+   HURD_CRITICAL_END;
+ }
++#endif
+ 
+ 
+ #endif	/* hurd/port.h */
+diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h
+index 21e30c5..46c1fe1 100644
+--- a/hurd/hurd/signal.h
++++ b/hurd/hurd/signal.h
+@@ -131,15 +131,17 @@ extern struct hurd_sigstate *_hurd_self_sigstate (void)
+ #define _HURD_SIGNAL_H_EXTERN_INLINE __extern_inline
+ #endif
+ 
++#ifdef __USE_EXTERN_INLINES
+ _HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
+ _hurd_self_sigstate (void)
+ {
+-  struct hurd_sigstate **location =
++  struct hurd_sigstate **location = (struct hurd_sigstate **)
+     (void *) __hurd_threadvar_location (_HURD_THREADVAR_SIGSTATE);
+   if (*location == NULL)
+     *location = _hurd_thread_sigstate (__mach_thread_self ());
+   return *location;
+ }
++#endif
+ 
+ /* Thread listening on our message port; also called the "signal thread".  */
+ 
+@@ -166,10 +168,13 @@ extern int _hurd_core_limit;
+    interrupted lest the signal handler try to take the same lock and
+    deadlock result.  */
+ 
++void *_hurd_critical_section_lock (void);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_SIGNAL_H_EXTERN_INLINE void *
+ _hurd_critical_section_lock (void)
+ {
+-  struct hurd_sigstate **location =
++  struct hurd_sigstate **location = (struct hurd_sigstate **)
+     (void *) __hurd_threadvar_location (_HURD_THREADVAR_SIGSTATE);
+   struct hurd_sigstate *ss = *location;
+   if (ss == NULL)
+@@ -191,7 +196,11 @@ _hurd_critical_section_lock (void)
+      _hurd_critical_section_unlock to unlock it.  */
+   return ss;
+ }
++#endif
+ 
++void _hurd_critical_section_unlock (void *our_lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_SIGNAL_H_EXTERN_INLINE void
+ _hurd_critical_section_unlock (void *our_lock)
+ {
+@@ -201,7 +210,7 @@ _hurd_critical_section_unlock (void *our_lock)
+   else
+     {
+       /* It was us who acquired the critical section lock.  Unlock it.  */
+-      struct hurd_sigstate *ss = our_lock;
++      struct hurd_sigstate *ss = (struct hurd_sigstate *) our_lock;
+       sigset_t pending;
+       __spin_lock (&ss->lock);
+       __spin_unlock (&ss->critical_section_lock);
+@@ -214,6 +223,7 @@ _hurd_critical_section_unlock (void *our_lock)
+ 	__msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
+     }
+ }
++#endif
+ 
+ /* Convenient macros for simple uses of critical sections.
+    These two must be used as a pair at the same C scoping level.  */
+diff --git a/hurd/hurd/threadvar.h b/hurd/hurd/threadvar.h
+index a0535f7..dd4a59c 100644
+--- a/hurd/hurd/threadvar.h
++++ b/hurd/hurd/threadvar.h
+@@ -82,6 +82,8 @@ enum __hurd_threadvar_index
+ 
+ extern unsigned long int *__hurd_threadvar_location_from_sp
+   (enum __hurd_threadvar_index __index, void *__sp);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_THREADVAR_H_EXTERN_INLINE unsigned long int *
+ __hurd_threadvar_location_from_sp (enum __hurd_threadvar_index __index,
+ 				   void *__sp)
+@@ -93,6 +95,7 @@ __hurd_threadvar_location_from_sp (enum __hurd_threadvar_index __index,
+ 	   : (unsigned long int *) ((__stack & __hurd_threadvar_stack_mask) +
+ 				    __hurd_threadvar_stack_offset))[__index];
+ }
++#endif
+ 
+ #include <machine-sp.h>		/* Define __thread_stack_pointer.  */
+ 
+@@ -106,12 +109,14 @@ __hurd_threadvar_location (enum __hurd_threadvar_index __index) __THROW
+ 	the same stack frame by different threads.  */
+      __attribute__ ((__const__));
+ 
++#ifdef __USE_EXTERN_INLINES
+ _HURD_THREADVAR_H_EXTERN_INLINE unsigned long int *
+ __hurd_threadvar_location (enum __hurd_threadvar_index __index)
+ {
+   return __hurd_threadvar_location_from_sp (__index,
+ 					    __thread_stack_pointer ());
+ }
++#endif
+ 
+ 
+ #endif	/* hurd/threadvar.h */
+diff --git a/hurd/hurd/userlink.h b/hurd/hurd/userlink.h
+index 34457e7..90045a9 100644
+--- a/hurd/hurd/userlink.h
++++ b/hurd/hurd/userlink.h
+@@ -77,6 +77,11 @@ struct hurd_userlink
+ 
+ /* Attach LINK to the chain of users at *CHAINP.  */
+ 
++void
++_hurd_userlink_link (struct hurd_userlink **chainp,
++		     struct hurd_userlink *link);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_USERLINK_H_EXTERN_INLINE void
+ _hurd_userlink_link (struct hurd_userlink **chainp,
+ 		     struct hurd_userlink *link)
+@@ -97,11 +102,15 @@ _hurd_userlink_link (struct hurd_userlink **chainp,
+   link->thread.prevp = thread_chainp;
+   *thread_chainp = link;
+ }
++#endif
+ 
+ 
+ /* Detach LINK from its chain.  Returns nonzero iff this was the
+    last user of the resource and it should be deallocated.  */
+ 
++int _hurd_userlink_unlink (struct hurd_userlink *link);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_USERLINK_H_EXTERN_INLINE int
+ _hurd_userlink_unlink (struct hurd_userlink *link)
+ {
+@@ -124,6 +133,7 @@ _hurd_userlink_unlink (struct hurd_userlink *link)
+ 
+   return dealloc;
+ }
++#endif
+ 
+ 
+ /* Clear all users from *CHAINP.  Call this when the resource *CHAINP
+@@ -132,6 +142,9 @@ _hurd_userlink_unlink (struct hurd_userlink *link)
+    value is zero, someone is still using the resource and they will
+    deallocate it when they are finished.  */
+ 
++int _hurd_userlink_clear (struct hurd_userlink **chainp);
++
++#ifdef __USE_EXTERN_INLINES
+ _HURD_USERLINK_H_EXTERN_INLINE int
+ _hurd_userlink_clear (struct hurd_userlink **chainp)
+ {
+@@ -144,5 +157,6 @@ _hurd_userlink_clear (struct hurd_userlink **chainp)
+   *chainp = NULL;
+   return 0;
+ }
++#endif
+ 
+ #endif	/* hurd/userlink.h */
+diff --git a/mach/lock-intern.h b/mach/lock-intern.h
+index 4aaaedc..a854ddc 100644
+--- a/mach/lock-intern.h
++++ b/mach/lock-intern.h
+@@ -29,11 +29,15 @@
+ 
+ /* Initialize LOCK.  */
+ 
++void __spin_lock_init (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE void
+ __spin_lock_init (__spin_lock_t *__lock)
+ {
+   *__lock = __SPIN_LOCK_INITIALIZER;
+ }
++#endif
+ 
+ 
+ /* Lock LOCK, blocking if we can't get it.  */
+@@ -41,12 +45,16 @@ extern void __spin_lock_solid (__spin_lock_t *__lock);
+ 
+ /* Lock the spin lock LOCK.  */
+ 
++void __spin_lock (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE void
+ __spin_lock (__spin_lock_t *__lock)
+ {
+   if (! __spin_try_lock (__lock))
+     __spin_lock_solid (__lock);
+ }
++#endif
+ 
+ /* Name space-clean internal interface to mutex locks.
+ 
+@@ -71,27 +79,39 @@ extern void __mutex_unlock_solid (void *__lock);
+ 
+ /* Lock the mutex lock LOCK.  */
+ 
++void __mutex_lock (void *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE void
+ __mutex_lock (void *__lock)
+ {
+   if (! __spin_try_lock ((__spin_lock_t *) __lock))
+     __mutex_lock_solid (__lock);
+ }
++#endif
+ 
+ /* Unlock the mutex lock LOCK.  */
+ 
++void __mutex_unlock (void *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE void
+ __mutex_unlock (void *__lock)
+ {
+   __spin_unlock ((__spin_lock_t *) __lock);
+   __mutex_unlock_solid (__lock);
+ }
++#endif
+ 
+ 
++int __mutex_trylock (void *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE int
+ __mutex_trylock (void *__lock)
+ {
+   return __spin_try_lock ((__spin_lock_t *) __lock);
+ }
++#endif
+ 
+ #endif /* lock-intern.h */
+diff --git a/mach/mach/mig_support.h b/mach/mach/mig_support.h
+index f02e8d4..fdd43a6 100644
+--- a/mach/mach/mig_support.h
++++ b/mach/mach/mig_support.h
+@@ -67,6 +67,8 @@ extern void mig_reply_setup (const mach_msg_header_t *__request,
+ /* Idiocy support function.  */
+ extern vm_size_t mig_strncpy (char *__dst, const char *__src, vm_size_t __len);
+ extern vm_size_t __mig_strncpy (char *__dst, const char *__src, vm_size_t);
++
++#ifdef __USE_EXTERN_INLINES
+ __extern_inline vm_size_t
+ __mig_strncpy (char *__dst, const char *__src, vm_size_t __len)
+ {
+@@ -77,6 +79,7 @@ mig_strncpy (char *__dst, const char *__src, vm_size_t __len)
+ {
+   return __mig_strncpy (__dst, __src, __len);
+ }
++#endif
+ 
+ 
+ 
+diff --git a/mach/spin-lock.c b/mach/spin-lock.c
+index aaebc55..1b1e69c 100644
+--- a/mach/spin-lock.c
++++ b/mach/spin-lock.c
+@@ -1,3 +1,4 @@
++#define __USE_EXTERN_INLINES 1
+ #define _EXTERN_INLINE /* Empty to define the real functions.  */
+ #include "spin-lock.h"
+ 
+diff --git a/sysdeps/generic/machine-lock.h b/sysdeps/generic/machine-lock.h
+index db9f444..5ecb265 100644
+--- a/sysdeps/generic/machine-lock.h
++++ b/sysdeps/generic/machine-lock.h
+@@ -35,14 +35,21 @@ typedef volatile int __spin_lock_t;
+ 
+ /* Unlock LOCK.  */
+ 
++void __spin_unlock (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE void
+ __spin_unlock (__spin_lock_t *__lock)
+ {
+   *__lock = 0;
+ }
++#endif
+ 
+ /* Try to lock LOCK; return nonzero if we locked it, zero if another has.  */
+ 
++int __spin_try_lock (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE int
+ __spin_try_lock (__spin_lock_t *__lock)
+ {
+@@ -51,14 +58,19 @@ __spin_try_lock (__spin_lock_t *__lock)
+   *__lock = 1;
+   return 1;
+ }
++#endif
+ 
+ /* Return nonzero if LOCK is locked.  */
+ 
++int __spin_lock_locked (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE int
+ __spin_lock_locked (__spin_lock_t *__lock)
+ {
+   return *__lock != 0;
+ }
++#endif
+ 
+ 
+ #endif /* machine-lock.h */
+diff --git a/sysdeps/generic/machine-sp.h b/sysdeps/generic/machine-sp.h
+index 25e423e..4769bc5 100644
+--- a/sysdeps/generic/machine-sp.h
++++ b/sysdeps/generic/machine-sp.h
+@@ -26,11 +26,15 @@
+ #define _EXTERN_INLINE __extern_inline
+ #endif
+ 
++void * __thread_stack_pointer (void);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE void *
+ __thread_stack_pointer (void)
+ {
+   register void *__sp__ ("{STACK-POINTER}");
+   return __sp__;
+ }
++#endif
+ 
+ #endif	/* machine-sp.h */
+diff --git a/sysdeps/mach/i386/machine-lock.h b/sysdeps/mach/i386/machine-lock.h
+index 33602f4..b0700d9 100644
+--- a/sysdeps/mach/i386/machine-lock.h
++++ b/sysdeps/mach/i386/machine-lock.h
+@@ -35,6 +35,9 @@ typedef __volatile int __spin_lock_t;
+ 
+ /* Unlock LOCK.  */
+ 
++void __spin_unlock (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE void
+ __spin_unlock (__spin_lock_t *__lock)
+ {
+@@ -43,9 +46,13 @@ __spin_unlock (__spin_lock_t *__lock)
+ 		       : "=&r" (__unlocked), "=m" (*__lock) : "0" (0)
+ 		       : "memory");
+ }
++#endif
+ 
+ /* Try to lock LOCK; return nonzero if we locked it, zero if another has.  */
+ 
++int __spin_try_lock (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE int
+ __spin_try_lock (__spin_lock_t *__lock)
+ {
+@@ -55,14 +62,19 @@ __spin_try_lock (__spin_lock_t *__lock)
+ 		      : "memory");
+   return !__locked;
+ }
++#endif
+ 
+ /* Return nonzero if LOCK is locked.  */
+ 
++int __spin_lock_locked (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE int
+ __spin_lock_locked (__spin_lock_t *__lock)
+ {
+   return *__lock != 0;
+ }
++#endif
+ 
+ 
+ #endif /* machine-lock.h */
+diff --git a/sysdeps/mach/powerpc/machine-lock.h b/sysdeps/mach/powerpc/machine-lock.h
+index 96af221..b0e228b 100644
+--- a/sysdeps/mach/powerpc/machine-lock.h
++++ b/sysdeps/mach/powerpc/machine-lock.h
+@@ -35,6 +35,9 @@ typedef __volatile long int __spin_lock_t;
+ 
+ /* Unlock LOCK.  */
+ 
++void __spin_unlock (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE void
+ __spin_unlock (__spin_lock_t *__lock)
+ {
+@@ -45,9 +48,13 @@ __spin_unlock (__spin_lock_t *__lock)
+ 	bne-	0b\n\
+ " : "=&r" (__locked) : "r" (__lock), "r" (0) : "cr0");
+ }
++#endif
+ 
+ /* Try to lock LOCK; return nonzero if we locked it, zero if another has.  */
+ 
++int __spin_try_lock (register __spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE int
+ __spin_try_lock (register __spin_lock_t *__lock)
+ {
+@@ -59,9 +66,13 @@ __spin_try_lock (register __spin_lock_t *__lock)
+ " : "=&r" (__rtn) : "r" (__lock), "r" (1) : "cr0");
+   return !__rtn;
+ }
++#endif
+ 
+ /* Return nonzero if LOCK is locked.  */
+ 
++int __spin_lock_locked (__spin_lock_t *__lock);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE int
+ __spin_lock_locked (__spin_lock_t *__lock)
+ {
+@@ -73,6 +84,7 @@ __spin_lock_locked (__spin_lock_t *__lock)
+ " : "=&r" (__rtn) : "r" (__lock) : "cr0");
+   return __rtn;
+ }
++#endif
+ 
+ 
+ #endif /* machine-lock.h */
+diff --git a/sysdeps/mach/powerpc/machine-sp.h b/sysdeps/mach/powerpc/machine-sp.h
+index 267707b..5885b2a 100644
+--- a/sysdeps/mach/powerpc/machine-sp.h
++++ b/sysdeps/mach/powerpc/machine-sp.h
+@@ -31,6 +31,9 @@
+ # endif
+ #endif
+ 
++void * __thread_stack_pointer (void);
++
++#ifdef __USE_EXTERN_INLINES
+ _EXTERN_INLINE void *
+ __thread_stack_pointer (void)
+ {
+@@ -38,5 +41,6 @@ __thread_stack_pointer (void)
+   __asm__ ("mr %0, 1" : "=r" (__sp__));
+   return __sp__;
+ }
++#endif
+ 
+ #endif	/* machine-sp.h */
+-- 
+tg: (0234227..) t/extern_inline (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-grantpt.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-ptsname.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-grantpt.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-grantpt.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,62 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] t/grantpt
+
+    /media/Stalin/tmp/glibc.hurd.gnu-2/libc_pic.os: In function `pts_name':
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/login/../sysdeps/unix/grantpt.c:52: undefined reference to `__ptsname_internal'
+    collect2: ld returned 1 exit status
+    make[1]: *** [/media/Stalin/tmp/glibc.hurd.gnu-2/libc.so] Error 1
+
+Cf. aa9890239a2aef81e64f3f22a31c7e01b6501f69
+
+Need any of the checks (stat, etc.) that Linux' __ptsname_internal does?
+
+Implement close_all_fds as in 139ee080b6b428240bf49f3e6361f3ac729f891a?
+
+---
+ sysdeps/mach/hurd/ptsname.c |   18 ++++++++++++++----
+ 1 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/ptsname.c b/sysdeps/mach/hurd/ptsname.c
+index b68cd9c..897b353 100644
+--- a/sysdeps/mach/hurd/ptsname.c
++++ b/sysdeps/mach/hurd/ptsname.c
+@@ -19,6 +19,7 @@
+ 
+ #include <errno.h>
+ #include <string.h>
++#include <sys/stat.h>
+ #include <hurd.h>
+ #include <hurd/fd.h>
+ #include <hurd/term.h>
+@@ -41,11 +42,10 @@ ptsname (int fd)
+ }
+ 
+ 
+-/* Store at most BUFLEN characters of the pathname of the slave pseudo
+-   terminal associated with the master FD is open on in BUF.
+-   Return 0 on success, otherwise an error number.  */
++/* We can't make use of STP, but do it that way for conformity with the Linux
++   version...  */
+ int
+-__ptsname_r (int fd, char *buf, size_t buflen)
++__ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
+ {
+   char peername[1024];  /* XXX */
+   size_t len;
+@@ -62,4 +62,14 @@ __ptsname_r (int fd, char *buf, size_t buflen)
+   memcpy (buf, peername, len);
+   return 0;
+ }
++
++
++/* Store at most BUFLEN characters of the pathname of the slave pseudo
++   terminal associated with the master FD is open on in BUF.
++   Return 0 on success, otherwise an error number.  */
++int
++__ptsname_r (int fd, char *buf, size_t buflen)
++{
++  return __ptsname_internal (fd, buf, buflen, NULL);
++}
+ weak_alias (__ptsname_r, ptsname_r)
+-- 
+tg: (0234227..) t/grantpt (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-gscope.diff (from rev 5010, glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-gscope.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-gscope.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-gscope.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,99 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] gscope
+
+Minimal gscope stuff.
+
+glibc-2.8/debian/patches/hurd-i386/local-gscope.diff 3085
+
+Probably written by Samuel Thibault.
+
+---
+
+I think that's the corresponding error message:
+
+    /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: In function `add_dependency':
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:106: undefined reference to `atomic_forced_read'
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:109: undefined reference to `atomic_read_barrier'
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:113: undefined reference to `atomic_forced_read'
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:141: undefined reference to `THREAD_GSCOPE_RESET_FLAG'
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:147: undefined reference to `atomic_forced_read'
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:284: undefined reference to `THREAD_GSCOPE_SET_FLAG'
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:261: undefined reference to `atomic_write_barrier'
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-lookup.c:250: undefined reference to `atomic_write_barrier'
+    /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: In function `add_to_global':
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-open.c:162: undefined reference to `atomic_write_barrier'
+    /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: In function `dl_open_worker':
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/elf/dl-open.c:478: undefined reference to `atomic_write_barrier'
+    collect2: ld returned 1 exit status
+    make[2]: *** [/media/Stalin/tmp/glibc.hurd.gnu-2/elf/ld.so] Error 1
+
+ elf/dl-support.c                  |    1 +
+ sysdeps/generic/ldsodefs.h        |    1 +
+ sysdeps/mach/hurd/sysdep-cancel.h |    9 +++++++++
+ sysdeps/mach/hurd/tls.h           |   13 +++++++++++++
+ 4 files changed, 24 insertions(+), 0 deletions(-)
+
+diff --git a/elf/dl-support.c b/elf/dl-support.c
+index 4226d12..4289755 100644
+--- a/elf/dl-support.c
++++ b/elf/dl-support.c
+@@ -150,6 +150,7 @@ int (*_dl_make_stack_executable_hook) (void **) internal_function
+ /* Function in libpthread to wait for termination of lookups.  */
+ void (*_dl_wait_lookup_done) (void);
+ 
++int volatile _dl_thread_gscope_count;
+ struct dl_scope_free_list *_dl_scope_free_list;
+ 
+ #ifdef NEED_DL_SYSINFO
+diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
+index b24bff3..fa0dec9 100644
+--- a/sysdeps/generic/ldsodefs.h
++++ b/sysdeps/generic/ldsodefs.h
+@@ -514,6 +514,7 @@ struct rtld_global
+     size_t count;
+     void *list[50];
+   } *_dl_scope_free_list;
++  EXTERN volatile int _dl_thread_gscope_count;
+ #ifdef SHARED
+ };
+ # define __rtld_global_attribute__
+diff --git a/sysdeps/mach/hurd/sysdep-cancel.h b/sysdeps/mach/hurd/sysdep-cancel.h
+new file mode 100644
+index 0000000..ec55c73
+--- /dev/null
++++ b/sysdeps/mach/hurd/sysdep-cancel.h
+@@ -0,0 +1,9 @@
++#include <sysdep.h>
++
++/* Always multi-thread (since there's at least the sig handler), but no
++   handling enabled.  */
++#define SINGLE_THREAD_P (0)
++#define RTLD_SINGLE_THREAD_P (0)
++#define LIBC_CANCEL_ASYNC()	0 /* Just a dummy value.  */
++#define LIBC_CANCEL_RESET(val)	((void)(val)) /* Nothing, but evaluate it.  */
++#define LIBC_CANCEL_HANDLED()	/* Nothing.  */
+diff --git a/sysdeps/mach/hurd/tls.h b/sysdeps/mach/hurd/tls.h
+index d63045f..55cfe04 100644
+--- a/sysdeps/mach/hurd/tls.h
++++ b/sysdeps/mach/hurd/tls.h
+@@ -73,5 +73,18 @@ typedef struct
+ 
+ #endif /* !ASSEMBLER */
+ 
++#ifndef __ASSEMBLER__
++#include <mach/mach_traps.h>
++#include <atomic.h>
++/* Temporary poor-man's global scope switch support: just busy-waits */
++#define THREAD_GSCOPE_SET_FLAG() \
++	asm volatile ("lock incl %0":"=m"(GL(dl_thread_gscope_count)))
++#define THREAD_GSCOPE_RESET_FLAG() \
++	asm volatile ("lock decl %0":"=m"(GL(dl_thread_gscope_count)))
++#define THREAD_GSCOPE_WAIT() \
++  while (GL(dl_thread_gscope_count)) { \
++    __swtch_pri (0); \
++  }
++#endif
+ 
+ #endif /* tls.h */
+-- 
+tg: (0234227..) t/gscope (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-ptrmangle.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/submitted-ptr-mangle.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-ptrmangle.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-ptrmangle.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,33 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] ptrmangle
+
+Pointer mangling.
+
+glibc-2.8/debian/patches/hurd-i386/submitted-ptr-mangle.diff 3057
+
+---
+ sysdeps/mach/i386/sysdep.h |    9 +++++++++
+ 1 files changed, 9 insertions(+), 0 deletions(-)
+
+diff --git a/sysdeps/mach/i386/sysdep.h b/sysdeps/mach/i386/sysdep.h
+index fb77d46..d3e569e 100644
+--- a/sysdeps/mach/i386/sysdep.h
++++ b/sysdeps/mach/i386/sysdep.h
+@@ -58,6 +58,15 @@
+ 
+ #define STACK_GROWTH_DOWN
+ 
++/* Pointer mangling is not yet supported for Hurd.  */
++#ifdef __ASSEMBLER__
++#define PTR_MANGLE(var)
++#define PTR_DEMANGLE(var)
++#else
++#define PTR_MANGLE(var) (void) (var)
++#define PTR_DEMANGLE(var) (void) (var)
++#endif
++
+ /* Get the machine-independent Mach definitions.  */
+ #include <sysdeps/mach/sysdep.h>
+ 
+-- 
+tg: (0234227..) t/ptrmangle (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-regenerate_errno.h.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/submitted-ECANCELED.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-regenerate_errno.h.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-regenerate_errno.h.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,38 @@
+Subject: [PATCH] t/regenerate_errno.h
+
+	* sysdeps/mach/hurd/bits/errno.h: Regenerate.
+
+---
+
+The build system will regenerate the file itself, but keeping the in-tree file
+up-to-date avoids having spurious rebuilds due to that.
+
+ sysdeps/mach/hurd/bits/errno.h |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/bits/errno.h b/sysdeps/mach/hurd/bits/errno.h
+index a7d57ad..3b6fe76 100644
+--- a/sysdeps/mach/hurd/bits/errno.h
++++ b/sysdeps/mach/hurd/bits/errno.h
+@@ -212,8 +212,8 @@ enum __error_t_codes
+ #define	EPROTO          _HURD_ERRNO (116)/* Protocol error */
+ 	ETIME           = _HURD_ERRNO (117),
+ #define	ETIME           _HURD_ERRNO (117)/* Timer expired */
+-	ECANCELED       = _HURD_ERRNO (118),
+-#define	ECANCELED       _HURD_ERRNO (118)/* Operation canceled */
++	ECANCELED       = _HURD_ERRNO (119),
++#define	ECANCELED       _HURD_ERRNO (119)/* Operation canceled */
+ 
+ 	/* Errors from <mach/message.h>.  */
+ 	EMACH_SEND_IN_PROGRESS          = 0x10000001,
+@@ -297,7 +297,7 @@ enum __error_t_codes
+ 
+ };
+ 
+-#define	_HURD_ERRNOS	119
++#define	_HURD_ERRNOS	120
+ 
+ /* User-visible type of error codes.  It is ok to use `int' or
+    `kern_return_t' for these, but with `error_t' the debugger prints
+-- 
+tg: (0234227..) t/regenerate_errno.h (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-strtoul_PLT.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/submitted-strtoul.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-strtoul_PLT.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-strtoul_PLT.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,34 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] strtoul_PLT
+
+Don't go through the PLT for strtoul.
+
+glibc-2.8/debian/patches/hurd-i386/submitted-strtoul.diff 3057
+
+---
+
+    /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: In function `strtoul':
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/stdlib/strtol.c:110: undefined reference to `__libc_tsd_LOCALE_data'
+    /media/Stalin/tmp/glibc.hurd.gnu-2/elf/librtld.os: In function `__strtoul_internal':
+    /media/data/home/thomas/tmp/source/glibc/git/glibc.hurd/stdlib/strtol.c:99: undefined reference to `__libc_tsd_LOCALE_data'
+    collect2: ld returned 1 exit status
+    make[2]: *** [/media/Stalin/tmp/glibc.hurd.gnu-2/elf/ld.so] Error 1
+
+ hurd/lookup-retry.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
+index 0a88622..96968f8 100644
+--- a/hurd/lookup-retry.c
++++ b/hurd/lookup-retry.c
+@@ -194,7 +194,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
+ 		  char *end;
+ 		  int save = errno;
+ 		  errno = 0;
+-		  fd = (int) strtoul (&retryname[3], &end, 10);
++		  fd = (int) __strtoul_internal (&retryname[3], &end, 10, 0);
+ 		  if (end == NULL || errno || /* Malformed number.  */
+ 		      /* Check for excess text after the number.  A slash
+ 			 is valid; it ends the component.  Anything else
+-- 
+tg: (0234227..) t/strtoul_PLT (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-struct_stat.diff (from rev 5010, glibc-package/trunk/debian/patches/hurd-i386/submitted-stat.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-struct_stat.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-struct_stat.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,130 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] struct_stat
+
+``struct stat'' fixes.
+
+Needed for HEAD and glibc-2_7-branch.
+
+<http://sources.redhat.com/ml/libc-alpha/2002-12/msg00011.html>
+
+Reported on <http://savannah.gnu.org/bugs/?18216>.
+
+
+2007-10-05  Thomas Schwinge  <tschwinge@gnu.org>
+
+	* sysdeps/mach/hurd/bits/stat.h (struct stat): Align to what is done
+	for Linux: use nsec instead of usec, as well as:
+	[__USE_MISC] (st_atim, st_mtim, st_ctim): Provide these ``struct
+	timespec''s.
+	(struct stat64): Likewise.
+	(_STATBUF_ST_NSEC): Define.
+	* sysdeps/mach/hurd/xstatconv.c (xstat64_conv): Adapt to that.
+
+---
+ sysdeps/mach/hurd/bits/stat.h |   56 +++++++++++++++++++++++++++++++---------
+ sysdeps/mach/hurd/xstatconv.c |    9 ++----
+ 2 files changed, 46 insertions(+), 19 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/bits/stat.h b/sysdeps/mach/hurd/bits/stat.h
+index b64a658..50d18c4 100644
+--- a/sysdeps/mach/hurd/bits/stat.h
++++ b/sysdeps/mach/hurd/bits/stat.h
+@@ -59,12 +59,27 @@ struct stat
+     __off64_t st_size;		/* Size in bytes.  */
+ #endif
+ 
+-    __time_t st_atime;		/* Access time, seconds */
+-    unsigned long int st_atime_usec; /* and microseconds.  */
+-    __time_t st_mtime;		/* Modification time, seconds */
+-    unsigned long int st_mtime_usec; /* and microseconds.  */
+-    __time_t st_ctime;		/* Status change time, seconds */
+-    unsigned long int st_ctime_usec; /* and microseconds.  */
++#ifdef __USE_MISC
++    /* Nanosecond resolution timestamps are stored in a format
++       equivalent to 'struct timespec'.  This is the type used
++       whenever possible but the Unix namespace rules do not allow the
++       identifier 'timespec' to appear in the <sys/stat.h> header.
++       Therefore we have to handle the use of this header in strictly
++       standard-compliant sources special.  */
++    struct timespec st_atim;		/* Time of last access.  */
++    struct timespec st_mtim;		/* Time of last modification.  */
++    struct timespec st_ctim;		/* Time of last status change.  */
++# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
++# define st_mtime st_mtim.tv_sec
++# define st_ctime st_ctim.tv_sec
++#else
++    __time_t st_atime;			/* Time of last access.  */
++    unsigned long int st_atimensec;	/* Nscecs of last access.  */
++    __time_t st_mtime;			/* Time of last modification.  */
++    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
++    __time_t st_ctime;			/* Time of last status change.  */
++    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
++#endif
+ 
+     __blksize_t st_blksize;	/* Optimal size for I/O.  */
+ 
+@@ -108,12 +123,24 @@ struct stat64
+ 
+     __off64_t st_size;		/* Size in bytes.  */
+ 
+-    __time_t st_atime;		/* Access time, seconds */
+-    unsigned long int st_atime_usec; /* and microseconds.  */
+-    __time_t st_mtime;		/* Modification time, seconds */
+-    unsigned long int st_mtime_usec; /* and microseconds.  */
+-    __time_t st_ctime;		/* Status change time, seconds */
+-    unsigned long int st_ctime_usec; /* and microseconds.  */
++#ifdef __USE_MISC
++    /* Nanosecond resolution timestamps are stored in a format
++       equivalent to 'struct timespec'.  This is the type used
++       whenever possible but the Unix namespace rules do not allow the
++       identifier 'timespec' to appear in the <sys/stat.h> header.
++       Therefore we have to handle the use of this header in strictly
++       standard-compliant sources special.  */
++    struct timespec st_atim;		/* Time of last access.  */
++    struct timespec st_mtim;		/* Time of last modification.  */
++    struct timespec st_ctim;		/* Time of last status change.  */
++#else
++    __time_t st_atime;			/* Time of last access.  */
++    unsigned long int st_atimensec;	/* Nscecs of last access.  */
++    __time_t st_mtime;			/* Time of last modification.  */
++    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
++    __time_t st_ctime;			/* Time of last status change.  */
++    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
++#endif
+ 
+     __blksize_t st_blksize;	/* Optimal size for I/O.  */
+ 
+@@ -131,7 +158,10 @@ struct stat64
+   };
+ #endif
+ 
+-#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
++/* Tell code we have these members.  */
++#define	_STATBUF_ST_BLKSIZE
++/* Nanosecond resolution time values are supported.  */
++#define _STATBUF_ST_NSEC
+ 
+ /* Encoding of the file mode.  */
+ 
+diff --git a/sysdeps/mach/hurd/xstatconv.c b/sysdeps/mach/hurd/xstatconv.c
+index e28643c..d320285 100644
+--- a/sysdeps/mach/hurd/xstatconv.c
++++ b/sysdeps/mach/hurd/xstatconv.c
+@@ -42,12 +42,9 @@ xstat64_conv (struct stat *buf, const struct stat64 *buf64)
+   buf->st_uid = buf64->st_uid;
+   buf->st_gid = buf64->st_gid;
+   buf->st_size = buf64->st_size;
+-  buf->st_atime = buf64->st_atime;
+-  buf->st_atime_usec = buf64->st_atime_usec;
+-  buf->st_mtime = buf64->st_mtime;
+-  buf->st_mtime_usec = buf64->st_mtime_usec;
+-  buf->st_ctime = buf64->st_ctime;
+-  buf->st_ctime_usec = buf64->st_ctime_usec;
++  buf->st_atim = buf64->st_atim;
++  buf->st_mtim = buf64->st_mtim;
++  buf->st_ctim = buf64->st_ctim;
+   buf->st_blksize = buf64->st_blksize;
+   buf->st_blocks = buf64->st_blocks;
+   buf->st_author = buf64->st_author;
+-- 
+tg: (0234227..) t/struct_stat (depends on: baseline)

Copied: glibc-package/trunk/debian/patches/hurd-i386/tg-tls.diff (from rev 5009, glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-tls-support.diff)
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-tls.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-tls.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,560 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] tls
+
+TLS support.
+
+All by Samuel Thibault.
+
+glibc-2.8/debian/patches/hurd-i386/local-tls-support.diff 3151
+
+2009-07-30  Samuel Thibault  <samuel.thibault@gnu.org>
+
+	Align up includes as on Linux, to fix build.
+	* sysdeps/mach/hurd/tls.h: Include <sysdep.h>.
+
+---
+ csu/libc-start.c                        |    2 +
+ hurd/hurdfault.c                        |    2 +
+ hurd/hurdsig.c                          |    4 +-
+ mach/mach.h                         |    3 ++
+ mach/setup-thread.c                 |   30 +++++++++++++++++-
+ sysdeps/generic/thread_state.h      |    1 +
+ sysdeps/mach/hurd/bits/libc-lock.h  |    3 ++
+ sysdeps/mach/hurd/bits/libc-tsd.h   |   35 --------------------
+ sysdeps/mach/hurd/fork.c            |    7 +++-
+ sysdeps/mach/hurd/i386/init-first.c |   60 +++++++++++++++++++++-------------
+ sysdeps/mach/hurd/i386/tls.h        |   53 +++++++++++++++++++++++++------
+ sysdeps/mach/hurd/i386/trampoline.c |    2 +-
+ sysdeps/mach/hurd/profil.c              |    2 +
+ sysdeps/mach/hurd/setitimer.c       |    3 +-
+ sysdeps/mach/hurd/tls.h             |    6 +++-
+ sysdeps/mach/i386/thread_state.h    |   11 ++++++-
+ sysdeps/mach/powerpc/thread_state.h |    1 +
+ sysdeps/mach/thread_state.h         |    3 ++
+ 18 files changed, 152 insertions(+), 76 deletions(-)
+
+diff --git a/csu/libc-start.c b/csu/libc-start.c
+index dc7ca55..7576623 100644
+--- a/csu/libc-start.c
++++ b/csu/libc-start.c
+@@ -140,10 +140,12 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
+   /* Performe IREL{,A} relocations.  */
+   __libc_csu_irel ();
+ 
++#ifndef __GNU__
+   /* Initialize the thread library at least a bit since the libgcc
+      functions are using thread functions if these are available and
+      we need to setup errno.  */
+   __pthread_initialize_minimal ();
++#endif
+ 
+   /* Set up the stack checker's canary.  */
+   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
+diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c
+index 36653e1..10b19c8 100644
+--- a/hurd/hurdfault.c
++++ b/hurd/hurdfault.c
+@@ -206,6 +206,8 @@ _hurdsig_fault_init (void)
+   /* This state will be restored when we fault.
+      It runs the function above.  */
+   memset (&state, 0, sizeof state);
++
++  MACHINE_THREAD_STATE_FIX_NEW (&state);
+   MACHINE_THREAD_STATE_SET_PC (&state, faulted);
+   MACHINE_THREAD_STATE_SET_SP (&state, faultstack, sizeof faultstack);
+ 
+diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
+index 7a6b1d5..4cb5e3c 100644
+--- a/hurd/hurdsig.c
++++ b/hurd/hurdsig.c
+@@ -1268,6 +1268,8 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
+ 				 (vm_address_t *) &__hurd_sigthread_stack_base,
+ 				 &stacksize);
+       assert_perror (err);
++      err = __mach_setup_tls (_hurd_msgport_thread);
++      assert_perror (err);
+ 
+       __hurd_sigthread_stack_end = __hurd_sigthread_stack_base + stacksize;
+       __hurd_sigthread_variables =
+@@ -1276,8 +1278,6 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
+ 	__libc_fatal ("hurd: Can't allocate threadvars for signal thread\n");
+       memset (__hurd_sigthread_variables, 0,
+ 	      __hurd_threadvar_max * sizeof (unsigned long int));
+-      __hurd_sigthread_variables[_HURD_THREADVAR_LOCALE]
+-	= (unsigned long int) &_nl_global_locale;
+ 
+       /* Reinitialize the MiG support routines so they will use a per-thread
+ 	 variable for the cached reply port.  */
+diff --git a/mach/mach.h b/mach/mach.h
+index f8fd44b..502db5a 100644
+--- a/mach/mach.h
++++ b/mach/mach.h
+@@ -101,5 +101,8 @@ kern_return_t mach_setup_thread (task_t task, thread_t thread, void *pc,
+ 				 vm_address_t *stack_base,
+ 				 vm_size_t *stack_size);
+ 
++/* Give THREAD a TLS area.  */
++kern_return_t __mach_setup_tls (thread_t thread);
++kern_return_t mach_setup_tls (thread_t thread);
+ 
+ #endif	/* mach.h */
+diff --git a/mach/setup-thread.c b/mach/setup-thread.c
+index fecffd9..bf0bfa9 100644
+--- a/mach/setup-thread.c
++++ b/mach/setup-thread.c
+@@ -20,6 +20,7 @@
+ #include <thread_state.h>
+ #include <string.h>
+ #include <mach/machine/vm_param.h>
++#include <ldsodefs.h>
+ #include "sysdep.h"		/* Defines stack direction.  */
+ 
+ #define	STACK_SIZE	(16 * 1024 * 1024) /* 16MB, arbitrary.  */
+@@ -73,8 +74,35 @@ __mach_setup_thread (task_t task, thread_t thread, void *pc,
+   if (error = __vm_protect (task, stack, __vm_page_size, 0, VM_PROT_NONE))
+     return error;
+ 
+-  return __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
++  return __thread_set_state (thread, MACHINE_NEW_THREAD_STATE_FLAVOR,
+ 			     (natural_t *) &ts, tssize);
+ }
+ 
+ weak_alias (__mach_setup_thread, mach_setup_thread)
++
++/* Give THREAD a TLS area.  */
++kern_return_t
++__mach_setup_tls (thread_t thread)
++{
++  kern_return_t error;
++  struct machine_thread_state ts;
++  mach_msg_type_number_t tssize = MACHINE_THREAD_STATE_COUNT;
++  tcbhead_t *tcb;
++
++  if (error = __thread_get_state (thread, MACHINE_THREAD_STATE_FLAVOR,
++			     (natural_t *) &ts, &tssize))
++    return error;
++  assert (tssize == MACHINE_THREAD_STATE_COUNT);
++
++  tcb = _dl_allocate_tls(NULL);
++  if (!tcb)
++    return KERN_RESOURCE_SHORTAGE;
++
++  _hurd_tls_new(thread, &ts, tcb);
++
++  error = __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
++			     (natural_t *) &ts, tssize);
++  return error;
++}
++
++weak_alias (__mach_setup_tls, mach_setup_tls)
+diff --git a/sysdeps/generic/thread_state.h b/sysdeps/generic/thread_state.h
+index 7f8c0f8..3d4b0b5 100644
+--- a/sysdeps/generic/thread_state.h
++++ b/sysdeps/generic/thread_state.h
+@@ -23,6 +23,7 @@
+ 
+ /* Replace <machine> with "i386" or "mips" or whatever.  */
+ 
++#define MACHINE_NEW_THREAD_STATE_FLAVOR	<machine>_NEW_THREAD_STATE
+ #define MACHINE_THREAD_STATE_FLAVOR	<machine>_THREAD_STATE
+ #define MACHINE_THREAD_STATE_COUNT	<machine>_THREAD_STATE_COUNT
+ 
+diff --git a/sysdeps/mach/hurd/bits/libc-lock.h b/sysdeps/mach/hurd/bits/libc-lock.h
+index 90e46e0..013615e 100644
+--- a/sysdeps/mach/hurd/bits/libc-lock.h
++++ b/sysdeps/mach/hurd/bits/libc-lock.h
+@@ -21,6 +21,9 @@
+ #define _BITS_LIBC_LOCK_H 1
+ 
+ #if (_LIBC - 0) || (_CTHREADS_ - 0)
++#if (_LIBC - 0)
++#include <tls.h>
++#endif
+ #include <cthreads.h>
+ #include <hurd/threadvar.h>
+ 
+diff --git a/sysdeps/mach/hurd/bits/libc-tsd.h b/sysdeps/mach/hurd/bits/libc-tsd.h
+deleted file mode 100644
+index 926dd1f..0000000
+--- a/sysdeps/mach/hurd/bits/libc-tsd.h
++++ /dev/null
+@@ -1,35 +0,0 @@
+-/* libc-internal interface for thread-specific data.  Hurd version.
+-   Copyright (C) 1998,2002,2008 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
+-   modify it under the terms of the GNU Lesser General Public
+-   License as published by the Free Software Foundation; either
+-   version 2.1 of the License, or (at your option) any later version.
+-
+-   The GNU C Library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Lesser General Public License for more details.
+-
+-   You should have received a copy of the GNU Lesser General Public
+-   License along with the GNU C Library; if not, write to the Free
+-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-   02111-1307 USA.  */
+-
+-#ifndef _BITS_LIBC_TSD_H
+-#define _BITS_LIBC_TSD_H 1
+-
+-#include <hurd/threadvar.h>
+-
+-#define __libc_tsd_define(CLASS, TYPE, KEY) /* nothing, always have threadvars */
+-
+-#define __libc_tsd_address(TYPE, KEY) \
+-  ((TYPE *) __hurd_threadvar_location (_HURD_THREADVAR_##KEY))
+-
+-#define __libc_tsd_get(TYPE, KEY) \
+-  (*__libc_tsd_address (TYPE, KEY))
+-#define __libc_tsd_set(TYPE, KEY, VALUE) \
+-  (*__libc_tsd_address (TYPE, KEY) = (VALUE))
+-
+-#endif	/* bits/libc-tsd.h */
+diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c
+index 66fa7e2..78b7c6c 100644
+--- a/sysdeps/mach/hurd/fork.c
++++ b/sysdeps/mach/hurd/fork.c
+@@ -523,6 +523,11 @@ __fork (void)
+ #endif
+       MACHINE_THREAD_STATE_SET_PC (&state,
+ 				   (unsigned long int) _hurd_msgport_receive);
++
++      /* Do special thread setup for TLS if needed.  */
++      if (err = _hurd_tls_fork (sigthread, _hurd_msgport_thread, &state))
++	LOSE;
++
+       if (err = __thread_set_state (sigthread, MACHINE_THREAD_STATE_FLAVOR,
+ 				    (natural_t *) &state, statecount))
+ 	LOSE;
+@@ -533,7 +538,7 @@ __fork (void)
+       _hurd_longjmp_thread_state (&state, env, 1);
+ 
+       /* Do special thread setup for TLS if needed.  */
+-      if (err = _hurd_tls_fork (thread, &state))
++      if (err = _hurd_tls_fork (thread, __mach_thread_self (), &state))
+ 	LOSE;
+ 
+       if (err = __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
+diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
+index 60823bd..63214de 100644
+--- a/sysdeps/mach/hurd/i386/init-first.c
++++ b/sysdeps/mach/hurd/i386/init-first.c
+@@ -104,10 +104,6 @@ init1 (int argc, char *arg0, ...)
+   char **argv = &arg0;
+   char **envp = &argv[argc + 1];
+   struct hurd_startup_data *d;
+-#ifndef SHARED
+-  extern ElfW(Phdr) *_dl_phdr;
+-  extern size_t _dl_phnum;
+-#endif
+ 
+   while (*envp)
+     ++envp;
+@@ -118,27 +114,9 @@ init1 (int argc, char *arg0, ...)
+      data block; the argument strings start there.  */
+   if ((void *) d == argv[0])
+     {
+-#ifndef SHARED
+-      /* We may need to see our own phdrs, e.g. for TLS setup.
+-         Try the usual kludge to find the headers without help from
+-	 the exec server.  */
+-      extern const void _start;
+-      const ElfW(Ehdr) *const ehdr = &_start;
+-      _dl_phdr = (ElfW(Phdr) *) ((const void *) ehdr + ehdr->e_phoff);
+-      _dl_phnum = ehdr->e_phnum;
+-      assert (ehdr->e_phentsize == sizeof (ElfW(Phdr)));
+-#endif
+       return;
+     }
+ 
+-#ifndef SHARED
+-  __libc_enable_secure = d->flags & EXEC_SECURE;
+-
+-  _dl_phdr = (ElfW(Phdr) *) d->phdr;
+-  _dl_phnum = d->phdrsz / sizeof (ElfW(Phdr));
+-  assert (d->phdrsz % sizeof (ElfW(Phdr)) == 0);
+-#endif
+-
+   _hurd_init_dtable = d->dtable;
+   _hurd_init_dtablesize = d->dtablesize;
+ 
+@@ -172,13 +150,16 @@ init (int *data)
+   char **envp = &argv[argc + 1];
+   struct hurd_startup_data *d;
+   unsigned long int threadvars[_HURD_THREADVAR_MAX];
++#ifndef SHARED
++  extern ElfW(Phdr) *_dl_phdr;
++  extern size_t _dl_phnum;
++#endif
+ 
+   /* Provide temporary storage for thread-specific variables on the
+      startup stack so the cthreads initialization code can use them
+      for malloc et al, or so we can use malloc below for the real
+      threadvars array.  */
+   memset (threadvars, 0, sizeof threadvars);
+-  threadvars[_HURD_THREADVAR_LOCALE] = (unsigned long int) &_nl_global_locale;
+   __hurd_threadvar_stack_offset = (unsigned long int) threadvars;
+ 
+   /* Since the cthreads initialization code uses malloc, and the
+@@ -192,6 +173,39 @@ init (int *data)
+     ++envp;
+   d = (void *) ++envp;
+ 
++  /* If we are the bootstrap task started by the kernel,
++     then after the environment pointers there is no Hurd
++     data block; the argument strings start there.  */
++  if ((void *) d == argv[0])
++    {
++#ifndef SHARED
++      /* We may need to see our own phdrs, e.g. for TLS setup.
++         Try the usual kludge to find the headers without help from
++	 the exec server.  */
++      extern const void __executable_start;
++      const ElfW(Ehdr) *const ehdr = &__executable_start;
++      _dl_phdr = (ElfW(Phdr) *) ((const void *) ehdr + ehdr->e_phoff);
++      _dl_phnum = ehdr->e_phnum;
++      assert (ehdr->e_phentsize == sizeof (ElfW(Phdr)));
++#endif
++    }
++  else
++    {
++#ifndef SHARED
++      __libc_enable_secure = d->flags & EXEC_SECURE;
++
++      _dl_phdr = (ElfW(Phdr) *) d->phdr;
++      _dl_phnum = d->phdrsz / sizeof (ElfW(Phdr));
++      assert (d->phdrsz % sizeof (ElfW(Phdr)) == 0);
++#endif
++    }
++
++#ifndef SHARED
++  /* We need to setup TLS before starting sigthread */
++  extern void __pthread_initialize_minimal(void);
++  __pthread_initialize_minimal();
++#endif
++
+   /* The user might have defined a value for this, to get more variables.
+      Otherwise it will be zero on startup.  We must make sure it is set
+      properly before before cthreads initialization, so cthreads can know
+diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h
+index 46e0982..3315ad1 100644
+--- a/sysdeps/mach/hurd/i386/tls.h
++++ b/sysdeps/mach/hurd/i386/tls.h
+@@ -71,7 +71,7 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
+ 
+       /* Get the first available selector.  */
+       int sel = -1;
+-      error_t err = __i386_set_gdt (tcb->self, &sel, desc);
++      kern_return_t err = __i386_set_gdt (tcb->self, &sel, desc);
+       if (err == MIG_BAD_ID)
+ 	{
+ 	  /* Old kernel, use a per-thread LDT.  */
+@@ -95,16 +95,16 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
+       /* Fetch the selector set by the first call.  */
+       int sel;
+       asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0));
+-      if (__builtin_expect (sel, 0x50) & 4) /* LDT selector */
++      if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
+ 	{
+-	  error_t err = __i386_set_ldt (tcb->self, sel, &desc, 1);
++	  kern_return_t err = __i386_set_ldt (tcb->self, sel, &desc, 1);
+ 	  assert_perror (err);
+ 	  if (err)
+ 	    return "i386_set_ldt failed";
+ 	}
+       else
+ 	{
+-	  error_t err = __i386_set_gdt (tcb->self, &sel, desc);
++	  kern_return_t err = __i386_set_gdt (tcb->self, &sel, desc);
+ 	  assert_perror (err);
+ 	  if (err)
+ 	    return "i386_set_gdt failed";
+@@ -141,9 +141,40 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
+ 
+ # include <mach/machine/thread_status.h>
+ 
+-/* Set up TLS in the new thread of a fork child, copying from our own.  */
+-static inline error_t __attribute__ ((unused))
+-_hurd_tls_fork (thread_t child, struct i386_thread_state *state)
++/* Set up TLS in the new thread of a fork child, copying from the original.  */
++static inline kern_return_t __attribute__ ((unused))
++_hurd_tls_fork (thread_t child, thread_t orig, struct i386_thread_state *state)
++{
++  /* Fetch the selector set by _hurd_tls_init.  */
++  int sel;
++  asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0));
++  if (sel == state->ds)		/* _hurd_tls_init was never called.  */
++    return 0;
++
++  struct descriptor desc, *_desc = &desc;
++  int err;
++  unsigned int count;
++
++  if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
++    err = __i386_get_ldt (orig, sel, 1, &_desc, &count);
++  else
++    err = __i386_get_gdt (orig, sel, &desc);
++
++  assert_perror (err);
++  if (err)
++    return err;
++
++  if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
++    err = __i386_set_ldt (child, sel, &desc, 1);
++  else
++    err = __i386_set_gdt (child, &sel, desc);
++
++  state->gs = sel;
++  return err;
++}
++
++static inline kern_return_t __attribute__ ((unused))
++_hurd_tls_new (thread_t child, struct i386_thread_state *state, tcbhead_t *tcb)
+ {
+   /* Fetch the selector set by _hurd_tls_init.  */
+   int sel;
+@@ -151,11 +182,13 @@ _hurd_tls_fork (thread_t child, struct i386_thread_state *state)
+   if (sel == state->ds)		/* _hurd_tls_init was never called.  */
+     return 0;
+ 
+-  tcbhead_t *const tcb = THREAD_SELF;
+   HURD_TLS_DESC_DECL (desc, tcb);
+-  error_t err;
++  kern_return_t err;
++
++  tcb->tcb = tcb;
++  tcb->self = child;
+ 
+-  if (__builtin_expect (sel, 0x50) & 4) /* LDT selector */
++  if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
+     err = __i386_set_ldt (child, sel, &desc, 1);
+   else
+     err = __i386_set_gdt (child, &sel, desc);
+diff --git a/sysdeps/mach/hurd/i386/trampoline.c b/sysdeps/mach/hurd/i386/trampoline.c
+index 99d9308..390a245 100644
+--- a/sysdeps/mach/hurd/i386/trampoline.c
++++ b/sysdeps/mach/hurd/i386/trampoline.c
+@@ -65,7 +65,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
+ 		  sizeof (state->basic));
+ 	  memcpy (&state->fpu, &ss->context->sc_i386_float_state,
+ 		  sizeof (state->fpu));
+-	  state->set |= (1 << i386_THREAD_STATE) | (1 << i386_FLOAT_STATE);
++	  state->set |= (1 << i386_REGS_SEGS_STATE) | (1 << i386_FLOAT_STATE);
+ 	}
+     }
+ 
+diff --git a/sysdeps/mach/hurd/profil.c b/sysdeps/mach/hurd/profil.c
+index 0426f67..fa5c016 100644
+--- a/sysdeps/mach/hurd/profil.c
++++ b/sysdeps/mach/hurd/profil.c
+@@ -69,6 +69,8 @@ update_waiter (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
+       if (! err)
+ 	err = __mach_setup_thread (__mach_task_self (), profile_thread,
+ 				   &profile_waiter, NULL, NULL);
++      if (! err)
++	err = __mach_setup_tls(profile_thread);
+     }
+   else
+     err = 0;
+diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
+index fec64a8..22f1b16 100644
+--- a/sysdeps/mach/hurd/setitimer.c
++++ b/sysdeps/mach/hurd/setitimer.c
+@@ -223,11 +223,12 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old,
+ 	    return __hurd_fail (err);
+ 	  _hurd_itimer_thread_stack_base = 0; /* Anywhere.  */
+ 	  _hurd_itimer_thread_stack_size = __vm_page_size; /* Small stack.  */
+-	  if (err = __mach_setup_thread (__mach_task_self (),
++	  if ((err = __mach_setup_thread (__mach_task_self (),
+ 					 _hurd_itimer_thread,
+ 					 &timer_thread,
+ 					 &_hurd_itimer_thread_stack_base,
+ 					 &_hurd_itimer_thread_stack_size))
++	      || (err = __mach_setup_tls(_hurd_itimer_thread)))
+ 	    {
+ 	      __thread_terminate (_hurd_itimer_thread);
+ 	      _hurd_itimer_thread = MACH_PORT_NULL;
+diff --git a/sysdeps/mach/hurd/tls.h b/sysdeps/mach/hurd/tls.h
+index d63045f..747470d 100644
+--- a/sysdeps/mach/hurd/tls.h
++++ b/sysdeps/mach/hurd/tls.h
+@@ -1,5 +1,7 @@
+ /* Definitions for thread-local data handling.  Hurd version.
+-   Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc.
++
++   Copyright (C) 2003, 2005, 2007, 2009 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
+@@ -23,7 +25,9 @@
+ #ifndef __ASSEMBLER__
+ 
+ # include <stddef.h>
++# include <stdint.h>
+ # include <stdbool.h>
++# include <sysdep.h>
+ # include <mach/mig_errors.h>
+ # include <mach.h>
+ 
+diff --git a/sysdeps/mach/i386/thread_state.h b/sysdeps/mach/i386/thread_state.h
+index e8fdef6..106ebc0 100644
+--- a/sysdeps/mach/i386/thread_state.h
++++ b/sysdeps/mach/i386/thread_state.h
+@@ -22,7 +22,8 @@
+ 
+ #include <mach/machine/thread_status.h>
+ 
+-#define MACHINE_THREAD_STATE_FLAVOR	i386_THREAD_STATE
++#define MACHINE_NEW_THREAD_STATE_FLAVOR	i386_THREAD_STATE
++#define MACHINE_THREAD_STATE_FLAVOR	i386_REGS_SEGS_STATE
+ #define MACHINE_THREAD_STATE_COUNT	i386_THREAD_STATE_COUNT
+ 
+ #define machine_thread_state i386_thread_state
+@@ -31,6 +32,14 @@
+ #define SP uesp
+ #define SYSRETURN eax
+ 
++#define MACHINE_THREAD_STATE_FIX_NEW(ts) do { \
++	asm ("mov %%cs, %w0" : "=q" ((ts)->cs)); \
++	asm ("mov %%ds, %w0" : "=q" ((ts)->ds)); \
++	asm ("mov %%es, %w0" : "=q" ((ts)->es)); \
++	asm ("mov %%fs, %w0" : "=q" ((ts)->fs)); \
++	asm ("mov %%gs, %w0" : "=q" ((ts)->gs)); \
++} while(0)
++
+ struct machine_thread_all_state
+   {
+     int set;			/* Mask of bits (1 << FLAVOR).  */
+diff --git a/sysdeps/mach/powerpc/thread_state.h b/sysdeps/mach/powerpc/thread_state.h
+index e6ca104..4ef1fe1 100644
+--- a/sysdeps/mach/powerpc/thread_state.h
++++ b/sysdeps/mach/powerpc/thread_state.h
+@@ -19,6 +19,7 @@
+ 
+ #include <mach/machine/thread_status.h>
+ 
++#define MACHINE_NEW_THREAD_STATE_FLAVOR	PPC_THREAD_STATE
+ #define MACHINE_THREAD_STATE_FLAVOR	PPC_THREAD_STATE
+ #define MACHINE_THREAD_STATE_COUNT	PPC_THREAD_STATE_COUNT
+ 
+diff --git a/sysdeps/mach/thread_state.h b/sysdeps/mach/thread_state.h
+index 38effdf..4445c2e 100644
+--- a/sysdeps/mach/thread_state.h
++++ b/sysdeps/mach/thread_state.h
+@@ -38,6 +38,9 @@
+   ((ts)->SP = (unsigned long int) (stack) + (size))
+ #endif
+ #endif
++#ifndef MACHINE_THREAD_STATE_FIX_NEW
++#define MACHINE_THREAD_STATE_FIX_NEW(ts)
++#endif
+ 
+ /* These functions are of use in machine-dependent signal trampoline
+    implementations.  */
+-- 
+tg: (0234227..) t/tls (depends on: baseline)

Added: glibc-package/trunk/debian/patches/hurd-i386/tg-tlsdesc.sym.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-tlsdesc.sym.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-tlsdesc.sym.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -0,0 +1,36 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] tlsdesc.sym
+
+i386 version of tlsdesc.sym for GNU Hurd.
+
+---
+ sysdeps/mach/hurd/i386/tlsdesc.sym |   19 +++++++++++++++++++
+ 1 files changed, 19 insertions(+), 0 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/i386/tlsdesc.sym b/sysdeps/mach/hurd/i386/tlsdesc.sym
+new file mode 100644
+index 0000000..a358f7e
+--- /dev/null
++++ b/sysdeps/mach/hurd/i386/tlsdesc.sym
+@@ -0,0 +1,19 @@
++#include <stddef.h>
++#include <sysdep.h>
++#include <tls.h>
++#include <link.h>
++#include <dl-tlsdesc.h>
++
++--
++
++-- We have to override sysdeps/i386/tlsdesc.sym to adapt to our libpthread.
++
++-- Abuse tls.h macros to derive offsets relative to the thread register.
++
++DTV_OFFSET			offsetof(tcbhead_t, dtv)
++
++TLSDESC_ARG			offsetof(struct tlsdesc, arg)
++
++TLSDESC_GEN_COUNT		offsetof(struct tlsdesc_dynamic_arg, gen_count)
++TLSDESC_MODID			offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module)
++TLSDESC_MODOFF			offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset)
+-- 
+tg: (0234227..) t/tlsdesc.sym (depends on: baseline)

Deleted: glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-_dl_random.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-_dl_random.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-_dl_random.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,18 +0,0 @@
-Add dummy _dl_random.
-
-t/_dl_random
-
----
- sysdeps/mach/hurd/dl-sysdep.c |    1 +
- 1 file changed, 1 insertion(+)
-
---- a/sysdeps/mach/hurd/dl-sysdep.c
-+++ b/sysdeps/mach/hurd/dl-sysdep.c
-@@ -56,6 +56,7 @@
- 				   of init-first.  */
- /* This variable containts the lowest stack address ever used.  */
- void *__libc_stack_end;
-+void *_dl_random attribute_relro = NULL; /* TODO */
- 
- #if HP_TIMING_AVAIL
- hp_timing_t _dl_cpuclock_offset;

Deleted: glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-atomic-no-multiple_threads.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-atomic-no-multiple_threads.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-atomic-no-multiple_threads.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,276 +0,0 @@
-On the Hurd we always at least start the sigthread anyway.  Let's avoid forking
-the file (which would mean having to maintain it), but it thus can't be applied
-upstream as such.
-
-t/bits_atomic.h_multiple_threads
-
----
- sysdeps/i386/i486/bits/atomic.h |  107 +++++++++++++---------------------------
- 1 file changed, 37 insertions(+), 70 deletions(-)
-
---- a/sysdeps/i386/i486/bits/atomic.h
-+++ b/sysdeps/i386/i486/bits/atomic.h
-@@ -87,35 +87,26 @@
- 
- #define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \
-   ({ __typeof (*mem) ret;						      \
--     __asm __volatile ("cmpl $0, %%gs:%P5\n\t"                                \
--                       "je 0f\n\t"                                            \
--                       "lock\n"                                               \
--                       "0:\tcmpxchgb %b2, %1"				      \
-+     __asm __volatile ("lock\n"                                               \
-+                       "\tcmpxchgb %b2, %1"				      \
- 		       : "=a" (ret), "=m" (*mem)			      \
--		       : "q" (newval), "m" (*mem), "0" (oldval),	      \
--			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
-+		       : "q" (newval), "m" (*mem), "0" (oldval));	      \
-      ret; })
- 
- #define __arch_c_compare_and_exchange_val_16_acq(mem, newval, oldval) \
-   ({ __typeof (*mem) ret;						      \
--     __asm __volatile ("cmpl $0, %%gs:%P5\n\t"                                \
--                       "je 0f\n\t"                                            \
--                       "lock\n"                                               \
--                       "0:\tcmpxchgw %w2, %1"				      \
-+     __asm __volatile ("lock\n"                                               \
-+                       "\tcmpxchgw %w2, %1"				      \
- 		       : "=a" (ret), "=m" (*mem)			      \
--		       : "r" (newval), "m" (*mem), "0" (oldval),	      \
--			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
-+		       : "r" (newval), "m" (*mem), "0" (oldval));	      \
-      ret; })
- 
- #define __arch_c_compare_and_exchange_val_32_acq(mem, newval, oldval) \
-   ({ __typeof (*mem) ret;						      \
--     __asm __volatile ("cmpl $0, %%gs:%P5\n\t"                                \
--                       "je 0f\n\t"                                            \
--                       "lock\n"                                               \
--                       "0:\tcmpxchgl %2, %1"				      \
-+     __asm __volatile ("lock\n"                                               \
-+                       "\tcmpxchgl %2, %1"				      \
- 		       : "=a" (ret), "=m" (*mem)			      \
--		       : "r" (newval), "m" (*mem), "0" (oldval),	      \
--			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
-+		       : "r" (newval), "m" (*mem), "0" (oldval));	      \
-      ret; })
- 
- /* XXX We do not really need 64-bit compare-and-exchange.  At least
-@@ -148,10 +139,8 @@
- #  define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \
-   ({ __typeof (*mem) ret;						      \
-      __asm __volatile ("xchgl %2, %%ebx\n\t"				      \
--		       "cmpl $0, %%gs:%P7\n\t"				      \
--		       "je 0f\n\t"					      \
- 		       "lock\n"						      \
--		       "0:\tcmpxchg8b %1\n\t"				      \
-+		       "\tcmpxchg8b %1\n\t"				      \
- 		       "xchgl %2, %%ebx"				      \
- 		       : "=A" (ret), "=m" (*mem)			      \
- 		       : "DS" (((unsigned long long int) (newval))	      \
-@@ -159,8 +148,7 @@
- 			 "c" (((unsigned long long int) (newval)) >> 32),     \
- 			 "m" (*mem), "a" (((unsigned long long int) (oldval)) \
- 					  & 0xffffffff),		      \
--			 "d" (((unsigned long long int) (oldval)) >> 32),     \
--			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
-+			 "d" (((unsigned long long int) (oldval)) >> 32));    \
-      ret; })
- # else
- #  define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
-@@ -177,18 +165,15 @@
- 
- #  define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \
-   ({ __typeof (*mem) ret;						      \
--     __asm __volatile ("cmpl $0, %%gs:%P7\n\t"				      \
--		       "je 0f\n\t"					      \
--		       "lock\n"						      \
--		       "0:\tcmpxchg8b %1"				      \
-+     __asm __volatile ("lock\n"						      \
-+		       "\tcmpxchg8b %1"				      \
- 		       : "=A" (ret), "=m" (*mem)			      \
- 		       : "b" (((unsigned long long int) (newval))	      \
- 			      & 0xffffffff),				      \
- 			 "c" (((unsigned long long int) (newval)) >> 32),     \
- 			 "m" (*mem), "a" (((unsigned long long int) (oldval)) \
- 					  & 0xffffffff),		      \
--			 "d" (((unsigned long long int) (oldval)) >> 32),     \
--			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
-+			 "d" (((unsigned long long int) (oldval)) >> 32));    \
-      ret; })
- # endif
- #endif
-@@ -223,18 +208,15 @@
-      if (sizeof (*mem) == 1)						      \
-        __asm __volatile (lock "xaddb %b0, %1"				      \
- 			 : "=q" (__result), "=m" (*mem)			      \
--			 : "0" (__addval), "m" (*mem),			      \
--			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
-+			 : "0" (__addval), "m" (*mem));			      \
-      else if (sizeof (*mem) == 2)					      \
-        __asm __volatile (lock "xaddw %w0, %1"				      \
- 			 : "=r" (__result), "=m" (*mem)			      \
--			 : "0" (__addval), "m" (*mem),			      \
--			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
-+			 : "0" (__addval), "m" (*mem));			      \
-      else if (sizeof (*mem) == 4)					      \
-        __asm __volatile (lock "xaddl %0, %1"				      \
- 			 : "=r" (__result), "=m" (*mem)			      \
--			 : "0" (__addval), "m" (*mem),			      \
--			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
-+			 : "0" (__addval), "m" (*mem));			      \
-      else								      \
-        {								      \
- 	 __typeof (mem) __memp = (mem);					      \
-@@ -256,7 +238,7 @@
- #endif
- 
- #define __arch_exchange_and_add_cprefix \
--  "cmpl $0, %%gs:%P4\n\tje 0f\n\tlock\n0:\t"
-+  "lock\n\t"
- 
- #define catomic_exchange_and_add(mem, value) \
-   __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, __arch_c,    \
-@@ -272,18 +254,15 @@
-     else if (sizeof (*mem) == 1)					      \
-       __asm __volatile (lock "addb %b1, %0"				      \
- 			: "=m" (*mem)					      \
--			: "iq" (value), "m" (*mem),			      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "iq" (value), "m" (*mem));			      \
-     else if (sizeof (*mem) == 2)					      \
-       __asm __volatile (lock "addw %w1, %0"				      \
- 			: "=m" (*mem)					      \
--			: "ir" (value), "m" (*mem),			      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "ir" (value), "m" (*mem));			      \
-     else if (sizeof (*mem) == 4)					      \
-       __asm __volatile (lock "addl %1, %0"				      \
- 			: "=m" (*mem)					      \
--			: "ir" (value), "m" (*mem),			      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "ir" (value), "m" (*mem));			      \
-     else								      \
-       {									      \
- 	__typeof (value) __addval = (value);				      \
-@@ -301,7 +280,7 @@
-   __arch_add_body (LOCK_PREFIX, __arch, mem, value)
- 
- #define __arch_add_cprefix \
--  "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t"
-+  "lock\n\t"
- 
- #define catomic_add(mem, value) \
-   __arch_add_body (__arch_add_cprefix, __arch_c, mem, value)
-@@ -350,18 +329,15 @@
-     if (sizeof (*mem) == 1)						      \
-       __asm __volatile (lock "incb %b0"					      \
- 			: "=m" (*mem)					      \
--			: "m" (*mem),					      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "m" (*mem));					      \
-     else if (sizeof (*mem) == 2)					      \
-       __asm __volatile (lock "incw %w0"					      \
- 			: "=m" (*mem)					      \
--			: "m" (*mem),					      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "m" (*mem));					      \
-     else if (sizeof (*mem) == 4)					      \
-       __asm __volatile (lock "incl %0"					      \
- 			: "=m" (*mem)					      \
--			: "m" (*mem),					      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "m" (*mem));					      \
-     else								      \
-       {									      \
- 	__typeof (mem) __memp = (mem);					      \
-@@ -377,7 +353,7 @@
- #define atomic_increment(mem) __arch_increment_body (LOCK_PREFIX, __arch, mem)
- 
- #define __arch_increment_cprefix \
--  "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t"
-+  "lock\n\t"
- 
- #define catomic_increment(mem) \
-   __arch_increment_body (__arch_increment_cprefix, __arch_c, mem)
-@@ -407,18 +383,15 @@
-     if (sizeof (*mem) == 1)						      \
-       __asm __volatile (lock "decb %b0"					      \
- 			: "=m" (*mem)					      \
--			: "m" (*mem),					      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "m" (*mem));					      \
-     else if (sizeof (*mem) == 2)					      \
-       __asm __volatile (lock "decw %w0"					      \
- 			: "=m" (*mem)					      \
--			: "m" (*mem),					      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "m" (*mem));					      \
-     else if (sizeof (*mem) == 4)					      \
-       __asm __volatile (lock "decl %0"					      \
- 			: "=m" (*mem)					      \
--			: "m" (*mem),					      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "m" (*mem));					      \
-     else								      \
-       {									      \
- 	__typeof (mem) __memp = (mem);					      \
-@@ -434,7 +407,7 @@
- #define atomic_decrement(mem) __arch_decrement_body (LOCK_PREFIX, __arch, mem)
- 
- #define __arch_decrement_cprefix \
--  "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t"
-+  "lock\n\t"
- 
- #define catomic_decrement(mem) \
-   __arch_decrement_body (__arch_decrement_cprefix, __arch_c, mem)
-@@ -505,24 +478,21 @@
-     if (sizeof (*mem) == 1)						      \
-       __asm __volatile (lock "andb %b1, %0"				      \
- 			: "=m" (*mem)					      \
--			: "iq" (mask), "m" (*mem),			      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "iq" (mask), "m" (*mem));			      \
-     else if (sizeof (*mem) == 2)					      \
-       __asm __volatile (lock "andw %w1, %0"				      \
- 			: "=m" (*mem)					      \
--			: "ir" (mask), "m" (*mem),			      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "ir" (mask), "m" (*mem));			      \
-     else if (sizeof (*mem) == 4)					      \
-       __asm __volatile (lock "andl %1, %0"				      \
- 			: "=m" (*mem)					      \
--			: "ir" (mask), "m" (*mem),			      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "ir" (mask), "m" (*mem));			      \
-     else								      \
-       abort ();								      \
-   } while (0)
- 
- #define __arch_cprefix \
--  "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t"
-+  "lock\n\t"
- 
- #define atomic_and(mem, mask) __arch_and_body (LOCK_PREFIX, mem, mask)
- 
-@@ -534,18 +504,15 @@
-     if (sizeof (*mem) == 1)						      \
-       __asm __volatile (lock "orb %b1, %0"				      \
- 			: "=m" (*mem)					      \
--			: "iq" (mask), "m" (*mem),			      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "iq" (mask), "m" (*mem));			      \
-     else if (sizeof (*mem) == 2)					      \
-       __asm __volatile (lock "orw %w1, %0"				      \
- 			: "=m" (*mem)					      \
--			: "ir" (mask), "m" (*mem),			      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "ir" (mask), "m" (*mem));			      \
-     else if (sizeof (*mem) == 4)					      \
-       __asm __volatile (lock "orl %1, %0"				      \
- 			: "=m" (*mem)					      \
--			: "ir" (mask), "m" (*mem),			      \
--			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
-+			: "ir" (mask), "m" (*mem));			      \
-     else								      \
-       abort ();								      \
-   } while (0)

Deleted: glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-check_native.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-check_native.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-check_native.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,38 +0,0 @@
-Stub implementation of __check_native
-
-t/check_native
-
----
- sysdeps/mach/hurd/check_native.c |   27 +++++++++++++++++++++++++++
- 1 file changed, 27 insertions(+)
-
---- /dev/null
-+++ b/sysdeps/mach/hurd/check_native.c
-@@ -0,0 +1,27 @@
-+/* Determine whether interfaces use native transport.  Dummy version.
-+   Copyright (C) 2008 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
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <stdint.h>
-+
-+void
-+__check_native (uint32_t a1_index, int *a1_native,
-+		uint32_t a2_index, int *a2_native)
-+{
-+#warning __check_native() not yet implemented
-+}

Deleted: glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-gscope.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-gscope.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-gscope.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,64 +0,0 @@
-Poor-man's global scope switch support: just busy-waits.
-
-t/gscope
-
----
- elf/dl-support.c                  |    1 +
- sysdeps/generic/ldsodefs.h        |    1 +
- sysdeps/mach/hurd/sysdep-cancel.h |    9 +++++++++
- sysdeps/mach/hurd/tls.h           |   13 +++++++++++++
- 4 files changed, 24 insertions(+)
-
---- a/elf/dl-support.c
-+++ b/elf/dl-support.c
-@@ -157,6 +157,7 @@
- /* Function in libpthread to wait for termination of lookups.  */
- void (*_dl_wait_lookup_done) (void);
- 
-+int volatile _dl_thread_gscope_count;
- struct dl_scope_free_list *_dl_scope_free_list;
- 
- #ifdef NEED_DL_SYSINFO
---- a/sysdeps/generic/ldsodefs.h
-+++ b/sysdeps/generic/ldsodefs.h
-@@ -515,6 +515,7 @@
-     size_t count;
-     void *list[50];
-   } *_dl_scope_free_list;
-+  EXTERN volatile int _dl_thread_gscope_count;
- #ifdef SHARED
- };
- # define __rtld_global_attribute__
---- /dev/null
-+++ b/sysdeps/mach/hurd/sysdep-cancel.h
-@@ -0,0 +1,9 @@
-+#include <sysdep.h>
-+
-+/* Always multi-thread (since there's at least the sig handler), but no
-+   handling enabled.  */
-+#define SINGLE_THREAD_P (0)
-+#define RTLD_SINGLE_THREAD_P (0)
-+#define LIBC_CANCEL_ASYNC()	0 /* Just a dummy value.  */
-+#define LIBC_CANCEL_RESET(val)	((void)(val)) /* Nothing, but evaluate it.  */
-+#define LIBC_CANCEL_HANDLED()	/* Nothing.  */
---- a/sysdeps/mach/hurd/tls.h
-+++ b/sysdeps/mach/hurd/tls.h
-@@ -75,5 +75,18 @@
- 
- #endif /* HAVE_TLS_SUPPORT */
- 
-+#ifndef __ASSEMBLER__
-+#include <mach/mach_traps.h>
-+#include <atomic.h>
-+/* Temporary poor-man's global scope switch support: just busy-waits */
-+#define THREAD_GSCOPE_SET_FLAG() \
-+	asm volatile ("lock incl %0":"=m"(GL(dl_thread_gscope_count)))
-+#define THREAD_GSCOPE_RESET_FLAG() \
-+	asm volatile ("lock decl %0":"=m"(GL(dl_thread_gscope_count)))
-+#define THREAD_GSCOPE_WAIT() \
-+  while (GL(dl_thread_gscope_count)) { \
-+    __swtch_pri (0); \
-+  }
-+#endif
- 
- #endif /* tls.h */

Deleted: glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-i686.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-i686.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-i686.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,26 +0,0 @@
-This isn't needed on linux, should check why.
-
-2010-08-22  Samuel Thibault  <samuel.thibault@ens-lyon.org>
-
-        * sysdeps/mach/i386/sysdep.h [__ASSEMBLER__] (__i686): New macro.
-
-t/__i686_defined
-
----
- sysdeps/mach/i386/sysdep.h |    5 +++++
- 1 file changed, 5 insertions(+)
-
---- a/sysdeps/mach/i386/sysdep.h
-+++ b/sysdeps/mach/i386/sysdep.h
-@@ -22,6 +22,11 @@
- #include <dl-sysdep.h>
- #include <tls.h>
- 
-+#if defined __i686 && defined __ASSEMBLER__
-+#undef __i686
-+#define __i686 __i686
-+#endif
-+
- #define LOSE asm volatile ("hlt")
- 
- #define SNARF_ARGS(entry_sp, argc, argv, envp)				      \

Deleted: glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-longjmp_chk.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-longjmp_chk.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-longjmp_chk.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,146 +0,0 @@
-From Thomas Schwinge.
-
-Provide ____longjmp_chk, still WIP.
-
-t/____longjmp_chk
-
----
- sysdeps/mach/hurd/i386/Makefile           |    4 +
- sysdeps/mach/hurd/i386/____longjmp_chk.S  |  108 ++++++++++++++++++++++++++++++
- sysdeps/mach/hurd/i386/signal-defines.sym |   10 ++
- 3 files changed, 122 insertions(+)
-
---- a/sysdeps/mach/hurd/i386/Makefile
-+++ b/sysdeps/mach/hurd/i386/Makefile
-@@ -2,3 +2,7 @@
- sysdep_routines += ioperm
- sysdep_headers += sys/io.h
- endif
-+
-+ifeq ($(subdir),debug)
-+gen-as-const-headers += signal-defines.sym
-+endif
---- /dev/null
-+++ b/sysdeps/mach/hurd/i386/____longjmp_chk.S
-@@ -0,0 +1,108 @@
-+/* Copyright (C) 2001,2004,2005,2006,2009 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
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <sysdep.h>
-+#include <jmpbuf-offsets.h>
-+#include <asm-syntax.h>
-+
-+#include <signal-defines.h>
-+/* #include <signal.h> */
-+#define SS_ONSTACK 1
-+
-+
-+	.section .rodata.str1.1,"aMS",@progbits,1
-+	.type	longjmp_msg,@object
-+longjmp_msg:
-+	.string "longjmp causes uninitialized stack frame"
-+	.size	longjmp_msg, .-longjmp_msg
-+
-+
-+#ifdef PIC
-+# define CALL_FAIL	movl	%ebx, %ecx; /* TODO: what's this mov good for? */ \
-+			cfi_register(%ebx,%ecx);			      \
-+			LOAD_PIC_REG (bx);				      \
-+			leal	longjmp_msg@GOTOFF(%ebx), %eax;		      \
-+			call	HIDDEN_JUMPTARGET(__fortify_fail)
-+#else
-+# define CALL_FAIL	movl	$longjmp_msg, %eax;			      \
-+			call	HIDDEN_JUMPTARGET(__fortify_fail)
-+#endif
-+
-+
-+	.text
-+ENTRY (____longjmp_chk)
-+	movl	4(%esp), %ecx	/* User's jmp_buf in %ecx.  */
-+
-+	/* Save the return address now.  */
-+	movl	(JB_PC*4)(%ecx), %edx
-+	/* Get the stack pointer.  */
-+	movl	(JB_SP*4)(%ecx), %edi
-+	cfi_undefined(%edi)
-+	PTR_DEMANGLE (%edx)
-+	PTR_DEMANGLE (%edi)
-+
-+	cmpl	%edi, %esp
-+	/* Jumping to a higher-address frame is always allowed.  */
-+	jbe	.Lok
-+
-+	/* Passing here, we're either about to do something invalid, or we're
-+	executing on an alternative signal stack.  */
-+
-+	/* TODO: need locking?  */
-+	/* struct hurd_sigstate * _hurd_self_sigstate (void) */
-+	call	_hurd_self_sigstate
-+	/* TODO: %eax and %eax->sigaltstack are always valid?  */
-+
-+	testl	$SS_ONSTACK, (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_FLAGS__OFFSET)(%eax)
-+	/* Fail if SS_ONSTACK is not set.  */
-+	jz	.Lfail
-+
-+	movl	(HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SP__OFFSET)(%eax), %ebx
-+	addl	(HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SIZE__OFFSET)(%eax), %ebx
-+	subl	%edi, %ebx
-+	cmpl	(HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SIZE__OFFSET)(%eax), %ebx
-+	/* TODO: comment this calculation.  */
-+	jae	.Lok
-+
-+.Lfail:	CALL_FAIL
-+
-+.Lok:	/* We add unwind information for the target here.  */
-+	cfi_def_cfa(%ecx, 0)
-+	cfi_register(%eip, %edx)
-+	cfi_register(%esp, %edi)
-+	cfi_offset(%ebx, JB_BX*4)
-+	cfi_offset(%esi, JB_SI*4)
-+	cfi_offset(%edi, JB_DI*4)
-+	cfi_offset(%ebp, JB_BP*4)
-+
-+	movl	8(%esp), %eax	/* Second argument is return value.  */
-+	movl	%edi, %esp
-+
-+	/* Restore registers.  */
-+	movl	(JB_BX*4)(%ecx), %ebx
-+	movl	(JB_SI*4)(%ecx), %esi
-+	movl	(JB_DI*4)(%ecx), %edi
-+	movl	(JB_BP*4)(%ecx), %ebp
-+	cfi_restore(%ebx)
-+	cfi_restore(%esi)
-+	cfi_restore(%edi)
-+	cfi_restore(%ebp)
-+
-+	/* Jump to saved PC.  */
-+	jmp	*%edx
-+END (____longjmp_chk)
---- /dev/null
-+++ b/sysdeps/mach/hurd/i386/signal-defines.sym
-@@ -0,0 +1,10 @@
-+#include <hurd/signal.h>
-+#include <signal.h>
-+
-+--
-+
-+HURD_SIGSTATE__SIGALTSTACK__OFFSET	offsetof(struct hurd_sigstate, sigaltstack)
-+
-+SIGALTSTACK__SS_SP__OFFSET		offsetof(struct sigaltstack, ss_sp)
-+SIGALTSTACK__SS_SIZE__OFFSET		offsetof(struct sigaltstack, ss_size)
-+SIGALTSTACK__SS_FLAGS__OFFSET		offsetof(struct sigaltstack, ss_flags)

Deleted: glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-ptsname.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-ptsname.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-ptsname.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,21 +0,0 @@
-This is a bit lame (thus not submitted), but should work for now.
-
-t/grantpt
-
----
- sysdeps/mach/hurd/ptsname.c |    8 ++++++++
- 1 file changed, 8 insertions(+)
---- a/sysdeps/mach/hurd/ptsname.c
-+++ b/sysdeps/mach/hurd/ptsname.c
-@@ -63,3 +63,11 @@
-   return 0;
- }
- weak_alias (__ptsname_r, ptsname_r)
-+
-+int
-+__ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
-+{
-+  if (__fxstat64 (_STAT_VER, fd, stp) < 0)
-+    return errno;
-+  return __ptsname_r (fd, buf, buflen);
-+}

Deleted: glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-tls-support.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-tls-support.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-tls-support.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,545 +0,0 @@
-TLS support
-TODO: get rid of threadvar variables
-
-t/tls
-t/tlsdesc.sym
-
----
- csu/libc-start.c                        |    2 +
- hurd/hurdfault.c                        |    2 +
- hurd/hurdsig.c                          |    4 +-
- mach/mach.h                             |    3 +
- mach/setup-thread.c                     |   30 +++++++++++++++-
- ports/sysdeps/mach/alpha/thread_state.h |    1 
- sysdeps/generic/thread_state.h          |    1 
- sysdeps/mach/hurd/bits/libc-lock.h      |    3 +
- sysdeps/mach/hurd/bits/libc-tsd.h       |   35 ------------------
- sysdeps/mach/hurd/fork.c                |    7 +++
- sysdeps/mach/hurd/i386/init-first.c     |   60 +++++++++++++++++++-------------
- sysdeps/mach/hurd/i386/tls.h            |   55 ++++++++++++++++++++++++-----
- sysdeps/mach/hurd/i386/tlsdesc.sym      |   17 +++++++++
- sysdeps/mach/hurd/i386/trampoline.c     |    2 -
- sysdeps/mach/hurd/profil.c              |    2 +
- sysdeps/mach/hurd/setitimer.c           |    3 +
- sysdeps/mach/hurd/tls.h                 |    2 +
- sysdeps/mach/i386/thread_state.h        |   11 +++++
- sysdeps/mach/powerpc/thread_state.h     |    1 
- sysdeps/mach/thread_state.h             |    3 +
- 20 files changed, 169 insertions(+), 75 deletions(-)
-
---- a/csu/libc-start.c
-+++ b/csu/libc-start.c
-@@ -140,10 +140,12 @@
-   /* Performe IREL{,A} relocations.  */
-   __libc_csu_irel ();
- 
-+#ifndef __GNU__
-   /* Initialize the thread library at least a bit since the libgcc
-      functions are using thread functions if these are available and
-      we need to setup errno.  */
-   __pthread_initialize_minimal ();
-+#endif
- 
-   /* Set up the stack checker's canary.  */
-   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
---- a/hurd/hurdfault.c
-+++ b/hurd/hurdfault.c
-@@ -206,6 +206,8 @@
-   /* This state will be restored when we fault.
-      It runs the function above.  */
-   memset (&state, 0, sizeof state);
-+
-+  MACHINE_THREAD_STATE_FIX_NEW (&state);
-   MACHINE_THREAD_STATE_SET_PC (&state, faulted);
-   MACHINE_THREAD_STATE_SET_SP (&state, faultstack, sizeof faultstack);
- 
---- a/hurd/hurdsig.c
-+++ b/hurd/hurdsig.c
-@@ -1268,6 +1268,8 @@
- 				 (vm_address_t *) &__hurd_sigthread_stack_base,
- 				 &stacksize);
-       assert_perror (err);
-+      err = __mach_setup_tls (_hurd_msgport_thread);
-+      assert_perror (err);
- 
-       __hurd_sigthread_stack_end = __hurd_sigthread_stack_base + stacksize;
-       __hurd_sigthread_variables =
-@@ -1276,8 +1278,6 @@
- 	__libc_fatal ("hurd: Can't allocate threadvars for signal thread\n");
-       memset (__hurd_sigthread_variables, 0,
- 	      __hurd_threadvar_max * sizeof (unsigned long int));
--      __hurd_sigthread_variables[_HURD_THREADVAR_LOCALE]
--	= (unsigned long int) &_nl_global_locale;
- 
-       /* Reinitialize the MiG support routines so they will use a per-thread
- 	 variable for the cached reply port.  */
---- a/mach/mach.h
-+++ b/mach/mach.h
-@@ -101,5 +101,8 @@
- 				 vm_address_t *stack_base,
- 				 vm_size_t *stack_size);
- 
-+/* Give THREAD a TLS area.  */
-+kern_return_t __mach_setup_tls (thread_t thread);
-+kern_return_t mach_setup_tls (thread_t thread);
- 
- #endif	/* mach.h */
---- a/mach/setup-thread.c
-+++ b/mach/setup-thread.c
-@@ -20,6 +20,7 @@
- #include <thread_state.h>
- #include <string.h>
- #include <mach/machine/vm_param.h>
-+#include <ldsodefs.h>
- #include "sysdep.h"		/* Defines stack direction.  */
- 
- #define	STACK_SIZE	(16 * 1024 * 1024) /* 16MB, arbitrary.  */
-@@ -73,8 +74,35 @@
-   if (error = __vm_protect (task, stack, __vm_page_size, 0, VM_PROT_NONE))
-     return error;
- 
--  return __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
-+  return __thread_set_state (thread, MACHINE_NEW_THREAD_STATE_FLAVOR,
- 			     (natural_t *) &ts, tssize);
- }
- 
- weak_alias (__mach_setup_thread, mach_setup_thread)
-+
-+/* Give THREAD a TLS area.  */
-+kern_return_t
-+__mach_setup_tls (thread_t thread)
-+{
-+  kern_return_t error;
-+  struct machine_thread_state ts;
-+  mach_msg_type_number_t tssize = MACHINE_THREAD_STATE_COUNT;
-+  tcbhead_t *tcb;
-+
-+  if (error = __thread_get_state (thread, MACHINE_THREAD_STATE_FLAVOR,
-+			     (natural_t *) &ts, &tssize))
-+    return error;
-+  assert (tssize == MACHINE_THREAD_STATE_COUNT);
-+
-+  tcb = _dl_allocate_tls(NULL);
-+  if (!tcb)
-+    return KERN_RESOURCE_SHORTAGE;
-+
-+  _hurd_tls_new(thread, &ts, tcb);
-+
-+  error = __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
-+			     (natural_t *) &ts, tssize);
-+  return error;
-+}
-+
-+weak_alias (__mach_setup_tls, mach_setup_tls)
---- a/sysdeps/generic/thread_state.h
-+++ b/sysdeps/generic/thread_state.h
-@@ -23,6 +23,7 @@
- 
- /* Replace <machine> with "i386" or "mips" or whatever.  */
- 
-+#define MACHINE_NEW_THREAD_STATE_FLAVOR	<machine>_NEW_THREAD_STATE
- #define MACHINE_THREAD_STATE_FLAVOR	<machine>_THREAD_STATE
- #define MACHINE_THREAD_STATE_COUNT	<machine>_THREAD_STATE_COUNT
- 
---- a/ports/sysdeps/mach/alpha/thread_state.h
-+++ b/ports/sysdeps/mach/alpha/thread_state.h
-@@ -19,6 +19,7 @@
- 
- #include <mach/machine/thread_status.h>
- 
-+#define MACHINE_NEW_THREAD_STATE_FLAVOR	ALPHA_THREAD_STATE
- #define MACHINE_THREAD_STATE_FLAVOR	ALPHA_THREAD_STATE
- #define MACHINE_THREAD_STATE_COUNT	ALPHA_THREAD_STATE_COUNT
- 
---- a/sysdeps/mach/hurd/bits/libc-tsd.h
-+++ /dev/null
-@@ -1,35 +0,0 @@
--/* libc-internal interface for thread-specific data.  Hurd version.
--   Copyright (C) 1998,2002,2008 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
--   modify it under the terms of the GNU Lesser General Public
--   License as published by the Free Software Foundation; either
--   version 2.1 of the License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; if not, write to the Free
--   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
--   02111-1307 USA.  */
--
--#ifndef _BITS_LIBC_TSD_H
--#define _BITS_LIBC_TSD_H 1
--
--#include <hurd/threadvar.h>
--
--#define __libc_tsd_define(CLASS, TYPE, KEY) /* nothing, always have threadvars */
--
--#define __libc_tsd_address(TYPE, KEY) \
--  ((TYPE *) __hurd_threadvar_location (_HURD_THREADVAR_##KEY))
--
--#define __libc_tsd_get(TYPE, KEY) \
--  (*__libc_tsd_address (TYPE, KEY))
--#define __libc_tsd_set(TYPE, KEY, VALUE) \
--  (*__libc_tsd_address (TYPE, KEY) = (VALUE))
--
--#endif	/* bits/libc-tsd.h */
---- a/sysdeps/mach/hurd/fork.c
-+++ b/sysdeps/mach/hurd/fork.c
-@@ -523,6 +523,11 @@
- #endif
-       MACHINE_THREAD_STATE_SET_PC (&state,
- 				   (unsigned long int) _hurd_msgport_receive);
-+
-+      /* Do special thread setup for TLS if needed.  */
-+      if (err = _hurd_tls_fork (sigthread, _hurd_msgport_thread, &state))
-+	LOSE;
-+
-       if (err = __thread_set_state (sigthread, MACHINE_THREAD_STATE_FLAVOR,
- 				    (natural_t *) &state, statecount))
- 	LOSE;
-@@ -533,7 +538,7 @@
-       _hurd_longjmp_thread_state (&state, env, 1);
- 
-       /* Do special thread setup for TLS if needed.  */
--      if (err = _hurd_tls_fork (thread, &state))
-+      if (err = _hurd_tls_fork (thread, ss->thread, &state))
- 	LOSE;
- 
-       if (err = __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
---- a/sysdeps/mach/hurd/i386/init-first.c
-+++ b/sysdeps/mach/hurd/i386/init-first.c
-@@ -104,10 +104,6 @@
-   char **argv = &arg0;
-   char **envp = &argv[argc + 1];
-   struct hurd_startup_data *d;
--#ifndef SHARED
--  extern ElfW(Phdr) *_dl_phdr;
--  extern size_t _dl_phnum;
--#endif
- 
-   while (*envp)
-     ++envp;
-@@ -118,27 +114,9 @@
-      data block; the argument strings start there.  */
-   if ((void *) d == argv[0])
-     {
--#ifndef SHARED
--      /* We may need to see our own phdrs, e.g. for TLS setup.
--         Try the usual kludge to find the headers without help from
--	 the exec server.  */
--      extern const void _start;
--      const ElfW(Ehdr) *const ehdr = &_start;
--      _dl_phdr = (ElfW(Phdr) *) ((const void *) ehdr + ehdr->e_phoff);
--      _dl_phnum = ehdr->e_phnum;
--      assert (ehdr->e_phentsize == sizeof (ElfW(Phdr)));
--#endif
-       return;
-     }
- 
--#ifndef SHARED
--  __libc_enable_secure = d->flags & EXEC_SECURE;
--
--  _dl_phdr = (ElfW(Phdr) *) d->phdr;
--  _dl_phnum = d->phdrsz / sizeof (ElfW(Phdr));
--  assert (d->phdrsz % sizeof (ElfW(Phdr)) == 0);
--#endif
--
-   _hurd_init_dtable = d->dtable;
-   _hurd_init_dtablesize = d->dtablesize;
- 
-@@ -172,13 +150,16 @@
-   char **envp = &argv[argc + 1];
-   struct hurd_startup_data *d;
-   unsigned long int threadvars[_HURD_THREADVAR_MAX];
-+#ifndef SHARED
-+  extern ElfW(Phdr) *_dl_phdr;
-+  extern size_t _dl_phnum;
-+#endif
- 
-   /* Provide temporary storage for thread-specific variables on the
-      startup stack so the cthreads initialization code can use them
-      for malloc et al, or so we can use malloc below for the real
-      threadvars array.  */
-   memset (threadvars, 0, sizeof threadvars);
--  threadvars[_HURD_THREADVAR_LOCALE] = (unsigned long int) &_nl_global_locale;
-   __hurd_threadvar_stack_offset = (unsigned long int) threadvars;
- 
-   /* Since the cthreads initialization code uses malloc, and the
-@@ -192,6 +173,39 @@
-     ++envp;
-   d = (void *) ++envp;
- 
-+  /* If we are the bootstrap task started by the kernel,
-+     then after the environment pointers there is no Hurd
-+     data block; the argument strings start there.  */
-+  if ((void *) d == argv[0])
-+    {
-+#ifndef SHARED
-+      /* We may need to see our own phdrs, e.g. for TLS setup.
-+         Try the usual kludge to find the headers without help from
-+	 the exec server.  */
-+      extern const void __executable_start;
-+      const ElfW(Ehdr) *const ehdr = &__executable_start;
-+      _dl_phdr = (ElfW(Phdr) *) ((const void *) ehdr + ehdr->e_phoff);
-+      _dl_phnum = ehdr->e_phnum;
-+      assert (ehdr->e_phentsize == sizeof (ElfW(Phdr)));
-+#endif
-+    }
-+  else
-+    {
-+#ifndef SHARED
-+      __libc_enable_secure = d->flags & EXEC_SECURE;
-+
-+      _dl_phdr = (ElfW(Phdr) *) d->phdr;
-+      _dl_phnum = d->phdrsz / sizeof (ElfW(Phdr));
-+      assert (d->phdrsz % sizeof (ElfW(Phdr)) == 0);
-+#endif
-+    }
-+
-+#ifndef SHARED
-+  /* We need to setup TLS before starting sigthread */
-+  extern void __pthread_initialize_minimal(void);
-+  __pthread_initialize_minimal();
-+#endif
-+
-   /* The user might have defined a value for this, to get more variables.
-      Otherwise it will be zero on startup.  We must make sure it is set
-      properly before before cthreads initialization, so cthreads can know
---- a/sysdeps/mach/hurd/i386/tls.h
-+++ b/sysdeps/mach/hurd/i386/tls.h
-@@ -31,6 +31,8 @@
- 
- # ifndef __ASSEMBLER__
- 
-+#include <pthread/pthread.h>
-+
- /* Use i386-specific RPCs to arrange that %gs segment register prefix
-    addresses the TCB in each thread.  */
- # include <mach/i386/mach_i386.h>
-@@ -72,7 +74,7 @@
- 
-       /* Get the first available selector.  */
-       int sel = -1;
--      error_t err = __i386_set_gdt (tcb->self, &sel, desc);
-+      kern_return_t err = __i386_set_gdt (tcb->self, &sel, desc);
-       if (err == MIG_BAD_ID)
- 	{
- 	  /* Old kernel, use a per-thread LDT.  */
-@@ -96,16 +98,16 @@
-       /* Fetch the selector set by the first call.  */
-       int sel;
-       asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0));
--      if (__builtin_expect (sel, 0x50) & 4) /* LDT selector */
-+      if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
- 	{
--	  error_t err = __i386_set_ldt (tcb->self, sel, &desc, 1);
-+	  kern_return_t err = __i386_set_ldt (tcb->self, sel, &desc, 1);
- 	  assert_perror (err);
- 	  if (err)
- 	    return "i386_set_ldt failed";
- 	}
-       else
- 	{
--	  error_t err = __i386_set_gdt (tcb->self, &sel, desc);
-+	  kern_return_t err = __i386_set_gdt (tcb->self, &sel, desc);
- 	  assert_perror (err);
- 	  if (err)
- 	    return "i386_set_gdt failed";
-@@ -142,9 +144,40 @@
- 
- #include <mach/machine/thread_status.h>
- 
--/* Set up TLS in the new thread of a fork child, copying from our own.  */
--static inline error_t __attribute__ ((unused))
--_hurd_tls_fork (thread_t child, struct i386_thread_state *state)
-+/* Set up TLS in the new thread of a fork child, copying from the original.  */
-+static inline kern_return_t __attribute__ ((unused))
-+_hurd_tls_fork (thread_t child, thread_t orig, struct i386_thread_state *state)
-+{
-+  /* Fetch the selector set by _hurd_tls_init.  */
-+  int sel;
-+  asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0));
-+  if (sel == state->ds)		/* _hurd_tls_init was never called.  */
-+    return 0;
-+
-+  struct descriptor desc, *_desc = &desc;
-+  int err;
-+  unsigned int count;
-+
-+  if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
-+    err = __i386_get_ldt (orig, sel, 1, &_desc, &count);
-+  else
-+    err = __i386_get_gdt (orig, sel, &desc);
-+
-+  assert_perror (err);
-+  if (err)
-+    return err;
-+
-+  if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
-+    err = __i386_set_ldt (child, sel, &desc, 1);
-+  else
-+    err = __i386_set_gdt (child, &sel, desc);
-+
-+  state->gs = sel;
-+  return err;
-+}
-+
-+static inline kern_return_t __attribute__ ((unused))
-+_hurd_tls_new (thread_t child, struct i386_thread_state *state, tcbhead_t *tcb)
- {
-   /* Fetch the selector set by _hurd_tls_init.  */
-   int sel;
-@@ -152,11 +185,13 @@
-   if (sel == state->ds)		/* _hurd_tls_init was never called.  */
-     return 0;
- 
--  tcbhead_t *const tcb = THREAD_SELF;
-   HURD_TLS_DESC_DECL (desc, tcb);
--  error_t err;
-+  kern_return_t err;
-+
-+  tcb->tcb = tcb;
-+  tcb->self = child;
- 
--  if (__builtin_expect (sel, 0x50) & 4) /* LDT selector */
-+  if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
-     err = __i386_set_ldt (child, sel, &desc, 1);
-   else
-     err = __i386_set_gdt (child, &sel, desc);
---- a/sysdeps/mach/hurd/i386/trampoline.c
-+++ b/sysdeps/mach/hurd/i386/trampoline.c
-@@ -65,7 +65,7 @@
- 		  sizeof (state->basic));
- 	  memcpy (&state->fpu, &ss->context->sc_i386_float_state,
- 		  sizeof (state->fpu));
--	  state->set |= (1 << i386_THREAD_STATE) | (1 << i386_FLOAT_STATE);
-+	  state->set |= (1 << i386_REGS_SEGS_STATE) | (1 << i386_FLOAT_STATE);
- 	}
-     }
- 
---- a/sysdeps/mach/hurd/profil.c
-+++ b/sysdeps/mach/hurd/profil.c
-@@ -69,6 +69,8 @@
-       if (! err)
- 	err = __mach_setup_thread (__mach_task_self (), profile_thread,
- 				   &profile_waiter, NULL, NULL);
-+      if (! err)
-+	err = __mach_setup_tls(profile_thread);
-     }
-   else
-     err = 0;
---- a/sysdeps/mach/hurd/setitimer.c
-+++ b/sysdeps/mach/hurd/setitimer.c
-@@ -223,11 +223,12 @@
- 	    return __hurd_fail (err);
- 	  _hurd_itimer_thread_stack_base = 0; /* Anywhere.  */
- 	  _hurd_itimer_thread_stack_size = __vm_page_size; /* Small stack.  */
--	  if (err = __mach_setup_thread (__mach_task_self (),
-+	  if ((err = __mach_setup_thread (__mach_task_self (),
- 					 _hurd_itimer_thread,
- 					 &timer_thread,
- 					 &_hurd_itimer_thread_stack_base,
- 					 &_hurd_itimer_thread_stack_size))
-+	      || (err = __mach_setup_tls(_hurd_itimer_thread)))
- 	    {
- 	      __thread_terminate (_hurd_itimer_thread);
- 	      _hurd_itimer_thread = MACH_PORT_NULL;
---- a/sysdeps/mach/i386/thread_state.h
-+++ b/sysdeps/mach/i386/thread_state.h
-@@ -19,7 +19,8 @@
- 
- #include <mach/machine/thread_status.h>
- 
--#define MACHINE_THREAD_STATE_FLAVOR	i386_THREAD_STATE
-+#define MACHINE_NEW_THREAD_STATE_FLAVOR	i386_THREAD_STATE
-+#define MACHINE_THREAD_STATE_FLAVOR	i386_REGS_SEGS_STATE
- #define MACHINE_THREAD_STATE_COUNT	i386_THREAD_STATE_COUNT
- 
- #define machine_thread_state i386_thread_state
-@@ -28,6 +29,14 @@
- #define SP uesp
- #define SYSRETURN eax
- 
-+#define MACHINE_THREAD_STATE_FIX_NEW(ts) do { \
-+	asm ("mov %%cs, %w0" : "=q" ((ts)->cs)); \
-+	asm ("mov %%ds, %w0" : "=q" ((ts)->ds)); \
-+	asm ("mov %%es, %w0" : "=q" ((ts)->es)); \
-+	asm ("mov %%fs, %w0" : "=q" ((ts)->fs)); \
-+	asm ("mov %%gs, %w0" : "=q" ((ts)->gs)); \
-+} while(0)
-+
- struct machine_thread_all_state
-   {
-     int set;			/* Mask of bits (1 << FLAVOR).  */
---- a/sysdeps/mach/powerpc/thread_state.h
-+++ b/sysdeps/mach/powerpc/thread_state.h
-@@ -19,6 +19,7 @@
- 
- #include <mach/machine/thread_status.h>
- 
-+#define MACHINE_NEW_THREAD_STATE_FLAVOR	PPC_THREAD_STATE
- #define MACHINE_THREAD_STATE_FLAVOR	PPC_THREAD_STATE
- #define MACHINE_THREAD_STATE_COUNT	PPC_THREAD_STATE_COUNT
- 
---- a/sysdeps/mach/thread_state.h
-+++ b/sysdeps/mach/thread_state.h
-@@ -38,6 +38,9 @@
-   ((ts)->SP = (unsigned long int) (stack) + (size))
- #endif
- #endif
-+#ifndef MACHINE_THREAD_STATE_FIX_NEW
-+#define MACHINE_THREAD_STATE_FIX_NEW(ts)
-+#endif
- 
- /* These functions are of use in machine-dependent signal trampoline
-    implementations.  */
---- a/sysdeps/mach/hurd/bits/libc-lock.h
-+++ b/sysdeps/mach/hurd/bits/libc-lock.h
-@@ -21,6 +21,9 @@
- #define _BITS_LIBC_LOCK_H 1
- 
- #if (_LIBC - 0) || (_CTHREADS_ - 0)
-+#if (_LIBC - 0)
-+#include <tls.h>
-+#endif
- #include <cthreads.h>
- #include <hurd/threadvar.h>
- 
---- a/sysdeps/mach/hurd/tls.h
-+++ b/sysdeps/mach/hurd/tls.h
-@@ -23,7 +23,9 @@
- #if defined HAVE_TLS_SUPPORT && !defined __ASSEMBLER__
- 
- # include <stddef.h>
-+# include <stdint.h>
- # include <stdbool.h>
-+# include <sysdep.h>
- # include <mach/mig_errors.h>
- # include <mach.h>
- 
---- /dev/null
-+++ b/sysdeps/mach/hurd/i386/tlsdesc.sym
-@@ -0,0 +1,17 @@
-+#include <stddef.h>
-+#include <sysdep.h>
-+#include <tls.h>
-+#include <link.h>
-+#include <dl-tlsdesc.h>
-+
-+--
-+
-+-- Abuse tls.h macros to derive offsets relative to the thread register.
-+
-+DTV_OFFSET			offsetof(tcbhead_t, dtv)
-+
-+TLSDESC_ARG			offsetof(struct tlsdesc, arg)
-+
-+TLSDESC_GEN_COUNT		offsetof(struct tlsdesc_dynamic_arg, gen_count)
-+TLSDESC_MODID			offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module)
-+TLSDESC_MODOFF			offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset)

Modified: glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-tls.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-tls.diff	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/hurd-i386/unsubmitted-tls.diff	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,6 +1,6 @@
 For now errno is still a threadvar variable.
 
-t/tls-threadvar
+t/tls-threadvar (when migrating to newer upstream glibc)
 
 ---
  include/errno.h |    2 +-

Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/series	2011-10-28 23:42:45 UTC (rev 5011)
@@ -100,26 +100,27 @@
 hurd-i386/local-enable-ldconfig.diff
 hurd-i386/unsubmitted-mlock.diff
 hurd-i386/unsubmitted-tls.diff
-hurd-i386/unsubmitted-tls-support.diff
+hurd-i386/tg-tls.diff
+hurd-i386/tg-tlsdesc.sym.diff
 hurd-i386/unsubmitted-gcc-4.1-init-first.diff
 hurd-i386/submitted-posix_opt.h.diff
 hurd-i386/submitted-ioctl-decode-argument.diff
 hurd-i386/submitted-libc_once.diff
-hurd-i386/submitted-ptr-mangle.diff
-hurd-i386/submitted-stat.diff
-hurd-i386/submitted-strtoul.diff
+hurd-i386/tg-ptrmangle.diff
+hurd-i386/tg-struct_stat.diff
+hurd-i386/tg-strtoul_PLT.diff
 hurd-i386/submitted-sysvshm.diff
 hurd-i386/submitted-ioctl-unsigned-size_t.diff
-hurd-i386/submitted-ECANCELED.diff
+hurd-i386/tg-regenerate_errno.h.diff
 hurd-i386/submitted-IPV6_PKTINFO.diff
-hurd-i386/submitted-extern_inline.diff
+hurd-i386/tg-extern_inline.diff
 hurd-i386/submitted-critical-sections.diff
 hurd-i386/submitted-dup2-fix.diff
-hurd-i386/unsubmitted-check_native.diff
-hurd-i386/submitted-dl-sysdep.diff
+hurd-i386/tg-check_native.diff
+hurd-i386/tg-dl-sysdep.c_SHARED.diff
 hurd-i386/submitted-itimer-lock.diff
 hurd-i386/unsubmitted-pthread_types.diff
-hurd-i386/unsubmitted-_dl_random.diff
+hurd-i386/tg-_dl_random.diff
 hurd-i386/unsubmitted-unwind-resume.diff
 hurd-i386/submitted-null-pathname.diff
 hurd-i386/submitted-sbrk.diff
@@ -128,17 +129,17 @@
 hurd-i386/submitted-SOL_IP.patch
 hurd-i386/unsubmitted-bigmem.diff
 hurd-i386/local-disable-ioctls.diff
-hurd-i386/unsubmitted-longjmp_chk.diff
+hurd-i386/tg-____longjmp_chk.diff
 hurd-i386/unsubmitted-locarchive.diff
 hurd-i386/submitted-regex_internal.diff
 hurd-i386/unsubmitted-mkdir_root.diff
-hurd-i386/unsubmitted-i686.diff
+hurd-i386/tg-__i686_defined.diff
 hurd-i386/unsubmitted-no-hp-timing.diff
 hurd-i386/submitted-catch-signal.diff
 hurd-i386/unsubmitted-sendmsg-SCM_RIGHTS.diff
 hurd-i386/cvs-header-prot.diff
 hurd-i386/cvs-psiginfo.diff
-hurd-i386/unsubmitted-ptsname.diff
+hurd-i386/tg-grantpt.diff
 hurd-i386/cvs-if_freereq.diff
 hurd-i386/submitted-add-needed.diff
 hurd-i386/local-ED.diff

Modified: glibc-package/trunk/debian/patches/series.hurd-i386
===================================================================
--- glibc-package/trunk/debian/patches/series.hurd-i386	2011-10-27 00:45:46 UTC (rev 5010)
+++ glibc-package/trunk/debian/patches/series.hurd-i386	2011-10-28 23:42:45 UTC (rev 5011)
@@ -1,6 +1,6 @@
 hurd-i386/submitted-net.diff
-hurd-i386/unsubmitted-gscope.diff
-hurd-i386/unsubmitted-atomic-no-multiple_threads.diff
+hurd-i386/tg-gscope.diff
+hurd-i386/tg-bits_atomic.h_multiple_threads.diff
 hurd-i386/local-pthread_stubs.diff
 hurd-i386/unsubmitted-pthread-unsupported-stubs.diff
 hurd-i386/unsubmitted-unlockpt-chroot.diff


Reply to: