summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--elf/dl-close.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 619ce644f5..d9c38d2b68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-09  Carlos O'Donell  <carlos@redhat.com>
+
+	* elf/dl-close.c (_dl_close_worker): Add comments.
+
 2013-05-09  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #15359]
diff --git a/elf/dl-close.c b/elf/dl-close.c
index c86f609402..fe3014cca3 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -183,6 +183,8 @@ _dl_close_worker (struct link_map *map)
       /* Mark all dependencies as used.  */
       if (l->l_initfini != NULL)
 	{
+	  /* We are always the zeroth entry, and since we don't include
+	     ourselves in the dependency analysis start at 1.  */
 	  struct link_map **lp = &l->l_initfini[1];
 	  while (*lp != NULL)
 	    {
@@ -193,6 +195,10 @@ _dl_close_worker (struct link_map *map)
 		  if (!used[(*lp)->l_idx])
 		    {
 		      used[(*lp)->l_idx] = 1;
+		      /* If we marked a new object as used, and we've
+			 already processed it, then we need to go back
+			 and process again from that point forward to
+			 ensure we keep all of its dependencies also.  */
 		      if ((*lp)->l_idx - 1 < done_index)
 			done_index = (*lp)->l_idx - 1;
 		    }