summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nptl/allocatestack.c8
-rw-r--r--nptl/descr.h20
-rw-r--r--nptl/pthread_create.c4
-rw-r--r--nptl/sysdeps/i386/tls.h6
-rw-r--r--nptl/sysdeps/pthread/createthread.c8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h3
-rw-r--r--nptl/sysdeps/x86_64/tls.h6
9 files changed, 35 insertions, 25 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 14a2ab09df..8e77543927 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -321,14 +321,14 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
       /* This is at least the second thread.  */
-      pd->multiple_threads = 1;
+      pd->header.multiple_threads = 1;
 #else
       __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
 #ifdef NEED_DL_SYSINFO
       /* Copy the sysinfo value from the parent.  */
-      pd->sysinfo = THREAD_GETMEM (THREAD_SELF, sysinfo);
+      pd->header.sysinfo = THREAD_GETMEM (THREAD_SELF, header.sysinfo);
 #endif
 
       /* Allocate the DTV for this thread.  */
@@ -446,14 +446,14 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
 	  /* This is at least the second thread.  */
-	  pd->multiple_threads = 1;
+	  pd->header.multiple_threads = 1;
 #else
 	  __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
 #ifdef NEED_DL_SYSINFO
 	  /* Copy the sysinfo value from the parent.  */
-	  pd->sysinfo = THREAD_GETMEM (THREAD_SELF, sysinfo);
+	  pd->header.sysinfo = THREAD_GETMEM (THREAD_SELF, header.sysinfo);
 #endif
 
 	  /* Allocate the DTV for this thread.  */
diff --git a/nptl/descr.h b/nptl/descr.h
index cbaa38fc3c..5a4c99c42f 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -57,17 +57,25 @@
 /* Thread descriptor data structure.  */
 struct pthread
 {
-#if !TLS_DTV_AT_TP
-  /* This overlaps tcbhead_t (see tls.h), as used for TLS without threads.  */
   union
   {
-    tcbhead_t;
-    void *__padding[16];
-  };
+#if !TLS_DTV_AT_TP
+    /* This overlaps the TCB as used for TLS without threads (see tls.h).  */
+    tcbhead_t header;
 #elif TLS_MULTIPLE_THREADS_IN_TCB
-  int multiple_threads;
+    struct
+    {
+      int multiple_threads;
+    } header;
 #endif
 
+    /* This extra padding has no special purpose, and this structure layout
+       is private and subject to change without affecting the official ABI.
+       We just have it here in case it might be convenient for some
+       implementation-specific instrumentation hack or suchlike.  */
+    void *__padding[16];
+  };
+
   /* This descriptor's link on the `stack_used' or `__stack_user' list.  */
   list_t list;
 
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 0eb7dc7c81..ec004194b2 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -347,10 +347,10 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
 
 #ifdef TLS_TCB_AT_TP
   /* Reference to the TCB itself.  */
-  pd->self = pd;
+  pd->header.self = pd;
 
   /* Self-reference for TLS.  */
-  pd->tcb = pd;
+  pd->header.tcb = pd;
 #endif
 
   /* Store the address of the start routine and the parameter.  Since
diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h
index 6fb6adca30..eea5e3010d 100644
--- a/nptl/sysdeps/i386/tls.h
+++ b/nptl/sysdeps/i386/tls.h
@@ -122,7 +122,7 @@ union user_desc_init
 /* Install new dtv for current thread.  */
 # define INSTALL_NEW_DTV(dtvp) \
   ({ struct pthread *__pd;						      \
-     THREAD_SETMEM (__pd, dtv, (dtvp)); })
+     THREAD_SETMEM (__pd, header.dtv, (dtvp)); })
 
 /* Return dtv of given thread descriptor.  */
 # define GET_DTV(descr) \
