aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic/libc-tls.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-05 01:21:25 +0000
committerRoland McGrath <roland@gnu.org>2002-08-05 01:21:25 +0000
commita816b435dd0b8dde7dc2f8d995bd290998801317 (patch)
tree07a52658122b19c7a08eacba7eaeb01cdc39b741 /sysdeps/generic/libc-tls.c
parent581dc54b74e8131acbb06f7ebb8887815f1914c8 (diff)
downloadglibc-a816b435dd0b8dde7dc2f8d995bd290998801317.tar
glibc-a816b435dd0b8dde7dc2f8d995bd290998801317.tar.gz
glibc-a816b435dd0b8dde7dc2f8d995bd290998801317.tar.bz2
glibc-a816b435dd0b8dde7dc2f8d995bd290998801317.zip
* Makerules (cpp-srcs-left): When setting this to run
cppflags-iterator.mk, must append .c to $(tests) and $(xtests) words. Combine the two loops into one on the concatenated list, including those as well as $(test-srcs). * elf/dl-minimal.c (__libc_memalign): Guts of malloc moved here, since we align here with optimally minimal waste anyway. (malloc): Just call that. * sysdeps/generic/libc-tls.c (__libc_setup_tls): Set l_tls_offset to the right variable. * elf/dl-load.c (_dl_map_object_from_fd): Use p_vaddr, not p_offset, to compute memory location for l_tls_initimage. * elf/rtld.c (_dl_start): Likewise. * sysdeps/generic/libc-tls.c (__libc_setup_tls): Likewise. * libio/oldiopopen.c: Move #include's before #if SHLIB_COMPAT, because the .d file is generated in the non-shared case and so fails to catch them otherwise. * sysdeps/generic/dl-tls.c (_dl_allocate_tls_storage): New function, split out of _dl_allocate_tls. (_dl_allocate_tls_init): Likewise. (_dl_allocate_tls): Call those. * sysdeps/generic/ldsodefs.h: Declare them with attribute_hidden. * elf/rtld.c (dl_main): Call them separately instead of calling _dl_allocate_tls. Delay _dl_allocate_tls_init until after relocation is finished, so that the initializer data has been relocated before we copy it into the main thread's TLS block. * sysdeps/generic/dl-tls.c (_dl_allocate_tls): Fix off-by-one error in loop conditions, prevented the last used module from being initialized.
Diffstat (limited to 'sysdeps/generic/libc-tls.c')
-rw-r--r--sysdeps/generic/libc-tls.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c
index 8c82040b19..6b9a746dd8 100644
--- a/sysdeps/generic/libc-tls.c
+++ b/sysdeps/generic/libc-tls.c
@@ -52,7 +52,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
void *tlsblock;
size_t memsz = 0;
size_t filesz = 0;
- off_t offset = 0;
+ size_t initimage = 0;
size_t align = 0;
size_t max_align = tcbalign;
size_t loadaddr = ~0ul;
@@ -70,7 +70,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
/* Remember the values we need. */
memsz = phdr->p_memsz;
filesz = phdr->p_filesz;
- offset = phdr->p_offset;
+ initimage = phdr->p_vaddr;
align = phdr->p_align;
if (phdr->p_align > max_align)
max_align = phdr->p_align;
@@ -120,7 +120,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
- memset (__mempcpy (static_dtv[2].pointer, (char *) loadaddr + offset,
+ memset (__mempcpy (static_dtv[2].pointer, (char *) loadaddr + initimage,
filesz),
'\0', memsz - filesz);
@@ -141,12 +141,12 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
# endif
/* We have to create a fake link map which normally would be created
- by the dynamic linker. It just has to have enough informatino to
+ by the dynamic linker. It just has to have enough information to
make the TLS routines happy. */
static_map.l_tls_align = align;
static_map.l_tls_blocksize = memsz;
static_map.l_tls_initimage_size = filesz;
- static_map.l_tls_offset = offset;
+ static_map.l_tls_offset = tcb_offset;
static_map.l_type = lt_executable;
static_map.l_tls_modid = 1;