about summary refs log tree commit diff
path: root/elf/dl-tls.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-17 09:59:14 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-17 10:17:41 +0200
commit9dc21009a47300f62b2a1fd9fec2270a21bd7c3d (patch)
tree3346d2857b8616a5b979ad145851f37dda0c470d /elf/dl-tls.c
parent0b3e92bdf3c11e8ca3271beb03ff16b87c23ed7f (diff)
downloadglibc-9dc21009a47300f62b2a1fd9fec2270a21bd7c3d.tar.gz
glibc-9dc21009a47300f62b2a1fd9fec2270a21bd7c3d.tar.xz
glibc-9dc21009a47300f62b2a1fd9fec2270a21bd7c3d.zip
elf: Move static TLS size and alignment into _rtld_global_ro
This helps to clarify that the caching of these fields in libpthread
(in __static_tls_size, __static_tls_align_m1) is unnecessary.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/dl-tls.c')
-rw-r--r--elf/dl-tls.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 67781bc108..91031c2b72 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -300,9 +300,9 @@ _dl_determine_tlsoffset (void)
     }
 
   GL(dl_tls_static_used) = offset;
-  GL(dl_tls_static_size) = (roundup (offset + GLRO(dl_tls_static_surplus),
-				     max_align)
-			    + TLS_TCB_SIZE);
+  GLRO (dl_tls_static_size) = (roundup (offset + GLRO(dl_tls_static_surplus),
+					max_align)
+			       + TLS_TCB_SIZE);
 #elif TLS_DTV_AT_TP
   /* The TLS blocks start right after the TCB.  */
   size_t offset = TLS_TCB_SIZE;
@@ -345,14 +345,14 @@ _dl_determine_tlsoffset (void)
     }
 
   GL(dl_tls_static_used) = offset;
-  GL(dl_tls_static_size) = roundup (offset + GLRO(dl_tls_static_surplus),
-				    TLS_TCB_ALIGN);
+  GLRO (dl_tls_static_size) = roundup (offset + GLRO(dl_tls_static_surplus),
+				       TLS_TCB_ALIGN);
 #else
 # error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
 #endif
 
   /* The alignment requirement for the static TLS block.  */
-  GL(dl_tls_static_align) = max_align;
+  GLRO (dl_tls_static_align) = max_align;
 }
 #endif /* SHARED */
 
@@ -391,8 +391,8 @@ allocate_dtv (void *result)
 void
 _dl_get_tls_static_info (size_t *sizep, size_t *alignp)
 {
-  *sizep = GL(dl_tls_static_size);
-  *alignp = GL(dl_tls_static_align);
+  *sizep = GLRO (dl_tls_static_size);
+  *alignp = GLRO (dl_tls_static_align);
 }
 
 /* Derive the location of the pointer to the start of the original
@@ -416,7 +416,7 @@ void *
 _dl_allocate_tls_storage (void)
 {
   void *result;
-  size_t size = GL(dl_tls_static_size);
+  size_t size = GLRO (dl_tls_static_size);
 
 #if TLS_DTV_AT_TP
   /* Memory layout is:
@@ -427,7 +427,7 @@ _dl_allocate_tls_storage (void)
 
   /* Perform the allocation.  Reserve space for the required alignment
      and the pointer to the original allocation.  */
-  size_t alignment = GL(dl_tls_static_align);
+  size_t alignment = GLRO (dl_tls_static_align);
   void *allocated = malloc (size + alignment + sizeof (void *));
   if (__glibc_unlikely (allocated == NULL))
     return NULL;
@@ -436,7 +436,7 @@ _dl_allocate_tls_storage (void)
 #if TLS_TCB_AT_TP
   /* The TCB follows the TLS blocks, which determine the alignment.
      (TCB alignment requirements have been taken into account when
-     calculating GL(dl_tls_static_align).)  */
+     calculating GLRO (dl_tls_static_align).)  */
   void *aligned = (void *) roundup ((uintptr_t) allocated, alignment);
   result = aligned + size - TLS_TCB_SIZE;