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

[commits] r14016 - in /branches/eglibc-2_11/libc: ./ conform/data/ elf/ iconv/ include/ inet/ libio/ login/programs/ math/ misc/ nptl/...



Author: joseph
Date: Fri May 27 10:01:54 2011
New Revision: 14016

Log:
Merge changes between r13230 and r14015 from /fsf/glibc-2_11-branch.

Added:
    branches/eglibc-2_11/libc/libio/bug-fclose1.c
      - copied unchanged from r14015, fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c
    branches/eglibc-2_11/libc/math/test-powl.c
      - copied unchanged from r14015, fsf/glibc-2_11-branch/libc/math/test-powl.c
    branches/eglibc-2_11/libc/stdio-common/bug23.c
      - copied unchanged from r14015, fsf/glibc-2_11-branch/libc/stdio-common/bug23.c
    branches/eglibc-2_11/libc/stdlib/bug-getcontext.c
      - copied unchanged from r14015, fsf/glibc-2_11-branch/libc/stdlib/bug-getcontext.c
    branches/eglibc-2_11/libc/sysdeps/mach/hurd/ifreq.h
      - copied unchanged from r14015, fsf/glibc-2_11-branch/libc/sysdeps/mach/hurd/ifreq.h
    branches/eglibc-2_11/libc/sysdeps/powerpc/powerpc64/power7/Makefile
      - copied unchanged from r14015, fsf/glibc-2_11-branch/libc/sysdeps/powerpc/powerpc64/power7/Makefile
    branches/eglibc-2_11/libc/sysdeps/wordsize-64/Makefile
      - copied unchanged from r14015, fsf/glibc-2_11-branch/libc/sysdeps/wordsize-64/Makefile
    branches/eglibc-2_11/libc/sysdeps/wordsize-64/tst-writev.c
      - copied unchanged from r14015, fsf/glibc-2_11-branch/libc/sysdeps/wordsize-64/tst-writev.c
Modified:
    branches/eglibc-2_11/libc/ChangeLog
    branches/eglibc-2_11/libc/conform/data/netdb.h-data
    branches/eglibc-2_11/libc/elf/Makefile
    branches/eglibc-2_11/libc/elf/dl-close.c
    branches/eglibc-2_11/libc/elf/dl-deps.c
    branches/eglibc-2_11/libc/elf/dl-load.c
    branches/eglibc-2_11/libc/elf/dl-lookup.c
    branches/eglibc-2_11/libc/elf/dl-tls.c
    branches/eglibc-2_11/libc/elf/ldconfig.c
    branches/eglibc-2_11/libc/elf/noload.c
    branches/eglibc-2_11/libc/iconv/loop.c
    branches/eglibc-2_11/libc/include/link.h
    branches/eglibc-2_11/libc/inet/getnameinfo.c
    branches/eglibc-2_11/libc/libio/Makefile
    branches/eglibc-2_11/libc/libio/fileops.c
    branches/eglibc-2_11/libc/libio/fmemopen.c
    branches/eglibc-2_11/libc/login/programs/pt_chown.c
    branches/eglibc-2_11/libc/math/Makefile
    branches/eglibc-2_11/libc/misc/error.c
    branches/eglibc-2_11/libc/misc/mntent_r.c
    branches/eglibc-2_11/libc/nptl/ChangeLog
    branches/eglibc-2_11/libc/nptl/allocatestack.c
    branches/eglibc-2_11/libc/posix/fnmatch.c
    branches/eglibc-2_11/libc/resolv/netdb.h
    branches/eglibc-2_11/libc/resolv/res_debug.c
    branches/eglibc-2_11/libc/resolv/res_init.c
    branches/eglibc-2_11/libc/resolv/res_query.c
    branches/eglibc-2_11/libc/resolv/resolv.h
    branches/eglibc-2_11/libc/stdio-common/Makefile
    branches/eglibc-2_11/libc/stdio-common/_i18n_number.h
    branches/eglibc-2_11/libc/stdio-common/printf-parsemb.c
    branches/eglibc-2_11/libc/stdio-common/vfprintf.c
    branches/eglibc-2_11/libc/stdlib/Makefile
    branches/eglibc-2_11/libc/sysdeps/i386/dl-tls.h
    branches/eglibc-2_11/libc/sysdeps/ia64/dl-tls.h
    branches/eglibc-2_11/libc/sysdeps/posix/spawni.c
    branches/eglibc-2_11/libc/sysdeps/powerpc/dl-tls.h
    branches/eglibc-2_11/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
    branches/eglibc-2_11/libc/sysdeps/pthread/aio_misc.c
    branches/eglibc-2_11/libc/sysdeps/s390/dl-tls.h
    branches/eglibc-2_11/libc/sysdeps/sh/dl-tls.h
    branches/eglibc-2_11/libc/sysdeps/sparc/dl-tls.h
    branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/Makefile
    branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
    branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
    branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/x86_64/getcontext.S
    branches/eglibc-2_11/libc/sysdeps/x86_64/dl-tls.h
    branches/eglibc-2_11/libc/sysdeps/x86_64/fpu/e_powl.S
    branches/eglibc-2_11/libc/wcsmbs/wchar.h

