[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-svn
Subject:    [Ipcop-svn] SF.net SVN: ipcop:[6749] ipcop/trunk
From:       gespinasse () users ! sourceforge ! net
Date:       2012-08-05 10:08:06
Message-ID: E1Sxxkk-00034J-AI () sfp-svn-2 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 6749
          http://ipcop.svn.sourceforge.net/ipcop/?rev=6749&view=rev
Author:   gespinasse
Date:     2012-08-05 10:08:06 +0000 (Sun, 05 Aug 2012)
Log Message:
-----------
glibc-2.11 update and cleanup

Move GCCOPTIONS and CFLAGS definition earlier as that's where we usually define \
makefile variables Add -fno-strict-aliasing to CFLAGS, that's how opensuse build \
glibc-2.11 and that remove a lot of warnings

Remove one CFLAGS="$(CFLAGS)" before base configure as useless. Not so logic but \
that's how I tested, I haven't tried but doing the same on toolchain, that should not \
hurt Let the build log be verbose again, that's needed to see a CFLAGS change.
Update to last glibc-2.11 git change and fix a few other issues.

Not finished, there is still more cleanup and patch to do.

Modified Paths:
--------------
    ipcop/trunk/lfs/glibc

Added Paths:
-----------
    ipcop/trunk/src/patches/glibc-2.11.3_git2012-05-13.patch
    ipcop/trunk/src/patches/glibc-2.11.3_posix-bug-regex32.patch
    ipcop/trunk/src/patches/glibc-check-native-missing-include.patch
    ipcop/trunk/src/patches/glibc_fwrite-no-attr-unused.patch
    ipcop/trunk/src/patches/glibc_int-malloc-fb.patch

Modified: ipcop/trunk/lfs/glibc
===================================================================
--- ipcop/trunk/lfs/glibc	2012-08-05 07:58:45 UTC (rev 6748)
+++ ipcop/trunk/lfs/glibc	2012-08-05 10:08:06 UTC (rev 6749)
@@ -44,10 +44,28 @@
 
 # Do not use hardening options to avoid breaking the build
 # we pass CFLAGS with configparms
-CFLAGS     = 
-CXXFLAGS   = 
+CXXFLAGS   =
 LDFLAGS    =
 
+# Use same settings for toolchain and base for simplicity
+# -Os trigger a bit more warnings but changing that here produce many different \
binaries not only in libc +ifeq "$(MACHINE)" "alpha"
+  GCCOPTION :=
+  CFLAGS := -O3 -march=ev4 -mtune=ev56 -mieee -pipe
+endif
+ifeq "$(MACHINE)" "i486"
+  GCCOPTION := -m32
+  CFLAGS := -march=i486 -mtune=pentium -Os -pipe -mno-tls-direct-seg-refs \
-fno-strict-aliasing +endif
+ifeq "$(MACHINE)" "ppc"
+  GCCOPTION := -m32
+  CFLAGS := -O3 -pipe
+endif
+ifeq "$(MACHINE)" "sparc"
+  GCCOPTION := -m32
+  CFLAGS := -mcpu=ultrasparc -O3 -pipe
+endif
+
 TARGET     = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
 
 
@@ -86,25 +104,6 @@
 # Installation Details
 ###############################################################################
 
-# Use same settings for toolchain and base for simplicity
-# config.cache is the easiest way for arch dependent settings
-ifeq "$(MACHINE)" "alpha"
-  GCCOPTION	=
-  CFLAGS = -O3 -march=ev4 -mtune=ev56 -mieee -pipe
-endif
-ifeq "$(MACHINE)" "i486"
-  GCCOPTION	= -m32
-  CFLAGS = -march=i486 -mtune=pentium -Os -pipe -mno-tls-direct-seg-refs
-endif
-ifeq "$(MACHINE)" "ppc"
-  GCCOPTION	= -m32
-  CFLAGS = -O3 -pipe
-endif
-ifeq "$(MACHINE)" "sparc"
-  GCCOPTION	= -m32
-  CFLAGS = -mcpu=ultrasparc -O3 -pipe
-endif
-
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build
@@ -112,8 +111,14 @@
 	# Toolchain and final glibc need to share exact same code, or random error/segfault \
may occure.  # This happen particulary as toolchain tcl for now is used to test final \
packages.  # If glibc code is patched, bumping toolchain number may be required.
-	cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/glibc-2.11.1_notimestamp.patch
-	cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/glibc-2.11_sparc-localedef-mmap.patch
+	cd $(DIR_APP) && patch -p1 -i $(DIR_PATCHES)/glibc-2.11.3_git2012-05-13.patch
+	cd $(DIR_APP) && patch -p1 -i $(DIR_PATCHES)/glibc-2.11.3_posix-bug-regex32.patch	# \
fix an incomplete new test +	cd $(DIR_APP) && patch -p0 -i \
$(DIR_PATCHES)/glibc-check-native-missing-include.patch	# fix implicit memset warning \
+	cd $(DIR_APP) && patch -p1 -i $(DIR_PATCHES)/glibc_int-malloc-fb.patch			# fix \
malloc.c warning 'fb' may be used uninitialized in unfrequent case +	cd $(DIR_APP) && \
patch -p0 -i $(DIR_PATCHES)/glibc_fwrite-no-attr-unused.patch		# silent ignoring \
return value of 'fwrite', changed on later glibc release +	#cd $(DIR_APP) && patch \
-p1 -i $(DIR_PATCHES)/glibc-CVE-2012-0864.patch +	cd $(DIR_APP) && patch -p1 -i \
$(DIR_PATCHES)/glibc-2.11.1_notimestamp.patch +	cd $(DIR_APP) && patch -p1 -i \
$(DIR_PATCHES)/glibc-2.11_sparc-localedef-mmap.patch  
 	@mkdir $(DIR_SRC)/glibc-build
 
@@ -146,7 +151,7 @@
 			ac_cv_prog_MSGFMT=""			\
 			libc_cv_ranlib_necessary=no
 
-	cd $(DIR_SRC)/glibc-build && make -j$(PARALLELISM) -s
+	cd $(DIR_SRC)/glibc-build && make -j$(PARALLELISM)
 	mkdir -p /$(TOOLS_DIR)/etc
 	touch /$(TOOLS_DIR)/etc/ld.so.conf
 	cd $(DIR_SRC)/glibc-build && make install
@@ -162,7 +167,6 @@
 	# We don't install any other shells than bash, but just in case, force ldd to use \
bash  cd $(DIR_APP) && sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
 	cd $(DIR_SRC)/glibc-build &&				\
-		CFLAGS="$(CFLAGS)"				\
 		../$(THISAPP)/configure				\
 			--prefix=/usr				\
 			--host=$(TARGET_2)			\
@@ -177,19 +181,18 @@
 			libc_cv_pic_default=yes			\
 			libc_cv_ranlib_necessary=no
 
+	# Contrary to HLFS, gcc is not yet hardened by default, so only adding -fPIC is \
required  echo "#1st run to build libs with -fPIC only" > \
$(DIR_SRC)/glibc-build/configparms  echo "build-programs=no" >> \
                $(DIR_SRC)/glibc-build/configparms
-	#echo "CC += -fPIC -fno-stack-protector -U_FORTIFY_SOURCE -nonow -nopie" >> \
                $(DIR_SRC)/glibc-build/configparms
-	#echo "CCX += -fPIC -fno-stack-protector -U_FORTIFY_SOURCE -nonow -nopie" >> \
$(DIR_SRC)/glibc-build/configparms  echo "CC += -fPIC -fno-stack-protector \
-U_FORTIFY_SOURCE" >> $(DIR_SRC)/glibc-build/configparms  echo "CCX += -fPIC \
-fno-stack-protector -U_FORTIFY_SOURCE" >> $(DIR_SRC)/glibc-build/configparms  # \
                Comment the -s if more verbose log is needed for debugging the build
-	cd $(DIR_SRC)/glibc-build && make -j $(PARALLELISM) -s
+	cd $(DIR_SRC)/glibc-build && make -j $(PARALLELISM)
 
 	echo "#2nd run to build hardened programs" > $(DIR_SRC)/glibc-build/configparms
 	echo "CC += -fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2" >> \
$(DIR_SRC)/glibc-build/configparms  echo "CCX += -fPIE -fstack-protector-all \
                -D_FORTIFY_SOURCE=2" >> $(DIR_SRC)/glibc-build/configparms
-	cd $(DIR_SRC)/glibc-build && make -j $(PARALLELISM) -s
+	cd $(DIR_SRC)/glibc-build && make -j $(PARALLELISM)
 	# LFS borrowed, copy a file from the source tree into build tree to prevent a \
couple of test failures  cd $(DIR_SRC)/glibc-build && cp -v \
../$(THISAPP)/iconvdata/gconv-modules iconvdata  

Added: ipcop/trunk/src/patches/glibc-2.11.3_git2012-05-13.patch
===================================================================
--- ipcop/trunk/src/patches/glibc-2.11.3_git2012-05-13.patch	                        \
                (rev 0)
+++ ipcop/trunk/src/patches/glibc-2.11.3_git2012-05-13.patch	2012-08-05 10:08:06 UTC \
(rev 6749) @@ -0,0 +1,3360 @@
+git clone git://sourceware.org/git/glibc.git
+git checkout remotes/origin/release/2.11/master -b glibc-2.11
+git diff glibc-2.11.3.. > glibc-2.11.3_git2012-05-13.patch
+
+diff --git a/ChangeLog b/ChangeLog
+index 49dcad6..2e9a516 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,369 @@
++2011-05-29  Ulrich Drepper  <drepper@gmail.com>
++
++	[BZ #12350]
++	* sysdeps/posix/getaddrinfo.c (gethosts): Restore only RES_USE_IENT6
++	bit from old_res_options.
++	(gaih_inet): Likewise.
++
++2011-05-28  Ulrich Drepper  <drepper@gmail.com>
++
++	[BZ #12811]
++	* posix/regex_internal.c (build_wcs_buffer): Don't signal we have to
++	grow the buffers more if it already has to be sufficient.
++	(build_wcs_upper_buffer): Likewise.
++	* posix/regexec.c (check_matching): Likewise.
++	(clean_state_log_if_needed): Likewise.
++	(extend_buffers): Don't enlarge buffers beyond size of the input
++	buffer.
++	Patches mostly by Emil Wojak <emil@wojak.eu>.
++	* posix/bug-regex32.c: New file.
++	* posix/Makefile (tests): Add bug-regex32.
++
++2011-05-14  Ulrich Drepper  <drepper@gmail.com>
++
++	* iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before
++	storing incomplete byte sequence in state object.
++
++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-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-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-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]
+diff --git a/conform/data/netdb.h-data b/conform/data/netdb.h-data
+index 483a3fc..0e22d7e 100644
+--- a/conform/data/netdb.h-data
++++ b/conform/data/netdb.h-data
+@@ -87,7 +87,7 @@ function int getaddrinfo (const char*, const char*, const struct \
addrinfo*, stru + 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)
+diff --git a/elf/dl-deps.c b/elf/dl-deps.c
+index 7191508..b2f6a46 100644
+--- a/elf/dl-deps.c
++++ b/elf/dl-deps.c
+@@ -491,6 +491,10 @@ _dl_map_object_deps (struct link_map *map,
+   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)
+     {
+@@ -666,8 +670,4 @@ Filters not supported with LD_TRACE_PRELINKING"));
+     }
+   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);
+ }
+diff --git a/elf/dl-dst.h b/elf/dl-dst.h
+index 76076a6..9d219e2 100644
+--- a/elf/dl-dst.h
++++ b/elf/dl-dst.h
+@@ -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
+diff --git a/elf/dl-load.c b/elf/dl-load.c
+index aa324d1..72e78be 100644
+--- a/elf/dl-load.c
++++ b/elf/dl-load.c
+@@ -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 @@ local_strdup (const char *s)
+ }
+ 
+ 
++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 @@ is_dst (const char *start, const char *name, const char *str,
+     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 @@ _dl_dst_substitute (struct link_map *l, const char *name, char \
*result, + 		    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 @@ _dl_dst_substitute (struct link_map *l, const char *name, char \
*result, + 	      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 @@ _dl_dst_substitute (struct link_map *l, const char *name, char \
*result, + 	      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 @@ _dl_dst_substitute (struct link_map *l, const char *name, char \
*result, + 	{
+ 	  *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 @@ _dl_dst_substitute (struct link_map *l, const char *name, char \
*result, +    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 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
+   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 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
+   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 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, \
const char *sep, + 	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,13 +633,21 @@ decompose_rpath (struct r_search_path_struct *sps,
+ 
+   /* 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)
+@@ -2100,7 +2190,9 @@ _dl_map_object (struct link_map *loader, const char *name,
+ 	    {
+ #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 +2258,7 @@ _dl_map_object (struct link_map *loader, const char *name,
+     {
+       /* 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;
+diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
+index 763ec16..8f37cac 100644
+--- a/elf/dl-lookup.c
++++ b/elf/dl-lookup.c
+@@ -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 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
+ 		 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 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
+ 		      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 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
+ 		  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);
+diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
+index 6847eda..ae2d05c 100644
+--- a/elf/dl-runtime.c
++++ b/elf/dl-runtime.c
+@@ -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 @@ _dl_call_pltexit (struct link_map *l, ElfW(Word) reloc_arg,
+ 
+   /* 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,
+diff --git a/elf/dl-tls.c b/elf/dl-tls.c
+index 824adc1..ea94aa0 100644
+--- a/elf/dl-tls.c
++++ b/elf/dl-tls.c
+@@ -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,9 +33,6 @@
+    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
+diff --git a/elf/ldconfig.c b/elf/ldconfig.c
+index 6ba8e07..c11b1f5 100644
+--- a/elf/ldconfig.c
++++ b/elf/ldconfig.c
+@@ -384,14 +384,17 @@ add_dir (const char *line)
+     }
+ 
+   /* 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)
+diff --git a/iconv/loop.c b/iconv/loop.c
+index da11bc2..72fef94 100644
+--- a/iconv/loop.c
++++ b/iconv/loop.c
+@@ -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 @@ SINGLE(LOOPFCT) (struct __gconv_step *step,
+     {
+       *inptrp = inend;
+ #ifdef STORE_REST
++      while (inptr < inend)
++	bytebuf[inlen++] = *inptr++;
++
+       inptr = bytebuf;
+       inptrp = &inptr;
+       inend = &bytebuf[inlen];
+diff --git a/include/alloca.h b/include/alloca.h
+index 9a4b5c7..b99c3d1 100644
+--- a/include/alloca.h
++++ b/include/alloca.h
+@@ -14,6 +14,7 @@ extern void *__alloca (size_t __size);
+ 
+ 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
+ 
+diff --git a/include/atomic.h b/include/atomic.h
+index 37d0111..fc4023b 100644
+--- a/include/atomic.h
++++ b/include/atomic.h
+@@ -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
+diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
+index db6b5c7..6fb6ad6 100644
+--- a/inet/getnameinfo.c
++++ b/inet/getnameinfo.c
+@@ -159,7 +159,7 @@ nrl_domainname (void)
+ 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 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char \
*host, + 	break;
+ 
+       default:
+-        return EAI_FAMILY;
++	return EAI_FAMILY;
+     }
+ 
+   if (serv && (servlen > 0))
+diff --git a/io/fcntl.h b/io/fcntl.h
+index 2a2a29d..50559ca 100644
+--- a/io/fcntl.h
++++ b/io/fcntl.h
+@@ -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 @@ __BEGIN_DECLS
+ # 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
+diff --git a/libio/fileops.c b/libio/fileops.c
+index 4698953..1e7ef07 100644
+--- a/libio/fileops.c
++++ b/libio/fileops.c
+@@ -290,7 +290,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
+ #ifdef _LIBC
+   last_recognized = mode;
+ #endif
+-  for (i = 1; i < 6; ++i)
++  for (i = 1; i < 7; ++i)
+     {
+       switch (*++mode)
+ 	{
+@@ -997,18 +997,18 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
+       /* 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)
+@@ -1270,7 +1270,7 @@ _IO_new_file_write (f, data, n)
+ 	{
+ 	  f->_flags |= _IO_ERR_SEEN;
+ 	  break;
+-        }
++	}
+       to_do -= count;
+       data = (void *) ((char *) data + count);
+     }
+@@ -1358,12 +1358,12 @@ _IO_new_file_xsputn (f, data, n)
+       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,
+diff --git a/libio/fmemopen.c b/libio/fmemopen.c
+index d3750fc..1a631d5 100644
+--- a/libio/fmemopen.c
++++ b/libio/fmemopen.c
+@@ -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 @@ fmemopen (void *buf, size_t len, const char *mode)
+   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;
+diff --git a/login/programs/pt_chown.c b/login/programs/pt_chown.c
+index 4c36f2c..9aa34e7 100644
+--- a/login/programs/pt_chown.c
++++ b/login/programs/pt_chown.c
+@@ -64,7 +64,7 @@ print_version (FILE *stream, struct argp_state *state)
+ 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 @@ do_pt_chown (void)
+ 
+   /* 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,
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 29c7992..8f5ab77 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -2832,7 +2832,7 @@ static void do_check_malloc_state(mstate av)
+   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
+diff --git a/math/Makefile b/math/Makefile
+index 7e3a626..45954e2 100644
+--- a/math/Makefile
++++ b/math/Makefile
+@@ -90,7 +90,8 @@ distribute += $(filter-out $(generated),$(long-m-yes:=.c) \
$(long-c-yes:=.c)) + # 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
+@@ -131,6 +132,7 @@ CFLAGS-test-ldouble.c = -fno-inline -ffloat-store -fno-builtin
+ 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__ \
+diff --git a/math/test-powl.c b/math/test-powl.c
+new file mode 100644
+index 0000000..c464d78
+--- /dev/null
++++ b/math/test-powl.c
+@@ -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;
++}
+diff --git a/misc/error.c b/misc/error.c
+index 85d1cff..9a73a61 100644
+--- a/misc/error.c
++++ b/misc/error.c
+@@ -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
+@@ -272,7 +272,9 @@ error_at_line (int status, int errnum, const char *file_name,
+ 
+       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;
+ 
+diff --git a/misc/mntent_r.c b/misc/mntent_r.c
+index 9598528..6959f0e 100644
+--- a/misc/mntent_r.c
++++ b/misc/mntent_r.c
+@@ -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 @@ __addmntent (FILE *stream, const struct mntent *mnt)
+ 		   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)
+ 
+diff --git a/nptl/ChangeLog b/nptl/ChangeLog
+index 73c65e6..ae6a121 100644
+--- a/nptl/ChangeLog
++++ b/nptl/ChangeLog
+@@ -1,3 +1,21 @@
++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.
+diff --git a/nptl/Versions b/nptl/Versions
+index 09098bf..285ff4c 100644
+--- a/nptl/Versions
++++ b/nptl/Versions
+@@ -27,6 +27,7 @@ libc {
+     pthread_cond_broadcast; pthread_cond_timedwait;
+   }
+   GLIBC_PRIVATE {
++    __libc_alloca_cutoff;
+     # Internal libc interface to libpthread
+     __libc_dl_error_tsd;
+   }
+diff --git a/nptl/alloca_cutoff.c b/nptl/alloca_cutoff.c
+index ba26ceb..bbd930a 100644
+--- a/nptl/alloca_cutoff.c
++++ b/nptl/alloca_cutoff.c
+@@ -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 @@ __libc_alloca_cutoff (size_t size)
+ 			  assume the maximum available stack space.  */
+ 		       ?: __MAX_ALLOCA_CUTOFF * 4));
+ }
++libc_hidden_def (__libc_alloca_cutoff)
+diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
+index 3c3585f..81c8333 100644
+--- a/nptl/allocatestack.c
++++ b/nptl/allocatestack.c
+@@ -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 @@ get_cached_stack (size_t *sizep, void **memp)
+ 
+   /* 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 @@ allocate_stack (const struct pthread_attr *attr, struct pthread \
**pdp, + 	    {
+ 	      int err;
+ 	    mprot_error:
+-	      err = errno;
++	      err = errno == ENOMEM ? EAGAIN : errno;
+ 
+ 	      lll_lock (stack_cache_lock, LLL_PRIVATE);
+ 
+diff --git a/nscd/hstcache.c b/nscd/hstcache.c
+index 228f6fd..a6055cf 100644
+--- a/nscd/hstcache.c
++++ b/nscd/hstcache.c
+@@ -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 @@ static const hst_response_header notfound =
+ };
+ 
+ 
++/* 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 @@ cache_addhst (struct database_dyn *db, int fd, request_header \
*req, +       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 @@ cache_addhst (struct database_dyn *db, int fd, request_header \
*req, + 					   ? 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 @@ addhstbyX (struct database_dyn *db, int fd, request_header *req,
+ 	      /* 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;
+ 	    }
+diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
+index e5f5b48..83de650 100644
+--- a/nss/nss_files/files-hosts.c
++++ b/nss/nss_files/files-hosts.c
+@@ -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 @@ _nss_files_get##name##_r (proto,					      \
+ 	  && _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 @@ _nss_files_get##name##_r (proto,					      \
+ 		    }							      \
+ 		  /* 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 @@ _nss_files_get##name##_r (proto,					      \
+ 		      *errnop = ERANGE;					      \
+ 		      *herrnop = NETDB_INTERNAL;			      \
+ 		      status = NSS_STATUS_TRYAGAIN;			      \
+-		      break;						      \
++		      goto out;						      \
+ 		    }							      \
+ 									      \
+ 		  new_h_addr_list =					      \
+@@ -268,8 +271,54 @@ _nss_files_get##name##_r (proto,					      \
+ 		}							      \
+ 	    }								      \
+ 									      \
+-	  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);						      \
+ 	}								      \
+ 									      \
+ 									      \
+diff --git a/posix/Makefile b/posix/Makefile
+index 4c9ff85..df8fc47 100644
+--- a/posix/Makefile
++++ b/posix/Makefile
+@@ -82,7 +82,7 @@ tests		:= tstgetopt testfnm runtests runptests	     \
+ 		   bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
+ 		   bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
+ 		   bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
+-		   bug-regex29 bug-regex30 bug-regex31 \
++		   bug-regex29 bug-regex30 bug-regex31 bug-regex32 \
+ 		   tst-nice tst-nanosleep tst-regex2 \
+ 		   transbug tst-rxspencer tst-pcre tst-boost \
+ 		   bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
+diff --git a/posix/bug-regex32.c b/posix/bug-regex32.c
+new file mode 100644
+index 0000000..525232c
+--- /dev/null
++++ b/posix/bug-regex32.c
+@@ -0,0 +1,36 @@
++// BZ 12811
++#include <regex.h>
++#include <stdio.h>
++#include <locale.h>
++
++static int
++do_test (void)
++{
++  char buf[1000];
++  regex_t preg;
++  if (setlocale (LC_CTYPE, "de_DE.UTF-8") == NULL)
++    {
++      puts ("setlocale failed");
++      return 1;
++    }
++
++  int e = regcomp (&preg, ".*ab", REG_ICASE);
++  if (e != 0)
++    {
++      regerror (e, &preg, buf, sizeof (buf));
++      printf ("regcomp = %d \"%s\"\n", e, buf);
++      return 1;
++    }
++
++  // Incomplete character at the end of the buffer
++  e = regexec (&preg, "aaaaaaaaaaaa\xc4", 0, NULL, 0);
++
++  regfree (&preg);
++  regerror (e, &preg, buf, sizeof (buf));
++  printf ("regexec = %d \"%s\"\n", e, buf);
++
++  return e != REG_NOMATCH;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+diff --git a/posix/fnmatch.c b/posix/fnmatch.c
+index 0af5ee6..819a6a7 100644
+--- a/posix/fnmatch.c
++++ b/posix/fnmatch.c
+@@ -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.
+ 
+@@ -375,6 +375,11 @@ fnmatch (pattern, string, flags)
+ 	       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));
+@@ -419,6 +424,12 @@ fnmatch (pattern, string, flags)
+ 	       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));
+diff --git a/posix/regex_internal.c b/posix/regex_internal.c
+index 09cffcf..6e75f47 100644
+--- a/posix/regex_internal.c
++++ b/posix/regex_internal.c
+@@ -237,13 +237,8 @@ build_wcs_buffer (re_string_t *pstr)
+       else
+ 	p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx;
+       mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
+-      if (BE (mbclen == (size_t) -2, 0))
+-	{
+-	  /* The buffer doesn't have enough space, finish to build.  */
+-	  pstr->cur_state = prev_st;
+-	  break;
+-	}
+-      else if (BE (mbclen == (size_t) -1 || mbclen == 0, 0))
++      if (BE (mbclen == (size_t) -1 || mbclen == 0
++	      || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len), 0))
+ 	{
+ 	  /* We treat these cases as a singlebyte character.  */
+ 	  mbclen = 1;
+@@ -252,6 +247,12 @@ build_wcs_buffer (re_string_t *pstr)
+ 	    wc = pstr->trans[wc];
+ 	  pstr->cur_state = prev_st;
+ 	}
++      else if (BE (mbclen == (size_t) -2, 0))
++	{
++	  /* The buffer doesn't have enough space, finish to build.  */
++	  pstr->cur_state = prev_st;
++	  break;
++	}
+ 
+       /* Write wide character and padding.  */
+       pstr->wcs[byte_idx++] = wc;
+@@ -334,9 +335,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
+ 	      for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
+ 		pstr->wcs[byte_idx++] = WEOF;
+ 	    }
+-	  else if (mbclen == (size_t) -1 || mbclen == 0)
++	  else if (mbclen == (size_t) -1 || mbclen == 0
++		   || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
+ 	    {
+-	      /* It is an invalid character or '\0'.  Just use the byte.  */
++	      /* It is an invalid character, an incomplete character
++		 at the end of the string, or '\0'.  Just use the byte.  */
+ 	      int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
+ 	      pstr->mbs[byte_idx] = ch;
+ 	      /* And also cast it to wide char.  */
+@@ -449,7 +452,8 @@ build_wcs_upper_buffer (re_string_t *pstr)
+ 	    for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
+ 	      pstr->wcs[byte_idx++] = WEOF;
+ 	  }
+-	else if (mbclen == (size_t) -1 || mbclen == 0)
++	else if (mbclen == (size_t) -1 || mbclen == 0
++		 || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
+ 	  {
+ 	    /* It is an invalid character or '\0'.  Just use the byte.  */
+ 	    int ch = pstr->raw_mbs[pstr->raw_mbs_idx + src_idx];
+diff --git a/posix/regexec.c b/posix/regexec.c
+index 8481b61..756682e 100644
+--- a/posix/regexec.c
++++ b/posix/regexec.c
+@@ -1,5 +1,5 @@
+ /* Extended regular expression matching and search library.
+-   Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
++   Copyright (C) 2002-2005,2007,2009,2010,2011 Free Software Foundation, Inc.
+    This file is part of the GNU C Library.
+    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
+ 
+@@ -1134,12 +1134,13 @@ check_matching (re_match_context_t *mctx, int \
fl_longest_match, +       re_dfastate_t *old_state = cur_state;
+       int next_char_idx = re_string_cur_idx (&mctx->input) + 1;
+ 
+-      if (BE (next_char_idx >= mctx->input.bufs_len, 0)
+-          || (BE (next_char_idx >= mctx->input.valid_len, 0)
+-              && mctx->input.valid_len < mctx->input.len))
+-        {
+-          err = extend_buffers (mctx);
+-          if (BE (err != REG_NOERROR, 0))
++      if ((BE (next_char_idx >= mctx->input.bufs_len, 0)
++	   && mctx->input.bufs_len < mctx->input.len)
++	  || (BE (next_char_idx >= mctx->input.valid_len, 0)
++	      && mctx->input.valid_len < mctx->input.len))
++	{
++	  err = extend_buffers (mctx);
++	  if (BE (err != REG_NOERROR, 0))
+ 	    {
+ 	      assert (err == REG_ESPACE);
+ 	      return -2;
+@@ -1710,7 +1711,8 @@ clean_state_log_if_needed (re_match_context_t *mctx, int \
next_state_log_idx) + {
+   int top = mctx->state_log_top;
+ 
+-  if (next_state_log_idx >= mctx->input.bufs_len
++  if ((next_state_log_idx >= mctx->input.bufs_len
++       && mctx->input.bufs_len < mctx->input.len)
+       || (next_state_log_idx >= mctx->input.valid_len
+ 	  && mctx->input.valid_len < mctx->input.len))
+     {
+@@ -3347,6 +3349,8 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
+ 	{
+ 	  state->trtable = (re_dfastate_t **)
+ 	    calloc (sizeof (re_dfastate_t *), SBC_MAX);
++	  if (BE (state->trtable == NULL, 0))
++	    return 0;
+ 	  return 1;
+ 	}
+       return 0;
+@@ -4072,7 +4076,7 @@ extend_buffers (re_match_context_t *mctx)
+   re_string_t *pstr = &mctx->input;
+ 
+   /* Double the lengthes of the buffers.  */
+-  ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
++  ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2));
+   if (BE (ret != REG_NOERROR, 0))
+     return ret;
+ 
+diff --git a/resolv/netdb.h b/resolv/netdb.h
+index 06e9a9a..bc8b6f4 100644
+--- a/resolv/netdb.h
++++ b/resolv/netdb.h
+@@ -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 __const char *gai_strerror (int __ecode) __THROW;
+ 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
+diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
+index 8592183..fe4ac2d 100644
+--- a/resolv/nss_dns/dns-host.c
++++ b/resolv/nss_dns/dns-host.c
+@@ -599,7 +599,6 @@ getanswer_r (const querybuf *answer, int anslen, const char \
*qname, int qtype, +   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 @@ getanswer_r (const querybuf *answer, int anslen, const char \
*qname, int qtype, +       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 @@ getanswer_r (const querybuf *answer, int anslen, const char \
*qname, int qtype, + 	    {
+ 	      register int nn;
+ 
+-	      if (ttlp != NULL && ttl != 0)
++	      if (ttlp != NULL)
+ 		*ttlp = ttl;
+ 	      if (canonp != NULL)
+ 		*canonp = bp;
+@@ -1163,7 +1162,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, \
const char *qname, + 
+       if (*firstp)
+ 	{
+-	  if (ttl != 0 && ttlp != NULL)
++	  if (ttlp != NULL)
+ 	    *ttlp = ttl;
+ 
+ 	  (*pat)->name = canon ?: h_name;
+diff --git a/resolv/res_debug.c b/resolv/res_debug.c
+index f7996a7..3daa44e 100644
+--- a/resolv/res_debug.c
++++ b/resolv/res_debug.c
+@@ -189,7 +189,7 @@ do_section(const res_state statp,
+ 						buf = malloc(buflen += 1024);
+ 					if (buf == NULL) {
+ 						fprintf(file,
+-				              ";; memory allocation failure\n");
++					      ";; memory allocation failure\n");
+ 					      return;
+ 					}
+ 					continue;
+@@ -356,7 +356,7 @@ const struct res_sym __p_class_syms[] = {
+ 	{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 @@ p_option(u_long option) {
+ 	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);
+diff --git a/resolv/res_init.c b/resolv/res_init.c
+index 74715f3..7588432 100644
+--- a/resolv/res_init.c
++++ b/resolv/res_init.c
+@@ -545,6 +545,11 @@ res_setoptions(res_state statp, const char *options, const char \
*source) { + 		} 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? */
+ 		}
+diff --git a/resolv/res_query.c b/resolv/res_query.c
+index 5ff352e..26daf0d 100644
+--- a/resolv/res_query.c
++++ b/resolv/res_query.c
+@@ -123,7 +123,7 @@ __libc_res_nquery(res_state statp,
+ {
+ 	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 @@ __libc_res_nquery(res_state statp,
+ 			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 @@ __libc_res_nsearch(res_state statp,
+ 	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 @@ __libc_res_nsearch(res_state statp,
+ 		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 @@ __libc_res_nsearch(res_state statp,
+ 	}
+ 
+ 	/*
+-	 * 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);
+diff --git a/resolv/resolv.h b/resolv/resolv.h
+index e49c29d..ed15a70 100644
+--- a/resolv/resolv.h
++++ b/resolv/resolv.h
+@@ -102,7 +102,7 @@ typedef res_sendhookact (*res_send_rhook) (const struct \
sockaddr_in *__ns, + # 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 @@ struct res_sym {
+ #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)
+ 
+diff --git a/shadow/sgetspent.c b/shadow/sgetspent.c
+index ec7f384..f3dce53 100644
+--- a/shadow/sgetspent.c
++++ b/shadow/sgetspent.c
+@@ -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 @@ sgetspent (const char *string)
+     }
+ 
+   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;
+diff --git a/stdio-common/Makefile b/stdio-common/Makefile
+index 9cbf143..6c71f1c 100644
+--- a/stdio-common/Makefile
++++ b/stdio-common/Makefile
+@@ -1,4 +1,4 @@
+-# Copyright (C) 1991-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
++# Copyright (C) 1991-2009, 2011 Free Software Foundation, Inc.
+ # This file is part of the GNU C Library.
+ 
+ # The GNU C Library is free software; you can redistribute it and/or
+@@ -60,7 +60,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
+ 	 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
+ 	 tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
+ 	 bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
+-	 scanf16 scanf17 tst-setvbuf1
++	 scanf16 scanf17 tst-setvbuf1 tst-grouping bug23
+ 
+ test-srcs = tst-unbputc tst-printf
+ 
+@@ -128,6 +128,7 @@ test-vfprintf-ENV = LOCPATH=$(common-objpfx)localedata
+ 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
+diff --git a/stdio-common/_i18n_number.h b/stdio-common/_i18n_number.h
+index 8bb5619..43ed17e 100644
+--- a/stdio-common/_i18n_number.h
++++ b/stdio-common/_i18n_number.h
+@@ -30,8 +30,8 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
+ # 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
+@@ -47,13 +47,19 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
+       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
+ 
+diff --git a/stdio-common/bug23.c b/stdio-common/bug23.c
+new file mode 100644
+index 0000000..dcc5428
+--- /dev/null
++++ b/stdio-common/bug23.c
+@@ -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"
+diff --git a/stdio-common/printf-parsemb.c b/stdio-common/printf-parsemb.c
+index efd1eca..a67cc1a 100644
+--- a/stdio-common/printf-parsemb.c
++++ b/stdio-common/printf-parsemb.c
+@@ -295,9 +295,9 @@ __parse_one_specmb (const UCHAR_T *format, size_t posn,
+       /* 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;
+diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
+index b60ddec..e9ff168 100644
+--- a/stdio-common/printf_fp.c
++++ b/stdio-common/printf_fp.c
+@@ -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.
+@@ -884,7 +884,9 @@ ___printf_fp (FILE *fp,
+ 	/* Guess the number of groups we will make, and thus how
+ 	   many spaces we need for separator characters.  */
+ 	ngroups = __guess_grouping (intdig_max, grouping);
+-	chars_needed += ngroups;
++	/* Allocate one more character in case rounding increases the
++	   number of groups.  */
++	chars_needed += ngroups + 1;
+       }
+ 
+     /* Allocate buffer for output.  We need two more because while rounding
+@@ -1088,9 +1090,16 @@ ___printf_fp (FILE *fp,
+       --wcp;
+ 
+     if (grouping)
+-      /* Add in separator characters, overwriting the same buffer.  */
+-      wcp = group_number (wstartp, wcp, intdig_no, grouping, thousands_sepwc,
+-			  ngroups);
++      {
++	/* Rounding might have changed the number of groups.  We allocated
++	   enough memory but we need here the correct number of groups.  */
++	if (intdig_no != intdig_max)
++	  ngroups = __guess_grouping (intdig_no, grouping);
++
++	/* Add in separator characters, overwriting the same buffer.  */
++	wcp = group_number (wstartp, wcp, intdig_no, grouping, thousands_sepwc,
++			    ngroups);
++      }
+ 
+     /* Write the exponent if it is needed.  */
+     if (type != 'f')
+@@ -1210,7 +1219,7 @@ ___printf_fp (FILE *fp,
+ 
+       tmpptr = buffer;
+       if (__builtin_expect (info->i18n, 0))
+-        {
++	{
+ #ifdef COMPILE_WPRINTF
+ 	  wstartp = _i18n_number_rewrite (wstartp, wcp,
+ 					  wbuffer + wbuffer_to_alloc);
+@@ -1224,7 +1233,7 @@ ___printf_fp (FILE *fp,
+ 	  assert ((uintptr_t) buffer <= (uintptr_t) tmpptr);
+ 	  assert ((uintptr_t) tmpptr < (uintptr_t) buffer_end);
+ #endif
+-        }
++	}
+ 
+       PRINT (tmpptr, wstartp, wide ? wcp - wstartp : cp - tmpptr);
+ 
+diff --git a/stdio-common/tst-grouping.c b/stdio-common/tst-grouping.c
+new file mode 100644
+index 0000000..e8f4b8c
+--- /dev/null
++++ b/stdio-common/tst-grouping.c
+@@ -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"
+diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
+index 6e0e85c..ab7fa13 100644
+--- a/stdio-common/vfprintf.c
++++ b/stdio-common/vfprintf.c
+@@ -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
+@@ -1676,7 +1676,8 @@ do_positional:
+ 	  {
+ 	    /* 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));
+diff --git a/stdlib/Makefile b/stdlib/Makefile
+index d361dd8..6b8e021 100644
+--- a/stdlib/Makefile
++++ b/stdlib/Makefile
+@@ -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
+@@ -70,7 +70,7 @@ tests		:= tst-strtol tst-strtod testmb testrand testsort testdiv   \
\ + 		   test-a64l tst-qsort tst-system testmb2 bug-strtod2	    \
+ 		   tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
+ 		   tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2	    \
+-		   tst-makecontext2 tst-strtod6 tst-unsetenv1
++		   tst-makecontext2 tst-strtod6 tst-unsetenv1 bug-getcontext
+ 
+ include ../Makeconfig
+ 
+@@ -144,3 +144,10 @@ $(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
+ $(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)
+diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
+new file mode 100644
+index 0000000..745aa1f
+--- /dev/null
++++ b/stdlib/bug-getcontext.c
+@@ -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"
+diff --git a/stdlib/msort.c b/stdlib/msort.c
+index 35cd4d0..fc58f0d 100644
+--- a/stdlib/msort.c
++++ b/stdlib/msort.c
+@@ -25,6 +25,7 @@
+ #include <unistd.h>
+ #include <memcopy.h>
+ #include <errno.h>
++#include <atomic.h>
+ 
+ struct msort_param
+ {
+@@ -182,7 +183,7 @@ qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void \
*arg) +       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 @@ qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void \
*arg) + 	     a quarter of the physical memory.  */
+ 	  phys_pages /= 4;
+ 
++	  /* Make sure phys_pages is written to memory.  */
++	  atomic_write_barrier ();
++
+ 	  pagesize = __sysconf (_SC_PAGESIZE);
+ 	}
+ 
+diff --git a/string/bits/string3.h b/string/bits/string3.h
+index 1d759f1..1647725 100644
+--- a/string/bits/string3.h
++++ b/string/bits/string3.h
+@@ -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 @@ __NTH (memcpy (void *__restrict __dest, __const void *__restrict \
__src, + }
+ 
+ __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 @@ __NTH (memset (void *__dest, int __ch, size_t __len))
+ 
+ #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));
+ }
+diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile
+index ef45ce6..3d9f3fc 100644
+--- a/sysdeps/i386/Makefile
++++ b/sysdeps/i386/Makefile
+@@ -47,6 +47,7 @@ endif
+ # 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
+diff --git a/sysdeps/i386/dl-tls.h b/sysdeps/i386/dl-tls.h
+index 58705c7..21b949b 100644
+--- a/sysdeps/i386/dl-tls.h
++++ b/sysdeps/i386/dl-tls.h
+@@ -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 @@ strong_alias (___tls_get_addr, ___tls_get_addr_internal)
+ 
+ # endif
+ #endif
++
++/* Value used for dtv entries for which the allocation is delayed.  */
++#define TLS_DTV_UNALLOCATED	((void *) -1l)
+diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
+index 5231789..4b1a9e7 100644
+--- a/sysdeps/i386/fpu/libm-test-ulps
++++ b/sysdeps/i386/fpu/libm-test-ulps
+@@ -857,8 +857,8 @@ ifloat: 1
+ 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":
+diff --git a/sysdeps/ia64/dl-tls.h b/sysdeps/ia64/dl-tls.h
+index 26f3d2a..5e9a165 100644
+--- a/sysdeps/ia64/dl-tls.h
++++ b/sysdeps/ia64/dl-tls.h
+@@ -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)
+diff --git a/sysdeps/mach/hurd/ifreq.h b/sysdeps/mach/hurd/ifreq.h
+new file mode 100644
+index 0000000..92cb7b9
+--- /dev/null
++++ b/sysdeps/mach/hurd/ifreq.h
+@@ -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));
++}
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index 8b7e38f..923d6c8 100644
+--- a/sysdeps/posix/getaddrinfo.c
++++ b/sysdeps/posix/getaddrinfo.c
+@@ -207,7 +207,7 @@ gaih_inet_serv (const char *servicename, const struct \
gaih_typeproto *tp, +       if (herrno == NETDB_INTERNAL)					      \
+ 	{								      \
+ 	  __set_h_errno (herrno);					      \
+-	  _res.options = old_res_options;				      \
++	  _res.options |= old_res_options & RES_USE_INET6;		      \
+ 	  return -EAI_SYSTEM;						      \
+ 	}								      \
+       if (herrno == TRY_AGAIN)						      \
+@@ -842,7 +842,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
+ 		nip = nip->next;
+ 	    }
+ 
+-	  _res.options = old_res_options;
++	  _res.options |= old_res_options & RES_USE_INET6;
+ 
+ 	  if (no_data != 0 && no_inet6_data != 0)
+ 	    {
+@@ -963,6 +963,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
+ 		   make a copy.  */
+ 		if (out == canon)
+ 		  goto make_copy;
++		canon = out;
+ 	      }
+ 	    else
+ #endif
+diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c
+index 29803a8..1c50f8e 100644
+--- a/sysdeps/posix/spawni.c
++++ b/sysdeps/posix/spawni.c
+@@ -142,9 +142,7 @@ __spawni (pid_t *pid, const char *file,
+     }
+   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
+diff --git a/sysdeps/powerpc/dl-tls.h b/sysdeps/powerpc/dl-tls.h
+index 957d4b4..9ab81f9 100644
+--- a/sysdeps/powerpc/dl-tls.h
++++ b/sysdeps/powerpc/dl-tls.h
+@@ -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 @@ extern void *__tls_get_addr (tls_index *ti);
+ # 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)
+diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S \
b/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S +index 12bf473..0f71a98 100644
+--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
++++ b/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
+@@ -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 @@ EALIGN (__isnanf, 4, 0)
+ L(NaN):
+ 	li	r3,1		/* else return 1 */
+ 	blr
+-	END (__isnan)
++	END (__isnanf)
+ 
+ hidden_def (__isnanf)
+ weak_alias (__isnanf, isnanf)
+-
+diff --git a/sysdeps/powerpc/powerpc64/power7/Makefile \
b/sysdeps/powerpc/powerpc64/power7/Makefile +new file mode 100644
+index 0000000..b0f4520
+--- /dev/null
++++ b/sysdeps/powerpc/powerpc64/power7/Makefile
+@@ -0,0 +1,5 @@
++ifeq ($(subdir),elf)
++# Prevent the use of VSX registers and insns in _dl_start, which under -O3
++# optimization may require a TOC reference before relocations are resolved.
++CFLAGS-rtld.c += -mno-vsx
++endif
+diff --git a/sysdeps/pthread/aio_misc.c b/sysdeps/pthread/aio_misc.c
+index c82acbb..ca3d111 100644
+--- a/sysdeps/pthread/aio_misc.c
++++ b/sysdeps/pthread/aio_misc.c
+@@ -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 int idle_thread_count;
+ 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 @@ __aio_init (const struct aioinit *init)
+   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)
+diff --git a/sysdeps/s390/dl-tls.h b/sysdeps/s390/dl-tls.h
+index 0560462..7295abc 100644
+--- a/sysdeps/s390/dl-tls.h
++++ b/sysdeps/s390/dl-tls.h
+@@ -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 @@ __tls_get_offset:\n\
+ # 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)
+diff --git a/sysdeps/sh/dl-tls.h b/sysdeps/sh/dl-tls.h
+index 98e2f19..cf60790 100644
+--- a/sysdeps/sh/dl-tls.h
++++ b/sysdeps/sh/dl-tls.h
+@@ -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 @@ typedef struct
+ 
+ 
+ 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)
+diff --git a/sysdeps/sparc/dl-tls.h b/sysdeps/sparc/dl-tls.h
+index 6edf8d5..fb2535e 100644
+--- a/sysdeps/sparc/dl-tls.h
++++ b/sysdeps/sparc/dl-tls.h
+@@ -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 @@ typedef struct
+ 
+ 
+ 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)
+diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c
+index 9372791..e166174 100644
+--- a/sysdeps/unix/readdir_r.c
++++ b/sysdeps/unix/readdir_r.c
+@@ -117,7 +117,8 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE \
**result) + #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
+diff --git a/sysdeps/unix/sysv/linux/bits/socket.h \
b/sysdeps/unix/sysv/linux/bits/socket.h +index f23b338..d77e34b 100644
+--- a/sysdeps/unix/sysv/linux/bits/socket.h
++++ b/sysdeps/unix/sysv/linux/bits/socket.h
+@@ -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 @@ enum __socket_type
+ #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 @@ enum __socket_type
+ #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.
+diff --git a/sysdeps/unix/sysv/linux/i386/bits/mman.h \
b/sysdeps/unix/sysv/linux/i386/bits/mman.h +index 7ac1aff..10fbd7e 100644
+--- a/sysdeps/unix/sysv/linux/i386/bits/mman.h
++++ b/sysdeps/unix/sysv/linux/i386/bits/mman.h
+@@ -1,5 +1,5 @@
+ /* Definitions for POSIX memory map interface.  Linux/i386 version.
+-   Copyright (C) 1997,2000,2003,2005,2006,2009,2010
++   Copyright (C) 1997,2000,2003,2005,2006,2009,2010,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
+ 
+diff --git a/sysdeps/unix/sysv/linux/ia64/bits/mman.h \
b/sysdeps/unix/sysv/linux/ia64/bits/mman.h +index 1b278c7..8b13989 100644
+--- a/sysdeps/unix/sysv/linux/ia64/bits/mman.h
++++ b/sysdeps/unix/sysv/linux/ia64/bits/mman.h
+@@ -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
+ 

@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic