about summary refs log tree commit diff
path: root/sysdeps/generic/libc-tls.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-02-23 06:19:23 +0000
committerUlrich Drepper <drepper@redhat.com>2005-02-23 06:19:23 +0000
commit094d3c54ae439a1dc83b6aa44caf81d54cab32e0 (patch)
tree958b93a2e38fd0c7962cdfa0d61f14c59ee91d3d /sysdeps/generic/libc-tls.c
parentf9ab9ba9aba6426845aca1731bd9d9fea089432c (diff)
downloadglibc-094d3c54ae439a1dc83b6aa44caf81d54cab32e0.tar.gz
glibc-094d3c54ae439a1dc83b6aa44caf81d54cab32e0.tar.xz
glibc-094d3c54ae439a1dc83b6aa44caf81d54cab32e0.zip
* sysdeps/generic/libc-tls.c (static_dtv): Size the same as the
	slotinfo array.
	(__libc_setup_tls_): Initializer length of DTV based on array length.
	* elf/dl-load.c: Revert last change.
	* sysdeps/generic/dl-tls.c: Revert last change.
Diffstat (limited to 'sysdeps/generic/libc-tls.c')
-rw-r--r--sysdeps/generic/libc-tls.c7
1 files changed, 3 insertions, 4 deletions
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.  */