diff options
Diffstat (limited to 'nptl/allocatestack.c')
-rw-r--r-- | nptl/allocatestack.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 7f6094ebb2..2a5ac22117 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -1173,13 +1173,18 @@ 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 - /* Fill in the DTV slot so that a later LD/GD access will find it. */ - 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); + + /* 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; + } void |