[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r6149 - in /fsf/trunk/libc: ./ elf/ io/ math/ string/ sysdeps/ieee754/flt-32/



Author: eglibc
Date: Mon May 12 00:05:06 2008
New Revision: 6149

Log:
Import glibc-mainline for 2008-05-12

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/elf/dl-tls.c
    fsf/trunk/libc/io/openat.c
    fsf/trunk/libc/io/openat64.c
    fsf/trunk/libc/math/libm-test.inc
    fsf/trunk/libc/string/tester.c
    fsf/trunk/libc/sysdeps/ieee754/flt-32/w_expf.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon May 12 00:05:06 2008
@@ -1,3 +1,23 @@
+2008-05-11  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/dl-tls.c (__tls_get_addr): Optimize by moving slow path in
+	its own function.  This reduces the frame setup costs and more.
+
+2008-02-11  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	[BZ #3406]
+	* sysdeps/ieee754/flt-32/w_expf.c (o_threshold): Correct value.
+	* math/libm-test.inc (exp_test): Test 88.72269439697265625.
+
+2008-05-11  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* io/openat.c (__openat_2): Also pass fd to __openat.
+	* io/openat64.c (__openat64_2): Also pass fd to __openat64.
+	Patch by Kristian Van Der Vliet <vanders@xxxxxxxxxx>.
+
+	* string/tester.c (test_memcmp): Add a few more tests.
+	Patch by Mats Erik Andersson <ynglingatal@xxxxxxxxx>.
+
 2008-05-10  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* nscd/cache.c (cache_add): Before returning with failure and this

Modified: fsf/trunk/libc/elf/dl-tls.c
==============================================================================
--- fsf/trunk/libc/elf/dl-tls.c (original)
+++ fsf/trunk/libc/elf/dl-tls.c Mon May 12 00:05:06 2008
@@ -691,6 +691,61 @@
 }
 
 
+static void *
+__attribute_noinline__
+tls_get_addr_tail (dtv_t *dtv, struct link_map *the_map, size_t module)
+{
+  /* The allocation was deferred.  Do it now.  */
+  if (the_map == NULL)
+    {
+      /* Find the link map for this module.  */
+      size_t idx = module;
+      struct dtv_slotinfo_list *listp = GL(dl_tls_dtv_slotinfo_list);
+
+      while (idx >= listp->len)
+	{
+	  idx -= listp->len;
+	  listp = listp->next;
+	}
+
+      the_map = listp->slotinfo[idx].map;
+    }
+
+ again:
+  /* Make sure that, if a dlopen running in parallel forces the
+     variable into static storage, we'll wait until the address in the
+     static TLS block is set up, and use that.  If we're undecided
+     yet, make sure we make the decision holding the lock as well.  */
+  if (__builtin_expect (the_map->l_tls_offset
+			!= FORCED_DYNAMIC_TLS_OFFSET, 0))
+    {
+      __rtld_lock_lock_recursive (GL(dl_load_lock));
+      if (__builtin_expect (the_map->l_tls_offset == NO_TLS_OFFSET, 1))
+	{
+	  the_map->l_tls_offset = FORCED_DYNAMIC_TLS_OFFSET;
+	  __rtld_lock_unlock_recursive (GL(dl_load_lock));
+	}
+      else
+	{
+	  __rtld_lock_unlock_recursive (GL(dl_load_lock));
+	  if (__builtin_expect (the_map->l_tls_offset
+				!= FORCED_DYNAMIC_TLS_OFFSET, 1))
+	    {
+	      void *p = dtv[module].pointer.val;
+	      if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
+		goto again;
+
+	      return p;
+	    }
+	}
+    }
+  void *p = dtv[module].pointer.val = allocate_and_init (the_map);
+  dtv[module].pointer.is_static = false;
+
+  return p;
+}
+
+
 /* The generic dynamic and local dynamic model cannot be used in
    statically linked applications.  */
 void *
@@ -703,52 +758,10 @@
   if (__builtin_expect (dtv[0].counter != GL(dl_tls_generation), 0))
     the_map = _dl_update_slotinfo (GET_ADDR_MODULE);
 
- retry:
   p = dtv[GET_ADDR_MODULE].pointer.val;
 
   if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
-    {
-      /* The allocation was deferred.  Do it now.  */
-      if (the_map == NULL)
-	{
-	  /* Find the link map for this module.  */
-	  size_t idx = GET_ADDR_MODULE;
-	  struct dtv_slotinfo_list *listp = GL(dl_tls_dtv_slotinfo_list);
-
-	  while (idx >= listp->len)
-	    {
-	      idx -= listp->len;
-	      listp = listp->next;
-	    }
-
-	  the_map = listp->slotinfo[idx].map;
-	}
-
-      /* Make sure that, if a dlopen running in parallel forces the
-	 variable into static storage, we'll wait until the address in
-	 the static TLS block is set up, and use that.  If we're
-	 undecided yet, make sure we make the decision holding the
-	 lock as well.  */
-      if (__builtin_expect (the_map->l_tls_offset
-			    != FORCED_DYNAMIC_TLS_OFFSET, 0))
-	{
-	  __rtld_lock_lock_recursive (GL(dl_load_lock));
-	  if (__builtin_expect (the_map->l_tls_offset == NO_TLS_OFFSET, 1))
-	    {
-	      the_map->l_tls_offset = FORCED_DYNAMIC_TLS_OFFSET;
-	      __rtld_lock_unlock_recursive (GL(dl_load_lock));
-	    }
-	  else
-	    {
-	      __rtld_lock_unlock_recursive (GL(dl_load_lock));
-	      if (__builtin_expect (the_map->l_tls_offset
-				    != FORCED_DYNAMIC_TLS_OFFSET, 1))
-		goto retry;
-	    }
-	}
-      p = dtv[GET_ADDR_MODULE].pointer.val = allocate_and_init (the_map);
-      dtv[GET_ADDR_MODULE].pointer.is_static = false;
-    }
+    p = tls_get_addr_tail (dtv, the_map, GET_ADDR_MODULE);
 
   return (char *) p + GET_ADDR_OFFSET;
 }

