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

[commits] r12542 - in /fsf/trunk/libc: ./ elf/ stdio-common/ sysdeps/i386/



Author: eglibc
Date: Thu Jan 13 00:03:48 2011
New Revision: 12542

Log:
Import glibc-mainline for 2011-01-13

Added:
    fsf/trunk/libc/stdio-common/tst-grouping.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/elf/dl-dst.h
    fsf/trunk/libc/stdio-common/Makefile
    fsf/trunk/libc/stdio-common/printf_fp.c
    fsf/trunk/libc/sysdeps/i386/Makefile

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Jan 13 00:03:48 2011
@@ -1,3 +1,22 @@
+2011-01-12  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* elf/dl-dst.h (DL_DST_REQUIRED): Allow l_origin to be NULL when
+	loader is ld.so.
+
+2011-01-10  Paul Pluzhnikov  <ppluzhnikov@xxxxxxxxxx>
+
+	* sysdeps/i386/Makefile: stdlib/cxa_finalize.c needs 16-byte stack
+	alignment for SSE2.
+
+2011-01-12  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #12394]
+	* stdio-common/printf_fp.c (__printf_fp): Add more room for grouping
+	characters.  When rounding increased number of integer digits recompute
+	number of groups.
+	* stdio-common/tst-grouping.c: New file.
+	* stdio-common/Makefile: Add rules to build and run tst-grouping.
+
 2011-01-09  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	* sysdeps/i386/bits/select.h: Don't use asm code for __FD_SET,

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Thu Jan 13 00:03:48 2011
@@ -1,5 +1,5 @@
-GNU C Library NEWS -- history of user-visible changes.  2010-12-27
-Copyright (C) 1992-2009, 2010 Free Software Foundation, Inc.
+GNU C Library NEWS -- history of user-visible changes.  2011-1-12
+Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
 Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
@@ -12,7 +12,7 @@
   3268, 7066, 10085, 10851, 11149, 11155, 11611, 11640, 11655, 11701,
   11840, 11856, 11883, 11903, 11904, 11968, 11979, 12005, 12037,
   12067, 12077, 12078, 12092, 12093, 12107, 12108, 12113, 12140,
-  12159, 12167, 12191, 12194, 12201, 12204, 12205, 12207, 12348
+  12159, 12167, 12191, 12194, 12201, 12204, 12205, 12207, 12348, 12394
 
 * New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark
 

