r6022 - in glibc-package/branches/eglibc-2.19/debian: . patches/hurd-i386
Author: sthibault
Date: 2014-04-21 22:58:26 +0000 (Mon, 21 Apr 2014)
New Revision: 6022
Modified:
glibc-package/branches/eglibc-2.19/debian/changelog
glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-extern_inline.diff
glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-sigstate_locking.diff
glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-sigstate_thread_reference.diff
glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-tls-threadvar.diff
Log:
Backport changes from trunk
Modified: glibc-package/branches/eglibc-2.19/debian/changelog
===================================================================
--- glibc-package/branches/eglibc-2.19/debian/changelog 2014-04-21 22:52:20 UTC (rev 6021)
+++ glibc-package/branches/eglibc-2.19/debian/changelog 2014-04-21 22:58:26 UTC (rev 6022)
@@ -90,6 +90,11 @@
initialization.
* patches/hurd-i386/cvs-tcbhead_t.diff: New patch to complete TLS variables,
to fix gcc's -fsplit-stack support.
+ * patches/hurd-i386/tg-extern_inline.diff: Only inline within libc.
+ * patches/hurd-i386/tg-tls-threadvar.diff: Use tcbhead_t for _hurd_sigstate
+ instead of TLS variable. Fixes some corner cases triggered with gcl.
+ * patches/hurd-i386/tg-sigstate_locking.diff: Refresh.
+ * patches/hurd-i386/tg-sigstate_thread_reference.diff: Refresh.
-- Aurelien Jarno <aurel32@debian.org> Sun, 02 Mar 2014 16:19:49 +0100
Modified: glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-extern_inline.diff
===================================================================
--- glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-extern_inline.diff 2014-04-21 22:52:20 UTC (rev 6021)
+++ glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-extern_inline.diff 2014-04-21 22:58:26 UTC (rev 6022)
@@ -50,7 +50,7 @@
+struct hurd_fd *_hurd_fd_get (int fd);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_FD_H_EXTERN_INLINE struct hurd_fd *
_hurd_fd_get (int fd)
{
@@ -133,7 +133,7 @@
+void _hurd_port_init (struct hurd_port *port, mach_port_t init);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_init (struct hurd_port *port, mach_port_t init)
{
@@ -153,7 +153,7 @@
+_hurd_port_locked_get (struct hurd_port *port,
+ struct hurd_userlink *link);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_PORT_H_EXTERN_INLINE mach_port_t
_hurd_port_locked_get (struct hurd_port *port,
struct hurd_userlink *link)
@@ -169,7 +169,7 @@
+_hurd_port_get (struct hurd_port *port,
+ struct hurd_userlink *link);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_PORT_H_EXTERN_INLINE mach_port_t
_hurd_port_get (struct hurd_port *port,
struct hurd_userlink *link)
@@ -187,7 +187,7 @@
+ struct hurd_userlink *link,
+ mach_port_t used_port);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_free (struct hurd_port *port,
struct hurd_userlink *link,
@@ -203,7 +203,7 @@
+void _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_locked_set (struct hurd_port *port, mach_port_t newport)
{
@@ -217,7 +217,7 @@
+void _hurd_port_set (struct hurd_port *port, mach_port_t newport);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_set (struct hurd_port *port, mach_port_t newport)
{
@@ -231,17 +231,17 @@
#endif /* hurd/port.h */
--- a/hurd/hurd/signal.h
+++ b/hurd/hurd/signal.h
-@@ -129,6 +129,7 @@ extern struct hurd_sigstate *_hurd_self_
+@@ -129,13 +129,15 @@ extern struct hurd_sigstate *_hurd_self_
+ #define _HURD_SIGNAL_H_EXTERN_INLINE __extern_inline
#endif
- extern __thread struct hurd_sigstate *_hurd_sigstate;
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
_hurd_self_sigstate (void)
{
-@@ -136,6 +137,7 @@ _hurd_self_sigstate (void)
- _hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
- return _hurd_sigstate;
+ if (THREAD_SELF->_hurd_sigstate == NULL)
+ THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
+ return THREAD_SELF->_hurd_sigstate;
}
+#endif
@@ -253,7 +253,7 @@
+void *_hurd_critical_section_lock (void);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_SIGNAL_H_EXTERN_INLINE void *
_hurd_critical_section_lock (void)
{
@@ -265,7 +265,7 @@
+void _hurd_critical_section_unlock (void *our_lock);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_SIGNAL_H_EXTERN_INLINE void
_hurd_critical_section_unlock (void *our_lock)
{
@@ -296,7 +296,7 @@
+_hurd_userlink_link (struct hurd_userlink **chainp,
+ struct hurd_userlink *link);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_USERLINK_H_EXTERN_INLINE void
_hurd_userlink_link (struct hurd_userlink **chainp,
struct hurd_userlink *link)
@@ -312,7 +312,7 @@
+int _hurd_userlink_unlink (struct hurd_userlink *link);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_USERLINK_H_EXTERN_INLINE int
_hurd_userlink_unlink (struct hurd_userlink *link)
{
@@ -330,7 +330,7 @@
+int _hurd_userlink_clear (struct hurd_userlink **chainp);
+
-+#if defined __USE_EXTERN_INLINES && defined _LIBC
++#if defined __USE_EXTERN_INLINES && defined _LIBC && !defined NOT_IN_libc
_HURD_USERLINK_H_EXTERN_INLINE int
_hurd_userlink_clear (struct hurd_userlink **chainp)
{
Modified: glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-sigstate_locking.diff
===================================================================
--- glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-sigstate_locking.diff 2014-04-21 22:52:20 UTC (rev 6021)
+++ glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-sigstate_locking.diff 2014-04-21 22:58:26 UTC (rev 6022)
@@ -23,7 +23,7 @@
possible already be set. Look up our sigstate structure the slow
- way; this locks the sigstate lock. */
+ way. */
- ss = _hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
+ ss = THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
- __spin_unlock (&ss->lock);
}
Modified: glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-sigstate_thread_reference.diff
===================================================================
--- glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-sigstate_thread_reference.diff 2014-04-21 22:52:20 UTC (rev 6021)
+++ glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-sigstate_thread_reference.diff 2014-04-21 22:58:26 UTC (rev 6022)
@@ -43,18 +43,18 @@
@@ -160,7 +164,11 @@ _HURD_SIGNAL_H_EXTERN_INLINE struct hurd
_hurd_self_sigstate (void)
{
- if (_hurd_sigstate == NULL)
-- _hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
+ if (THREAD_SELF->_hurd_sigstate == NULL)
+- THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
+ {
+ thread_t self = __mach_thread_self ();
-+ _hurd_sigstate = _hurd_thread_sigstate (self);
++ THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (self);
+ __mach_port_deallocate (__mach_task_self (), self);
+ }
- return _hurd_sigstate;
+ return THREAD_SELF->_hurd_sigstate;
}
#endif
@@ -201,11 +209,14 @@ _hurd_critical_section_lock (void)
- ss = _hurd_sigstate;
+ ss = THREAD_SELF->_hurd_sigstate;
if (ss == NULL)
{
+ thread_t self = __mach_thread_self ();
@@ -63,8 +63,8 @@
asked for it. In this case, the critical section flag cannot
possible already be set. Look up our sigstate structure the slow
way. */
-- ss = _hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
-+ ss = _hurd_sigstate = _hurd_thread_sigstate (self);
+- ss = THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
++ ss = THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (self);
+ __mach_port_deallocate (__mach_task_self (), self);
}
Modified: glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-tls-threadvar.diff
===================================================================
--- glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-tls-threadvar.diff 2014-04-21 22:52:20 UTC (rev 6021)
+++ glibc-package/branches/eglibc-2.19/debian/patches/hurd-i386/tg-tls-threadvar.diff 2014-04-21 22:58:26 UTC (rev 6022)
@@ -73,11 +73,7 @@
struct hurd_signal_preemptor; /* <hurd/sigpreempt.h> */
-@@ -129,14 +128,13 @@ extern struct hurd_sigstate *_hurd_self_
- #define _HURD_SIGNAL_H_EXTERN_INLINE __extern_inline
- #endif
-
-+extern __thread struct hurd_sigstate *_hurd_sigstate;
+@@ -129,11 +128,9 @@ extern struct hurd_sigstate *_hurd_self_
_HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
_hurd_self_sigstate (void)
{
@@ -86,9 +82,9 @@
- if (*location == NULL)
- *location = _hurd_thread_sigstate (__mach_thread_self ());
- return *location;
-+ if (_hurd_sigstate == NULL)
-+ _hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
-+ return _hurd_sigstate;
++ if (THREAD_SELF->_hurd_sigstate == NULL)
++ THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
++ return THREAD_SELF->_hurd_sigstate;
}
/* Thread listening on our message port; also called the "signal thread". */
@@ -107,7 +103,7 @@
+ return NULL;
+#endif
+
-+ ss = _hurd_sigstate;
++ ss = THREAD_SELF->_hurd_sigstate;
if (ss == NULL)
{
/* The thread variable is unset; this must be the first time we've
@@ -115,7 +111,7 @@
possible already be set. Look up our sigstate structure the slow
way; this locks the sigstate lock. */
- ss = *location = _hurd_thread_sigstate (__mach_thread_self ());
-+ ss = _hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
++ ss = THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
__spin_unlock (&ss->lock);
}
@@ -233,14 +229,11 @@
#include <mach.h>
#include <mach/thread_switch.h>
-@@ -48,7 +49,9 @@ thread_t _hurd_sigthread;
+@@ -48,7 +49,6 @@ thread_t _hurd_sigthread;
/* These are set up by _hurdsig_init. */
unsigned long int __hurd_sigthread_stack_base;
unsigned long int __hurd_sigthread_stack_end;
-unsigned long int *__hurd_sigthread_variables;
-+
-+/* Per-thread signal state. */
-+__thread struct hurd_sigstate *_hurd_sigstate;
/* Linked-list of per-thread signal state. */
struct hurd_sigstate *_hurd_sigstates;
@@ -392,12 +385,11 @@
# define errno __libc_errno
--- a/sysdeps/mach/hurd/Versions
+++ b/sysdeps/mach/hurd/Versions
-@@ -6,6 +6,8 @@ libc {
+@@ -6,6 +6,7 @@ libc {
GLIBC_PRIVATE {
# Functions shared with the dynamic linker
__libc_read; __libc_write; __libc_lseek64;
+ __libc_lock_self0; __libc_lock_self;
-+ _hurd_sigstate;
_dl_init_first;
}
@@ -410,12 +402,11 @@
__hurd_threadvar_stack_mask; __hurd_threadvar_stack_offset;
# functions that must be shared with libc
-@@ -33,5 +33,7 @@ ld {
+@@ -33,5 +33,6 @@ ld {
# functions that must be shared with libc
__libc_read; __libc_write; __libc_lseek64;
+ __libc_lock_self0; __libc_lock_self;
-+ _hurd_sigstate;
}
}
--- a/sysdeps/mach/hurd/bits/libc-lock.h
@@ -711,14 +702,13 @@
static inline const char * __attribute__ ((unused))
_hurd_tls_init (tcbhead_t *tcb, int secondcall)
-@@ -126,6 +137,21 @@ _hurd_tls_init (tcbhead_t *tcb, int seco
+@@ -126,6 +137,20 @@ _hurd_tls_init (tcbhead_t *tcb, int seco
: "i" (offsetof (tcbhead_t, tcb))); \
__tcb;})
+/* Return the TCB address of a thread given its state. */
+# define THREAD_TCB(thread, thread_state) \
+ ({ int __sel = (thread_state)->basic.gs; \
-+ tcbhead_t *__tcb; \
+ struct descriptor __desc, *___desc = &__desc; \
+ unsigned int __count = 1; \
+ kern_return_t __err; \
@@ -832,11 +822,12 @@
--- a/sysdeps/mach/hurd/i386/tls.h
+++ b/sysdeps/mach/hurd/i386/tls.h
-@@ -47,6 +47,7 @@ typedef struct
+@@ -47,6 +47,8 @@ typedef struct
void *__private_tm[4];
/* GCC split stack support. */
void *__private_ss;
+ mach_port_t reply_port; /* This thread's reply port. */
++ struct hurd_sigstate *_hurd_sigstate;
} tcbhead_t;
#endif
Reply to: