From 99fe3b0e7a0a9d72152cc86df0571c231c83cae4 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 24 Jul 2003 20:07:00 +0000 Subject: Update. 2003-07-24 Ulrich Drepper * include/link.h (struct link_map): Add l_tls_firstbyte_offset field. * sysdeps/generic/dl-tls.c [TLS_TCB_AT_TP] (_dl_determine_tlsoffset): Fix calculation of offsets to take misalignment of first byte in file into account. * elf/dl-load.c (_dl_map_object_from_fd): Initialize l_tls_firstbyte_offset field. * elf/rtld.c (_dl_start_final, _dl_start, dl_main): Likewise. * elf/dl-reloc.c (_dl_allocate_static_tls): Change return type to int. Take l_tls_firstbyte_offset information into account. (CHECK_STATIS_TLS): _dl_allocate_static_tls can fail now. * sysdeps/generic/ldsodefs.h: Adjust _dl_allocate_static_tls prototype. * elf/Makefile: Add rules to build and run tst-tls14. * elf/tst-tls14.c: New file. * elf/tst-tlsmod14a.c: New file. * elf/tst-tlsmod14b.c: New file. --- elf/dl-load.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'elf/dl-load.c') diff --git a/elf/dl-load.c b/elf/dl-load.c index f3c9e82423..249ef84639 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -987,6 +987,10 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, l->l_tls_blocksize = ph->p_memsz; l->l_tls_align = ph->p_align; + if (ph->p_align == 0) + l->l_tls_firstbyte_offset = 0; + else + l->l_tls_firstbyte_offset = ph->p_vaddr & (ph->p_align - 1); l->l_tls_initimage_size = ph->p_filesz; /* Since we don't know the load address yet only store the offset. We will adjust it later. */ -- cgit v1.2.3