about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/dl-tls.c5
-rw-r--r--sysdeps/generic/libc-tls.c7
2 files changed, 6 insertions, 6 deletions
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
index ee4acb5a64..fdd569b587 100644
--- a/sysdeps/generic/dl-tls.c
+++ b/sysdeps/generic/dl-tls.c
@@ -49,7 +49,7 @@ oom (void)
 {
   _dl_fatal_printf ("cannot allocate memory for thread-local data: ABORT\n");
 }
-
+# endif
 
 
 size_t
@@ -97,7 +97,6 @@ _dl_next_tls_modid (void)
 	  /* The new index must indeed be exactly one higher than the
 	     previous high.  */
 	  assert (result == GL(dl_tls_max_dtv_idx) + 1);
-
 	  /* There is no gap anymore.  */
 	  GL(dl_tls_dtv_gaps) = false;
 
@@ -108,6 +107,7 @@ _dl_next_tls_modid (void)
     {
       /* No gaps, allocate a new entry.  */
     nogaps:
+
       result = ++GL(dl_tls_max_dtv_idx);
     }
 
@@ -115,6 +115,7 @@ _dl_next_tls_modid (void)
 }
 
 
+# ifdef SHARED
 void
 internal_function
 _dl_determine_tlsoffset (void)
diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c
index b88ede06a2..0cf884ca08 100644
--- a/sysdeps/generic/libc-tls.c
+++ b/sysdeps/generic/libc-tls.c
@@ -1,5 +1,5 @@
 /* Initialization code for TLS in statically linked application.
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -34,8 +34,7 @@ extern ElfW(Phdr) *_dl_phdr;
 extern size_t _dl_phnum;
 
 
-/* DTV with just one element plus overhead.  */
-static dtv_t static_dtv[3];
+static dtv_t static_dtv[2 + TLS_SLOTINFO_SURPLUS];
 
 
 static struct
@@ -173,7 +172,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
 		       & ~(max_align - 1));
 
   /* Initialize the dtv.  [0] is the length, [1] the generation counter.  */
-  static_dtv[0].counter = 1;
+  static_dtv[0].counter = (sizeof (static_dtv) / sizeof (static_dtv[0])) - 2;
   // static_dtv[1].counter = 0;		would be needed if not already done
 
   /* Initialize the TLS block.  */