Submitted By: DJ Lucas <dj_AT_linuxfromscratch_DOT_org>
Date: 2005-11-20
Initial Package Version: 2.3.4
Upstream Status: Comitted
Origin:  http://bugs.gentoo.org/show_bug.cgi?id=52374#c35
Description:  Fixes the follwoing error:
Inconsistency detected by ld.so: ../sysdeps/generic/dl-tls.c: 72:
_dl_next_tls_modid: Assertion `result <= _rtld_local._dl_tls_max_dtv_idx'
failed!


diff -Naur glibc-2.3.5-orig/sysdeps/generic/dl-tls.c glibc-2.3.5/sysdeps/generic/dl-tls.c
--- glibc-2.3.5-orig/sysdeps/generic/dl-tls.c	2005-02-16 10:23:02.000000000 +0000
+++ glibc-2.3.5/sysdeps/generic/dl-tls.c	2005-11-20 11:55:11.000000000 +0000
@@ -70,24 +70,22 @@
 	 NB: the offset +1 is due to the fact that DTV[0] is used
 	 for something else.  */
       result = GL(dl_tls_static_nelem) + 1;
-      /* If the following would not be true we mustn't have assumed
-	 there is a gap.  */
-      assert (result <= GL(dl_tls_max_dtv_idx));
-      do
-	{
-	  while (result - disp < runp->len)
-	    {
-	      if (runp->slotinfo[result - disp].map == NULL)
-		break;
+      if (result <= GL(dl_tls_max_dtv_idx))
+        do
+	  {
+	    while (result - disp < runp->len)
+	      {
+	        if (runp->slotinfo[result - disp].map == NULL)
+		  break;
+
+	        ++result;
+	        assert (result <= GL(dl_tls_max_dtv_idx) + 1);
+	      }
 
-	      ++result;
-	      assert (result <= GL(dl_tls_max_dtv_idx) + 1);
-	    }
-
-	  if (result - disp < runp->len)
-	    break;
+	    if (result - disp < runp->len)
+	      break;
 
-	  disp += runp->len;
+	    disp += runp->len;
 	}
       while ((runp = runp->next) != NULL);
 
