[BACK]Return to tls.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / tls

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libc/tls/tls.c between version 1.8 and 1.9

version 1.8, 2014/12/14 23:49:17 version 1.9, 2018/07/13 19:50:21
Line 45  __RCSID("$NetBSD$");
Line 45  __RCSID("$NetBSD$");
 #include <sys/mman.h>  #include <sys/mman.h>
 #include <link_elf.h>  #include <link_elf.h>
 #include <lwp.h>  #include <lwp.h>
   #include <stdbool.h>
 #include <stddef.h>  #include <stddef.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
Line 52  __RCSID("$NetBSD$");
Line 53  __RCSID("$NetBSD$");
   
 __dso_hidden void       __libc_static_tls_setup(void);  __dso_hidden void       __libc_static_tls_setup(void);
   
   static bool is_dynamic;
 static const void *tls_initaddr;  static const void *tls_initaddr;
 static size_t tls_initsize;  static size_t tls_initsize;
 static size_t tls_size;  static size_t tls_size;
Line 131  _rtld_tls_free(struct tls_tcb *tcb)
Line 133  _rtld_tls_free(struct tls_tcb *tcb)
                 free(p);                  free(p);
 }  }
   
 __weakref_visible int rtld_DYNAMIC __weak_reference(_DYNAMIC);  
   
 static int __section(".text.startup")  static int __section(".text.startup")
 __libc_static_tls_setup_cb(struct dl_phdr_info *data, size_t len, void *cookie)  __libc_static_tls_setup_cb(struct dl_phdr_info *data, size_t len, void *cookie)
 {  {
Line 140  __libc_static_tls_setup_cb(struct dl_phd
Line 140  __libc_static_tls_setup_cb(struct dl_phd
         const Elf_Phdr *phlimit = data->dlpi_phdr + data->dlpi_phnum;          const Elf_Phdr *phlimit = data->dlpi_phdr + data->dlpi_phnum;
   
         for (; phdr < phlimit; ++phdr) {          for (; phdr < phlimit; ++phdr) {
                   if (phdr->p_type == PT_INTERP) {
                           is_dynamic = true;
                           return -1;
                   }
                 if (phdr->p_type != PT_TLS)                  if (phdr->p_type != PT_TLS)
                         continue;                          continue;
                 tls_initaddr = (void *)(phdr->p_vaddr + data->dlpi_addr);                  tls_initaddr = (void *)(phdr->p_vaddr + data->dlpi_addr);
Line 154  __libc_static_tls_setup(void)
Line 158  __libc_static_tls_setup(void)
 {  {
         struct tls_tcb *tcb;          struct tls_tcb *tcb;
   
         if (&rtld_DYNAMIC != NULL) {  
                 return;  
         }  
   
         dl_iterate_phdr(__libc_static_tls_setup_cb, NULL);          dl_iterate_phdr(__libc_static_tls_setup_cb, NULL);
           if (is_dynamic)
                   return;
   
         tcb = _rtld_tls_allocate();          tcb = _rtld_tls_allocate();
 #ifdef __HAVE___LWP_SETTCB  #ifdef __HAVE___LWP_SETTCB

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

CVSweb <webmaster@jp.NetBSD.org>