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

Re: [SRM] Uploading new upstream stable version to Squeeze?



On Wed, Jun 08, 2011 at 07:12:57PM +0200, Philipp Kern wrote:
> Aurelien,
> 
> On Sun, Jun 05, 2011 at 12:23:51PM +0200, Aurelien Jarno wrote:
> > For a few upstream releases now, some people are maintaining a stable 
> > branch for some versions of the glibc [1], which is followed by eglibc
> > [2]. This is the case for the 2.11 version we are using in Squeeze, it
> > is not sure yet which next version will have a long term support. The 
> > branch only consists of patches cherry-picked from HEAD after a few 
> > weeks. Some of the patches in this branch fix already reported bugs [3],
> > but some of them [4] are likely to be reported later during Squeeze
> > lifetime.
> > 
> > I am therefore thinking about uploading the next upstream stable version
> > (2.11.4 is currently in test period, it will be released in the next
> > days), similarly to what is currently done for the kernel. What's your
> > opinion on that, is it something that you would allow?
> 
> [3] and [4] look fine, I'd like to see the whole diff against Squeeze, though.
> Is it reviewable?  (Added test cases also seem like a great idea, FWIW.)
> 

Please find attached the diff between the upstream version in Squeeze
and the current upstream version. You will find the upstream changelog
in the diff, to understand all the changes. Please note that some parts
are already included as patches in the Squeeze version, and that will
have to be dropped. Here are the corresponding debian/changelog entries:

  * Update from stable upstream version:
    - fix wrong memmove/bcopy optimization with gcc-4.6.  Closes: #619963.
    - fix an integer overflow in fnmatch() (CVE-2011-1659).  Closes: #626370.
    - fix spurious warning in bswap_16() with -Wconversion.  Closes: #561249.
    - fix auxiliary cache file creation.  Closes: #588218.
  * Drop patches included in the new version:
    - patches/any/cvs-redirect-throw.diff
    - patches/any/cvs-flush-cache-textrels.diff
    - patches/hurd-i386/cvs-linkat.diff
    - patches/hurd-i386/cvs-select.diff
    - patches/sparc/submitted-epoll.diff
    - patches/any/cvs-dont-expand-dst-twice.diff
    - patches/amd64/cvs-avx-tcb-alignment.diff 

If it is possible to upload such a version, I'll integrate that in the
SVN and I'll provide a full diff of the debian/ directory for final 
review. We'll include some small other changes (e.g. support for kernel 
3.0 in the preinst script).

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net
SVN update of svn://svn.eglibc.org/branches/eglibc-2_11 from revision 10714

