about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-04-01 00:26:36 +0000
committerUlrich Drepper <drepper@redhat.com>2009-04-01 00:26:36 +0000
commit22c8319345a279e22cf17aa5f9aa851a2b4091c2 (patch)
treea98c574aaecffb284a8087bd0228dc641ffbcd81 /elf/dl-close.c
parent20739e5454c12acbc0479387fe795c5b19a4166f (diff)
downloadglibc-22c8319345a279e22cf17aa5f9aa851a2b4091c2.tar.gz
glibc-22c8319345a279e22cf17aa5f9aa851a2b4091c2.tar.xz
glibc-22c8319345a279e22cf17aa5f9aa851a2b4091c2.zip
* elf/dl-open.c: Keep track of used name spaces and only iterate over cvs/fedora-glibc-20090401T0935
	those which are used.
	* elf/dl-addr.c: Likewise.
	* elf/dl-caller.c: Likewise.
	* elf/dl-fini.c: Likewise.
	* elf/dl-iteratephdr.c: Likewise.
	* elf/dl-libc.c: Likewise.
	* elf/dl-load.c: Likewise.
	* elf/dl-support.c: Likewise.
	* elf/dl-sym.c: Likewise.
	* elf/rtld.c: Likewise.
	* sysdeps/generic/ldsodefs.h: Likewise.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 46f1a40adc..b73a7adb1a 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -1,5 +1,5 @@
 /* Close a shared object opened by `_dl_open'.
-   Copyright (C) 1996-2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1996-2007, 2009 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
@@ -695,6 +695,18 @@ _dl_close_worker (struct link_map *map)
     }
 #endif
 
+  if (__builtin_expect (ns->_ns_loaded == NULL, 0)
+      && nsid == GL(dl_nns) - 1)
+    do
+      {
+	--GL(dl_nns);
+#ifndef SHARED
+	if (GL(dl_nns) == 0)
+	  break;
+#endif
+      }
+    while (GL(dl_ns)[GL(dl_nns) - 1]._ns_loaded == NULL);
+
   /* Notify the debugger those objects are finalized and gone.  */
   r->r_state = RT_CONSISTENT;
   _dl_debug_state ();
@@ -763,7 +775,7 @@ free_slotinfo (struct dtv_slotinfo_list **elemp)
 
 libc_freeres_fn (free_mem)
 {
-  for (Lmid_t nsid = 0; nsid < DL_NNS; ++nsid)
+  for (Lmid_t nsid = 0; nsid < GL(dl_nns); ++nsid)
     if (__builtin_expect (GL(dl_ns)[nsid]._ns_global_scope_alloc, 0) != 0
 	&& (GL(dl_ns)[nsid]._ns_main_searchlist->r_nlist
 	    // XXX Check whether we need NS-specific initial_searchlist