@@ -228,7 +228,7 @@ union user_desc_init
 /* Return the address of the dtv for the current thread.  */
 # define THREAD_DTV() \
   ({ struct pthread *__pd;						      \
-     THREAD_GETMEM (__pd, dtv); })
+     THREAD_GETMEM (__pd, header.dtv); })
 
 
 /* Return the thread descriptor for the current thread.
@@ -240,7 +240,7 @@ union user_desc_init
 # define THREAD_SELF \
   ({ struct pthread *__self;						      \
      asm ("movl %%gs:%c1,%0" : "=r" (__self)				      \
-	  : "i" (offsetof (struct pthread, self))); 			      \
+	  : "i" (offsetof (struct pthread, header.self)));			      \
      __self;})
 
 
diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c
index 4ee92afec4..797176d0b6 100644
--- a/nptl/sysdeps/pthread/createthread.c
+++ b/nptl/sysdeps/pthread/createthread.c
@@ -55,7 +55,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
 #endif
 
 #ifdef TLS_TCB_AT_TP
-  assert (pd->tcb != NULL);
+  assert (pd->header.tcb != NULL);
 #endif
 
   if (__builtin_expect (THREAD_GETMEM (THREAD_SELF, report_events), 0))
@@ -85,7 +85,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
 	  /* We now have for sure more than one thread.  */
-	  pd->multiple_threads = 1;
+	  pd->header.multiple_threads = 1;
 #else
 	  __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
@@ -114,7 +114,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
     }
 
 #ifdef NEED_DL_SYSINFO
-  assert (THREAD_GETMEM (THREAD_SELF, sysinfo) == pd->sysinfo);
+  assert (THREAD_GETMEM (THREAD_SELF, header.sysinfo) == pd->header.sysinfo);
 #endif
 
   /* We rely heavily on various flags the CLONE function understands:
@@ -157,7 +157,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
   /* We now have for sure more than one thread.  */
-  THREAD_SETMEM (THREAD_SELF, multiple_threads, 1);
+  THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
 #endif
 
   return 0;
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
index 6abb59a144..35f05e1cc2 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
@@ -78,7 +78,8 @@
 
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P \
-  __builtin_expect (THREAD_GETMEM (THREAD_SELF, multiple_threads) == 0, 1)
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
 # endif
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
index 5b999678fc..5a3ae51c23 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
@@ -81,7 +81,7 @@ L(pseudo_end):
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P \
   __builtin_expect (THREAD_GETMEM (THREAD_SELF,				      \
-				   header.data.multiple_threads) == 0, 1)
+				   header.multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P \
 	ear	%r1,%a0;						      \
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
index 27147476e2..16f8ad5e0f 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
@@ -117,7 +117,8 @@
 
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P \
-  __builtin_expect (THREAD_GETMEM (THREAD_SELF, multiple_threads) == 0, 1)
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P \
 	stc gbr,r0; \
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index fb35b7b40a..e7fab7a1b2 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -92,7 +92,7 @@ typedef struct
 /* Install new dtv for current thread.  */
 # define INSTALL_NEW_DTV(dtvp) \
   ({ struct pthread *__pd;						      \
-     THREAD_SETMEM (__pd, dtv, (dtvp)); })
+     THREAD_SETMEM (__pd, header.dtv, (dtvp)); })
 
 /* Return dtv of given thread descriptor.  */
 # define GET_DTV(descr) \
@@ -136,7 +136,7 @@ typedef struct
 /* Return the address of the dtv for the current thread.  */
 # define THREAD_DTV() \
   ({ struct pthread *__pd;						      \
-     THREAD_GETMEM (__pd, dtv); })
+     THREAD_GETMEM (__pd, header.dtv); })
 
 
 /* Return the thread descriptor for the current thread.
@@ -148,7 +148,7 @@ typedef struct
 # define THREAD_SELF \
   ({ struct pthread *__self;						      \
      asm ("movq %%fs:%c1,%q0" : "=r" (__self)				      \
-	  : "i" (offsetof (struct pthread, self)));		 	      \
+	  : "i" (offsetof (struct pthread, header.self)));	 	      \
      __self;})