Modified: fsf/trunk/libc/elf/dl-dst.h
==============================================================================
--- fsf/trunk/libc/elf/dl-dst.h (original)
+++ fsf/trunk/libc/elf/dl-dst.h Thu Jan 13 00:03:48 2011
@@ -1,6 +1,5 @@
 /* Handling of dynamic sring tokens.
-   Copyright (C) 1999,2001,2002,2003,2004,2006,2007
-   Free Software Foundation, Inc.
+   Copyright (C) 1999,2001-2004,2006,2007,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,6 +32,11 @@
     __cnt; })
 
 
+#ifdef SHARED
+# define IS_RTLD(l) (l) == &GL(dl_rtld_map)
+#else
+# define IS_RTLD(l) 0
+#endif
 /* Guess from the number of DSTs the length of the result string.  */
 #define DL_DST_REQUIRED(l, name, len, cnt) \
   ({									      \
@@ -41,7 +45,7 @@
 									      \
     if (__cnt > 0)							      \
       {									      \
-	size_t dst_len;						      	      \
+	size_t dst_len;							      \
 	/* Now we make a guess how many extra characters on top of the	      \
 	   length of S we need to represent the result.  We know that	      \
 	   we have CNT replacements.  Each at most can use		      \
@@ -50,11 +54,12 @@
 	   minus 4 (which is the length of "$LIB").			      \
 									      \
 	   First get the origin string if it is not available yet.	      \
-	   This can only happen for the map of the executable.  */	      \
+	   This can only happen for the map of the executable or, when	      \
+	   auditing, in ld.so.  */					      \
 	DL_DST_REQ_STATIC (l)						      \
 	if ((l)->l_origin == NULL)					      \
 	  {								      \
-	    assert ((l)->l_name[0] == '\0');				      \
+	    assert ((l)->l_name[0] == '\0' || IS_RTLD (l));		      \
 	    (l)->l_origin = _dl_get_origin ();				      \
 	    dst_len = ((l)->l_origin && (l)->l_origin != (char *) -1	      \
 			  ? strlen ((l)->l_origin) : 0);		      \
@@ -62,7 +67,7 @@
 	else								      \
 	  dst_len = (l)->l_origin == (char *) -1			      \
 	    ? 0 : strlen ((l)->l_origin);				      \
-	dst_len = MAX (MAX (dst_len, GLRO(dl_platformlen)), 		      \
+	dst_len = MAX (MAX (dst_len, GLRO(dl_platformlen)),		      \
 		       strlen (DL_DST_LIB));				      \
 	if (dst_len > 4)						      \
 	  __len += __cnt * (dst_len - 4);				      \

Modified: fsf/trunk/libc/stdio-common/Makefile
==============================================================================
--- fsf/trunk/libc/stdio-common/Makefile (original)
+++ fsf/trunk/libc/stdio-common/Makefile Thu Jan 13 00:03:48 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1991-2009, 2011 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -60,7 +60,7 @@
 	 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
 	 tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
 	 bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
-	 scanf16 scanf17 tst-setvbuf1
+	 scanf16 scanf17 tst-setvbuf1 tst-grouping
 
 test-srcs = tst-unbputc tst-printf
 
@@ -128,6 +128,7 @@
 scanf13-ENV = LOCPATH=$(common-objpfx)localedata
 bug14-ENV = LOCPATH=$(common-objpfx)localedata
 bug15-ENV = LOCPATH=$(common-objpfx)localedata
+tst-grouping-ENV = LOCPATH=$(common-objpfx)localedata
 
 ifneq (,$(filter %REENTRANT, $(defines)))
 CPPFLAGS += -D_IO_MTSAFE_IO

Modified: fsf/trunk/libc/stdio-common/printf_fp.c
==============================================================================
--- fsf/trunk/libc/stdio-common/printf_fp.c (original)
+++ fsf/trunk/libc/stdio-common/printf_fp.c Thu Jan 13 00:03:48 2011
@@ -1,5 +1,5 @@
 /* Floating point output for `printf'.
-   Copyright (C) 1995-2003, 2006, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2006-2008, 2011 Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@xxxxxxxxxxxxxx>, 1995.
@@ -884,7 +884,9 @@
 	/* Guess the number of groups we will make, and thus how
 	   many spaces we need for separator characters.  */
 	ngroups = __guess_grouping (intdig_max, grouping);
-	chars_needed += ngroups;
+	/* Allocate one more character in case rounding increases the
+	   number of groups.  */
+	chars_needed += ngroups + 1;
       }
 
     /* Allocate buffer for output.  We need two more because while rounding
@@ -1088,9 +1090,16 @@
       --wcp;
 
     if (grouping)
-      /* Add in separator characters, overwriting the same buffer.  */
-      wcp = group_number (wstartp, wcp, intdig_no, grouping, thousands_sepwc,
-			  ngroups);
+      {
+	/* Rounding might have changed the number of groups.  We allocated
+	   enough memory but we need here the correct number of groups.  */
+	if (intdig_no != intdig_max)
+	  ngroups = __guess_grouping (intdig_no, grouping);
+
+	/* Add in separator characters, overwriting the same buffer.  */
+	wcp = group_number (wstartp, wcp, intdig_no, grouping, thousands_sepwc,
+			    ngroups);
+      }
 
     /* Write the exponent if it is needed.  */
     if (type != 'f')
@@ -1210,7 +1219,7 @@
 
       tmpptr = buffer;
       if (__builtin_expect (info->i18n, 0))
-        {
+	{
 #ifdef COMPILE_WPRINTF
 	  wstartp = _i18n_number_rewrite (wstartp, wcp,
 					  wbuffer + wbuffer_to_alloc);
@@ -1224,7 +1233,7 @@
 	  assert ((uintptr_t) buffer <= (uintptr_t) tmpptr);
 	  assert ((uintptr_t) tmpptr < (uintptr_t) buffer_end);
 #endif
-        }
+	}
 
       PRINT (tmpptr, wstartp, wide ? wcp - wstartp : cp - tmpptr);
 

Added: fsf/trunk/libc/stdio-common/tst-grouping.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tst-grouping.c (added)
+++ fsf/trunk/libc/stdio-common/tst-grouping.c Thu Jan 13 00:03:48 2011
@@ -1,0 +1,83 @@
+/* BZ 12394, test by Bruno Haible.  */
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+  char buf1[1000];
+  char buf2[1000];
+  int result = 0;
+
+  if (setlocale (LC_NUMERIC, "de_DE.UTF-8") == NULL)
+    return 1;
+
+  sprintf (buf1, "%'.2f",  999.996);
+  sprintf (buf2, "%'.2f", 1000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 2;
+
+  sprintf (buf1, "%'.2f",  999999.996);
+  sprintf (buf2, "%'.2f", 1000000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 2;
+
+  sprintf (buf1, "%'.2f",  999999999.996);
+  sprintf (buf2, "%'.2f", 1000000000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 2;
+
+  sprintf (buf1, "%'.2f",  999999999999.996);
+  sprintf (buf2, "%'.2f", 1000000000000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 2;
+
+  sprintf (buf1, "%'.2f",  999999999999999.996);
+  sprintf (buf2, "%'.2f", 1000000000000000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 2;
+
+  sprintf (buf1, "%'.5g",  999.996);
+  sprintf (buf2, "%'.5g", 1000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 4;
+
+  sprintf (buf1, "%'.4g",  9999.996);
+  sprintf (buf2, "%'.4g", 10000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 8;
+
+  sprintf (buf1, "%'.5g",  99999.996);
+  sprintf (buf2, "%'.5g", 100000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 8;
+
+  sprintf (buf1, "%'.6g",  999999.996);
+  sprintf (buf2, "%'.6g", 1000000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 8;
+
+  sprintf (buf1, "%'.7g",  9999999.996);
+  sprintf (buf2, "%'.7g", 10000000.004);
+  printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
+  if (strcmp (buf1, buf2) != 0)
+    result |= 8;
+
+  return result;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/sysdeps/i386/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/Makefile (original)
+++ fsf/trunk/libc/sysdeps/i386/Makefile Thu Jan 13 00:03:48 2011
@@ -47,6 +47,7 @@
 # And a couple of other routines
 ifeq ($(subdir),stdlib)
 CFLAGS-exit.c += -mpreferred-stack-boundary=4
+CFLAGS-cxa_finalize.c += -mpreferred-stack-boundary=4
 endif
 ifeq ($(subdir),elf)
 CFLAGS-dl-init.c += -mpreferred-stack-boundary=4