about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-12-03 01:51:07 +0000
committerRoland McGrath <roland@gnu.org>2002-12-03 01:51:07 +0000
commit2d14868942150183adaf0bc80b8ed6b70b65261e (patch)
tree6f1aea1c1f443244ed6a0883ddf276c01232381d /elf/rtld.c
parentf87277f2cdbfde84d4b82687a62e6eb8fd2222f9 (diff)
downloadglibc-2d14868942150183adaf0bc80b8ed6b70b65261e.tar.gz
glibc-2d14868942150183adaf0bc80b8ed6b70b65261e.tar.xz
glibc-2d14868942150183adaf0bc80b8ed6b70b65261e.zip
* elf/tst-tls4.c: Define an unused TLS variable here, so that no lazy
	TLS setup is required.
	* elf/tst-tls5.c: Likewise.
	* elf/tst-tls6.c: Likewise.
	* elf/tst-tls7.c: Likewise.
	* elf/tst-tls8.c: Likewise.
	* elf/tst-tls9.c: Likewise.

	* elf/rtld.c (dl_main): Remove [! SHARED] conditional from
	`if (GL(dl_tls_max_dtv_idx) > 0)' tests for doing TLS setup.
	* elf/dl-close.c (libc_freeres_fn): Check GL(dl_tls_dtv_slotinfo_list)
	for being null before calling free_slotinfo.
	* elf/dl-load.c (_dl_map_object_from_fd) [SHARED]: For PT_TLS in
	dynamic loading, bail with error if GL(dl_tls_max_dtv_idx) is zero.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 350cc700b5..6e20e15fff 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1139,12 +1139,14 @@ of this helper program; chances are you did not intend to run this program.\n\
     /* Assign a module ID.  */
     GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid ();
 
-# ifndef SHARED
-  /* If dynamic loading of modules with TLS is impossible we do not
-     have to initialize any of the TLS functionality unless any of the
-     initial modules uses TLS.  */
+  /* We do not initialize any of the TLS functionality unless any of the
+     initial modules uses TLS.  This makes dynamic loading of modules with
+     TLS impossible, but to support it requires either eagerly doing setup
+     now or lazily doing it later.  Doing it now makes us incompatible with
+     an old kernel that can't perform TLS_INIT_TP, even if no TLS is ever
+     used.  Trying to do it lazily is too hairy to try when there could be
+     multiple threads (from a non-TLS-using libpthread).  */
   if (GL(dl_tls_max_dtv_idx) > 0)
-# endif
     {
       struct link_map *l;
       size_t nelem;
@@ -1555,9 +1557,7 @@ cannot allocate TLS data structures for initial thread");
   GL(dl_initial_searchlist) = *GL(dl_main_searchlist);
 
 #ifdef USE_TLS
-# ifndef SHARED
-  if (GL(dl_tls_max_dtv_idx) > 0)
-# endif
+  if (GL(dl_tls_max_dtv_idx) > 0 || USE___THREAD)
     {
       /* Now that we have completed relocation, the initializer data
 	 for the TLS blocks has its final values and we can copy them