about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2011-02-17 13:41:34 +0100
committerAndreas Schwab <schwab@redhat.com>2011-03-02 16:26:36 +0100
commit29686f94f65772e72c28a41d1438bc9b37909d19 (patch)
treed515610dc8c5100a5c3c2fca81c4fe4d69f85ef8 /elf
parent8d24af9c83ec810872bf46a4ff8c3d415c84d8d2 (diff)
downloadglibc-29686f94f65772e72c28a41d1438bc9b37909d19.tar.gz
glibc-29686f94f65772e72c28a41d1438bc9b37909d19.tar.xz
glibc-29686f94f65772e72c28a41d1438bc9b37909d19.zip
Fix false assertion
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-deps.c85
1 files changed, 44 insertions, 41 deletions
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index d3c27f14cc..9e30594838 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -623,55 +623,58 @@ Filters not supported with LD_TRACE_PRELINKING"));
 
   /* We can skip looking for the binary itself which is at the front
      of the search list.  */
-  assert (nlist > 1);
-  i = 1;
-  bool seen[nlist];
-  memset (seen, false, nlist * sizeof (seen[0]));
-  while (1)
+  if (nlist > 1)
     {
-      /* Keep track of which object we looked at this round.  */
-      seen[i] = true;
-      struct link_map *thisp = l_initfini[i];
-
-      /* Find the last object in the list for which the current one is
-	 a dependency and move the current object behind the object
-	 with the dependency.  */
-      unsigned int k = nlist - 1;
-      while (k > i)
+      i = 1;
+      bool seen[nlist];
+      memset (seen, false, nlist * sizeof (seen[0]));
+      while (1)
 	{
-	  struct link_map **runp = l_initfini[k]->l_initfini;
-	  if (runp != NULL)
-	    /* Look through the dependencies of the object.  */
-	    while (*runp != NULL)
-	      if (__builtin_expect (*runp++ == thisp, 0))
-		{
-		  /* Move the current object to the back past the last
-		     object with it as the dependency.  */
-		  memmove (&l_initfini[i], &l_initfini[i + 1],
-			   (k - i) * sizeof (l_initfini[0]));
-		  l_initfini[k] = thisp;
-
-		  if (seen[i + 1])
+	  /* Keep track of which object we looked at this round.  */
+	  seen[i] = true;
+	  struct link_map *thisp = l_initfini[i];
+
+	  /* Find the last object in the list for which the current one is
+	     a dependency and move the current object behind the object
+	     with the dependency.  */
+	  unsigned int k = nlist - 1;
+	  while (k > i)
+	    {
+	      struct link_map **runp = l_initfini[k]->l_initfini;
+	      if (runp != NULL)
+		/* Look through the dependencies of the object.  */
+		while (*runp != NULL)
+		  if (__builtin_expect (*runp++ == thisp, 0))
 		    {
-		      ++i;
-		      goto next_clear;
+		      /* Move the current object to the back past the last
+			 object with it as the dependency.  */
+		      memmove (&l_initfini[i], &l_initfini[i + 1],
+			       (k - i) * sizeof (l_initfini[0]));
+		      l_initfini[k] = thisp;
+
+		      if (seen[i + 1])
+			{
+			  ++i;
+			  goto next_clear;
+			}
+
+		      memmove (&seen[i], &seen[i + 1],
+			       (k - i) * sizeof (seen[0]));
+		      seen[k] = true;
+
+		      goto next;
 		    }
 
-		  memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
-		  seen[k] = true;
+	      --k;
+	    }
 
-		  goto next;
-		}
+	  if (++i == nlist)
+	    break;
+	next_clear:
+	  memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
 
-	  --k;
+	next:;
 	}
-
-      if (++i == nlist)
-	break;
-    next_clear:
-      memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
-
-    next:;
     }
 
   /* Terminate the list of dependencies.  */