Modified: branches/eglibc-2_11/libc/ChangeLog
==============================================================================
--- branches/eglibc-2_11/libc/ChangeLog (original)
+++ branches/eglibc-2_11/libc/ChangeLog Fri May 27 10:01:54 2011
@@ -1,3 +1,246 @@
+2011-05-17  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	[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@xxxxxxxxx>
+
+	[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@xxxxxxxxx>
+
+	[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@xxxxxxxxx>
+
+	[BZ #12724]
+	* libio/fileops.c (_IO_new_file_close_it): Always flush when
+	currently writing and seek to current position when not.
+	* libio/Makefile (tests): Add bug-fclose1.
+	* libio/bug-fclose1.c: New file.
+
+2011-05-12  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #12511]
+	* 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@xxxxxxxxxxx>.
+
+2011-05-11  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[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@xxxxxxxxx>
+
+	[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@xxxxxxx>
+	    Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[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@xxxxxxxxxx>
+
+	* elf/ldconfig.c (add_dir): Don't crash on empty path.
+
+2011-04-30  Bruno Haible  <bruno@xxxxxxxxx>
+
+	[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@xxxxxxxxx>
+
+	[BZ #12685]
+	* libio/fileops.c (_IO_new_file_fopen): Scan up to 7 bytes of the
+	mode string.
+	Patch by Eric Blake <eblake@xxxxxxxxxx>.
+
+2011-04-17  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[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@xxxxxxxxx>
+
+	[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@xxxxxxxxxx>
+
+	* 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@xxxxxxxxxx>
+
+	* 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@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
+	bits/timex.h
+
+2011-03-18  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #12583]
+	* posix/fnmatch.c (fnmatch): Check size of pattern in wide
+	character representation.
+	Partly based on a patch by Tomas Hoger <thoger@xxxxxxxxxx>.
+
+2011-03-16  Ryan S. Arnold  <rsa@xxxxxxxxxx>
+
+	* 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@xxxxxxxxxx>
+
+	* wcsmbs/wchar.h (wmemcmp): Remove __restrict qualifiers.
+
+2011-03-10  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[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@xxxxxxxxxxx>.
+
+2011-03-06  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* 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@xxxxxxxxxx>
+
+	* libio/fmemopen.c (fmemopen): Don't read past end of buffer.
+
+2011-02-23  Andreas Schwab  <schwab@xxxxxxxxxx>
+	    Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[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@xxxxxxxxxx>
+
+	[BZ #12454]
+	* elf/dl-deps.c (_dl_map_object_deps): Signal error early when
+	dependencies are missing.
+
+2011-02-22  Samuel Thibault  <samuel.thibault@xxxxxxxxxxxx>
+
+	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@xxxxxxx>
+	    Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[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@xxxxxxxxxx>
+
+	* 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@xxxxxxxxxx>
+
+	* 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@xxxxxxxxxx>
+
+	* 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@xxxxxxxxx>
 
 	* elf/dl-runtime.c (_dl_call_pltexit): Pass correct address of the

Modified: branches/eglibc-2_11/libc/conform/data/netdb.h-data
==============================================================================
--- branches/eglibc-2_11/libc/conform/data/netdb.h-data (original)
+++ branches/eglibc-2_11/libc/conform/data/netdb.h-data Fri May 27 10:01:54 2011
@@ -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)

Modified: branches/eglibc-2_11/libc/elf/Makefile
==============================================================================
--- branches/eglibc-2_11/libc/elf/Makefile (original)
+++ branches/eglibc-2_11/libc/elf/Makefile Fri May 27 10:01:54 2011
@@ -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

Modified: branches/eglibc-2_11/libc/elf/dl-close.c
==============================================================================
--- branches/eglibc-2_11/libc/elf/dl-close.c (original)
+++ branches/eglibc-2_11/libc/elf/dl-close.c Fri May 27 10:01:54 2011
@@ -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))

Modified: branches/eglibc-2_11/libc/elf/dl-deps.c
==============================================================================
--- branches/eglibc-2_11/libc/elf/dl-deps.c (original)
+++ branches/eglibc-2_11/libc/elf/dl-deps.c Fri May 27 10:01:54 2011
@@ -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;
 }

Modified: branches/eglibc-2_11/libc/elf/dl-load.c
==============================================================================
--- branches/eglibc-2_11/libc/elf/dl-load.c (original)
+++ branches/eglibc-2_11/libc/elf/dl-load.c Fri May 27 10:01:54 2011
@@ -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,10 +383,27 @@
 	{
 	  *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';
 
@@ -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,33 +514,8 @@
 	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;
-
-	  /* 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;
-	}
+      if (__builtin_expect (check_trusted, 0) && !is_trusted_path (cp, len))
+	continue;
 
       /* See if this directory is already known.  */
       for (dirp = GL(dl_all_dirs); dirp != NULL; dirp = dirp->next)
@@ -551,11 +633,19 @@
 
   /* 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.  */
@@ -897,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;
     }
@@ -915,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"));
@@ -2100,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
@@ -2166,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;

Modified: branches/eglibc-2_11/libc/elf/dl-lookup.c
==============================================================================
--- branches/eglibc-2_11/libc/elf/dl-lookup.c (original)
+++ branches/eglibc-2_11/libc/elf/dl-lookup.c Fri May 27 10:01:54 2011
@@ -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);

Modified: branches/eglibc-2_11/libc/elf/dl-tls.c
==============================================================================
--- branches/eglibc-2_11/libc/elf/dl-tls.c (original)
+++ branches/eglibc-2_11/libc/elf/dl-tls.c Fri May 27 10:01:54 2011
@@ -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
@@ -32,9 +32,6 @@
 /* Amount of excess space to allocate in the static TLS area
    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.  */

Modified: branches/eglibc-2_11/libc/elf/ldconfig.c
==============================================================================
--- branches/eglibc-2_11/libc/elf/ldconfig.c (original)
+++ branches/eglibc-2_11/libc/elf/ldconfig.c Fri May 27 10:01:54 2011
@@ -387,14 +387,17 @@
     }
 
   /* Canonify path: for now only remove leading and trailing
-     whitespace and the trailing slashes slashes.  */
-  i = strlen (entry->path) - 1;
-
-  while (isspace (entry->path[i]) && i > 0)
-    entry->path[i--] = '\0';
-
-  while (entry->path[i] == '/' && i > 0)
-    entry->path[i--] = '\0';
+     whitespace and the trailing slashes.  */
+  i = strlen (entry->path);
+
+  while (i > 0 && isspace (entry->path[i - 1]))
+    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)

Modified: branches/eglibc-2_11/libc/elf/noload.c
==============================================================================
--- branches/eglibc-2_11/libc/elf/noload.c (original)
+++ branches/eglibc-2_11/libc/elf/noload.c Fri May 27 10:01:54 2011
@@ -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)
 	    {

Modified: branches/eglibc-2_11/libc/iconv/loop.c
==============================================================================
--- branches/eglibc-2_11/libc/iconv/loop.c (original)
+++ branches/eglibc-2_11/libc/iconv/loop.c Fri May 27 10:01:54 2011
@@ -1,5 +1,5 @@
 /* Conversion loop frame work.
-   Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1998-2003, 2005, 2008, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -399,6 +399,9 @@
     {
       *inptrp = inend;
 #ifdef STORE_REST
+      while (inptr < inend)
+	bytebuf[inlen++] = *inptr++;
+
       inptr = bytebuf;
       inptrp = &inptr;
       inend = &bytebuf[inlen];

Modified: branches/eglibc-2_11/libc/include/link.h
==============================================================================
--- branches/eglibc-2_11/libc/include/link.h (original)
+++ branches/eglibc-2_11/libc/include/link.h Fri May 27 10:01:54 2011
@@ -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

Modified: branches/eglibc-2_11/libc/inet/getnameinfo.c
==============================================================================
--- branches/eglibc-2_11/libc/inet/getnameinfo.c (original)
+++ branches/eglibc-2_11/libc/inet/getnameinfo.c Fri May 27 10:01:54 2011
@@ -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))

Modified: branches/eglibc-2_11/libc/libio/Makefile
==============================================================================
--- branches/eglibc-2_11/libc/libio/Makefile (original)
+++ branches/eglibc-2_11/libc/libio/Makefile Fri May 27 10:01:54 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2004,2006,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004,2006-2009,2011 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -67,7 +67,7 @@
 	tst-mmap2-eofsync tst-mmap-offend bug-fopena+		\
 	bug-ungetc2 bug-ungetc3 bug-ungetc4			\
 	tst-memstream1 tst-memstream2				\
-	bug-memstream1 tst-popen1
+	bug-memstream1 tst-popen1 bug-fclose1
 tests-$(OPTION_EGLIBC_LOCALE_CODE)				\
      += tst-swscanf tst-fgetws tst-fopenloc tst-setvbuf1	\
 	tst-ungetwc1 tst-ungetwc2 bug-ftell bug-ungetwc2	\

Modified: branches/eglibc-2_11/libc/libio/fileops.c
==============================================================================
--- branches/eglibc-2_11/libc/libio/fileops.c (original)
+++ branches/eglibc-2_11/libc/libio/fileops.c Fri May 27 10:01:54 2011
@@ -161,19 +161,27 @@
 _IO_new_file_close_it (fp)
      _IO_FILE *fp;
 {
-  int write_status, close_status;
   if (!_IO_file_is_open (fp))
     return EOF;
 
-  if ((fp->_flags & _IO_NO_WRITES) == 0
-      && (fp->_flags & _IO_CURRENTLY_PUTTING) != 0)
+  int write_status;
+  if (_IO_in_put_mode (fp))
     write_status = _IO_do_flush (fp);
+  else if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
+	   && !_IO_in_backup (fp))
+    {
+      off64_t o = _IO_SEEKOFF (fp, 0, _IO_seek_cur, 0);
+      if (o == WEOF)
+	write_status = EOF;
+      else
+	write_status = _IO_SYSSEEK (fp, o, SEEK_SET) < 0 ? EOF : 0;
+    }
   else
     write_status = 0;
 
   INTUSE(_IO_unsave_markers) (fp);
 
-  close_status = _IO_SYSCLOSE (fp);
+  int close_status = _IO_SYSCLOSE (fp);
 
   /* Free buffer. */
 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
@@ -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;
-
-              fp->_offset = result;
-            }
-        }
+	{
+	  if (mode != 0)
+	    goto dumb;
+	  else
+	    {
+	      result = _IO_SYSSEEK (fp, 0, dir);
+	      if (result == EOF)
+		return 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,

Modified: branches/eglibc-2_11/libc/libio/fmemopen.c
==============================================================================
--- branches/eglibc-2_11/libc/libio/fmemopen.c (original)
+++ branches/eglibc-2_11/libc/libio/fmemopen.c Fri May 27 10:01:54 2011
@@ -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@xxxxxxxx, 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;

Modified: branches/eglibc-2_11/libc/login/programs/pt_chown.c
==============================================================================
--- branches/eglibc-2_11/libc/login/programs/pt_chown.c (original)
+++ branches/eglibc-2_11/libc/login/programs/pt_chown.c Fri May 27 10:01:54 2011
@@ -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,

Modified: branches/eglibc-2_11/libc/math/Makefile
==============================================================================
--- branches/eglibc-2_11/libc/math/Makefile (original)
+++ branches/eglibc-2_11/libc/math/Makefile Fri May 27 10:01:54 2011
@@ -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__ \

Modified: branches/eglibc-2_11/libc/misc/error.c
==============================================================================
--- branches/eglibc-2_11/libc/misc/error.c (original)
+++ branches/eglibc-2_11/libc/misc/error.c Fri May 27 10:01:54 2011
@@ -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;
 

Modified: branches/eglibc-2_11/libc/misc/mntent_r.c
==============================================================================
--- branches/eglibc-2_11/libc/misc/mntent_r.c (original)
+++ branches/eglibc-2_11/libc/misc/mntent_r.c Fri May 27 10:01:54 2011
@@ -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)
 

Modified: branches/eglibc-2_11/libc/nptl/ChangeLog
==============================================================================
--- branches/eglibc-2_11/libc/nptl/ChangeLog (original)
+++ branches/eglibc-2_11/libc/nptl/ChangeLog Fri May 27 10:01:54 2011
@@ -1,3 +1,15 @@
+2011-05-11  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #386]
+	* allocatestack.c (allocate_stack): Convert ENOMEM error to EAGAIN.
+
+2011-04-10  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #12650]
+	* allocatestack.c (get_cached_stack): Deallocate DTV entries before
+	clearing memory.
+	Patch partly by Robert Rex <robert.rex@xxxxxxxxxx>.
+
 2011-01-13  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	[BZ #10484]

Modified: branches/eglibc-2_11/libc/nptl/allocatestack.c
==============================================================================
--- branches/eglibc-2_11/libc/nptl/allocatestack.c (original)
+++ branches/eglibc-2_11/libc/nptl/allocatestack.c Fri May 27 10:01:54 2011
@@ -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@xxxxxxxxxx>, 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);
 

Modified: branches/eglibc-2_11/libc/posix/fnmatch.c
==============================================================================
--- branches/eglibc-2_11/libc/posix/fnmatch.c (original)
+++ branches/eglibc-2_11/libc/posix/fnmatch.c Fri May 27 10:01:54 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2007,2010
+/* 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.
 
@@ -379,6 +379,11 @@
 	       XXX Do we have to set `errno' to something which mbsrtows hasn't
 	       already done?  */
 	    return -1;
+	  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));
@@ -423,6 +428,12 @@
 	       XXX Do we have to set `errno' to something which mbsrtows hasn't
 	       already done?  */
 	    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));

Modified: branches/eglibc-2_11/libc/resolv/netdb.h
==============================================================================
--- branches/eglibc-2_11/libc/resolv/netdb.h (original)
+++ branches/eglibc-2_11/libc/resolv/netdb.h Fri May 27 10:01:54 2011
@@ -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

Modified: branches/eglibc-2_11/libc/resolv/res_debug.c
==============================================================================
--- branches/eglibc-2_11/libc/resolv/res_debug.c (original)
+++ branches/eglibc-2_11/libc/resolv/res_debug.c Fri May 27 10:01:54 2011
@@ -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);

Modified: branches/eglibc-2_11/libc/resolv/res_init.c
==============================================================================
--- branches/eglibc-2_11/libc/resolv/res_init.c (original)
+++ branches/eglibc-2_11/libc/resolv/res_init.c Fri May 27 10:01:54 2011
@@ -545,6 +545,11 @@
 		} 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? */
 		}

Modified: branches/eglibc-2_11/libc/resolv/res_query.c
==============================================================================
--- branches/eglibc-2_11/libc/resolv/res_query.c (original)
+++ branches/eglibc-2_11/libc/resolv/res_query.c Fri May 27 10:01:54 2011
@@ -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);

Modified: branches/eglibc-2_11/libc/resolv/resolv.h
==============================================================================
--- branches/eglibc-2_11/libc/resolv/resolv.h (original)
+++ branches/eglibc-2_11/libc/resolv/resolv.h Fri May 27 10:01:54 2011
@@ -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)
 

Modified: branches/eglibc-2_11/libc/stdio-common/Makefile
==============================================================================
--- branches/eglibc-2_11/libc/stdio-common/Makefile (original)
+++ branches/eglibc-2_11/libc/stdio-common/Makefile Fri May 27 10:01:54 2011
@@ -68,7 +68,7 @@
 	 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-grouping
 tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \

Modified: branches/eglibc-2_11/libc/stdio-common/_i18n_number.h
==============================================================================
--- branches/eglibc-2_11/libc/stdio-common/_i18n_number.h (original)
+++ branches/eglibc-2_11/libc/stdio-common/_i18n_number.h Fri May 27 10:01:54 2011
@@ -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
 

Modified: branches/eglibc-2_11/libc/stdio-common/printf-parsemb.c
==============================================================================
--- branches/eglibc-2_11/libc/stdio-common/printf-parsemb.c (original)
+++ branches/eglibc-2_11/libc/stdio-common/printf-parsemb.c Fri May 27 10:01:54 2011
@@ -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;

Modified: branches/eglibc-2_11/libc/stdio-common/vfprintf.c
==============================================================================
--- branches/eglibc-2_11/libc/stdio-common/vfprintf.c (original)
+++ branches/eglibc-2_11/libc/stdio-common/vfprintf.c Fri May 27 10:01:54 2011
@@ -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));

Modified: branches/eglibc-2_11/libc/stdlib/Makefile
==============================================================================
--- branches/eglibc-2_11/libc/stdlib/Makefile (original)
+++ branches/eglibc-2_11/libc/stdlib/Makefile Fri May 27 10:01:54 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1991-2009, 2011 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -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)

Modified: branches/eglibc-2_11/libc/sysdeps/i386/dl-tls.h
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/i386/dl-tls.h (original)
+++ branches/eglibc-2_11/libc/sysdeps/i386/dl-tls.h Fri May 27 10:01:54 2011
@@ -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)

Modified: branches/eglibc-2_11/libc/sysdeps/ia64/dl-tls.h
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/ia64/dl-tls.h (original)
+++ branches/eglibc-2_11/libc/sysdeps/ia64/dl-tls.h Fri May 27 10:01:54 2011
@@ -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)

Modified: branches/eglibc-2_11/libc/sysdeps/posix/spawni.c
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/posix/spawni.c (original)
+++ branches/eglibc-2_11/libc/sysdeps/posix/spawni.c Fri May 27 10:01:54 2011
@@ -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

Modified: branches/eglibc-2_11/libc/sysdeps/powerpc/dl-tls.h
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/powerpc/dl-tls.h (original)
+++ branches/eglibc-2_11/libc/sysdeps/powerpc/dl-tls.h Fri May 27 10:01:54 2011
@@ -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)

Modified: branches/eglibc-2_11/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S (original)
+++ branches/eglibc-2_11/libc/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S Fri May 27 10:01:54 2011
@@ -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)
-

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

Modified: branches/eglibc-2_11/libc/sysdeps/s390/dl-tls.h
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/s390/dl-tls.h (original)
+++ branches/eglibc-2_11/libc/sysdeps/s390/dl-tls.h Fri May 27 10:01:54 2011
@@ -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)

Modified: branches/eglibc-2_11/libc/sysdeps/sh/dl-tls.h
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/sh/dl-tls.h (original)
+++ branches/eglibc-2_11/libc/sysdeps/sh/dl-tls.h Fri May 27 10:01:54 2011
@@ -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)

Modified: branches/eglibc-2_11/libc/sysdeps/sparc/dl-tls.h
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/sparc/dl-tls.h (original)
+++ branches/eglibc-2_11/libc/sysdeps/sparc/dl-tls.h Fri May 27 10:01:54 2011
@@ -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)

Modified: branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/Makefile
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/Makefile (original)
+++ branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/Makefile Fri May 27 10:01:54 2011
@@ -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

Modified: branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (original)
+++ branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h Fri May 27 10:01:54 2011
@@ -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)

Modified: branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S (original)
+++ branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S Fri May 27 10:01:54 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,2004,2005,2006,2009,2010 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,18 +30,22 @@
 //#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.

Modified: branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/x86_64/getcontext.S
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/x86_64/getcontext.S (original)
+++ branches/eglibc-2_11/libc/sysdeps/unix/sysv/linux/x86_64/getcontext.S Fri May 27 10:01:54 2011
@@ -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@xxxxxxx>, 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

Modified: branches/eglibc-2_11/libc/sysdeps/x86_64/dl-tls.h
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/x86_64/dl-tls.h (original)
+++ branches/eglibc-2_11/libc/sysdeps/x86_64/dl-tls.h Fri May 27 10:01:54 2011
@@ -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)

Modified: branches/eglibc-2_11/libc/sysdeps/x86_64/fpu/e_powl.S
==============================================================================
--- branches/eglibc-2_11/libc/sysdeps/x86_64/fpu/e_powl.S (original)
+++ branches/eglibc-2_11/libc/sysdeps/x86_64/fpu/e_powl.S Fri May 27 10:01:54 2011
@@ -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@xxxxxxxxxx>, 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

Modified: branches/eglibc-2_11/libc/wcsmbs/wchar.h
==============================================================================
--- branches/eglibc-2_11/libc/wcsmbs/wchar.h (original)
+++ branches/eglibc-2_11/libc/wcsmbs/wchar.h Fri May 27 10:01:54 2011
@@ -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.  */