diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2014-02-07 21:04:10 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2014-02-07 21:04:10 +0000 |
commit | 85f4cc52a11508e42daa5625283410e0d6f3a993 (patch) | |
tree | deca25a1076f1a24479cbca3bd7d162123fae742 /libc/nptl/allocatestack.c | |
parent | a1055d384d75c28f09a47c2d8628bc330f892955 (diff) | |
download | eglibc2-master.tar.gz |
git-svn-id: svn://svn.eglibc.org/trunk@25237 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/nptl/allocatestack.c')
-rw-r--r-- | libc/nptl/allocatestack.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libc/nptl/allocatestack.c b/libc/nptl/allocatestack.c index 2a5ac2211..13eca47cf 100644 --- a/libc/nptl/allocatestack.c +++ b/libc/nptl/allocatestack.c @@ -242,7 +242,11 @@ get_cached_stack (size_t *sizep, void **memp) /* Clear the DTV. */ dtv_t *dtv = GET_DTV (TLS_TPADJ (result)); - _dl_clear_dtv (dtv); + 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. */ _dl_allocate_tls_init (TLS_TPADJ (result)); @@ -1173,18 +1177,13 @@ init_one_static_tls (struct pthread *curp, struct link_map *map) # error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined" # endif - /* Initialize the memory. */ - memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size), - '\0', map->l_tls_blocksize - map->l_tls_initimage_size); - /* Fill in the DTV slot so that a later LD/GD access will find it. */ - dtv[map->l_tls_modid].pointer.is_static = true; - /* Pairs against the read barrier in tls_get_attr_tail, guaranteeing - any thread waiting for an update to pointer.val sees the - initimage write. */ - atomic_write_barrier (); dtv[map->l_tls_modid].pointer.val = dest; + dtv[map->l_tls_modid].pointer.is_static = true; + /* Initialize the memory. */ + memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size), + '\0', map->l_tls_blocksize - map->l_tls_initimage_size); } void |