--- a/stdlib/bug-getcontext.c	(révision 0)
+++ b/stdlib/bug-getcontext.c	(révision 14168)
@@ -0,0 +1,48 @@
+/* BZ 12420 */
+
+#include <errno.h>
+#include <fenv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ucontext.h>
+
+static int
+do_test (void)
+{
+  int except_mask =  FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW;
+  int status = feenableexcept (except_mask);
+
+  except_mask = fegetexcept ();
+  if (except_mask == -1)
+    {
+      printf("\nBefore getcontext(): fegetexcept returned: %d\n",
+	     except_mask);
+      return 1;
+    }
+
+  ucontext_t ctx;
+  status = getcontext(&ctx);
+  if (status)
+    {
+      printf("\ngetcontext failed, errno: %d.\n", errno);
+      return 1;
+    }
+
+  printf ("\nDone with getcontext()!\n");
+  fflush (NULL);
+
+  int mask = fegetexcept ();
+  if (mask != except_mask)
+    {
+      printf("\nAfter getcontext(): fegetexcept returned: %d, expected: %d.\n",
+	     mask, except_mask);
+      return 1;
+    }
+
+  printf("\nAt end fegetexcept() returned %d, expected: %d.\n",
+	 mask, except_mask);
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
--- a/stdlib/msort.c	(révision 10714)
+++ b/stdlib/msort.c	(révision 14168)
@@ -25,6 +25,7 @@
 #include <unistd.h>
 #include <memcopy.h>
 #include <errno.h>
+#include <atomic.h>
 
 struct msort_param
 {
@@ -182,7 +183,7 @@
       static long int phys_pages;
       static int pagesize;
 
-      if (phys_pages == 0)
+      if (pagesize == 0)
 	{
 	  phys_pages = __sysconf (_SC_PHYS_PAGES);
 
@@ -197,6 +198,9 @@
 	     a quarter of the physical memory.  */
 	  phys_pages /= 4;
 
+	  /* Make sure phys_pages is written to memory.  */
+	  atomic_write_barrier ();
+
 	  pagesize = __sysconf (_SC_PAGESIZE);
 	}
 
--- a/stdlib/Makefile	(révision 10714)
+++ b/stdlib/Makefile	(révision 14168)
@@ -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
@@ -80,7 +80,7 @@
 		   test-a64l tst-qsort tst-system bug-strtod2		    \
 		   tst-atof1 tst-atof2 tst-strtod2 tst-rand48-2             \
 		   tst-makecontext tst-qsort2 tst-makecontext2 tst-strtod6  \
-		   tst-unsetenv1
+		   tst-unsetenv1 bug-getcontext
 tests-$(OPTION_EGLIBC_LOCALE_CODE) \
 		+= tst-strtod3 tst-strtod4 tst-strtod5 testmb2
 tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
@@ -159,3 +159,10 @@
 $(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os
 	$(build-module)
 CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1
+
+ifeq ($(build-shared),yes)
+link-libm = $(common-objpfx)math/libm.so
+else
+link-libm = $(common-objpfx)math/libm.a
+endif
+$(objpfx)bug-getcontext: $(link-libm)
--- a/stdlib/strtod_l.c	(révision 10714)
+++ b/stdlib/strtod_l.c	(révision 14168)
@@ -1504,7 +1504,9 @@
 			  register int i;
 			  (void) __mpn_lshift (&retval[used
 						       / BITS_PER_MP_LIMB],
-					       retval, RETURN_LIMB_SIZE,
+					       retval,
+					       (RETURN_LIMB_SIZE
+						- used / BITS_PER_MP_LIMB),
 					       used % BITS_PER_MP_LIMB);
 			  for (i = used / BITS_PER_MP_LIMB - 1; i >= 0; --i)
 			    retval[i] = 0;
--- a/scripts/data/localplt-s390x-linux-gnu.data	(révision 0)
+++ b/scripts/data/localplt-s390x-linux-gnu.data	(révision 14168)
@@ -0,0 +1,7 @@
+libc.so: _Unwind_Find_FDE
+libc.so: calloc
+libc.so: free
+libc.so: malloc
+libc.so: memalign
+libc.so: realloc
+libm.so: matherr
--- a/scripts/data/localplt-s390-linux-gnu.data	(révision 0)
+++ b/scripts/data/localplt-s390-linux-gnu.data	(révision 14168)
@@ -0,0 +1,7 @@
+libc.so: _Unwind_Find_FDE
+libc.so: calloc
+libc.so: free
+libc.so: malloc
+libc.so: memalign
+libc.so: realloc
+libm.so: matherr
--- a/nscd/hstcache.c	(révision 10714)
+++ b/nscd/hstcache.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Cache handling for host lookup.
-   Copyright (C) 1998-2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -77,6 +77,20 @@
 };
 
 
+/* This is the standard reply in case there are temporary problems.  */
+static const hst_response_header tryagain =
+{
+  .version = NSCD_VERSION,
+  .found = 0,
+  .h_name_len = 0,
+  .h_aliases_cnt = 0,
+  .h_addrtype = -1,
+  .h_length = -1,
+  .h_addr_list_cnt = 0,
+  .error = TRY_AGAIN
+};
+
+
 static void
 cache_addhst (struct database_dyn *db, int fd, request_header *req,
 	      const void *key, struct hostent *hst, uid_t owner,
@@ -111,11 +125,15 @@
       else
 	{
 	  /* We have no data.  This means we send the standard reply for this
-	     case.  */
+	     case.  Possibly this is only temporary.  */
 	  ssize_t total = sizeof (notfound);
+	  assert (sizeof (notfound) == sizeof (tryagain));
 
+	  const hst_response_header *resp = (errval == EAGAIN
+					     ? &tryagain : &notfound);
+
 	  if (fd != -1 &&
-	      TEMP_FAILURE_RETRY (send (fd, &notfound, total,
+	      TEMP_FAILURE_RETRY (send (fd, resp, total,
 					MSG_NOSIGNAL)) != total)
 	    all_written = false;
 
@@ -135,7 +153,7 @@
 					   ? db->negtimeout : ttl);
 
 	      /* This is the reply.  */
-	      memcpy (&dataset->resp, &notfound, total);
+	      memcpy (&dataset->resp, resp, total);
 
 	      /* Copy the key data.  */
 	      memcpy (dataset->strdata, key, req->key_len);
@@ -490,6 +508,7 @@
 	      /* We set the error to indicate this is (possibly) a
 		 temporary error and that it does not mean the entry
 		 is not available at all.  */
+	      h_errno = TRY_AGAIN;
 	      errval = EAGAIN;
 	      break;
 	    }
--- a/libio/fmemopen.c	(révision 10714)
+++ b/libio/fmemopen.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Fmemopen implementation.
-   Copyright (C) 2000, 2002, 2005, 2006, 2008, 2009
+   Copyright (C) 2000, 2002, 2005, 2006, 2008, 2009, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Hanno Mueller, kontakt@hanno.de, 2000.
@@ -243,7 +243,7 @@
   if (mode[0] == 'w')
     c->buffer[0] = '\0';
 
-  c->maxpos = strlen (c->buffer);
+  c->maxpos = strnlen (c->buffer, len);
 
   if (mode[0] == 'a')
     c->pos = c->maxpos;
--- a/libio/bug-fclose1.c	(révision 0)
+++ b/libio/bug-fclose1.c	(révision 14168)
@@ -0,0 +1,132 @@
+// BZ #12724
+
+static void do_prepare (void);
+#define PREPARE(argc, argv) do_prepare ()
+static int do_test (void);
+#define TEST_FUNCTION do_test()
+#include "../test-skeleton.c"
+
+
+static int fd;
+
+
+static void
+do_prepare (void)
+{
+  fd = create_temp_file ("bug-fclose1.", NULL);
+  if (fd == -1)
+    {
+      printf ("cannot create temporary file: %m\n");
+      exit (1);
+    }
+}
+
+
+static int
+do_test (void)
+{
+  static const char pattern[] = "hello world";
+
+  /* Prepare a seekable file.  */
+  if (write (fd, pattern, sizeof pattern) != sizeof pattern)
+    {
+      printf ("cannot write pattern: %m\n");
+      return 1;
+    }
+  if (lseek (fd, 1, SEEK_SET) != 1)
+    {
+      printf ("cannot seek after write: %m\n");
+      return 1;
+    }
+
+  /* Create an output stream visiting the file; when it is closed, all
+     other file descriptors visiting the file must see the new file
+     position.  */
+  int fd2 = dup (fd);
+  if (fd2 < 0)
+    {
+      printf ("cannot duplicate descriptor for writing: %m\n");
+      return 1;
+    }
+  FILE *f = fdopen (fd2, "w");
+  if (f == NULL)
+    {
+      printf ("first fdopen failed: %m\n");
+      return 1;
+    }
+  if (fputc (pattern[1], f) != pattern[1])
+    {
+      printf ("fputc failed: %m\n");
+      return 1;
+    }
+  if (fclose (f) != 0)
+    {
+      printf ("first fclose failed: %m\n");
+      return 1;
+    }
+  errno = 0;
+  if (lseek (fd2, 0, SEEK_CUR) != -1)
+    {
+      printf ("lseek after fclose after write did not fail\n");
+      return 1;
+    }
+  if (errno != EBADF)
+    {
+      printf ("lseek after fclose after write did not fail with EBADF: %m\n");
+      return 1;
+    }
+  off_t o = lseek (fd, 0, SEEK_CUR);
+  if (o != 2)
+    {
+      printf ("\
+lseek on original descriptor after first fclose returned %ld, expected 2\n",
+	      (long int) o);
+      return 1;
+    }
+
+  /* Likewise for an input stream.  */
+  fd2 = dup (fd);
+  if (fd2 < 0)
+     {
+      printf ("cannot duplicate descriptor for reading: %m\n");
+      return 1;
+    }
+  f = fdopen (fd2, "r");
+   if (f == NULL)
+    {
+      printf ("second fdopen failed: %m\n");
+      return 1;
+    }
+   char c = fgetc (f);
+   if (c != pattern[2])
+     {
+       printf ("getc returned %c, expected %c\n", c, pattern[2]);
+       return 1;
+     }
+  if (fclose (f) != 0)
+    {
+      printf ("second fclose failed: %m\n");
+      return 1;
+    }
+  errno = 0;
+  if (lseek (fd2, 0, SEEK_CUR) != -1)
+    {
+      printf ("lseek after fclose after read did not fail\n");
+      return 1;
+    }
+  if (errno != EBADF)
+    {
+      printf ("lseek after fclose after read did not fail with EBADF: %m\n");
+      return 1;
+    }
+  o = lseek (fd, 0, SEEK_CUR);
+  if (o != 3)
+    {
+      printf ("\
+lseek on original descriptor after second fclose returned %ld, expected 3\n",
+	      (long int) o);
+      return 1;
+    }
+
+  return 0;
+}
--- a/libio/stdio.h	(révision 10714)
+++ b/libio/stdio.h	(révision 14168)
@@ -427,9 +427,9 @@
 		       __isoc99_fscanf) __wur;
 extern int __REDIRECT (scanf, (__const char *__restrict __format, ...),
 		       __isoc99_scanf) __wur;
-extern int __REDIRECT (sscanf, (__const char *__restrict __s,
-				__const char *__restrict __format, ...),
-		       __isoc99_sscanf) __THROW;
+extern int __REDIRECT_NTH (sscanf, (__const char *__restrict __s,
+				    __const char *__restrict __format, ...),
+			   __isoc99_sscanf);
 # else
 extern int __isoc99_fscanf (FILE *__restrict __stream,
 			    __const char *__restrict __format, ...) __wur;
@@ -481,11 +481,11 @@
 extern int __REDIRECT (vscanf, (__const char *__restrict __format,
 				_G_va_list __arg), __isoc99_vscanf)
      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT (vsscanf,
-		       (__const char *__restrict __s,
-			__const char *__restrict __format, _G_va_list __arg),
-		       __isoc99_vsscanf)
-     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
+extern int __REDIRECT_NTH (vsscanf,
+			   (__const char *__restrict __s,
+			    __const char *__restrict __format,
+			    _G_va_list __arg), __isoc99_vsscanf)
+     __attribute__ ((__format__ (__scanf__, 2, 0)));
 #  else
 extern int __isoc99_vfscanf (FILE *__restrict __s,
 			     __const char *__restrict __format,
--- a/libio/fileops.c	(révision 10714)
+++ b/libio/fileops.c	(révision 14168)
@@ -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
@@ -291,7 +299,7 @@
 #ifdef _LIBC
   last_recognized = mode;
 #endif
-  for (i = 1; i < 6; ++i)
+  for (i = 1; i < 7; ++i)
     {
       switch (*++mode)
 	{
@@ -1005,18 +1013,18 @@
       /* Adjust for read-ahead (bytes is buffer). */
       offset -= fp->_IO_read_end - fp->_IO_read_ptr;
       if (fp->_offset == _IO_pos_BAD)
-        {
-          if (mode != 0)
-            goto dumb;
-          else
-            {
-              result = _IO_SYSSEEK (fp, 0, dir);
-              if (result == EOF)
-                return result;
+	{
+	  if (mode != 0)
+	    goto dumb;
+	  else
+	    {
+	      result = _IO_SYSSEEK (fp, 0, dir);
+	      if (result == EOF)
+		return result;
 
-              fp->_offset = result;
-            }
-        }
+	      fp->_offset = result;
+	    }
+	}
       /* Make offset absolute, assuming current pointer is file_ptr(). */
       offset += fp->_offset;
       if (offset < 0)
@@ -1278,7 +1286,7 @@
 	{
 	  f->_flags |= _IO_ERR_SEEN;
 	  break;
-        }
+	}
       to_do -= count;
       data = (void *) ((char *) data + count);
     }
@@ -1366,12 +1374,12 @@
       do_write = to_do - (block_size >= 128 ? to_do % block_size : 0);
 
       if (do_write)
-        {
+	{
 	  count = new_do_write (f, s, do_write);
 	  to_do -= count;
 	  if (count < do_write)
 	    return n - to_do;
-        }
+	}
 
       /* Now write out the remainder.  Normally, this will fit in the
 	 buffer, but it's somewhat messier for line-buffered files,
--- a/libio/Makefile	(révision 10714)
+++ b/libio/Makefile	(révision 14168)
@@ -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	\
--- a/wcsmbs/bits/wchar2.h	(révision 10714)
+++ b/wcsmbs/bits/wchar2.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Checking macros for wchar functions.
-   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007, 2010 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,15 +60,13 @@
 						   __const wchar_t *__s2,
 						   size_t __n), wmemmove);
 extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn,
-				(wchar_t *__restrict __s1,
-				 __const wchar_t *__restrict __s2, size_t __n,
-				 size_t __ns1), __wmemmove_chk)
+				(wchar_t *__s1, __const wchar_t *__s2,
+				 size_t __n, size_t __ns1), __wmemmove_chk)
      __warnattr ("wmemmove called with length bigger than size of destination "
 		 "buffer");
 
 __extern_always_inline wchar_t *
-__NTH (wmemmove (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
-		 size_t __n))
+__NTH (wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n))
 {
   if (__bos0 (__s1) != (size_t) -1)
     {
@@ -129,7 +127,7 @@
 		 "buffer");
 
 __extern_always_inline wchar_t *
-__NTH (wmemset (wchar_t *__restrict __s, wchar_t __c, size_t __n))
+__NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n))
 {
   if (__bos0 (__s) != (size_t) -1)
     {
@@ -152,7 +150,7 @@
 				 __const wchar_t *__restrict __src), wcscpy);
 
 __extern_always_inline wchar_t *
-__NTH (wcscpy (wchar_t *__dest, __const wchar_t *__src))
+__NTH (wcscpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src))
 {
   if (__bos (__dest) != (size_t) -1)
     return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
@@ -160,14 +158,15 @@
 }
 
 
-extern wchar_t *__wcpcpy_chk (wchar_t *__dest, __const wchar_t *__src,
+extern wchar_t *__wcpcpy_chk (wchar_t *__restrict __dest,
+			      __const wchar_t *__restrict __src,
 			      size_t __destlen) __THROW;
-extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, (wchar_t *__dest,
-						 __const wchar_t *__src),
-				wcpcpy);
+extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias,
+				(wchar_t *__restrict __dest,
+				 __const wchar_t *__restrict __src), wcpcpy);
 
 __extern_always_inline wchar_t *
-__NTH (wcpcpy (wchar_t *__dest, __const wchar_t *__src))
+__NTH (wcpcpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src))
 {
   if (__bos (__dest) != (size_t) -1)
     return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
@@ -190,7 +189,8 @@
 		 "buffer");
 
 __extern_always_inline wchar_t *
-__NTH (wcsncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n))
+__NTH (wcsncpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src,
+		size_t __n))
 {
   if (__bos (__dest) != (size_t) -1)
     {
@@ -220,7 +220,8 @@
 		 "buffer");
 
 __extern_always_inline wchar_t *
-__NTH (wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n))
+__NTH (wcpncpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src,
+		size_t __n))
 {
   if (__bos (__dest) != (size_t) -1)
     {
@@ -243,7 +244,7 @@
 				 __const wchar_t *__restrict __src), wcscat);
 
 __extern_always_inline wchar_t *
-__NTH (wcscat (wchar_t *__dest, __const wchar_t *__src))
+__NTH (wcscat (wchar_t *__restrict __dest, __const wchar_t *__restrict __src))
 {
   if (__bos (__dest) != (size_t) -1)
     return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
@@ -260,7 +261,8 @@
 				 size_t __n), wcsncat);
 
 __extern_always_inline wchar_t *
-__NTH (wcsncat (wchar_t *__dest, __const wchar_t *__src, size_t __n))
+__NTH (wcsncat (wchar_t *__restrict __dest, __const wchar_t *__restrict __src,
+		size_t __n))
 {
   if (__bos (__dest) != (size_t) -1)
     return __wcsncat_chk (__dest, __src, __n,
@@ -428,14 +430,16 @@
 #endif
 
 
-extern size_t __wcrtomb_chk (char *__s, wchar_t __wchar, mbstate_t *__p,
-			  size_t __buflen) __THROW __wur;
+extern size_t __wcrtomb_chk (char *__restrict __s, wchar_t __wchar,
+			     mbstate_t *__restrict __p,
+			     size_t __buflen) __THROW __wur;
 extern size_t __REDIRECT_NTH (__wcrtomb_alias,
 			      (char *__restrict __s, wchar_t __wchar,
 			       mbstate_t *__restrict __ps), wcrtomb) __wur;
 
 __extern_always_inline __wur size_t
-__NTH (wcrtomb (char *__s, wchar_t __wchar, mbstate_t *__ps))
+__NTH (wcrtomb (char *__restrict __s, wchar_t __wchar,
+		mbstate_t *__restrict __ps))
 {
   /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
      But this would only disturb the namespace.  So we define our own
--- a/wcsmbs/wcsatcliff.c	(révision 10714)
+++ b/wcsmbs/wcsatcliff.c	(révision 14168)
@@ -16,6 +16,8 @@
 #define MEMCPY wmemcpy
 #define MEMPCPY wmempcpy
 #define MEMCHR wmemchr
+#define STRCMP wcscmp
+#define STRNCMP wcsncmp
 
 
 #include "../string/stratcliff.c"
--- a/wcsmbs/wchar.h	(révision 10714)
+++ b/wcsmbs/wchar.h	(révision 14168)
@@ -319,8 +319,7 @@
 #endif
 
 /* Compare N wide characters of S1 and S2.  */
-extern int wmemcmp (__const wchar_t *__restrict __s1,
-		    __const wchar_t *__restrict __s2, size_t __n)
+extern int wmemcmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
      __THROW __attribute_pure__;
 
 /* Copy N wide characters of SRC to DEST.  */
@@ -561,11 +560,13 @@
 #ifdef	__USE_XOPEN2K8
 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
    DEST.  */
-extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
+extern wchar_t *wcpcpy (wchar_t *__restrict __dest,
+			__const wchar_t *__restrict __src) __THROW;
 
 /* Copy no more than N characters of SRC to DEST, returning the address of
    the last character written into DEST.  */
-extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
+extern wchar_t *wcpncpy (wchar_t *__restrict __dest,
+			 __const wchar_t *__restrict __src, size_t __n)
      __THROW;
 #endif	/* use GNU */
 
@@ -658,10 +659,10 @@
 extern int __REDIRECT (wscanf, (__const wchar_t *__restrict __format, ...),
 		       __isoc99_wscanf)
      /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
-extern int __REDIRECT (swscanf, (__const wchar_t *__restrict __s,
-				 __const wchar_t *__restrict __format, ...),
-		       __isoc99_swscanf)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
+extern int __REDIRECT_NTH (swscanf, (__const wchar_t *__restrict __s,
+				     __const wchar_t *__restrict __format,
+				     ...), __isoc99_swscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
 #  else
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     __const wchar_t *__restrict __format, ...);
@@ -712,10 +713,10 @@
 extern int __REDIRECT (vwscanf, (__const wchar_t *__restrict __format,
 				 __gnuc_va_list __arg), __isoc99_vwscanf)
      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
-extern int __REDIRECT (vswscanf, (__const wchar_t *__restrict __s,
-				  __const wchar_t *__restrict __format,
-				  __gnuc_va_list __arg), __isoc99_vswscanf)
-     __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+extern int __REDIRECT_NTH (vswscanf, (__const wchar_t *__restrict __s,
+				      __const wchar_t *__restrict __format,
+				      __gnuc_va_list __arg), __isoc99_vswscanf)
+     /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
 #  else
 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
 			      __const wchar_t *__restrict __format,
--- a/include/alloca.h	(révision 10714)
+++ b/include/alloca.h	(révision 14168)
@@ -14,6 +14,7 @@
 
 extern int __libc_use_alloca (size_t size) __attribute__ ((const));
 extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
+libc_hidden_proto (__libc_alloca_cutoff)
 
 #define __MAX_ALLOCA_CUTOFF	65536
 
--- a/include/link.h	(révision 10714)
+++ b/include/link.h	(révision 14168)
@@ -1,6 +1,6 @@
 /* Data structure for communication from the run-time dynamic linker for
    loaded ELF shared objects.
-   Copyright (C) 1995-2006, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2006, 2007, 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
@@ -236,6 +236,9 @@
 
     /* List of object in order of the init and fini calls.  */
     struct link_map **l_initfini;
+    /* The init and fini list generated at startup, saved when the
+       object is also loaded dynamically.  */
+    struct link_map **l_orig_initfini;
 
     /* List of the dependencies introduced through symbol binding.  */
     struct link_map_reldeps
--- a/include/atomic.h	(révision 10714)
+++ b/include/atomic.h	(révision 14168)
@@ -33,7 +33,7 @@
      the multi-thread case.  The interfaces have the prefix
      "catomic_".
 
-   - support functions like barriers.  They also have the preifx
+   - support functions like barriers.  They also have the prefix
      "atomic_".
 
    Architectures must provide a few lowlevel macros (the compare
--- a/include/dlfcn.h	(révision 10714)
+++ b/include/dlfcn.h	(révision 14168)
@@ -9,6 +9,7 @@
 #define __RTLD_OPENEXEC	0x20000000
 #define __RTLD_CALLMAP	0x10000000
 #define __RTLD_AUDIT	0x08000000
+#define __RTLD_SECURE	0x04000000 /* Apply additional security checks.  */
 
 #define __LM_ID_CALLER	-2
 
--- a/config.make.in	(révision 10714)
+++ b/config.make.in	(révision 14168)
@@ -58,7 +58,7 @@
 enable-check-abi = @enable_check_abi@
 have-forced-unwind = @libc_cv_forced_unwind@
 have-fpie = @libc_cv_fpie@
-gnu89-inline-CFLAGS = @libc_cv_gnu89_inline@
+gnu89-inline-CFLAGS = @gnu89_inline@
 have-ssp = @libc_cv_ssp@
 have-selinux = @have_selinux@
 have-libaudit = @have_libaudit@
--- a/configure.in	(révision 10714)
+++ b/configure.in	(révision 14168)
@@ -1773,11 +1773,11 @@
 fi
 rm -f conftest*])
 if test $libc_cv_gnu89_inline = yes; then
-  libc_cv_gnu89_inline=-fgnu89-inline
+  gnu89_inline=-fgnu89-inline
 else
-  libc_cv_gnu89_inline=
+  gnu89_inline=
 fi
-AC_SUBST(libc_cv_gnu89_inline)
+AC_SUBST(gnu89_inline)
 
 if test $elf != yes; then
   AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
--- a/ChangeLog	(révision 10714)
+++ b/ChangeLog	(révision 14168)
@@ -1,3 +1,676 @@
+2011-05-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #12775]
+	* sysdeps/x86_64/fpu/e_powl.S: Fix a typo.
+	* math/Makefile (tests): Add test-powl.
+	(CFLAGS-test-powl.c): Define.
+	* math/test-powl.c: New file.
+
+2011-05-16  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12766]
+	* misc/error.c (error_at_line): Ensure file_name and old_file_name
+	point to strings before performing equality test for error_one_per_line
+	mode.
+
+	[BZ #11697]
+	* login/programs/pt_chown.c (do_pt_chown): Always call chown.
+
+2011-05-14  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12083]
+	* sysdeps/pthread/aio_misc.c (__aio_init): Compute optim.aio_num
+	correctly.
+
+	* libio/fileops.c (_IO_new_file_close_it): Initialize write_status.
+
+	* 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-13  Ulrich Drepper  <drepper@gmail.com>
+
+	[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@gmail.com>
+
+	[BZ #12511]
+	* elf/dl-lookup.c (enter): Don't test for copy relocation here and
+	don't set DF_1_NODELETE here.
+	(do_lookup_x): When entering new entry test for copy relocation
+	and if necessary set DF_1_NODELETE flag.
+	Patch by Piotr Bury <pbury@goahead.com>.
+
+2011-05-11  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12052]
+	* sysdeps/posix/spawni.c (__spawni): Fix sched_setscheduler call.
+
+	[BZ #12625]
+	* misc/mntent_r.c (addmntent): Flush the stream after the output
+
+	[BZ #12393]
+	* elf/dl-load.c (is_trusted_path): Remove unnecessary test.
+	(is_trusted_path_normalize): Skip initial colon.  Append slash
+	to empty buffer.  Duplicate is_trusted_path code but allow
+	constructed patch to be prefix.
+	(is_dst): Allow $ORIGIN followed by /.
+	(_dl_dst_substitute): Correct clearing of check_for_trusted.
+	Correct testing of result of is_trusted_path_normalize
+	(decompose_rpath): Fix warning.
+
+2011-05-07  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12734]
+	* resolv/resolv.h: Define RES_NOTLDQUERY.
+	* resolv/res_init.c (res_setoptions): Recognize no_tld_query and
+	no-tld-query and set RES_NOTLDQUERY.
+	* resolv/res_debug.c (p_option): Handle RES_NOTLDQUERY.
+	* resolv/res_query.c (__libc_res_nsearch): Backport changes from
+	modern BIND to search name as TLD unless forbidden.
+
+2011-05-07  Petr Baudis  <pasky@suse.cz>
+	    Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12393]
+	* elf/dl-load.c (fillin_rpath): Move trusted path check...
+	(is_trusted_path): ...to here.
+	(is_norm_trusted_path): Add wrapper for /../ and /./ normalization.
+	(_dl_dst_substitute): Verify expanded $ORIGIN path elements
+	using is_norm_trusted_path() in setuid scripts.
+
+2011-05-03  Andreas Schwab  <schwab@redhat.com>
+
+	* elf/ldconfig.c (add_dir): Don't crash on empty path.
+
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	[BZ #12717]
+	* conform/data/netdb.h-data (getnameinfo): Make POSIX compliant.
+	* resolv/netdb.h (getnameinfo): Change type of flags parameter
+	to 'int'.
+	* inet/getnameinfo.c (getnameinfo): Likewise.
+
+2011-04-22  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12685]
+	* libio/fileops.c (_IO_new_file_fopen): Scan up to 7 bytes of the
+	mode string.
+	Patch by Eric Blake <eblake@redhat.com>.
+
+2011-04-17  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12420]
+	* sysdeps/unix/sysv/linux/x86_64/getcontext.S: Reload context after
+	storing it.
+	* stdlib/bug-getcontext.c: New file.
+	* stdlib/Makefile: Add rules to build and run bug-getcontext.
+
+2011-04-10  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12650]
+	* sysdeps/i386/dl-tls.h: Define TLS_DTV_UNALLOCATED.
+	* sysdeps/ia64/dl-tls.h: Likewise.
+	* sysdeps/powerpc/dl-tls.h: Likewise.
+	* sysdeps/s390/dl-tls.h: Likewise.
+	* sysdeps/sh/dl-tls.h: Likewise.
+	* sysdeps/sparc/dl-tls.h: Likewise.
+	* sysdeps/x86_64/dl-tls.h: Likewise.
+	* elf/dl-tls.c: Don't define TLS_DTV_UNALLOCATED here.
+
+2011-03-14  Andreas Schwab  <schwab@redhat.com>
+
+	* elf/dl-load.c (_dl_dst_substitute): When skipping the first
+	rpath element also skip the following colon.
+	(expand_dynamic_string_token): Add is_path parameter and pass
+	down to DL_DST_REQUIRED and _dl_dst_substitute.
+	(decompose_rpath): Call expand_dynamic_string_token with
+	non-zero is_path.  Ignore empty rpaths.
+	(_dl_map_object_from_fd): Call expand_dynamic_string_token
+	with zero is_path.
+
+2011-04-07  Andreas Schwab  <schwab@redhat.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S (CALL_FAIL):
+	Maintain aligned stack.
+	(CHECK_RSP): Remove unused macro.
+
+2011-04-01  Andreas Schwab  <schwab@redhat.com>
+
+	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
+	bits/timex.h
+
+2011-03-18  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12583]
+	* posix/fnmatch.c (fnmatch): Check size of pattern in wide
+	character representation.
+	Partly based on a patch by Tomas Hoger <thoger@redhat.com>.
+
+2011-03-16  Ryan S. Arnold  <rsa@us.ibm.com>
+
+	* sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S (isnanf): Fix
+	END(__isnan) to END(__isnanf) to match function entry point/label
+	EALIGN(__isnanf,...).
+
+2011-03-10  Jakub Jelinek  <jakub@redhat.com>
+
+	* wcsmbs/wchar.h (wmemcmp): Remove __restrict qualifiers.
+
+2011-03-10  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12510]
+	* elf/dl-lookup.c (do_lookup_x): For copy relocations of unique objects
+	copy from the symbol referenced in the relocation to initialize the
+	used variable.
+	Patch by Piotr Bury <pbury@goahead.com>.
+
+2011-03-06  Ulrich Drepper  <drepper@gmail.com>
+
+	* elf/dl-load.c (_dl_map_object): If we are looking for the first
+	to-be-loaded object along a path to loader is ld.so.
+
+2011-03-03  Andreas Schwab  <schwab@redhat.com>
+
+	* libio/fmemopen.c (fmemopen): Don't read past end of buffer.
+
+2011-02-23  Andreas Schwab  <schwab@redhat.com>
+	    Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12509]
+	* include/link.h (struct link_map): Add l_orig_initfini.
+	* elf/dl-load.c (_dl_map_object_from_fd): Free realname before
+	returning unsuccessfully.
+	* elf/dl-close.c (_dl_close_worker): If this is the last explicit
+	close of a file loaded at startup, restore the original l_initfini
+	list.
+	* elf/dl-deps.c (_dl_map_object_deps): Don't free old l_initfini
+	list, store the pointer.
+	* elf/Makefile ($(objpfx)noload-mem): New rule.
+	(noload-ENV): Define.
+	(tests): Add $(objpfx)noload-mem.
+	* elf/noload.c: Include <memcheck.h>.
+	(main): Call mtrace.  Close all opened handles.
+
+2011-02-17  Andreas Schwab  <schwab@redhat.com>
+
+	[BZ #12454]
+	* elf/dl-deps.c (_dl_map_object_deps): Signal error early when
+	dependencies are missing.
+
+2011-02-22  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	Fix __if_freereq crash: Unlike the generic version which uses free,
+	Hurd needs munmap.
+	* sysdeps/mach/hurd/ifreq.h: New file.
+
+2011-01-27  Petr Baudis  <pasky@suse.cz>
+	    Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12445]
+	* stdio-common/vfprintf.c (vfprintf): Pass correct newlen
+	to extend_alloca().
+	* stdio-common/bug23.c: New file.
+	* stdio-common/Makefile (tests): Add bug23.
+
+2011-02-16  Ryan S. Arnold  <rsa@us.ibm.com>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
+	(INTERNAL_VSYSCALL_NCS INTERNAL_SYSCALL_NCS): Remove erroneous (int)
+	cast from r3.
+	* sysdeps/wordsize-64/Makefile: New file.  Add tst-writev to
+	'tests' variable.
+	* sysdeps/wordsize-64/tst-writev.c: New file.
+
+2011-02-15  Ryan S. Arnold  <rsa@us.ibm.com>
+
+	* sysdeps/powerpc/powerpc64/power7/Makefile: New file which adds
+	-mno-vsx to the CFLAGS-rtld.c variable to avoid using VSX registers and
+	insns in _dl_start to prevent a TOC reference before relocs are
+	resolved.
+
+2011-02-11  Jakub Jelinek  <jakub@redhat.com>
+
+	* stdio-common/printf-parsemb.c (__parse_one_specmb): Handle
+	arginfo fn returning -1.
+
+	* stdio-common/_i18n_number.h (_i18n_number_rewrite): Ensure decimal
+	and thousands string is zero terminated.
+
+2011-02-02  Ulrich Drepper  <drepper@gmail.com>
+
+	* elf/dl-runtime.c (_dl_call_pltexit): Pass correct address of the
+	function to the callback.
+	Patch partly by Jiri Olsa <jolsa@redhat.com>.
+
+2011-02-02  Andreas Schwab  <schwab@redhat.com>
+
+	* shadow/sgetspent.c: Check return value of __sgetspent_r instead
+	of errno.
+
+2010-10-01  Andreas Schwab  <schwab@redhat.com>
+
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't discard result of
+	decoding ACE if AI_CANONIDN.
+
+2011-01-17  Ulrich Drepper  <drepper@gmail.com>
+
+	* io/fcntl.h: Define AT_NO_AUTOMOUNT.
+
+	* sysdeps/unix/sysv/linux/i386/bits/mman.h: Define MADV_HUGEPAGE and
+	MADV_NOHUGEPAGE.
+	* sysdeps/unix/sysv/linux/ia64/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/s390/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/sh/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/mman.h: Likewise.
+
+	* sysdeps/unix/sysv/linux/bits/socket.h: Define AF_CAIF, AF_ALG,
+	PF_CAIF, and PF_ALG.
+	* sysdeps/unix/sysv/linux/sparc/bits/socket.h: Likewise.
+
+2011-01-15  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #6812]
+	* nscd/hstcache.c (tryagain): Define.
+	(cache_addhst): Return tryagain not notfound for temporary errors.
+	(addhstbyX): Also set h_errno to TRY_AGAIN when memory allocation
+	failed.
+
+2011-01-13  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12397]
+	* sysdeps/unix/sysv/linux/mkdirat.c (mkdirat): Fix handling of missing
+	syscall.
+
+	[BZ #10484]
+	* nss/nss_files/files-hosts.c (HOST_DB_LOOKUP): Handle overflows of
+	temporary buffer used to handle multi lookups locally.
+	* include/alloca.h: Add libc_hidden_proto for __libc_alloca_cutoff.
+
+2011-01-12  Ulrich Drepper  <drepper@gmail.com>
+
+	* elf/dl-dst.h (DL_DST_REQUIRED): Allow l_origin to be NULL when
+	loader is ld.so.
+
+2010-03-12  Andreas Schwab  <schwab@redhat.com>
+
+	* elf/dl-dst.h: Include "trusted-dirs.h".
+	(DL_DST_REQUIRED): Take $LIB into account.
+
+2011-01-10  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* sysdeps/i386/Makefile: stdlib/cxa_finalize.c needs 16-byte stack
+	alignment for SSE2.
+
+2011-01-12  Ulrich Drepper  <drepper@gmail.com>
+
+	[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-04  David S. Miller  <davem@sunset.davemloft.net>
+
+	[BZ #11155]
+	* sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c: Use i386's
+	implementation just like for lxstat, fxstatat, et al.
+
+2010-12-27  Jim Meyering  <meyering@redhat.com>
+
+	[BZ #12348]
+	* posix/regexec.c (build_trtable): Return failure indication upon
+	calloc failure.  Otherwise, re_search_internal could infloop on OOM.
+
+2010-12-25  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12207]
+	* malloc/malloc.c (do_check_malloc_state): Use fastbin macro.
+
+2010-12-19  Ulrich Drepper  <drepper@gmail.com>
+
+	* sysdeps/unix/readdir_r.c (__READDIR_R): Compute reclen more
+	accurately.
+	* sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c: Define
+	GETDENTS_64BIT_ALIGNED.
+
+2010-12-10  Andreas Schwab  <schwab@redhat.com>
+
+	* wcsmbs/wchar.h (wcpcpy, wcpncpy): Add __restrict.
+	* wcsmbs/bits/wchar2.h (__wmemmove_chk_warn, wmemmove, wmemset):
+	Remove __restrict.
+	(wcscpy, __wcpcpy_chk, __wcpcpy_alias, wcpcpy, wcsncpy, wcpncpy)
+	(wcscat, wcsncat, __wcrtomb_chk, wcrtomb): Add __restrict.
+
+2010-12-09  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #11655]
+	* stdlib/msort.c (qsort_r): Make sure both phys_pages and pagesize
+	are initialized.
+
+2010-12-09  Jakub Jelinek  <jakub@redhat.com>
+
+	* string/bits/string3.h (memmove, bcopy): Remove __restrict.
+
+2010-11-30  Ulrich Drepper  <drepper@gmail.com>
+
+	* sysdeps/i386/fpu/libm-test-ulps: Relax ynf(10,0.75) test expectations.
+
+2010-11-24  Andreas Schwab  <schwab@redhat.com>
+
+	* resolv/nss_dns/dns-host.c (getanswer_r): Don't handle ttl == 0
+	specially.
+	(gaih_getanswer_slice): Likewise.
+
+2010-05-31  Petr Baudis  <pasky@suse.cz>
+
+	[BZ #11149]
+	* elf/ldconfig.c (main): Allow aux_cache_file open()ing to fail
+	silently even in the chroot mode.
+
+2010-05-31  Petr Baudis <pasky@suse.cz>
+
+	[BZ #10085]
+	* nis/nss_compat/compat-initgroups.c (internal_getgrent_r): Fix
+	initialization of skip_initgroups_dyn.
+
+2010-09-27  Andreas Schwab  <schwab@redhat.com>
+
+	[BZ #11611]
+	* sysdeps/unix/sysv/linux/internal_statvfs.c (INTERNAL_STATVFS):
+	Mask out sign-bit copies when constructing f_fsid.
+
+2010-11-19  Ulrich Drepper  <drepper@gmail.com>
+
+	* sysdeps/unix/sysv/linux/i386/bits/mman.h: Define MAP_HUGETLB.
+	* sysdeps/unix/sysv/linux/x86_64/bits/mman.h: Likewise.
+
+2010-11-16  Ulrich Drepper  <drepper@gmail.com>
+
+	* sysdeps/unix/sysv/linux/sys/swap.h (SWAP_FLAG_DISCARD): Define.
+
+2010-11-11  Andreas Schwab  <schwab@redhat.com>
+
+	* posix/fnmatch_loop.c (NEW_PATTERN): Fix use of alloca.
+	* posix/Makefile (tests): Add $(objpfx)tst-fnmatch-mem.
+	(tst-fnmatch-ENV): Set MALLOC_TRACE.
+	($(objpfx)tst-fnmatch-mem): New rule.
+	(generated): Add tst-fnmatch-mem and tst-fnmatch.mtrace.
+	* posix/tst-fnmatch.c (main): Call mtrace.
+
+2010-08-09  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11883]
+	* posix/fnmatch.c: Keep track of alloca use and fall back on malloc.
+	* posix/fnmatch_loop.c: Likewise.
+
+2010-11-10  Luis Machado  <luisgpm@br.ibm.com>
+
+	* sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (__ieee754_sqrtl): Force
+	  signed comparison.
+
+2010-11-08  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12194]
+	* sysdeps/i386/bits/byteswap.h: Avoid warning in __bswap_16.
+	* sysdeps/x86_64/bits/byteswap.h: Likewise.
+
+2010-09-06  Andreas Schwab  <schwab@redhat.com>
+
+	* manual/Makefile: Don't mix pattern rules with normal rules.
+
+2010-08-12  Andreas Schwab  <schwab@redhat.com>
+
+	[BZ #11904]
+	* locale/programs/locale.c (print_assignment): New function.
+	(show_locale_vars): Use it.
+
+2010-10-26  Ulrich Drepper  <drepper@gmail.com>
+
+	* elf/rtld.c (dl_main): Move assertion after the point where rtld map
+	is added to the list.
+
+2010-10-20  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+	    Ulrich Drepper  <drepper@gmail.com>
+
+	* elf/dl-object.c (_dl_new_object): Don't append the new object to
+	the global list here.  Move code to...
+	(_dl_add_to_namespace_list): ...here.  New function.
+	* elf/rtld.c (dl_main): Invoke _dl_add_to_namespace_list.
+	* sysdeps/generic/ldsodefs.h (_dl_add_to_namespace_list): Declare.
+	* elf/dl-load.c (lose): Don't remove the element from the list.
+	(_dl_map_object_from_fd): Invoke _dl_add_to_namespace_list.
+	(_dl_map_object): Likewise.
+
+2010-10-24  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #12140]
+	* malloc/malloc.c (_int_free): Fill correct number of bytes when
+	perturbing.
+
+2010-09-09  Andreas Schwab  <schwab@redhat.com>
+
+	* Makeconfig (sysd-rules-patterns): Add rtld-%:rtld-%.
+	(sysd-rules-targets): Remove duplicates.
+	* elf/rtld-Rules ($(objpfx)rtld-%.os): Add pattern rules with
+	rtld-%.$o dependency.
+
+2010-10-18  Andreas Schwab  <schwab@redhat.com>
+
+	* elf/dl-open.c (dl_open_worker): Don't expand DST here, let
+	_dl_map_object do it.
+
+2010-10-15  Andreas Schwab  <schwab@redhat.com>
+
+	* scripts/data/localplt-s390-linux-gnu.data: New file.
+	* scripts/data/localplt-s390x-linux-gnu.data: New file.
+
+2010-10-12  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #12078]
+	* posix/regcomp.c (parse_branch): One more memory leak plugged.
+	* posix/bug-regex31.input: Add test case.
+
+2010-10-11  Ulrich Drepper  <drepper@gmail.com>
+
+	* posix/bug-regex31.c: Rewrite to run multiple tests from stdin.
+	* posix/bug-regex31.input: New file.
+
+	[BZ #12078]
+	* posix/regcomp.c (parse_branch): Free memory when allocation failed.
+	(parse_sub_exp): Fix last change, use postorder.
+
+	* posix/bug-regex31.c: New file.
+	* posix/Makefile: Add rules to build and run bug-regex31.
+
+	* posix/regcomp.c (parse_bracket_exp): Add missing re_free calls.
+
+	[BZ #12078]
+	* posix/regcomp.c (parse_sub_exp): Free tree data when it is not used.
+
+	[BZ #12093]
+	* sysdeps/unix/sysv/linux/check_pf.c (__check_pf): ->ifa_addr might
+	be NULL.
+
+2010-09-15  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/getdents.c (__GETDENTS): When
+	implementing getdents64 using getdents syscall, set d_type if
+	__ASSUME_GETDENTS32_D_TYPE.
+
+2010-09-14  Andreas Schwab  <schwab@redhat.com>
+
+	* sysdeps/s390/s390-32/__longjmp.c (__longjmp): Define register
+	variables after CHECK_SP call.
+	* sysdeps/s390/s390-64/__longjmp.c (__longjmp): Likewise.
+
+2010-09-08  Chung-Lin Tang  <cltang@codesourcery.com>
+	    Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11968]
+	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
+	(____longjmp_chk): Use %ebx for saving value across system call.
+	Add unwind info.
+
+2010-08-31  Mike Frysinger  <vapier@gentoo.org>
+
+	* sysdeps/unix/sysv/linux/sparc/sys/epoll.h (epoll_create2): Delete.
+	(epoll_create1): Declare.
+
+	* sysdeps/unix/sysv/linux/x86_64/sys/epoll.h: Fix typo.
+
+2010-08-31  Andreas Schwab  <schwab@redhat.com>
+
+	[BZ #7066]
+	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Fix array overflow when
+	shifting retval into place.
+
+2010-09-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* resolv/res_init.c (__res_vinit): Count the default server we added.
+
+2010-08-25  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #10851]
+	* resolv/res_init.c (__res_vinit): When no server address at all
+	is given default to loopback.
+
+2010-08-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/i386/elf/Makefile: New file.
+
+2010-07-31  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* hurd/hurdselect.c (_hurd_select): Round timeout up instead of down
+	when converting to ms.
+
+2010-07-29  Roland McGrath  <roland@redhat.com>
+
+	[BZ 11856]
+	* manual/locale.texi (Yes-or-No Questions): Fix example code.
+
+2010-07-27  Andreas Schwab  <schwab@redhat.com>
+
+	* manual/memory.texi (Malloc Tunable Parameters): Document
+	M_PERTURB.
+
+2010-07-26  Roland McGrath  <roland@redhat.com>
+
+	[BZ #11840]
+	* configure.in (-fgnu89-inline check): Set and substitute
+	gnu89_inline, not libc_cv_gnu89_inline.
+	* configure: Regenerated.
+	* config.make.in (gnu89-inline-CFLAGS): Use @gnu89_inline@.
+
+2010-07-20  Roland McGrath  <roland@redhat.com>
+
+	* elf/dl-sysdep.c (_dl_important_hwcaps): Add dsocaps mask to
+	dl_hwcap_mask as well as dl_hwcap.  Without this, dsocaps matching in
+	ld.so.cache was broken.  With it, there is no way to disable dsocaps
+	like LD_HWCAP_MASK can disable hwcaps.
+
+2010-07-05  Roland McGrath  <roland@redhat.com>
+
+	* manual/arith.texi (Rounding Functions): Fix rint description
+	implicit in round description.
+
+2010-07-02  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/Makefile: Fix linking for a few tests to make recent linker
+	happy.
+
+2010-06-02  Emilio Pozuelo Monfort  <pochu27@gmail.com>
+
+	* hurd/lookup-at.c (__file_name_lookup_at): Accept
+	AT_SYMLINK_FOLLOW in AT_FLAGS.  Fail with EINVAL if both
+	AT_SYMLINK_FOLLOW and AT_SYMLINK_NOFOLLOW are present
+	in AT_FLAGS.
+	* hurd/hurd/fd.h (__file_name_lookup_at): Update comment.
+	* sysdeps/mach/hurd/linkat.c (linkat): Pass O_NOLINK in FLAGS.
+
+2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #12191]
+	* sysdeps/x86_64/cacheinfo.c (init_cacheinfo): Round
+	__x86_64_data_cache_size_half, __x86_64_data_cache_size
+	__x86_64_shared_cache_size_half and __x86_64_shared_cache_size,
+	to multiple of 256 bytes.
+
+2010-11-03  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12167]
+	* sysdeps/unix/sysv/linux/ttyname.c (ttyname): Recognize new mangling
+	of inacessible symlinks.  Verify result of symlink before returning it.
+	* sysdeps/unix/sysv/linux/ttyname_r.c (__ttyname_r): Likewise.
+	Patch mostly by Miklos Szeredi <miklos@szeredi.hu>.
+
+2010-10-25  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #12159]
+	* sysdeps/x86_64/multiarch/strchr.S: Fix propagation of search byte
+	into all bytes of SSE register.
+	Patch by Richard Li <richardpku@gmail.com>.
+
+2010-10-22  Andreas Schwab  <schwab@redhat.com>
+
+	* include/dlfcn.h (__RTLD_SECURE): Define.
+	* elf/dl-load.c (_dl_map_object): Remove preloaded parameter.  Use
+	mode & __RTLD_SECURE instead.
+	(open_path): Rename preloaded parameter to secure.
+	* sysdeps/generic/ldsodefs.h (_dl_map_object): Adjust declaration.
+	* elf/dl-open.c (dl_open_worker): Adjust call to _dl_map_object.
+	* elf/dl-deps.c (openaux): Likewise.
+	* elf/rtld.c (struct map_args): Remove is_preloaded.
+	(map_doit): Don't use it.
+	(dl_main): Likewise.
+	(do_preload): Use __RTLD_SECURE instead of is_preloaded.
+	(dlmopen_doit): Add __RTLD_SECURE to mode bits.
+
+2010-10-06  Ulrich Drepper  <drepper@gmail.com>
+
+	* string/bug-strstr1.c: New file.
+	* string/Makefile: Add rules to build and run bug-strstr1.
+
+2010-10-05  Eric Blake  <eblake@redhat.com>
+
+	[BZ #12092]
+	* string/str-two-way.h (two_way_long_needle): Always clear memory
+	when skipping input due to the shift table.
+
+2010-10-03  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12005]
+	* malloc/mcheck.c: Handle large requests.
+
+	[BZ #12077]
+	* sysdeps/x86_64/strcmp.S: Fix handling of remaining bytes in buffer
+	for strncmp and strncasecmp.
+	* string/stratcliff.c: Add tests for strcmp and strncmp.
+	* wcsmbs/wcsatcliff.c: Adjust for stratcliff change.
+
+2010-06-02  Kirill A. Shutemov  <kirill@shutemov.name>
+
+	* elf/dl-reloc.c: Flush cache after solving TEXTRELs if arch
+	requires it.
+
+2010-06-02  Andreas Schwab  <schwab@redhat.com>
+
+	* nis/nss_nis/nis-initgroups.c (get_uid): Properly resize buffer.
+
+2010-06-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* libio/stdio.h (sscanf, vsscanf): Use __REDIRECT_NTH instead of
+	__REDIRECT followed by __THROW.
+	* wcsmbs/wchar.h (swscanf, vswscanf): Likewise.
+	* posix/getopt.h (getopt): Likewise.
+
 2010-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #11640]
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S	(révision 10714)
+++ b/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S	(révision 14168)
@@ -1,5 +1,5 @@
 /* isnanf().  PowerPC32 version.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 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
@@ -39,8 +39,7 @@
 L(NaN):
 	li	r3,1		/* else return 1 */
 	blr
-	END (__isnan)
+	END (__isnanf)
 
 hidden_def (__isnanf)
 weak_alias (__isnanf, isnanf)
-
--- a/sysdeps/powerpc/dl-tls.h	(révision 10714)
+++ b/sysdeps/powerpc/dl-tls.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  PowerPC version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 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
@@ -47,3 +47,6 @@
 # define GET_ADDR_OFFSET	(ti->ti_offset + TLS_DTV_OFFSET)
 # define __TLS_GET_ADDR(__ti)	(__tls_get_addr (__ti) - TLS_DTV_OFFSET)
 #endif
+
+/* Value used for dtv entries for which the allocation is delayed.  */
+#define TLS_DTV_UNALLOCATED	((void *) -1l)
--- a/sysdeps/unix/sysv/linux/s390/bits/mman.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/s390/bits/mman.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/s390 version.
-   Copyright (C) 2000-2003,2005,2006,2009 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003,2005,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
@@ -94,6 +94,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c	(révision 14168)
@@ -1 +1 @@
-#include "../../fxstat.c"
+#include "../../i386/fxstat.c"
--- a/sysdeps/unix/sysv/linux/sparc/bits/mman.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/sparc/bits/mman.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/SPARC version.
-   Copyright (C) 1997,1999,2000,2003,2005,2006,2009
+   Copyright (C) 1997,1999,2000,2003,2005,2006,2009,2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -97,6 +97,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/sysdeps/unix/sysv/linux/sparc/bits/socket.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/sparc/bits/socket.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  Linux/SPARC version.
-   Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009
+   Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -108,7 +108,9 @@
 #define PF_ISDN		34	/* mISDN sockets.  */
 #define PF_PHONET	35	/* Phonet sockets.  */
 #define PF_IEEE802154	36	/* IEEE 802.15.4 sockets.  */
-#define	PF_MAX		37	/* For now..  */
+#define PF_CAIF		37	/* CAIF sockets.  */
+#define PF_ALG		38	/* Algorithm sockets.  */
+#define	PF_MAX		39	/* For now..  */
 
 /* Address families.  */
 #define	AF_UNSPEC	PF_UNSPEC
@@ -149,6 +151,8 @@
 #define AF_ISDN		PF_ISDN
 #define AF_PHONET	PF_PHONET
 #define AF_IEEE802154	PF_IEEE802154
+#define AF_CAIF		PF_CAIF
+#define AF_ALG		PF_ALG
 #define	AF_MAX		PF_MAX
 
 /* Socket level values.  Others are defined in the appropriate headers.
@@ -233,8 +237,8 @@
 #define	MSG_MORE	MSG_MORE
 
     MSG_CMSG_CLOEXEC	= 0x40000000	/* Set close_on_exit for file
-                                           descriptor received through
-                                           SCM_RIGHTS.  */
+					   descriptor received through
+					   SCM_RIGHTS.  */
 #define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
   };
 
--- a/sysdeps/unix/sysv/linux/sparc/sys/epoll.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/sparc/sys/epoll.h	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007, 2008, 2010 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
@@ -31,7 +31,7 @@
 #endif
 
 
-/* Flags to be passed to epoll_create2.  */
+/* Flags to be passed to epoll_create1.  */
 enum
   {
     EPOLL_CLOEXEC = 0x400000,
@@ -101,8 +101,9 @@
    returned by epoll_create() should be closed with close().  */
 extern int epoll_create (int __size) __THROW;
 
-/* Same as epoll_create but with an additional FLAGS parameter.  */
-extern int epoll_create2 (int __size, int __flags) __THROW;
+/* Same as epoll_create but with an FLAGS parameter.  The unused SIZE
+   parameter has been dropped.  */
+extern int epoll_create1 (int __flags) __THROW;
 
 
 /* Manipulate an epoll instance "epfd". Returns 0 in case of success,
--- a/sysdeps/unix/sysv/linux/i386/bits/mman.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/i386/bits/mman.h	(révision 14168)
@@ -1,5 +1,6 @@
 /* Definitions for POSIX memory map interface.  Linux/i386 version.
-   Copyright (C) 1997,2000,2003,2005,2006,2009 Free Software Foundation, Inc.
+   Copyright (C) 1997,2000,2003,2005,2006,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
@@ -64,6 +65,7 @@
 # define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
 # define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
 # define MAP_STACK	0x20000		/* Allocation is for a stack.  */
+# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
 #endif
 
 /* Flags to `msync'.  */
@@ -94,6 +96,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h	(révision 14168)
@@ -172,7 +172,7 @@
        : "r9", "r10", "r11", "r12",					\
          "cr0", "ctr", "lr", "memory");					\
 	  err = (long int) r0;						\
-    (int) r3;								\
+    r3;								\
   })
 
 #undef INLINE_SYSCALL
@@ -219,7 +219,7 @@
        : "r9", "r10", "r11", "r12",					\
          "cr0", "ctr", "memory");					\
 	  err = r0;  \
-    (int) r3;  \
+    r3;  \
   })
 #define INTERNAL_SYSCALL(name, err, nr, args...)			\
   INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
--- a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/PowerPC version.
-   Copyright (C) 1997,2000,2003,2005,2006,2008,2009
+   Copyright (C) 1997,2000,2003,2005,2006,2008,2009,2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -96,6 +96,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/sysdeps/unix/sysv/linux/ttyname_r.c	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c	(révision 14168)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,93,1995-2001,2003,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-2001,2003,2006,2010
+   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
@@ -122,6 +123,9 @@
   if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
     return errno;
 
+  if (__fxstat64 (_STAT_VER, fd, &st) < 0)
+    return errno;
+
   /* We try using the /proc filesystem.  */
   *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
 
@@ -145,13 +149,31 @@
 #endif
 			, 1))
     {
+#define UNREACHABLE_LEN strlen ("(unreachable)")
+      if (ret > UNREACHABLE_LEN
+	  && memcmp (buf, "(unreachable)", UNREACHABLE_LEN) == 0)
+	{
+	  memmove (buf, buf + UNREACHABLE_LEN, ret - UNREACHABLE_LEN);
+	  ret -= UNREACHABLE_LEN;
+	}
+
+      /* readlink need not terminate the string.  */
       buf[ret] = '\0';
-      return 0;
+
+      /* Verify readlink result, fall back on iterating through devices.  */
+      if (buf[0] == '/'
+	  && __xstat64 (_STAT_VER, buf, &st1) == 0
+#ifdef _STATBUF_ST_RDEV
+	  && S_ISCHR (st1.st_mode)
+	  && st1.st_rdev == st.st_rdev
+#else
+	  && st1.st_ino == st.st_ino
+	  && st1.st_dev == st.st_dev
+#endif
+	  )
+	return 0;
     }
 
-  if (__fxstat64 (_STAT_VER, fd, &st) < 0)
-    return errno;
-
   /* Prepare the result buffer.  */
   memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/"));
   buflen -= sizeof ("/dev/pts/") - 1;
--- a/sysdeps/unix/sysv/linux/Makefile	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/Makefile	(révision 14168)
@@ -96,7 +96,7 @@
 endif
 
 ifeq ($(subdir),time)
-sysdep_headers += sys/timex.h
+sysdep_headers += sys/timex.h bits/timex.h
 
 sysdep_routines += ntp_gettime
 endif
--- a/sysdeps/unix/sysv/linux/mkdirat.c	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/mkdirat.c	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 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
@@ -43,7 +43,7 @@
     {
       res = INLINE_SYSCALL (mkdirat, 3, fd, file, mode);
 # ifndef __ASSUME_ATFCTS
-      if (res == -1 && res == ENOSYS)
+      if (res == -1 && errno == ENOSYS)
 	__have_atfcts = -1;
       else
 # endif
--- a/sysdeps/unix/sysv/linux/ttyname.c	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/ttyname.c	(révision 14168)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,93,1996-2002,2006,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1996-2002,2006,2009,2010
+   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
@@ -131,6 +132,9 @@
   if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
     return NULL;
 
+  if (__fxstat64 (_STAT_VER, fd, &st) < 0)
+    return NULL;
+
   /* We try using the /proc filesystem.  */
   *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
 
@@ -161,14 +165,33 @@
     {
       if ((size_t) len >= buflen)
 	return NULL;
+
+#define UNREACHABLE_LEN strlen ("(unreachable)")
+      if (len > UNREACHABLE_LEN
+	  && memcmp (ttyname_buf, "(unreachable)", UNREACHABLE_LEN) == 0)
+	{
+	  memmove (ttyname_buf, ttyname_buf + UNREACHABLE_LEN,
+		   len - UNREACHABLE_LEN);
+	  len -= UNREACHABLE_LEN;
+	}
+
       /* readlink need not terminate the string.  */
       ttyname_buf[len] = '\0';
-      return ttyname_buf;
+
+      /* Verify readlink result, fall back on iterating through devices.  */
+      if (ttyname_buf[0] == '/'
+	  && __xstat64 (_STAT_VER, ttyname_buf, &st1) == 0
+#ifdef _STATBUF_ST_RDEV
+	  && S_ISCHR (st1.st_mode)
+	  && st1.st_rdev == st.st_rdev
+#else
+	  && st1.st_ino == st.st_ino
+	  && st1.st_dev == st.st_dev
+#endif
+	  )
+	return ttyname_buf;
     }
 
-  if (__fxstat64 (_STAT_VER, fd, &st) < 0)
-    return NULL;
-
   if (__xstat64 (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
     {
 #ifdef _STATBUF_ST_RDEV
--- a/sysdeps/unix/sysv/linux/bits/socket.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/bits/socket.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  Linux version.
-   Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009
+   Copyright (C) 1991, 1992, 1994-2001, 2004, 2006-2010, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -109,7 +109,9 @@
 #define PF_ISDN		34	/* mISDN sockets.  */
 #define PF_PHONET	35	/* Phonet sockets.  */
 #define PF_IEEE802154	36	/* IEEE 802.15.4 sockets.  */
-#define	PF_MAX		37	/* For now..  */
+#define PF_CAIF		37	/* CAIF sockets.  */
+#define PF_ALG		38	/* Algorithm sockets.  */
+#define	PF_MAX		39	/* For now..  */
 
 /* Address families.  */
 #define	AF_UNSPEC	PF_UNSPEC
@@ -150,6 +152,8 @@
 #define AF_ISDN		PF_ISDN
 #define AF_PHONET	PF_PHONET
 #define AF_IEEE802154	PF_IEEE802154
+#define AF_CAIF		PF_CAIF
+#define AF_ALG		PF_ALG
 #define	AF_MAX		PF_MAX
 
 /* Socket level values.  Others are defined in the appropriate headers.
--- a/sysdeps/unix/sysv/linux/sh/bits/mman.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/sh/bits/mman.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/SH version.
-   Copyright (C) 1997,1999,2000,2003,2005,2006,2009
+   Copyright (C) 1997,1999,2000,2003,2005,2006,2009,2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -94,6 +94,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/sysdeps/unix/sysv/linux/sys/swap.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/sys/swap.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Calls to enable and disable swapping on specified locations.  Linux version.
-   Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 1999, 2010 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
@@ -28,6 +28,7 @@
 #define	SWAP_FLAG_PREFER	0x8000	/* Set if swap priority is specified. */
 #define	SWAP_FLAG_PRIO_MASK	0x7fff
 #define	SWAP_FLAG_PRIO_SHIFT	0
+#define SWAP_FLAG_DISCARD	0x10000	/* Discard swap cluster after use.  */
 
 __BEGIN_DECLS
 
--- a/sysdeps/unix/sysv/linux/check_pf.c	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/check_pf.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Determine protocol families for which interfaces exist.  Linux version.
-   Copyright (C) 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007, 2008, 2010 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
@@ -304,10 +304,13 @@
 
   struct ifaddrs *runp;
   for (runp = ifa; runp != NULL; runp = runp->ifa_next)
-    if (runp->ifa_addr->sa_family == PF_INET)
-      *seen_ipv4 = true;
-    else if (runp->ifa_addr->sa_family == PF_INET6)
-      *seen_ipv6 = true;
+    if (runp->ifa_addr != NULL)
+      {
+	if (runp->ifa_addr->sa_family == PF_INET)
+	  *seen_ipv4 = true;
+	else if (runp->ifa_addr->sa_family == PF_INET6)
+	  *seen_ipv6 = true;
+      }
 
   (void) freeifaddrs (ifa);
 #endif
--- a/sysdeps/unix/sysv/linux/getdents.c	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/getdents.c	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-2003, 2004, 2006, 2007
+/* Copyright (C) 1993, 1995-2004, 2006, 2007, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -285,7 +285,11 @@
 	DIRENT_SET_DP_INO(dp, kdp->d_ino);
 	dp->d_off = kdp->d_off;
 	dp->d_reclen = new_reclen;
+#ifdef __ASSUME_GETDENTS32_D_TYPE
+	dp->d_type = *((char *) kdp + kdp->d_reclen - 1);
+#else
 	dp->d_type = DT_UNKNOWN;
+#endif
 	memcpy (dp->d_name, kdp->d_name,
 		kdp->d_reclen - offsetof (struct kernel_dirent, d_name));
 
--- a/sysdeps/unix/sysv/linux/x86_64/getcontext.S	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/x86_64/getcontext.S	(révision 14168)
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -62,6 +62,7 @@
 	movq	%rcx, oFPREGS(%rdi)
 	/* Save the floating-point environment.  */
 	fnstenv	(%rcx)
+	fldenv	(%rcx)
 	stmxcsr oMXCSR(%rdi)
 
 	/* Save the current signal mask with
--- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,2004,2005,2006,2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001,2004,2005,2006,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
@@ -30,28 +30,32 @@
 //#define __longjmp ____longjmp_chk
 
 #ifdef PIC
-# define CALL_FAIL	leaq	longjmp_msg(%rip), %rdi;		      \
-			call	__GI___fortify_fail
+# define CALL_FAIL	subq	$8, %rsp;				      \
+			cfi_remember_state;				      \
+			cfi_def_cfa_offset(16);				      \
+			leaq	longjmp_msg(%rip), %rdi;		      \
+			call	__GI___fortify_fail;			      \
+			nop;						      \
+			cfi_restore_state
 #else
-# define CALL_FAIL	movq	$longjmp_msg, %rdi;			      \
-			call	__fortify_fail
+# define CALL_FAIL	subq	$8, %rsp;				      \
+			cfi_remember_state;				      \
+			cfi_def_cfa_offset(16);				      \
+			movq	$longjmp_msg, %rdi;			      \
+			call	__fortify_fail;				      \
+			nop;						      \
+			cfi_restore_state
 #endif
 
-#define CHECK_RSP(reg) \
-	cmpq	reg, %rsp;						      \
-	jbe	.Lok;							      \
-	CALL_FAIL;							      \
-.Lok:
-
 /* Jump to the position specified by ENV, causing the
    setjmp call there to return VAL, or 1 if VAL is 0.
    void __longjmp (__jmp_buf env, int val).  */
 	.text
 ENTRY(____longjmp_chk)
 	/* Restore registers.  */
-	movq	(JB_RSP*8)(%rdi),%r8
-	movq	(JB_RBP*8)(%rdi),%r9
-	movq	(JB_PC*8)(%rdi),%rdx
+	movq	(JB_RSP*8)(%rdi), %r8
+	movq	(JB_RBP*8)(%rdi), %r9
+	movq	(JB_PC*8)(%rdi), %rdx
 #ifdef PTR_DEMANGLE
 	PTR_DEMANGLE (%r8)
 	PTR_DEMANGLE (%r9)
@@ -63,7 +67,9 @@
 
 	/* Save function parameters.  */
 	movq	%rdi, %r10
-	movl	%esi, %ecx
+	cfi_register (%rdi, %r10)
+	movl	%esi, %ebx
+	cfi_register (%rsi, %rbx)
 
 	xorl	%edi, %edi
 	leaq	-24(%rsp), %rsi
@@ -84,7 +90,9 @@
 .Lfail:	CALL_FAIL
 
 .Lok2:	movq	%r10, %rdi
-	movl	%ecx, %esi
+	cfi_restore (%rdi)
+	movl	%ebx, %esi
+	cfi_restore (%rsi)
 
 .Lok:	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%rdi, 0)
@@ -96,11 +104,11 @@
 	cfi_offset(%r13,JB_R13*8)
 	cfi_offset(%r14,JB_R14*8)
 	cfi_offset(%r15,JB_R15*8)
-	movq	(JB_RBX*8)(%rdi),%rbx
-	movq	(JB_R12*8)(%rdi),%r12
-	movq	(JB_R13*8)(%rdi),%r13
-	movq	(JB_R14*8)(%rdi),%r14
-	movq	(JB_R15*8)(%rdi),%r15
+	movq	(JB_RBX*8)(%rdi), %rbx
+	movq	(JB_R12*8)(%rdi), %r12
+	movq	(JB_R13*8)(%rdi), %r13
+	movq	(JB_R14*8)(%rdi), %r14
+	movq	(JB_R15*8)(%rdi), %r15
 	/* Set return value for setjmp.  */
 	movl	%esi, %eax
 	movq	%r8,%rsp
--- a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h	(révision 14168)
@@ -1,5 +1,6 @@
 /* Definitions for POSIX memory map interface.  Linux/x86_64 version.
-   Copyright (C) 2001, 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2001,2003,2005,2006,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
@@ -65,6 +66,7 @@
 # define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
 # define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
 # define MAP_STACK	0x20000		/* Allocation is for a stack.  */
+# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
 #endif
 
 /* Flags to `msync'.  */
@@ -95,6 +97,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2008, 2010 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
@@ -31,7 +31,7 @@
 #endif
 
 
-/* Flags to be passed to epoll_create2.  */
+/* Flags to be passed to epoll_create1.  */
 enum
   {
     EPOLL_CLOEXEC = 02000000,
--- a/sysdeps/unix/sysv/linux/ia64/bits/mman.h	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/ia64/bits/mman.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/ia64 version.
-   Copyright (C) 1997,1998,2000,2003,2005,2006,2009
+   Copyright (C) 1997,1998,2000,2003,2005,2006,2009,2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -95,6 +95,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/sysdeps/unix/sysv/linux/internal_statvfs.c	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/internal_statvfs.c	(révision 14168)
@@ -214,7 +214,8 @@
   buf->f_files = fsbuf->f_files;
   buf->f_ffree = fsbuf->f_ffree;
   if (sizeof (buf->f_fsid) == sizeof (fsbuf->f_fsid))
-    buf->f_fsid = (fsbuf->f_fsid.__val[0]
+    buf->f_fsid = ((fsbuf->f_fsid.__val[0]
+		    & ((1UL << (8 * sizeof (fsbuf->f_fsid.__val[0]))) - 1))
 		   | ((unsigned long int) fsbuf->f_fsid.__val[1]
 		      << (8 * (sizeof (buf->f_fsid)
 			       - sizeof (fsbuf->f_fsid.__val[0])))));
--- a/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c	(révision 10714)
+++ b/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c	(révision 14168)
@@ -1,4 +1,5 @@
 #define readdir64_r __no_readdir64_r_decl
+#define GETDENTS_64BIT_ALIGNED 1
 #include <sysdeps/unix/readdir_r.c>
 #undef readdir64_r
 weak_alias (__readdir_r, readdir64_r)
--- a/sysdeps/unix/readdir_r.c	(révision 10714)
+++ b/sysdeps/unix/readdir_r.c	(révision 14168)
@@ -117,7 +117,8 @@
 #ifdef GETDENTS_64BIT_ALIGNED
       /* The d_reclen value might include padding which is not part of
 	 the DIRENT_TYPE data structure.  */
-      reclen = MIN (reclen, sizeof (DIRENT_TYPE));
+      reclen = MIN (reclen,
+		    offsetof (DIRENT_TYPE, d_name) + sizeof (dp->d_name));
 #endif
       *result = memcpy (entry, dp, reclen);
 #ifdef GETDENTS_64BIT_ALIGNED
--- a/sysdeps/pthread/aio_misc.c	(révision 10714)
+++ b/sysdeps/pthread/aio_misc.c	(révision 14168)
@@ -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@cygnus.com>, 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)
--- a/sysdeps/i386/dl-tls.h	(révision 10714)
+++ b/sysdeps/i386/dl-tls.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  i386 version.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 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
@@ -58,3 +58,6 @@
 
 # endif
 #endif
+
+/* Value used for dtv entries for which the allocation is delayed.  */
+#define TLS_DTV_UNALLOCATED	((void *) -1l)
--- a/sysdeps/i386/Makefile	(révision 10714)
+++ b/sysdeps/i386/Makefile	(révision 14168)
@@ -51,6 +51,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
--- a/sysdeps/i386/bits/byteswap.h	(révision 10714)
+++ b/sysdeps/i386/bits/byteswap.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Macros to swap the order of bytes in integer values.
-   Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008
+   Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -27,26 +27,27 @@
 
 /* Swap bytes in 16 bit value.  */
 #define __bswap_constant_16(x) \
-     ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+     ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
 
 #ifdef __GNUC__
 # if __GNUC__ >= 2
 #  define __bswap_16(x) \
      (__extension__							      \
-      ({ register unsigned short int __v, __x = (x);			      \
+      ({ register unsigned short int __v, __x = (unsigned short int) (x);     \
 	 if (__builtin_constant_p (__x))				      \
 	   __v = __bswap_constant_16 (__x);				      \
 	 else								      \
 	   __asm__ ("rorw $8, %w0"					      \
 		    : "=r" (__v)					      \
- 		    : "0" (__x)						      \
- 		    : "cc");						      \
+		    : "0" (__x)						      \
+		    : "cc");						      \
 	 __v; }))
 # else
 /* This is better than nothing.  */
 #  define __bswap_16(x) \
      (__extension__							      \
-      ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
+      ({ register unsigned short int __x = (unsigned short int) (x);	      \
+	 __bswap_constant_16 (__x); }))
 # endif
 #else
 static __inline unsigned short int
@@ -122,7 +123,7 @@
      (__extension__							      \
       ({ union { __extension__ unsigned long long int __ll;		      \
 		 unsigned long int __l[2]; } __w, __r;			      \
-         if (__builtin_constant_p (x))					      \
+	 if (__builtin_constant_p (x))					      \
 	   __r.__ll = __bswap_constant_64 (x);				      \
 	 else								      \
 	   {								      \
--- a/sysdeps/i386/fpu/libm-test-ulps	(révision 10714)
+++ b/sysdeps/i386/fpu/libm-test-ulps	(révision 14168)
@@ -857,8 +857,8 @@
 ildouble: 2
 ldouble: 2
 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
-float: 1
-ifloat: 1
+float: 2
+ifloat: 2
 ildouble: 4
 ldouble: 4
 Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
--- a/sysdeps/wordsize-64/tst-writev.c	(révision 0)
+++ b/sysdeps/wordsize-64/tst-writev.c	(révision 14168)
@@ -0,0 +1,107 @@
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ryan S. Arnold <rsa@us.ibm.com>, 2011.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fcntl.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+
+/* The purpose of this test is to verify that the INTERNAL_[V]SYSCALL_NCS
+   macros on 64-bit platforms don't cast the return type to (int) which would
+   erroneously sign extend the return value should the high bit of the bottom
+   half of the word be '1'.  */
+
+#if 0
+/* Used to test the non power-of-2 code path.  */
+#undef IOV_MAX
+#define IOV_MAX 1000
+#endif
+
+/* writev() should report that it has written EXPECTED number of bytes.  */
+#define EXPECTED ((size_t) INT32_MAX + 1)
+
+static int
+do_test (void)
+{
+  struct iovec iv[IOV_MAX];
+  /* POSIX doesn't guarantee that IOV_MAX is pow of 2 but we're optimistic.  */
+  size_t bufsz = EXPECTED / IOV_MAX;
+  size_t bufrem = EXPECTED % IOV_MAX;
+
+  /* If there's a remainder then IOV_MAX probably isn't a power of 2 and we
+     need to make bufsz bigger so that the last iovec, iv[IOV_MAX-1], is free
+     for the remainder.  */
+  if (bufrem)
+    {
+      bufsz = bufsz + 1;
+      bufrem = EXPECTED - (bufsz * (IOV_MAX - 1));
+    }
+
+  /* We writev to /dev/null since we're just testing writev's return value.  */
+  int fd = open (_PATH_DEVNULL, O_WRONLY);
+  if (fd == -1)
+    {
+      printf ("Unable to open /dev/null for writing.\n");
+      return -1;
+    }
+
+  iv[0].iov_base = malloc (bufsz);
+  if (iv[0].iov_base == NULL)
+    {
+      printf ("malloc (%zu) failed.\n", bufsz);
+      close (fd);
+      return -1;
+    }
+  iv[0].iov_len = bufsz;
+
+  /* We optimistically presume that there isn't a remainder and set all iovec
+     instances to the same base and len as the first instance.  */
+  for (int i = 1; i < IOV_MAX; i++)
+    {
+      /* We don't care what the data is so reuse the allocation from iv[0];  */
+      iv[i].iov_base = iv[0].iov_base;
+      iv[i].iov_len = iv[0].iov_len;
+    }
+
+  /* If there is a remainder then we correct the last iov_len.  */
+  if (bufrem)
+    iv[IOV_MAX - 1].iov_len = bufrem;
+
+  /* Write junk to /dev/null with the writev syscall in order to get a return
+     of INT32_MAX+1 bytes to verify that the INTERNAL_SYSCALL wrappers aren't
+     mangling the result if the signbit of a 32-bit number is set.  */
+  ssize_t ret = writev (fd, iv, IOV_MAX);
+
+  free (iv[0].iov_base);
+  close (fd);
+
+  if (ret != (ssize_t) EXPECTED)
+    {
+      printf ("writev() return value: %zd != EXPECTED: %zd\n", ret, EXPECTED);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
--- a/sysdeps/x86_64/dl-tls.h	(révision 10714)
+++ b/sysdeps/x86_64/dl-tls.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  x86-64 version.
-   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005, 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
@@ -27,3 +27,6 @@
 
 
 extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed.  */
+#define TLS_DTV_UNALLOCATED	((void *) -1l)
--- a/sysdeps/x86_64/strcmp.S	(révision 10714)
+++ b/sysdeps/x86_64/strcmp.S	(révision 14168)
@@ -313,7 +313,7 @@
 	jnz	LABEL(ashr_1_exittail)	/* find null char*/
 
 #ifdef USE_AS_STRNCMP
-	cmp	$14, %r11
+	cmp	$15, %r11
 	jbe	LABEL(ashr_1_exittail)
 #endif
 
@@ -438,7 +438,7 @@
 	jnz	LABEL(ashr_2_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$13, %r11
+	cmp	$14, %r11
 	jbe	LABEL(ashr_2_exittail)
 #endif
 
@@ -560,7 +560,7 @@
 	jnz	LABEL(ashr_3_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$12, %r11
+	cmp	$13, %r11
 	jbe	LABEL(ashr_3_exittail)
 #endif
 
@@ -682,7 +682,7 @@
 	jnz	LABEL(ashr_4_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$11, %r11
+	cmp	$12, %r11
 	jbe	LABEL(ashr_4_exittail)
 #endif
 
@@ -804,7 +804,7 @@
 	jnz	LABEL(ashr_5_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$10, %r11
+	cmp	$11, %r11
 	jbe	LABEL(ashr_5_exittail)
 #endif
 
@@ -926,7 +926,7 @@
 	jnz	LABEL(ashr_6_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$9, %r11
+	cmp	$10, %r11
 	jbe	LABEL(ashr_6_exittail)
 #endif
 
@@ -1048,7 +1048,7 @@
 	jnz	LABEL(ashr_7_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$8, %r11
+	cmp	$9, %r11
 	jbe	LABEL(ashr_7_exittail)
 #endif
 
@@ -1170,7 +1170,7 @@
 	jnz	LABEL(ashr_8_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$7, %r11
+	cmp	$8, %r11
 	jbe	LABEL(ashr_8_exittail)
 #endif
 
@@ -1292,7 +1292,7 @@
 	jnz	LABEL(ashr_9_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$6, %r11
+	cmp	$7, %r11
 	jbe	LABEL(ashr_9_exittail)
 #endif
 
@@ -1414,7 +1414,7 @@
 	jnz	LABEL(ashr_10_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$5, %r11
+	cmp	$6, %r11
 	jbe	LABEL(ashr_10_exittail)
 #endif
 
@@ -1536,7 +1536,7 @@
 	jnz	LABEL(ashr_11_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$4, %r11
+	cmp	$5, %r11
 	jbe	LABEL(ashr_11_exittail)
 #endif
 
@@ -1658,7 +1658,7 @@
 	jnz	LABEL(ashr_12_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$3, %r11
+	cmp	$4, %r11
 	jbe	LABEL(ashr_12_exittail)
 #endif
 
@@ -1780,7 +1780,7 @@
 	jnz	LABEL(ashr_13_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$2, %r11
+	cmp	$3, %r11
 	jbe	LABEL(ashr_13_exittail)
 #endif
 
@@ -1902,7 +1902,7 @@
 	jnz	LABEL(ashr_14_exittail)
 
 #ifdef USE_AS_STRNCMP
-	cmp	$1, %r11
+	cmp	$2, %r11
 	jbe	LABEL(ashr_14_exittail)
 #endif
 
@@ -2026,8 +2026,8 @@
 	jnz	LABEL(ashr_15_exittail)
 
 #ifdef USE_AS_STRNCMP
-	test	%r11, %r11
-	je	LABEL(ashr_15_exittail)
+	cmpq	$1, %r11
+	jbe	LABEL(ashr_15_exittail)
 #endif
 
 	pxor	%xmm0, %xmm0
--- a/sysdeps/x86_64/cacheinfo.c	(révision 10714)
+++ b/sysdeps/x86_64/cacheinfo.c	(révision 14168)
@@ -453,10 +453,10 @@
 
 
 /* Half the data cache size for use in memory and string routines, typically
-   L1 size.  */
+   L1 size, rounded to multiple of 256 bytes.  */
 long int __x86_64_data_cache_size_half attribute_hidden = 32 * 1024 / 2;
 /* Shared cache size for use in memory and string routines, typically
-   L2 or L3 size.  */
+   L2 or L3 size, rounded to multiple of 256 bytes.  */
 long int __x86_64_shared_cache_size_half attribute_hidden = 1024 * 1024 / 2;
 long int __x86_64_shared_cache_size attribute_hidden = 1024 * 1024;
 
@@ -657,10 +657,16 @@
     }
 
   if (data > 0)
-    __x86_64_data_cache_size_half = data / 2;
+    {
+      /* Round data cache size to multiple of 256 bytes.  */
+      data = data & ~255L;
+      __x86_64_data_cache_size_half = data / 2;
+    }
 
   if (shared > 0)
     {
+      /* Round shared cache size to multiple of 256 bytes.  */
+      shared = shared & ~255L;
       __x86_64_shared_cache_size_half = shared / 2;
       __x86_64_shared_cache_size = shared;
     }
--- a/sysdeps/x86_64/bits/byteswap.h	(révision 10714)
+++ b/sysdeps/x86_64/bits/byteswap.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Macros to swap the order of bytes in integer values.
-   Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008
+   Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -29,12 +29,12 @@
 
 /* Swap bytes in 16 bit value.  */
 #define __bswap_constant_16(x) \
-     ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+     ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
 
 #if defined __GNUC__ && __GNUC__ >= 2
 # define __bswap_16(x) \
      (__extension__							      \
-      ({ register unsigned short int __v, __x = (x);			      \
+      ({ register unsigned short int __v, __x = (unsigned short int) (x);     \
 	 if (__builtin_constant_p (__x))				      \
 	   __v = __bswap_constant_16 (__x);				      \
 	 else								      \
@@ -47,7 +47,8 @@
 /* This is better than nothing.  */
 # define __bswap_16(x) \
      (__extension__							      \
-      ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
+      ({ register unsigned short int __x = (unsigned short int) (x);          \
+	 __bswap_constant_16 (__x); }))
 #endif
 
 
@@ -120,16 +121,16 @@
 #  define __bswap_64(x) \
      (__extension__                                                           \
       ({ union { __extension__ unsigned long long int __ll;                   \
-                 unsigned int __l[2]; } __w, __r;                             \
-         if (__builtin_constant_p (x))                                        \
-           __r.__ll = __bswap_constant_64 (x);                                \
-         else                                                                 \
-           {                                                                  \
-             __w.__ll = (x);                                                  \
-             __r.__l[0] = __bswap_32 (__w.__l[1]);                            \
-             __r.__l[1] = __bswap_32 (__w.__l[0]);                            \
-           }                                                                  \
-         __r.__ll; }))
+		 unsigned int __l[2]; } __w, __r;                             \
+	 if (__builtin_constant_p (x))                                        \
+	   __r.__ll = __bswap_constant_64 (x);                                \
+	 else                                                                 \
+	   {                                                                  \
+	     __w.__ll = (x);                                                  \
+	     __r.__l[0] = __bswap_32 (__w.__l[1]);                            \
+	     __r.__l[1] = __bswap_32 (__w.__l[0]);                            \
+	   }                                                                  \
+	 __r.__ll; }))
 # endif
 #endif
 
--- a/sysdeps/x86_64/fpu/e_powl.S	(révision 10714)
+++ b/sysdeps/x86_64/fpu/e_powl.S	(révision 14168)
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of pow function.
-   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2007
+   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2007, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -154,7 +154,7 @@
 	fucompp			// 1.0 : x : y
 	fnstsw
 	fxch			// x : 1.0 : y
-	test	$4500,%eax
+	test	$0x4500,%eax
 	jz	7f
 	fsub	%st(1)		// x-1 : 1.0 : y
 	fyl2xp1			// log2(x) : y
--- a/sysdeps/x86_64/multiarch/strchr.S	(révision 10714)
+++ b/sysdeps/x86_64/multiarch/strchr.S	(révision 14168)
@@ -1,5 +1,5 @@
 /* strchr with SSE4.2
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
@@ -87,13 +87,13 @@
 	pxor	%xmm2, %xmm2
 	movd	%esi, %xmm1
 	movl	%edi, %ecx
+	pshufb  %xmm2, %xmm1
 	andl	$15, %ecx
 	movq	%rdi, %r8
 	je	L(aligned_start)
 
 /* Handle unaligned string.  */
 	andq	$-16, %r8
-	pshufb  %xmm2, %xmm1
 	movdqa	(%r8), %xmm0
 	pcmpeqb	 %xmm0, %xmm2
 	pcmpeqb	 %xmm1, %xmm0
--- a/sysdeps/s390/s390-32/__longjmp.c	(révision 10714)
+++ b/sysdeps/s390/s390-32/__longjmp.c	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2005, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2005, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
 
@@ -29,16 +29,19 @@
 void
 __longjmp (__jmp_buf env, int val)
 {
-  register int r2 __asm ("%r2") = val == 0 ? 1 : val;
 #ifdef PTR_DEMANGLE
-  register uintptr_t r3 __asm ("%r3") = THREAD_GET_POINTER_GUARD ();
-  register void *r1 __asm ("%r1") = (void *) env;
+  uintptr_t guard = THREAD_GET_POINTER_GUARD ();
 # ifdef CHECK_SP
-  CHECK_SP (env, r3);
+  CHECK_SP (env, guard);
 # endif
 #elif defined CHECK_SP
   CHECK_SP (env, 0);
 #endif
+  register int r2 __asm ("%r2") = val == 0 ? 1 : val;
+#ifdef PTR_DEMANGLE
+  register uintptr_t r3 __asm ("%r3") = guard;
+  register void *r1 __asm ("%r1") = (void *) env;
+#endif
   /* Restore registers and jump back.  */
   asm volatile ("ld   %%f6,48(%1)\n\t"
 		"ld   %%f4,40(%1)\n\t"
--- a/sysdeps/s390/dl-tls.h	(révision 10714)
+++ b/sysdeps/s390/dl-tls.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  s390 version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 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
@@ -72,6 +72,9 @@
 # define __TLS_GET_ADDR(__ti) \
   ({ extern char _GLOBAL_OFFSET_TABLE_[] attribute_hidden;		  \
      (void *) __tls_get_offset ((char *) (__ti) - _GLOBAL_OFFSET_TABLE_)  \
-     + (unsigned long) __builtin_thread_pointer (); }) 
+     + (unsigned long) __builtin_thread_pointer (); })
 
 #endif
+
+/* Value used for dtv entries for which the allocation is delayed.  */
+#define TLS_DTV_UNALLOCATED	((void *) -1l)
--- a/sysdeps/s390/s390-64/__longjmp.c	(révision 10714)
+++ b/sysdeps/s390/s390-64/__longjmp.c	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2005, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2005, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
 
@@ -29,16 +29,19 @@
 void
 __longjmp (__jmp_buf env, int val)
 {
-  register long int r2 __asm ("%r2") = val == 0 ? 1 : val;
 #ifdef PTR_DEMANGLE
-  register uintptr_t r3 __asm ("%r3") = THREAD_GET_POINTER_GUARD ();
-  register void *r1 __asm ("%r1") = (void *) env;
+  uintptr_t guard = THREAD_GET_POINTER_GUARD ();
 # ifdef CHECK_SP
-  CHECK_SP (env, r3);
+  CHECK_SP (env, guard);
 # endif
 #elif defined CHECK_SP
   CHECK_SP (env, 0);
 #endif
+  register long int r2 __asm ("%r2") = val == 0 ? 1 : val;
+#ifdef PTR_DEMANGLE
+  register uintptr_t r3 __asm ("%r3") = guard;
+  register void *r1 __asm ("%r1") = (void *) env;
+#endif
   /* Restore registers and jump back.  */
   asm volatile ("ld   %%f7,104(%1)\n\t"
 		"ld   %%f5,96(%1)\n\t"
--- a/sysdeps/posix/spawni.c	(révision 10714)
+++ b/sysdeps/posix/spawni.c	(révision 14168)
@@ -142,9 +142,7 @@
     }
   else if ((flags & POSIX_SPAWN_SETSCHEDULER) != 0)
     {
-      if (__sched_setscheduler (0, attrp->__policy,
-				(flags & POSIX_SPAWN_SETSCHEDPARAM) != 0
-				? &attrp->__sp : NULL) == -1)
+      if (__sched_setscheduler (0, attrp->__policy, &attrp->__sp) == -1)
 	_exit (SPAWN_ERROR);
     }
 #endif
--- a/sysdeps/posix/getaddrinfo.c	(révision 10714)
+++ b/sysdeps/posix/getaddrinfo.c	(révision 14168)
@@ -963,6 +963,7 @@
 		   make a copy.  */
 		if (out == canon)
 		  goto make_copy;
+		canon = out;
 	      }
 	    else
 #endif
--- a/sysdeps/ia64/dl-tls.h	(révision 10714)
+++ b/sysdeps/ia64/dl-tls.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  IA-64 version.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 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
@@ -28,3 +28,6 @@
 #define DONT_USE_TLS_INDEX	1
 
 extern void *__tls_get_addr (size_t m, size_t offset);
+
+/* Value used for dtv entries for which the allocation is delayed.  */
+#define TLS_DTV_UNALLOCATED	((void *) -1l)
--- a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c	(révision 10714)
+++ b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c	(révision 14168)
@@ -73,9 +73,9 @@
 	m = ((a.i[2] >> 20) & 0x7ff) - 54;
       }
       m += n;
-      if (m > 0)
+      if ((int) m > 0)
 	a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
-      else if (m <= -54) {
+      else if ((int) m <= -54) {
 	a.i[2] &= 0x80000000;
 	a.i[3] = 0;
       } else {
--- a/sysdeps/sparc/dl-tls.h	(révision 10714)
+++ b/sysdeps/sparc/dl-tls.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  SPARC version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 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
@@ -27,3 +27,6 @@
 
 
 extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed.  */
+#define TLS_DTV_UNALLOCATED	((void *) -1l)
--- a/sysdeps/mach/hurd/ifreq.h	(révision 0)
+++ b/sysdeps/mach/hurd/ifreq.h	(révision 14168)
@@ -0,0 +1,45 @@
+/* Copyright (C) 1999, 2002, 2003, 2011 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <net/if.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+static inline struct ifreq *
+__if_nextreq (struct ifreq *ifr)
+{
+#ifdef _HAVE_SA_LEN
+  if (ifr->ifr_addr.sa_len > sizeof ifr->ifr_addr)
+    return (struct ifreq *) ((char *) &ifr->ifr_addr + ifr->ifr_addr.sa_len);
+#endif
+  return ifr + 1;
+}
+
+extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
+
+
+static inline void
+__if_freereq (struct ifreq *ifreqs, int num_ifs)
+{
+  munmap (ifreqs, num_ifs * sizeof (struct ifreq));
+}
--- a/sysdeps/mach/hurd/linkat.c	(révision 10714)
+++ b/sysdeps/mach/hurd/linkat.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Make a link between file names relative to open directories.  Hurd version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006,2010 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
@@ -38,7 +38,9 @@
   file_t oldfile, linknode, todir;
   char *toname;
 
-  oldfile = __file_name_lookup_at (fromfd, flags, from, 0, 0);
+  /* POSIX says linkat doesn't follow symlinks by default, so pass
+     O_NOLINK.  That can be overridden by AT_SYMLINK_FOLLOW in FLAGS.  */
+  oldfile = __file_name_lookup_at (fromfd, flags, from, O_NOLINK, 0);
   if (oldfile == MACH_PORT_NULL)
     return -1;
 
--- a/sysdeps/sh/dl-tls.h	(révision 10714)
+++ b/sysdeps/sh/dl-tls.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  SH version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 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
@@ -27,3 +27,6 @@
 
 
 extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed.  */
+#define TLS_DTV_UNALLOCATED	((void *) -1l)
--- a/sysdeps/generic/ldsodefs.h	(révision 10714)
+++ b/sysdeps/generic/ldsodefs.h	(révision 14168)
@@ -820,11 +820,9 @@
 
 /* Open the shared object NAME and map in its segments.
    LOADER's DT_RPATH is used in searching for NAME.
-   If the object is already opened, returns its existing map.
-   For preloaded shared objects PRELOADED is set to a non-zero
-   value to allow additional security checks.  */
+   If the object is already opened, returns its existing map.  */
 extern struct link_map *_dl_map_object (struct link_map *loader,
-					const char *name, int preloaded,
+					const char *name,
 					int type, int trace_mode, int mode,
 					Lmid_t nsid)
      internal_function attribute_hidden;
@@ -889,8 +887,11 @@
 extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name)
      internal_function;
 
-/* Allocate a `struct link_map' for a new object being loaded,
-   and enter it into the _dl_main_map list.  */
+/* Add the new link_map NEW to the end of the namespace list.  */
+extern void _dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
+     internal_function attribute_hidden;
+
+/* Allocate a `struct link_map' for a new object being loaded.  */
 extern struct link_map *_dl_new_object (char *realname, const char *libname,
 					int type, struct link_map *loader,
 					int mode, Lmid_t nsid)
--- a/misc/mntent_r.c	(révision 10714)
+++ b/misc/mntent_r.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Utilities for reading/writing fstab, mtab, etc.
-   Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010
+   Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -263,8 +263,8 @@
 		   mntcopy.mnt_type,
 		   mntcopy.mnt_opts,
 		   mntcopy.mnt_freq,
-		   mntcopy.mnt_passno)
-	  < 0 ? 1 : 0);
+		   mntcopy.mnt_passno) < 0
+	  || fflush (stream) != 0);
 }
 weak_alias (__addmntent, addmntent)
 
--- a/misc/error.c	(révision 10714)
+++ b/misc/error.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2006, 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
@@ -277,7 +277,9 @@
 
       if (old_line_number == line_number
 	  && (file_name == old_file_name
-	      || strcmp (old_file_name, file_name) == 0))
+	      || (old_file_name != NULL
+		  && file_name != NULL
+		  && strcmp (old_file_name, file_name) == 0)))
 	/* Simply return and print nothing.  */
 	return;
 
--- a/inet/getnameinfo.c	(révision 10714)
+++ b/inet/getnameinfo.c	(révision 14168)
@@ -159,7 +159,7 @@
 int
 getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 	     socklen_t hostlen, char *serv, socklen_t servlen,
-	     unsigned int flags)
+	     int flags)
 {
   int serrno = errno;
   int tmpbuflen = 1024;
@@ -385,7 +385,7 @@
 	break;
 
       default:
-        return EAI_FAMILY;
+	return EAI_FAMILY;
     }
 
   if (serv && (servlen > 0))
--- a/hurd/hurdselect.c	(révision 10714)
+++ b/hurd/hurdselect.c	(révision 14168)
@@ -52,7 +52,7 @@
   int firstfd, lastfd;
   mach_msg_timeout_t to = (timeout != NULL ?
 			   (timeout->tv_sec * 1000 +
-			    timeout->tv_nsec / 1000000) :
+			    (timeout->tv_nsec + 999999) / 1000000) :
 			   0);
   struct
     {
--- a/hurd/lookup-at.c	(révision 10714)
+++ b/hurd/lookup-at.c	(révision 14168)
@@ -30,8 +30,14 @@
   error_t err;
   file_t result;
 
+  if ((at_flags & AT_SYMLINK_FOLLOW) && (at_flags & AT_SYMLINK_NOFOLLOW))
+    return (__hurd_fail (EINVAL), MACH_PORT_NULL);
+
   flags |= (at_flags & AT_SYMLINK_NOFOLLOW) ? O_NOLINK : 0;
   at_flags &= ~AT_SYMLINK_NOFOLLOW;
+  if (at_flags & AT_SYMLINK_FOLLOW)
+    flags &= ~O_NOLINK;
+  at_flags &= ~AT_SYMLINK_FOLLOW;
   if (at_flags != 0)
     return (__hurd_fail (EINVAL), MACH_PORT_NULL);
 
--- a/hurd/hurd/fd.h	(révision 10714)
+++ b/hurd/hurd/fd.h	(révision 14168)
@@ -254,8 +254,9 @@
 			 const sigset_t *sigmask);
 
 /* Variant of file_name_lookup used in *at function implementations.
-   AT_FLAGS should contain only AT_SYMLINK_NOFOLLOW; other bits
-   cause EINVAL.  */
+   AT_FLAGS may only contain AT_SYMLINK_FOLLOW or AT_SYMLINK_NOFOLLOW,
+   which will remove and add O_NOLINK from FLAGS respectively.
+   Other bits cause EINVAL.  */
 extern file_t __file_name_lookup_at (int fd, int at_flags,
 				     const char *file_name,
 				     int flags, mode_t mode);
--- a/nss/nss_files/files-hosts.c	(révision 10714)
+++ b/nss/nss_files/files-hosts.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Hosts file parser in nss_files module.
-   Copyright (C) 1996-2001, 2003-2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1996-2001, 2003-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
@@ -129,19 +129,22 @@
 	  && _res_hconf.flags & HCONF_FLAG_MULTI)			      \
 	{								      \
 	  /* We have to get all host entries from the file.  */		      \
-	  const size_t tmp_buflen = MIN (buflen, 4096);			      \
-	  char tmp_buffer[tmp_buflen]					      \
+	  size_t tmp_buflen = MIN (buflen, 4096);			      \
+	  char tmp_buffer_stack[tmp_buflen]				      \
 	    __attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));\
+	  char *tmp_buffer = tmp_buffer_stack;				      \
 	  struct hostent tmp_result_buf;				      \
 	  int naddrs = 1;						      \
 	  int naliases = 0;						      \
 	  char *bufferend;						      \
+	  bool tmp_buffer_malloced = false;				      \
 									      \
 	  while (result->h_aliases[naliases] != NULL)			      \
 	    ++naliases;							      \
 									      \
 	  bufferend = (char *) &result->h_aliases[naliases + 1];	      \
 									      \
+	again:								      \
 	  while ((status = internal_getent (&tmp_result_buf, tmp_buffer,      \
 					    tmp_buflen, errnop H_ERRNO_ARG    \
 					    EXTRA_ARGS_VALUE))		      \
@@ -182,7 +185,7 @@
 		    }							      \
 		  /* If the real name is different add it also to the	      \
 		     aliases.  This means that there is a duplication	      \
-		     in the alias list but this is really the users	      \
+		     in the alias list but this is really the user's	      \
 		     problem.  */					      \
 		  if (strcmp (old_result->h_name,			      \
 			      tmp_result_buf.h_name) != 0)		      \
@@ -204,7 +207,7 @@
 		      *errnop = ERANGE;					      \
 		      *herrnop = NETDB_INTERNAL;			      \
 		      status = NSS_STATUS_TRYAGAIN;			      \
-		      break;						      \
+		      goto out;						      \
 		    }							      \
 									      \
 		  new_h_addr_list =					      \
@@ -268,8 +271,54 @@
 		}							      \
 	    }								      \
 									      \
-	  if (status != NSS_STATUS_TRYAGAIN)				      \
+	  if (status == NSS_STATUS_TRYAGAIN)				      \
+	    {								      \
+	      size_t newsize = 2 * tmp_buflen;				      \
+	      if (tmp_buffer_malloced)					      \
+		{							      \
+		  char *newp = realloc (tmp_buffer, newsize);		      \
+		  if (newp != NULL)					      \
+		    {							      \
+		      assert ((((uintptr_t) newp)			      \
+			       & (__alignof__ (struct hostent_data) - 1))     \
+			      == 0);					      \
+		      tmp_buffer = newp;				      \
+		      tmp_buflen = newsize;				      \
+		      goto again;					      \
+		    }							      \
+		}							      \
+	      else if (!__libc_use_alloca (buflen + newsize))		      \
+		{							      \
+		  tmp_buffer = malloc (newsize);			      \
+		  if (tmp_buffer != NULL)				      \
+		    {							      \
+		      assert ((((uintptr_t) tmp_buffer)			      \
+			       & (__alignof__ (struct hostent_data) - 1))     \
+			      == 0);					      \
+		      tmp_buffer_malloced = true;			      \
+		      tmp_buflen = newsize;				      \
+		      goto again;					      \
+		    }							      \
+		}							      \
+	      else							      \
+		{							      \
+		  tmp_buffer						      \
+		    = extend_alloca (tmp_buffer, tmp_buflen,		      \
+				     newsize				      \
+				     + __alignof__ (struct hostent_data));    \
+		  tmp_buffer = (char *) (((uintptr_t) tmp_buffer	      \
+					  + __alignof__ (struct hostent_data) \
+					  - 1)				      \
+					 & ~(__alignof__ (struct hostent_data)\
+					     - 1));			      \
+		  goto again;						      \
+		}							      \
+	    }								      \
+	  else								      \
 	    status = NSS_STATUS_SUCCESS;				      \
+	out:								      \
+	  if (tmp_buffer_malloced)					      \
+	    free (tmp_buffer);						      \
 	}								      \
 									      \
 									      \
--- a/Makeconfig	(révision 10714)
+++ b/Makeconfig	(révision 14168)
@@ -694,7 +694,7 @@
 	   -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
 	   $(CPPFLAGS-$(suffix $@)) \
 	   $(foreach lib,$(libof-$(basename $(@F))) \
-		         $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+			 $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
 	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
 override CFLAGS	= -std=gnu99 $(gnu89-inline-CFLAGS) \
 		  $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
@@ -983,7 +983,7 @@
 # emitted into sysd-rules.  A sysdeps Makeconfig fragment can
 # add its own special object file prefix to this list with e.g. foo-%:%
 # to have foo-*.? compiled from *.? using $(foo-CPPFLAGS).
-sysd-rules-patterns := %:% rtld-%:% m_%:s_%
+sysd-rules-patterns := %:% rtld-%:rtld-% rtld-%:% m_%:s_%
 
 # Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
 sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
@@ -992,8 +992,8 @@
 endif
 
 # Compute just the target patterns.  Makeconfig has set sysd-rules-patterns.
-sysd-rules-targets := $(foreach p,$(sysd-rules-patterns),\
-		      		$(firstword $(subst :, ,$p)))
+sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\
+					 $(firstword $(subst :, ,$p))))
 
 endif # Makeconfig not yet included
 
--- a/string/bits/string3.h	(révision 10714)
+++ b/string/bits/string3.h	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2007, 2009, 2010 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
@@ -53,8 +53,7 @@
 }
 
 __extern_always_inline void *
-__NTH (memmove (void *__restrict __dest, __const void *__restrict __src,
-		size_t __len))
+__NTH (memmove (void *__dest, __const void *__src, size_t __len))
 {
   return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
 }
@@ -88,8 +87,7 @@
 
 #ifdef __USE_BSD
 __extern_always_inline void
-__NTH (bcopy (__const void *__restrict __src, void *__restrict __dest,
-	      size_t __len))
+__NTH (bcopy (__const void *__src, void *__dest, size_t __len))
 {
   (void) __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
 }
--- a/string/stratcliff.c	(révision 10714)
+++ b/string/stratcliff.c	(révision 14168)
@@ -1,5 +1,6 @@
 /* Test for string function add boundaries of usable memory.
-   Copyright (C) 1996,1997,1999-2003,2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1999-2003,2007,2009,2010
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -47,6 +48,8 @@
 # define MEMCPY memcpy
 # define MEMPCPY mempcpy
 # define MEMCHR memchr
+# define STRCMP strcmp
+# define STRNCMP strncmp
 #endif
 
 
@@ -70,12 +73,12 @@
   if (adr == MAP_FAILED || dest == MAP_FAILED)
     {
       if (errno == ENOSYS)
-        puts ("No test, mmap not available.");
+	puts ("No test, mmap not available.");
       else
-        {
-          printf ("mmap failed: %m");
-          result = 1;
-        }
+	{
+	  printf ("mmap failed: %m");
+	  result = 1;
+	}
     }
   else
     {
@@ -93,8 +96,8 @@
 
       /* strlen/wcslen test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      adr[inner] = L('\0');
 
@@ -107,12 +110,12 @@
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
 
       /* strnlen/wcsnlen test */
       for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      adr[inner] = L('\0');
 
@@ -126,9 +129,9 @@
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
       for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (inner = MAX (outer, nchars - 64); inner <= nchars; ++inner)
 	    {
 	      if (STRNLEN (&adr[outer], inner - outer)
@@ -139,11 +142,11 @@
 		  result = 1;
 		}
 	    }
-        }
+	}
 
       /* strchr/wcschr test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      for (inner = middle; inner < nchars; ++inner)
@@ -167,7 +170,7 @@
 		  adr[middle] = L('T');
 		}
 	    }
-        }
+	}
 
       /* Special test.  */
       adr[nchars - 1] = L('\0');
@@ -180,7 +183,7 @@
 
       /* strrchr/wcsrchr test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      for (inner = middle; inner < nchars; ++inner)
@@ -204,11 +207,11 @@
 		  adr[middle] = L('T');
 		}
 	    }
-        }
+	}
 
       /* memchr test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      adr[middle] = L('V');
@@ -224,9 +227,9 @@
 
 	      adr[middle] = L('T');
 	    }
-        }
+	}
       for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  CHAR *cp = MEMCHR (&adr[outer], L('V'), nchars - outer);
 
 	  if (cp != NULL)
@@ -235,13 +238,13 @@
 		      STRINGIFY (MEMCHR), outer);
 	      result = 1;
 	    }
-        }
+	}
 
       /* This function only exists for single-byte characters.  */
 #ifndef WCSTEST
       /* rawmemchr test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      adr[middle] = L('V');
@@ -257,13 +260,13 @@
 
 	      adr[middle] = L('T');
 	    }
-        }
+	}
 #endif
 
       /* strcpy/wcscpy test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      adr[inner] = L('\0');
 
@@ -277,8 +280,75 @@
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
 
+      /* strcmp/wcscmp tests */
+      for (outer = 1; outer < 32; ++outer)
+	for (middle = 0; middle < 16; ++middle)
+	  {
+	    MEMSET (adr + middle, L('T'), 256);
+	    adr[256] = L('\0');
+	    MEMSET (dest + nchars - outer, L('T'), outer - 1);
+	    dest[nchars - 1] = L('\0');
+
+	    if (STRCMP (adr + middle, dest + nchars - outer) <= 0)
+	      {
+		printf ("%s 1 flunked for outer = %d, middle = %d\n",
+			STRINGIFY (STRCMP), outer, middle);
+		result = 1;
+	      }
+
+	    if (STRCMP (dest + nchars - outer, adr + middle) >= 0)
+	      {
+		printf ("%s 2 flunked for outer = %d, middle = %d\n",
+			STRINGIFY (STRCMP), outer, middle);
+		result = 1;
+	      }
+	  }
+
+      /* strncmp/wcsncmp tests */
+      for (outer = 1; outer < 32; ++outer)
+	for (middle = 0; middle < 16; ++middle)
+	  {
+	    MEMSET (adr + middle, L('T'), 256);
+	    adr[256] = L('\0');
+	    MEMSET (dest + nchars - outer, L('T'), outer - 1);
+	    dest[nchars - 1] = L('U');
+
+	    for (inner = 0; inner < outer; ++inner)
+	      {
+		if (STRNCMP (adr + middle, dest + nchars - outer, inner) != 0)
+		  {
+		    printf ("%s 1 flunked for outer = %d, middle = %d, "
+			    "inner = %d\n",
+			    STRINGIFY (STRNCMP), outer, middle, inner);
+		    result = 1;
+		  }
+
+		if (STRNCMP (dest + nchars - outer, adr + middle, inner) != 0)
+		  {
+		    printf ("%s 2 flunked for outer = %d, middle = %d, "
+			    "inner = %d\n",
+			    STRINGIFY (STRNCMP), outer, middle, inner);
+		    result = 1;
+		  }
+	      }
+
+	    if (STRNCMP (adr + middle, dest + nchars - outer, outer) >= 0)
+	      {
+		printf ("%s 1 flunked for outer = %d, middle = %d, full\n",
+			STRINGIFY (STRNCMP), outer, middle);
+		result = 1;
+	      }
+
+	    if (STRNCMP (dest + nchars - outer, adr + middle, outer) <= 0)
+	      {
+		printf ("%s 2 flunked for outer = %d, middle = %d, full\n",
+			STRINGIFY (STRNCMP), outer, middle);
+		result = 1;
+	      }
+	  }
+
       /* strncpy/wcsncpy tests */
       adr[nchars - 1] = L('T');
       for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
@@ -295,12 +365,12 @@
 		  result = 1;
 		}
 	    }
-        }
+	}
       adr[nchars - 1] = L('\0');
 
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      size_t len;
 
