about summary refs log tree commit diff
path: root/sysdeps/generic/libc-tls.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-10-22 06:22:53 +0000
committerRoland McGrath <roland@gnu.org>2002-10-22 06:22:53 +0000
commit8265947da0173ae415bed7123c64ad97bb2af1b5 (patch)
tree8ae3555f5b74d1824257f5a0b5d922235cc220ad /sysdeps/generic/libc-tls.c
parent6ef518c323c2bcdd8e633da3c0cd1f525f63c7d8 (diff)
downloadglibc-8265947da0173ae415bed7123c64ad97bb2af1b5.tar.gz
glibc-8265947da0173ae415bed7123c64ad97bb2af1b5.tar.xz
glibc-8265947da0173ae415bed7123c64ad97bb2af1b5.zip
* sysdeps/generic/libc-tls.c (__libc_setup_tls): Initialize the static
	slotinfo list's len member to the proper size, not just 1.
	Initialize static_map.l_tls_initimage.

	* elf/dl-open.c (dl_open_worker): Fix loop searching for
	dtv_slotinfo_list element containing new modules' l_tls_modid.

	* elf/tst-tls9.c, elf/tst-tls9-static.c: New files.
	* elf/tst-tlsmod5.c, elf/tst-tlsmod6.c: New files.
	* elf/Makefile (tests): Add tst-tls9.
	(tests-static): Add tst-tls9-static.
	(tst-tls9-static-ENV): New variable.
	($(objpfx)tst-tls9-static, $(objpfx)tst-tls9-static.out): New targets.

	* elf/dl-close.c (remove_slotinfo): Remove an assert; the number of
	modids used by partially loaded modules being closed can't be known.
Diffstat (limited to 'sysdeps/generic/libc-tls.c')
-rw-r--r--sysdeps/generic/libc-tls.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c
index df8dc2cbdc..92ea62fce4 100644
--- a/sysdeps/generic/libc-tls.c
+++ b/sysdeps/generic/libc-tls.c
@@ -39,10 +39,10 @@ static struct
 {
   struct dtv_slotinfo_list si;
   /* The dtv_slotinfo_list data structure does not include the actual
-     informatin since it is defined as an array of size zero.  We
-     define here the necessary entries.  Not that it is not important
-     whether there is padding or not since we will always access the
-     informatin through the 'si' element.  */
+     information since it is defined as an array of size zero.  We define
+     here the necessary entries.  Note that it is not important whether
+     there is padding or not since we will always access the information
+     through the 'si' element.  */
   struct dtv_slotinfo info[2 + TLS_SLOTINFO_SURPLUS];
 } static_slotinfo;
 
@@ -160,13 +160,16 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
      make the TLS routines happy.  */
   static_map.l_tls_align = align;
   static_map.l_tls_blocksize = memsz;
+  static_map.l_tls_initimage = initimage;
   static_map.l_tls_initimage_size = filesz;
   static_map.l_tls_offset = tcb_offset;
   static_map.l_type = lt_executable;
   static_map.l_tls_modid = 1;
 
   /* Create the slotinfo list.  */
-  static_slotinfo.si.len = 1;	/* Only one element.  */
+  static_slotinfo.si.len = (((char *) (&static_slotinfo + 1)
+			     - (char *) &static_slotinfo.si.slotinfo[0])
+			    / sizeof static_slotinfo.si.slotinfo[0]);
   // static_slotinfo.si.next = NULL;	already zero
 
   static_slotinfo.si.slotinfo[1].gen = 0;