* 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.
This commit is contained in:
Roland McGrath 2002-10-22 06:22:53 +00:00
parent 6ef518c323
commit 8265947da0
4 changed files with 34 additions and 11 deletions

View File

@ -1,3 +1,22 @@
2002-10-21 Roland McGrath <roland@redhat.com>
* 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.
2002-10-21 Isamu Hasegawa <isamu@yamato.ibm.com> 2002-10-21 Isamu Hasegawa <isamu@yamato.ibm.com>
* posix/Makefile: Add a test case for the bug reported by Aharon * posix/Makefile: Add a test case for the bug reported by Aharon

View File

@ -44,9 +44,8 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
if (listp->next == NULL) if (listp->next == NULL)
{ {
/* The index is not actually valid in the slotinfo list, /* The index is not actually valid in the slotinfo list,
because this object was closed before it was fully setup because this object was closed before it was fully set
due to some error. */ up due to some error. */
assert (idx - disp == listp->len);
assert (! should_be_there); assert (! should_be_there);
} }
else else

View File

@ -378,17 +378,19 @@ dl_open_worker (void *a)
assert (new->l_searchlist.r_list[i]->l_type == lt_loaded); assert (new->l_searchlist.r_list[i]->l_type == lt_loaded);
/* Find the place in the stv slotinfo list. */ /* Find the place in the dtv slotinfo list. */
listp = GL(dl_tls_dtv_slotinfo_list); listp = GL(dl_tls_dtv_slotinfo_list);
prevp = NULL; /* Needed to shut up gcc. */ prevp = NULL; /* Needed to shut up gcc. */
do do
{ {
/* Does it fit in the array of this list element? */ /* Does it fit in the array of this list element? */
if (idx <= listp->len) if (idx < listp->len)
break; break;
idx -= listp->len;
prevp = listp; prevp = listp;
listp = listp->next;
} }
while ((listp = listp->next) != NULL); while (listp != NULL);
if (listp == NULL) if (listp == NULL)
{ {

View File

@ -39,10 +39,10 @@ static struct
{ {
struct dtv_slotinfo_list si; struct dtv_slotinfo_list si;
/* The dtv_slotinfo_list data structure does not include the actual /* The dtv_slotinfo_list data structure does not include the actual
informatin since it is defined as an array of size zero. We information since it is defined as an array of size zero. We define
define here the necessary entries. Not that it is not important here the necessary entries. Note that it is not important whether
whether there is padding or not since we will always access the there is padding or not since we will always access the information
informatin through the 'si' element. */ through the 'si' element. */
struct dtv_slotinfo info[2 + TLS_SLOTINFO_SURPLUS]; struct dtv_slotinfo info[2 + TLS_SLOTINFO_SURPLUS];
} static_slotinfo; } static_slotinfo;
@ -160,13 +160,16 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
make the TLS routines happy. */ make the TLS routines happy. */
static_map.l_tls_align = align; static_map.l_tls_align = align;
static_map.l_tls_blocksize = memsz; static_map.l_tls_blocksize = memsz;
static_map.l_tls_initimage = initimage;
static_map.l_tls_initimage_size = filesz; static_map.l_tls_initimage_size = filesz;
static_map.l_tls_offset = tcb_offset; static_map.l_tls_offset = tcb_offset;
static_map.l_type = lt_executable; static_map.l_type = lt_executable;
static_map.l_tls_modid = 1; static_map.l_tls_modid = 1;
/* Create the slotinfo list. */ /* 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.next = NULL; already zero
static_slotinfo.si.slotinfo[1].gen = 0; static_slotinfo.si.slotinfo[1].gen = 0;