@@ -334,12 +404,12 @@
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
 
       /* stpcpy/wcpcpy test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      adr[inner] = L('\0');
 
@@ -352,7 +422,7 @@
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
 
       /* stpncpy/wcpncpy test */
       adr[nchars - 1] = L('T');
@@ -374,8 +444,8 @@
       adr[nchars - 1] = L('\0');
 
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
+	{
+	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      adr[middle] = L('\0');
 
@@ -393,7 +463,7 @@
 
 	      adr[middle] = L('T');
 	    }
-        }
+	}
 
       /* memcpy/wmemcpy test */
       for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
--- a/string/str-two-way.h	(révision 10714)
+++ b/string/str-two-way.h	(révision 14168)
@@ -350,8 +350,8 @@
 		     a byte out of place, there can be no match until
 		     after the mismatch.  */
 		  shift = needle_len - period;
-		  memory = 0;
 		}
+	      memory = 0;
 	      j += shift;
 	      continue;
 	    }
--- a/string/Makefile	(révision 10714)
+++ b/string/Makefile	(révision 14168)
@@ -58,7 +58,7 @@
 		   bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap	\
 		   tst-strtok tst-strfry	\
 		   bug-strtok1 $(addprefix test-,$(strop-tests))	\
-		   tst-strxfrm2 tst-endian tst-svc2
+		   tst-strxfrm2 tst-endian tst-svc2 bug-strstr1
 tests-$(OPTION_EGLIBC_ENVZ) += bug-envz1 
 tests-$(OPTION_EGLIBC_LOCALE_CODE) \
 		+= tst-strxfrm bug-strcoll1
@@ -81,6 +81,7 @@
 CFLAGS-stratcliff.c = -fno-builtin
 CFLAGS-test-ffs.c = -fno-builtin
 CFLAGS-tst-inlcall.c = -fno-builtin
+CFLAGS-bug-strstr1.c = -fno-builtin
 
 # eglibc: ifeq ($(cross-compiling),no)
 tests: $(objpfx)tst-svc.out
--- a/string/bug-strstr1.c	(révision 0)
+++ b/string/bug-strstr1.c	(révision 14168)
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <string.h>
+
+int main (int argc, char** argv)
+{
+  const char haystack[] =
+    "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_A7_20_EF_BF_BD";
+
+  const char needle[] =
+    "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+
+  const char* sub = strstr (haystack, needle);
+
+  if (sub != NULL)
+    {
+      int j;
+
+      fprintf (stderr, "BUG: expected NULL, got:\n%s\n%s\n", sub, needle);
+      for (j = 0; needle[j] != '\0'; ++j)
+        putchar (needle[j] == sub[j] ? ' ' : '^');
+      puts ("");
+      return 1;
+    }
+
+  return 0;
+}
--- a/iconv/loop.c	(révision 10714)
+++ b/iconv/loop.c	(révision 14168)
@@ -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@cygnus.com>, 1998.
 
@@ -399,6 +399,9 @@
     {
       *inptrp = inend;
 #ifdef STORE_REST
+      while (inptr < inend)
+	bytebuf[inlen++] = *inptr++;
+
       inptr = bytebuf;
       inptrp = &inptr;
       inend = &bytebuf[inlen];
--- a/math/test-powl.c	(révision 0)
+++ b/math/test-powl.c	(révision 14168)
@@ -0,0 +1,51 @@
+/* Test for powl
+   Copyright (C) 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdio.h>
+#include <math.h>
+#include <float.h>
+#include <ieee754.h>
+
+int
+main (void)
+{
+  int result = 0;
+
+#ifndef NO_LONG_DOUBLE
+# if LDBL_MANT_DIG == 64
+    {
+      long double x = 1e-20;
+      union ieee854_long_double u;
+      u.ieee.mantissa0 = 1;
+      u.ieee.mantissa1 = 1;
+      u.ieee.exponent = 0;
+      u.ieee.negative = 0;
+      (void) powl (0.2, u.d);
+      x = powl (x, 1.5);
+      if (fabsl (x - 1e-30) > 1e-10)
+	{
+	  printf ("powl (1e-20, 1.5): wrong result: %Lg\n", x);
+	  result = 1;
+	}
+    }
+# endif
+#endif
+
+  return result;
+}
--- a/math/Makefile	(révision 10714)
+++ b/math/Makefile	(révision 14168)
@@ -92,7 +92,8 @@
 # Rules for the test suite.
 tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \
 	test-misc test-fpucw tst-definitions test-tgmath test-tgmath-ret \
-	bug-nextafter bug-nexttoward bug-tgmath1 test-tgmath-int test-tgmath2
+	bug-nextafter bug-nexttoward bug-tgmath1 test-tgmath-int \
+	test-tgmath2 test-powl
 # We do the `long double' tests only if this data type is available and
 # distinct from `double'.
 test-longdouble-yes = test-ldouble test-ildoubl
@@ -133,6 +134,7 @@
 CFLAGS-test-tgmath.c = -fno-builtin
 CFLAGS-test-tgmath2.c = -fno-builtin
 CFLAGS-test-tgmath-ret.c = -fno-builtin
+CFLAGS-test-powl.c = -fno-builtin
 CPPFLAGS-test-ifloat.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \
 			 -DTEST_FAST_MATH -fno-builtin
 CPPFLAGS-test-idouble.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \
--- a/locale/programs/locale.c	(révision 10714)
+++ b/locale/programs/locale.c	(révision 14168)
@@ -765,6 +765,29 @@
   twalk (all_data, print_names);
 }
 
+/* Print a properly quoted assignment of NAME with VAL, using double
+   quotes iff DQUOTE is true.  */
+static void
+print_assignment (const char *name, const char *val, bool dquote)
+{
+  printf ("%s=", name);
+  if (dquote)
+    putchar ('"');
+  while (*val != '\0')
+    {
+      size_t segment
+	= strcspn (val, dquote ? "$`\"\\" : "~|&;<>()$`\\\"' \t\n");
+      printf ("%.*s", (int) segment, val);
+      val += segment;
+      if (*val == '\0')
+	break;
+      putchar ('\\');
+      putchar (*val++);
+    }
+  if (dquote)
+    putchar ('"');
+  putchar ('\n');
+}
 
 /* We have to show the contents of the environments determining the
    locale.  */
@@ -772,7 +795,7 @@
 show_locale_vars (void)
 {
   size_t cat_no;
-  const char *lcall = getenv ("LC_ALL");
+  const char *lcall = getenv ("LC_ALL") ? : "";
   const char *lang = getenv ("LANG") ? : "";
 
   auto void get_source (const char *name);
@@ -781,15 +804,15 @@
     {
       char *val = getenv (name);
 
-      if ((lcall ?: "")[0] != '\0' || val == NULL)
-	printf ("%s=\"%s\"\n", name,
-		(lcall ?: "")[0] ? lcall : (lang ?: "")[0] ? lang : "POSIX");
+      if (lcall[0] != '\0' || val == NULL)
+	print_assignment (name, lcall[0] ? lcall : lang[0] ? lang : "POSIX",
+			  true);
       else
-	printf ("%s=%s\n", name, val);
+	print_assignment (name, val, false);
     }
 
   /* LANG has to be the first value.  */
-  printf ("LANG=%s\n", lang);
+  print_assignment ("LANG", lang, false);
 
   /* Now all categories in an unspecified order.  */
   for (cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
@@ -797,7 +820,7 @@
       get_source (category[cat_no].name);
 
   /* The last is the LC_ALL value.  */
-  printf ("LC_ALL=%s\n", lcall ? : "");
+  print_assignment ("LC_ALL", lcall, false);
 }
 
 
--- a/INSTALL	(révision 10714)
+++ b/INSTALL	(révision 14168)
@@ -329,11 +329,12 @@
      Check the FAQ for any special compiler issues on particular
      platforms.
 
-   * GNU `binutils' 2.15 or later
+   * GNU `binutils'
 
      You must use GNU `binutils' (as and ld) to build the GNU C library.
      No other assembler or linker has the necessary functionality at the
-     moment.
+     moment.  The configure scripts checks for the appropriate version
+     for the platform.  Too-old versions will prevent building glibc.
 
    * GNU `texinfo' 3.12f
 
--- a/malloc/malloc.c	(révision 10714)
+++ b/malloc/malloc.c	(révision 14168)
@@ -2832,7 +2832,7 @@
   max_fast_bin = fastbin_index(get_max_fast ());
 
   for (i = 0; i < NFASTBINS; ++i) {
-    p = av->fastbins[i];
+    p = fastbin (av, i);
 
     /* The following test can only be performed for the main arena.
        While mallopt calls malloc_consolidate to get rid of all fast
@@ -4850,7 +4850,7 @@
       }
 
     if (__builtin_expect (perturb_byte, 0))
-      free_perturb (chunk2mem(p), size - SIZE_SZ);
+      free_perturb (chunk2mem(p), size - 2 * SIZE_SZ);
 
     set_fastchunks(av);
     fb = &fastbin (av, fastbin_index(size));
@@ -4938,7 +4938,7 @@
       }
 
     if (__builtin_expect (perturb_byte, 0))
-      free_perturb (chunk2mem(p), size - SIZE_SZ);
+      free_perturb (chunk2mem(p), size - 2 * SIZE_SZ);
 
     /* consolidate backward */
     if (!prev_inuse(p)) {
--- a/malloc/mcheck.c	(révision 10714)
+++ b/malloc/mcheck.c	(révision 14168)
@@ -1,5 +1,6 @@
 /* Standard debugging hooks for `malloc'.
-   Copyright (C) 1990-1997,1999,2000-2002,2007 Free Software Foundation, Inc.
+   Copyright (C) 1990-1997,1999,2000-2002,2007,2010
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written May 1989 by Mike Haertel.
 
@@ -25,6 +26,7 @@
 # include <stdint.h>
 # include <stdio.h>
 # include <libintl.h>
+# include <errno.h>
 #endif
 
 /* Old hook values.  */
@@ -209,6 +211,12 @@
   if (pedantic)
     mcheck_check_all ();
 
+  if (size > ~((size_t) 0) - (sizeof (struct hdr) + 1))
+    {
+      __set_errno (ENOMEM);
+      return NULL;
+    }
+
   __malloc_hook = old_malloc_hook;
   if (old_malloc_hook != NULL)
     hdr = (struct hdr *) (*old_malloc_hook) (sizeof (struct hdr) + size + 1,
@@ -241,6 +249,12 @@
 
   slop = (sizeof *hdr + alignment - 1) & -alignment;
 
+  if (size > ~((size_t) 0) - (slop + 1))
+    {
+      __set_errno (ENOMEM);
+      return NULL;
+    }
+
   __memalign_hook = old_memalign_hook;
   if (old_memalign_hook != NULL)
     block = (*old_memalign_hook) (alignment, slop + size + 1, caller);
@@ -276,6 +290,12 @@
   if (pedantic)
     mcheck_check_all ();
 
+  if (size > ~((size_t) 0) - (sizeof (struct hdr) + 1))
+    {
+      __set_errno (ENOMEM);
+      return NULL;
+    }
+
   if (ptr)
     {
       hdr = ((struct hdr *) ptr) - 1;
--- a/nptl/Makefile	(révision 10714)
+++ b/nptl/Makefile	(révision 14168)
@@ -509,7 +509,8 @@
 $(objpfx)tst-_res1mod2.so: $(objpfx)tst-_res1mod1.so
 LDFLAGS-tst-_res1mod1.so = -Wl,-soname,tst-_res1mod1.so
 LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
-$(objpfx)tst-_res1: $(objpfx)tst-_res1mod2.so $(shared-thread-library)
+$(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \
+		    $(shared-thread-library)
 else
 $(objpfx)tst-cond11: $(common-objpfx)rt/librt.a
 $(objpfx)tst-cond19: $(common-objpfx)rt/librt.a
--- a/nptl/ChangeLog	(révision 10714)
+++ b/nptl/ChangeLog	(révision 14168)
@@ -1,3 +1,41 @@
+2011-05-11  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #386]
+	* allocatestack.c (allocate_stack): Convert ENOMEM error to EAGAIN.
+
+2011-04-10  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12650]
+	* allocatestack.c (get_cached_stack): Deallocate DTV entries before
+	clearing memory.
+	Patch partly by Robert Rex <robert.rex@exasol.com>.
+
+2011-01-13  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #10484]
+	* Versions [libc] (GLIBC_PRIVATE): Export __libc_alloca_cutoff.
+	* alloca_cutoff.c: Add libc_hidden_def.
+
+2010-08-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* nptl/sysdeps/unix/sysv/linux/i386/Makefile: New file.
+
+2010-07-01  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makefile (tst-_res1): Add tst-_res1mod1 to dependency list.
+
+2010-10-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #12113]
+	* sysdeps/x86_64/pthreaddef.h (TCB_ALIGNMENT): Changed to 32.
+	* sysdeps/x86_64/tls.h (TLS_TCB_ALIGN): Defined with alignment
+	of "struct pthread".
+
+2010-06-01  Takashi Yoshii  <takashi.yoshii.zj@renesas.com>
+
+	* sysdeps/unix/sysv/linux/sh/lowlevellock.S: Fix incorrect
+	location of ifndef __ASSUME_FUTEX_CLOCK_REALTIME.
+
 2009-11-27  Andreas Schwab  <schwab@redhat.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Reload
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S	(révision 10714)
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009
+/* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -282,6 +282,7 @@
 	rts
 	 mov.l	@r15+, r12
 
+# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
 	.align	2
 # ifdef PIC
 .Lgot:
@@ -293,7 +294,6 @@
 	.long	__have_futex_clock_realtime
 # endif
 
-# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
 .Lreltmo:
 	/* Check for a valid timeout value.  */
 	mov.l	@(4,r6), r1
--- a/nptl/sysdeps/x86_64/tls.h	(révision 10714)
+++ b/nptl/sysdeps/x86_64/tls.h	(révision 14168)
@@ -117,12 +117,7 @@
 # define TLS_TCB_SIZE sizeof (struct pthread)
 
 /* Alignment requirements for the TCB.  */
-//# define TLS_TCB_ALIGN __alignof__ (struct pthread)
-// Normally the above would be correct  But we have to store post-AVX
-// vector registers in the TCB and we want the storage to be aligned.
-// unfortunately there isn't yet a type for these values and hence no
-// 32-byte alignment requirement.  Make this explicit, for now.
-# define TLS_TCB_ALIGN 32
+# define TLS_TCB_ALIGN __alignof__ (struct pthread)
 
 /* The TCB can have any size and the memory following the address the
    thread pointer points to is unspecified.  Allocate the TCB there.  */
--- a/nptl/sysdeps/x86_64/pthreaddef.h	(révision 10714)
+++ b/nptl/sysdeps/x86_64/pthreaddef.h	(révision 14168)
@@ -27,8 +27,9 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK	2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT		16
+/* Alignment requirement for TCB.  Need to store post-AVX vector registers
+   in the TCB and we want the storage to be aligned at 32-byte.  */
+#define TCB_ALIGNMENT		32
 
 
 /* Location of current stack frame.  The frame pointer is not usable.  */
--- a/nptl/alloca_cutoff.c	(révision 10714)
+++ b/nptl/alloca_cutoff.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Determine whether block of given size can be allocated on the stack or not.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 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
@@ -34,3 +34,4 @@
 			  assume the maximum available stack space.  */
 		       ?: __MAX_ALLOCA_CUTOFF * 4));
 }
+libc_hidden_def (__libc_alloca_cutoff)
--- a/nptl/allocatestack.c	(révision 10714)
+++ b/nptl/allocatestack.c	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -26,6 +26,7 @@
 #include <sys/mman.h>
 #include <sys/param.h>
 #include <dl-sysdep.h>
+#include <dl-tls.h>
 #include <tls.h>
 #include <lowlevellock.h>
 #include <kernel-features.h>
@@ -238,6 +239,10 @@
 
   /* Clear the DTV.  */
   dtv_t *dtv = GET_DTV (TLS_TPADJ (result));
+  for (size_t cnt = 0; cnt < dtv[-1].counter; ++cnt)
+    if (! dtv[1 + cnt].pointer.is_static
+	&& dtv[1 + cnt].pointer.val != TLS_DTV_UNALLOCATED)
+      free (dtv[1 + cnt].pointer.val);
   memset (dtv, '\0', (dtv[-1].counter + 1) * sizeof (dtv_t));
 
   /* Re-initialize the TLS.  */
@@ -623,7 +628,7 @@
 	    {
 	      int err;
 	    mprot_error:
-	      err = errno;
+	      err = errno == ENOMEM ? EAGAIN : errno;
 
 	      lll_lock (stack_cache_lock, LLL_PRIVATE);
 
--- a/nptl/Versions	(révision 10714)
+++ b/nptl/Versions	(révision 14168)
@@ -27,6 +27,7 @@
     pthread_cond_broadcast; pthread_cond_timedwait;
   }
   GLIBC_PRIVATE {
+    __libc_alloca_cutoff;
     # Internal libc interface to libpthread
     __libc_dl_error_tsd;
   }
--- a/login/programs/pt_chown.c	(révision 10714)
+++ b/login/programs/pt_chown.c	(révision 14168)
@@ -64,7 +64,7 @@
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "1999");
+"), "2011");
 }
 
 static char *
@@ -123,7 +123,7 @@
 
   /* Set the owner to the real user ID, and the group to that special
      group ID.  */
-  if (st.st_gid != gid && chown (pty, getuid (), gid) < 0)
+  if (chown (pty, getuid (), gid) < 0)
     return FAIL_EACCES;
 
   /* Set the permission mode to readable and writable by the owner,
--- a/.gitattributes	(révision 10714)
+++ b/.gitattributes	(révision 14168)
@@ -1 +1,2 @@
 timezone/* -whitespace
+INSTALL -whitespace
--- a/shadow/sgetspent.c	(révision 10714)
+++ b/shadow/sgetspent.c	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 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
@@ -49,8 +49,8 @@
     }
 
   while (buffer != NULL
-	 && __sgetspent_r (string, &resbuf, buffer, buffer_size, &result) != 0
-	 && errno == ERANGE)
+	 && (__sgetspent_r (string, &resbuf, buffer, buffer_size, &result)
+	     == ERANGE))
     {
       char *new_buf;
       buffer_size += BUFLEN_SPWD;
--- a/posix/regcomp.c	(révision 10714)
+++ b/posix/regcomp.c	(révision 14168)
@@ -2164,16 +2164,21 @@
       exp = parse_expression (regexp, preg, token, syntax, nest, err);
       if (BE (*err != REG_NOERROR && exp == NULL, 0))
 	{
+	  if (tree != NULL)
+	    postorder (tree, free_tree, NULL);
 	  return NULL;
 	}
       if (tree != NULL && exp != NULL)
 	{
-	  tree = create_tree (dfa, tree, exp, CONCAT);
-	  if (tree == NULL)
+	  bin_tree_t *newtree = create_tree (dfa, tree, exp, CONCAT);
+	  if (newtree == NULL)
 	    {
+	      postorder (exp, free_tree, NULL);
+	      postorder (tree, free_tree, NULL);
 	      *err = REG_ESPACE;
 	      return NULL;
 	    }
+	  tree = newtree;
 	}
       else if (tree == NULL)
 	tree = exp;
@@ -2422,7 +2427,11 @@
     {
       tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);
       if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0))
-	*err = REG_EPAREN;
+	{
+	  if (tree != NULL)
+	    postorder (tree, free_tree, NULL);
+	  *err = REG_EPAREN;
+	}
       if (BE (*err != REG_NOERROR, 0))
 	return NULL;
     }
@@ -3049,6 +3058,10 @@
   if (BE (sbcset == NULL, 0))
 #endif /* RE_ENABLE_I18N */
     {
+      re_free (sbcset);
+#ifdef RE_ENABLE_I18N
+      re_free (mbcset);
+#endif
       *err = REG_ESPACE;
       return NULL;
     }
--- a/posix/tst-fnmatch.c	(révision 10714)
+++ b/posix/tst-fnmatch.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Tests for fnmatch function.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2010 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
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <mcheck.h>
 
 
 static char *next_input (char **line, int first, int last);
@@ -46,6 +47,8 @@
   size_t escpatternlen = 0;
   int nr = 0;
 
+  mtrace ();
+
   /* Read lines from stdin with the following format:
 
        locale  input-string  match-string  flags  result
--- a/posix/fnmatch_loop.c	(révision 10714)
+++ b/posix/fnmatch_loop.c	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993,1996-2001,2003-2005,2007
+/* Copyright (C) 1991-1993,1996-2001,2003-2005,2007,2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -30,22 +30,24 @@
    it matches, nonzero if not.  */
 static int FCT (const CHAR *pattern, const CHAR *string,
 		const CHAR *string_end, int no_leading_period, int flags,
-		struct STRUCT *ends)
+		struct STRUCT *ends, size_t alloca_used)
      internal_function;
 static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
-		const CHAR *string_end, int no_leading_period, int flags)
+		const CHAR *string_end, int no_leading_period, int flags,
+		size_t alloca_used)
      internal_function;
 static const CHAR *END (const CHAR *patternp) internal_function;
 
 static int
 internal_function
-FCT (pattern, string, string_end, no_leading_period, flags, ends)
+FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
      const CHAR *pattern;
      const CHAR *string;
      const CHAR *string_end;
      int no_leading_period;
      int flags;
      struct STRUCT *ends;
+     size_t alloca_used;
 {
   register const CHAR *p = pattern, *n = string;
   register UCHAR c;
@@ -74,10 +76,8 @@
 	case L('?'):
 	  if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
 	    {
-	      int res;
-
-	      res = EXT (c, p, n, string_end, no_leading_period,
-			 flags);
+	      int res = EXT (c, p, n, string_end, no_leading_period,
+			     flags, alloca_used);
 	      if (res != -1)
 		return res;
 	    }
@@ -106,10 +106,8 @@
 	case L('*'):
 	  if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
 	    {
-	      int res;
-
-	      res = EXT (c, p, n, string_end, no_leading_period,
-			 flags);
+	      int res = EXT (c, p, n, string_end, no_leading_period,
+			     flags, alloca_used);
 	      if (res != -1)
 		return res;
 	    }
@@ -198,7 +196,7 @@
 
 		  for (--p; n < endp; ++n, no_leading_period = 0)
 		    if (FCT (p, n, string_end, no_leading_period, flags2,
-			     &end) == 0)
+			     &end, alloca_used) == 0)
 		      goto found;
 		}
 	      else if (c == L('/') && (flags & FNM_FILE_NAME))
@@ -207,7 +205,7 @@
 		    ++n;
 		  if (n < string_end && *n == L('/')
 		      && (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags,
-			       NULL) == 0))
+			       NULL, alloca_used) == 0))
 		    return 0;
 		}
 	      else
@@ -221,7 +219,7 @@
 		  for (--p; n < endp; ++n, no_leading_period = 0)
 		    if (FOLD ((UCHAR) *n) == c
 			&& (FCT (p, n, string_end, no_leading_period, flags2,
-				 &end) == 0))
+				 &end, alloca_used) == 0))
 		      {
 		      found:
 			if (end.pattern == NULL)
@@ -758,7 +756,7 @@
 					       _NL_COLLATE_SYMB_EXTRAMB);
 
 				/* Locate the character in the hashing
-                                   table.  */
+				   table.  */
 				hash = elem_hash (str, c1);
 
 				idx = 0;
@@ -980,9 +978,8 @@
 	case L('!'):
 	  if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
 	    {
-	      int res;
-
-	      res = EXT (c, p, n, string_end, no_leading_period, flags);
+	      int res = EXT (c, p, n, string_end, no_leading_period, flags,
+			     alloca_used);
 	      if (res != -1)
 		return res;
 	    }