Modified: fsf/trunk/libc/io/openat.c
==============================================================================
--- fsf/trunk/libc/io/openat.c (original)
+++ fsf/trunk/libc/io/openat.c Mon May 12 00:05:06 2008
@@ -79,7 +79,7 @@
   if (oflag & O_CREAT)
     __fortify_fail ("invalid openat call: O_CREAT without mode");
 
-  return __openat (file, oflag);
+  return __openat (fd, file, oflag);
 }
 stub_warning (__openat_2)
 

Modified: fsf/trunk/libc/io/openat64.c
==============================================================================
--- fsf/trunk/libc/io/openat64.c (original)
+++ fsf/trunk/libc/io/openat64.c Mon May 12 00:05:06 2008
@@ -79,7 +79,7 @@
   if (oflag & O_CREAT)
     __fortify_fail ("invalid openat64 call: O_CREAT without mode");
 
-  return __openat64 (file, oflag);
+  return __openat64 (fd, file, oflag);
 }
 stub_warning (__openat_2)
 

Modified: fsf/trunk/libc/math/libm-test.inc
==============================================================================
--- fsf/trunk/libc/math/libm-test.inc (original)
+++ fsf/trunk/libc/math/libm-test.inc Mon May 12 00:05:06 2008
@@ -2510,6 +2510,7 @@
   TEST_f_f (exp, 3, M_E3l);
   TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
   TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
+  TEST_f_f (exp, 88.72269439697265625L, 3.40233126623160774937554134772290447915e38L);
 #ifdef TEST_LDOUBLE
   /* The result can only be represented in long double.  */
   TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);

Modified: fsf/trunk/libc/string/tester.c
==============================================================================
--- fsf/trunk/libc/string/tester.c (original)
+++ fsf/trunk/libc/string/tester.c Mon May 12 00:05:06 2008
@@ -985,15 +985,33 @@
 static void
 test_memcmp (void)
 {
+  int cnt = 1;
+  char one[21];
+  char two[21];
+  
   it = "memcmp";
-  check(memcmp("a", "a", 1) == 0, 1);		/* Identity. */
-  check(memcmp("abc", "abc", 3) == 0, 2);	/* Multicharacter. */
-  check(memcmp("abcd", "abce", 4) < 0, 3);	/* Honestly unequal. */
-  check(memcmp("abce", "abcd", 4) > 0, 4);
-  check(memcmp("alph", "beta", 4) < 0, 5);
-  check(memcmp("a\203", "a\003", 2) > 0, 6);
-  check(memcmp("abce", "abcd", 3) == 0, 7);	/* Count limited. */
-  check(memcmp("abc", "def", 0) == 0, 8);	/* Zero count. */
+  check(memcmp("a", "a", 1) == 0, cnt++);	/* Identity. */
+  check(memcmp("abc", "abc", 3) == 0, cnt++);	/* Multicharacter. */
+  check(memcmp("abcd", "abcf", 4) < 0, cnt++);	/* Honestly unequal. */
+  check(memcmp("abcf", "abcd", 4) > 0, cnt++);
+  check(memcmp("alph", "cold", 4) < 0, cnt++);
+  check(memcmp("a\203", "a\003", 2) > 0, cnt++);
+  check(memcmp("a\003", "a\203", 2) < 0, cnt++);
+  check(memcmp("a\003bc", "a\203bc", 2) < 0, cnt++);
+  check(memcmp("abc\203", "abc\003", 4) > 0, cnt++);
+  check(memcmp("abc\003", "abc\203", 4) < 0, cnt++);
+  check(memcmp("abcf", "abcd", 3) == 0, cnt++);	/* Count limited. */
+  check(memcmp("abc", "def", 0) == 0, cnt++);	/* Zero count. */
+  /* Comparisons with shifting 4-byte boundaries. */
+  for (int i = 0; i < 4; ++i)
+    {
+      char *a = one + i;
+      char *b = two + i;
+      strncpy(a, "--------11112222", 16);
+      strncpy(b, "--------33334444", 16);
+      check(memcmp(b, a, 16) > 0, cnt++);
+      check(memcmp(a, b, 16) < 0, cnt++);
+    }
 }
 
 static void

Modified: fsf/trunk/libc/sysdeps/ieee754/flt-32/w_expf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/flt-32/w_expf.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/flt-32/w_expf.c Mon May 12 00:05:06 2008
@@ -29,7 +29,7 @@
 #else
 static float
 #endif
-o_threshold=  8.8721679688e+01,  /* 0x42b17180 */
+o_threshold=  8.8722831726e+01,  /* 0x42b17217 */
 u_threshold= -1.0397208405e+02;  /* 0xc2cff1b5 */
 
 #ifdef __STDC__