r5737 - in glibc-package/trunk/debian: . patches patches/hurd-i386
Author: sthibault
Date: 2013-10-24 22:07:17 +0000 (Thu, 24 Oct 2013)
New Revision: 5737
Added:
glibc-package/trunk/debian/patches/hurd-i386/cvs-tls-threadvar-threadself.diff
Modified:
glibc-package/trunk/debian/changelog
glibc-package/trunk/debian/patches/series
Log:
* patches/hurd-i386/cvs-tls-threadvar-threadself.diff: New patch, store
pthread_self in TLS instead of threadvar.
Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog 2013-10-24 21:59:56 UTC (rev 5736)
+++ glibc-package/trunk/debian/changelog 2013-10-24 22:07:17 UTC (rev 5737)
@@ -14,6 +14,8 @@
previous patch.
* patches/hurd-i386/tg-extern_inline.diff: Do not expose some internals of
libc outside libc.
+ * patches/hurd-i386/cvs-tls-threadvar-threadself.diff: New patch, store
+ pthread_self in TLS instead of threadvar.
-- Adam Conrad <adconrad@0c3.net> Sun, 22 Sep 2013 23:39:33 -0600
Added: glibc-package/trunk/debian/patches/hurd-i386/cvs-tls-threadvar-threadself.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/cvs-tls-threadvar-threadself.diff (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/cvs-tls-threadvar-threadself.diff 2013-10-24 22:07:17 UTC (rev 5737)
@@ -0,0 +1,216 @@
+commit 25260994c812050a5d7addf125cdc90c911ca5c1
+Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date: Fri Apr 27 01:32:54 2012 +0000
+
+ Store self in __thread variable instead of threadvar
+
+ * sysdeps/mach/hurd/pt-sysdep.h (_HURD_THREADVAR_THREAD): Remove macro.
+ (___pthread_self): Declare new __thread variable.
+ (_pthread_self): Take self pointer from ___pthread_self instead of
+ threadvar.
+ * sysdeps/mach/hurd/pt-sysdep.c (___pthread_self): Define new __thread
+ variable.
+ (init_routine): Set ___pthread_self to initial thread structure.
+ * pthread/pt-internal.h (__pthread_setup): Add `self' parameter to
+ `entry_point' parameter.
+ * pthread/pt-create.c (entry_point): Add `self' parameter. Store it in
+ ___pthread_self.
+ * sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Add `self parameter to
+ `entry_point' parameter. Pass it the `thread' parameter.
+ (__pthread_setup): Likewise.
+ * sysdeps/l4/hurd/powerpc/pt-setup.c (struct start_info): Add `self' field.
+ (first_entry_1): Pass `self' parameter.
+ (stack_setup): Add `self' parameter to `entry_point' parameter, pass it the
+ `thread' parameter.
+ (__pthread_setup): Likewise.
+ * sysdeps/mach/hurd/ia32/pt-setup.c (stack_setup): Pass `thread' parameter
+ to the start routine.
+ (stack_setup): Add `self' parameter to `entry_point' paramter.
+
+Index: eglibc-2.17/libpthread/pthread/pt-create.c
+===================================================================
+--- eglibc-2.17.orig/libpthread/pthread/pt-create.c 2013-10-20 22:55:39.000000000 +0000
++++ eglibc-2.17/libpthread/pthread/pt-create.c 2013-10-20 22:55:39.000000000 +0000
+@@ -41,8 +41,12 @@
+
+ /* The entry-point for new threads. */
+ static void
+-entry_point (void *(*start_routine)(void *), void *arg)
++entry_point (struct __pthread *self, void *(*start_routine)(void *), void *arg)
+ {
++#ifdef ENABLE_TLS
++ ___pthread_self = self;
++#endif
++
+ #ifdef IS_IN_libpthread
+ /* Initialize pointers to locale data. */
+ __ctype_init ();
+Index: eglibc-2.17/libpthread/pthread/pt-internal.h
+===================================================================
+--- eglibc-2.17.orig/libpthread/pthread/pt-internal.h 2013-10-20 22:55:39.000000000 +0000
++++ eglibc-2.17/libpthread/pthread/pt-internal.h 2013-10-20 22:55:39.000000000 +0000
+@@ -225,7 +225,8 @@
+
+ /* Setup thread THREAD's context. */
+ extern int __pthread_setup (struct __pthread *__restrict thread,
+- void (*entry_point)(void *(*)(void *),
++ void (*entry_point)(struct __pthread *,
++ void *(*)(void *),
+ void *),
+ void *(*start_routine)(void *),
+ void *__restrict arg);
+Index: eglibc-2.17/libpthread/sysdeps/l4/hurd/ia32/pt-setup.c
+===================================================================
+--- eglibc-2.17.orig/libpthread/sysdeps/l4/hurd/ia32/pt-setup.c 2013-10-20 22:55:39.000000000 +0000
++++ eglibc-2.17/libpthread/sysdeps/l4/hurd/ia32/pt-setup.c 2013-10-20 22:55:39.000000000 +0000
+@@ -65,7 +65,7 @@
+ static void *
+ stack_setup (struct __pthread *thread,
+ void *(*start_routine)(void *), void *arg,
+- void (*entry_point)(void *(*)(void *), void *))
++ void (*entry_point)(struct __pthread *, void *(*)(void *), void *))
+ {
+ uintptr_t *top;
+
+@@ -80,6 +80,7 @@
+ /* Set up call frame. */
+ *--top = (uintptr_t) arg; /* Argument to START_ROUTINE. */
+ *--top = (uintptr_t) start_routine;
++ *--top = (uintptr_t) thread;
+ *--top = 0; /* Fake return address. */
+ *--top = (uintptr_t) entry_point;
+ }
+@@ -89,7 +90,7 @@
+
+ int
+ __pthread_setup (struct __pthread *thread,
+- void (*entry_point)(void *(*)(void *), void *),
++ void (*entry_point)(struct __pthread *, void *(*)(void *), void *),
+ void *(*start_routine)(void *), void *arg)
+ {
+ thread->mcontext.pc = (void *) &_pthread_entry_point;
+Index: eglibc-2.17/libpthread/sysdeps/l4/hurd/powerpc/pt-setup.c
+===================================================================
+--- eglibc-2.17.orig/libpthread/sysdeps/l4/hurd/powerpc/pt-setup.c 2013-10-20 22:55:39.000000000 +0000
++++ eglibc-2.17/libpthread/sysdeps/l4/hurd/powerpc/pt-setup.c 2013-10-20 22:55:39.000000000 +0000
+@@ -28,6 +28,7 @@
+ struct start_info
+ {
+ void (*entry_point) (void *(*)(void *), void *);
++ struct __pthread *self;
+ void *(*start_routine) (void *);
+ void *arg;
+ };
+@@ -41,6 +42,7 @@
+ lwz 0, 0(1) ;\
+ lwz 3, 4(1) ;\
+ lwz 4, 8(1) ;\
++ lwz 5, 12(1) ;\
+ mtctr 0 ;\
+ bctrl ;\
+ ");
+@@ -51,7 +53,7 @@
+ opportunity to install THREAD in our utcb. */
+ static void *
+ stack_setup (struct __pthread *thread,
+- void (*entry_point)(void *(*)(void *), void *),
++ void (*entry_point)(struct __pthread *, void *(*)(void *), void *),
+ void *(*start_routine)(void *), void *arg)
+ {
+ l4_word_t *top;
+@@ -68,6 +70,7 @@
+ struct start_info *info = ((struct start_info *) top) - 1;
+
+ info->entry_point = entry_point;
++ info->self = thread;
+ info->start_routine = start_routine;
+ info->arg = arg;
+ return (void *) info;
+@@ -77,7 +80,7 @@
+
+ int
+ __pthread_setup (struct __pthread *thread,
+- void (*entry_point)(void *(*)(void *), void *),
++ void (*entry_point)(struct __pthread *, void *(*)(void *), void *),
+ void *(*start_routine)(void *), void *arg)
+ {
+ thread->mcontext.pc = first_entry_1;
+Index: eglibc-2.17/libpthread/sysdeps/mach/hurd/ia32/pt-setup.c
+===================================================================
+--- eglibc-2.17.orig/libpthread/sysdeps/mach/hurd/ia32/pt-setup.c 2013-10-20 22:55:39.000000000 +0000
++++ eglibc-2.17/libpthread/sysdeps/mach/hurd/ia32/pt-setup.c 2013-10-20 22:55:39.000000000 +0000
+@@ -57,16 +57,14 @@
+ /* Next, make room for the TSDs. */
+ top -= __hurd_threadvar_max;
+
+- /* Save the self pointer. */
+- top[_HURD_THREADVAR_THREAD] = (uintptr_t) thread;
+-
+ if (start_routine)
+ {
+ /* And then the call frame. */
+- top -= 2;
++ top -= 3;
+ top = (uintptr_t *) ((uintptr_t) top & ~0xf);
+- top[1] = (uintptr_t) arg; /* Argument to START_ROUTINE. */
+- top[0] = (uintptr_t) start_routine;
++ top[2] = (uintptr_t) arg; /* Argument to START_ROUTINE. */
++ top[1] = (uintptr_t) start_routine;
++ top[0] = (uintptr_t) thread;
+ *--top = 0; /* Fake return address. */
+ }
+
+@@ -82,7 +80,7 @@
+
+ int
+ __pthread_setup (struct __pthread *thread,
+- void (*entry_point)(void *(*)(void *), void *),
++ void (*entry_point)(struct __pthread *, void *(*)(void *), void *),
+ void *(*start_routine)(void *), void *arg)
+ {
+ error_t err;
+Index: eglibc-2.17/libpthread/sysdeps/mach/hurd/pt-sysdep.c
+===================================================================
+--- eglibc-2.17.orig/libpthread/sysdeps/mach/hurd/pt-sysdep.c 2013-10-20 22:55:39.000000000 +0000
++++ eglibc-2.17/libpthread/sysdeps/mach/hurd/pt-sysdep.c 2013-10-20 22:55:39.000000000 +0000
+@@ -38,6 +38,8 @@
+ extern size_t __pthread_stack_default_size;
+ weak_extern(__pthread_stack_default_size);
+
++__thread struct __pthread *___pthread_self;
++
+ /* Forward. */
+ static void *init_routine (void);
+
+@@ -65,8 +67,7 @@
+ err = __pthread_create_internal (&thread, 0, 0, 0);
+ assert_perror (err);
+
+- ((void **) (__hurd_threadvar_stack_offset))[_HURD_THREADVAR_THREAD]
+- = thread;
++ ___pthread_self = thread;
+
+ /* Decrease the number of threads, to take into account that the
+ signal thread (which will be created by the glibc startup code
+Index: eglibc-2.17/libpthread/sysdeps/mach/hurd/pt-sysdep.h
+===================================================================
+--- eglibc-2.17.orig/libpthread/sysdeps/mach/hurd/pt-sysdep.h 2013-10-20 22:55:39.000000000 +0000
++++ eglibc-2.17/libpthread/sysdeps/mach/hurd/pt-sysdep.h 2013-10-20 22:55:39.000000000 +0000
+@@ -35,15 +35,13 @@
+ mach_msg_header_t wakeupmsg; \
+ int have_kernel_resources;
+
+-#define _HURD_THREADVAR_THREAD _HURD_THREADVAR_DYNAMIC_USER
+-
++extern __thread struct __pthread *___pthread_self;
+ #define _pthread_self() \
+ ({ \
+ struct __pthread *thread; \
+ \
+ assert (__pthread_threads); \
+- thread = *(struct __pthread **) \
+- __hurd_threadvar_location (_HURD_THREADVAR_THREAD); \
++ thread = ___pthread_self; \
+ \
+ assert (thread); \
+ assert (({ mach_port_t ktid = __mach_thread_self (); \
Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series 2013-10-24 21:59:56 UTC (rev 5736)
+++ glibc-package/trunk/debian/patches/series 2013-10-24 22:07:17 UTC (rev 5737)
@@ -132,6 +132,7 @@
hurd-i386/tg-pthread-atfork.diff
hurd-i386/cvs-pthread_atfork.diff
hurd-i386/tg-pipe2.diff
+hurd-i386/cvs-tls-threadvar-threadself.diff
i386/local-biarch.diff
i386/local-cmov.diff
Reply to: