From 299601a1ef8df4532ded24194c4556e294ab1e6e Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 25 Apr 2003 09:12:43 +0000 Subject: Update. 2003-04-22 Jakub Jelinek * include/link.h (NO_TLS_OFFSET): Define to 0 if not defined. * elf/dl-close.c (_dl_close): Use NO_TLS_OFFSET. * elf/dl-object.c (_dl_new_object): Initialize l_tls_offset to NO_TLS_OFFSET. * elf/rtld.c (_dl_start_final, _dl_start): Likewise. * elf/dl-reloc.c (CHECK_STATIC_TLS): Use NO_TLS_OFFSET. * sysdeps/generic/dl-tls.c (_dl_allocate_tls_init): Likewise. * sysdeps/powerpc/dl-tls.h (TLS_TPREL_VALUE): Don't subtract TLS_TCB_SIZE. --- elf/dl-close.c | 2 +- elf/dl-object.c | 4 ++++ elf/dl-reloc.c | 2 +- elf/rtld.c | 7 +++++++ 4 files changed, 13 insertions(+), 2 deletions(-) (limited to 'elf') diff --git a/elf/dl-close.c b/elf/dl-close.c index 5a61ad0..1e6dd12 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -365,7 +365,7 @@ _dl_close (void *_map) /* All dynamically loaded modules with TLS are unloaded. */ GL(dl_tls_max_dtv_idx) = GL(dl_tls_static_nelem); - if (imap->l_tls_offset != 0) + if (imap->l_tls_offset != NO_TLS_OFFSET) { /* Collect a contiguous chunk built from the objects in this search list, going in either direction. When the diff --git a/elf/dl-object.c b/elf/dl-object.c index 6196cd7..a33b40a 100644 --- a/elf/dl-object.c +++ b/elf/dl-object.c @@ -53,6 +53,10 @@ _dl_new_object (char *realname, const char *libname, int type, new->l_name = realname; new->l_type = type; new->l_loader = loader; +#if defined USE_TLS && NO_TLS_OFFSET != 0 + new->l_tls_offset = NO_TLS_OFFSET; +#endif + /* new->l_global = 0; We use calloc therefore not necessary. */ /* Use the 'l_scope_mem' array by default for the the 'l_scope' diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c index 5d8dc0d..c7f1f34 100644 --- a/elf/dl-reloc.c +++ b/elf/dl-reloc.c @@ -209,7 +209,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], intended to produce. */ #define CHECK_STATIC_TLS(map, sym_map) \ do { \ - if (__builtin_expect ((sym_map)->l_tls_offset == 0, 0)) \ + if (__builtin_expect ((sym_map)->l_tls_offset == NO_TLS_OFFSET, 0)) \ _dl_allocate_static_tls (sym_map); \ } while (0) diff --git a/elf/rtld.c b/elf/rtld.c index bd66149..9d2a94c 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -233,6 +233,9 @@ _dl_start_final (void *arg, struct dl_start_final_info *info) GL(dl_rtld_map).l_tls_modid = 1; # else assert (info->l.l_tls_modid == 0); +# if NO_TLS_OFFSET != 0 + GL(dl_rtld_map).l_tls_offset = NO_TLS_OFFSET; +# endif # endif #endif @@ -316,6 +319,10 @@ _dl_start (void *arg) bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic (); elf_get_dynamic_info (&bootstrap_map); +#if defined USE_TLS && NO_TLS_OFFSET != 0 + bootstrap_map.l_tls_offset = NO_TLS_OFFSET; +#endif + #if USE___THREAD /* Get the dynamic linker's own program header. First we need the ELF file header. The `_begin' symbol created by the linker script points -- cgit v1.1