mirror of
https://sourceware.org/git/glibc.git
synced 2025-11-27 12:01:15 +03:00
Remove TLS_TCB_ALIGN and TLS_INIT_TCB_ALIGN
TLS_INIT_TCB_ALIGN is not actually used. TLS_TCB_ALIGN was likely
introduced to support a configuration where the thread pointer
has not the same alignment as THREAD_SELF. Only ia64 seems to use
that, but for the stack/pointer guard, not for storing tcbhead_t.
Some ports use TLS_TCB_OFFSET and TLS_PRE_TCB_SIZE to shift
the thread pointer, potentially landing in a different residue class
modulo the alignment, but the changes should not impact that.
In general, given that TLS variables have their own alignment
requirements, having different alignment for the (unshifted) thread
pointer and struct pthread would potentially result in dynamic
offsets, leading to more complexity.
hppa had different values before: __alignof__ (tcbhead_t), which
seems to be 4, and __alignof__ (struct pthread), which was 8
(old default) and is now 32. However, it defines THREAD_SELF as:
/* Return the thread descriptor for the current thread. */
# define THREAD_SELF \
({ struct pthread *__self; \
__self = __get_cr27(); \
__self - 1; \
})
So the thread pointer points after struct pthread (hence __self - 1),
and they have to have the same alignment on hppa as well.
Similarly, on ia64, the definitions were different. We have:
# define TLS_PRE_TCB_SIZE \
(sizeof (struct pthread) \
+ (PTHREAD_STRUCT_END_PADDING < 2 * sizeof (uintptr_t) \
? ((2 * sizeof (uintptr_t) + __alignof__ (struct pthread) - 1) \
& ~(__alignof__ (struct pthread) - 1)) \
: 0))
# define THREAD_SELF \
((struct pthread *) ((char *) __thread_self - TLS_PRE_TCB_SIZE))
And TLS_PRE_TCB_SIZE is a multiple of the struct pthread alignment
(confirmed by the new _Static_assert in sysdeps/ia64/libc-tls.c).
On m68k, we have a larger gap between tcbhead_t and struct pthread.
But as far as I can tell, the port is fine with that. The definition
of TCB_OFFSET is sufficient to handle the shifted TCB scenario.
This fixes commit 23c77f6018
("nptl: Increase default TCB alignment to 32").
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <array_length.h>
|
#include <array_length.h>
|
||||||
|
#include <pthreadP.h>
|
||||||
|
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
#error makefile bug, this file is for static only
|
#error makefile bug, this file is for static only
|
||||||
@@ -89,7 +90,7 @@ init_static_tls (size_t memsz, size_t align)
|
|||||||
{
|
{
|
||||||
/* That is the size of the TLS memory for this object. */
|
/* That is the size of the TLS memory for this object. */
|
||||||
GL(dl_tls_static_size) = roundup (memsz + GLRO(dl_tls_static_surplus),
|
GL(dl_tls_static_size) = roundup (memsz + GLRO(dl_tls_static_surplus),
|
||||||
TLS_TCB_ALIGN);
|
TCB_ALIGNMENT);
|
||||||
#if TLS_TCB_AT_TP
|
#if TLS_TCB_AT_TP
|
||||||
GL(dl_tls_static_size) += TLS_TCB_SIZE;
|
GL(dl_tls_static_size) += TLS_TCB_SIZE;
|
||||||
#endif
|
#endif
|
||||||
@@ -214,5 +215,5 @@ __libc_setup_tls (void)
|
|||||||
memsz += tcb_offset;
|
memsz += tcb_offset;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
init_static_tls (memsz, MAX (TLS_TCB_ALIGN, max_align));
|
init_static_tls (memsz, MAX (TCB_ALIGNMENT, max_align));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ _dl_count_modids (void)
|
|||||||
void
|
void
|
||||||
_dl_determine_tlsoffset (void)
|
_dl_determine_tlsoffset (void)
|
||||||
{
|
{
|
||||||
size_t max_align = TLS_TCB_ALIGN;
|
size_t max_align = TCB_ALIGNMENT;
|
||||||
size_t freetop = 0;
|
size_t freetop = 0;
|
||||||
size_t freebottom = 0;
|
size_t freebottom = 0;
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ _dl_determine_tlsoffset (void)
|
|||||||
|
|
||||||
GL(dl_tls_static_used) = offset;
|
GL(dl_tls_static_used) = offset;
|
||||||
GLRO (dl_tls_static_size) = roundup (offset + GLRO(dl_tls_static_surplus),
|
GLRO (dl_tls_static_size) = roundup (offset + GLRO(dl_tls_static_surplus),
|
||||||
TLS_TCB_ALIGN);
|
TCB_ALIGNMENT);
|
||||||
#else
|
#else
|
||||||
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
|
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -52,18 +52,12 @@ typedef struct
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* This is the size we need before TCB. */
|
/* This is the size we need before TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* Install the dtv pointer. The pointer passed is to the element with
|
/* Install the dtv pointer. The pointer passed is to the element with
|
||||||
index -1 which contain the length. */
|
index -1 which contain the length. */
|
||||||
# define INSTALL_DTV(tcbp, dtvp) \
|
# define INSTALL_DTV(tcbp, dtvp) \
|
||||||
|
|||||||
@@ -46,18 +46,12 @@ typedef struct
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN 16
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* This is the size we need before TCB. */
|
/* This is the size we need before TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN 16
|
|
||||||
|
|
||||||
/* Install the dtv pointer. The pointer passed is to the element with
|
/* Install the dtv pointer. The pointer passed is to the element with
|
||||||
index -1 which contain the length. */
|
index -1 which contain the length. */
|
||||||
# define INSTALL_DTV(tcbp, dtvp) \
|
# define INSTALL_DTV(tcbp, dtvp) \
|
||||||
|
|||||||
@@ -48,17 +48,11 @@ typedef struct
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
#ifndef TLS_TCB_SIZE
|
#ifndef TLS_TCB_SIZE
|
||||||
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size we need before TCB. */
|
/* This is the size we need before TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
|
|||||||
@@ -50,18 +50,12 @@ typedef struct
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN 16
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* This is the size we need before TCB. */
|
/* This is the size we need before TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN 16
|
|
||||||
|
|
||||||
/* Install the dtv pointer. The pointer passed is to the element with
|
/* Install the dtv pointer. The pointer passed is to the element with
|
||||||
index -1 which contain the length. */
|
index -1 which contain the length. */
|
||||||
# define INSTALL_DTV(tcbp, dtvp) \
|
# define INSTALL_DTV(tcbp, dtvp) \
|
||||||
|
|||||||
@@ -61,15 +61,9 @@ typedef struct
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN 8
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN 8
|
|
||||||
|
|
||||||
/* This is the size we need before TCB. */
|
/* This is the size we need before TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,11 @@
|
|||||||
/* An architecture-specific version of this file has to defined a
|
/* An architecture-specific version of this file has to defined a
|
||||||
number of symbols:
|
number of symbols:
|
||||||
|
|
||||||
|
TCB_ALIGNMENT
|
||||||
|
|
||||||
|
Alignment of THREAD_SELF (struct pthread *) and the thread
|
||||||
|
pointer.
|
||||||
|
|
||||||
TLS_TCB_AT_TP or TLS_DTV_AT_TP
|
TLS_TCB_AT_TP or TLS_DTV_AT_TP
|
||||||
|
|
||||||
The presence of one of these symbols signals which variant of
|
The presence of one of these symbols signals which variant of
|
||||||
@@ -43,15 +48,6 @@
|
|||||||
dynamic linker itself. There are no threads in use at that time.
|
dynamic linker itself. There are no threads in use at that time.
|
||||||
|
|
||||||
|
|
||||||
TLS_TCB_ALIGN
|
|
||||||
|
|
||||||
Alignment requirements for the TCB structure.
|
|
||||||
|
|
||||||
TLS_INIT_TCB_ALIGN
|
|
||||||
|
|
||||||
Similarly, but for the structure used at startup time.
|
|
||||||
|
|
||||||
|
|
||||||
INSTALL_DTV(tcb, init_dtv)
|
INSTALL_DTV(tcb, init_dtv)
|
||||||
|
|
||||||
This macro must install the given initial DTV into the thread control
|
This macro must install the given initial DTV into the thread control
|
||||||
|
|||||||
@@ -52,15 +52,9 @@ typedef struct
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size we need before TCB */
|
/* This is the size we need before TCB */
|
||||||
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
|
|||||||
@@ -102,15 +102,9 @@ union user_desc_init
|
|||||||
struct pthread even when not linked with -lpthread. */
|
struct pthread even when not linked with -lpthread. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (struct pthread)
|
# define TLS_INIT_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (struct pthread)
|
# define TLS_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* The TCB can have any size and the memory following the address the
|
/* The TCB can have any size and the memory following the address the
|
||||||
thread pointer points to is unspecified. Allocate the TCB there. */
|
thread pointer points to is unspecified. Allocate the TCB there. */
|
||||||
# define TLS_TCB_AT_TP 1
|
# define TLS_TCB_AT_TP 1
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
#include <csu/libc-tls.c>
|
#include <csu/libc-tls.c>
|
||||||
|
|
||||||
|
_Static_assert (TLS_PRE_TCB_SIZE % __alignof (struct pthread) == 0,
|
||||||
|
"__thread_self and THREAD_SELF have same alignment");
|
||||||
|
|
||||||
/* On IA-64, as it lacks linker optimizations, __tls_get_addr can be
|
/* On IA-64, as it lacks linker optimizations, __tls_get_addr can be
|
||||||
called even in statically linked binaries.
|
called even in statically linked binaries.
|
||||||
In this case module must be always 1 and PT_TLS segment
|
In this case module must be always 1 and PT_TLS segment
|
||||||
|
|||||||
@@ -53,9 +53,6 @@ register struct pthread *__thread_self __asm__("r13");
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
@@ -70,9 +67,6 @@ register struct pthread *__thread_self __asm__("r13");
|
|||||||
& ~(__alignof__ (struct pthread) - 1)) \
|
& ~(__alignof__ (struct pthread) - 1)) \
|
||||||
: 0))
|
: 0))
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* The DTV is allocated at the TP; the TCB is placed elsewhere. */
|
/* The DTV is allocated at the TP; the TCB is placed elsewhere. */
|
||||||
# define TLS_DTV_AT_TP 1
|
# define TLS_DTV_AT_TP 1
|
||||||
# define TLS_TCB_AT_TP 0
|
# define TLS_TCB_AT_TP 0
|
||||||
|
|||||||
@@ -53,20 +53,15 @@ typedef struct
|
|||||||
pointer, we don't need this. */
|
pointer, we don't need this. */
|
||||||
# define TLS_INIT_TCB_SIZE 0
|
# define TLS_INIT_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. Because our TCB is before the thread
|
/* This is the size of the TCB. Because our TCB is before the thread
|
||||||
pointer, we don't need this. */
|
pointer, we don't need this. */
|
||||||
# define TLS_TCB_SIZE 0
|
# define TLS_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size we need before TCB - actually, it includes the TCB. */
|
/* This is the size we need before TCB - actually, it includes the TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE \
|
# define TLS_PRE_TCB_SIZE \
|
||||||
(sizeof (struct pthread) \
|
(sizeof (struct pthread) \
|
||||||
+ ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
|
+ ((sizeof (tcbhead_t) + __alignof (struct pthread) - 1) \
|
||||||
|
& ~(__alignof (struct pthread) - 1)))
|
||||||
|
|
||||||
/* The thread pointer (TP) points to the end of the
|
/* The thread pointer (TP) points to the end of the
|
||||||
TCB + 0x7000, as for PowerPC and MIPS. This implies that TCB address is
|
TCB + 0x7000, as for PowerPC and MIPS. This implies that TCB address is
|
||||||
|
|||||||
@@ -29,20 +29,12 @@
|
|||||||
# include <mach.h>
|
# include <mach.h>
|
||||||
# include <atomic.h>
|
# include <atomic.h>
|
||||||
|
|
||||||
|
|
||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE TLS_INIT_TCB_SIZE /* XXX */
|
# define TLS_TCB_SIZE TLS_INIT_TCB_SIZE /* XXX */
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN TLS_INIT_TCB_ALIGN /* XXX */
|
|
||||||
|
|
||||||
|
|
||||||
/* Install the dtv pointer. The pointer passed is to the element with
|
/* Install the dtv pointer. The pointer passed is to the element with
|
||||||
index -1 which contain the length. */
|
index -1 which contain the length. */
|
||||||
# define INSTALL_DTV(descr, dtvp) \
|
# define INSTALL_DTV(descr, dtvp) \
|
||||||
|
|||||||
@@ -56,18 +56,12 @@ typedef struct
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* This is the size we need before TCB. */
|
/* This is the size we need before TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* Install the dtv pointer. The pointer passed is to the element with
|
/* Install the dtv pointer. The pointer passed is to the element with
|
||||||
index -1 which contain the length. */
|
index -1 which contain the length. */
|
||||||
# define INSTALL_DTV(tcbp, dtvp) \
|
# define INSTALL_DTV(tcbp, dtvp) \
|
||||||
|
|||||||
@@ -83,20 +83,15 @@ typedef struct
|
|||||||
pointer, we don't need this. */
|
pointer, we don't need this. */
|
||||||
# define TLS_INIT_TCB_SIZE 0
|
# define TLS_INIT_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. Because our TCB is before the thread
|
/* This is the size of the TCB. Because our TCB is before the thread
|
||||||
pointer, we don't need this. */
|
pointer, we don't need this. */
|
||||||
# define TLS_TCB_SIZE 0
|
# define TLS_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size we need before TCB - actually, it includes the TCB. */
|
/* This is the size we need before TCB - actually, it includes the TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE \
|
# define TLS_PRE_TCB_SIZE \
|
||||||
(sizeof (struct pthread) \
|
(sizeof (struct pthread) \
|
||||||
+ ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
|
+ ((sizeof (tcbhead_t) + __alignof (struct pthread) - 1) \
|
||||||
|
& ~(__alignof (struct pthread) - 1)))
|
||||||
|
|
||||||
/* The thread pointer (in hardware register $29) points to the end of
|
/* The thread pointer (in hardware register $29) points to the end of
|
||||||
the TCB + 0x7000, as for PowerPC. The pthread_descr structure is
|
the TCB + 0x7000, as for PowerPC. The pthread_descr structure is
|
||||||
|
|||||||
@@ -59,20 +59,15 @@ register struct pthread *__thread_self __asm__("r23");
|
|||||||
pointer, we don't need this. */
|
pointer, we don't need this. */
|
||||||
# define TLS_INIT_TCB_SIZE 0
|
# define TLS_INIT_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. Because our TCB is before the thread
|
/* This is the size of the TCB. Because our TCB is before the thread
|
||||||
pointer, we don't need this. */
|
pointer, we don't need this. */
|
||||||
# define TLS_TCB_SIZE 0
|
# define TLS_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size we need before TCB - actually, it includes the TCB. */
|
/* This is the size we need before TCB - actually, it includes the TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE \
|
# define TLS_PRE_TCB_SIZE \
|
||||||
(sizeof (struct pthread) \
|
(sizeof (struct pthread) \
|
||||||
+ ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
|
+ ((sizeof (tcbhead_t) + __alignof (struct pthread) - 1) \
|
||||||
|
& ~(__alignof (struct pthread) - 1)))
|
||||||
|
|
||||||
/* The thread pointer (in hardware register r23) points to the end of
|
/* The thread pointer (in hardware register r23) points to the end of
|
||||||
the TCB + 0x7000, as for PowerPC and MIPS. */
|
the TCB + 0x7000, as for PowerPC and MIPS. */
|
||||||
|
|||||||
@@ -108,19 +108,14 @@ typedef struct
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE 0
|
# define TLS_INIT_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE 0
|
# define TLS_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size we need before TCB. */
|
/* This is the size we need before TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE \
|
# define TLS_PRE_TCB_SIZE \
|
||||||
(sizeof (struct pthread) \
|
(sizeof (struct pthread) \
|
||||||
+ ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
|
+ ((sizeof (tcbhead_t) + __alignof (struct pthread) - 1) \
|
||||||
|
& ~(__alignof (struct pthread) - 1)))
|
||||||
|
|
||||||
/* The following assumes that TP (R2 or R13) points to the end of the
|
/* The following assumes that TP (R2 or R13) points to the end of the
|
||||||
TCB + 0x7000 (per the ABI). This implies that TCB address is
|
TCB + 0x7000 (per the ABI). This implies that TCB address is
|
||||||
|
|||||||
@@ -50,20 +50,15 @@ typedef struct
|
|||||||
pointer, we don't need this. */
|
pointer, we don't need this. */
|
||||||
# define TLS_INIT_TCB_SIZE 0
|
# define TLS_INIT_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. Because our TCB is before the thread
|
/* This is the size of the TCB. Because our TCB is before the thread
|
||||||
pointer, we don't need this. */
|
pointer, we don't need this. */
|
||||||
# define TLS_TCB_SIZE 0
|
# define TLS_TCB_SIZE 0
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size we need before TCB - actually, it includes the TCB. */
|
/* This is the size we need before TCB - actually, it includes the TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE \
|
# define TLS_PRE_TCB_SIZE \
|
||||||
(sizeof (struct pthread) \
|
(sizeof (struct pthread) \
|
||||||
+ ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
|
+ ((sizeof (tcbhead_t) + __alignof (struct pthread) - 1) \
|
||||||
|
& ~(__alignof (struct pthread) - 1)))
|
||||||
|
|
||||||
/* The thread pointer tp points to the end of the TCB.
|
/* The thread pointer tp points to the end of the TCB.
|
||||||
The pthread_descr structure is immediately in front of the TCB. */
|
The pthread_descr structure is immediately in front of the TCB. */
|
||||||
|
|||||||
@@ -66,15 +66,9 @@ typedef struct
|
|||||||
struct pthread even when not linked with -lpthread. */
|
struct pthread even when not linked with -lpthread. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (struct pthread)
|
# define TLS_INIT_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (struct pthread)
|
# define TLS_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* The TCB can have any size and the memory following the address the
|
/* The TCB can have any size and the memory following the address the
|
||||||
thread pointer points to is unspecified. Allocate the TCB there. */
|
thread pointer points to is unspecified. Allocate the TCB there. */
|
||||||
# define TLS_TCB_AT_TP 1
|
# define TLS_TCB_AT_TP 1
|
||||||
|
|||||||
@@ -51,18 +51,12 @@ typedef struct
|
|||||||
/* This is the size of the initial TCB. */
|
/* This is the size of the initial TCB. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
# define TLS_TCB_SIZE sizeof (tcbhead_t)
|
||||||
|
|
||||||
/* This is the size we need before TCB. */
|
/* This is the size we need before TCB. */
|
||||||
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* The TLS blocks start right after the TCB. */
|
/* The TLS blocks start right after the TCB. */
|
||||||
# define TLS_DTV_AT_TP 1
|
# define TLS_DTV_AT_TP 1
|
||||||
# define TLS_TCB_AT_TP 0
|
# define TLS_TCB_AT_TP 0
|
||||||
|
|||||||
@@ -63,15 +63,9 @@ register struct pthread *__thread_self __asm__("%g7");
|
|||||||
struct pthread even when not linked with -lpthread. */
|
struct pthread even when not linked with -lpthread. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (struct pthread)
|
# define TLS_INIT_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (struct pthread)
|
# define TLS_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* The TCB can have any size and the memory following the address the
|
/* The TCB can have any size and the memory following the address the
|
||||||
thread pointer points to is unspecified. Allocate the TCB there. */
|
thread pointer points to is unspecified. Allocate the TCB there. */
|
||||||
# define TLS_TCB_AT_TP 1
|
# define TLS_TCB_AT_TP 1
|
||||||
|
|||||||
@@ -106,15 +106,9 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
|
|||||||
struct pthread even when not linked with -lpthread. */
|
struct pthread even when not linked with -lpthread. */
|
||||||
# define TLS_INIT_TCB_SIZE sizeof (struct pthread)
|
# define TLS_INIT_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the initial TCB. */
|
|
||||||
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* This is the size of the TCB. */
|
/* This is the size of the TCB. */
|
||||||
# define TLS_TCB_SIZE sizeof (struct pthread)
|
# define TLS_TCB_SIZE sizeof (struct pthread)
|
||||||
|
|
||||||
/* Alignment requirements for the TCB. */
|
|
||||||
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
|
||||||
|
|
||||||
/* The TCB can have any size and the memory following the address the
|
/* The TCB can have any size and the memory following the address the
|
||||||
thread pointer points to is unspecified. Allocate the TCB there. */
|
thread pointer points to is unspecified. Allocate the TCB there. */
|
||||||
# define TLS_TCB_AT_TP 1
|
# define TLS_TCB_AT_TP 1
|
||||||
|
|||||||
Reference in New Issue
Block a user