summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index cab8c87d..d91dcee 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -3151,13 +3151,13 @@ allocate_tls(Obj_Entry *objs, void *oldtcb, size_t tcbsize, size_t tcbalign)
dtv[1] = tls_max_index;
for (obj = objs; obj; obj = obj->next) {
- if (obj->tlsoffset) {
+ if (obj->tlsoffset > 0) {
addr = (Elf_Addr)tls + obj->tlsoffset;
- memset((void*) (addr + obj->tlsinitsize),
- 0, obj->tlssize - obj->tlsinitsize);
- if (obj->tlsinit)
- memcpy((void*) addr, obj->tlsinit,
- obj->tlsinitsize);
+ if (obj->tlsinitsize > 0)
+ memcpy((void*) addr, obj->tlsinit, obj->tlsinitsize);
+ if (obj->tlssize > obj->tlsinitsize)
+ memset((void*) (addr + obj->tlsinitsize), 0,
+ obj->tlssize - obj->tlsinitsize);
dtv[obj->tlsindex + 1] = addr;
}
}
@@ -3357,21 +3357,18 @@ allocate_tls_offset(Obj_Entry *obj)
void
free_tls_offset(Obj_Entry *obj)
{
-#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \
- defined(__arm__) || defined(__mips__)
+
/*
* If we were the last thing to allocate out of the static TLS
* block, we give our space back to the 'allocator'. This is a
* simplistic workaround to allow libGL.so.1 to be loaded and
- * unloaded multiple times. We only handle the Variant II
- * mechanism for now - this really needs a proper allocator.
+ * unloaded multiple times.
*/
if (calculate_tls_end(obj->tlsoffset, obj->tlssize)
== calculate_tls_end(tls_last_offset, tls_last_size)) {
tls_last_offset -= obj->tlssize;
tls_last_size = 0;
}
-#endif
}
void *
OpenPOWER on IntegriCloud