about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/dl-tls.c2
-rw-r--r--sysdeps/generic/libc-start.c10
-rw-r--r--sysdeps/generic/libc-tls.c2
3 files changed, 12 insertions, 2 deletions
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
index 014c3a4809..850df8d76f 100644
--- a/sysdeps/generic/dl-tls.c
+++ b/sysdeps/generic/dl-tls.c
@@ -309,7 +309,7 @@ _dl_allocate_tls_init (void *result)
 	    /* Unused entry.  */
 	    continue;
 
-	  if (map->l_type == lt_loaded)
+	  if (map->l_tls_offset == 0)
 	    {
 	      /* For dynamically loaded modules we simply store
 		 the value indicating deferred allocation.  */
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
index ef02b1819f..5b2728b8ba 100644
--- a/sysdeps/generic/libc-start.c
+++ b/sysdeps/generic/libc-start.c
@@ -17,6 +17,7 @@
    02111-1307 USA.  */
 
 #include <stdlib.h>
+#include <stdio.h>
 #include <unistd.h>
 #include <ldsodefs.h>
 #include <bp-start.h>
@@ -29,6 +30,7 @@ extern void *__libc_stack_end;
 
 #include <tls.h>
 #ifndef SHARED
+# include <dl-osinfo.h>
 extern void __pthread_initialize_minimal (void)
 # if !(USE_TLS - 0)
      __attribute__ ((weak))
@@ -81,6 +83,14 @@ BP_SYM (__libc_start_main) (int (*main) (int, char **, char **),
   ++auxvec;
   _dl_aux_init ((ElfW(auxv_t) *) auxvec);
 # endif
+# ifdef DL_SYSDEP_OSCHECK
+  if (!__libc_multiple_libcs)
+    {
+      /* This needs to run to initiliaze _dl_osversion before TLS
+	 setup might check it.  */
+      DL_SYSDEP_OSCHECK (__libc_fatal);
+    }
+# endif
 
   /* Initialize the thread library at least a bit since the libgcc
      functions are using thread functions if these are available and
diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c
index 26fd6e09c9..a403e95065 100644
--- a/sysdeps/generic/libc-tls.c
+++ b/sysdeps/generic/libc-tls.c
@@ -102,7 +102,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
 	  break;
 	}
 
-  if (memsz == 0 && tcbsize == 0)
+  if (memsz == 0 && tcbsize <= TLS_INIT_TCB_SIZE)
     /* We do not need a TLS block and no thread descriptor.  */
     return;