about summary refs log tree commit diff
path: root/sysdeps/generic/dl-tls.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-11 00:57:37 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-11 00:57:37 +0000
commita330abe2cd2b8cf8dd78ba82dadeab725b41adae (patch)
tree2df0840f0ede5a3a99cb9b28cada76956fe6cd9a /sysdeps/generic/dl-tls.c
parent03af57939c7216333e000f5e45eae99a99cc5444 (diff)
downloadglibc-a330abe2cd2b8cf8dd78ba82dadeab725b41adae.tar.gz
glibc-a330abe2cd2b8cf8dd78ba82dadeab725b41adae.tar.xz
glibc-a330abe2cd2b8cf8dd78ba82dadeab725b41adae.zip
Update.
	* sysdeps/generic/dl-tls.c (_dl_determine_tlsoffset): More changes
	required by passing pointer to last element of the list.

	* elf/dl-load.c (_dl_map_object_from_fd): Move adjustment of
	l_tls_initimage to a place where it actually is performed.

	* elf/tls-macros.h: ...here.  New file.
Diffstat (limited to 'sysdeps/generic/dl-tls.c')
-rw-r--r--sysdeps/generic/dl-tls.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
index 2c5fa75b62..e42911acd3 100644
--- a/sysdeps/generic/dl-tls.c
+++ b/sysdeps/generic/dl-tls.c
@@ -79,16 +79,16 @@ _dl_next_tls_modid (void)
 
 void
 internal_function
-_dl_determine_tlsoffset (struct link_map *firstp)
+_dl_determine_tlsoffset (struct link_map *lastp)
 {
-  struct link_map *runp = firstp;
+  struct link_map *runp;
   size_t max_align = 0;
   size_t offset;
 
-  if (GL(dl_initimage_list) == NULL)
+  if (lastp == NULL)
     {
       /* None of the objects used at startup time uses TLS.  We still
-	 have to allocate the TCB adn dtv.  */
+	 have to allocate the TCB and dtv.  */
       GL(dl_tls_static_size) = TLS_TCB_SIZE;
       GL(dl_tls_static_align) = TLS_TCB_ALIGN;
 
@@ -99,6 +99,7 @@ _dl_determine_tlsoffset (struct link_map *firstp)
   /* We simply start with zero.  */
   offset = 0;
 
+  runp = lastp->l_tls_nextimage;
   do
     {
       max_align = MAX (max_align, runp->l_tls_align);
@@ -110,7 +111,7 @@ _dl_determine_tlsoffset (struct link_map *firstp)
 	 negative offset.  */
       runp->l_tls_offset = offset;
     }
-  while ((runp = runp->l_tls_nextimage) != firstp);
+  while ((runp = runp->l_tls_nextimage) != lastp->l_tls_nextimage);
 
 #if 0
   /* The thread descriptor (pointed to by the thread pointer) has its
@@ -126,27 +127,28 @@ _dl_determine_tlsoffset (struct link_map *firstp)
 
   GL(dl_tls_static_size) = offset + TLS_TCB_SIZE;
 # elif TLS_DTV_AT_TP
-  struct link_map *lastp;
+  struct link_map *prevp;
 
   /* The first block starts right after the TCB.  */
   offset = TLS_TCB_SIZE;
   max_align = runp->l_tls_align;
+  runp = lastp->l_tls_nextimage;
   runp->l_tls_offset = offset;
-  lastp = runp;
+  prevp = runp;
 
   while ((runp = runp->l_tls_nextimage) != firstp)
     {
       max_align = MAX (max_align, runp->l_tls_align);
 
       /* Compute the offset of the next TLS block.  */
-      offset = roundup (offset + lastp->l_tls_blocksize, runp->l_tls_align);
+      offset = roundup (offset + prevp->l_tls_blocksize, runp->l_tls_align);
 
       runp->l_tls_offset = offset;
 
-      lastp = runp;
+      prevp = runp;
     }
 
-  GL(dl_tls_static_size) = offset + lastp->l_tls_blocksize;
+  GL(dl_tls_static_size) = offset + prevp->l_tls_blocksize;
 # else
 #  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
 # endif