r6021 - in glibc-package/trunk/debian: . patches/hurd-i386
Author: sthibault
Date: 2014-04-21 22:52:20 +0000 (Mon, 21 Apr 2014)
New Revision: 6021
Modified:
glibc-package/trunk/debian/changelog
glibc-package/trunk/debian/patches/hurd-i386/tg-extern_inline.diff
glibc-package/trunk/debian/patches/hurd-i386/tg-sigstate_locking.diff
glibc-package/trunk/debian/patches/hurd-i386/tg-sigstate_thread_reference.diff
glibc-package/trunk/debian/patches/hurd-i386/tg-tls-threadvar.diff
Log:
Fix some Hurd corner cases triggered with gcl
* 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.
Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog 2014-04-17 21:46:50 UTC (rev 6020)
+++ glibc-package/trunk/debian/changelog 2014-04-21 22:52:20 UTC (rev 6021)
@@ -15,6 +15,11 @@
* patches/hurd-i386/cvs-tcbhead_t.diff: New patch to complete TLS variables,
to fix gcc's -fsplit-stack support.
* Update hurd-i386 testsuite results.
+ * 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.
[ Petr Salinger ]
* kfreebsd/local-sysdeps.diff: update to revision 5460 (from glibc-bsd).
Modified: glibc-package/trunk/debian/patches/hurd-i386/tg-extern_inline.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-extern_inline.diff 2014-04-17 21:46:50 UTC (rev 6020)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-extern_inline.diff 2014-04-21 22:52:20 UTC (rev 6021)
@@ -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)
{
@@ -232,16 +232,16 @@
--- a/hurd/hurd/signal.h
+++ b/hurd/hurd/signal.h
@@ -130,13 +130,15 @@
+ #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)
{
- 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;
}
+#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)
{
@@ -298,7 +298,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)
@@ -314,7 +314,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)
{
@@ -332,7 +332,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/trunk/debian/patches/hurd-i386/tg-sigstate_locking.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-sigstate_locking.diff 2014-04-17 21:46:50 UTC (rev 6020)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-sigstate_locking.diff 2014-04-21 22:52:20 UTC (rev 6021)
@@ -25,7 +25,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/trunk/debian/patches/hurd-i386/tg-sigstate_thread_reference.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-sigstate_thread_reference.diff 2014-04-17 21:46:50 UTC (rev 6020)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-sigstate_thread_reference.diff 2014-04-21 22:52:20 UTC (rev 6021)
@@ -45,18 +45,18 @@
@@ -161,7 +165,11 @@ _hurd_self_sigstate (void)
_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
@@ -192,11 +200,14 @@ _hurd_critical_section_lock (void)
- ss = _hurd_sigstate;
+ ss = THREAD_SELF->_hurd_sigstate;
if (ss == NULL)
{
+ thread_t self = __mach_thread_self ();
@@ -65,8 +65,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/trunk/debian/patches/hurd-i386/tg-tls-threadvar.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-tls-threadvar.diff 2014-04-17 21:46:50 UTC (rev 6020)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-tls-threadvar.diff 2014-04-21 22:52:20 UTC (rev 6021)
@@ -77,11 +77,7 @@
struct hurd_signal_preemptor; /* <hurd/sigpreempt.h> */
-@@ -129,14 +128,13 @@ extern struct hurd_sigstate *_hurd_self_sigstate (void)
- #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_sigstate (void)
_HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
_hurd_self_sigstate (void)
{
@@ -90,9 +86,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". */
@@ -111,7 +107,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
@@ -119,7 +115,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);
}
@@ -241,14 +237,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;
@@ -408,12 +401,11 @@
index 89e1906..9ecdbaf 100644
--- 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;
}
@@ -426,12 +418,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;
}
}
diff --git a/sysdeps/mach/hurd/bits/libc-lock.h b/sysdeps/mach/hurd/bits/libc-lock.h
@@ -753,14 +744,13 @@
static inline const char * __attribute__ ((unused))
_hurd_tls_init (tcbhead_t *tcb, int secondcall)
-@@ -127,6 +138,21 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
+@@ -127,6 +138,20 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
: "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; \
@@ -880,11 +870,12 @@
index 230f907..a5f65ff 100644
--- 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: