summaryrefslogtreecommitdiffstats
path: root/libpthread/nptl/sysdeps/generic/libc-tls.c
diff options
context:
space:
mode:
authorAustin Foxley <austinf@cetoncorp.com>2009-09-23 09:55:03 -0700
committerAustin Foxley <austinf@cetoncorp.com>2009-09-23 09:56:04 -0700
commitd74b8a68d450072ee3c6e6b586d32ff38e88f840 (patch)
tree02981405617f4cf3e9366a8e8e88aae452cab797 /libpthread/nptl/sysdeps/generic/libc-tls.c
parent46348ce60a0005d8009349f09f80ca35669801b9 (diff)
downloaduClibc-alpine-d74b8a68d450072ee3c6e6b586d32ff38e88f840.tar.bz2
uClibc-alpine-d74b8a68d450072ee3c6e6b586d32ff38e88f840.tar.xz
tls: test for DTV vs TCB at TP correctly
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
Diffstat (limited to 'libpthread/nptl/sysdeps/generic/libc-tls.c')
-rw-r--r--libpthread/nptl/sysdeps/generic/libc-tls.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libpthread/nptl/sysdeps/generic/libc-tls.c b/libpthread/nptl/sysdeps/generic/libc-tls.c
index d302d31c9..b78d96483 100644
--- a/libpthread/nptl/sysdeps/generic/libc-tls.c
+++ b/libpthread/nptl/sysdeps/generic/libc-tls.c
@@ -146,10 +146,10 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
The initialized value of _dl_tls_static_size is provided by dl-open.c
to request some surplus that permits dynamic loading of modules with
IE-model TLS. */
-# if TLS_TCB_AT_TP
+# if defined(TLS_TCB_AT_TP)
tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
tlsblock = sbrk (tcb_offset + tcbsize + max_align);
-# elif TLS_DTV_AT_TP
+# elif defined(TLS_DTV_AT_TP)
tcb_offset = roundup (tcbsize, align ?: 1);
tlsblock = sbrk (tcb_offset + memsz + max_align
+ TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
@@ -169,11 +169,11 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
// static_dtv[1].counter = 0; would be needed if not already done
/* Initialize the TLS block. */
-# if TLS_TCB_AT_TP
+# if defined(TLS_TCB_AT_TP)
static_dtv[2].pointer.val = ((char *) tlsblock + tcb_offset
- roundup (memsz, align ?: 1));
static_map.l_tls_offset = roundup (memsz, align ?: 1);
-# elif TLS_DTV_AT_TP
+# elif defined(TLS_DTV_AT_TP)
static_dtv[2].pointer.val = (char *) tlsblock + tcb_offset;
static_map.l_tls_offset = tcb_offset;
# else
@@ -186,11 +186,11 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
/* Install the pointer to the dtv. */
/* Initialize the thread pointer. */
-# if TLS_TCB_AT_TP
+# if defined(TLS_TCB_AT_TP)
INSTALL_DTV ((char *) tlsblock + tcb_offset, static_dtv);
const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset, 0);
-# elif TLS_DTV_AT_TP
+# elif defined(TLS_DTV_AT_TP)
INSTALL_DTV (tlsblock, static_dtv);
const char *lossage = (char *)TLS_INIT_TP (tlsblock, 0);
# else
@@ -214,9 +214,9 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
memsz = roundup (memsz, align ?: 1);
-# if TLS_TCB_AT_TP
+# if defined(TLS_TCB_AT_TP)
memsz += tcbsize;
-# elif TLS_DTV_AT_TP
+# elif defined(TLS_DTV_AT_TP)
memsz += tcb_offset;
# endif
@@ -232,7 +232,7 @@ _dl_tls_setup (void)
{
init_slotinfo ();
init_static_tls (
-# if TLS_TCB_AT_TP
+# if defined(TLS_TCB_AT_TP)
TLS_TCB_SIZE,
# else
0,