93dc2d
commit 23c77f60181eb549f11ec2f913b4270af29eee38
93dc2d
Author: Florian Weimer <fweimer@redhat.com>
93dc2d
Date:   Fri Dec 3 16:28:07 2021 +0100
93dc2d
93dc2d
    nptl: Increase default TCB alignment to 32
93dc2d
    
93dc2d
    rseq support will use a 32-byte aligned field in struct pthread,
93dc2d
    so the whole struct needs to have at least that alignment.
93dc2d
    
93dc2d
    nptl/tst-tls3mod.c uses TCB_ALIGNMENT, therefore include <descr.h>
93dc2d
    to obtain the fallback definition.
93dc2d
    
93dc2d
    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
93dc2d
93dc2d
diff --git a/nptl/descr.h b/nptl/descr.h
93dc2d
index 4de84138fb960fa4..57be5b4fef564b36 100644
93dc2d
--- a/nptl/descr.h
93dc2d
+++ b/nptl/descr.h
93dc2d
@@ -37,7 +37,9 @@
93dc2d
 #include <tls-internal-struct.h>
93dc2d
 
93dc2d
 #ifndef TCB_ALIGNMENT
93dc2d
-# define TCB_ALIGNMENT	sizeof (double)
93dc2d
+# define TCB_ALIGNMENT 32
93dc2d
+#elif TCB_ALIGNMENT < 32
93dc2d
+# error TCB_ALIGNMENT must be at least 32
93dc2d
 #endif
93dc2d
 
93dc2d
 
93dc2d
diff --git a/nptl/tst-tls3mod.c b/nptl/tst-tls3mod.c
93dc2d
index cfd13aace1affcd5..77dcc550fc3b5017 100644
93dc2d
--- a/nptl/tst-tls3mod.c
93dc2d
+++ b/nptl/tst-tls3mod.c
93dc2d
@@ -24,6 +24,7 @@
93dc2d
 #include <stdlib.h>
93dc2d
 #include <unistd.h>
93dc2d
 #include <pthreaddef.h>
93dc2d
+#include <descr.h>
93dc2d
 
93dc2d
 
93dc2d
 extern pthread_barrier_t b;
93dc2d
diff --git a/sysdeps/aarch64/nptl/pthreaddef.h b/sysdeps/aarch64/nptl/pthreaddef.h
93dc2d
index 4d5ecf6661fd0fe6..8d9a10622d132a7a 100644
93dc2d
--- a/sysdeps/aarch64/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/aarch64/nptl/pthreaddef.h
93dc2d
@@ -28,8 +28,5 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK 2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT 16
93dc2d
-
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/alpha/nptl/pthreaddef.h b/sysdeps/alpha/nptl/pthreaddef.h
93dc2d
index 25edb5093e095548..660e5694a25ec60f 100644
93dc2d
--- a/sysdeps/alpha/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/alpha/nptl/pthreaddef.h
93dc2d
@@ -27,8 +27,5 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	4096
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/arc/nptl/pthreaddef.h b/sysdeps/arc/nptl/pthreaddef.h
93dc2d
index 873b9d149ac46a62..d4dbe9e079445353 100644
93dc2d
--- a/sysdeps/arc/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/arc/nptl/pthreaddef.h
93dc2d
@@ -28,8 +28,5 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		4
93dc2d
-
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/arm/nptl/pthreaddef.h b/sysdeps/arm/nptl/pthreaddef.h
93dc2d
index 332f4079c4c3f2bf..13769f5ae270b0ca 100644
93dc2d
--- a/sysdeps/arm/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/arm/nptl/pthreaddef.h
93dc2d
@@ -28,9 +28,6 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
 
