about summary refs log tree commit diff
path: root/linuxthreads
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/descr.h22
-rw-r--r--linuxthreads/pthread.c4
-rw-r--r--linuxthreads/sysdeps/ia64/tcb-offsets.sym2
-rw-r--r--linuxthreads/sysdeps/powerpc/tls.h2
-rw-r--r--linuxthreads/sysdeps/sh/tcb-offsets.sym2
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h4
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h2
7 files changed, 13 insertions, 25 deletions
diff --git a/linuxthreads/descr.h b/linuxthreads/descr.h
index dd496f6d0f..a9aaa55122 100644
--- a/linuxthreads/descr.h
+++ b/linuxthreads/descr.h
@@ -120,14 +120,17 @@ struct _pthread_descr_struct
       union dtv *dtvp;
       pthread_descr self;	/* Pointer to this structure */
       int multiple_threads;
-# define p_multiple_threads(descr) (descr)->p_header.data.multiple_threads
 # ifdef NEED_DL_SYSINFO
       uintptr_t sysinfo;
 # endif
     } data;
     void *__padding[16];
   } p_header;
+# define p_multiple_threads p_header.data.multiple_threads
+#elif TLS_MULTIPLE_THREADS_IN_TCB
+  int p_multiple_threads;
 #endif
+
   pthread_descr p_nextlive, p_prevlive;
                                 /* Double chaining of active threads */
   pthread_descr p_nextwaiting;  /* Next element in the queue holding the thr */
@@ -186,22 +189,7 @@ struct _pthread_descr_struct
 #endif
   size_t p_alloca_cutoff;	/* Maximum size which should be allocated
 				   using alloca() instead of malloc().  */
-  /* New elements must be added at the end before __multiple_threads.  */
-#if TLS_MULTIPLE_THREADS_IN_TCB
-  /* This field here isn't necessarily multiple_threads, which is really
-     the last integer in struct _pthread_descr_struct.  */
-  int __multiple_threads;
-# define p_multiple_threads(descr) \
-  (((union								      \
-     {									      \
-       struct _pthread_descr_struct s;					      \
-       struct								      \
-       {								      \
-	 char dummy[sizeof (struct _pthread_descr_struct) - sizeof (int)];    \
-	 int multiple_threads;						      \
-       } m;								      \
-     } *)(descr))->m.multiple_threads)
-#endif
+  /* New elements must be added at the end.  */
 } __attribute__ ((aligned(32))); /* We need to align the structure so that
 				    doubles are aligned properly.  This is 8
 				    bytes on MIPS and 16 bytes on MIPS64.
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 38a9f7df6e..d13207f4ee 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -571,7 +571,7 @@ int __pthread_initialize_manager(void)
 
   __pthread_multiple_threads = 1;
 #if TLS_MULTIPLE_THREADS_IN_TCB || !defined USE_TLS || !TLS_DTV_AT_TP
-  p_multiple_threads (__pthread_main_thread) = 1;
+  __pthread_main_thread->p_multiple_threads = 1;
 #endif
   *__libc_multiple_threads_ptr = 1;
 
@@ -620,7 +620,7 @@ int __pthread_initialize_manager(void)
 #if !defined USE_TLS || !TLS_DTV_AT_TP
   mgr->p_header.data.tcb = tcbp;
   mgr->p_header.data.self = mgr;
-  p_multiple_threads (mgr) = 1;
+  mgr->p_header.data.multiple_threads = 1;
 #elif TLS_MULTIPLE_THREADS_IN_TCB
   p_multiple_threads (mgr) = 1;
 #endif
diff --git a/linuxthreads/sysdeps/ia64/tcb-offsets.sym b/linuxthreads/sysdeps/ia64/tcb-offsets.sym
index c1d307dbc3..f7793f7665 100644
--- a/linuxthreads/sysdeps/ia64/tcb-offsets.sym
+++ b/linuxthreads/sysdeps/ia64/tcb-offsets.sym
@@ -3,7 +3,7 @@
 
 --
 #ifdef USE_TLS
-MULTIPLE_THREADS_OFFSET -sizeof(int)
+MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads) - sizeof (struct _pthread_descr_struct)
 #else
 MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
 #endif
diff --git a/linuxthreads/sysdeps/powerpc/tls.h b/linuxthreads/sysdeps/powerpc/tls.h
index 55e915e440..9bae084a0b 100644
--- a/linuxthreads/sysdeps/powerpc/tls.h
+++ b/linuxthreads/sysdeps/powerpc/tls.h
@@ -32,6 +32,8 @@ typedef union dtv
   void *pointer;
 } dtv_t;
 
+#else /* __ASSEMBLER__ */
+# include <tcb-offsets.h>
 #endif /* __ASSEMBLER__ */
 
 #ifdef HAVE_TLS_SUPPORT
diff --git a/linuxthreads/sysdeps/sh/tcb-offsets.sym b/linuxthreads/sysdeps/sh/tcb-offsets.sym
index 7537daa915..328eb05738 100644
--- a/linuxthreads/sysdeps/sh/tcb-offsets.sym
+++ b/linuxthreads/sysdeps/sh/tcb-offsets.sym
@@ -3,7 +3,7 @@
 
 --
 #ifdef USE_TLS
-MULTIPLE_THREADS_OFFSET ((char *) &p_multiple_threads ((struct _pthread_descr_struct *)0) - (char *) 0)
+MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads)
 TLS_PRE_TCB_SIZE	sizeof (struct _pthread_descr_struct)
 #else
 MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
index fb6ca06599..2d191d115c 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
+++ b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
@@ -21,8 +21,6 @@
 #include <tls.h>
 #ifndef __ASSEMBLER__
 # include <linuxthreads/internals.h>
-#else
-# include <tcb-offsets.h>
 #endif
 
 #if !defined NOT_IN_libc || defined IS_IN_libpthread
@@ -87,7 +85,7 @@
 
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P						\
-  __builtin_expect (p_multiple_threads (THREAD_SELF) == 0, 1)
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P						\
   lwz 10,MULTIPLE_THREADS_OFFSET(2);					\
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
index 57cced9479..e6d0cca252 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+++ b/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
@@ -121,7 +121,7 @@
 # ifndef __ASSEMBLER__
 #  if defined FLOATING_STACKS && USE___THREAD && defined PIC
 #   define SINGLE_THREAD_P \
-  __builtin_expect (p_multiple_threads (THREAD_SELF) == 0, 1)
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
 #  else
 extern int __local_multiple_threads attribute_hidden;
 #   define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)