summaryrefslogtreecommitdiff
path: root/libpthread
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread')
-rw-r--r--libpthread/nptl/allocatestack.c5
-rw-r--r--libpthread/nptl/sysdeps/arc/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/arm/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/csky/dl-tls.h2
-rw-r--r--libpthread/nptl/sysdeps/generic/dl-tls.c2
-rw-r--r--libpthread/nptl/sysdeps/i386/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/metag/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/microblaze/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/mips/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/or1k/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/powerpc/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/riscv32/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/riscv64/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/sh/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/sparc/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/m68k/bits/pthreadtypes.h18
-rw-r--r--libpthread/nptl/sysdeps/x86_64/dl-tls.h3
-rw-r--r--libpthread/nptl/sysdeps/xtensa/dl-tls.h3
18 files changed, 58 insertions, 11 deletions
diff --git a/libpthread/nptl/allocatestack.c b/libpthread/nptl/allocatestack.c
index 7ef884543..941ef22f0 100644
--- a/libpthread/nptl/allocatestack.c
+++ b/libpthread/nptl/allocatestack.c
@@ -24,6 +24,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include <sys/param.h>
+#include <dl-tls.h>
#include <tls.h>
#include <lowlevellock.h>
#include <link.h>
@@ -241,6 +242,10 @@ get_cached_stack (size_t *sizep, void **memp)
/* Clear the DTV. */
dtv_t *dtv = GET_DTV (TLS_TPADJ (result));
+ for (size_t cnt = 0; cnt < dtv[-1].counter; ++cnt)
+ if (! dtv[1 + cnt].pointer.is_static
+ && dtv[1 + cnt].pointer.val != TLS_DTV_UNALLOCATED)
+ free (dtv[1 + cnt].pointer.val);
memset (dtv, '\0', (dtv[-1].counter + 1) * sizeof (dtv_t));
/* Re-initialize the TLS. */
diff --git a/libpthread/nptl/sysdeps/arc/dl-tls.h b/libpthread/nptl/sysdeps/arc/dl-tls.h
index 34e54e4d3..e81c0c187 100644
--- a/libpthread/nptl/sysdeps/arc/dl-tls.h
+++ b/libpthread/nptl/sysdeps/arc/dl-tls.h
@@ -26,3 +26,6 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/arm/dl-tls.h b/libpthread/nptl/sysdeps/arm/dl-tls.h
index a728455e4..a79ea7160 100644
--- a/libpthread/nptl/sysdeps/arm/dl-tls.h
+++ b/libpthread/nptl/sysdeps/arm/dl-tls.h
@@ -26,3 +26,6 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/csky/dl-tls.h b/libpthread/nptl/sysdeps/csky/dl-tls.h
index ebf1a7dc3..7171d47ea 100644
--- a/libpthread/nptl/sysdeps/csky/dl-tls.h
+++ b/libpthread/nptl/sysdeps/csky/dl-tls.h
@@ -14,3 +14,5 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti);
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/generic/dl-tls.c b/libpthread/nptl/sysdeps/generic/dl-tls.c
index 7d25e4706..7b7991be8 100644
--- a/libpthread/nptl/sysdeps/generic/dl-tls.c
+++ b/libpthread/nptl/sysdeps/generic/dl-tls.c
@@ -45,8 +45,6 @@
to allow dynamic loading of modules defining IE-model TLS data. */
# define TLS_STATIC_SURPLUS 64 + DL_NNS * 100
-/* Value used for dtv entries for which the allocation is delayed. */
-# define TLS_DTV_UNALLOCATED ((void *) -1l)
#ifndef SHARED
extern dtv_t static_dtv;
diff --git a/libpthread/nptl/sysdeps/i386/dl-tls.h b/libpthread/nptl/sysdeps/i386/dl-tls.h
index 32495c1e0..004082407 100644
--- a/libpthread/nptl/sysdeps/i386/dl-tls.h
+++ b/libpthread/nptl/sysdeps/i386/dl-tls.h
@@ -59,3 +59,6 @@ strong_alias (___tls_get_addr, ___tls_get_addr_internal)
# endif
#endif
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/metag/dl-tls.h b/libpthread/nptl/sysdeps/metag/dl-tls.h
index 81632e057..811d6254f 100644
--- a/libpthread/nptl/sysdeps/metag/dl-tls.h
+++ b/libpthread/nptl/sysdeps/metag/dl-tls.h
@@ -26,3 +26,6 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/microblaze/dl-tls.h b/libpthread/nptl/sysdeps/microblaze/dl-tls.h
index 5613e21e2..ded8714bd 100644
--- a/libpthread/nptl/sysdeps/microblaze/dl-tls.h
+++ b/libpthread/nptl/sysdeps/microblaze/dl-tls.h
@@ -24,3 +24,6 @@ typedef struct
} tls_index;
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/mips/dl-tls.h b/libpthread/nptl/sysdeps/mips/dl-tls.h
index e26aa388b..63ec2bc00 100644
--- a/libpthread/nptl/sysdeps/mips/dl-tls.h
+++ b/libpthread/nptl/sysdeps/mips/dl-tls.h
@@ -43,3 +43,6 @@ extern void *__tls_get_addr (tls_index *ti);
# define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
# define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/or1k/dl-tls.h b/libpthread/nptl/sysdeps/or1k/dl-tls.h
index 5613e21e2..ded8714bd 100644
--- a/libpthread/nptl/sysdeps/or1k/dl-tls.h
+++ b/libpthread/nptl/sysdeps/or1k/dl-tls.h
@@ -24,3 +24,6 @@ typedef struct
} tls_index;
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/powerpc/dl-tls.h b/libpthread/nptl/sysdeps/powerpc/dl-tls.h
index c322ade60..ae50098c7 100644
--- a/libpthread/nptl/sysdeps/powerpc/dl-tls.h
+++ b/libpthread/nptl/sysdeps/powerpc/dl-tls.h
@@ -46,3 +46,6 @@ extern void *__tls_get_addr (tls_index *ti);
# define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
# define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
#endif
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/riscv32/dl-tls.h b/libpthread/nptl/sysdeps/riscv32/dl-tls.h
index 31991be0d..4124b7c78 100644
--- a/libpthread/nptl/sysdeps/riscv32/dl-tls.h
+++ b/libpthread/nptl/sysdeps/riscv32/dl-tls.h
@@ -32,3 +32,6 @@ extern void *__tls_get_addr (tls_index *ti);
#define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
#define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/riscv64/dl-tls.h b/libpthread/nptl/sysdeps/riscv64/dl-tls.h
index 31991be0d..4124b7c78 100644
--- a/libpthread/nptl/sysdeps/riscv64/dl-tls.h
+++ b/libpthread/nptl/sysdeps/riscv64/dl-tls.h
@@ -32,3 +32,6 @@ extern void *__tls_get_addr (tls_index *ti);
#define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
#define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/sh/dl-tls.h b/libpthread/nptl/sysdeps/sh/dl-tls.h
index f5f90beaf..e0d13eec4 100644
--- a/libpthread/nptl/sysdeps/sh/dl-tls.h
+++ b/libpthread/nptl/sysdeps/sh/dl-tls.h
@@ -26,3 +26,6 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/sparc/dl-tls.h b/libpthread/nptl/sysdeps/sparc/dl-tls.h
index 7d9e8f0f7..aac9d5b30 100644
--- a/libpthread/nptl/sysdeps/sparc/dl-tls.h
+++ b/libpthread/nptl/sysdeps/sparc/dl-tls.h
@@ -26,3 +26,6 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/m68k/bits/pthreadtypes.h b/libpthread/nptl/sysdeps/unix/sysv/linux/m68k/bits/pthreadtypes.h
index 2a90a0b90..d2f22caee 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/m68k/bits/pthreadtypes.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/m68k/bits/pthreadtypes.h
@@ -39,7 +39,7 @@ typedef unsigned long int pthread_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_ATTR_T];
- long int __align;
+ long int __align __attribute__((__aligned__(4)));
} pthread_attr_t;
@@ -69,13 +69,13 @@ typedef union
};
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
- long int __align;
+ long int __align __attribute__((__aligned__(4)));
} pthread_mutex_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
- long int __align;
+ long int __align __attribute__((__aligned__(4)));
} pthread_mutexattr_t;
@@ -95,13 +95,13 @@ typedef union
unsigned int __broadcast_seq;
} __data;
char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
+ __extension__ long long int __align __attribute__((__aligned__(8)));
} pthread_cond_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
- long int __align;
+ long int __align __attribute__((__aligned__(4)));
} pthread_condattr_t;
@@ -144,13 +144,13 @@ typedef union
int __writer;
} __data;
char __size[__SIZEOF_PTHREAD_RWLOCK_T];
- long int __align;
+ long int __align __attribute__((__aligned__(4)));
} pthread_rwlock_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
- long int __align;
+ long int __align __attribute__((__aligned__(4)));
} pthread_rwlockattr_t;
#endif
@@ -165,13 +165,13 @@ typedef volatile int pthread_spinlock_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIER_T];
- long int __align;
+ long int __align __attribute__((__aligned__(4)));
} pthread_barrier_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
- int __align;
+ int __align __attribute__((__aligned__(4)));
} pthread_barrierattr_t;
#endif
diff --git a/libpthread/nptl/sysdeps/x86_64/dl-tls.h b/libpthread/nptl/sysdeps/x86_64/dl-tls.h
index d6c338cda..5cac55f33 100644
--- a/libpthread/nptl/sysdeps/x86_64/dl-tls.h
+++ b/libpthread/nptl/sysdeps/x86_64/dl-tls.h
@@ -26,3 +26,6 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/libpthread/nptl/sysdeps/xtensa/dl-tls.h b/libpthread/nptl/sysdeps/xtensa/dl-tls.h
index 5fc4ea2d0..dfc91753e 100644
--- a/libpthread/nptl/sysdeps/xtensa/dl-tls.h
+++ b/libpthread/nptl/sysdeps/xtensa/dl-tls.h
@@ -70,3 +70,6 @@ extern ptrdiff_t attribute_hidden
_dl_tlsdesc_dynamic(struct tlsdesc_dynamic_arg *);
#endif
#endif
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)