@@ -1061,26 +1058,32 @@
 static int
 internal_function
 EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
-     int no_leading_period, int flags)
+     int no_leading_period, int flags, size_t alloca_used)
 {
   const CHAR *startp;
   int level;
   struct patternlist
   {
     struct patternlist *next;
+    CHAR malloced;
     CHAR str[0];
   } *list = NULL;
   struct patternlist **lastp = &list;
   size_t pattern_len = STRLEN (pattern);
+  int any_malloced = 0;
   const CHAR *p;
   const CHAR *rs;
+  int retval = 0;
 
   /* Parse the pattern.  Store the individual parts in the list.  */
   level = 0;
   for (startp = p = pattern + 1; level >= 0; ++p)
     if (*p == L('\0'))
-      /* This is an invalid pattern.  */
-      return -1;
+      {
+	/* This is an invalid pattern.  */
+	retval = -1;
+	goto out;
+      }
     else if (*p == L('['))
       {
 	/* Handle brackets special.  */
@@ -1097,8 +1100,11 @@
 	/* Skip over all characters of the list.  */
 	while (*p != L(']'))
 	  if (*p++ == L('\0'))
-	    /* This is no valid pattern.  */
-	    return -1;
+	    {
+	      /* This is no valid pattern.  */
+	      retval = -1;
+	      goto out;
+	    }
       }
     else if ((*p == L('?') || *p == L('*') || *p == L('+') || *p == L('@')
 	      || *p == L('!')) && p[1] == L('('))
@@ -1111,15 +1117,25 @@
 	    /* This means we found the end of the pattern.  */
 #define NEW_PATTERN \
 	    struct patternlist *newp;					      \
-									      \
-	    if (opt == L('?') || opt == L('@'))				      \
-	      newp = alloca (sizeof (struct patternlist)		      \
-			     + (pattern_len * sizeof (CHAR)));		      \
+	    size_t slen = (opt == L('?') || opt == L('@')		      \
+			   ? pattern_len : (p - startp + 1));		      \
+	    slen = sizeof (struct patternlist) + (slen * sizeof (CHAR));      \
+	    int malloced = ! __libc_use_alloca (alloca_used + slen);	      \
+	    if (__builtin_expect (malloced, 0))				      \
+	      {								      \
+		newp = malloc (slen);					      \
+		if (newp == NULL)					      \
+		  {							      \
+		    retval = -2;					      \
+		    goto out;						      \
+		  }							      \
+		any_malloced = 1;					      \
+	      }								      \
 	    else							      \
-	      newp = alloca (sizeof (struct patternlist)		      \
-			     + ((p - startp + 1) * sizeof (CHAR)));	      \
+	      newp = alloca_account (slen, alloca_used);		      \
+	    newp->next = NULL;						      \
+	    newp->malloced = malloced;					      \
 	    *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L('\0');    \
-	    newp->next = NULL;						      \
 	    *lastp = newp;						      \
 	    lastp = &newp->next
 	    NEW_PATTERN;
@@ -1140,8 +1156,9 @@
   switch (opt)
     {
     case L('*'):
-      if (FCT (p, string, string_end, no_leading_period, flags, NULL) == 0)
-	return 0;
+      if (FCT (p, string, string_end, no_leading_period, flags, NULL,
+	       alloca_used) == 0)
+	goto success;
       /* FALLTHROUGH */
 
     case L('+'):
@@ -1152,7 +1169,7 @@
 	       current pattern.  */
 	    if (FCT (list->str, string, rs, no_leading_period,
 		     flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
-		     NULL) == 0
+		     NULL, alloca_used) == 0
 		/* This was successful.  Now match the rest with the rest
 		   of the pattern.  */
 		&& (FCT (p, rs, string_end,
@@ -1160,7 +1177,7 @@
 			 ? no_leading_period
 			 : rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0,
 			 flags & FNM_FILE_NAME
-			 ? flags : flags & ~FNM_PERIOD, NULL) == 0
+			 ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0
 		    /* This didn't work.  Try the whole pattern.  */
 		    || (rs != string
 			&& FCT (pattern - 1, rs, string_end,
@@ -1169,18 +1186,21 @@
 				: (rs[-1] == '/' && NO_LEADING_PERIOD (flags)
 				   ? 1 : 0),
 				flags & FNM_FILE_NAME
-				? flags : flags & ~FNM_PERIOD, NULL) == 0)))
+				? flags : flags & ~FNM_PERIOD, NULL,
+				alloca_used) == 0)))
 	      /* It worked.  Signal success.  */
-	      return 0;
+	      goto success;
 	}
       while ((list = list->next) != NULL);
 
       /* None of the patterns lead to a match.  */
-      return FNM_NOMATCH;
+      retval = FNM_NOMATCH;
+      break;
 
     case L('?'):
-      if (FCT (p, string, string_end, no_leading_period, flags, NULL) == 0)
-	return 0;
+      if (FCT (p, string, string_end, no_leading_period, flags, NULL,
+	       alloca_used) == 0)
+	goto success;
       /* FALLTHROUGH */
 
     case L('@'):
@@ -1192,13 +1212,14 @@
 	if (FCT (STRCAT (list->str, p), string, string_end,
 		 no_leading_period,
 		 flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
-		 NULL) == 0)
+		 NULL, alloca_used) == 0)
 	  /* It worked.  Signal success.  */
-	  return 0;
+	  goto success;
       while ((list = list->next) != NULL);
 
       /* None of the patterns lead to a match.  */
-      return FNM_NOMATCH;
+      retval = FNM_NOMATCH;
+      break;
 
     case L('!'):
       for (rs = string; rs <= string_end; ++rs)
@@ -1208,7 +1229,7 @@
 	  for (runp = list; runp != NULL; runp = runp->next)
 	    if (FCT (runp->str, string, rs,  no_leading_period,
 		     flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
-		     NULL) == 0)
+		     NULL, alloca_used) == 0)
 	      break;
 
 	  /* If none of the patterns matched see whether the rest does.  */
@@ -1218,21 +1239,34 @@
 		       ? no_leading_period
 		       : rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0,
 		       flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
-		       NULL) == 0))
+		       NULL, alloca_used) == 0))
 	    /* This is successful.  */
-	    return 0;
+	    goto success;
 	}
 
       /* None of the patterns together with the rest of the pattern
 	 lead to a match.  */
-      return FNM_NOMATCH;
+      retval = FNM_NOMATCH;
+      break;
 
     default:
       assert (! "Invalid extended matching operator");
+      retval = -1;
       break;
     }
 
-  return -1;
+ success:
+ out:
+  if (any_malloced)
+    while (list != NULL)
+      {
+	struct patternlist *old = list;
+	list = list->next;
+	if (old->malloced)
+	  free (old);
+      }
+
+  return retval;
 }
 
 
--- a/posix/regexec.c	(révision 10714)
+++ b/posix/regexec.c	(révision 14168)
@@ -3333,6 +3333,8 @@
 	{
 	  state->trtable = (re_dfastate_t **)
 	    calloc (sizeof (re_dfastate_t *), SBC_MAX);
+	  if (BE (state->trtable == NULL, 0))
+	    return 0;
 	  return 1;
 	}
       return 0;
--- a/posix/bug-regex31.c	(révision 0)
+++ b/posix/bug-regex31.c	(révision 14168)
@@ -0,0 +1,36 @@
+#include <mcheck.h>
+#include <regex.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+int
+main (void)
+{
+  mtrace ();
+
+  int res = 0;
+  char *buf = NULL;
+  size_t len = 0;
+  while (! feof (stdin))
+    {
+      ssize_t n = getline (&buf, &len, stdin);
+      if (n <= 0)
+	break;
+      if (buf[n - 1] == '\n')
+	buf[n - 1] = '\0';
+
+      regex_t regex;
+      int rc = regcomp (&regex, buf, REG_EXTENDED);
+      if (rc != 0)
+	printf ("%s: Error %d (expected)\n", buf, rc);
+      else
+	{
+	  printf ("%s: succeeded !\n", buf);
+	  res = 1;
+	}
+    }
+
+  free (buf);
+
+  return 0;
+}
--- a/posix/Makefile	(révision 10714)
+++ b/posix/Makefile	(révision 14168)
@@ -94,6 +94,7 @@
 		   bug-regex14 bug-regex15 \
 		   bug-regex21 bug-regex24 \
 		   bug-regex27 bug-regex28 bug-regex29 bug-regex30 \
+		   bug-regex31 \
 		   tst-nice tst-nanosleep \
 		   transbug \
 		   tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
@@ -134,10 +135,12 @@
 	     annexc annexc.out wordexp-tst.out bug-regex2-mem \
 	     bug-regex2.mtrace bug-regex14-mem bug-regex14.mtrace \
 	     bug-regex21-mem bug-regex21.mtrace \
+	     bug-regex31-mem bug-regex31.mtrace \
 	     tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \
 	     tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
 	     bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \
-	     tst-vfork3-mem tst-vfork3.mtrace getconf.speclist
+	     tst-vfork3-mem tst-vfork3.mtrace getconf.speclist \
+	     tst-fnmatch-mem tst-fnmatch.mtrace
 
 include ../Rules
 
@@ -254,11 +257,11 @@
 # Run a test on the header files we use.
 # XXX Please note that for now we ignore the result of this test.
 tests: $(objpfx)annexc.out
-# eglibc: ifeq (no,$(cross-compiling))
 tests: $(objpfx)bug-regex2-mem \
   $(objpfx)bug-regex21-mem \
+  $(objpfx)bug-regex31-mem \
   $(objpfx)tst-getconf.out \
-  $(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem
+  $(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem $(objpfx)tst-fnmatch-mem
 ifeq (y,($OPTION_POSIX_REGEXP_GLIBC))
 tests: $(objpfx)bug-regex14-mem $(objpfx)tst-rxspencer-mem \
   $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem 
@@ -274,6 +277,11 @@
 $(objpfx)annexc: annexc.c
 	$(native-compile)
 
+tst-fnmatch-ENV += MALLOC_TRACE=$(objpfx)tst-fnmatch.mtrace
+
+$(objpfx)tst-fnmatch-mem: $(objpfx)tst-fnmatch.out
+	$(common-objpfx)malloc/mtrace $(objpfx)tst-fnmatch.mtrace > $@
+
 bug-regex2-ENV = MALLOC_TRACE=$(objpfx)bug-regex2.mtrace
 
 $(objpfx)bug-regex2-mem: $(objpfx)bug-regex2.out
@@ -289,6 +297,11 @@
 $(objpfx)bug-regex21-mem: $(objpfx)bug-regex21.out
 	$(common-objpfx)malloc/mtrace $(objpfx)bug-regex21.mtrace > $@
 
+bug-regex31-ENV = MALLOC_TRACE=$(objpfx)bug-regex31.mtrace
+
+$(objpfx)bug-regex31-mem: $(objpfx)bug-regex31.out
+	$(common-objpfx)malloc/mtrace $(objpfx)bug-regex31.mtrace > $@
+
 tst-vfork3-ENV = MALLOC_TRACE=$(objpfx)tst-vfork3.mtrace
 
 $(objpfx)tst-vfork3-mem: $(objpfx)tst-vfork3.out
--- a/posix/bug-regex31.input	(révision 0)
+++ b/posix/bug-regex31.input	(révision 14168)
@@ -0,0 +1,4 @@
+[[][
+([0]
+([0]a
+([0]([0])
--- a/posix/getopt.h	(révision 10714)
+++ b/posix/getopt.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2009
+   Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2009,2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -158,9 +158,9 @@
    additional functionality can be disable at runtime.  This redirection
    helps to also do this at runtime.  */
 #  ifdef __REDIRECT
-  extern int __REDIRECT (getopt, (int ___argc, char *const *___argv,
-				  const char *__shortopts),
-			 __posix_getopt) __THROW;
+  extern int __REDIRECT_NTH (getopt, (int ___argc, char *const *___argv,
+				      const char *__shortopts),
+			     __posix_getopt);
 #  else
 extern int __posix_getopt (int ___argc, char *const *___argv,
 			   const char *__shortopts) __THROW;
--- a/posix/fnmatch.c	(révision 10714)
+++ b/posix/fnmatch.c	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2007
+/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2007,2010,2011
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -45,6 +45,12 @@
 # include <stdlib.h>
 #endif
 
+#ifdef _LIBC
+# include <alloca.h>
+#else
+# define alloca_account(size., var) alloca (size)
+#endif
+
 /* For platform which support the ISO C amendement 1 functionality we
    support user defined character classes.  */
 #if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
@@ -334,8 +340,11 @@
       mbstate_t ps;
       size_t n;
       const char *p;
+      wchar_t *wpattern_malloc = NULL;
       wchar_t *wpattern;
+      wchar_t *wstring_malloc = NULL;
       wchar_t *wstring;
+      size_t alloca_used = 0;
 
       /* Convert the strings into wide characters.  */
       memset (&ps, '\0', sizeof (ps));
@@ -347,7 +356,8 @@
 #endif
       if (__builtin_expect (n < 1024, 1))
 	{
-	  wpattern = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+	  wpattern = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
+						 alloca_used);
 	  n = mbsrtowcs (wpattern, &p, n + 1, &ps);
 	  if (__builtin_expect (n == (size_t) -1, 0))
 	    /* Something wrong.
@@ -369,8 +379,16 @@
 	       XXX Do we have to set `errno' to something which mbsrtows hasn't
 	       already done?  */
 	    return -1;
-	  wpattern = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+	  if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+	    {
+	      __set_errno (ENOMEM);
+	      return -2;
+	    }
+	  wpattern_malloc = wpattern
+	    = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
 	  assert (mbsinit (&ps));
+	  if (wpattern == NULL)
+	    return -2;
 	  (void) mbsrtowcs (wpattern, &pattern, n + 1, &ps);
 	}
 
@@ -383,13 +401,18 @@
       p = string;
       if (__builtin_expect (n < 1024, 1))
 	{
-	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+	  wstring = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
+						alloca_used);
 	  n = mbsrtowcs (wstring, &p, n + 1, &ps);
 	  if (__builtin_expect (n == (size_t) -1, 0))
-	    /* Something wrong.
-	       XXX Do we have to set `errno' to something which mbsrtows hasn't
-	       already done?  */
-	    return -1;
+	    {
+	      /* Something wrong.
+		 XXX Do we have to set `errno' to something which
+		 mbsrtows hasn't already done?  */
+	    free_return:
+	      free (wpattern_malloc);
+	      return -1;
+	    }
 	  if (p)
 	    {
 	      memset (&ps, '\0', sizeof (ps));
@@ -404,19 +427,38 @@
 	    /* Something wrong.
 	       XXX Do we have to set `errno' to something which mbsrtows hasn't
 	       already done?  */
-	    return -1;
-	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+	    goto free_return;
+	  if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+	    {
+	      free (wpattern_malloc);
+	      __set_errno (ENOMEM);
+	      return -2;
+	    }
+
+	  wstring_malloc = wstring
+	    = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
+	  if (wstring == NULL)
+	    {
+	      free (wpattern_malloc);
+	      return -2;
+	    }
 	  assert (mbsinit (&ps));
 	  (void) mbsrtowcs (wstring, &string, n + 1, &ps);
 	}
 
-      return internal_fnwmatch (wpattern, wstring, wstring + n,
-				flags & FNM_PERIOD, flags, NULL);
+      int res = internal_fnwmatch (wpattern, wstring, wstring + n,
+				   flags & FNM_PERIOD, flags, NULL,
+				   alloca_used);
+
+      free (wstring_malloc);
+      free (wpattern_malloc);
+
+      return res;
     }
 # endif  /* mbstate_t and mbsrtowcs or _LIBC.  */
 
   return internal_fnmatch (pattern, string, string + strlen (string),
-			   flags & FNM_PERIOD, flags, NULL);
+			   flags & FNM_PERIOD, flags, NULL, 0);
 }
 
 # ifdef _LIBC
--- a/stdio-common/printf_fp.c	(révision 10714)
+++ b/stdio-common/printf_fp.c	(révision 14168)
@@ -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@gnu.ai.mit.edu>, 1995.
@@ -906,7 +906,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
@@ -1110,10 +1112,17 @@
       --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')
       {
@@ -1232,7 +1241,7 @@
 
       tmpptr = buffer;
       if (__builtin_expect (info->i18n, 0))
-        {
+	{
 #ifdef COMPILE_WPRINTF
 	  wstartp = _i18n_number_rewrite (wstartp, wcp,
 					  wbuffer + wbuffer_to_alloc);
@@ -1246,7 +1255,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);
 
--- a/stdio-common/tst-grouping.c	(révision 0)
+++ b/stdio-common/tst-grouping.c	(révision 14168)
@@ -0,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"
--- a/stdio-common/_i18n_number.h	(révision 10714)
+++ b/stdio-common/_i18n_number.h	(révision 14168)
@@ -33,8 +33,8 @@
 # define decimal NULL
 # define thousands NULL
 #else
-  char decimal[MB_LEN_MAX];
-  char thousands[MB_LEN_MAX];
+  char decimal[MB_LEN_MAX + 1];
+  char thousands[MB_LEN_MAX + 1];
 #endif
 
   /* "to_outpunct" is a map from ASCII decimal point and thousands-sep
@@ -50,13 +50,19 @@
       mbstate_t state;
       memset (&state, '\0', sizeof (state));
 
-      if (__wcrtomb (decimal, wdecimal, &state) == (size_t) -1)
+      size_t n = __wcrtomb (decimal, wdecimal, &state);
+      if (n == (size_t) -1)
 	memcpy (decimal, ".", 2);
+      else
+	decimal[n] = '\0';
 
       memset (&state, '\0', sizeof (state));
 
-      if (__wcrtomb (thousands, wthousands, &state) == (size_t) -1)
+      n = __wcrtomb (thousands, wthousands, &state);
+      if (n == (size_t) -1)
 	memcpy (thousands, ",", 2);
+      else
+	thousands[n] = '\0';
     }
 #endif
 
--- a/stdio-common/bug23.c	(révision 0)
+++ b/stdio-common/bug23.c	(révision 14168)
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <string.h>
+
+static char buf[32768];
+static const char expected[] = "\
+\n\
+a\n\
+abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
+
+static int
+do_test (void)
+{
+  snprintf (buf, sizeof (buf),
+	    "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+	    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+	    "a", "b", "c", "d", 5);
+  return strcmp (buf, expected) != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
--- a/stdio-common/Makefile	(révision 10714)
+++ b/stdio-common/Makefile	(révision 14168)
@@ -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
@@ -68,9 +68,9 @@
 	 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
 	 tst-fwrite bug16 bug17 tst-sprintf2 bug18 \
 	 bug19 tst-popen2 scanf14 scanf15 bug21 bug22 scanf16 scanf17 \
-	 tst-setvbuf1
+	 tst-setvbuf1 bug23
 tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-      += tst-sscanf tst-swprintf bug15 test-vfprintf bug14 scanf13
+      += tst-sscanf tst-swprintf bug15 test-vfprintf bug14 scanf13 tst-grouping
 tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
       += tst-perror bug19a bug20
 tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
@@ -142,6 +142,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
--- a/stdio-common/vfprintf.c	(révision 10714)
+++ b/stdio-common/vfprintf.c	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2008, 2009   Free Software Foundation, Inc.
+/* Copyright (C) 1991-2008, 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
@@ -1699,7 +1699,8 @@
 	  {
 	    /* Extend the array of format specifiers.  */
 	    struct printf_spec *old = specs;
-	    specs = extend_alloca (specs, nspecs_max, 2 * nspecs_max);
+	    specs = extend_alloca (specs, nspecs_max,
+				   2 * nspecs_max * sizeof (*specs));
 
 	    /* Copy the old array's elements to the new space.  */
 	    memmove (specs, old, nspecs * sizeof (struct printf_spec));
--- a/stdio-common/printf-parsemb.c	(révision 10714)
+++ b/stdio-common/printf-parsemb.c	(révision 14168)
@@ -295,9 +295,9 @@
       /* We don't try to get the types for all arguments if the format
 	 uses more than one.  The normal case is covered though.  If
 	 the call returns -1 we continue with the normal specifiers.  */
-      || (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
-	  (&spec->info, 1, &spec->data_arg_type,
-	   &spec->size)) < 0)
+      || (int) (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
+				   (&spec->info, 1, &spec->data_arg_type,
+				    &spec->size)) < 0)
     {
       /* Find the data argument types of a built-in spec.  */
       spec->ndata_args = 1;
--- a/resolv/res_debug.c	(révision 10714)
+++ b/resolv/res_debug.c	(révision 14168)
@@ -189,7 +189,7 @@
 						buf = malloc(buflen += 1024);
 					if (buf == NULL) {
 						fprintf(file,
-				              ";; memory allocation failure\n");
+					      ";; memory allocation failure\n");
 					      return;
 					}
 					continue;
@@ -356,7 +356,7 @@
 	{C_HS,		"HESIOD"},
 	{C_ANY,		"ANY"},
 	{C_NONE,	"NONE"},
-	{C_IN, 		(char *)0}
+	{C_IN,		(char *)0}
 };
 libresolv_hidden_data_def (__p_class_syms)
 
@@ -588,6 +588,7 @@
 	case RES_USEBSTRING:	return "ip6-bytstring";
 	case RES_USE_EDNS0:	return "edns0";
 	case RES_USE_DNSSEC:	return "dnssec";
+	case RES_NOTLDQUERY:	return "no-tld-query";
 				/* XXX nonreentrant */
 	default:		sprintf(nbuf, "?0x%lx?", (u_long)option);
 				return (nbuf);
--- a/resolv/netdb.h	(révision 10714)
+++ b/resolv/netdb.h	(révision 14168)
@@ -1,4 +1,4 @@
-  /* Copyright (C) 1996-2002, 2003, 2004, 2009 Free Software Foundation, Inc.
+  /* Copyright (C) 1996-2004, 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
@@ -677,7 +677,7 @@
 extern int getnameinfo (__const struct sockaddr *__restrict __sa,
 			socklen_t __salen, char *__restrict __host,
 			socklen_t __hostlen, char *__restrict __serv,
-			socklen_t __servlen, unsigned int __flags);
+			socklen_t __servlen, int __flags);
 #endif	/* POSIX */
 
 #ifdef __USE_GNU
--- a/resolv/res_init.c	(révision 10714)
+++ b/resolv/res_init.c	(révision 14168)
@@ -176,13 +176,6 @@
 		statp->id = res_randomid();
 	}
 
-#ifdef USELOOPBACK
-	statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
-#else
-	statp->nsaddr.sin_addr.s_addr = INADDR_ANY;
-#endif
-	statp->nsaddr.sin_family = AF_INET;
-	statp->nsaddr.sin_port = htons(NAMESERVER_PORT);
 	statp->nscount = 0;
 	statp->ndots = 1;
 	statp->pfcode = 0;
@@ -321,24 +314,24 @@
 			nserv++;
 #ifdef _LIBC
 			nservall++;
-                    } else {
-                        struct in6_addr a6;
-                        char *el;
+		    } else {
+			struct in6_addr a6;
+			char *el;
 
-                        if ((el = strchr(cp, '\n')) != NULL)
-                            *el = '\0';
+			if ((el = strchr(cp, '\n')) != NULL)
+			    *el = '\0';
 			if ((el = strchr(cp, SCOPE_DELIMITER)) != NULL)
 			    *el = '\0';
-                        if ((*cp != '\0') &&
-                            (inet_pton(AF_INET6, cp, &a6) > 0)) {
-                            struct sockaddr_in6 *sa6;
+			if ((*cp != '\0') &&
+			    (inet_pton(AF_INET6, cp, &a6) > 0)) {
+			    struct sockaddr_in6 *sa6;
 
-                            sa6 = malloc(sizeof(*sa6));
-                            if (sa6 != NULL) {
-                                sa6->sin6_family = AF_INET6;
-                                sa6->sin6_port = htons(NAMESERVER_PORT);
+			    sa6 = malloc(sizeof(*sa6));
+			    if (sa6 != NULL) {
+				sa6->sin6_family = AF_INET6;
+				sa6->sin6_port = htons(NAMESERVER_PORT);
 				sa6->sin6_flowinfo = 0;
-                                sa6->sin6_addr = a6;
+				sa6->sin6_addr = a6;
 
 				if (__builtin_expect (el == NULL, 1))
 				    sa6->sin6_scope_id = 0;
@@ -365,9 +358,9 @@
 				statp->_u._ext.nsaddrs[nservall] = sa6;
 				statp->_u._ext.nssocks[nservall] = -1;
 				statp->_u._ext.nsmap[nservall] = MAXNS + 1;
-                                nservall++;
-                            }
-                        }
+				nservall++;
+			    }
+			}
 #endif
 		    }
 		    continue;
@@ -433,6 +426,12 @@
 #endif
 	    (void) fclose(fp);
 	}
+	if (__builtin_expect(statp->nscount == 0, 0)) {
+	    statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
+	    statp->nsaddr.sin_family = AF_INET;
+	    statp->nsaddr.sin_port = htons(NAMESERVER_PORT);
+	    statp->nscount = 1;
+	}
 	if (statp->defdname[0] == 0 &&
 	    __gethostname(buf, sizeof(statp->defdname) - 1) == 0 &&
 	    (cp = strchr(buf, '.')) != NULL)
