about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-07-07 07:41:02 +0000
committerUlrich Drepper <drepper@redhat.com>2004-07-07 07:41:02 +0000
commit8e5aaad9daee699404f00c79100dfd88781eedf5 (patch)
tree7de7e0dd00268b2960178cb21fb081735813df51 /elf
parente782376c013a8ef486e625b50895d78879a9141f (diff)
downloadglibc-8e5aaad9daee699404f00c79100dfd88781eedf5.tar.gz
glibc-8e5aaad9daee699404f00c79100dfd88781eedf5.tar.xz
glibc-8e5aaad9daee699404f00c79100dfd88781eedf5.zip
Update.
2004-07-07  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-fini.c (_dl_fini): Move the unlock of the ld.so lock
	before the loop running the destructors.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-fini.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index c34ee8ea1e..ca1cb8c476 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -126,6 +126,14 @@ _dl_fini (void)
 	}
     }
 
+  /* We do not rely on the linked list of loaded object anymore from
+     this point on.  We have our own list here (maps).  The various
+     members of this list cannot vanish since the open count is too
+     high and will be decremented in this loop.  So we release the
+     lock so that some code which might be called from a destructor
+     can directly or indirectly access the lock.  */
+  __rtld_lock_unlock_recursive (GL(dl_load_lock));
+
   /* 'maps' now contains the objects in the right order.  Now call the
      destructors.  We have to process this array from the front.  */
   for (i = 0; i < GL(dl_nloaded); ++i)
@@ -171,8 +179,6 @@ _dl_fini (void)
       --l->l_opencount;
     }
 
-  __rtld_lock_unlock_recursive (GL(dl_load_lock));
-
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0))
     _dl_debug_printf ("\nruntime linker statistics:\n"
 		      "           final number of relocations: %lu\n"