about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-12-31 06:09:08 +0000
committerUlrich Drepper <drepper@redhat.com>2000-12-31 06:09:08 +0000
commitc77a447822c8ccc6866216bad737189fff3a0b93 (patch)
tree83529a631cd6887c71795711ce58620d57bf7d7b /elf/dl-close.c
parentd9af88677f42690b7ad4cacecc7f9b6a62fe50ce (diff)
downloadglibc-c77a447822c8ccc6866216bad737189fff3a0b93.tar.gz
glibc-c77a447822c8ccc6866216bad737189fff3a0b93.tar.xz
glibc-c77a447822c8ccc6866216bad737189fff3a0b93.zip
Update.
2000-12-30  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-close.c (_dl_close): We can ignore the NODELETE flag if the
	object was not yet initialized.

2000-12-28  H.J. Lu  <hjl@gnu.org>

	* elf/dl-deps.c (_dl_map_object_deps): Make sure the DSO state
	is always consistent even if its dependency is failed.

	* elf/dl-open.c (_dl_open): Increment the open count before
	calling _dl_close () in case of failure.

	* elf/neededtest4.c: New file.
	* elf/neededobj5.c: New file.
	* elf/neededobj6.c: New file.

	* elf/Makefile (distribute): Add neededobj5.c and neededobj6.c.
	(tests): Add neededtest4.
	(modules-names): Add neededobj5 and neededobj6.
	($(objpfx)neededobj6.so): New target.
	($(objpfx)neededtest4): New target.
	($(objpfx)neededtest4.out): New target.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 6c17593a52..cd4e44eef4 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -55,7 +55,7 @@ _dl_close (void *_map)
   unsigned int *new_opencount;
 
   /* First see whether we can remove the object at all.  */
-  if (map->l_flags_1 & DF_1_NODELETE)
+  if ((map->l_flags_1 & DF_1_NODELETE) && map->l_init_called)
     /* Nope.  Do nothing.  */
     return;
 
@@ -101,7 +101,7 @@ _dl_close (void *_map)
     }
   --new_opencount[0];
   for (i = 1; list[i] != NULL; ++i)
-    if (! (list[i]->l_flags_1 & DF_1_NODELETE)
+    if ((! (list[i]->l_flags_1 & DF_1_NODELETE) || ! list[i]->l_init_called)
 	/* Decrement counter.  */
 	&& --new_opencount[i] == 0
 	/* Test whether this object was also loaded directly.  */
@@ -113,7 +113,8 @@ _dl_close (void *_map)
 	struct link_map **dep_list = list[i]->l_searchlist.r_list;
 
 	for (j = 1; j < list[i]->l_searchlist.r_nlist; ++j)
-	  if (! (dep_list[j]->l_flags_1 & DF_1_NODELETE))
+	  if (! (dep_list[j]->l_flags_1 & DF_1_NODELETE)
+	      || ! dep_list[j]->l_init_called)
 	    {
 	      assert (dep_list[j]->l_idx < map->l_searchlist.r_nlist);
 	      --new_opencount[dep_list[j]->l_idx];
@@ -127,7 +128,7 @@ _dl_close (void *_map)
       struct link_map *imap = list[i];
       if (new_opencount[i] == 0 && imap->l_type == lt_loaded
 	  && (imap->l_info[DT_FINI] || imap->l_info[DT_FINI_ARRAY])
-	  && ! (imap->l_flags_1 & DF_1_NODELETE)
+	  && (! (imap->l_flags_1 & DF_1_NODELETE) || ! imap->l_init_called)
 	  /* Skip any half-cooked objects that were never initialized.  */
 	  && imap->l_init_called)
 	{