@@ -538,14 +537,19 @@
 		} else if (!strncmp(cp, "no-check-names",
 				    sizeof("no-check-names") - 1)) {
 			statp->options |= RES_NOCHECKNAME;
-                } else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {
+		} else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {
 			statp->options |= RES_USE_EDNS0;
-                } else if (!strncmp(cp, "single-request-reopen",
+		} else if (!strncmp(cp, "single-request-reopen",
 				    sizeof("single-request-reopen") - 1)) {
 			statp->options |= RES_SNGLKUPREOP;
-                } else if (!strncmp(cp, "single-request",
+		} else if (!strncmp(cp, "single-request",
 				    sizeof("single-request") - 1)) {
 			statp->options |= RES_SNGLKUP;
+		} else if (!strncmp(cp, "no_tld_query",
+				    sizeof("no_tld_query") - 1) ||
+			   !strncmp(cp, "no-tld-query",
+				    sizeof("no-tld-query") - 1)) {
+			statp->options |= RES_NOTLDQUERY;
 		} else {
 			/* XXX - print a warning here? */
 		}
--- a/resolv/res_query.c	(révision 10714)
+++ b/resolv/res_query.c	(révision 14168)
@@ -123,7 +123,7 @@
 {
 	HEADER *hp = (HEADER *) answer;
 	int n, use_malloc = 0;
-        u_int oflags = statp->_flags;
+	u_int oflags = statp->_flags;
 
 	size_t bufsize = (type == T_UNSPEC ? 2 : 1) * QUERYSIZE;
 	u_char *buf = alloca (bufsize);
@@ -210,7 +210,7 @@
 			if (statp->options & RES_DEBUG)
 				printf(";; res_nquery: retry without EDNS0\n");
 #endif
-                        goto again;
+			goto again;
 		}
 #ifdef DEBUG
 		if (statp->options & RES_DEBUG)
@@ -344,6 +344,7 @@
 	int trailing_dot, ret, saved_herrno;
 	int got_nodata = 0, got_servfail = 0, root_on_list = 0;
 	int tried_as_is = 0;
+	int searched = 0;
 
 	__set_errno (0);
 	RES_SET_H_ERRNO(statp, HOST_NOT_FOUND);  /* True if we never query. */
@@ -406,6 +407,7 @@
 		for (domain = (const char * const *)statp->dnsrch;
 		     *domain && !done;
 		     domain++) {
+			searched = 1;
 
 			if (domain[0][0] == '\0' ||
 			    (domain[0][0] == '.' && domain[0][1] == '\0'))
@@ -477,11 +479,11 @@
 	}
 
 	/*
-	 * If the name has any dots at all, and no earlier 'as-is' query
-	 * for the name, and "." is not on the search list, then try an as-is
-	 * query now.
+	 * f the query has not already been tried as is then try it
+	 * unless RES_NOTLDQUERY is set and there were no dots.
 	 */
-	if (dots && !(tried_as_is || root_on_list)) {
+	if ((dots || !searched || (statp->options & RES_NOTLDQUERY) == 0)
+	    && !(tried_as_is || root_on_list)) {
 		ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
 					      answer, anslen, answerp,
 					      answerp2, nanswerp2, resplen2);
--- a/resolv/resolv.h	(révision 10714)
+++ b/resolv/resolv.h	(révision 14168)
@@ -102,7 +102,7 @@
 # define RES_MAXTIME		65535	/* Infinity, in milliseconds. */
 
 struct __res_state {
-	int	retrans;	 	/* retransmition time interval */
+	int	retrans;		/* retransmition time interval */
 	int	retry;			/* number of times to retransmit */
 	u_long	options;		/* option flags - see below. */
 	int	nscount;		/* number of name servers */
@@ -219,6 +219,8 @@
 #define RES_SNGLKUPREOP	0x00400000	/* -"-, but open new socket for each
 					   request */
 #define RES_USE_DNSSEC	0x00800000	/* use DNSSEC using OK bit in OPT */
+#define RES_NOTLDQUERY	0x01000000	/* Do not look up unqualified name
+					   as a TLD.  */
 
 #define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
 
--- a/resolv/nss_dns/dns-host.c	(révision 10714)
+++ b/resolv/nss_dns/dns-host.c	(révision 14168)
@@ -599,7 +599,6 @@
   int (*name_ok) (const char *);
   u_char packtmp[NS_MAXCDNAME];
   int have_to_map = 0;
-  int32_t ttl = 0;
   uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
   buffer += pad;
   if (__builtin_expect (buflen < sizeof (struct host_data) + pad, 0))
@@ -733,7 +732,7 @@
       cp += INT16SZ;			/* type */
       class = __ns_get16 (cp);
       cp += INT16SZ;			/* class */
-      ttl = __ns_get32 (cp);
+      int32_t ttl = __ns_get32 (cp);
       cp += INT32SZ;			/* TTL */
       n = __ns_get16 (cp);
       cp += INT16SZ;			/* len */
@@ -907,7 +906,7 @@
 	    {
 	      register int nn;
 
-	      if (ttlp != NULL && ttl != 0)
+	      if (ttlp != NULL)
 		*ttlp = ttl;
 	      if (canonp != NULL)
 		*canonp = bp;
@@ -1163,7 +1162,7 @@
 
       if (*firstp)
 	{
-	  if (ttl != 0 && ttlp != NULL)
+	  if (ttlp != NULL)
 	    *ttlp = ttl;
 
 	  (*pat)->name = canon ?: h_name;
--- a/version.h	(révision 10714)
+++ b/version.h	(révision 14168)
@@ -1,4 +1,4 @@
 /* This file just defines the current version number of libc.  */
 
 #define RELEASE "stable"
-#define VERSION "2.11.2"
+#define VERSION "2.11.3"
--- a/manual/arith.texi	(révision 10714)
+++ b/manual/arith.texi	(révision 14168)
@@ -1407,7 +1407,8 @@
 @comment ISO
 @deftypefunx {long double} roundl (long double @var{x})
 These functions are similar to @code{rint}, but they round halfway
-cases away from zero instead of to the nearest even integer.
+cases away from zero instead of to the nearest integer (or other
+current rounding mode).
 @end deftypefun
 
 @comment math.h
--- a/manual/Makefile	(révision 10714)
+++ b/manual/Makefile	(révision 14168)
@@ -243,9 +243,12 @@
 .PHONY: stubs
 stubs: $(objpfx)stubs
 endif
-$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
+$(objpfx)stubs ../po/manual.pot:
 	$(make-target-directory)
 	touch $@
+$(objpfx)stamp%:
+	$(make-target-directory)
+	touch $@
 
 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
--- a/manual/memory.texi	(révision 10714)
+++ b/manual/memory.texi	(révision 14168)
@@ -702,6 +702,11 @@
 @item M_MMAP_MAX
 The maximum number of chunks to allocate with @code{mmap}.  Setting this
 to zero disables all use of @code{mmap}.
+@item M_PERTURB
+If non-zero, memory blocks are filled with values depending on some
+low order bits of this parameter when they are allocated (except when
+allocated by @code{calloc}) and freed.  This can be used to debug the
+use of uninitialized or freed heap memory.
 @end table
 
 @end deftypefun
--- a/manual/locale.texi	(révision 10714)
+++ b/manual/locale.texi	(révision 14168)
@@ -1210,7 +1210,7 @@
   /* @r{Prepare the @code{getline} call.}  */
   line = NULL;
   len = 0;
-  while (getline (&line, &len, stdout) >= 0)
+  while (getline (&line, &len, stdin) >= 0)
     @{
       /* @r{Check the response.}  */
       int res = rpmatch (line);
--- a/manual/install.texi	(révision 10714)
+++ b/manual/install.texi	(révision 14168)
@@ -348,11 +348,12 @@
 Check the FAQ for any special compiler issues on particular platforms.
 
 @item
-GNU @code{binutils} 2.15 or later
+GNU @code{binutils}
 
 You must use GNU @code{binutils} (as and ld) to build the GNU C library.
 No other assembler or linker has the necessary functionality at the
-moment.
+moment.  The configure scripts checks for the appropriate version
+for the platform.  Too-old versions will prevent building glibc.
 
 @item
 GNU @code{texinfo} 3.12f
--- a/configure	(révision 10714)
+++ b/configure	(révision 14168)
@@ -681,7 +681,7 @@
 exceptions
 no_whole_archive
 libc_cv_have_initfini
-libc_cv_gnu89_inline
+gnu89_inline
 libc_cv_ssp
 fno_unit_at_a_time
 libc_cv_hashstyle
@@ -6937,9 +6937,9 @@
 { $as_echo "$as_me:$LINENO: result: $libc_cv_gnu89_inline" >&5
 $as_echo "$libc_cv_gnu89_inline" >&6; }
 if test $libc_cv_gnu89_inline = yes; then
-  libc_cv_gnu89_inline=-fgnu89-inline
+  gnu89_inline=-fgnu89-inline
 else
-  libc_cv_gnu89_inline=
+  gnu89_inline=
 fi
 
 
--- a/conform/data/netdb.h-data	(révision 10714)
+++ b/conform/data/netdb.h-data	(révision 14168)
@@ -87,7 +87,7 @@
 function {struct hostent*} gethostbyaddr (const void*, socklen_t, int)
 function {struct hostent*} gethostbyname (const char*)
 function {struct hostent*} gethostent (void)
-function int getnameinfo (const struct sockaddr*, socklen_t, char*, socklen_t, char*, socklen_t, unsigned)
+function int getnameinfo (const struct sockaddr*, socklen_t, char*, socklen_t, char*, socklen_t, int)
 function {struct netent*} getnetbyaddr (uint32_t, int)
 function {struct netent*} getnetbyname (const char*)
 function {struct netent*} getnetent (void)
--- a/nis/nss_nis/nis-initgroups.c	(révision 10714)
+++ b/nis/nss_nis/nis-initgroups.c	(révision 14168)
@@ -139,7 +139,7 @@
       if (r != ERANGE)
 	break;
 
-      extend_alloca (buf, buflen, 2 * buflen);
+      buf = extend_alloca (buf, buflen, 2 * buflen);
     }
 
   return 1;
--- a/nis/nss_compat/compat-initgroups.c	(révision 10714)
+++ b/nis/nss_compat/compat-initgroups.c	(révision 14168)
@@ -474,18 +474,21 @@
 	  /* If the selected module does not support getgrent_r or
 	     initgroups_dyn, abort. We cannot find the needed group
 	     entries.  */
-	  if (nss_getgrent_r == NULL && nss_initgroups_dyn == NULL)
+	  if (nss_initgroups_dyn == NULL || nss_getgrgid_r == NULL)
+	    {
+	      if (nss_setgrent != NULL)
+	        {
+		  nss_setgrent (1);
+		  ent->need_endgrent = true;
+		}
+	      ent->skip_initgroups_dyn = true;
+	    }
+
+	  if (ent->skip_initgroups_dyn && nss_getgrent_r == NULL)
 	    return NSS_STATUS_UNAVAIL;
 
 	  ent->files = false;
 
-	  if (nss_initgroups_dyn == NULL && nss_setgrent != NULL)
-	    {
-	      nss_setgrent (1);
-	      ent->need_endgrent = true;
-	    }
-	  ent->skip_initgroups_dyn = true;
-
 	  return getgrent_next_nss (ent, buffer, buflen, user, group,
 				    start, size, groupsp, limit, errnop);
 	}
--- a/elf/dl-open.c	(révision 10714)
+++ b/elf/dl-open.c	(révision 14168)
@@ -220,38 +220,9 @@
 
   assert (_dl_debug_initialize (0, args->nsid)->r_state == RT_CONSISTENT);
 
-  /* Maybe we have to expand a DST.  */
-  if (__builtin_expect (dst != NULL, 0))
-    {
-      size_t len = strlen (file);
-
-      /* Determine how much space we need.  We have to allocate the
-	 memory locally.  */
-      size_t required = DL_DST_REQUIRED (call_map, file, len,
-					 _dl_dst_count (dst, 0));
-
-      /* Get space for the new file name.  */
-      char *new_file = (char *) alloca (required + 1);
-
-      /* Generate the new file name.  */
-      _dl_dst_substitute (call_map, file, new_file, 0);
-
-      /* If the substitution failed don't try to load.  */
-      if (*new_file == '\0')
-	_dl_signal_error (0, "dlopen", NULL,
-			  N_("empty dynamic string token substitution"));
-
-      /* Now we have a new file name.  */
-      file = new_file;
-
-      /* It does not matter whether call_map is set even if we
-	 computed it only because of the DST.  Since the path contains
-	 a slash the value is not used.  See dl-load.c.  */
-    }
-
   /* Load the named object.  */
   struct link_map *new;
-  args->map = new = _dl_map_object (call_map, file, 0, lt_loaded, 0,
+  args->map = new = _dl_map_object (call_map, file, lt_loaded, 0,
 				    mode | __RTLD_CALLMAP, args->nsid);
 
   /* If the pointer returned is NULL this means the RTLD_NOLOAD flag is
--- a/elf/dl-reloc.c	(révision 10714)
+++ b/elf/dl-reloc.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Relocate a shared object and resolve its references to other loaded objects.
-   Copyright (C) 1995-2006, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2006, 2008, 2009, 2010 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
@@ -319,6 +319,10 @@
 	  goto call_error;
 	}
 
+#ifdef CLEAR_CACHE
+      CLEAR_CACHE (textrels->start, textrels->start + textrels->len);
+#endif
+
       textrels = textrels->next;
     }
 
--- a/elf/rtld-Rules	(révision 10714)
+++ b/elf/rtld-Rules	(révision 14168)
@@ -1,6 +1,6 @@
 # Subroutine makefile for compiling libc modules linked into dynamic linker.
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2002,2003,2005,2006,2008,2010 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
@@ -56,7 +56,7 @@
 # Use the verbose option of ar and tar when not running silently.
 ifeq	"$(findstring s,$(MAKEFLAGS))" ""	# if not -s
 verbose := v
-else	   					# -s
+else						# -s
 verbose	:=
 endif						# not -s
 
@@ -93,6 +93,12 @@
 # These are the basic compilation rules corresponding to the Makerules ones.
 # The sysd-rules generated makefile already defines pattern rules for rtld-%
 # targets built from sysdeps source files.
+$(objpfx)rtld-%.os: rtld-%.S $(before-compile)
+	$(compile-command.S) $(rtld-CPPFLAGS)
+$(objpfx)rtld-%.os: rtld-%.s $(before-compile)
+	$(compile-command.s) $(rtld-CPPFLAGS)
+$(objpfx)rtld-%.os: rtld-%.c $(before-compile)
+	$(compile-command.c) $(rtld-CPPFLAGS)
 $(objpfx)rtld-%.os: %.S $(before-compile)
 	$(compile-command.S) $(rtld-CPPFLAGS)
 $(objpfx)rtld-%.os: %.s $(before-compile)
@@ -101,6 +107,9 @@
 	$(compile-command.c) $(rtld-CPPFLAGS)
 
 # The rules for generated source files.
+$(objpfx)rtld-%.os: $(objpfx)rtld-%.S $(before-compile); $(compile-command.S)
+$(objpfx)rtld-%.os: $(objpfx)rtld-%.s $(before-compile); $(compile-command.s)
+$(objpfx)rtld-%.os: $(objpfx)rtld-%.c $(before-compile); $(compile-command.c)
 $(objpfx)rtld-%.os: $(objpfx)%.S $(before-compile); $(compile-command.S)
 $(objpfx)rtld-%.os: $(objpfx)%.s $(before-compile); $(compile-command.s)
 $(objpfx)rtld-%.os: $(objpfx)%.c $(before-compile); $(compile-command.c)
--- a/elf/dl-tls.c	(révision 10714)
+++ b/elf/dl-tls.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  Generic version.
-   Copyright (C) 2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc.
+   Copyright (C) 2002-2006,2008,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,10 +33,7 @@
    to allow dynamic loading of modules defining IE-model TLS data.  */
 #define TLS_STATIC_SURPLUS	64 + DL_NNS * 100
 
-/* Value used for dtv entries for which the allocation is delayed.  */
-#define TLS_DTV_UNALLOCATED	((void *) -1l)
 
-
 /* Out-of-memory handler.  */
 #ifdef SHARED
 static void
--- a/elf/dl-sysdep.c	(révision 10714)
+++ b/elf/dl-sysdep.c	(révision 14168)
@@ -424,6 +424,11 @@
     {
       const ElfW(Word) mask = ((const ElfW(Word) *) dsocaps)[-1];
       GLRO(dl_hwcap) |= (uint64_t) mask << _DL_FIRST_EXTRA;
+      /* Note that we add the dsocaps to the set already chosen by the
+	 LD_HWCAP_MASK environment variable (or default HWCAP_IMPORTANT).
+	 So there is no way to request ignoring an OS-supplied dsocap
+	 string and bit like you can ignore an OS-supplied HWCAP bit.  */
+      GLRO(dl_hwcap_mask) |= (uint64_t) mask << _DL_FIRST_EXTRA;
       size_t len;
       for (const char *p = dsocaps; p < dsocaps + dsocapslen; p += len + 1)
 	{
--- a/elf/Makefile	(révision 10714)
+++ b/elf/Makefile	(révision 14168)
@@ -210,7 +210,7 @@
 ifeq (yesyes,$(have-fpie)$(build-shared))
 tests: $(objpfx)tst-pie1.out
 endif
-tests: $(objpfx)tst-leaks1-mem
+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
 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
@@ -664,6 +664,10 @@
 LDFLAGS-noload = -rdynamic
 $(objpfx)noload.out: $(objpfx)testobj5.so
 
+$(objpfx)noload-mem: $(objpfx)noload.out
+	$(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@
+noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
+
 LDFLAGS-nodelete = -rdynamic
 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
@@ -766,11 +770,11 @@
 $(objpfx)tst-tls9: $(libdl)
 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
 
-$(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so
+$(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
 
-$(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so
+$(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
 
-$(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so
+$(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
 
 $(objpfx)tst-tls13: $(libdl)
 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
--- a/elf/noload.c	(révision 10714)
+++ b/elf/noload.c	(révision 14168)
@@ -1,20 +1,28 @@
 #include <dlfcn.h>
 #include <stdio.h>
+#include <mcheck.h>
 
 int
 main (void)
 {
   int result = 0;
+  void *p;
 
+  mtrace ();
+
   /* First try to load an object which is a dependency.  This should
      succeed.  */
-  if (dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD) == NULL)
+  p = dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD);
+  if (p == NULL)
     {
       printf ("cannot open \"testobj1.so\": %s\n", dlerror ());
       result = 1;
     }
   else
-    puts ("loading \"testobj1.so\" succeeded, OK");
+    {
+      puts ("loading \"testobj1.so\" succeeded, OK");
+      dlclose (p);
+    }
 
   /* Now try loading an object which is not already loaded.  */
   if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) != NULL)
@@ -25,8 +33,6 @@
   else
     {
       /* Load the object and run the same test again.  */
-      void *p;
-
       puts ("\"testobj5.so\" wasn't loaded and RTLD_NOLOAD prevented it, OK");
 
       p = dlopen ("testobj5.so", RTLD_LAZY);
@@ -41,13 +47,17 @@
 	{
 	  puts ("loading \"testobj5.so\" succeeded, OK");
 
-	  if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) == NULL)
+	  void *q = dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD);
+	  if (q == NULL)
 	    {
 	      printf ("cannot open \"testobj5.so\": %s\n", dlerror ());
 	      result = 1;
 	    }
 	  else
-	    puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK");
+	    {
+	      puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK");
+	      dlclose (q);
+	    }
 
 	  if (dlclose (p) != 0)
 	    {
--- a/elf/dl-object.c	(révision 10714)
+++ b/elf/dl-object.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Storage management for the chain of loaded shared objects.
-   Copyright (C) 1995-2002,2004,2006-2008,2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002,2004,2006-2009,2010 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
@@ -26,16 +26,36 @@
 #include <assert.h>
 
 
+/* Add the new link_map NEW to the end of the namespace list.  */
+void
+internal_function
+_dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
+{
+  if (GL(dl_ns)[nsid]._ns_loaded != NULL)
+    {
+      struct link_map *l = GL(dl_ns)[nsid]._ns_loaded;
+      while (l->l_next != NULL)
+	l = l->l_next;
+      new->l_prev = l;
+      /* new->l_next = NULL;   Would be necessary but we use calloc.  */
+      l->l_next = new;
+    }
+  else
+    GL(dl_ns)[nsid]._ns_loaded = new;
+  ++GL(dl_ns)[nsid]._ns_nloaded;
+  new->l_serial = GL(dl_load_adds);
+  ++GL(dl_load_adds);
+}
+
+
 /* Allocate a `struct link_map' for a new object being loaded,
    and enter it into the _dl_loaded list.  */
-
 struct link_map *
 internal_function
 _dl_new_object (char *realname, const char *libname, int type,
 		struct link_map *loader, int mode, Lmid_t nsid)
 {
   struct link_map *l;
-  int idx;
   size_t libname_len = strlen (libname) + 1;
   struct link_map *new;
   struct libname_list *newname;
@@ -94,26 +114,12 @@
   new->l_scope_max = sizeof (new->l_scope_mem) / sizeof (new->l_scope_mem[0]);
 
   /* Counter for the scopes we have to handle.  */
-  idx = 0;
+  int idx = 0;
 
   if (GL(dl_ns)[nsid]._ns_loaded != NULL)
-    {
-      l = GL(dl_ns)[nsid]._ns_loaded;
-      while (l->l_next != NULL)
-	l = l->l_next;
-      new->l_prev = l;
-      /* new->l_next = NULL;	Would be necessary but we use calloc.  */
-      l->l_next = new;
+    /* Add the global scope.  */
+    new->l_scope[idx++] = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
 
-      /* Add the global scope.  */
-      new->l_scope[idx++] = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
-    }
-  else
-    GL(dl_ns)[nsid]._ns_loaded = new;
-  ++GL(dl_ns)[nsid]._ns_nloaded;
-  new->l_serial = GL(dl_load_adds);
-  ++GL(dl_load_adds);
-
   /* If we have no loader the new object acts as it.  */
   if (loader == NULL)
     loader = new;
--- a/elf/rtld.c	(révision 10714)
+++ b/elf/rtld.c	(révision 14168)
@@ -588,7 +588,6 @@
   /* Argument to map_doit.  */
   char *str;
   struct link_map *loader;
-  int is_preloaded;
   int mode;
   /* Return value of map_doit.  */
   struct link_map *map;
@@ -626,16 +625,17 @@
 map_doit (void *a)
 {
   struct map_args *args = (struct map_args *) a;
-  args->map = _dl_map_object (args->loader, args->str,
-			      args->is_preloaded, lt_library, 0, args->mode,
-			      LM_ID_BASE);
+  args->map = _dl_map_object (args->loader, args->str, lt_library, 0,
+			      args->mode, LM_ID_BASE);
 }
 
 static void
 dlmopen_doit (void *a)
 {
   struct dlmopen_args *args = (struct dlmopen_args *) a;
-  args->map = _dl_open (args->fname, RTLD_LAZY | __RTLD_DLOPEN | __RTLD_AUDIT,
+  args->map = _dl_open (args->fname,
+			(RTLD_LAZY | __RTLD_DLOPEN | __RTLD_AUDIT
+			 | __RTLD_SECURE),
 			dl_main, LM_ID_NEWLM, _dl_argc, INTUSE(_dl_argv),
 			__environ);
 }
@@ -805,8 +805,7 @@
 
   args.str = fname;
   args.loader = main_map;
-  args.is_preloaded = 1;
-  args.mode = 0;
+  args.mode = __RTLD_SECURE;
 
   unsigned int old_nloaded = GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
 
@@ -1052,7 +1051,6 @@
 
 	  args.str = rtld_progname;
 	  args.loader = NULL;
-	  args.is_preloaded = 0;
 	  args.mode = __RTLD_OPENEXEC;
 	  (void) _dl_catch_error (&objname, &err_str, &malloced, map_doit,
 				  &args);
@@ -1064,7 +1062,7 @@
       else
 	{
 	  HP_TIMING_NOW (start);
-	  _dl_map_object (NULL, rtld_progname, 0, lt_library, 0,
+	  _dl_map_object (NULL, rtld_progname, lt_library, 0,
 			  __RTLD_OPENEXEC, LM_ID_BASE);
 	  HP_TIMING_NOW (stop);
 
@@ -1090,11 +1088,15 @@
       main_map = _dl_new_object ((char *) "", "", lt_executable, NULL,
 				 __RTLD_OPENEXEC, LM_ID_BASE);
       assert (main_map != NULL);
-      assert (main_map == GL(dl_ns)[LM_ID_BASE]._ns_loaded);
       main_map->l_phdr = phdr;
       main_map->l_phnum = phnum;
       main_map->l_entry = *user_entry;
 
+      /* Even though the link map is not yet fully initialized we can add
+	 it to the map list since there are no possible users running yet.  */
+      _dl_add_to_namespace_list (main_map, LM_ID_BASE);
+      assert (main_map == GL(dl_ns)[LM_ID_BASE]._ns_loaded);
+
       /* At this point we are in a bit of trouble.  We would have to
 	 fill in the values for l_dev and l_ino.  But in general we
 	 do not know where the file is.  We also do not handle AT_EXECFD
@@ -1237,7 +1239,7 @@
       /* We were invoked directly, so the program might not have a
 	 PT_INTERP.  */
       _dl_rtld_libname.name = GL(dl_rtld_map).l_name;
-      /* _dl_rtld_libname.next = NULL; 	Already zero.  */
+      /* _dl_rtld_libname.next = NULL;	Already zero.  */
       GL(dl_rtld_map).l_libname =  &_dl_rtld_libname;
     }
   else
@@ -1362,6 +1364,9 @@
 	      l->l_libname->name = memcpy (copy, dsoname, len);
 	    }
 
+	  /* Add the vDSO to the object list.  */
+	  _dl_add_to_namespace_list (l, LM_ID_BASE);
+
 	  /* Rearrange the list so this DSO appears after rtld_map.  */
 	  assert (l->l_next == NULL);
 	  assert (l->l_prev == main_map);
--- a/elf/dl-close.c	(révision 10714)
+++ b/elf/dl-close.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Close a shared object opened by `_dl_open'.
-   Copyright (C) 1996-2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1996-2007, 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
@@ -119,8 +119,17 @@
   if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
       || dl_close_state != not_pending)
     {
-      if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
-	dl_close_state = rerun;
+      if (map->l_direct_opencount == 0)
+	{
+	  if (map->l_type == lt_loaded)
+	    dl_close_state = rerun;
+	  else if (map->l_type == lt_library)
+	    {
+	      struct link_map **oldp = map->l_initfini;
+	      map->l_initfini = map->l_orig_initfini;
+	      _dl_scope_free (oldp);
+	    }
+	}
 
       /* There are still references to this object.  Do nothing more.  */
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
--- a/elf/dl-deps.c	(révision 10714)
+++ b/elf/dl-deps.c	(révision 14168)
@@ -62,7 +62,7 @@
 {
   struct openaux_args *args = (struct openaux_args *) a;
 
-  args->aux = _dl_map_object (args->map, args->name, 0,
+  args->aux = _dl_map_object (args->map, args->name,
 			      (args->map->l_type == lt_executable
 			       ? lt_library : args->map->l_type),
 			      args->trace_mode, args->open_mode,
@@ -491,6 +491,10 @@
   if (errno == 0 && errno_saved != 0)
     __set_errno (errno_saved);
 
+  if (errno_reason)
+    _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
+		      NULL, errstring);
+
   struct link_map **old_l_initfini = NULL;
   if (map->l_initfini != NULL && map->l_type == lt_loaded)
     {
@@ -665,9 +669,5 @@
       _dl_scope_free (old_l_reldeps);
     }
   if (old_l_initfini != NULL)
-    _dl_scope_free (old_l_initfini);
-
-  if (errno_reason)
-    _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
-		      NULL, errstring);
+      map->l_orig_initfini = old_l_initfini;
 }
--- a/elf/dl-dst.h	(révision 10714)
+++ b/elf/dl-dst.h	(révision 14168)
@@ -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
@@ -18,6 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include "trusted-dirs.h"
+
 /* Determine the number of DST elements in the name.  Only if IS_PATH is
    nonzero paths are recognized (i.e., multiple, ':' separated filenames).  */
 #define DL_DST_COUNT(name, is_path) \
@@ -31,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) \
   ({									      \
@@ -39,28 +45,32 @@
 									      \
     if (__cnt > 0)							      \
       {									      \
-	size_t origin_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		      \
-	     MAX (strlen (ORIGIN), strlen (_dl_platform))		      \
-	   minus 7 (which is the length of "$ORIGIN").			      \
+	     MAX (MAX (strlen (ORIGIN), strlen (_dl_platform)),		      \
+		  strlen (DL_DST_LIB))					      \
+	   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 ();				      \
-	    origin_len = ((l)->l_origin && (l)->l_origin != (char *) -1	      \
+	    dst_len = ((l)->l_origin && (l)->l_origin != (char *) -1	      \
 			  ? strlen ((l)->l_origin) : 0);		      \
 	  }								      \
 	else								      \
-	  origin_len = (l)->l_origin == (char *) -1			      \
+	  dst_len = (l)->l_origin == (char *) -1			      \
 	    ? 0 : strlen ((l)->l_origin);				      \
-									      \
-	__len += __cnt * (MAX (origin_len, GLRO(dl_platformlen)) - 7);	      \
+	dst_len = MAX (MAX (dst_len, GLRO(dl_platformlen)),		      \
+		       strlen (DL_DST_LIB));				      \
+	if (dst_len > 4)						      \
+	  __len += __cnt * (dst_len - 4);				      \
       }									      \
 									      \
     __len; })
@@ -72,7 +82,7 @@
   if ((l) == NULL)							      \
     {									      \
       const char *origin = _dl_get_origin ();				      \
-      origin_len = (origin && origin != (char *) -1 ? strlen (origin) : 0);   \
+      dst_len = (origin && origin != (char *) -1 ? strlen (origin) : 0);      \
     }									      \
   else
 #endif
--- a/elf/dl-runtime.c	(révision 10714)
+++ b/elf/dl-runtime.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* On-demand PLT fixup for shared objects.
-   Copyright (C) 1995-2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1995-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
@@ -446,6 +446,7 @@
 
   /* Set up the sym parameter.  */
   ElfW(Sym) sym = *defsym;
+  sym.st_value = DL_FIXUP_VALUE_ADDR (reloc_result->addr);
 
   /* Get the symbol name.  */
   const char *strtab = (const void *) D_PTR (reloc_result->bound,
--- a/elf/dl-load.c	(révision 10714)
+++ b/elf/dl-load.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Map in a shared object's segments from the file.
-   Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2007, 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
@@ -168,6 +168,87 @@
 }
 
 
+static bool
+is_trusted_path (const char *path, size_t len)
+{
+  const char *trun = system_dirs;
+
+  for (size_t idx = 0; idx < nsystem_dirs_len; ++idx)
+    {
+      if (len == system_dirs_len[idx] && memcmp (trun, path, len) == 0)
+	/* Found it.  */
+	return true;
+
+      trun += system_dirs_len[idx] + 1;
+    }
+
+  return false;
+}
+
+
+static bool
+is_trusted_path_normalize (const char *path, size_t len)
+{
+  if (len == 0)
+    return false;
+
+  if (*path == ':')
+    {
+      ++path;
+      --len;
+    }
+
+  char *npath = (char *) alloca (len + 2);
+  char *wnp = npath;
+  while (*path != '\0')
+    {
+      if (path[0] == '/')
+	{
+	  if (path[1] == '.')
+	    {
+	      if (path[2] == '.' && (path[3] == '/' || path[3] == '\0'))
+		{
+		  while (wnp > npath && *--wnp != '/')
+		    ;
+		  path += 3;
+		  continue;
+		}
+	      else if (path[2] == '/' || path[2] == '\0')
+		{
+		  path += 2;
+		  continue;
+		}
+	    }
+
+	  if (wnp > npath && wnp[-1] == '/')
+	    {
+	      ++path;
+	      continue;
+	    }
+	}
+
+      *wnp++ = *path++;
+    }
+
+  if (wnp == npath || wnp[-1] != '/')
+    *wnp++ = '/';
+
+  const char *trun = system_dirs;
+
+  for (size_t idx = 0; idx < nsystem_dirs_len; ++idx)
+    {
+      if (wnp - npath >= system_dirs_len[idx]
+	  && memcmp (trun, npath, system_dirs_len[idx]) == 0)
+	/* Found it.  */
+	return true;
+
+      trun += system_dirs_len[idx] + 1;
+    }
+
+  return false;
+}
+
+
 static size_t
 is_dst (const char *start, const char *name, const char *str,
 	int is_path, int secure)
@@ -200,7 +281,8 @@
     return 0;
 
   if (__builtin_expect (secure, 0)
-      && ((name[len] != '\0' && (!is_path || name[len] != ':'))
+      && ((name[len] != '\0' && name[len] != '/'
+	   && (!is_path || name[len] != ':'))
 	  || (name != start + 1 && (!is_path || name[-2] != ':'))))
     return 0;
 
@@ -240,13 +322,14 @@
 		    int is_path)
 {
   const char *const start = name;
-  char *last_elem, *wp;
 
   /* Now fill the result path.  While copying over the string we keep
      track of the start of the last path element.  When we come accross
      a DST we copy over the value or (if the value is not available)
      leave the entire path element out.  */
-  last_elem = wp = result;
+  char *wp = result;
+  char *last_elem = result;
+  bool check_for_trusted = false;
 
   do
     {
@@ -265,6 +348,9 @@
 	      else
 #endif
 		repl = l->l_origin;
+
+	      check_for_trusted = (INTUSE(__libc_enable_secure)
+				   && l->l_type == lt_executable);
 	    }
 	  else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
 	    repl = GLRO(dl_platform);
@@ -284,6 +370,10 @@
 	      name += len;
 	      while (*name != '\0' && (!is_path || *name != ':'))
 		++name;
+	      /* Also skip following colon if this is the first rpath
+		 element, but keep an empty element at the end.  */
+	      if (wp == result && is_path && *name == ':' && name[1] != '\0')
+		++name;
 	    }
 	  else
 	    /* No DST we recognize.  */
@@ -293,11 +383,28 @@
 	{
 	  *wp++ = *name++;
 	  if (is_path && *name == ':')
-	    last_elem = wp;
+	    {
+	      /* In SUID/SGID programs, after $ORIGIN expansion the
+		 normalized path must be rooted in one of the trusted
+		 directories.  */
+	      if (__builtin_expect (check_for_trusted, false)
+		  && !is_trusted_path_normalize (last_elem, wp - last_elem))
+		wp = last_elem;
+	      else
+		last_elem = wp;
+
+	      check_for_trusted = false;
+	    }
 	}
     }
   while (*name != '\0');
 
+  /* In SUID/SGID programs, after $ORIGIN expansion the normalized
+     path must be rooted in one of the trusted directories.  */
+  if (__builtin_expect (check_for_trusted, false)
+      && !is_trusted_path_normalize (last_elem, wp - last_elem))
+    wp = last_elem;
+
   *wp = '\0';
 
   return result;
@@ -310,7 +417,7 @@
    belonging to the map is loaded.  In this case the path element
    containing $ORIGIN is left out.  */
 static char *
-expand_dynamic_string_token (struct link_map *l, const char *s)
+expand_dynamic_string_token (struct link_map *l, const char *s, int is_path)
 {
   /* We make two runs over the string.  First we determine how large the
      resulting string is and then we copy it over.  Since this is now
@@ -321,7 +428,7 @@
   char *result;
 
   /* Determine the number of DST elements.  */
-  cnt = DL_DST_COUNT (s, 1);
+  cnt = DL_DST_COUNT (s, is_path);
 
   /* If we do not have to replace anything simply copy the string.  */
   if (__builtin_expect (cnt, 0) == 0)
@@ -335,7 +442,7 @@
   if (result == NULL)
     return NULL;
 
-  return _dl_dst_substitute (l, s, result, 1);
+  return _dl_dst_substitute (l, s, result, is_path);
 }
 
 
@@ -407,34 +514,9 @@
 	cp[len++] = '/';
 
       /* Make sure we don't use untrusted directories if we run SUID.  */
-      if (__builtin_expect (check_trusted, 0))
-	{
-	  const char *trun = system_dirs;
-	  size_t idx;
-	  int unsecure = 1;
+      if (__builtin_expect (check_trusted, 0) && !is_trusted_path (cp, len))
+	continue;
 
-	  /* All trusted directories must be complete names.  */
-	  if (cp[0] == '/')
-	    {
-	      for (idx = 0; idx < nsystem_dirs_len; ++idx)
-		{
-		  if (len == system_dirs_len[idx]
-		      && memcmp (trun, cp, len) == 0)
-		    {
-		      /* Found it.  */
-		      unsecure = 0;
-		      break;
-		    }
-
-		  trun += system_dirs_len[idx] + 1;
-		}
-	    }
-
-	  if (unsecure)
-	    /* Simply drop this directory.  */
-	    continue;
-	}
-
       /* See if this directory is already known.  */
       for (dirp = GL(dl_all_dirs); dirp != NULL; dirp = dirp->next)
 	if (dirp->dirnamelen == len && memcmp (cp, dirp->dirname, len) == 0)
@@ -551,13 +633,21 @@
 
   /* Make a writable copy.  At the same time expand possible dynamic
      string tokens.  */
-  copy = expand_dynamic_string_token (l, rpath);
+  copy = expand_dynamic_string_token (l, rpath, 1);
   if (copy == NULL)
     {
       errstring = N_("cannot create RUNPATH/RPATH copy");
       goto signal_error;
     }
 
+  /* Ignore empty rpaths.  */
+  if (*copy == 0)
+    {
+      free (copy);
+      sps->dirs = (struct r_search_path_elem **) -1;
+      return false;
+    }
+
   /* Count the number of necessary elements in the result array.  */
   nelems = 0;
   for (cp = copy; *cp != '\0'; ++cp)
@@ -801,19 +891,7 @@
   /* The file might already be closed.  */
   if (fd != -1)
     (void) __close (fd);
-  if (l != NULL)
-    {
-      /* Remove the stillborn object from the list and free it.  */
-      assert (l->l_next == NULL);
-      if (l->l_prev == NULL)
-	/* No other module loaded. This happens only in the static library,
-	   or in rtld under --verify.  */
-	GL(dl_ns)[l->l_ns]._ns_loaded = NULL;
-      else
-	l->l_prev->l_next = NULL;
-      --GL(dl_ns)[l->l_ns]._ns_nloaded;
-      free (l);
-    }
+  free (l);
   free (realname);
 
   if (r != NULL)
@@ -898,6 +976,9 @@
 	 never be unloaded.  */
       __close (fd);
 
+      /* Add the map for the mirrored object to the object list.  */
+      _dl_add_to_namespace_list (l, nsid);
+
       return l;
     }
 #endif
@@ -906,6 +987,7 @@
     {
       /* We are not supposed to load the object unless it is already
 	 loaded.  So return now.  */
+      free (realname);
       __close (fd);
       return NULL;
     }
@@ -924,6 +1006,7 @@
       _dl_zerofd = _dl_sysdep_open_zero_fill ();
       if (_dl_zerofd == -1)
 	{
+	  free (realname);
 	  __close (fd);
 	  _dl_signal_error (errno, NULL, NULL,
 			    N_("cannot open zero fill device"));
@@ -1492,6 +1575,9 @@
     add_name_to_object (l, ((const char *) D_PTR (l, l_info[DT_STRTAB])
 			    + l->l_info[DT_SONAME]->d_un.d_val));
 
+  /* Now that the object is fully initialized add it to the object list.  */
+  _dl_add_to_namespace_list (l, nsid);
+
 #ifdef SHARED
   /* Auditing checkpoint: we have a new object.  */
   if (__builtin_expect (GLRO(dl_naudit) > 0, 0)
@@ -1802,7 +1888,7 @@
    if MAY_FREE_DIRS is true.  */
 
 static int
-open_path (const char *name, size_t namelen, int preloaded,
+open_path (const char *name, size_t namelen, int secure,
 	   struct r_search_path_struct *sps, char **realname,
 	   struct filebuf *fbp, struct link_map *loader, int whatcode,
 	   bool *found_other_class)
@@ -1884,7 +1970,7 @@
 	  /* Remember whether we found any existing directory.  */
 	  here_any |= this_dir->status[cnt] != nonexisting;
 
-	  if (fd != -1 && __builtin_expect (preloaded, 0)
+	  if (fd != -1 && __builtin_expect (secure, 0)
 	      && INTUSE(__libc_enable_secure))
 	    {
 	      /* This is an extra security effort to make sure nobody can
@@ -1953,7 +2039,7 @@
 
 struct link_map *
 internal_function
-_dl_map_object (struct link_map *loader, const char *name, int preloaded,
+_dl_map_object (struct link_map *loader, const char *name,
 		int type, int trace_mode, int mode, Lmid_t nsid)
 {
   int fd;
@@ -2057,7 +2143,8 @@
 	  for (l = loader; l; l = l->l_loader)
 	    if (cache_rpath (l, &l->l_rpath_dirs, DT_RPATH, "RPATH"))
 	      {
-		fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
+		fd = open_path (name, namelen, mode & __RTLD_SECURE,
+				&l->l_rpath_dirs,
 				&realname, &fb, loader, LA_SER_RUNPATH,
 				&found_other_class);
 		if (fd != -1)
@@ -2072,14 +2159,15 @@
 	      && main_map != NULL && main_map->l_type != lt_loaded
 	      && cache_rpath (main_map, &main_map->l_rpath_dirs, DT_RPATH,
 			      "RPATH"))
-	    fd = open_path (name, namelen, preloaded, &main_map->l_rpath_dirs,
+	    fd = open_path (name, namelen, mode & __RTLD_SECURE,
+			    &main_map->l_rpath_dirs,
 			    &realname, &fb, loader ?: main_map, LA_SER_RUNPATH,
 			    &found_other_class);
 	}
 
       /* Try the LD_LIBRARY_PATH environment variable.  */
       if (fd == -1 && env_path_list.dirs != (void *) -1)
-	fd = open_path (name, namelen, preloaded, &env_path_list,
+	fd = open_path (name, namelen, mode & __RTLD_SECURE, &env_path_list,
 			&realname, &fb,
 			loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded,
 			LA_SER_LIBPATH, &found_other_class);
@@ -2088,12 +2176,12 @@
       if (fd == -1 && loader != NULL
 	  && cache_rpath (loader, &loader->l_runpath_dirs,
 			  DT_RUNPATH, "RUNPATH"))
-	fd = open_path (name, namelen, preloaded,
+	fd = open_path (name, namelen, mode & __RTLD_SECURE,
 			&loader->l_runpath_dirs, &realname, &fb, loader,
 			LA_SER_RUNPATH, &found_other_class);
 
       if (fd == -1
-	  && (__builtin_expect (! preloaded, 1)
+	  && (__builtin_expect (! (mode & __RTLD_SECURE), 1)
 	      || ! INTUSE(__libc_enable_secure)))
 	{
 	  /* Check the list of libraries in the file /etc/ld.so.cache,
@@ -2104,7 +2192,9 @@
 	    {
 #ifdef SHARED
 	      // XXX Correct to unconditionally default to namespace 0?
-	      l = loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded;
+	      l = (loader
+		   ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded
+		   ?: &GL(dl_rtld_map));
 #else
 	      l = loader;
 #endif
@@ -2159,7 +2249,7 @@
 	  && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
 	      || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
 	  && rtld_search_dirs.dirs != (void *) -1)
-	fd = open_path (name, namelen, preloaded, &rtld_search_dirs,
+	fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
 			&realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
 
       /* Add another newline when we are tracing the library loading.  */
@@ -2170,7 +2260,7 @@
     {
       /* The path may contain dynamic string tokens.  */
       realname = (loader
-		  ? expand_dynamic_string_token (loader, name)
+		  ? expand_dynamic_string_token (loader, name, 0)
 		  : local_strdup (name));
       if (realname == NULL)
 	fd = -1;
@@ -2204,7 +2294,7 @@
 	     have.  */
 	  static const Elf_Symndx dummy_bucket = STN_UNDEF;
 
-	  /* Enter the new object in the list of loaded objects.  */
+	  /* Allocate a new object map.  */
 	  if ((name_copy = local_strdup (name)) == NULL
 	      || (l = _dl_new_object (name_copy, name, type, loader,
 				      mode, nsid)) == NULL)
@@ -2222,6 +2312,9 @@
 	  l->l_nbuckets = 1;
 	  l->l_relocated = 1;
 
+	  /* Enter the object in the object list.  */
+	  _dl_add_to_namespace_list (l, nsid);
+
 	  return l;
 	}
       else if (found_other_class)
--- a/elf/ldconfig.c	(révision 10714)
+++ b/elf/ldconfig.c	(révision 14168)
@@ -387,15 +387,18 @@
     }
 
   /* Canonify path: for now only remove leading and trailing
-     whitespace and the trailing slashes slashes.  */
-  i = strlen (entry->path) - 1;
+     whitespace and the trailing slashes.  */
+  i = strlen (entry->path);
 
-  while (isspace (entry->path[i]) && i > 0)
-    entry->path[i--] = '\0';
+  while (i > 0 && isspace (entry->path[i - 1]))
+    entry->path[--i] = '\0';
 
-  while (entry->path[i] == '/' && i > 0)
-    entry->path[i--] = '\0';
+  while (i > 0 && entry->path[i - 1] == '/')
+    entry->path[--i] = '\0';
 
+  if (i == 0)
+    return;
+
   char *path = entry->path;
   if (opt_chroot)
     path = chroot_canon (opt_chroot, path);
@@ -1362,14 +1365,9 @@
 
   const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE;
   if (opt_chroot)
-    {
-      aux_cache_file = chroot_canon (opt_chroot, aux_cache_file);
-      if (aux_cache_file == NULL)
-	error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"),
-	       _PATH_LDCONFIG_AUX_CACHE);
-    }
+    aux_cache_file = chroot_canon (opt_chroot, aux_cache_file);
 
-  if (! opt_ignore_aux_cache)
+  if (! opt_ignore_aux_cache && aux_cache_file)
     load_aux_cache (aux_cache_file);
   else
     init_aux_cache ();
@@ -1379,7 +1377,8 @@
   if (opt_build_cache)
     {
       save_cache (cache_file);
-      save_aux_cache (aux_cache_file);
+      if (aux_cache_file)
+        save_aux_cache (aux_cache_file);
     }
 
   return 0;
--- a/elf/dl-lookup.c	(révision 10714)
+++ b/elf/dl-lookup.c	(révision 14168)
@@ -1,5 +1,5 @@
 /* Look up a symbol in the loaded objects.
-   Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2007, 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
@@ -312,39 +312,21 @@
 		 definition we have to use it.  */
 	      void enter (struct unique_sym *table, size_t size,
 			  unsigned int hash, const char *name,
-			  const ElfW(Sym) *sym, struct link_map *map)
+			  const ElfW(Sym) *sym, const struct link_map *map)
 	      {
 		size_t idx = hash % size;
 		size_t hash2 = 1 + hash % (size - 2);
-		while (1)
+		while (table[idx].name != NULL)
 		  {
-		    if (table[idx].name == NULL)
-		      {
-			table[idx].hashval = hash;
-			table[idx].name = name;
-			if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
-			  {
-			    table[idx].sym = ref;
-			    table[idx].map = undef_map;
-			  }
-			else
-			  {
-			    table[idx].sym = sym;
-			    table[idx].map = map;
-
-			    if (map->l_type == lt_loaded)
-			      /* Make sure we don't unload this object by
-				 setting the appropriate flag.  */
-			      map->l_flags_1 |= DF_1_NODELETE;
-			  }
-
-			return;
-		      }
-
 		    idx += hash2;
 		    if (idx >= size)
 		      idx -= size;
 		  }
+
+		table[idx].hashval = hash;
+		table[idx].name = name;
+		table[idx].sym = sym;
+		table[idx].map = map;
 	      }
 
 	      struct unique_sym_table *tab
@@ -363,8 +345,19 @@
 		      if (entries[idx].hashval == new_hash
 			  && strcmp (entries[idx].name, undef_name) == 0)
 			{
-			  result->s = entries[idx].sym;
-			  result->m = (struct link_map *) entries[idx].map;
+			  if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
+			    {
+			      /* We possibly have to initialize the central
+				 copy from the copy addressed through the
+				 relocation.  */
+			      result->s = sym;
+			      result->m = (struct link_map *) map;
+			    }
+			  else
+			    {
+			      result->s = entries[idx].sym;
+			      result->m = (struct link_map *) entries[idx].map;
+			    }
 			  __rtld_lock_unlock_recursive (tab->lock);
 			  return 1;
 			}
@@ -425,8 +418,19 @@
 		  tab->free = free;
 		}
 
-	      enter (entries, size, new_hash, strtab + sym->st_name, sym,
-		     (struct link_map *) map);
+	      if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
+		enter (entries, size, new_hash, strtab + sym->st_name, ref,
+		       undef_map);
+	      else
+		{
+		  enter (entries, size, new_hash, strtab + sym->st_name, sym,
+			 map);
+
+		  if (map->l_type == lt_loaded)
+		    /* Make sure we don't unload this object by
+		       setting the appropriate flag.  */
+		    ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE;
+		}
 	      ++tab->n_elements;
 
 	      __rtld_lock_unlock_recursive (tab->lock);
--- a/io/fcntl.h	(révision 10714)
+++ b/io/fcntl.h	(révision 14168)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006,2007, 2009
+/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006,2007,2009,2010,2011
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -64,6 +64,8 @@
 # define AT_REMOVEDIR		0x200	/* Remove directory instead of
 					   unlinking file.  */
 # define AT_SYMLINK_FOLLOW	0x400	/* Follow symbolic links.  */
+# define AT_NO_AUTOMOUNT	0x800	/* Suppress terminal automount
+					   traversal.  */
 # define AT_EACCESS		0x200	/* Test access permitted for
 					   effective IDs, not real IDs.  */
 #endif
--- a/ports/sysdeps/arm/sysdep.h	(révision 10714)
+++ b/ports/sysdeps/arm/sysdep.h	(révision 14168)
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdeps/generic/sysdep.h>
+#include <features.h>
 
 #if (!defined (__ARM_ARCH_2__) && !defined (__ARM_ARCH_3__) \
      && !defined (__ARM_ARCH_3M__) && !defined (__ARM_ARCH_4__))
@@ -89,10 +90,16 @@
 
 /* If compiled for profiling, call `mcount' at the start of each function.  */
 #ifdef	PROF
+#if __GNUC_PREREQ(4,4) && defined(__ARM_EABI__)
 #define CALL_MCOUNT			\
 	str	lr,[sp, #-4]!	;	\
+	bl	PLTJMP(mcount)	;
+#else
+#define CALL_MCOUNT			\
+	str	lr,[sp, #-4]!	;	\
 	bl	PLTJMP(mcount)	;	\
 	ldr	lr, [sp], #4	;
+#endif
 #else
 #define CALL_MCOUNT		/* Do nothing.  */
 #endif
@@ -102,8 +109,12 @@
    on this system, the asm identifier `syscall_error' intrudes on the
    C name space.  Make sure we use an innocuous name.  */
 #define	syscall_error	__syscall_error
+#if __GNUC_PREREQ(4,4) && defined(__ARM_EABI__)
+#define mcount		__gnu_mcount_nc
+#else
 #define mcount		_mcount
 #endif
+#endif
 
 #if defined(__ARM_EABI__)
 /* Tag_ABI_align8_preserved: This code preserves 8-byte
--- a/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h	(révision 10714)
+++ b/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/ARM version.
-   Copyright (C) 1997, 2000, 2003, 2005, 2006, 2009
+   Copyright (C) 1997, 2000, 2003, 2005, 2006, 2009, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -94,6 +94,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h	(révision 10714)
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/m68k version.
-   Copyright (C) 1997, 2000, 2003, 2005, 2008, 2009
+   Copyright (C) 1997, 2000, 2003, 2005, 2008, 2009, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -94,6 +94,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h	(révision 10714)
+++ b/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h	(révision 14168)
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/MIPS version.
-   Copyright (C) 1997, 2000, 2003, 2004, 2005, 2006, 2009
+   Copyright (C) 1997, 2000, 2003, 2004, 2005, 2006, 2009, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -96,6 +96,8 @@
 # define MADV_DOFORK	  11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE	  12	/* KSM may merge identical pages.  */
 # define MADV_UNMERGEABLE 13	/* KSM may not merge identical pages.  */
+# define MADV_HUGEPAGE	  14	/* Worth backing with hugepages.  */
+# define MADV_NOHUGEPAGE  15	/* Not worth backing with hugepages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
--- a/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h	(révision 10714)
+++ b/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h	(révision 14168)
@@ -1,6 +1,6 @@
 /* System-specific socket constants and types.  Linux/MIPS version.
    Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004, 2005, 2006, 2007, 2008,
-   2009 Free Software Foundation, Inc.
+   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
@@ -109,7 +109,9 @@
 #define PF_ISDN		34	/* mISDN sockets.  */
 #define PF_PHONET	35	/* Phonet sockets.  */
 #define PF_IEEE802154	36	/* IEEE 802.15.4 sockets.  */
-#define	PF_MAX		37	/* For now..  */
+#define PF_CAIF		37	/* CAIF sockets.  */
+#define PF_ALG		38	/* Algorithm sockets.  */
+#define	PF_MAX		39	/* For now..  */
 
 /* Address families.  */
 #define	AF_UNSPEC	PF_UNSPEC
@@ -150,6 +152,8 @@
 #define AF_ISDN		PF_ISDN
 #define AF_PHONET	PF_PHONET
 #define AF_IEEE802154	PF_IEEE802154
+#define AF_CAIF		PF_CAIF
+#define AF_ALG		PF_ALG
 #define	AF_MAX		PF_MAX
 
 /* Socket level values.  Others are defined in the appropriate headers.
--- a/ports/ChangeLog.mips	(révision 10714)
+++ b/ports/ChangeLog.mips	(révision 14168)
@@ -1,3 +1,13 @@
+2011-01-25  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/mips/bits/mman.h (MADV_HUGEPAGE,
+	MADV_NOHUGEPAGE): Define.
+
+2011-01-25  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/mips/bits/socket.h (AF_CAIF, AF_ALG,
+	PF_CAIF, PF_ALG): Define.
+
 2009-12-16  Joseph Myers  <joseph@codesourcery.com>
 
 	* sysdeps/mips/dl-lookup.c: Update from generic version.
--- a/ports/ChangeLog.arm	(révision 10714)
+++ b/ports/ChangeLog.arm	(révision 14168)
@@ -1,3 +1,15 @@
+2011-02-16  Manjunath Matti  <manjunath81@gmail.com>
+
+	* sysdeps/arm/sysdep.h (CALL_MCOUNT): Use __gnu_mcount_nc
+	interface for EABI with GCC 4.4 or later.
+	(mcount): Define to __gnu_mcount_nc for EABI with GCC 4.4 or
+	later.
+
+2011-01-25  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/arm/bits/mman.h (MADV_HUGEPAGE,
+	MADV_NOHUGEPAGE): Define.
+
 2009-11-19  Joseph Myers  <joseph@codesourcery.com>
 
 	* sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_PSELECT,
--- a/ports/ChangeLog.m68k	(révision 10714)
+++ b/ports/ChangeLog.m68k	(révision 14168)
@@ -1,3 +1,8 @@
+2011-01-18  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* sysdeps/unix/sysv/linux/m68k/bits/mman.h (MADV_HUGEPAGE)
+	(MADV_NOHUGEPAGE): Define.
+
 2009-11-17  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #10972]

Reply to: