summary refs log tree commit diff
path: root/elf/dl-close.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/dl-close.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/dl-close.c')
-rw-r--r--elf/dl-close.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 632f8ba9fc..b5c2841d61 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -476,12 +476,15 @@ libc_freeres_fn (free_mem)
     }
 
 #ifdef USE_TLS
-  /* Free the memory allocated for the dtv slotinfo array.  We can do
-     this only if all modules which used this memory are unloaded.
-     Also, the first element of the list does not have to be
-     deallocated.  It was allocated in the dynamic linker (i.e., with
-     a different malloc).  */
-  if (free_slotinfo (GL(dl_tls_dtv_slotinfo_list)->next))
-    GL(dl_tls_dtv_slotinfo_list)->next = NULL;
+  if (USE___THREAD || GL(dl_tls_dtv_slotinfo_list) != NULL)
+    {
+      /* Free the memory allocated for the dtv slotinfo array.  We can do
+	 this only if all modules which used this memory are unloaded.
+	 Also, the first element of the list does not have to be
+	 deallocated.  It was allocated in the dynamic linker (i.e., with
+	 a different malloc).  */
+      if (free_slotinfo (GL(dl_tls_dtv_slotinfo_list)->next))
+	GL(dl_tls_dtv_slotinfo_list)->next = NULL;
+    }
 #endif
 }