* sysdeps/generic/libc-tls.c (__libc_setup_tls): Don't check for

PT_LOAD program headers and don't try to relocate PT_TLS's p_vaddr;
	it is already absolute.

	* elf/Makefile (tests): List tst-tls1 and tst-tls2 unconditionally.
	[$(build-static) = yes] (tests): Add tst-tls1-static, tst-tls2-static.
	[$(build-static) = yes] (tests-static): New variable.
	($(tests-static):%=$(objfpx)%.o)): New static pattern rule.
This commit is contained in:
Roland McGrath 2002-08-28 10:28:11 +00:00
parent db26531364
commit d10c64301e
2 changed files with 24 additions and 24 deletions

View File

@ -1,9 +1,19 @@
2002-08-28 Roland McGrath <roland@redhat.com>
* sysdeps/generic/libc-tls.c (__libc_setup_tls): Don't check for
PT_LOAD program headers and don't try to relocate PT_TLS's p_vaddr;
it is already absolute.
* elf/Makefile (tests): List tst-tls1 and tst-tls2 unconditionally.
[$(build-static) = yes] (tests): Add tst-tls1-static, tst-tls2-static.
[$(build-static) = yes] (tests-static): New variable.
($(tests-static):%=$(objfpx)%.o)): New static pattern rule.
2002-08-26 Christoph Hellwig <hch@lst.de> 2002-08-26 Christoph Hellwig <hch@lst.de>
* sysdeps/unix/sysv/linux/sys/personality.h: Remark origin, fix * sysdeps/unix/sysv/linux/sys/personality.h: Remark origin, fix
formating braindamage, add missing PER_HPUX and PER_OSF1 values. formating braindamage, add missing PER_HPUX and PER_OSF1 values.
2002-08-28 Ulrich Drepper <drepper@redhat.com> 2002-08-28 Ulrich Drepper <drepper@redhat.com>
* sysdeps/x86_64/Dist: Add _mcount.S and bits/link.h. * sysdeps/x86_64/Dist: Add _mcount.S and bits/link.h.

View File

@ -59,35 +59,26 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
void *tlsblock; void *tlsblock;
size_t memsz = 0; size_t memsz = 0;
size_t filesz = 0; size_t filesz = 0;
size_t initimage = 0; void *initimage = NULL;
size_t align = 0; size_t align = 0;
size_t max_align = tcbalign; size_t max_align = tcbalign;
size_t loadaddr = ~0ul;
size_t tcb_offset; size_t tcb_offset;
ElfW(Phdr) *phdr; ElfW(Phdr) *phdr;
/* Look through the TLS segment if there is any. */ /* Look through the TLS segment if there is any. */
if (_dl_phdr != NULL) if (_dl_phdr != NULL)
for (phdr = _dl_phdr; phdr < &_dl_phdr[_dl_phnum]; ++phdr) for (phdr = _dl_phdr; phdr < &_dl_phdr[_dl_phnum]; ++phdr)
{ if (phdr->p_type == PT_TLS)
if (phdr->p_type == PT_TLS) {
{ /* Remember the values we need. */
/* Remember the values we need. */ memsz = phdr->p_memsz;
memsz = phdr->p_memsz; filesz = phdr->p_filesz;
filesz = phdr->p_filesz; initimage = (void *) phdr->p_vaddr;
initimage = phdr->p_vaddr; align = phdr->p_align;
align = phdr->p_align; if (phdr->p_align > max_align)
if (phdr->p_align > max_align) max_align = phdr->p_align;
max_align = phdr->p_align; break;
} }
else if (phdr->p_type == PT_LOAD)
{
/* We have to find the load address which is not easy.
Look for the load segment with the lowest address. */
if (phdr->p_vaddr < loadaddr)
loadaddr = phdr->p_vaddr;
}
}
if (memsz == 0 && tcbsize == 0) if (memsz == 0 && tcbsize == 0)
/* We do not need a TLS block and no thread descriptor. */ /* We do not need a TLS block and no thread descriptor. */
@ -125,8 +116,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
# else # else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined" # error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif # endif
memset (__mempcpy (static_dtv[2].pointer, (char *) loadaddr + initimage, memset (__mempcpy (static_dtv[2].pointer, initimage, filesz),
filesz),
'\0', memsz - filesz); '\0', memsz - filesz);
/* Install the pointer to the dtv. */ /* Install the pointer to the dtv. */