about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-24 19:18:25 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-24 19:18:25 +0000
commit2e93b4a4cd190fc8d21682f69a5455dc6dcd04dd (patch)
tree827aaf2c600f898f308661d5bbbcd66cc7f7cb63 /elf/dl-close.c
parent8edd9172533488545e7e088e0c3bc02f9ef36bee (diff)
downloadglibc-2e93b4a4cd190fc8d21682f69a5455dc6dcd04dd.tar.gz
glibc-2e93b4a4cd190fc8d21682f69a5455dc6dcd04dd.tar.xz
glibc-2e93b4a4cd190fc8d21682f69a5455dc6dcd04dd.zip
Update.
	* elf/dl-deps.c (_dl_map_object_deps): Put l_initfini array before
	r_list array in allocated memory.
	* elf/dl-close.c (_dl_close): Optimize access to l_initfini list
	and remove use of r_list.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 4ee5c1b9bb..db11d3b50a 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -86,7 +86,7 @@ _dl_close (void *_map)
       return;
     }
 
-  list = map->l_searchlist.r_list;
+  list = map->l_initfini;
   nsearchlist = map->l_searchlist.r_nlist;
 
   /* Compute the new l_opencount values.  */
@@ -94,23 +94,23 @@ _dl_close (void *_map)
 					   * sizeof (unsigned int));
   for (i = 0; i < nsearchlist; ++i)
     {
-      map->l_initfini[i]->l_idx = i;
-      new_opencount[i] = map->l_initfini[i]->l_opencount;
+      list[i]->l_idx = i;
+      new_opencount[i] = list[i]->l_opencount;
     }
   --new_opencount[0];
   for (i = 1; i < nsearchlist; ++i)
-    if (! (map->l_initfini[i]->l_flags_1 & DF_1_NODELETE)
+    if (! (list[i]->l_flags_1 & DF_1_NODELETE)
 	/* Decrement counter.  */
 	&& --new_opencount[i] == 0
 	/* Test whether this object was also loaded directly.  */
-	&& map->l_initfini[i]->l_searchlist.r_list != NULL)
+	&& list[i]->l_searchlist.r_list != NULL)
       {
 	/* In this case we have the decrement all the dependencies of
            this object.  They are all in MAP's dependency list.  */
 	unsigned int j;
-	struct link_map **dep_list = map->l_initfini[i]->l_searchlist.r_list;
+	struct link_map **dep_list = list[i]->l_searchlist.r_list;
 
-	for (j = 1; j < map->l_initfini[i]->l_searchlist.r_nlist; ++j)
+	for (j = 1; j < list[i]->l_searchlist.r_nlist; ++j)
 	  if (! (dep_list[j]->l_flags_1 & DF_1_NODELETE))
 	    {
 	      assert (dep_list[j]->l_idx < nsearchlist);
@@ -125,7 +125,7 @@ _dl_close (void *_map)
   /* Call all termination functions at once.  */
   for (i = 0; i < nsearchlist; ++i)
     {
-      struct link_map *imap = map->l_initfini[i];
+      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)
@@ -235,12 +235,7 @@ _dl_close (void *_map)
 
 	  /* Remove the searchlists.  */
 	  if (imap != map)
-	    {
-	      if (imap->l_searchlist.r_list != NULL)
-		free (imap->l_searchlist.r_list);
-	      else
-		free (imap->l_initfini);
-	    }
+	      free (imap->l_initfini);
 
 	  if (imap->l_phdr_allocated)
 	    free ((void *) imap->l_phdr);