93dc2d
 /* Location of current stack frame.
93dc2d
 
93dc2d
diff --git a/sysdeps/csky/nptl/pthreaddef.h b/sysdeps/csky/nptl/pthreaddef.h
93dc2d
index e78bc0016b43b450..7dde9131b9b1a6b0 100644
93dc2d
--- a/sysdeps/csky/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/csky/nptl/pthreaddef.h
93dc2d
@@ -28,8 +28,5 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		8
93dc2d
-
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/ia64/nptl/pthreaddef.h b/sysdeps/ia64/nptl/pthreaddef.h
93dc2d
index 3a0f6daf9ad871aa..c7420fd1e4ee6081 100644
93dc2d
--- a/sysdeps/ia64/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/ia64/nptl/pthreaddef.h
93dc2d
@@ -30,9 +30,6 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	16384
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
 
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__stack_pointer
93dc2d
diff --git a/sysdeps/m68k/nptl/pthreaddef.h b/sysdeps/m68k/nptl/pthreaddef.h
93dc2d
index 13e785a86bbf47b4..ce9511cb02da69fd 100644
93dc2d
--- a/sysdeps/m68k/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/m68k/nptl/pthreaddef.h
93dc2d
@@ -28,9 +28,6 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
 
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/microblaze/nptl/pthreaddef.h b/sysdeps/microblaze/nptl/pthreaddef.h
93dc2d
index 517157444da556ad..19d7235782afde53 100644
93dc2d
--- a/sysdeps/microblaze/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/microblaze/nptl/pthreaddef.h
93dc2d
@@ -31,8 +31,5 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK  2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT       16
93dc2d
-
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME __builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/mips/nptl/pthreaddef.h b/sysdeps/mips/nptl/pthreaddef.h
93dc2d
index a7bccef6e512438f..322591c293ce5e15 100644
93dc2d
--- a/sysdeps/mips/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/mips/nptl/pthreaddef.h
93dc2d
@@ -27,9 +27,6 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
 
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/nios2/nptl/pthreaddef.h b/sysdeps/nios2/nptl/pthreaddef.h
93dc2d
index e01a0e6df72c089a..aa0709d0dc69f251 100644
93dc2d
--- a/sysdeps/nios2/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/nios2/nptl/pthreaddef.h
93dc2d
@@ -28,8 +28,5 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		4
93dc2d
-
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/powerpc/nptl/pthreaddef.h b/sysdeps/powerpc/nptl/pthreaddef.h
93dc2d
index ef5310e6315fde2c..117c35229ea68f48 100644
93dc2d
--- a/sysdeps/powerpc/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/powerpc/nptl/pthreaddef.h
93dc2d
@@ -28,9 +28,6 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	4096
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
 
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/riscv/nptl/pthreaddef.h b/sysdeps/riscv/nptl/pthreaddef.h
93dc2d
index 7bf93d6a63fdecd2..0f33cc48fe4fc728 100644
93dc2d
--- a/sysdeps/riscv/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/riscv/nptl/pthreaddef.h
93dc2d
@@ -28,8 +28,5 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/s390/nptl/pthreaddef.h b/sysdeps/s390/nptl/pthreaddef.h
93dc2d
index 091f82df24a4024c..0e32bd862f7fea48 100644
93dc2d
--- a/sysdeps/s390/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/s390/nptl/pthreaddef.h
93dc2d
@@ -28,9 +28,6 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
 
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/sh/nptl/pthreaddef.h b/sysdeps/sh/nptl/pthreaddef.h
93dc2d
index 3fa3d189ef969c90..f4e3a290df4ee6e6 100644
93dc2d
--- a/sysdeps/sh/nptl/pthreaddef.h
93dc2d
+++ b/sysdeps/sh/nptl/pthreaddef.h
93dc2d
@@ -29,9 +29,6 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		8
93dc2d
-
93dc2d
 
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
93dc2d
diff --git a/sysdeps/sparc/sparc32/pthreaddef.h b/sysdeps/sparc/sparc32/pthreaddef.h
93dc2d
index 6526fb3d6e7e1448..7a0a04789dac478e 100644
93dc2d
--- a/sysdeps/sparc/sparc32/pthreaddef.h
93dc2d
+++ b/sysdeps/sparc/sparc32/pthreaddef.h
93dc2d
@@ -27,9 +27,6 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	2048
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
 
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME  (stack_pointer + (2 * 64))
93dc2d
diff --git a/sysdeps/sparc/sparc64/pthreaddef.h b/sysdeps/sparc/sparc64/pthreaddef.h
93dc2d
index 3da9d7afc8054598..103842856d40432b 100644
93dc2d
--- a/sysdeps/sparc/sparc64/pthreaddef.h
93dc2d
+++ b/sysdeps/sparc/sparc64/pthreaddef.h
93dc2d
@@ -27,10 +27,6 @@
93dc2d
 /* Minimal stack size after allocating thread descriptor and guard size.  */
93dc2d
 #define MINIMAL_REST_STACK	4096
93dc2d
 
93dc2d
-/* Alignment requirement for TCB.  */
93dc2d
-#define TCB_ALIGNMENT		16
93dc2d
-
93dc2d
-
93dc2d
 /* Location of current stack frame.  */
93dc2d
 #define CURRENT_STACK_FRAME  (stack_pointer + (2 * 128))
93dc2d
 register char *stack_pointer __asm__("%sp");