mirror of git://sourceware.org/git/glibc.git
* sysdeps/generic/libc-tls.c (static_dtv): Size the same as the
slotinfo array. (__libc_setup_tls_): Initializer length of DTV based on array length. * elf/dl-load.c: Revert last change. * sysdeps/generic/dl-tls.c: Revert last change.
This commit is contained in:
parent
f9ab9ba9ab
commit
094d3c54ae
|
|
@ -1,5 +1,11 @@
|
||||||
2005-02-22 Ulrich Drepper <drepper@redhat.com>
|
2005-02-22 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/generic/libc-tls.c (static_dtv): Size the same as the
|
||||||
|
slotinfo array.
|
||||||
|
(__libc_setup_tls_): Initializer length of DTV based on array length.
|
||||||
|
* elf/dl-load.c: Revert last change.
|
||||||
|
* sysdeps/generic/dl-tls.c: Revert last change.
|
||||||
|
|
||||||
* posix/Makefile (tests): Add tst-execvp1, tst-execvp2, tst-execlp1,
|
* posix/Makefile (tests): Add tst-execvp1, tst-execvp2, tst-execlp1,
|
||||||
tst-execlp2, tst-execv1, tst-execv2, tst-execl1, tst-execl2,
|
tst-execlp2, tst-execv1, tst-execv2, tst-execl1, tst-execl2,
|
||||||
tst-execve1, tst-execve2, tst-execle1, and tst-execle2.
|
tst-execve1, tst-execve2, tst-execle1, and tst-execle2.
|
||||||
|
|
|
||||||
|
|
@ -1056,7 +1056,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||||
|
|
||||||
case PT_TLS:
|
case PT_TLS:
|
||||||
#ifdef USE_TLS
|
#ifdef USE_TLS
|
||||||
# ifdef SHARED
|
|
||||||
if (ph->p_memsz == 0)
|
if (ph->p_memsz == 0)
|
||||||
/* Nothing to do for an empty segment. */
|
/* Nothing to do for an empty segment. */
|
||||||
break;
|
break;
|
||||||
|
|
@ -1084,6 +1083,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef SHARED
|
||||||
if (l->l_prev == NULL || (mode & __RTLD_AUDIT) != 0)
|
if (l->l_prev == NULL || (mode & __RTLD_AUDIT) != 0)
|
||||||
/* We are loading the executable itself when the dynamic linker
|
/* We are loading the executable itself when the dynamic linker
|
||||||
was executed directly. The setup will happen later. */
|
was executed directly. The setup will happen later. */
|
||||||
|
|
@ -1092,6 +1092,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||||
/* In a static binary there is no way to tell if we dynamically
|
/* In a static binary there is no way to tell if we dynamically
|
||||||
loaded libpthread. */
|
loaded libpthread. */
|
||||||
if (GL(dl_error_catch_tsd) == &_dl_initial_error_catch_tsd)
|
if (GL(dl_error_catch_tsd) == &_dl_initial_error_catch_tsd)
|
||||||
|
# endif
|
||||||
{
|
{
|
||||||
/* We have not yet loaded libpthread.
|
/* We have not yet loaded libpthread.
|
||||||
We can do the TLS setup right now! */
|
We can do the TLS setup right now! */
|
||||||
|
|
@ -1124,12 +1125,6 @@ cannot allocate TLS data structures for initial thread");
|
||||||
_dl_deallocate_tls (tcb, 1);
|
_dl_deallocate_tls (tcb, 1);
|
||||||
goto call_lose;
|
goto call_lose;
|
||||||
}
|
}
|
||||||
# else
|
|
||||||
errval = EINVAL;
|
|
||||||
errstring = N_("\
|
|
||||||
statically linked code cannot load module with TLS");
|
|
||||||
goto call_lose;
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Uh-oh, the binary expects TLS support but we cannot
|
/* Uh-oh, the binary expects TLS support but we cannot
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ oom (void)
|
||||||
{
|
{
|
||||||
_dl_fatal_printf ("cannot allocate memory for thread-local data: ABORT\n");
|
_dl_fatal_printf ("cannot allocate memory for thread-local data: ABORT\n");
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
|
@ -97,7 +97,6 @@ _dl_next_tls_modid (void)
|
||||||
/* The new index must indeed be exactly one higher than the
|
/* The new index must indeed be exactly one higher than the
|
||||||
previous high. */
|
previous high. */
|
||||||
assert (result == GL(dl_tls_max_dtv_idx) + 1);
|
assert (result == GL(dl_tls_max_dtv_idx) + 1);
|
||||||
|
|
||||||
/* There is no gap anymore. */
|
/* There is no gap anymore. */
|
||||||
GL(dl_tls_dtv_gaps) = false;
|
GL(dl_tls_dtv_gaps) = false;
|
||||||
|
|
||||||
|
|
@ -108,6 +107,7 @@ _dl_next_tls_modid (void)
|
||||||
{
|
{
|
||||||
/* No gaps, allocate a new entry. */
|
/* No gaps, allocate a new entry. */
|
||||||
nogaps:
|
nogaps:
|
||||||
|
|
||||||
result = ++GL(dl_tls_max_dtv_idx);
|
result = ++GL(dl_tls_max_dtv_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,6 +115,7 @@ _dl_next_tls_modid (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef SHARED
|
||||||
void
|
void
|
||||||
internal_function
|
internal_function
|
||||||
_dl_determine_tlsoffset (void)
|
_dl_determine_tlsoffset (void)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* Initialization code for TLS in statically linked application.
|
/* Initialization code for TLS in statically linked application.
|
||||||
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
|
@ -34,8 +34,7 @@ extern ElfW(Phdr) *_dl_phdr;
|
||||||
extern size_t _dl_phnum;
|
extern size_t _dl_phnum;
|
||||||
|
|
||||||
|
|
||||||
/* DTV with just one element plus overhead. */
|
static dtv_t static_dtv[2 + TLS_SLOTINFO_SURPLUS];
|
||||||
static dtv_t static_dtv[3];
|
|
||||||
|
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
|
|
@ -173,7 +172,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
|
||||||
& ~(max_align - 1));
|
& ~(max_align - 1));
|
||||||
|
|
||||||
/* Initialize the dtv. [0] is the length, [1] the generation counter. */
|
/* Initialize the dtv. [0] is the length, [1] the generation counter. */
|
||||||
static_dtv[0].counter = 1;
|
static_dtv[0].counter = (sizeof (static_dtv) / sizeof (static_dtv[0])) - 2;
|
||||||
// static_dtv[1].counter = 0; would be needed if not already done
|
// static_dtv[1].counter = 0; would be needed if not already done
|
||||||
|
|
||||||
/* Initialize the TLS block. */
|
/* Initialize the TLS block. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue