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

[commits] r13832 - in /trunk/libc: ./ assert/ elf/ iconv/ iconvdata/ include/ libio/ localedata/ localedata/locales/ login/ nscd/ stdl...



Author: joseph
Date: Sun May 15 05:22:50 2011
New Revision: 13832

Log:
Merge changes between r13800 and r13831 from /fsf/trunk.

Added:
    trunk/libc/elf/tst-tls19.c
      - copied unchanged from r13831, fsf/trunk/libc/elf/tst-tls19.c
    trunk/libc/elf/tst-tls19mod1.c
      - copied unchanged from r13831, fsf/trunk/libc/elf/tst-tls19mod1.c
    trunk/libc/elf/tst-tls19mod2.c
      - copied unchanged from r13831, fsf/trunk/libc/elf/tst-tls19mod2.c
    trunk/libc/elf/tst-tls19mod3.c
      - copied unchanged from r13831, fsf/trunk/libc/elf/tst-tls19mod3.c
    trunk/libc/iconvdata/bug-iconv8.c
      - copied unchanged from r13831, fsf/trunk/libc/iconvdata/bug-iconv8.c
    trunk/libc/libio/bug-fclose1.c
      - copied unchanged from r13831, fsf/trunk/libc/libio/bug-fclose1.c
Modified:
    trunk/libc/ChangeLog
    trunk/libc/Makeconfig
    trunk/libc/NEWS
    trunk/libc/Rules
    trunk/libc/assert/assert-perr.c
    trunk/libc/assert/assert.c
    trunk/libc/elf/Makefile
    trunk/libc/elf/dl-open.c
    trunk/libc/iconv/loop.c
    trunk/libc/iconvdata/Makefile
    trunk/libc/iconvdata/cp932.c
    trunk/libc/include/assert.h
    trunk/libc/include/stdlib.h
    trunk/libc/libio/Makefile
    trunk/libc/libio/fileops.c
    trunk/libc/libio/tst_putwc.c
    trunk/libc/localedata/ChangeLog
    trunk/libc/localedata/locales/en_SG
    trunk/libc/login/Makefile
    trunk/libc/nscd/Makefile
    trunk/libc/stdlib/abort.c
    trunk/libc/sysdeps/generic/elf/backtracesymsfd.c
    trunk/libc/sysdeps/ia64/backtrace.c
    trunk/libc/sysdeps/posix/libc_fatal.c
    trunk/libc/sysdeps/pthread/aio_misc.c
    trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c

Modified: trunk/libc/ChangeLog
==============================================================================
--- trunk/libc/ChangeLog (original)
+++ trunk/libc/ChangeLog Sun May 15 05:22:50 2011
@@ -1,3 +1,85 @@
+2011-05-15  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #11901]
+	* include/stdlib.h: Move include protection to the right place.
+	Define abort_msg_s.  Declare __abort_msg with it.
+	* stdlib/abort.c (__abort_msg): Adjust type.
+	* assert/assert.c (__assert_fail_base): New function.  Majority
+	of code from __assert_fail.  Allocate memory for __abort_msg with
+	mmap.
+	(__assert_fail): Now call __assert_fail_base.
+	* assert/assert-perr.c: Remove bulk of implementation.  Use
+	__assert_fail_base.
+	* include/assert.hL Declare __assert_fail_base.
+	* sysdeps/posix/libc_fatal.c: Allocate memory for __abort_msg with
+	mmap.
+	* sysdeps/unix/sysv/linux/libc_fatal.c: Likewise.
+
+2011-05-14  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #11952]
+	[BZ #12453]
+	* elf/dl-open.c (dl_open_worker): Delay calls to _dl_update_slotinfo
+	until all modules are registered in the DTV.
+	* elf/Makefile: Add rules to build and run tst-tls19.
+	* elf/tst-tls19.c: New file.
+	* elf/tst-tls19mod1.c: New file.
+	* elf/tst-tls19mod2.c: New file.
+	* elf/tst-tls19mod3.c: New file.
+	Patch mostly by Martin von Gagern <Martin.vGagern@xxxxxxx>.
+
+	[BZ #12083]
+	* sysdeps/pthread/aio_misc.c (__aio_init): Compute optim.aio_num
+	correctly.
+
+	[BZ #12601]
+	* iconvdata/cp932.c (BODY to UCS4): Fix incrementing inptr in case of
+	two-byte sequence errors.
+	* iconvdata/Makefile (tests): Add bug-iconv8.
+	* iconvdata/bug-iconv8.c: New file.
+
+	[BZ #12626]
+	* sysdeps/generic/elf/backtracesymsfd.c (__backtrace_symbols_fd): Move
+	buf2 definition.
+
+	* libio/fileops.c (_IO_new_file_close_it): Initialize write_status.
+
+	[BZ #12432]
+	* sysdeps/ia64/backtrace.c (struct trace_reg): Add cfa element.
+	(dummy_getcfa): New function.
+	(init): Get _Unwind_GetCFA address, use dummy if not found.
+	(backtrace_helper): In recursion check, also check whether CFA changes.
+	(__backtrace): Completely initialize arg.
+
+	* iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before
+	storing incomplete byte sequence in state object.  Avoid testing for
+	guaranteed too small input if we know there is enough data available.
+
+2011-05-11  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* Makeconfig (+link-pie): Indent.
+	* Rules (binaries-pie): Define if $(have-fpie) and
+	$(build-shared).
+	(binaries-shared): Also filter out $(binaries-pie).
+	($(addprefix $(objpfx),$(binaries-pie))): New rule.
+	* nscd/Makefile (others-pie): Add nscd.
+	(LDFLAGS-nscd): Set this instead of relro-LDFLAGS.
+	($(objpfx)nscd): Remove command override.
+	* login/Makefile (others-pie): Add pt_chown.
+	($(objpfx)pt_chown): Remove command override.
+	* elf/Makefile: Add PIE tests to tests and tests-pie variables and
+	remove command overrides.
+
+2011-05-13  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* libio/tst_putwc.c: Fix error messages.
+
+	[BZ #12724]
+	* libio/fileops.c (_IO_new_file_close_it): Always flush when
+	currently writing and seek to current position when not.
+	* libio/Makefile (tests): Add bug-fclose1.
+	* libio/bug-fclose1.c: New file.
+
 2011-05-12  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	[BZ #12511]

Modified: trunk/libc/Makeconfig
==============================================================================
--- trunk/libc/Makeconfig (original)
+++ trunk/libc/Makeconfig Sun May 15 05:22:50 2011
@@ -450,9 +450,9 @@
 	     $(addprefix $(csu-objpfx),S$(start-installed-name)) \
 	     $(+preinit) $(+prectorS) \
 	     $(filter-out $(addprefix $(csu-objpfx),start.o \
-	     S$(start-installed-name))\
-	     $(+preinit) $(link-extra-libs) \
-	     $(common-objpfx)libc% $(+postinit),$^) \
+						    S$(start-installed-name))\
+			  $(+preinit) $(link-extra-libs) \
+			  $(common-objpfx)libc% $(+postinit),$^) \
 	     $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
 endif
 # Command for statically linking programs with the C library.

Modified: trunk/libc/NEWS
==============================================================================
--- trunk/libc/NEWS (original)
+++ trunk/libc/NEWS Sun May 15 05:22:50 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-5-11
+GNU C Library NEWS -- history of user-visible changes.  2011-5-14
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -9,11 +9,12 @@
 
 * The following bugs are resolved with this release:
 
-  386, 11257, 11258, 11487, 11532, 11578, 11653, 11668, 11724, 11945, 11947,
-  12052, 12158, 12178, 12200, 12346, 12393, 12420, 12445, 12449, 12454,
-  12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541, 12545,
-  12551, 12583, 12587, 12597, 12611, 12625, 12631, 12650, 12653, 12655,
-  12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12734, 12738
+  386, 11257, 11258, 11487, 11532, 11578, 11653, 11668, 11724, 11901, 11945,
+  11947, 11952, 12052, 12083, 12158, 12178, 12200, 12346, 12393, 12420,
+  12432, 12445, 12449, 12453, 12454, 12460, 12469, 12489, 12509, 12510,
+  12511, 12518, 12527, 12541, 12545, 12551, 12582, 12583, 12587, 12597,
+  12601, 12611, 12625, 12626, 12631, 12650, 12653, 12655, 12660, 12681,
+  12685, 12711, 12713, 12714, 12717, 12723, 12724, 12734, 12738
 
 * The RPC implementation in libc is obsoleted.  Old programs keep working
   but new programs cannot be linked with the routines in libc anymore.

Modified: trunk/libc/Rules
==============================================================================
--- trunk/libc/Rules (original)
+++ trunk/libc/Rules Sun May 15 05:22:50 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2000,2002,2003,2004,2005,2006
+# Copyright (C) 1991-2000,2002,2003,2004,2005,2006,2011
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -106,18 +106,32 @@
 ifeq ($(build-programs),yes)
 binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs)
 binaries-static = $(others-static) $(tests-static) $(xtests-static)
+ifeq (yesyes,$(have-fpie)$(build-shared))
+binaries-pie = $(others-pie) $(tests-pie) $(xtests-pie)
+else
+binaries-pie =
+endif
 else
 binaries-all = $(tests) $(xtests) $(test-srcs)
 binaries-static =
+binaries-pie =
 endif
 
-binaries-shared = $(filter-out $(binaries-static), $(binaries-all))
+binaries-shared = $(filter-out $(binaries-pie) $(binaries-static), \
+			       $(binaries-all))
 
 ifneq "$(strip $(binaries-shared))" ""
 $(addprefix $(objpfx),$(binaries-shared)): %: %.o \
   $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
 	$(+link)
+endif
+
+ifneq "$(strip $(binaries-pie))" ""
+$(addprefix $(objpfx),$(binaries-pie)): %: %.o \
+  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
+  $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
+	$(+link-pie)
 endif
 
 ifneq "$(strip $(binaries-static))" ""

Modified: trunk/libc/assert/assert-perr.c
==============================================================================
--- trunk/libc/assert/assert-perr.c (original)
+++ trunk/libc/assert/assert-perr.c Sun May 15 05:22:50 2011
@@ -1,4 +1,5 @@
-/* Copyright (C) 1994-1998,2001,2002,2005,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1994-1998,2001,2002,2005,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
@@ -17,66 +18,23 @@
    02111-1307 USA.  */
 
 #include <assert.h>
-#include <atomic.h>
 #include <libintl.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sysdep.h>
-#include <unistd.h>
 
-
-extern const char *__progname;
-
-#ifdef USE_IN_LIBIO
-# include <wchar.h>
-# include <libio/iolibio.h>
-# define fflush(s) INTUSE(_IO_fflush) (s)
-#endif
 
 /* This function, when passed an error number, a filename, and a line
    number, prints a message on the standard error stream of the form:
-   	a.c:10: foobar: Unexpected error: Computer bought the farm
+	a.c:10: foobar: Unexpected error: Computer bought the farm
    It then aborts program execution via a call to `abort'.  */
-
-#ifdef FATAL_PREPARE_INCLUDE
-# include FATAL_PREPARE_INCLUDE
-#endif
-
 void
 __assert_perror_fail (int errnum,
 		      const char *file, unsigned int line,
 		      const char *function)
 {
   char errbuf[1024];
-  char *buf;
 
-#ifdef FATAL_PREPARE
-  FATAL_PREPARE;
-#endif
-
-  if (__asprintf (&buf, _("%s%s%s:%u: %s%sUnexpected error: %s.\n"),
-		  __progname, __progname[0] ? ": " : "",
-		  file, line,
-		  function ? function : "", function ? ": " : "",
-		  __strerror_r (errnum, errbuf, sizeof errbuf)) >= 0)
-    {
-      /* Print the message.  */
-      (void) __fxprintf (NULL, "%s", buf);
-      (void) fflush (stderr);
-
-      /* We have to free the old buffer since the application might
-	 catch the SIGABRT signal.  */
-      char *old = atomic_exchange_acq (&__abort_msg, buf);
-      free (old);
-    }
-  else
-    {
-      /* At least print a minimal message.  */
-      static const char errstr[] = "Unexpected error.\n";
-      __libc_write (STDERR_FILENO, errstr, sizeof (errstr) - 1);
-    }
-
-  abort ();
+  char *e = __strerror_r (errnum, errbuf, sizeof errbuf);
+  __assert_fail_base (_("%s%s%s:%u: %s%sUnexpected error: %s.\n"),
+		      e, file, line, function);
 }
 libc_hidden_def (__assert_perror_fail)

Modified: trunk/libc/assert/assert.c
==============================================================================
--- trunk/libc/assert/assert.c (original)
+++ trunk/libc/assert/assert.c Sun May 15 05:22:50 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1994-1996,1998,2001,2002,2005,2009
+/* Copyright (C) 1991,1994-1996,1998,2001,2002,2005,2009,2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -19,11 +19,13 @@
 
 #include <assert.h>
 #include <atomic.h>
+#include <ldsodefs.h>
 #include <libintl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sysdep.h>
 #include <unistd.h>
+#include <sys/mman.h>
 
 
 extern const char *__progname;
@@ -37,7 +39,7 @@
 /* This function, when passed a string containing an asserted
    expression, a filename, and a line number, prints a message
    on the standard error stream of the form:
-   	a.c:10: foobar: Assertion `a == b' failed.
+	a.c:10: foobar: Assertion `a == b' failed.
    It then aborts program execution via a call to `abort'.  */
 
 #ifdef FATAL_PREPARE_INCLUDE
@@ -45,31 +47,44 @@
 #endif
 
 
-#undef __assert_fail
 void
-__assert_fail (const char *assertion, const char *file, unsigned int line,
-	       const char *function)
+__assert_fail_base (const char *fmt, const char *assertion, const char *file,
+		    unsigned int line, const char *function)
 {
-  char *buf;
+  char *str;
 
 #ifdef FATAL_PREPARE
   FATAL_PREPARE;
 #endif
 
-  if (__asprintf (&buf, _("%s%s%s:%u: %s%sAssertion `%s' failed.\n"),
+  int total;
+  if (__asprintf (&str, fmt,
 		  __progname, __progname[0] ? ": " : "",
 		  file, line,
 		  function ? function : "", function ? ": " : "",
-		  assertion) >= 0)
+		  assertion, &total) >= 0)
     {
       /* Print the message.  */
-      (void) __fxprintf (NULL, "%s", buf);
+      (void) __fxprintf (NULL, "%s", str);
       (void) fflush (stderr);
 
-      /* We have to free the old buffer since the application might
-	 catch the SIGABRT signal.  */
-      char *old = atomic_exchange_acq (&__abort_msg, buf);
-      free (old);
+      total = (total + 1 + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1);
+      struct abort_msg_s *buf = __mmap (NULL, total, PROT_READ | PROT_WRITE,
+					MAP_ANON | MAP_PRIVATE, -1, 0);
+      if (__builtin_expect (buf != MAP_FAILED, 1))
+	{
+	  buf->size = total;
+	  strcpy (buf->msg, str);
+
+	  /* We have to free the old buffer since the application might
+	     catch the SIGABRT signal.  */
+	  struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg, buf);
+
+	  if (old != NULL)
+	    __munmap (old, old->size);
+	}
+
+      free (str);
     }
   else
     {
@@ -80,4 +95,14 @@
 
   abort ();
 }
+
+
+#undef __assert_fail
+void
+__assert_fail (const char *assertion, const char *file, unsigned int line,
+	       const char *function)
+{
+  __assert_fail_base (_("%s%s%s:%u: %s%sAssertion `%s' failed.\n%n"),
+		      assertion, file, line, function);
+}
 hidden_def(__assert_fail)

Modified: trunk/libc/elf/Makefile
==============================================================================
--- trunk/libc/elf/Makefile (original)
+++ trunk/libc/elf/Makefile Sun May 15 05:22:50 2011
@@ -76,6 +76,7 @@
 		   tst-tlsmod12.c tst-tls10.h tst-alignmod.c tst-alignmod2.c \
 		   circlemod1.c circlemod1a.c circlemod2.c circlemod2a.c \
 		   circlemod3.c circlemod3a.c nodlopenmod2.c \
+		   tst-tls19mod1.c tst-tls19mod2.c tst-tls19mod3.c \
 		   tls-macros.h \
 		   reldep8mod1.c reldep8mod2.c reldep8mod3.c \
 		   nodel2mod1.c nodel2mod2.c nodel2mod3.c \
@@ -195,7 +196,7 @@
 	 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
 	 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
 	 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
-	 tst-tls16 tst-tls17 tst-tls18 tst-tls-dlinfo \
+	 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
 	 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
 	 tst-dlmodcount tst-dlopenrpath tst-deep1 \
 	 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
@@ -213,9 +214,6 @@
 ifeq (x86_64,$(config-machine))
 tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7
 endif
-endif
-ifeq (yesyes,$(have-fpie)$(build-shared))
-tests: $(objpfx)tst-pie1.out
 endif
 tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
@@ -244,6 +242,7 @@
 		tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
 		tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
 		$(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
+		tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
 		circlemod1 circlemod1a circlemod2 circlemod2a \
 		circlemod3 circlemod3a \
 		reldep8mod1 reldep8mod2 reldep8mod3 \
@@ -269,8 +268,8 @@
 endif
 ifeq (yesyes,$(have-fpie)$(build-shared))
 modules-names += tst-piemod1
-extra-test-objs += tst-pie1.o
-test-extras += tst-pie1
+tests += tst-pie1
+tests-pie += tst-pie1
 endif
 ifeq (x86_64,$(config-machine))
 modules-names += tst-auditmod3a tst-auditmod3b \
@@ -307,9 +306,8 @@
 ifeq (yes,$(have-fpie))
 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
 		  ifuncmain5pie ifuncmain6pie ifuncmain7pie
-tests: $(patsubst %,$(objpfx)%.out, $(ifunc-pie-tests))
-extra-test-objs += $(ifunc-pie-tests:=.o)
-test-extras += $(ifunc-pie-tests)
+tests += $(ifunc-pie-tests)
+tests-pie += $(ifunc-pie-tests)
 endif
 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
 endif
@@ -532,6 +530,8 @@
 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
+$(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
+$(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
@@ -833,6 +833,9 @@
 	$(compile-command.c) -DN=$*
 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
 
+$(objpfx)tst-tls19: $(libdl)
+$(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
+
 CFLAGS-tst-align.c = $(stack-align-test-flags)
 CFLAGS-tst-align2.c = $(stack-align-test-flags)
 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
@@ -918,20 +921,9 @@
 	$(objpfx)tst-array5-static > $@
 	cmp $@ tst-array5-static.exp > /dev/null
 
-ifeq (yesyes,$(have-fpie)$(build-shared))
 CFLAGS-tst-pie1.c += $(pie-ccflag)
 
-$(objpfx)tst-pie1.out: $(objpfx)tst-pie1
-	$(cross-test-wrapper) \
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)tst-pie1: $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so
-	$(+link-pie)
-
-generated += tst-pie1 tst-pie1.out tst-pie1.o
-endif
+$(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
 
 check-textrel-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
 $(objpfx)check-textrel: check-textrel.c
@@ -1102,7 +1094,6 @@
 
 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
 
-ifeq (yesyes,$(have-fpie)$(build-shared))
 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
@@ -1110,66 +1101,11 @@
 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
 
-$(objpfx)ifuncmain1pie.out: $(objpfx)ifuncmain1pie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain1pie: $(objpfx)ifuncmain1pie.o $(objpfx)ifuncmod1.so
-	$(+link-pie)
-
-generated += ifuncmain1pie ifuncmain1pie.out
-
-$(objpfx)ifuncmain1staticpie.out: $(objpfx)ifuncmain1staticpie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain1staticpie: $(objpfx)ifuncmain1staticpie.o $(objpfx)ifuncdep1pic.o
-	$(+link-pie)
-
-generated += ifuncmain1staticpie ifuncmain1staticpie.out
-
-$(objpfx)ifuncmain1vispie.out: $(objpfx)ifuncmain1vispie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain1vispie: $(objpfx)ifuncmain1vispie.o $(objpfx)ifuncmod1.so
-	$(+link-pie)
-
-generated += ifuncmain1vispie ifuncmain1vispie.out
-
-$(objpfx)ifuncmain5pie.out: $(objpfx)ifuncmain5pie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain5pie: $(objpfx)ifuncmain5pie.o $(objpfx)ifuncmod5.so
-	$(+link-pie)
-
-generated += ifuncmain5pie ifuncmain5pie.out
-
-$(objpfx)ifuncmain6pie.out: $(objpfx)ifuncmain6pie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain6pie: $(objpfx)ifuncmain6pie.o $(objpfx)ifuncmod6.so
-	$(+link-pie)
-
-generated += ifuncmain6pie ifuncmain6pie.out
-
-$(objpfx)ifuncmain7pie.out: $(objpfx)ifuncmain7pie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain7pie: $(objpfx)ifuncmain7pie.o
-	$(+link-pie)
-
-generated += ifuncmain7pie ifuncmain7pie.out
-endif
+$(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
+$(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
+$(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
+$(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
+$(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
 
 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)

Modified: trunk/libc/elf/dl-open.c
==============================================================================
--- trunk/libc/elf/dl-open.c (original)
+++ trunk/libc/elf/dl-open.c Sun May 15 05:22:50 2011
@@ -1,5 +1,5 @@
 /* Load a shared object at runtime, relocate it, and run its initializer.
-   Copyright (C) 1996-2007, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1996-2007, 2009, 2010, 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
@@ -347,6 +347,7 @@
   /* If the file is not loaded now as a dependency, add the search
      list of the newly loaded object to the scope.  */
   bool any_tls = false;
+  unsigned int first_static_tls = new->l_searchlist.r_nlist;
   for (unsigned int i = 0; i < new->l_searchlist.r_nlist; ++i)
     {
       struct link_map *imap = new->l_searchlist.r_list[i];
@@ -425,30 +426,9 @@
 	     might have to increase its size.  */
 	  _dl_add_to_slotinfo (imap);
 
-	  if (imap->l_need_tls_init)
-	    {
-	      /* For static TLS we have to allocate the memory here
-		 and now.  This includes allocating memory in the DTV.
-		 But we cannot change any DTV other than our own. So,
-		 if we cannot guarantee that there is room in the DTV
-		 we don't even try it and fail the load.
-
-		 XXX We could track the minimum DTV slots allocated in
-		 all threads.  */
-	      if (! RTLD_SINGLE_THREAD_P && imap->l_tls_modid > DTV_SURPLUS)
-		_dl_signal_error (0, "dlopen", NULL, N_("\
-cannot load any more object with static TLS"));
-
-	      imap->l_need_tls_init = 0;
-#ifdef SHARED
-	      /* Update the slot information data for at least the
-		 generation of the DSO we are allocating data for.  */
-	      _dl_update_slotinfo (imap->l_tls_modid);
-#endif
-
-	      GL(dl_init_static_tls) (imap);
-	      assert (imap->l_need_tls_init == 0);
-	    }
+	  if (imap->l_need_tls_init
+	      && first_static_tls == new->l_searchlist.r_nlist)
+	    first_static_tls = i;
 
 	  /* We have to bump the generation counter.  */
 	  any_tls = true;
@@ -459,6 +439,40 @@
   if (any_tls && __builtin_expect (++GL(dl_tls_generation) == 0, 0))
     _dl_fatal_printf (N_("\
 TLS generation counter wrapped!  Please report this."));
+
+  /* We need a second pass for static tls data, because _dl_update_slotinfo
+     must not be run while calls to _dl_add_to_slotinfo are still pending. */
+  for (unsigned int i = first_static_tls; i < new->l_searchlist.r_nlist; ++i)
+    {
+      struct link_map *imap = new->l_searchlist.r_list[i];
+
+      if (imap->l_need_tls_init
+	  && ! imap->l_init_called
+	  && imap->l_tls_blocksize > 0)
+	{
+	  /* For static TLS we have to allocate the memory here and
+	     now.  This includes allocating memory in the DTV.  But we
+	     cannot change any DTV other than our own. So, if we
+	     cannot guarantee that there is room in the DTV we don't
+	     even try it and fail the load.
+
+	     XXX We could track the minimum DTV slots allocated in
+	     all threads.  */
+	  if (! RTLD_SINGLE_THREAD_P && imap->l_tls_modid > DTV_SURPLUS)
+	    _dl_signal_error (0, "dlopen", NULL, N_("\
+cannot load any more object with static TLS"));
+
+	  imap->l_need_tls_init = 0;
+#ifdef SHARED
+	  /* Update the slot information data for at least the
+	     generation of the DSO we are allocating data for.  */
+	  _dl_update_slotinfo (imap->l_tls_modid);
+#endif
+
+	  GL(dl_init_static_tls) (imap);
+	  assert (imap->l_need_tls_init == 0);
+	}
+    }
 
   /* Run the initializer functions of new objects.  */
   _dl_init (new, args->argc, args->argv, args->env);

Modified: trunk/libc/iconv/loop.c
==============================================================================
--- trunk/libc/iconv/loop.c (original)
+++ trunk/libc/iconv/loop.c Sun May 15 05:22:50 2011
@@ -1,5 +1,5 @@
 /* Conversion loop frame work.
-   Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1998-2003, 2005, 2008, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -395,10 +395,14 @@
 #endif
 
   /* Are there enough bytes in the input buffer?  */
-  if (__builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
+  if (MIN_NEEDED_INPUT > 1
+      && __builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
     {
       *inptrp = inend;
 #ifdef STORE_REST
+      while (inptr < inend)
+	bytebuf[inlen++] = *inptr++;
+
       inptr = bytebuf;
       inptrp = &inptr;
       inend = &bytebuf[inlen];

Modified: trunk/libc/iconvdata/Makefile
==============================================================================
--- trunk/libc/iconvdata/Makefile (original)
+++ trunk/libc/iconvdata/Makefile Sun May 15 05:22:50 2011
@@ -71,7 +71,7 @@
 
 ifeq (yes,$(build-shared))
 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
-	tst-iconv6 bug-iconv5
+	tst-iconv6 bug-iconv5 bug-iconv8
 tests-$(OPTION_EGLIBC_LOCALE_CODE) += bug-iconv6 tst-iconv7
 ifeq ($(have-thread-library),yes)
 tests += bug-iconv3

Modified: trunk/libc/iconvdata/cp932.c
==============================================================================
--- trunk/libc/iconvdata/cp932.c (original)
+++ trunk/libc/iconvdata/cp932.c Sun May 15 05:22:50 2011
@@ -1,5 +1,5 @@
 /* Mapping tables for CP932 handling.
-   Copyright (C) 1997,1998,1999,2000,2001,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2001,2003,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by MORIYAMA Masayuki <msyk@xxxxxxxxxxxxxxxxx>, 2003.
 
@@ -4549,8 +4549,8 @@
       ++inptr;								      \
     else if (ch >= 0xa1 && ch <= 0xdf)                                        \
       {                                                                       \
-        ch += 0xfec0;                                                         \
-        ++inptr;                                                              \
+	ch += 0xfec0;                                                         \
+	++inptr;                                                              \
       }									      \
     else if (__builtin_expect (ch, 0) == 0xa0				      \
 	     || __builtin_expect (ch <= 0x80, 0)			      \
@@ -4588,65 +4588,63 @@
 	if (__builtin_expect (ch2 < 0x40, 0)				      \
 	    || __builtin_expect (ch2 > 0xfc, 0)				      \
 	    || __builtin_expect (ch2 == 0x7f, 0)			      \
-	    || (__builtin_expect (idx > 0x84be, 0) && idx < 0x8740)      \
-	    || (__builtin_expect (idx > 0x879c, 0) && idx < 0x889f)      \
-	    || (__builtin_expect (idx > 0x88fc, 0) && idx < 0x8940)      \
-	    || (__builtin_expect (idx > 0x9ffc, 0) && idx < 0xe040)      \
-	    || (__builtin_expect (idx > 0xeaa4, 0) && idx < 0xed40)      \
-	    || (__builtin_expect (idx > 0xeefc, 0) && idx < 0xf040)      \
+	    || (__builtin_expect (idx > 0x84be, 0) && idx < 0x8740)	      \
+	    || (__builtin_expect (idx > 0x879c, 0) && idx < 0x889f)	      \
+	    || (__builtin_expect (idx > 0x88fc, 0) && idx < 0x8940)	      \
+	    || (__builtin_expect (idx > 0x9ffc, 0) && idx < 0xe040)	      \
+	    || (__builtin_expect (idx > 0xeaa4, 0) && idx < 0xed40)	      \
+	    || (__builtin_expect (idx > 0xeefc, 0) && idx < 0xf040)	      \
 	    || __builtin_expect (idx > 0xfc4b, 0))			      \
 	  {								      \
 	    /* This is illegal.  */					      \
 	    if (! ignore_errors_p ())					      \
 	      {								      \
-	        /* This is an illegal character.  */			      \
-	        result = __GCONV_ILLEGAL_INPUT;				      \
-	        break;							      \
+		/* This is an illegal character.  */			      \
+		result = __GCONV_ILLEGAL_INPUT;				      \
+		break;							      \
 	      }								      \
 									      \
 	    ++inptr;							      \
 	    ++*irreversible;						      \
 	    continue;							      \
 	  }								      \
+									      \
+	/* We could pack the data a bit more dense.  The second		      \
+	   byte will never be 0x7f and it will also be never		      \
+	   >0xfc.  But this would mean yet more `if's.  */		      \
+	if (idx <= 0x84be)						      \
+	  ch = cjk_block1[(ch - 0x81) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0x879c)						      \
+	  ch = cjk_block2[(ch - 0x87) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0x88fc)						      \
+	  ch = cjk_block3[(ch - 0x88) * 192 + ch2 - 0x9f];		      \
+	else if (idx <= 0x9ffc)						      \
+	  ch = cjk_block4[(ch - 0x89) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0xeaa4)						      \
+	  ch = cjk_block5[(ch - 0xe0) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0xeefc)						      \
+	  ch = cjk_block6[(ch - 0xed) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0xf9fc)						      \
+	  ch = (ch-0xf0)*188 + ch2-((ch2<0x7f)?0x40:0x41) + 0xe000;	      \
 	else								      \
-	  {								      \
-	    /* We could pack the data a bit more dense.  The second	      \
-	       byte will never be 0x7f and it will also be never	      \
-	       >0xfc.  But this would mean yet more `if's.  */		      \
-	    if (idx <= 0x84be)						      \
-	      ch = cjk_block1[(ch - 0x81) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0x879c)					      \
-	      ch = cjk_block2[(ch - 0x87) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0x88fc)					      \
-	      ch = cjk_block3[(ch - 0x88) * 192 + ch2 - 0x9f];		      \
-	    else if (idx <= 0x9ffc)					      \
-	      ch = cjk_block4[(ch - 0x89) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0xeaa4)					      \
-	      ch = cjk_block5[(ch - 0xe0) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0xeefc)					      \
-	      ch = cjk_block6[(ch - 0xed) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0xf9fc)					      \
-	      ch = (ch-0xf0)*188 + ch2-((ch2<0x7f)?0x40:0x41) + 0xe000;	      \
-	    else							      \
-	      ch = cjk_block7[(ch - 0xfa) * 192 + ch2 - 0x40];		      \
-									      \
-	    inptr += 2;							      \
-	  }								      \
+	  ch = cjk_block7[(ch - 0xfa) * 192 + ch2 - 0x40];		      \
 									      \
 	if (__builtin_expect (ch, 1) == 0)				      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
 	    if (! ignore_errors_p ())					      \
 	      {								      \
-	        /* This is an illegal character.  */			      \
-	        result = __GCONV_ILLEGAL_INPUT;				      \
-	        break;							      \
+		/* This is an illegal character.  */			      \
+		result = __GCONV_ILLEGAL_INPUT;				      \
+		break;							      \
 	      }								      \
 									      \
 	    inptr += 2;							      \
 	    ++*irreversible;						      \
 	    continue;							      \
 	  }								      \
+									      \
+	inptr += 2;							      \
       }									      \
 									      \
     put32 (outptr, ch);							      \
@@ -4674,7 +4672,7 @@
 	else if (ch >= 0x2010 && ch <= 0x9fa0)				      \
 	  cp = from_ucs4_cjk[ch - 0x2010];				      \
 	else if (ch >= 0xe000 && ch <= 0xe757)				      \
-          {								      \
+	  {								      \
 	    pua[0] = (ch - 0xe000) / 188 + 0xf0;			      \
 	    pua[1] = (ch - 0xe000) % 188 + 0x40;			      \
 	    if (pua[1] > 0x7e)						      \

Modified: trunk/libc/include/assert.h
==============================================================================
--- trunk/libc/include/assert.h (original)
+++ trunk/libc/include/assert.h Sun May 15 05:22:50 2011
@@ -5,7 +5,7 @@
    so it has to be repeated here.  */
 extern void __assert_fail (__const char *__assertion, __const char *__file,
 			   unsigned int __line, __const char *__function)
-  __THROW __attribute__ ((__noreturn__));
+     __THROW __attribute__ ((__noreturn__));
 
 /* Likewise, but prints the error text for ERRNUM.  */
 extern void __assert_perror_fail (int __errnum, __const char *__file,
@@ -13,6 +13,12 @@
 				  __const char *__function)
      __THROW __attribute__ ((__noreturn__));
 
+/* The real implementation of the two functions above.  */
+extern void __assert_fail_base (const char *fmt, const char *assertion,
+				const char *file, unsigned int line,
+				const char *function)
+     __THROW  __attribute__ ((__noreturn__));
+
 #if !defined NOT_IN_libc || defined IS_IN_rtld
 hidden_proto (__assert_fail)
 hidden_proto (__assert_perror_fail)

Modified: trunk/libc/include/stdlib.h
==============================================================================
--- trunk/libc/include/stdlib.h (original)
+++ trunk/libc/include/stdlib.h Sun May 15 05:22:50 2011
@@ -223,16 +223,21 @@
 # define __cxa_atexit(func, arg, d) INTUSE(__cxa_atexit) (func, arg, d)
 # endif
 
-#endif
-
 extern void *__default_morecore (ptrdiff_t) __THROW;
 libc_hidden_proto (__default_morecore)
 
-extern char *__abort_msg;
+struct abort_msg_s
+{
+  unsigned int size;
+  char msg[0];
+};
+extern struct abort_msg_s *__abort_msg;
 libc_hidden_proto (__abort_msg)
 
 __END_DECLS
 
+#endif
+
 #undef __Need_M_And_C
 
 #endif  /* include/stdlib.h */

Modified: trunk/libc/libio/Makefile
==============================================================================
--- trunk/libc/libio/Makefile (original)
+++ trunk/libc/libio/Makefile Sun May 15 05:22:50 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2004,2006,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004,2006-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
@@ -67,7 +67,7 @@
 	tst-mmap2-eofsync tst-mmap-offend bug-fopena+		\
 	bug-ungetc2 bug-ungetc3 bug-ungetc4			\
 	tst-memstream1 tst-memstream2				\
-	bug-memstream1 tst-popen1
+	bug-memstream1 tst-popen1 bug-fclose1
 tests-$(OPTION_EGLIBC_LOCALE_CODE)				\
      += tst-swscanf tst-fgetws tst-fopenloc tst-setvbuf1	\
 	tst-ungetwc1 tst-ungetwc2 bug-ftell bug-ungetwc2	\

Modified: trunk/libc/libio/fileops.c
==============================================================================
--- trunk/libc/libio/fileops.c (original)
+++ trunk/libc/libio/fileops.c Sun May 15 05:22:50 2011
@@ -161,19 +161,27 @@
 _IO_new_file_close_it (fp)
      _IO_FILE *fp;
 {
-  int write_status, close_status;
   if (!_IO_file_is_open (fp))
     return EOF;
 
-  if ((fp->_flags & _IO_NO_WRITES) == 0
-      && (fp->_flags & _IO_CURRENTLY_PUTTING) != 0)
+  int write_status;
+  if (_IO_in_put_mode (fp))
     write_status = _IO_do_flush (fp);
+  else if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
+	   && !_IO_in_backup (fp))
+    {
+      off64_t o = _IO_SEEKOFF (fp, 0, _IO_seek_cur, 0);
+      if (o == WEOF)
+	write_status = EOF;
+      else
+	write_status = _IO_SYSSEEK (fp, o, SEEK_SET) < 0 ? EOF : 0;
+    }
   else
     write_status = 0;
 
   INTUSE(_IO_unsave_markers) (fp);
 
-  close_status = _IO_SYSCLOSE (fp);
+  int close_status = _IO_SYSCLOSE (fp);
 
   /* Free buffer. */
 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T

Modified: trunk/libc/libio/tst_putwc.c
==============================================================================
--- trunk/libc/libio/tst_putwc.c (original)
+++ trunk/libc/libio/tst_putwc.c Sun May 15 05:22:50 2011
@@ -1,5 +1,5 @@
 /* Simple test of putwc in the C locale.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2000.
 
@@ -74,13 +74,16 @@
   /* Now close the file, open it again, and read again.  */
   if (fclose (fp) != 0)
     {
-      printf ("failure during fclose(): %m");
+      printf ("failure during fclose: %m\n");
       res = 1;
     }
 
   fp = fopen (outname, "r");
   if (fp == NULL)
-    error (EXIT_FAILURE, errno, "cannot reopen file");
+    {
+      printf ("cannot reopen file: %m\n");
+      return 1;
+    }
 
   /* We can remove the file now.  */
   remove (outname);
@@ -104,7 +107,7 @@
 
   if (fclose (fp) != 0)
     {
-      puts ("failure during fclose()");
+      printf ("failure during fclose: %m\n");
       res = 1;
     }
 

Modified: trunk/libc/localedata/ChangeLog
==============================================================================
--- trunk/libc/localedata/ChangeLog (original)
+++ trunk/libc/localedata/ChangeLog Sun May 15 05:22:50 2011
@@ -1,3 +1,9 @@
+2011-05-14  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #12582]
+	* localedata/charmaps/en_SG (LC_TIME): Fix time formats.
+	Patch by KH Teo <b3virq3b@xxxxxxxxx>.
+
 2011-05-09  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	[BZ #11487]

Modified: trunk/libc/localedata/locales/en_SG
==============================================================================
--- trunk/libc/localedata/locales/en_SG (original)
+++ trunk/libc/localedata/locales/en_SG Sun May 15 05:22:50 2011
@@ -117,19 +117,20 @@
 am_pm       "<U0041><U004D>";"<U0050><U004D>"
 %
 % Appropriate date and time representation
-% %A %d,%B,%Y %I:%M:%S  %Z
-d_t_fmt     "<U0025><U0041><U0020><U0025><U0064><U002C><U0025><U0042><U002C><U0025><U0059><U0020><U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070><U0020><U0025><U005A>"
+% %a %d %b %Y %r
+d_t_fmt     "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0072>"
 %
 % Appropriate date representation
-% %A %d,%B,%Y
-d_fmt       "<U0025><U0041><U0020><U0025><U0064><U002C><U0025><U0042><U002C><U0025><U0059>"
+% %d/%m/%Y
+d_fmt       "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"
 %
 % Appropriate time representation
-% %I:%M:%S  %Z
-t_fmt       "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0020><U0025><U005A>"
+% %T
+t_fmt       "<U0025><U0054>"
 %
 % Appropriate 12 h time representation (%r)
-t_fmt_ampm  "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070><U0020><U0025><U005A>"
+% %I:%M:%S %p
+t_fmt_ampm  "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
 %
 END LC_TIME
 

Modified: trunk/libc/login/Makefile
==============================================================================
--- trunk/libc/login/Makefile (original)
+++ trunk/libc/login/Makefile Sun May 15 05:22:50 2011
@@ -34,6 +34,7 @@
 
 others = pt_chown
 others-$(OPTION_EGLIBC_UTMP) += utmpdump
+others-pie = pt_chown
 install-others-programs = $(inst_libexecdir)/pt_chown
 
 distribute := utmp-private.h utmp-equal.h pty-private.h
@@ -71,9 +72,6 @@
 LDLIBS-pt_chown = $(libcap)
 ifeq (yesyes,$(have-fpie)$(build-shared))
 LDFLAGS-pt_chown = -Wl,-z,now
-
-$(objpfx)pt_chown: $(objpfx)pt_chown.o
-	$(+link-pie)
 endif
 
 # pt_chown needs to be setuid root.

Modified: trunk/libc/nscd/Makefile
==============================================================================
--- trunk/libc/nscd/Makefile (original)
+++ trunk/libc/nscd/Makefile Sun May 15 05:22:50 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1998,2000,2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 1998,2000,2002-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
@@ -45,9 +45,8 @@
 endif
 ifeq ($(have-thread-library),yes)
 
-ifneq (yesyes,$(have-fpie)$(build-shared))
 others-$(OPTION_EGLIBC_INET) += nscd
-endif
+others-pie += nscd
 install-sbin-$(OPTION_EGLIBC_INET) += nscd
 
 extra-objs-$(OPTION_EGLIBC_INET) += $(nscd-modules:=.o)
@@ -133,10 +132,7 @@
 CFLAGS-nis_hash.c += $(nscd-cflags)
 
 ifeq (yesyes,$(have-fpie)$(build-shared))
-relro-LDFLAGS += -Wl,-z,now
-
-$(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
-	$(+link-pie)
+LDFLAGS-nscd = -Wl,-z,now
 endif
 
 # This makes sure -DNOT_IN_libc is passed for all these modules.

Modified: trunk/libc/stdlib/abort.c
==============================================================================
--- trunk/libc/stdlib/abort.c (original)
+++ trunk/libc/stdlib/abort.c Sun May 15 05:22:50 2011
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,93,1995-1998,2001,02,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993,1995-1998,2001,2002,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
@@ -37,7 +38,7 @@
 #endif
 
 /* Exported variable to locate abort message in core files etc.  */
-char *__abort_msg __attribute__ ((nocommon));
+struct abort_msg_s *__abort_msg __attribute__ ((nocommon));
 libc_hidden_def (__abort_msg)
 
 /* We must avoid to run in circles.  Therefore we remember how far we

Modified: trunk/libc/sysdeps/generic/elf/backtracesymsfd.c
==============================================================================
--- trunk/libc/sysdeps/generic/elf/backtracesymsfd.c (original)
+++ trunk/libc/sysdeps/generic/elf/backtracesymsfd.c Sun May 15 05:22:50 2011
@@ -1,5 +1,5 @@
 /* Write formatted list with names for addresses in backtrace to a file.
-   Copyright (C) 1998,2000,2003,2005,2009 Free Software Foundation, Inc.
+   Copyright (C) 1998,2000,2003,2005,2009,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -28,7 +28,7 @@
 #if __ELF_NATIVE_CLASS == 32
 # define WORD_WIDTH 8
 #else
-/* We assyme 64bits.  */
+/* We assume 64bits.  */
 # define WORD_WIDTH 16
 #endif
 
@@ -45,6 +45,7 @@
   for (cnt = 0; cnt < size; ++cnt)
     {
       char buf[WORD_WIDTH];
+      char buf2[WORD_WIDTH];
       Dl_info info;
       struct link_map *map;
       size_t last = 0;
@@ -59,7 +60,6 @@
 
 	  if (info.dli_sname != NULL || map->l_addr != 0)
 	    {
-	      char buf2[WORD_WIDTH];
 	      size_t diff;
 
 	      iov[last].iov_base = (void *) "(";

Modified: trunk/libc/sysdeps/ia64/backtrace.c
==============================================================================
--- trunk/libc/sysdeps/ia64/backtrace.c (original)
+++ trunk/libc/sysdeps/ia64/backtrace.c Sun May 15 05:22:50 2011
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2005, 2007, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2003.
 
@@ -27,13 +27,25 @@
 struct trace_arg
 {
   void **array;
-  int cnt, size;
+  _Unwind_Word cfa;
+  int cnt;
+  int size;
 };
 
 #ifdef SHARED
 static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
 static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
+static _Unwind_Word (*unwind_getcfa) (struct _Unwind_Context *);
 static void *libgcc_handle;
+
+
+/* Dummy version in case libgcc_s does not contain the real code.  */
+static _Unwind_Word
+dummy_getcfa (struct _Unwind_Context *ctx __attribute__ ((unused)))
+{
+  return 0;
+}
+
 
 static void
 init (void)
@@ -47,10 +59,13 @@
   unwind_getip = __libc_dlsym (libgcc_handle, "_Unwind_GetIP");
   if (unwind_getip == NULL)
     unwind_backtrace = NULL;
+  unwind_getcfa = (__libc_dlsym (libgcc_handle, "_Unwind_GetCFA")
+		   ?: dummy_getcfa);
 }
 #else
 # define unwind_backtrace _Unwind_Backtrace
 # define unwind_getip _Unwind_GetIP
+# define unwind_getcfa _Unwind_GetCFA
 #endif
 
 static _Unwind_Reason_Code
@@ -65,8 +80,12 @@
       arg->array[arg->cnt] = (void *) unwind_getip (ctx);
 
       /* Check whether we make any progress.  */
-      if (arg->cnt > 0 && arg->array[arg->cnt - 1] == arg->array[arg->cnt])
+      _Unwind_Word cfa = unwind_getcfa (ctx);
+
+      if (arg->cnt > 0 && arg->array[arg->cnt - 1] == arg->array[arg->cnt]
+	  && cfa == arg->cfa)
 	return _URC_END_OF_STACK;
+      arg->cfa = cfa;
     }
   if (++arg->cnt == arg->size)
     return _URC_END_OF_STACK;
@@ -78,7 +97,7 @@
      void **array;
      int size;
 {
-  struct trace_arg arg = { .array = array, .size = size, .cnt = -1 };
+  struct trace_arg arg = { .array = array, .cfa = 0, .size = size, .cnt = -1 };
 #ifdef SHARED
   __libc_once_define (static, once);
 

Modified: trunk/libc/sysdeps/posix/libc_fatal.c
==============================================================================
--- trunk/libc/sysdeps/posix/libc_fatal.c (original)
+++ trunk/libc/sysdeps/posix/libc_fatal.c Sun May 15 05:22:50 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993-1995,1997,2000,2004,2005,2009
+/* Copyright (C) 1993-1995,1997,2000,2004,2005,2009,2011
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -20,6 +20,7 @@
 #include <atomic.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <ldsodefs.h>
 #include <paths.h>
 #include <stdarg.h>
 #include <stdbool.h>
@@ -125,18 +126,28 @@
       if (TEMP_FAILURE_RETRY (__writev (fd, iov, nlist)) == total)
 	written = true;
 
-      char *buf = do_abort ? malloc (total + 1) : NULL;
-      if (buf != NULL)
+      if (do_abort)
 	{
-	  char *wp = buf;
-	  for (int cnt = 0; cnt < nlist; ++cnt)
-	    wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
-	  *wp = '\0';
+	  total = ((total + 1 + GLRO(dl_pagesize) - 1)
+		   & ~(GLRO(dl_pagesize) - 1));
+	  struct abort_msg_s *buf = __mmap (NULL, total,
+					    PROT_READ | PROT_WRITE,
+					    MAP_ANON | MAP_PRIVATE, -1, 0);
+	  if (buf != MAP_FAILED)
+	    {
+	      buf->size = total;
+	      char *wp = buf->msg;
+	      for (int cnt = 0; cnt < nlist; ++cnt)
+		wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
+	      *wp = '\0';
 
-	  /* We have to free the old buffer since the application might
-	     catch the SIGABRT signal.  */
-	  char *old = atomic_exchange_acq (&__abort_msg, buf);
-	  free (old);
+	      /* We have to free the old buffer since the application might
+		 catch the SIGABRT signal.  */
+	      struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg,
+							     buf);
+	      if (old != NULL)
+		__munmap (old, old->size);
+	    }
 	}
     }
 

Modified: trunk/libc/sysdeps/pthread/aio_misc.c
==============================================================================
--- trunk/libc/sysdeps/pthread/aio_misc.c (original)
+++ trunk/libc/sysdeps/pthread/aio_misc.c Sun May 15 05:22:50 2011
@@ -1,5 +1,5 @@
 /* Handle general operations.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006, 2007, 2009
+   Copyright (C) 1997-2001, 2003, 2004, 2006, 2007, 2009, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1997.
@@ -26,6 +26,7 @@
 #include <pthread.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <aio_misc.h>
@@ -87,7 +88,7 @@
 static struct aioinit optim =
 {
   20,	/* int aio_threads;	Maximal number of threads.  */
-  64,	/* int aio_num;		Number of expected simultanious requests. */
+  64,	/* int aio_num;		Number of expected simultaneous requests. */
   0,
   0,
   0,
@@ -282,9 +283,10 @@
   if (pool == NULL)
     {
       optim.aio_threads = init->aio_threads < 1 ? 1 : init->aio_threads;
+      assert (powerof2 (ENTRIES_PER_ROW));
       optim.aio_num = (init->aio_num < ENTRIES_PER_ROW
 		       ? ENTRIES_PER_ROW
-		       : init->aio_num & ~ENTRIES_PER_ROW);
+		       : init->aio_num & ~(ENTRIES_PER_ROW - 1));
     }
 
   if (init->aio_idle_time != 0)

Modified: trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c Sun May 15 05:22:50 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993-1995,1997,2000,2002-2005,2009
+/* Copyright (C) 1993-1995,1997,2000,2002-2005,2009,2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -20,6 +20,7 @@
 #include <atomic.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <ldsodefs.h>
 #include <paths.h>
 #include <stdarg.h>
 #include <stdbool.h>
@@ -28,6 +29,7 @@
 #include <string.h>
 #include <sysdep.h>
 #include <unistd.h>
+#include <sys/mman.h>
 #include <sys/syslog.h>
 #include <execinfo.h>
 #include <gnu/option-groups.h>
@@ -135,18 +137,28 @@
       if (cnt == total)
 	written = true;
 
-      char *buf = do_abort ? malloc (total + 1) : NULL;
-      if (buf != NULL)
-	{
-	  char *wp = buf;
-	  for (int cnt = 0; cnt < nlist; ++cnt)
-	    wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
-	  *wp = '\0';
-
-	  /* We have to free the old buffer since the application might
-	     catch the SIGABRT signal.  */
-	  char *old = atomic_exchange_acq (&__abort_msg, buf);
-	  free (old);
+      if (do_abort)
+	{
+	  total = ((total + 1 + GLRO(dl_pagesize) - 1)
+		   & ~(GLRO(dl_pagesize) - 1));
+	  struct abort_msg_s *buf = __mmap (NULL, total,
+					    PROT_READ | PROT_WRITE,
+					    MAP_ANON | MAP_PRIVATE, -1, 0);
+	  if (__builtin_expect (buf != MAP_FAILED, 1))
+	    {
+	      buf->size = total;
+	      char *wp = buf->msg;
+	      for (int cnt = 0; cnt < nlist; ++cnt)
+		wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
+	      *wp = '\0';
+
+	      /* We have to free the old buffer since the application might
+		 catch the SIGABRT signal.  */
+	      struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg,
+							     buf);
+	      if (old != NULL)
+		__munmap (old, old->size);
+	    }
 	}
     }