From 1d78f2996dc94c04578e83d1df221811fbe13fc7 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Tue, 9 Mar 2010 20:21:12 -0800
Subject: [PATCH 01/76] Fix a few more problem with the recent setxid changes.

---
 nptl/ChangeLog                      |  8 ++++++++
 nptl/pthread_create.c               | 30 ++++++++++-------------------
 nptl/sysdeps/pthread/createthread.c | 19 +++++++++---------
 3 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index fa4c8f2f9f..f51ad43265 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-09  Ulrich Drepper  <drepper@redhat.com>
+
+	* pthread_create.c (__pthread_create_2_1): If priorities are incorrect
+	and the call fails wake eventually waiting setxid threads.  Don't free
+	stack here if we try starting a thread.
+	* sysdeps/pthread/createthread.c (do_clone): Only wake setxid waiter
+	if the clone call failed.
+
 2010-03-08  Andreas Schwab  <schwab@redhat.com>
 
 	* pthread_create.c (__pthread_create_2_1): Don't set setxid_futex.
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 14e3cf784b..34d83f94ad 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -537,33 +537,23 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
       if (pd->schedparam.sched_priority < minprio
 	  || pd->schedparam.sched_priority > maxprio)
 	{
-	  err = EINVAL;
-	  goto errout;
+	  /* Perhaps a thread wants to change the IDs and if waiting
+	     for this stillborn thread.  */
+	  if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0)
+				== -2, 0))
+	    lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE);
+
+	  __deallocate_stack (pd);
+
+	  return EINVAL;
 	}
     }
 
   /* Pass the descriptor to the caller.  */
   *newthread = (pthread_t) pd;
 
-  /* Remember whether the thread is detached or not.  In case of an
-     error we have to free the stacks of non-detached stillborn
-     threads.  */
-  bool is_detached = IS_DETACHED (pd);
-
   /* Start the thread.  */
-  err = create_thread (pd, iattr, STACK_VARIABLES_ARGS);
-  if (err != 0)
-    {
-      /* Something went wrong.  Free the resources.  */
-      if (!is_detached)
-	{
-	errout:
-	  __deallocate_stack (pd);
-	}
-      return err;
-    }
-
-  return 0;
+  return create_thread (pd, iattr, STACK_VARIABLES_ARGS);
 }
 versioned_symbol (libpthread, __pthread_create_2_1, pthread_create, GLIBC_2_1);
 
diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c
index 3bb3915281..8d96387a9a 100644
--- a/nptl/sysdeps/pthread/createthread.c
+++ b/nptl/sysdeps/pthread/createthread.c
@@ -75,19 +75,17 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
   int rc = ARCH_CLONE (fct, STACK_VARIABLES_ARGS, clone_flags,
 		       pd, &pd->tid, TLS_VALUE, &pd->tid);
 
-  /* Allow setxid from now onwards.  */
-  if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0) == -2, 0))
-    lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE);
-
   if (__builtin_expect (rc == -1, 0))
     {
       atomic_decrement (&__nptl_nthreads); /* Oops, we lied for a second.  */
 
-      /* Failed.  If the thread is detached, remove the TCB here since
-	 the caller cannot do this.  The caller remembered the thread
-	 as detached and cannot reverify that it is not since it must
-	 not access the thread descriptor again.  */
-      if (IS_DETACHED (pd))
+      /* Perhaps a thread wants to change the IDs and if waiting
+	 for this stillborn thread.  */
+      if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0)
+			    == -2, 0))
+	lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE);
+
+      /* Free the resources.  */
 	__deallocate_stack (pd);
 
       /* We have to translate error codes.  */
@@ -120,6 +118,9 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
 	      (void) INTERNAL_SYSCALL (tkill, err2, 2, pd->tid, SIGCANCEL);
 #endif
 
+	      /* We do not free the stack here because the canceled thread
+		 itself will do this.  */
+
 	      return (INTERNAL_SYSCALL_ERROR_P (res, err)
 		      ? INTERNAL_SYSCALL_ERRNO (res, err)
 		      : 0);

From fb084e5e80737932aac2d58091541f1bc245b5f9 Mon Sep 17 00:00:00 2001
From: Luis Machado <luisgpm@br.ibm.com>
Date: Wed, 10 Mar 2010 07:14:16 -0800
Subject: [PATCH 02/76] power7-optimized 64-bit and 32-bit memcpy

---
 ChangeLog                                 |   5 +
 sysdeps/powerpc/powerpc32/power7/memcpy.S | 469 ++++++++++++++++++++++
 sysdeps/powerpc/powerpc64/power7/memcpy.S | 449 +++++++++++++++++++++
 3 files changed, 923 insertions(+)
 create mode 100644 sysdeps/powerpc/powerpc32/power7/memcpy.S
 create mode 100644 sysdeps/powerpc/powerpc64/power7/memcpy.S

diff --git a/ChangeLog b/ChangeLog
index 7e5e7bb5b2..218545435a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-10  Luis Machado  <luisgpm@br.ibm.com>
+
+	* sysdeps/powerpc/powerpc64/power7/memcpy.S: New file.
+	* sysdeps/powerpc/powerpc32/power7/memcpy.S: New file.
+
 2010-03-09  David S. Miller  <davem@davemloft.net>
 
 	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Handling
diff --git a/sysdeps/powerpc/powerpc32/power7/memcpy.S b/sysdeps/powerpc/powerpc32/power7/memcpy.S
new file mode 100644
index 0000000000..d96ef20851
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power7/memcpy.S
@@ -0,0 +1,469 @@
+/* Optimized memcpy implementation for PowerPC32/POWER7.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+   Contributed by Luis Machado <luisgpm@br.ibm.com>.
+   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., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+#include <sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
+   Returns 'dst'.  */
+
+	.machine  power7
+EALIGN (BP_SYM (memcpy), 5, 0)
+	CALL_MCOUNT
+
+	stwu    1,-32(1)
+	cfi_adjust_cfa_offset(32)
+	stw	30,20(1)
+	cfi_offset(30,(20-32))
+	stw	31,24(1)
+	mr      30,3
+	cmplwi  cr1,5,31
+	neg	0,3
+	cfi_offset(31,-8)
+	ble	cr1, L(copy_LT_32)  /* If move < 32 bytes use short move
+				    code.  */
+
+	andi.   11,3,7	      /* Check alignment of DST.  */
+	clrlwi  10,4,29	      /* Check alignment of SRC.  */
+	cmplw   cr6,10,11     /* SRC and DST alignments match?  */
+	mr	12,4
+	mr	31,5
+	bne	cr6,L(copy_GE_32_unaligned)
+
+	srwi    9,5,3	      /* Number of full quadwords remaining.  */
+
+	beq	L(copy_GE_32_aligned_cont)
+
+	clrlwi  0,0,29
+	mtcrf   0x01,0
+	subf    31,0,5
+
+	/* Get the SRC aligned to 8 bytes.  */
+
+1:  	bf	31,2f
+    	lbz	6,0(12)
+    	addi    12,12,1
+    	stb	6,0(3)
+    	addi    3,3,1
+2:  	bf      30,4f
+    	lhz     6,0(12)
+    	addi    12,12,2
+    	sth     6,0(3)
+    	addi    3,3,2
+4:  	bf      29,0f
+    	lwz     6,0(12)
+    	addi    12,12,4
+    	stw     6,0(3)
+    	addi    3,3,4
+0:
+    	clrlwi  10,12,29      /* Check alignment of SRC again.  */
+    	srwi    9,31,3	      /* Number of full doublewords remaining.  */
+
+L(copy_GE_32_aligned_cont):
+
+    	clrlwi  11,31,29
+    	mtcrf   0x01,9
+
+    	srwi    8,31,5
+    	cmplwi  cr1,9,4
+    	cmplwi  cr6,11,0
+    	mr	11,12
+
+    	/* Copy 1~3 doublewords so the main loop starts
+    	at a multiple of 32 bytes.  */
+
+    	bf	30,1f
+    	lfd     6,0(12)
+    	lfd     7,8(12)
+    	addi    11,12,16
+    	mtctr   8
+    	stfd    6,0(3)
+    	stfd    7,8(3)
+    	addi    10,3,16
+    	bf      31,4f
+    	lfd     0,16(12)
+    	stfd    0,16(3)
+    	blt     cr1,3f
+    	addi    11,12,24
+    	addi    10,3,24
+    	b       4f
+
+    	.align  4
+1:  	/* Copy 1 doubleword and set the counter.  */
+    	mr	10,3
+    	mtctr   8
+    	bf      31,4f
+    	lfd     6,0(12)
+    	addi    11,12,8
+    	stfd    6,0(3)
+    	addi    10,3,8
+
+    	.align  4
+4:  	/* Main aligned copy loop. Copies 32-bytes at a time.  */
+    	lfd	6,0(11)
+    	lfd     7,8(11)
+    	lfd     8,16(11)
+    	lfd     0,24(11)
+    	addi    11,11,32
+
+    	stfd    6,0(10)
+    	stfd    7,8(10)
+    	stfd    8,16(10)
+    	stfd    0,24(10)
+    	addi    10,10,32
+    	bdnz    4b
+3:
+
+    	/* Check for tail bytes.  */
+
+    	clrrwi  0,31,3
+    	mtcrf   0x01,31
+    	beq	cr6,0f
+
+.L9:
+    	add	3,3,0
+    	add	12,12,0
+
+    	/*  At this point we have a tail of 0-7 bytes and we know that the
+    	destination is doubleword-aligned.  */
+4:  	/* Copy 4 bytes.  */
+    	bf	29,2f
+
+    	lwz     6,0(12)
+    	addi    12,12,4
+    	stw     6,0(3)
+    	addi    3,3,4
+2:  	/* Copy 2 bytes.  */
+    	bf	30,1f
+
+    	lhz     6,0(12)
+    	addi    12,12,2
+    	sth     6,0(3)
+    	addi    3,3,2
+1:  	/* Copy 1 byte.  */
+    	bf	31,0f
+
+    	lbz	6,0(12)
+    	stb	6,0(3)
+0:  	/* Return original DST pointer.  */
+    	mr	3,30
+    	lwz	30,20(1)
+    	lwz     31,24(1)
+    	addi    1,1,32
+    	blr
+
+    	/* Handle copies of 0~31 bytes.  */
+    	.align  4
+L(copy_LT_32):
+    	cmplwi  cr6,5,8
+    	mr	12,4
+    	mtcrf   0x01,5
+    	ble	cr6,L(copy_LE_8)
+
+    	/* At least 9 bytes to go.  */
+    	neg	8,4
+    	clrrwi  11,4,2
+    	andi.   0,8,3
+    	cmplwi  cr1,5,16
+    	mr	10,5
+    	beq	L(copy_LT_32_aligned)
+
+    	/* Force 4-bytes alignment for SRC.  */
+    	mtocrf  0x01,0
+    	subf    10,0,5
+2:  	bf	30,1f
+
+    	lhz	6,0(12)
+    	addi    12,12,2
+    	sth	6,0(3)
+    	addi    3,3,2
+1:  	bf	31,L(end_4bytes_alignment)
+
+    	lbz	6,0(12)
+    	addi    12,12,1
+    	stb	6,0(3)
+    	addi    3,3,1
+
+    	.align  4
+L(end_4bytes_alignment):
+    	cmplwi  cr1,10,16
+    	mtcrf   0x01,10
+
+L(copy_LT_32_aligned):
+    	/* At least 6 bytes to go, and SRC is word-aligned.  */
+    	blt	cr1,8f
+
+    	/* Copy 16 bytes.  */
+    	lwz	6,0(12)
+    	lwz     7,4(12)
+    	stw     6,0(3)
+    	lwz     8,8(12)
+    	stw     7,4(3)
+    	lwz     6,12(12)
+    	addi    12,12,16
+    	stw     8,8(3)
+    	stw     6,12(3)
+    	addi    3,3,16
+8:  	/* Copy 8 bytes.  */
+    	bf	28,4f
+
+    	lwz     6,0(12)
+    	lwz     7,4(12)
+    	addi    12,12,8
+    	stw     6,0(3)
+    	stw     7,4(3)
+    	addi    3,3,8
+4:  	/* Copy 4 bytes.  */
+    	bf	29,2f
+
+    	lwz     6,0(12)
+    	addi    12,12,4
+    	stw     6,0(3)
+    	addi    3,3,4
+2:  	/* Copy 2-3 bytes.  */
+    	bf	30,1f
+
+    	lhz     6,0(12)
+    	sth     6,0(3)
+    	bf      31,0f
+    	lbz     7,2(12)
+    	stb     7,2(3)
+
+    	/* Return original DST pointer.  */
+    	mr      3,30
+    	lwz     30,20(1)
+    	addi    1,1,32
+    	blr
+
+    	.align  4
+1:  	/* Copy 1 byte.  */
+    	bf	31,0f
+
+    	lbz	6,0(12)
+    	stb	6,0(3)
+0:  	/* Return original DST pointer.  */
+    	mr	3,30
+    	lwz	30,20(1)
+    	addi    1,1,32
+    	blr
+
+    	/* Handles copies of 0~8 bytes.  */
+    	.align  4
+L(copy_LE_8):
+    	bne	cr6,4f
+
+    	/* Though we could've used lfd/stfd here, they are still
+    	slow for unaligned cases.  */
+
+    	lwz	6,0(4)
+    	lwz     7,4(4)
+    	stw     6,0(3)
+    	stw     7,4(3)
+
+    	/* Return original DST pointer.  */
+    	mr      3,30
+    	lwz     30,20(1)
+    	addi    1,1,32
+    	blr
+
+    	.align  4
+4:  	/* Copies 4~7 bytes.  */
+    	bf	29,2b
+
+    	lwz	6,0(4)
+    	stw     6,0(3)
+    	bf      30,5f
+    	lhz     7,4(4)
+    	sth     7,4(3)
+    	bf      31,0f
+    	lbz     8,6(4)
+    	stb     8,6(3)
+
+    	/* Return original DST pointer.  */
+    	mr      3,30
+    	lwz     30,20(1)
+    	addi    1,1,32
+    	blr
+
+    	.align  4
+5:  	/* Copy 1 byte.  */
+    	bf	31,0f
+
+    	lbz	6,4(4)
+    	stb	6,4(3)
+
+0:  	/* Return original DST pointer.  */
+    	mr	3,30
+    	lwz     30,20(1)
+    	addi    1,1,32
+    	blr
+
+    	/* Handle copies of 32+ bytes where DST is aligned (to quadword) but
+    	SRC is not. Use aligned quadword loads from SRC, shifted to realign
+    	the data, allowing for aligned DST stores.  */
+    	.align  4
+L(copy_GE_32_unaligned):
+    	andi.   11,3,15	      /* Check alignment of DST.  */
+    	clrlwi  0,0,28	      /* Number of bytes until the 1st
+    	    		      quadword of DST.  */
+    	srwi    9,5,4	      /* Number of full quadwords remaining.  */
+
+    	beq    L(copy_GE_32_unaligned_cont)
+
+    	/* SRC is not quadword aligned, get it aligned.  */
+
+    	mtcrf   0x01,0
+    	subf    31,0,5
+
+    	/* Vector instructions work best when proper alignment (16-bytes)
+    	is present.  Move 0~15 bytes as needed to get DST quadword-aligned.  */
+1:  	/* Copy 1 byte.  */
+    	bf	31,2f
+
+    	lbz	6,0(12)
+    	addi    12,12,1
+    	stb	6,0(3)
+    	addi    3,3,1
+2:  	/* Copy 2 bytes.  */
+    	bf	    30,4f
+
+    	lhz     6,0(12)
+    	addi    12,12,2
+    	sth     6,0(3)
+    	addi    3,3,2
+4:  	/* Copy 4 bytes.  */
+    	bf	29,8f
+
+    	lwz     6,0(12)
+    	addi    12,12,4
+    	stw     6,0(3)
+    	addi    3,3,4
+8:  	/* Copy 8 bytes.  */
+    	bf	28,0f
+
+    	lfd	6,0(12)
+    	addi    12,12,8
+    	stfd    6,0(3)
+    	addi    3,3,8
+0:
+    	clrlwi  10,12,28      /* Check alignment of SRC.  */
+    	srdi    9,31,4	      /* Number of full quadwords remaining.  */
+
+    	/* The proper alignment is present, it is OK to copy the bytes now.  */
+L(copy_GE_32_unaligned_cont):
+
+    	/* Setup two indexes to speed up the indexed vector operations.  */
+    	clrlwi  11,31,28
+    	li      6,16	      /* Index for 16-bytes offsets.  */
+    	li	7,32	      /* Index for 32-bytes offsets.  */
+    	cmplwi  cr1,11,0
+    	srdi    8,31,5	      /* Setup the loop counter.  */
+    	mr      10,3
+    	mr      11,12
+    	mtcrf   0x01,9
+    	cmplwi  cr6,9,1
+    	lvsl    5,0,12
+    	lvx     3,0,12
+    	bf      31,L(setup_unaligned_loop)
+
+    	/* Copy another 16 bytes to align to 32-bytes due to the loop .  */
+    	lvx     4,12,6
+    	vperm   6,3,4,5
+    	addi    11,12,16
+    	addi    10,3,16
+    	stvx    6,0,3
+    	vor	3,4,4
+
+L(setup_unaligned_loop):
+    	mtctr   8
+    	ble     cr6,L(end_unaligned_loop)
+
+    	/* Copy 32 bytes at a time using vector instructions.  */
+    	.align  4
+L(unaligned_loop):
+
+    	/* Note: vr6/vr10 may contain data that was already copied,
+    	but in order to get proper alignment, we may have to copy
+    	some portions again. This is faster than having unaligned
+    	vector instructions though.  */
+
+    	lvx	4,11,6	      /* vr4 = r11+16.  */
+    	vperm   6,3,4,5	      /* Merge the correctly-aligned portions
+    	    		      of vr3/vr4 into vr6.  */
+    	lvx	3,11,7	      /* vr3 = r11+32.  */
+    	vperm   10,4,3,5      /* Merge the correctly-aligned portions
+    	    		      of vr3/vr4 into vr10.  */
+    	addi    11,11,32
+    	stvx    6,0,10
+    	stvx    10,10,6
+    	addi    10,10,32
+
+    	bdnz    L(unaligned_loop)
+
+    	.align  4
+L(end_unaligned_loop):
+
+    	/* Check for tail bytes.  */
+    	clrrwi  0,31,4
+    	mtcrf   0x01,31
+    	beq	cr1,0f
+
+    	add	3,3,0
+    	add	12,12,0
+
+    	/*  We have 1~15 tail bytes to copy, and DST is quadword aligned.  */
+8:  	/* Copy 8 bytes.  */
+    	bf	28,4f
+
+    	lwz	6,0(12)
+    	lwz	7,4(12)
+    	addi    12,12,8
+    	stw	6,0(3)
+    	stw	7,4(3)
+    	addi    3,3,8
+4:  	/* Copy 4 bytes.  */
+    	bf	29,2f
+
+    	lwz	6,0(12)
+    	addi    12,12,4
+    	stw	6,0(3)
+    	addi    3,3,4
+2:  	/* Copy 2~3 bytes.  */
+    	bf	30,1f
+
+    	lhz	6,0(12)
+    	addi    12,12,2
+    	sth	6,0(3)
+    	addi    3,3,2
+1:  	/* Copy 1 byte.  */
+    	bf	31,0f
+
+    	lbz	6,0(12)
+    	stb	6,0(3)
+0:  	/* Return original DST pointer.  */
+    	mr	3,30
+    	lwz     30,20(1)
+    	lwz	31,24(1)
+    	addi    1,1,32
+    	blr
+
+END (BP_SYM (memcpy))
+libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/powerpc/powerpc64/power7/memcpy.S b/sysdeps/powerpc/powerpc64/power7/memcpy.S
new file mode 100644
index 0000000000..a2a1f82cb3
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/power7/memcpy.S
@@ -0,0 +1,449 @@
+/* Optimized memcpy implementation for PowerPC64/POWER7.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+   Contributed by Luis Machado <luisgpm@br.ibm.com>.
+   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., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+#include <sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+
+/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
+   Returns 'dst'.  */
+
+	.machine power7
+EALIGN (BP_SYM (memcpy), 5, 0)
+	CALL_MCOUNT 3
+
+	cmpldi  cr1,5,31
+	neg	0,3
+	std	3,-16(1)
+	std	31,-8(1)
+	cfi_offset(31,-8)
+	ble	cr1, L(copy_LT_32)  /* If move < 32 bytes use short move
+				    code.  */
+
+	andi.   11,3,7	      /* Check alignment of DST.  */
+
+
+	clrldi  10,4,61       /* Check alignment of SRC.  */
+	cmpld   cr6,10,11     /* SRC and DST alignments match?  */
+	mr	12,4
+	mr	31,5
+	bne	cr6,L(copy_GE_32_unaligned)
+
+	srdi    9,5,3	      /* Number of full quadwords remaining.  */
+
+	beq    L(copy_GE_32_aligned_cont)
+
+	clrldi  0,0,61
+	mtcrf   0x01,0
+	subf    31,0,5
+
+	/* Get the SRC aligned to 8 bytes.  */
+
+1:	bf	31,2f
+    	lbz	6,0(12)
+    	addi    12,12,1
+    	stb	6,0(3)
+    	addi    3,3,1
+2:  	bf      30,4f
+    	lhz     6,0(12)
+    	addi    12,12,2
+    	sth     6,0(3)
+    	addi    3,3,2
+4:  	bf      29,0f
+    	lwz     6,0(12)
+    	addi    12,12,4
+    	stw     6,0(3)
+    	addi    3,3,4
+0:
+    	clrldi  10,12,61      /* Check alignment of SRC again.  */
+    	srdi    9,31,3	      /* Number of full doublewords remaining.  */
+
+L(copy_GE_32_aligned_cont):
+
+	clrldi  11,31,61
+	mtcrf   0x01,9
+
+	srdi    8,31,5
+	cmpldi  cr1,9,4
+	cmpldi  cr6,11,0
+	mr	11,12
+
+	/* Copy 1~3 doublewords so the main loop starts
+	at a multiple of 32 bytes.  */
+
+	bf	30,1f
+	ld      6,0(12)
+	ld      7,8(12)
+	addi    11,12,16
+	mtctr   8
+	std     6,0(3)
+	std     7,8(3)
+	addi    10,3,16
+	bf      31,4f
+	ld      0,16(12)
+	std     0,16(3)
+	blt     cr1,3f
+	addi    11,12,24
+	addi    10,3,24
+	b       4f
+
+	.align  4
+1:	/* Copy 1 doubleword and set the counter.  */
+    	mr	10,3
+    	mtctr   8
+    	bf      31,4f
+    	ld      6,0(12)
+    	addi    11,12,8
+    	std     6,0(3)
+    	addi    10,3,8
+
+    	/* Main aligned copy loop. Copies 32-bytes at a time.  */
+    	.align  4
+4:
+    	ld	6,0(11)
+    	ld      7,8(11)
+    	ld      8,16(11)
+    	ld      0,24(11)
+    	addi    11,11,32
+
+    	std     6,0(10)
+    	std     7,8(10)
+    	std     8,16(10)
+    	std     0,24(10)
+    	addi    10,10,32
+    	bdnz    4b
+3:
+
+    	/* Check for tail bytes.  */
+    	rldicr  0,31,0,60
+    	mtcrf   0x01,31
+    	beq	cr6,0f
+
+.L9:
+    	add	3,3,0
+    	add	12,12,0
+
+    	/*  At this point we have a tail of 0-7 bytes and we know that the
+    	destination is doubleword-aligned.  */
+4:  	/* Copy 4 bytes.  */
+    	bf	29,2f
+
+    	lwz     6,0(12)
+    	addi    12,12,4
+    	stw     6,0(3)
+    	addi    3,3,4
+2:  	/* Copy 2 bytes.  */
+    	bf	30,1f
+
+    	lhz     6,0(12)
+    	addi    12,12,2
+    	sth     6,0(3)
+    	addi    3,3,2
+1:  	/* Copy 1 byte.  */
+    	bf	31,0f
+
+    	lbz	6,0(12)
+    	stb	6,0(3)
+0:  	/* Return original DST pointer.  */
+    	ld	31,-8(1)
+    	ld	3,-16(1)
+    	blr
+
+    	/* Handle copies of 0~31 bytes.  */
+    	.align  4
+L(copy_LT_32):
+	cmpldi  cr6,5,8
+    	mr	12,4
+    	mtcrf   0x01,5
+    	ble	cr6,L(copy_LE_8)
+
+    	/* At least 9 bytes to go.  */
+    	neg	8,4
+    	clrrdi  11,4,2
+    	andi.   0,8,3
+    	cmpldi  cr1,5,16
+    	mr	10,5
+    	beq	L(copy_LT_32_aligned)
+
+    	/* Force 4-bytes alignment for SRC.  */
+    	mtocrf  0x01,0
+    	subf    10,0,5
+2:  	bf	30,1f
+
+    	lhz	6,0(12)
+    	addi    12,12,2
+    	sth	6,0(3)
+    	addi    3,3,2
+1:  	bf	31,L(end_4bytes_alignment)
+
+    	lbz	6,0(12)
+    	addi    12,12,1
+    	stb	6,0(3)
+    	addi    3,3,1
+
+    	.align  4
+L(end_4bytes_alignment):
+	cmpldi  cr1,10,16
+    	mtcrf   0x01,10
+
+L(copy_LT_32_aligned):
+	/* At least 6 bytes to go, and SRC is word-aligned.  */
+    	blt	cr1,8f
+
+    	/* Copy 16 bytes.  */
+    	lwz	6,0(12)
+    	lwz     7,4(12)
+    	stw     6,0(3)
+    	lwz     8,8(12)
+    	stw     7,4(3)
+    	lwz     6,12(12)
+    	addi    12,12,16
+    	stw     8,8(3)
+    	stw     6,12(3)
+    	addi    3,3,16
+8:  	/* Copy 8 bytes.  */
+    	bf	28,4f
+
+    	lwz     6,0(12)
+    	lwz     7,4(12)
+    	addi    12,12,8
+    	stw     6,0(3)
+    	stw     7,4(3)
+    	addi    3,3,8
+4:  	/* Copy 4 bytes.  */
+    	bf	29,2f
+
+    	lwz     6,0(12)
+    	addi    12,12,4
+    	stw     6,0(3)
+    	addi    3,3,4
+2:  	/* Copy 2-3 bytes.  */
+    	bf	30,1f
+
+    	lhz     6,0(12)
+    	sth     6,0(3)
+    	bf      31,0f
+    	lbz     7,2(12)
+    	stb     7,2(3)
+    	ld	3,-16(1)
+    	blr
+
+    	.align  4
+1:  	/* Copy 1 byte.  */
+    	bf	31,0f
+
+    	lbz	6,0(12)
+    	stb	6,0(3)
+0:  	/* Return original DST pointer.  */
+    	ld	3,-16(1)
+    	blr
+
+    	/* Handles copies of 0~8 bytes.  */
+    	.align  4
+L(copy_LE_8):
+	bne	cr6,4f
+
+    	/* Though we could've used ld/std here, they are still
+    	slow for unaligned cases.  */
+
+    	lwz	6,0(4)
+    	lwz     7,4(4)
+    	stw     6,0(3)
+    	stw     7,4(3)
+    	ld      3,-16(1)      /* Return original DST pointers.  */
+    	blr
+
+    	.align  4
+4:  	/* Copies 4~7 bytes.  */
+    	bf	29,2b
+
+    	lwz	6,0(4)
+    	stw     6,0(3)
+    	bf      30,5f
+    	lhz     7,4(4)
+    	sth     7,4(3)
+    	bf      31,0f
+    	lbz     8,6(4)
+    	stb     8,6(3)
+    	ld	3,-16(1)
+    	blr
+
+    	.align  4
+5:  	/* Copy 1 byte.  */
+    	bf	31,0f
+
+    	lbz	6,4(4)
+    	stb	6,4(3)
+
+0:  	/* Return original DST pointer.  */
+    	ld	3,-16(1)
+    	blr
+
+    	/* Handle copies of 32+ bytes where DST is aligned (to quadword) but
+    	SRC is not.  Use aligned quadword loads from SRC, shifted to realign
+    	the data, allowing for aligned DST stores.  */
+    	.align  4
+L(copy_GE_32_unaligned):
+	clrldi  0,0,60	      /* Number of bytes until the 1st
+    	    		      quadword.  */
+    	andi.   11,3,15       /* Check alignment of DST (against
+    	    		      quadwords).  */
+    	srdi    9,5,4	      /* Number of full quadwords remaining.  */
+
+    	beq	L(copy_GE_32_unaligned_cont)
+
+    	/* SRC is not quadword aligned, get it aligned.  */
+
+    	mtcrf   0x01,0
+    	subf    31,0,5
+
+    	/* Vector instructions work best when proper alignment (16-bytes)
+    	is present.  Move 0~15 bytes as needed to get DST quadword-aligned.  */
+1:  	/* Copy 1 byte.  */
+    	bf	31,2f
+
+    	lbz	6,0(12)
+    	addi    12,12,1
+    	stb	6,0(3)
+    	addi    3,3,1
+2:  	/* Copy 2 bytes.  */
+    	bf	30,4f
+
+    	lhz     6,0(12)
+    	addi    12,12,2
+    	sth     6,0(3)
+    	addi    3,3,2
+4:  	/* Copy 4 bytes.  */
+    	bf	29,8f
+
+    	lwz     6,0(12)
+    	addi    12,12,4
+    	stw     6,0(3)
+    	addi    3,3,4
+8:  	/* Copy 8 bytes.  */
+    	bf	28,0f
+
+    	ld	6,0(12)
+    	addi    12,12,8
+    	std	6,0(3)
+    	addi    3,3,8
+0:
+    	clrldi  10,12,60      /* Check alignment of SRC.  */
+    	srdi    9,31,4	      /* Number of full quadwords remaining.  */
+
+    	/* The proper alignment is present, it is OK to copy the bytes now.  */
+L(copy_GE_32_unaligned_cont):
+
+    	/* Setup two indexes to speed up the indexed vector operations.  */
+    	clrldi  11,31,60
+    	li      6,16	      /* Index for 16-bytes offsets.  */
+    	li	7,32	      /* Index for 32-bytes offsets.  */
+    	cmpldi  cr1,11,0
+    	srdi    8,31,5	      /* Setup the loop counter.  */
+    	mr      10,3
+    	mr      11,12
+    	mtcrf   0x01,9
+    	cmpldi  cr6,9,1
+    	lvsl    5,0,12
+    	lvx     3,0,12
+    	bf      31,L(setup_unaligned_loop)
+
+    	/* Copy another 16 bytes to align to 32-bytes due to the loop .  */
+    	lvx     4,12,6
+    	vperm   6,3,4,5
+    	addi    11,12,16
+    	addi    10,3,16
+    	stvx    6,0,3
+    	vor	3,4,4
+
+L(setup_unaligned_loop):
+    	mtctr   8
+    	ble     cr6,L(end_unaligned_loop)
+
+    	/* Copy 32 bytes at a time using vector instructions.  */
+    	.align  4
+L(unaligned_loop):
+
+    	/* Note: vr6/vr10 may contain data that was already copied,
+    	but in order to get proper alignment, we may have to copy
+    	some portions again. This is faster than having unaligned
+    	vector instructions though.  */
+
+    	lvx	4,11,6	      /* vr4 = r11+16.  */
+    	vperm   6,3,4,5	      /* Merge the correctly-aligned portions
+    	    		      of vr3/vr4 into vr6.  */
+    	lvx	3,11,7	      /* vr3 = r11+32.  */
+    	vperm   10,4,3,5      /* Merge the correctly-aligned portions
+    	    		      of vr3/vr4 into vr10.  */
+    	addi    11,11,32
+    	stvx    6,0,10
+    	stvx    10,10,6
+    	addi    10,10,32
+
+    	bdnz	L(unaligned_loop)
+
+    	.align  4
+L(end_unaligned_loop):
+
+    	/* Check for tail bytes.  */
+    	rldicr  0,31,0,59
+    	mtcrf   0x01,31
+    	beq	cr1,0f
+
+    	add	3,3,0
+    	add	12,12,0
+
+    	/*  We have 1~15 tail bytes to copy, and DST is quadword aligned.  */
+8:  	/* Copy 8 bytes.  */
+    	bf	28,4f
+
+    	lwz	6,0(12)
+    	lwz	7,4(12)
+    	addi    12,12,8
+    	stw	6,0(3)
+    	stw	7,4(3)
+    	addi    3,3,8
+4:  	/* Copy 4 bytes.  */
+    	bf	29,2f
+
+    	lwz	6,0(12)
+    	addi    12,12,4
+    	stw	6,0(3)
+    	addi    3,3,4
+2:  	/* Copy 2~3 bytes.  */
+    	bf	30,1f
+
+    	lhz	6,0(12)
+    	addi    12,12,2
+    	sth	6,0(3)
+    	addi    3,3,2
+1:  	/* Copy 1 byte.  */
+    	bf	31,0f
+
+    	lbz	6,0(12)
+    	stb	6,0(3)
+0:  	/* Return original DST pointer.  */
+    	ld	31,-8(1)
+    	ld	3,-16(1)
+    	blr
+
+END_GEN_TB (BP_SYM (memcpy),TB_TOCLESS)
+libc_hidden_builtin_def (memcpy)

From b8907dfd8b1c33943fef1f7c51274c1500024785 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Wed, 10 Mar 2010 07:28:04 -0800
Subject: [PATCH 03/76] Fix whitespace issues.

---
 sysdeps/powerpc/powerpc32/power7/memcpy.S | 760 +++++++++++-----------
 sysdeps/powerpc/powerpc64/power7/memcpy.S | 650 +++++++++---------
 2 files changed, 705 insertions(+), 705 deletions(-)

diff --git a/sysdeps/powerpc/powerpc32/power7/memcpy.S b/sysdeps/powerpc/powerpc32/power7/memcpy.S
index d96ef20851..e3dfd2ff92 100644
--- a/sysdeps/powerpc/powerpc32/power7/memcpy.S
+++ b/sysdeps/powerpc/powerpc32/power7/memcpy.S
@@ -58,412 +58,412 @@ EALIGN (BP_SYM (memcpy), 5, 0)
 
 	/* Get the SRC aligned to 8 bytes.  */
 
-1:  	bf	31,2f
-    	lbz	6,0(12)
-    	addi    12,12,1
-    	stb	6,0(3)
-    	addi    3,3,1
-2:  	bf      30,4f
-    	lhz     6,0(12)
-    	addi    12,12,2
-    	sth     6,0(3)
-    	addi    3,3,2
-4:  	bf      29,0f
-    	lwz     6,0(12)
-    	addi    12,12,4
-    	stw     6,0(3)
-    	addi    3,3,4
+1:	bf	31,2f
+	lbz	6,0(12)
+	addi    12,12,1
+	stb	6,0(3)
+	addi    3,3,1
+2:	bf      30,4f
+	lhz     6,0(12)
+	addi    12,12,2
+	sth     6,0(3)
+	addi    3,3,2
+4:	bf      29,0f
+	lwz     6,0(12)
+	addi    12,12,4
+	stw     6,0(3)
+	addi    3,3,4
 0:
-    	clrlwi  10,12,29      /* Check alignment of SRC again.  */
-    	srwi    9,31,3	      /* Number of full doublewords remaining.  */
+	clrlwi  10,12,29      /* Check alignment of SRC again.  */
+	srwi    9,31,3	      /* Number of full doublewords remaining.  */
 
 L(copy_GE_32_aligned_cont):
 
-    	clrlwi  11,31,29
-    	mtcrf   0x01,9
-
-    	srwi    8,31,5
-    	cmplwi  cr1,9,4
-    	cmplwi  cr6,11,0
-    	mr	11,12
-
-    	/* Copy 1~3 doublewords so the main loop starts
-    	at a multiple of 32 bytes.  */
-
-    	bf	30,1f
-    	lfd     6,0(12)
-    	lfd     7,8(12)
-    	addi    11,12,16
-    	mtctr   8
-    	stfd    6,0(3)
-    	stfd    7,8(3)
-    	addi    10,3,16
-    	bf      31,4f
-    	lfd     0,16(12)
-    	stfd    0,16(3)
-    	blt     cr1,3f
-    	addi    11,12,24
-    	addi    10,3,24
-    	b       4f
-
-    	.align  4
-1:  	/* Copy 1 doubleword and set the counter.  */
-    	mr	10,3
-    	mtctr   8
-    	bf      31,4f
-    	lfd     6,0(12)
-    	addi    11,12,8
-    	stfd    6,0(3)
-    	addi    10,3,8
-
-    	.align  4
-4:  	/* Main aligned copy loop. Copies 32-bytes at a time.  */
-    	lfd	6,0(11)
-    	lfd     7,8(11)
-    	lfd     8,16(11)
-    	lfd     0,24(11)
-    	addi    11,11,32
-
-    	stfd    6,0(10)
-    	stfd    7,8(10)
-    	stfd    8,16(10)
-    	stfd    0,24(10)
-    	addi    10,10,32
-    	bdnz    4b
+	clrlwi  11,31,29
+	mtcrf   0x01,9
+
+	srwi    8,31,5
+	cmplwi  cr1,9,4
+	cmplwi  cr6,11,0
+	mr	11,12
+
+	/* Copy 1~3 doublewords so the main loop starts
+	at a multiple of 32 bytes.  */
+
+	bf	30,1f
+	lfd     6,0(12)
+	lfd     7,8(12)
+	addi    11,12,16
+	mtctr   8
+	stfd    6,0(3)
+	stfd    7,8(3)
+	addi    10,3,16
+	bf      31,4f
+	lfd     0,16(12)
+	stfd    0,16(3)
+	blt     cr1,3f
+	addi    11,12,24
+	addi    10,3,24
+	b       4f
+
+	.align  4
+1:	/* Copy 1 doubleword and set the counter.  */
+	mr	10,3
+	mtctr   8
+	bf      31,4f
+	lfd     6,0(12)
+	addi    11,12,8
+	stfd    6,0(3)
+	addi    10,3,8
+
+	.align  4
+4:	/* Main aligned copy loop. Copies 32-bytes at a time.  */
+	lfd	6,0(11)
+	lfd     7,8(11)
+	lfd     8,16(11)
+	lfd     0,24(11)
+	addi    11,11,32
+
+	stfd    6,0(10)
+	stfd    7,8(10)
+	stfd    8,16(10)
+	stfd    0,24(10)
+	addi    10,10,32
+	bdnz    4b
 3:
 
-    	/* Check for tail bytes.  */
+	/* Check for tail bytes.  */
 
-    	clrrwi  0,31,3
-    	mtcrf   0x01,31
-    	beq	cr6,0f
+	clrrwi  0,31,3
+	mtcrf   0x01,31
+	beq	cr6,0f
 
 .L9:
-    	add	3,3,0
-    	add	12,12,0
-
-    	/*  At this point we have a tail of 0-7 bytes and we know that the
-    	destination is doubleword-aligned.  */
-4:  	/* Copy 4 bytes.  */
-    	bf	29,2f
-
-    	lwz     6,0(12)
-    	addi    12,12,4
-    	stw     6,0(3)
-    	addi    3,3,4
-2:  	/* Copy 2 bytes.  */
-    	bf	30,1f
-
-    	lhz     6,0(12)
-    	addi    12,12,2
-    	sth     6,0(3)
-    	addi    3,3,2
-1:  	/* Copy 1 byte.  */
-    	bf	31,0f
-
-    	lbz	6,0(12)
-    	stb	6,0(3)
-0:  	/* Return original DST pointer.  */
-    	mr	3,30
-    	lwz	30,20(1)
-    	lwz     31,24(1)
-    	addi    1,1,32
-    	blr
-
-    	/* Handle copies of 0~31 bytes.  */
-    	.align  4
+	add	3,3,0
+	add	12,12,0
+
+	/*  At this point we have a tail of 0-7 bytes and we know that the
+	destination is doubleword-aligned.  */
+4:	/* Copy 4 bytes.  */
+	bf	29,2f
+
+	lwz     6,0(12)
+	addi    12,12,4
+	stw     6,0(3)
+	addi    3,3,4
+2:	/* Copy 2 bytes.  */
+	bf	30,1f
+
+	lhz     6,0(12)
+	addi    12,12,2
+	sth     6,0(3)
+	addi    3,3,2
+1:	/* Copy 1 byte.  */
+	bf	31,0f
+
+	lbz	6,0(12)
+	stb	6,0(3)
+0:	/* Return original DST pointer.  */
+	mr	3,30
+	lwz	30,20(1)
+	lwz     31,24(1)
+	addi    1,1,32
+	blr
+
+	/* Handle copies of 0~31 bytes.  */
+	.align  4
 L(copy_LT_32):
-    	cmplwi  cr6,5,8
-    	mr	12,4
-    	mtcrf   0x01,5
-    	ble	cr6,L(copy_LE_8)
-
-    	/* At least 9 bytes to go.  */
-    	neg	8,4
-    	clrrwi  11,4,2
-    	andi.   0,8,3
-    	cmplwi  cr1,5,16
-    	mr	10,5
-    	beq	L(copy_LT_32_aligned)
-
-    	/* Force 4-bytes alignment for SRC.  */
-    	mtocrf  0x01,0
-    	subf    10,0,5
-2:  	bf	30,1f
-
-    	lhz	6,0(12)
-    	addi    12,12,2
-    	sth	6,0(3)
-    	addi    3,3,2
-1:  	bf	31,L(end_4bytes_alignment)
-
-    	lbz	6,0(12)
-    	addi    12,12,1
-    	stb	6,0(3)
-    	addi    3,3,1
-
-    	.align  4
+	cmplwi  cr6,5,8
+	mr	12,4
+	mtcrf   0x01,5
+	ble	cr6,L(copy_LE_8)
+
+	/* At least 9 bytes to go.  */
+	neg	8,4
+	clrrwi  11,4,2
+	andi.   0,8,3
+	cmplwi  cr1,5,16
+	mr	10,5
+	beq	L(copy_LT_32_aligned)
+
+	/* Force 4-bytes alignment for SRC.  */
+	mtocrf  0x01,0
+	subf    10,0,5
+2:	bf	30,1f
+
+	lhz	6,0(12)
+	addi    12,12,2
+	sth	6,0(3)
+	addi    3,3,2
+1:	bf	31,L(end_4bytes_alignment)
+
+	lbz	6,0(12)
+	addi    12,12,1
+	stb	6,0(3)
+	addi    3,3,1
+
+	.align  4
 L(end_4bytes_alignment):
-    	cmplwi  cr1,10,16
-    	mtcrf   0x01,10
+	cmplwi  cr1,10,16
+	mtcrf   0x01,10
 
 L(copy_LT_32_aligned):
-    	/* At least 6 bytes to go, and SRC is word-aligned.  */
-    	blt	cr1,8f
-
-    	/* Copy 16 bytes.  */
-    	lwz	6,0(12)
-    	lwz     7,4(12)
-    	stw     6,0(3)
-    	lwz     8,8(12)
-    	stw     7,4(3)
-    	lwz     6,12(12)
-    	addi    12,12,16
-    	stw     8,8(3)
-    	stw     6,12(3)
-    	addi    3,3,16
-8:  	/* Copy 8 bytes.  */
-    	bf	28,4f
-
-    	lwz     6,0(12)
-    	lwz     7,4(12)
-    	addi    12,12,8
-    	stw     6,0(3)
-    	stw     7,4(3)
-    	addi    3,3,8
-4:  	/* Copy 4 bytes.  */
-    	bf	29,2f
-
-    	lwz     6,0(12)
-    	addi    12,12,4
-    	stw     6,0(3)
-    	addi    3,3,4
-2:  	/* Copy 2-3 bytes.  */
-    	bf	30,1f
-
-    	lhz     6,0(12)
-    	sth     6,0(3)
-    	bf      31,0f
-    	lbz     7,2(12)
-    	stb     7,2(3)
-
-    	/* Return original DST pointer.  */
-    	mr      3,30
-    	lwz     30,20(1)
-    	addi    1,1,32
-    	blr
-
-    	.align  4
-1:  	/* Copy 1 byte.  */
-    	bf	31,0f
-
-    	lbz	6,0(12)
-    	stb	6,0(3)
-0:  	/* Return original DST pointer.  */
-    	mr	3,30
-    	lwz	30,20(1)
-    	addi    1,1,32
-    	blr
-
-    	/* Handles copies of 0~8 bytes.  */
-    	.align  4
+	/* At least 6 bytes to go, and SRC is word-aligned.  */
+	blt	cr1,8f
+
+	/* Copy 16 bytes.  */
+	lwz	6,0(12)
+	lwz     7,4(12)
+	stw     6,0(3)
+	lwz     8,8(12)
+	stw     7,4(3)
+	lwz     6,12(12)
+	addi    12,12,16
+	stw     8,8(3)
+	stw     6,12(3)
+	addi    3,3,16
+8:	/* Copy 8 bytes.  */
+	bf	28,4f
+
+	lwz     6,0(12)
+	lwz     7,4(12)
+	addi    12,12,8
+	stw     6,0(3)
+	stw     7,4(3)
+	addi    3,3,8
+4:	/* Copy 4 bytes.  */
+	bf	29,2f
+
+	lwz     6,0(12)
+	addi    12,12,4
+	stw     6,0(3)
+	addi    3,3,4
+2:	/* Copy 2-3 bytes.  */
+	bf	30,1f
+
+	lhz     6,0(12)
+	sth     6,0(3)
+	bf      31,0f
+	lbz     7,2(12)
+	stb     7,2(3)
+
+	/* Return original DST pointer.  */
+	mr      3,30
+	lwz     30,20(1)
+	addi    1,1,32
+	blr
+
+	.align  4
+1:	/* Copy 1 byte.  */
+	bf	31,0f
+
+	lbz	6,0(12)
+	stb	6,0(3)
+0:	/* Return original DST pointer.  */
+	mr	3,30
+	lwz	30,20(1)
+	addi    1,1,32
+	blr
+
+	/* Handles copies of 0~8 bytes.  */
+	.align  4
 L(copy_LE_8):
-    	bne	cr6,4f
-
-    	/* Though we could've used lfd/stfd here, they are still
-    	slow for unaligned cases.  */
-
-    	lwz	6,0(4)
-    	lwz     7,4(4)
-    	stw     6,0(3)
-    	stw     7,4(3)
-
-    	/* Return original DST pointer.  */
-    	mr      3,30
-    	lwz     30,20(1)
-    	addi    1,1,32
-    	blr
-
-    	.align  4
-4:  	/* Copies 4~7 bytes.  */
-    	bf	29,2b
-
-    	lwz	6,0(4)
-    	stw     6,0(3)
-    	bf      30,5f
-    	lhz     7,4(4)
-    	sth     7,4(3)
-    	bf      31,0f
-    	lbz     8,6(4)
-    	stb     8,6(3)
-
-    	/* Return original DST pointer.  */
-    	mr      3,30
-    	lwz     30,20(1)
-    	addi    1,1,32
-    	blr
-
-    	.align  4
-5:  	/* Copy 1 byte.  */
-    	bf	31,0f
-
-    	lbz	6,4(4)
-    	stb	6,4(3)
-
-0:  	/* Return original DST pointer.  */
-    	mr	3,30
-    	lwz     30,20(1)
-    	addi    1,1,32
-    	blr
-
-    	/* Handle copies of 32+ bytes where DST is aligned (to quadword) but
-    	SRC is not. Use aligned quadword loads from SRC, shifted to realign
-    	the data, allowing for aligned DST stores.  */
-    	.align  4
+	bne	cr6,4f
+
+	/* Though we could've used lfd/stfd here, they are still
+	slow for unaligned cases.  */
+
+	lwz	6,0(4)
+	lwz     7,4(4)
+	stw     6,0(3)
+	stw     7,4(3)
+
+	/* Return original DST pointer.  */
+	mr      3,30
+	lwz     30,20(1)
+	addi    1,1,32
+	blr
+
+	.align  4
+4:	/* Copies 4~7 bytes.  */
+	bf	29,2b
+
+	lwz	6,0(4)
+	stw     6,0(3)
+	bf      30,5f
+	lhz     7,4(4)
+	sth     7,4(3)
+	bf      31,0f
+	lbz     8,6(4)
+	stb     8,6(3)
+
+	/* Return original DST pointer.  */
+	mr      3,30
+	lwz     30,20(1)
+	addi    1,1,32
+	blr
+
+	.align  4
+5:	/* Copy 1 byte.  */
+	bf	31,0f
+
+	lbz	6,4(4)
+	stb	6,4(3)
+
+0:	/* Return original DST pointer.  */
+	mr	3,30
+	lwz     30,20(1)
+	addi    1,1,32
+	blr
+
+	/* Handle copies of 32+ bytes where DST is aligned (to quadword) but
+	SRC is not. Use aligned quadword loads from SRC, shifted to realign
+	the data, allowing for aligned DST stores.  */
+	.align  4
 L(copy_GE_32_unaligned):
-    	andi.   11,3,15	      /* Check alignment of DST.  */
-    	clrlwi  0,0,28	      /* Number of bytes until the 1st
-    	    		      quadword of DST.  */
-    	srwi    9,5,4	      /* Number of full quadwords remaining.  */
-
-    	beq    L(copy_GE_32_unaligned_cont)
-
-    	/* SRC is not quadword aligned, get it aligned.  */
-
-    	mtcrf   0x01,0
-    	subf    31,0,5
-
-    	/* Vector instructions work best when proper alignment (16-bytes)
-    	is present.  Move 0~15 bytes as needed to get DST quadword-aligned.  */
-1:  	/* Copy 1 byte.  */
-    	bf	31,2f
-
-    	lbz	6,0(12)
-    	addi    12,12,1
-    	stb	6,0(3)
-    	addi    3,3,1
-2:  	/* Copy 2 bytes.  */
-    	bf	    30,4f
-
-    	lhz     6,0(12)
-    	addi    12,12,2
-    	sth     6,0(3)
-    	addi    3,3,2
-4:  	/* Copy 4 bytes.  */
-    	bf	29,8f
-
-    	lwz     6,0(12)
-    	addi    12,12,4
-    	stw     6,0(3)
-    	addi    3,3,4
-8:  	/* Copy 8 bytes.  */
-    	bf	28,0f
-
-    	lfd	6,0(12)
-    	addi    12,12,8
-    	stfd    6,0(3)
-    	addi    3,3,8
+	andi.   11,3,15	      /* Check alignment of DST.  */
+	clrlwi  0,0,28	      /* Number of bytes until the 1st
+			      quadword of DST.  */
+	srwi    9,5,4	      /* Number of full quadwords remaining.  */
+
+	beq    L(copy_GE_32_unaligned_cont)
+
+	/* SRC is not quadword aligned, get it aligned.  */
+
+	mtcrf   0x01,0
+	subf    31,0,5
+
+	/* Vector instructions work best when proper alignment (16-bytes)
+	is present.  Move 0~15 bytes as needed to get DST quadword-aligned.  */
+1:	/* Copy 1 byte.  */
+	bf	31,2f
+
+	lbz	6,0(12)
+	addi    12,12,1
+	stb	6,0(3)
+	addi    3,3,1
+2:	/* Copy 2 bytes.  */
+	bf	    30,4f
+
+	lhz     6,0(12)
+	addi    12,12,2
+	sth     6,0(3)
+	addi    3,3,2
+4:	/* Copy 4 bytes.  */
+	bf	29,8f
+
+	lwz     6,0(12)
+	addi    12,12,4
+	stw     6,0(3)
+	addi    3,3,4
+8:	/* Copy 8 bytes.  */
+	bf	28,0f
+
+	lfd	6,0(12)
+	addi    12,12,8
+	stfd    6,0(3)
+	addi    3,3,8
 0:
-    	clrlwi  10,12,28      /* Check alignment of SRC.  */
-    	srdi    9,31,4	      /* Number of full quadwords remaining.  */
+	clrlwi  10,12,28      /* Check alignment of SRC.  */
+	srdi    9,31,4	      /* Number of full quadwords remaining.  */
 
-    	/* The proper alignment is present, it is OK to copy the bytes now.  */
+	/* The proper alignment is present, it is OK to copy the bytes now.  */
 L(copy_GE_32_unaligned_cont):
 
-    	/* Setup two indexes to speed up the indexed vector operations.  */
-    	clrlwi  11,31,28
-    	li      6,16	      /* Index for 16-bytes offsets.  */
-    	li	7,32	      /* Index for 32-bytes offsets.  */
-    	cmplwi  cr1,11,0
-    	srdi    8,31,5	      /* Setup the loop counter.  */
-    	mr      10,3
-    	mr      11,12
-    	mtcrf   0x01,9
-    	cmplwi  cr6,9,1
-    	lvsl    5,0,12
-    	lvx     3,0,12
-    	bf      31,L(setup_unaligned_loop)
-
-    	/* Copy another 16 bytes to align to 32-bytes due to the loop .  */
-    	lvx     4,12,6
-    	vperm   6,3,4,5
-    	addi    11,12,16
-    	addi    10,3,16
-    	stvx    6,0,3
-    	vor	3,4,4
+	/* Setup two indexes to speed up the indexed vector operations.  */
+	clrlwi  11,31,28
+	li      6,16	      /* Index for 16-bytes offsets.  */
+	li	7,32	      /* Index for 32-bytes offsets.  */
+	cmplwi  cr1,11,0
+	srdi    8,31,5	      /* Setup the loop counter.  */
+	mr      10,3
+	mr      11,12
+	mtcrf   0x01,9
+	cmplwi  cr6,9,1
+	lvsl    5,0,12
+	lvx     3,0,12
+	bf      31,L(setup_unaligned_loop)
+
+	/* Copy another 16 bytes to align to 32-bytes due to the loop .  */
+	lvx     4,12,6
+	vperm   6,3,4,5
+	addi    11,12,16
+	addi    10,3,16
+	stvx    6,0,3
+	vor	3,4,4
 
 L(setup_unaligned_loop):
-    	mtctr   8
-    	ble     cr6,L(end_unaligned_loop)
+	mtctr   8
+	ble     cr6,L(end_unaligned_loop)
 
-    	/* Copy 32 bytes at a time using vector instructions.  */
-    	.align  4
+	/* Copy 32 bytes at a time using vector instructions.  */
+	.align  4
 L(unaligned_loop):
 
-    	/* Note: vr6/vr10 may contain data that was already copied,
-    	but in order to get proper alignment, we may have to copy
-    	some portions again. This is faster than having unaligned
-    	vector instructions though.  */
-
-    	lvx	4,11,6	      /* vr4 = r11+16.  */
-    	vperm   6,3,4,5	      /* Merge the correctly-aligned portions
-    	    		      of vr3/vr4 into vr6.  */
-    	lvx	3,11,7	      /* vr3 = r11+32.  */
-    	vperm   10,4,3,5      /* Merge the correctly-aligned portions
-    	    		      of vr3/vr4 into vr10.  */
-    	addi    11,11,32
-    	stvx    6,0,10
-    	stvx    10,10,6
-    	addi    10,10,32
-
-    	bdnz    L(unaligned_loop)
-
-    	.align  4
+	/* Note: vr6/vr10 may contain data that was already copied,
+	but in order to get proper alignment, we may have to copy
+	some portions again. This is faster than having unaligned
+	vector instructions though.  */
+
+	lvx	4,11,6	      /* vr4 = r11+16.  */
+	vperm   6,3,4,5	      /* Merge the correctly-aligned portions
+			      of vr3/vr4 into vr6.  */
+	lvx	3,11,7	      /* vr3 = r11+32.  */
+	vperm   10,4,3,5      /* Merge the correctly-aligned portions
+			      of vr3/vr4 into vr10.  */
+	addi    11,11,32
+	stvx    6,0,10
+	stvx    10,10,6
+	addi    10,10,32
+
+	bdnz    L(unaligned_loop)
+
+	.align  4
 L(end_unaligned_loop):
 
-    	/* Check for tail bytes.  */
-    	clrrwi  0,31,4
-    	mtcrf   0x01,31
-    	beq	cr1,0f
-
-    	add	3,3,0
-    	add	12,12,0
-
-    	/*  We have 1~15 tail bytes to copy, and DST is quadword aligned.  */
-8:  	/* Copy 8 bytes.  */
-    	bf	28,4f
-
-    	lwz	6,0(12)
-    	lwz	7,4(12)
-    	addi    12,12,8
-    	stw	6,0(3)
-    	stw	7,4(3)
-    	addi    3,3,8
-4:  	/* Copy 4 bytes.  */
-    	bf	29,2f
-
-    	lwz	6,0(12)
-    	addi    12,12,4
-    	stw	6,0(3)
-    	addi    3,3,4
-2:  	/* Copy 2~3 bytes.  */
-    	bf	30,1f
-
-    	lhz	6,0(12)
-    	addi    12,12,2
-    	sth	6,0(3)
-    	addi    3,3,2
-1:  	/* Copy 1 byte.  */
-    	bf	31,0f
-
-    	lbz	6,0(12)
-    	stb	6,0(3)
-0:  	/* Return original DST pointer.  */
-    	mr	3,30
-    	lwz     30,20(1)
-    	lwz	31,24(1)
-    	addi    1,1,32
-    	blr
+	/* Check for tail bytes.  */
+	clrrwi  0,31,4
+	mtcrf   0x01,31
+	beq	cr1,0f
+
+	add	3,3,0
+	add	12,12,0
+
+	/*  We have 1~15 tail bytes to copy, and DST is quadword aligned.  */
+8:	/* Copy 8 bytes.  */
+	bf	28,4f
+
+	lwz	6,0(12)
+	lwz	7,4(12)
+	addi    12,12,8
+	stw	6,0(3)
+	stw	7,4(3)
+	addi    3,3,8
+4:	/* Copy 4 bytes.  */
+	bf	29,2f
+
+	lwz	6,0(12)
+	addi    12,12,4
+	stw	6,0(3)
+	addi    3,3,4
+2:	/* Copy 2~3 bytes.  */
+	bf	30,1f
+
+	lhz	6,0(12)
+	addi    12,12,2
+	sth	6,0(3)
+	addi    3,3,2
+1:	/* Copy 1 byte.  */
+	bf	31,0f
+
+	lbz	6,0(12)
+	stb	6,0(3)
+0:	/* Return original DST pointer.  */
+	mr	3,30
+	lwz     30,20(1)
+	lwz	31,24(1)
+	addi    1,1,32
+	blr
 
 END (BP_SYM (memcpy))
 libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/powerpc/powerpc64/power7/memcpy.S b/sysdeps/powerpc/powerpc64/power7/memcpy.S
index a2a1f82cb3..2e5beed15e 100644
--- a/sysdeps/powerpc/powerpc64/power7/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/power7/memcpy.S
@@ -58,23 +58,23 @@ EALIGN (BP_SYM (memcpy), 5, 0)
 	/* Get the SRC aligned to 8 bytes.  */
 
 1:	bf	31,2f
-    	lbz	6,0(12)
-    	addi    12,12,1
-    	stb	6,0(3)
-    	addi    3,3,1
-2:  	bf      30,4f
-    	lhz     6,0(12)
-    	addi    12,12,2
-    	sth     6,0(3)
-    	addi    3,3,2
-4:  	bf      29,0f
-    	lwz     6,0(12)
-    	addi    12,12,4
-    	stw     6,0(3)
-    	addi    3,3,4
+	lbz	6,0(12)
+	addi    12,12,1
+	stb	6,0(3)
+	addi    3,3,1
+2:	bf      30,4f
+	lhz     6,0(12)
+	addi    12,12,2
+	sth     6,0(3)
+	addi    3,3,2
+4:	bf      29,0f
+	lwz     6,0(12)
+	addi    12,12,4
+	stw     6,0(3)
+	addi    3,3,4
 0:
-    	clrldi  10,12,61      /* Check alignment of SRC again.  */
-    	srdi    9,31,3	      /* Number of full doublewords remaining.  */
+	clrldi  10,12,61      /* Check alignment of SRC again.  */
+	srdi    9,31,3	      /* Number of full doublewords remaining.  */
 
 L(copy_GE_32_aligned_cont):
 
@@ -107,343 +107,343 @@ L(copy_GE_32_aligned_cont):
 
 	.align  4
 1:	/* Copy 1 doubleword and set the counter.  */
-    	mr	10,3
-    	mtctr   8
-    	bf      31,4f
-    	ld      6,0(12)
-    	addi    11,12,8
-    	std     6,0(3)
-    	addi    10,3,8
-
-    	/* Main aligned copy loop. Copies 32-bytes at a time.  */
-    	.align  4
+	mr	10,3
+	mtctr   8
+	bf      31,4f
+	ld      6,0(12)
+	addi    11,12,8
+	std     6,0(3)
+	addi    10,3,8
+
+	/* Main aligned copy loop. Copies 32-bytes at a time.  */
+	.align  4
 4:
-    	ld	6,0(11)
-    	ld      7,8(11)
-    	ld      8,16(11)
-    	ld      0,24(11)
-    	addi    11,11,32
-
-    	std     6,0(10)
-    	std     7,8(10)
-    	std     8,16(10)
-    	std     0,24(10)
-    	addi    10,10,32
-    	bdnz    4b
+	ld	6,0(11)
+	ld      7,8(11)
+	ld      8,16(11)
+	ld      0,24(11)
+	addi    11,11,32
+
+	std     6,0(10)
+	std     7,8(10)
+	std     8,16(10)
+	std     0,24(10)
+	addi    10,10,32
+	bdnz    4b
 3:
 
-    	/* Check for tail bytes.  */
-    	rldicr  0,31,0,60
-    	mtcrf   0x01,31
-    	beq	cr6,0f
+	/* Check for tail bytes.  */
+	rldicr  0,31,0,60
+	mtcrf   0x01,31
+	beq	cr6,0f
 
 .L9:
-    	add	3,3,0
-    	add	12,12,0
-
-    	/*  At this point we have a tail of 0-7 bytes and we know that the
-    	destination is doubleword-aligned.  */
-4:  	/* Copy 4 bytes.  */
-    	bf	29,2f
-
-    	lwz     6,0(12)
-    	addi    12,12,4
-    	stw     6,0(3)
-    	addi    3,3,4
-2:  	/* Copy 2 bytes.  */
-    	bf	30,1f
-
-    	lhz     6,0(12)
-    	addi    12,12,2
-    	sth     6,0(3)
-    	addi    3,3,2
-1:  	/* Copy 1 byte.  */
-    	bf	31,0f
-
-    	lbz	6,0(12)
-    	stb	6,0(3)
-0:  	/* Return original DST pointer.  */
-    	ld	31,-8(1)
-    	ld	3,-16(1)
-    	blr
-
-    	/* Handle copies of 0~31 bytes.  */
-    	.align  4
+	add	3,3,0
+	add	12,12,0
+
+	/*  At this point we have a tail of 0-7 bytes and we know that the
+	destination is doubleword-aligned.  */
+4:	/* Copy 4 bytes.  */
+	bf	29,2f
+
+	lwz     6,0(12)
+	addi    12,12,4
+	stw     6,0(3)
+	addi    3,3,4
+2:	/* Copy 2 bytes.  */
+	bf	30,1f
+
+	lhz     6,0(12)
+	addi    12,12,2
+	sth     6,0(3)
+	addi    3,3,2
+1:	/* Copy 1 byte.  */
+	bf	31,0f
+
+	lbz	6,0(12)
+	stb	6,0(3)
+0:	/* Return original DST pointer.  */
+	ld	31,-8(1)
+	ld	3,-16(1)
+	blr
+
+	/* Handle copies of 0~31 bytes.  */
+	.align  4
 L(copy_LT_32):
 	cmpldi  cr6,5,8
-    	mr	12,4
-    	mtcrf   0x01,5
-    	ble	cr6,L(copy_LE_8)
-
-    	/* At least 9 bytes to go.  */
-    	neg	8,4
-    	clrrdi  11,4,2
-    	andi.   0,8,3
-    	cmpldi  cr1,5,16
-    	mr	10,5
-    	beq	L(copy_LT_32_aligned)
-
-    	/* Force 4-bytes alignment for SRC.  */
-    	mtocrf  0x01,0
-    	subf    10,0,5
-2:  	bf	30,1f
-
-    	lhz	6,0(12)
-    	addi    12,12,2
-    	sth	6,0(3)
-    	addi    3,3,2
-1:  	bf	31,L(end_4bytes_alignment)
-
-    	lbz	6,0(12)
-    	addi    12,12,1
-    	stb	6,0(3)
-    	addi    3,3,1
-
-    	.align  4
+	mr	12,4
+	mtcrf   0x01,5
+	ble	cr6,L(copy_LE_8)
+
+	/* At least 9 bytes to go.  */
+	neg	8,4
+	clrrdi  11,4,2
+	andi.   0,8,3
+	cmpldi  cr1,5,16
+	mr	10,5
+	beq	L(copy_LT_32_aligned)
+
+	/* Force 4-bytes alignment for SRC.  */
+	mtocrf  0x01,0
+	subf    10,0,5
+2:	bf	30,1f
+
+	lhz	6,0(12)
+	addi    12,12,2
+	sth	6,0(3)
+	addi    3,3,2
+1:	bf	31,L(end_4bytes_alignment)
+
+	lbz	6,0(12)
+	addi    12,12,1
+	stb	6,0(3)
+	addi    3,3,1
+
+	.align  4
 L(end_4bytes_alignment):
 	cmpldi  cr1,10,16
-    	mtcrf   0x01,10
+	mtcrf   0x01,10
 
 L(copy_LT_32_aligned):
 	/* At least 6 bytes to go, and SRC is word-aligned.  */
-    	blt	cr1,8f
-
-    	/* Copy 16 bytes.  */
-    	lwz	6,0(12)
-    	lwz     7,4(12)
-    	stw     6,0(3)
-    	lwz     8,8(12)
-    	stw     7,4(3)
-    	lwz     6,12(12)
-    	addi    12,12,16
-    	stw     8,8(3)
-    	stw     6,12(3)
-    	addi    3,3,16
-8:  	/* Copy 8 bytes.  */
-    	bf	28,4f
-
-    	lwz     6,0(12)
-    	lwz     7,4(12)
-    	addi    12,12,8
-    	stw     6,0(3)
-    	stw     7,4(3)
-    	addi    3,3,8
-4:  	/* Copy 4 bytes.  */
-    	bf	29,2f
-
-    	lwz     6,0(12)
-    	addi    12,12,4
-    	stw     6,0(3)
-    	addi    3,3,4
-2:  	/* Copy 2-3 bytes.  */
-    	bf	30,1f
-
-    	lhz     6,0(12)
-    	sth     6,0(3)
-    	bf      31,0f
-    	lbz     7,2(12)
-    	stb     7,2(3)
-    	ld	3,-16(1)
-    	blr
-
-    	.align  4
-1:  	/* Copy 1 byte.  */
-    	bf	31,0f
-
-    	lbz	6,0(12)
-    	stb	6,0(3)
-0:  	/* Return original DST pointer.  */
-    	ld	3,-16(1)
-    	blr
-
-    	/* Handles copies of 0~8 bytes.  */
-    	.align  4
+	blt	cr1,8f
+
+	/* Copy 16 bytes.  */
+	lwz	6,0(12)
+	lwz     7,4(12)
+	stw     6,0(3)
+	lwz     8,8(12)
+	stw     7,4(3)
+	lwz     6,12(12)
+	addi    12,12,16
+	stw     8,8(3)
+	stw     6,12(3)
+	addi    3,3,16
+8:	/* Copy 8 bytes.  */
+	bf	28,4f
+
+	lwz     6,0(12)
+	lwz     7,4(12)
+	addi    12,12,8
+	stw     6,0(3)
+	stw     7,4(3)
+	addi    3,3,8
+4:	/* Copy 4 bytes.  */
+	bf	29,2f
+
+	lwz     6,0(12)
+	addi    12,12,4
+	stw     6,0(3)
+	addi    3,3,4
+2:	/* Copy 2-3 bytes.  */
+	bf	30,1f
+
+	lhz     6,0(12)
+	sth     6,0(3)
+	bf      31,0f
+	lbz     7,2(12)
+	stb     7,2(3)
+	ld	3,-16(1)
+	blr
+
+	.align  4
+1:	/* Copy 1 byte.  */
+	bf	31,0f
+
+	lbz	6,0(12)
+	stb	6,0(3)
+0:	/* Return original DST pointer.  */
+	ld	3,-16(1)
+	blr
+
+	/* Handles copies of 0~8 bytes.  */
+	.align  4
 L(copy_LE_8):
 	bne	cr6,4f
 
-    	/* Though we could've used ld/std here, they are still
-    	slow for unaligned cases.  */
-
-    	lwz	6,0(4)
-    	lwz     7,4(4)
-    	stw     6,0(3)
-    	stw     7,4(3)
-    	ld      3,-16(1)      /* Return original DST pointers.  */
-    	blr
-
-    	.align  4
-4:  	/* Copies 4~7 bytes.  */
-    	bf	29,2b
-
-    	lwz	6,0(4)
-    	stw     6,0(3)
-    	bf      30,5f
-    	lhz     7,4(4)
-    	sth     7,4(3)
-    	bf      31,0f
-    	lbz     8,6(4)
-    	stb     8,6(3)
-    	ld	3,-16(1)
-    	blr
-
-    	.align  4
-5:  	/* Copy 1 byte.  */
-    	bf	31,0f
-
-    	lbz	6,4(4)
-    	stb	6,4(3)
-
-0:  	/* Return original DST pointer.  */
-    	ld	3,-16(1)
-    	blr
-
-    	/* Handle copies of 32+ bytes where DST is aligned (to quadword) but
-    	SRC is not.  Use aligned quadword loads from SRC, shifted to realign
-    	the data, allowing for aligned DST stores.  */
-    	.align  4
+	/* Though we could've used ld/std here, they are still
+	slow for unaligned cases.  */
+
+	lwz	6,0(4)
+	lwz     7,4(4)
+	stw     6,0(3)
+	stw     7,4(3)
+	ld      3,-16(1)      /* Return original DST pointers.  */
+	blr
+
+	.align  4
+4:	/* Copies 4~7 bytes.  */
+	bf	29,2b
+
+	lwz	6,0(4)
+	stw     6,0(3)
+	bf      30,5f
+	lhz     7,4(4)
+	sth     7,4(3)
+	bf      31,0f
+	lbz     8,6(4)
+	stb     8,6(3)
+	ld	3,-16(1)
+	blr
+
+	.align  4
+5:	/* Copy 1 byte.  */
+	bf	31,0f
+
+	lbz	6,4(4)
+	stb	6,4(3)
+
+0:	/* Return original DST pointer.  */
+	ld	3,-16(1)
+	blr
+
+	/* Handle copies of 32+ bytes where DST is aligned (to quadword) but
+	SRC is not.  Use aligned quadword loads from SRC, shifted to realign
+	the data, allowing for aligned DST stores.  */
+	.align  4
 L(copy_GE_32_unaligned):
 	clrldi  0,0,60	      /* Number of bytes until the 1st
-    	    		      quadword.  */
-    	andi.   11,3,15       /* Check alignment of DST (against
-    	    		      quadwords).  */
-    	srdi    9,5,4	      /* Number of full quadwords remaining.  */
-
-    	beq	L(copy_GE_32_unaligned_cont)
-
-    	/* SRC is not quadword aligned, get it aligned.  */
-
-    	mtcrf   0x01,0
-    	subf    31,0,5
-
-    	/* Vector instructions work best when proper alignment (16-bytes)
-    	is present.  Move 0~15 bytes as needed to get DST quadword-aligned.  */
-1:  	/* Copy 1 byte.  */
-    	bf	31,2f
-
-    	lbz	6,0(12)
-    	addi    12,12,1
-    	stb	6,0(3)
-    	addi    3,3,1
-2:  	/* Copy 2 bytes.  */
-    	bf	30,4f
-
-    	lhz     6,0(12)
-    	addi    12,12,2
-    	sth     6,0(3)
-    	addi    3,3,2
-4:  	/* Copy 4 bytes.  */
-    	bf	29,8f
-
-    	lwz     6,0(12)
-    	addi    12,12,4
-    	stw     6,0(3)
-    	addi    3,3,4
-8:  	/* Copy 8 bytes.  */
-    	bf	28,0f
-
-    	ld	6,0(12)
-    	addi    12,12,8
-    	std	6,0(3)
-    	addi    3,3,8
+			      quadword.  */
+	andi.   11,3,15       /* Check alignment of DST (against
+			      quadwords).  */
+	srdi    9,5,4	      /* Number of full quadwords remaining.  */
+
+	beq	L(copy_GE_32_unaligned_cont)
+
+	/* SRC is not quadword aligned, get it aligned.  */
+
+	mtcrf   0x01,0
+	subf    31,0,5
+
+	/* Vector instructions work best when proper alignment (16-bytes)
+	is present.  Move 0~15 bytes as needed to get DST quadword-aligned.  */
+1:	/* Copy 1 byte.  */
+	bf	31,2f
+
+	lbz	6,0(12)
+	addi    12,12,1
+	stb	6,0(3)
+	addi    3,3,1
+2:	/* Copy 2 bytes.  */
+	bf	30,4f
+
+	lhz     6,0(12)
+	addi    12,12,2
+	sth     6,0(3)
+	addi    3,3,2
+4:	/* Copy 4 bytes.  */
+	bf	29,8f
+
+	lwz     6,0(12)
+	addi    12,12,4
+	stw     6,0(3)
+	addi    3,3,4
+8:	/* Copy 8 bytes.  */
+	bf	28,0f
+
+	ld	6,0(12)
+	addi    12,12,8
+	std	6,0(3)
+	addi    3,3,8
 0:
-    	clrldi  10,12,60      /* Check alignment of SRC.  */
-    	srdi    9,31,4	      /* Number of full quadwords remaining.  */
+	clrldi  10,12,60      /* Check alignment of SRC.  */
+	srdi    9,31,4	      /* Number of full quadwords remaining.  */
 
-    	/* The proper alignment is present, it is OK to copy the bytes now.  */
+	/* The proper alignment is present, it is OK to copy the bytes now.  */
 L(copy_GE_32_unaligned_cont):
 
-    	/* Setup two indexes to speed up the indexed vector operations.  */
-    	clrldi  11,31,60
-    	li      6,16	      /* Index for 16-bytes offsets.  */
-    	li	7,32	      /* Index for 32-bytes offsets.  */
-    	cmpldi  cr1,11,0
-    	srdi    8,31,5	      /* Setup the loop counter.  */
-    	mr      10,3
-    	mr      11,12
-    	mtcrf   0x01,9
-    	cmpldi  cr6,9,1
-    	lvsl    5,0,12
-    	lvx     3,0,12
-    	bf      31,L(setup_unaligned_loop)
-
-    	/* Copy another 16 bytes to align to 32-bytes due to the loop .  */
-    	lvx     4,12,6
-    	vperm   6,3,4,5
-    	addi    11,12,16
-    	addi    10,3,16
-    	stvx    6,0,3
-    	vor	3,4,4
+	/* Setup two indexes to speed up the indexed vector operations.  */
+	clrldi  11,31,60
+	li      6,16	      /* Index for 16-bytes offsets.  */
+	li	7,32	      /* Index for 32-bytes offsets.  */
+	cmpldi  cr1,11,0
+	srdi    8,31,5	      /* Setup the loop counter.  */
+	mr      10,3
+	mr      11,12
+	mtcrf   0x01,9
+	cmpldi  cr6,9,1
+	lvsl    5,0,12
+	lvx     3,0,12
+	bf      31,L(setup_unaligned_loop)
+
+	/* Copy another 16 bytes to align to 32-bytes due to the loop .  */
+	lvx     4,12,6
+	vperm   6,3,4,5
+	addi    11,12,16
+	addi    10,3,16
+	stvx    6,0,3
+	vor	3,4,4
 
 L(setup_unaligned_loop):
-    	mtctr   8
-    	ble     cr6,L(end_unaligned_loop)
+	mtctr   8
+	ble     cr6,L(end_unaligned_loop)
 
-    	/* Copy 32 bytes at a time using vector instructions.  */
-    	.align  4
+	/* Copy 32 bytes at a time using vector instructions.  */
+	.align  4
 L(unaligned_loop):
 
-    	/* Note: vr6/vr10 may contain data that was already copied,
-    	but in order to get proper alignment, we may have to copy
-    	some portions again. This is faster than having unaligned
-    	vector instructions though.  */
-
-    	lvx	4,11,6	      /* vr4 = r11+16.  */
-    	vperm   6,3,4,5	      /* Merge the correctly-aligned portions
-    	    		      of vr3/vr4 into vr6.  */
-    	lvx	3,11,7	      /* vr3 = r11+32.  */
-    	vperm   10,4,3,5      /* Merge the correctly-aligned portions
-    	    		      of vr3/vr4 into vr10.  */
-    	addi    11,11,32
-    	stvx    6,0,10
-    	stvx    10,10,6
-    	addi    10,10,32
-
-    	bdnz	L(unaligned_loop)
-
-    	.align  4
+	/* Note: vr6/vr10 may contain data that was already copied,
+	but in order to get proper alignment, we may have to copy
+	some portions again. This is faster than having unaligned
+	vector instructions though.  */
+
+	lvx	4,11,6	      /* vr4 = r11+16.  */
+	vperm   6,3,4,5	      /* Merge the correctly-aligned portions
+			      of vr3/vr4 into vr6.  */
+	lvx	3,11,7	      /* vr3 = r11+32.  */
+	vperm   10,4,3,5      /* Merge the correctly-aligned portions
+			      of vr3/vr4 into vr10.  */
+	addi    11,11,32
+	stvx    6,0,10
+	stvx    10,10,6
+	addi    10,10,32
+
+	bdnz	L(unaligned_loop)
+
+	.align  4
 L(end_unaligned_loop):
 
-    	/* Check for tail bytes.  */
-    	rldicr  0,31,0,59
-    	mtcrf   0x01,31
-    	beq	cr1,0f
-
-    	add	3,3,0
-    	add	12,12,0
-
-    	/*  We have 1~15 tail bytes to copy, and DST is quadword aligned.  */
-8:  	/* Copy 8 bytes.  */
-    	bf	28,4f
-
-    	lwz	6,0(12)
-    	lwz	7,4(12)
-    	addi    12,12,8
-    	stw	6,0(3)
-    	stw	7,4(3)
-    	addi    3,3,8
-4:  	/* Copy 4 bytes.  */
-    	bf	29,2f
-
-    	lwz	6,0(12)
-    	addi    12,12,4
-    	stw	6,0(3)
-    	addi    3,3,4
-2:  	/* Copy 2~3 bytes.  */
-    	bf	30,1f
-
-    	lhz	6,0(12)
-    	addi    12,12,2
-    	sth	6,0(3)
-    	addi    3,3,2
-1:  	/* Copy 1 byte.  */
-    	bf	31,0f
-
-    	lbz	6,0(12)
-    	stb	6,0(3)
-0:  	/* Return original DST pointer.  */
-    	ld	31,-8(1)
-    	ld	3,-16(1)
-    	blr
+	/* Check for tail bytes.  */
+	rldicr  0,31,0,59
+	mtcrf   0x01,31
+	beq	cr1,0f
+
+	add	3,3,0
+	add	12,12,0
+
+	/*  We have 1~15 tail bytes to copy, and DST is quadword aligned.  */
+8:	/* Copy 8 bytes.  */
+	bf	28,4f
+
+	lwz	6,0(12)
+	lwz	7,4(12)
+	addi    12,12,8
+	stw	6,0(3)
+	stw	7,4(3)
+	addi    3,3,8
+4:	/* Copy 4 bytes.  */
+	bf	29,2f
+
+	lwz	6,0(12)
+	addi    12,12,4
+	stw	6,0(3)
+	addi    3,3,4
+2:	/* Copy 2~3 bytes.  */
+	bf	30,1f
+
+	lhz	6,0(12)
+	addi    12,12,2
+	sth	6,0(3)
+	addi    3,3,2
+1:	/* Copy 1 byte.  */
+	bf	31,0f
+
+	lbz	6,0(12)
+	stb	6,0(3)
+0:	/* Return original DST pointer.  */
+	ld	31,-8(1)
+	ld	3,-16(1)
+	blr
 
 END_GEN_TB (BP_SYM (memcpy),TB_TOCLESS)
 libc_hidden_builtin_def (memcpy)

From 4bf7d392453cbcbd65b36c054e1fdbdb1590def7 Mon Sep 17 00:00:00 2001
From: Roland McGrath <roland@redhat.com>
Date: Thu, 11 Mar 2010 00:44:28 -0800
Subject: [PATCH 04/76] elf.h: Add missing R_X86_64_*64 relocs.

---
 ChangeLog | 5 +++++
 elf/elf.h | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 218545435a..c3fda93de9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-11  Roland McGrath  <roland@redhat.com>
+
+	* elf/elf.h (R_X86_64_GOT64, R_X86_64_GOTPCREL64): New macros.
+	(R_X86_64_GOTPC64, R_X86_64_GOTPLT64, R_X86_64_PLTOFF64): New macros.
+
 2010-03-10  Luis Machado  <luisgpm@br.ibm.com>
 
 	* sysdeps/powerpc/powerpc64/power7/memcpy.S: New file.
diff --git a/elf/elf.h b/elf/elf.h
index fd6236b8cf..f41a02649e 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -2666,7 +2666,13 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_X86_64_GOTOFF64	25	/* 64 bit offset to GOT */
 #define R_X86_64_GOTPC32	26	/* 32 bit signed pc relative
 					   offset to GOT */
-/* 27 .. 31 */
+#define R_X86_64_GOT64		27	/* 64-bit GOT entry offset */
+#define R_X86_64_GOTPCREL64	28	/* 64-bit PC relative offset
+					   to GOT entry */
+#define R_X86_64_GOTPC64	29	/* 64-bit PC relative offset to GOT */
+#define R_X86_64_GOTPLT64	30 	/* like GOT64, says PLT entry needed */
+#define R_X86_64_PLTOFF64	31	/* 64-bit GOT relative offset
+					   to PLT entry */
 #define R_X86_64_SIZE32		32	/* Size of symbol plus 32-bit addend */
 #define R_X86_64_SIZE64		33	/* Size of symbol plus 64-bit addend */
 #define R_X86_64_GOTPC32_TLSDESC 34	/* GOT offset for TLS descriptor.  */

From 4c35fb65c9ea221561bc5698358944a73383b3d6 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Fri, 12 Mar 2010 07:57:19 -0800
Subject: [PATCH 05/76] Don't underestimate length of DST substitution

---
 ChangeLog    |  5 +++++
 elf/dl-dst.h | 21 +++++++++++++--------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c3fda93de9..be5d5557e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-12  Andreas Schwab  <schwab@redhat.com>
+
+	* elf/dl-dst.h: Include "trusted-dirs.h".
+	(DL_DST_REQUIRED): Take $LIB into account.
+
 2010-03-11  Roland McGrath  <roland@redhat.com>
 
 	* elf/elf.h (R_X86_64_GOT64, R_X86_64_GOTPCREL64): New macros.
diff --git a/elf/dl-dst.h b/elf/dl-dst.h
index 76076a6036..ae8d119c0d 100644
--- a/elf/dl-dst.h
+++ b/elf/dl-dst.h
@@ -18,6 +18,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) \
@@ -39,12 +41,13 @@
 									      \
     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.  */	      \
@@ -53,14 +56,16 @@
 	  {								      \
 	    assert ((l)->l_name[0] == '\0');				      \
 	    (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 +77,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

From 94db8db8e80d8b7fe094dee92660c158bf62d732 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Fri, 12 Mar 2010 08:44:10 -0800
Subject: [PATCH 06/76] Define UMOUNT_NOFOLLOW.

---
 ChangeLog                           | 4 ++++
 sysdeps/unix/sysv/linux/sys/mount.h | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index be5d5557e5..e8781598a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-12  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/sys/mount.h (UMOUNT_NOFOLLOW): Define.
+
 2010-03-12  Andreas Schwab  <schwab@redhat.com>
 
 	* elf/dl-dst.h: Include "trusted-dirs.h".
diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
index a41220d14e..923b4616ca 100644
--- a/sysdeps/unix/sysv/linux/sys/mount.h
+++ b/sysdeps/unix/sysv/linux/sys/mount.h
@@ -123,8 +123,10 @@ enum
 #define MNT_FORCE MNT_FORCE
   MNT_DETACH = 2,		/* Just detach from the tree.  */
 #define MNT_DETACH MNT_DETACH
-  MNT_EXPIRE = 4		/* Mark for expiry.  */
+  MNT_EXPIRE = 4,		/* Mark for expiry.  */
 #define MNT_EXPIRE MNT_EXPIRE
+  UMOUNT_NOFOLLOW = 8		/* Don't follow symlink on umount.  */
+#define UMOUNT_NOFOLLOW UMOUNT_NOFOLLOW
 };
 
 

From 92ad15a8f1d3e65f20fda3265c04ff26a642a2d0 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Mon, 15 Mar 2010 11:44:58 -0700
Subject: [PATCH 07/76] Implement handling of libc ABI in ELF header.

---
 ChangeLog     |  8 ++++++++
 Makerules     | 16 ++++++++++++++--
 csu/version.c |  8 ++++++--
 elf/dl-load.c |  6 ++++--
 4 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e8781598a9..21137d77e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-15  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makerules: Add rule for libc-abis.h.
+	* csu/version.c: Use LIBC_ABIS_STRING string if available.
+	* elf/dl-load.c (VALID_ELF_ABIVERSION): Check using LIBC_ABI_MAX.
+	(open_verify): Only check EI_ABIVERSION bytes using VALID_ELF_HEADER.
+	Add extra call to VALID_ELF_ABIVERSION.
+
 2010-03-12  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/sys/mount.h (UMOUNT_NOFOLLOW): Define.
diff --git a/Makerules b/Makerules
index 43fa5a701b..d5ff383770 100644
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright (C) 1991-2006,2007,2008,2009,2010 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -109,6 +109,18 @@ $(common-objpfx)%.latest: $(common-objpfx)abi-versions.h
 endif # avoid-generated
 endif # $(versioning) = yes
 
+ifndef avoid-generated
+before-compile := $(common-objpfx)libc-abis.h $(before-compile)
+libc-abis := $(firstword $(wildcard $(foreach D,$(add-ons), $(..)libc-abis)) \
+			 libc-abis)
+$(common-objpfx)libc-abis.h: $(..)scripts/gen-libc-abis $(libc-abis)
+	$(SHELL) $(..)scripts/gen-libc-abis \
+		 $(base-machine)-$(config-vendor)-$(config-os) \
+		 < $(libc-abis) > $@T
+	$(move-if-change) $@T $@
+common-generated += $(common-objpfx)libc-abis.h
+endif # avoid-generated
+
 # Make sure the subdirectory for object files gets created.
 ifdef objpfx
 ifeq (,$(wildcard $(objpfx).))
@@ -1395,7 +1407,7 @@ $(objpfx)stubs: $(objs-for-stubs)
 ifneq (,$(strip $(objs-for-stubs)))
 	(cd $(objpfx).; $(OBJDUMP) -h $(patsubst $(objpfx)%,%,$^)) | \
 	$(AWK) '/\.gnu\.glibc-stub\./ { \
-	          sub(/\.gnu\.glibc-stub\./, "", $$2); \
+		  sub(/\.gnu\.glibc-stub\./, "", $$2); \
 		  stubs[$$2] = 1; } \
 		END { for (s in stubs) print "#define __stub_" s }' > $@T
 	mv -f $@T $@
diff --git a/csu/version.c b/csu/version.c
index db913be800..8e32f312a9 100644
--- a/csu/version.c
+++ b/csu/version.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,7 @@
 
 #include "version.h"
 #include <tls.h>
+#include <libc-abis.h>
 #include <gnu/libc-version.h>
 
 static const char __libc_release[] = RELEASE;
@@ -25,12 +26,15 @@ static const char __libc_version[] = VERSION;
 
 static const char banner[] =
 "GNU C Library "RELEASE" release version "VERSION", by Roland McGrath et al.\n\
-Copyright (C) 2009 Free Software Foundation, Inc.\n\
+Copyright (C) 2010 Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.\n\
 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
 PARTICULAR PURPOSE.\n\
 Compiled by GNU CC version "__VERSION__".\n"
 #include "version-info.h"
+#ifdef LIBC_ABIS_STRING
+LIBC_ABIS_STRING
+#endif
 #ifdef GLIBC_OLDEST_ABI
 "The oldest ABI supported: " GLIBC_OLDEST_ABI ".\n"
 #endif
diff --git a/elf/dl-load.c b/elf/dl-load.c
index e8c7be55f7..1cfab353d0 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1569,7 +1569,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 #ifndef VALID_ELF_HEADER
 # define VALID_ELF_HEADER(hdr,exp,size)	(memcmp (hdr, exp, size) == 0)
 # define VALID_ELF_OSABI(osabi)		(osabi == ELFOSABI_SYSV)
-# define VALID_ELF_ABIVERSION(ver)	(ver == 0)
+# define VALID_ELF_ABIVERSION(ver)	(ver < LIBC_ABI_MAX)
 #elif defined MORE_ELF_HEADER_DATA
   MORE_ELF_HEADER_DATA;
 #endif
@@ -1655,7 +1655,9 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 
       /* See whether the ELF header is what we expect.  */
       if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected,
-						EI_PAD), 0))
+						EI_ABIVERSION)
+			    || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]),
+			    0))
 	{
 	  /* Something is wrong.  */
 	  const Elf32_Word *magp = (const void *) ehdr->e_ident;

From 561470e061b4210385ace824cac6139bccde094c Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Mon, 15 Mar 2010 11:50:59 -0700
Subject: [PATCH 08/76] Update copyright year.

---
 ChangeLog                   | 17 +++++++++++++++++
 catgets/gencat.c            |  4 ++--
 debug/catchsegv.sh          |  6 +++---
 debug/xtrace.sh             |  4 ++--
 elf/ldconfig.c              |  4 ++--
 elf/ldd.bash.in             |  6 +++---
 elf/sprof.c                 |  6 +++---
 iconv/iconv_prog.c          |  6 +++---
 iconv/iconvconfig.c         | 32 ++++++++++++++++----------------
 locale/programs/locale.c    | 10 +++++-----
 locale/programs/localedef.c |  8 ++++----
 malloc/memusage.sh          | 10 +++++-----
 malloc/mtrace.pl            |  4 ++--
 nscd/nscd.c                 |  8 ++++----
 nss/getent.c                |  4 ++--
 posix/getconf.c             |  4 ++--
 16 files changed, 75 insertions(+), 58 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 21137d77e4..5d5df59c8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2010-03-15  Ulrich Drepper  <drepper@redhat.com>
 
+	* posix/getconf.c: Update copyright year.
+	* nss/getent.c: Likewise.
+	* iconv/iconvconfig.c: Likewise.
+	* iconv/iconv_prog.c: Likewise.
+	* elf/ldconfig.c: Likewise.
+	* catgets/gencat.c: Likewise.
+	* csu/version.c: Likewise.
+	* elf/ldd.bash.in: Likewise.
+	* elf/sprof.c (print_version): Likewise.
+	* locale/programs/locale.c: Likewise.
+	* locale/programs/localedef.c: Likewise.
+	* nscd/nscd.c (print_version): Likewise.
+	* debug/xtrace.sh: Likewise.
+	* malloc/memusage.sh: Likewise.
+	* malloc/mtrace.pl: Likewise.
+	* debug/catchsegv.sh: Likewise.
+
 	* Makerules: Add rule for libc-abis.h.
 	* csu/version.c: Use LIBC_ABIS_STRING string if available.
 	* elf/dl-load.c (VALID_ELF_ABIVERSION): Check using LIBC_ABI_MAX.
diff --git a/catgets/gencat.c b/catgets/gencat.c
index e9a371fd5b..32a81cab35 100644
--- a/catgets/gencat.c
+++ b/catgets/gencat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 1996.
 
@@ -247,7 +247,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\
-"), "2009");
+"), "2010");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
diff --git a/debug/catchsegv.sh b/debug/catchsegv.sh
index 5a91d21137..d78fec5e63 100755
--- a/debug/catchsegv.sh
+++ b/debug/catchsegv.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998,1999,2001,2003,2004,2006,2007,2008,2009
+# Copyright (C) 1998,1999,2001,2003,2004,2006,2007,2008,2009,2010
 # Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -40,7 +40,7 @@ if test $# -eq 0; then
       ;;
     --v | --ve | --ver | --vers | --versi | --versio | --version)
       echo 'catchsegv (GNU libc) @VERSION@'
-      echo 'Copyright (C) 2009 Free Software Foundation, Inc.
+      echo 'Copyright (C) 2010 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 Written by Ulrich Drepper.'
@@ -97,7 +97,7 @@ if test -s "$segv_output"; then
 	      echo "$line"
 	    fi
 	    ;;
-         *) echo "$line"
+	 *) echo "$line"
 	    ;;
      esac
    done)
diff --git a/debug/xtrace.sh b/debug/xtrace.sh
index 8ef507ef38..3cf9b0c0f4 100755
--- a/debug/xtrace.sh
+++ b/debug/xtrace.sh
@@ -1,5 +1,5 @@
 #! @BASH@
-# Copyright (C) 1999, 2001-2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001-2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
 
@@ -66,7 +66,7 @@ do_version() {
   printf $"Copyright (C) %s Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2009"
+" "2010"
   printf $"Written by %s.
 " "Ulrich Drepper"
   exit 0
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 78a0f0c2a8..efa67253f5 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999.
 
@@ -317,7 +317,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\
-"), "2009");
+"), "2010");
   fprintf (stream, gettext ("Written by %s.\n"),
 	   "Andreas Jaeger");
 }
diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
index 1bbefe2ff0..00ab15f76d 100644
--- a/elf/ldd.bash.in
+++ b/elf/ldd.bash.in
@@ -1,5 +1,5 @@
 #! @BASH@
-# Copyright (C) 1996-2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -39,7 +39,7 @@ while test $# -gt 0; do
     printf $"Copyright (C) %s Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2009"
+" "2010"
     printf $"Written by %s and %s.
 " "Roland McGrath" "Ulrich Drepper"
     exit 0
@@ -160,7 +160,7 @@ warning: you do not have execution permission for" "\`$file'" >&2
     for rtld in ${RTLDLIST}; do
       if test -x $rtld; then
 	verify_out=`${rtld} --verify "$file"`
-        ret=$?
+	ret=$?
 	case $ret in
 	[02]) RTLD=${rtld}; break;;
 	esac
diff --git a/elf/sprof.c b/elf/sprof.c
index 96d854fb70..a2cc974bba 100644
--- a/elf/sprof.c
+++ b/elf/sprof.c
@@ -1,5 +1,5 @@
 /* Read and display shared object profiling data.
-   Copyright (C) 1997-2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1997-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -261,7 +261,7 @@ main (int argc, char *argv[])
     {
       /* We need exactly two non-option parameter.  */
       argp_help (&argp, stdout, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR,
-                 program_invocation_short_name);
+		 program_invocation_short_name);
       exit (1);
     }
 
@@ -388,7 +388,7 @@ Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
 "),
-	   "2009");
+	   "2010");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
index 3bcb9b464e..7354f68715 100644
--- a/iconv/iconv_prog.c
+++ b/iconv/iconv_prog.c
@@ -1,5 +1,5 @@
 /* Convert text in given files from the specified from-set to the to-set.
-   Copyright (C) 1998-2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1998-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -424,7 +424,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\
-"), "2009");
+"), "2010");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
@@ -501,7 +501,7 @@ process_block (iconv_t cd, char *addr, size_t len, FILE **output,
       if (n != (size_t) -1)
 	{
 	  /* All the input test is processed.  For state-dependent
-             character sets we have to flush the state now.  */
+	     character sets we have to flush the state now.  */
 	  outptr = outbuf;
 	  outlen = OUTBUF_SIZE;
 	  n = iconv (cd, NULL, NULL, &outptr, &outlen);
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
index 1d95e89a84..e4d5b3a89b 100644
--- a/iconv/iconvconfig.c
+++ b/iconv/iconvconfig.c
@@ -1,5 +1,5 @@
 /* Generate fastloading iconv module configuration files.
-   Copyright (C) 2000-2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2000-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
 
@@ -396,7 +396,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\
-"), "2009");
+"), "2010");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
@@ -993,24 +993,24 @@ next_prime (uint32_t seed)
    stoff    ???          String table
 
    hoff     8*hsize      Array of tuples
-                            string table offset
-                            module index
+			    string table offset
+			    module index
 
    moff     ???          Array of tuples
-                            canonical name offset
-                            from-internal module dir name offset
-                            from-internal module name off
-                            to-internal module dir name offset
-                            to-internal module name offset
-                            offset into other conversion table
+			    canonical name offset
+			    from-internal module dir name offset
+			    from-internal module name off
+			    to-internal module dir name offset
+			    to-internal module name offset
+			    offset into other conversion table
 
    ooff     ???          One or more of
-                            number of steps/modules
-                            one or more of tuple
-                              canonical name offset for output
-                              module dir name offset
-                              module name offset
-                         (following last entry with step count 0)
+			    number of steps/modules
+			    one or more of tuple
+			      canonical name offset for output
+			      module dir name offset
+			      module name offset
+			 (following last entry with step count 0)
 */
 
 static struct hash_entry *hash_table;
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 77262b7d1c..a3602cf118 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -1,5 +1,5 @@
 /* Implementation of the locale program according to POSIX 9945-2.
-   Copyright (C) 1995-1997, 1999-2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 1999-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
@@ -144,7 +144,7 @@ struct category
 #define DEFINE_CATEGORY(category, name, items, postload) \
     static struct cat_item category##_desc[] =				      \
       {									      \
-        NO_PAREN items							      \
+	NO_PAREN items							      \
       };
 
 #include "categories.def"
@@ -294,7 +294,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\
-"), "2009");
+"), "2010");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
@@ -539,7 +539,7 @@ write_locales (void)
 	     because
 	     a) we are only interested in the first two fields
 	     b) these fields must be usable as file names and so must
-	        not be that long  */
+		not be that long  */
 	  char buf[BUFSIZ];
 	  char *alias;
 	  char *value;
@@ -886,7 +886,7 @@ show_info (const char *name)
 	    while (cnt > 1)
 	      {
 		printf ("%d;", *val == '\177' ? -1 : *val);
-                --cnt;
+		--cnt;
 		++val;
 	      }
 
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index c8eebc7e5c..4cb0d862ca 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
@@ -365,8 +365,8 @@ more_help (int key, const char *text, void *input)
       /* We print some extra information.  */
       if (asprintf (&cp, gettext ("\
 System's directory for character maps : %s\n\
-                       repertoire maps: %s\n\
-                       locale path    : %s\n\
+		       repertoire maps: %s\n\
+		       locale path    : %s\n\
 %s"),
 		    CHARMAP_PATH, REPERTOIREMAP_PATH, LOCALE_PATH, gettext ("\
 For bug reporting instructions, please see:\n\
@@ -388,7 +388,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\
-"), "2009");
+"), "2010");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
diff --git a/malloc/memusage.sh b/malloc/memusage.sh
index 9fab0a3b8b..ec34486b55 100755
--- a/malloc/memusage.sh
+++ b/malloc/memusage.sh
@@ -1,5 +1,5 @@
 #! @BASH@
-# Copyright (C) 1999-2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1999-2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
 
@@ -73,7 +73,7 @@ do_version() {
   printf $"Copyright (C) %s Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2009"
+" "2010"
   printf $"Written by %s.
 " "Ulrich Drepper"
   exit 0
@@ -99,9 +99,9 @@ while test $# -gt 0; do
     ;;
   --us | --usa | --usag | --usage)
     echo $"Syntax: memusage [--data=FILE] [--progname=NAME] [--png=FILE] [--unbuffered]
-            [--buffer=SIZE] [--no-timer] [--time-based] [--total]
-            [--title=STRING] [--x-size=SIZE] [--y-size=SIZE]
-            PROGRAM [PROGRAMOPTION]..."
+	    [--buffer=SIZE] [--no-timer] [--time-based] [--total]
+	    [--title=STRING] [--x-size=SIZE] [--y-size=SIZE]
+	    PROGRAM [PROGRAMOPTION]..."
     exit 0
     ;;
   -n | --pr | --pro | --prog | --progn | --progna | --prognam | --progname)
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
index 1c13ae0370..82318dca58 100644
--- a/malloc/mtrace.pl
+++ b/malloc/mtrace.pl
@@ -1,7 +1,7 @@
 #! @PERL@
 eval "exec @PERL@ -S $0 $@"
     if 0;
-# Copyright (C) 1997-2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1997-2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@gnu.org>, 1997.
 # Based on the mtrace.awk script.
@@ -45,7 +45,7 @@ sub usage {
 	$ARGV[0] eq "--vers" || $ARGV[0] eq "--versi" ||
 	$ARGV[0] eq "--versio" || $ARGV[0] eq "--version") {
 	print "mtrace (GNU $PACKAGE) $VERSION\n";
-	print "Copyright (C) 2009 Free Software Foundation, Inc.\n";
+	print "Copyright (C) 2010 Free Software Foundation, Inc.\n";
 	print "This is free software; see the source for copying conditions.  There is NO\n";
 	print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
 	print "Written by Ulrich Drepper <drepper\@gnu.org>\n";
diff --git a/nscd/nscd.c b/nscd/nscd.c
index b9035f2131..7e70f2b116 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (c) 1998-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -246,7 +246,7 @@ main (int argc, char **argv)
       openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
 
       if (write_pid (_PATH_NSCDPID) < 0)
-        dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
 
       if (!init_logfile ())
 	dbg_log (_("Could not create log file"));
@@ -430,7 +430,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\
-"), "2009");
+"), "2010");
   fprintf (stream, gettext ("Written by %s.\n"),
 	   "Thorsten Kukuk and Ulrich Drepper");
 }
@@ -511,7 +511,7 @@ check_pid (const char *file)
 	 the PID is the same as the current process' since tha latter
 	 can mean we re-exec.  */
       if ((n != 1 || kill (pid, 0) == 0) && pid != getpid ())
-        return 1;
+	return 1;
     }
 
   return 0;
diff --git a/nss/getent.c b/nss/getent.c
index d70a8da0f4..69eea25a68 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (c) 1998-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -83,7 +83,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\
-"), "2009");
+"), "2010");
   fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
 }
 
diff --git a/posix/getconf.c b/posix/getconf.c
index d9d90e44f7..25f4307bea 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 1995-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 1995-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
@@ -1105,7 +1105,7 @@ main (int argc, char *argv[])
 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\
-"), "2009");
+"), "2010");
       printf (gettext ("Written by %s.\n"), "Roland McGrath");
       return 0;
     }

From bf219bc6fcd970d67ad76dbf3c96cdcdc951e083 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Tue, 16 Mar 2010 04:47:33 -0700
Subject: [PATCH 09/76] Missing files for libc ABI handling.

---
 libc-abis             | 44 +++++++++++++++++++++++++++++++++++++++++++
 scripts/gen-libc-abis | 26 +++++++++++++++++++++++++
 2 files changed, 70 insertions(+)
 create mode 100644 libc-abis
 create mode 100644 scripts/gen-libc-abis

diff --git a/libc-abis b/libc-abis
new file mode 100644
index 0000000000..6e9cce8904
--- /dev/null
+++ b/libc-abis
@@ -0,0 +1,44 @@
+# Definition of features which introduce new libc ABI versions.  This
+# file is used to create a header file with definitions for the various
+# versions.  The static linker will encode in the EI_ABIVERSION field in
+# the e_ident array in the ELF program header the required ABI version.
+# This is not a bitmask.  The maximum ABI version required must be
+# encoded.
+#
+# Adding new features should always happen by appending new lines.  Never
+# add entries in the middle or where they seem "logical".  Once a version
+# is assigned to a feature it must not change again.  Since some features
+# are conditionally added this can only ever be done securely without much
+# risk is by adding at the end.
+#
+# The following lines have one of two formats:
+#
+#	SYMBOL
+# With just a symbol on the line this is the name of a feature which
+# is architecture independent.
+#
+#	SYMBOL	PLATFORM
+# Using this form architecture (and platform) dependent features can be
+# specified.  The PLATFORM name can use the wildcards available in
+# the Bourne shell's case expression.
+#
+# Note that the same symbol can be used using different platform triples.
+# They don't have to be in the same order relative to other entries.  This
+# can happen if the feature is implemented for different architectures
+# at different times.
+#
+# This file is parsed by a script which produces a header file containing
+# a single enum definition.  An extra symbol is added as entry zero to
+# specify the default ABI with number 0 and an artificial last entry is
+# added to allow computing the maximum ABI version for the platform.
+#
+# Feature Name	Configuration
+# ------------	-------------
+#
+# Unique symbol definitions for C++.
+# Architecture independent, all ELF targets (== all targets)
+UNIQUE
+#
+# Indirect PLT relocations.  Architecture dependent.
+IFUNC		x86_64-*-linux*
+IFUNC		i?86-*-linux*
diff --git a/scripts/gen-libc-abis b/scripts/gen-libc-abis
new file mode 100644
index 0000000000..ce9ac5e20d
--- /dev/null
+++ b/scripts/gen-libc-abis
@@ -0,0 +1,26 @@
+#! /bin/sh
+triple="$1"
+
+printf "#ifndef _LIBC_ABIS_H\n#define _LIBC_ABIS_H 1\n\n"
+printf "enum\n{\n  LIBC_ABI_DEFAULT = 0,\n"
+
+while read s t; do
+  if test "$s" = "#" || test -z "$s"; then continue; fi
+  if test -z "$t"; then
+    printf "  LIBC_ABI_%s,\n" "$s"
+    features="$features $s"
+  else
+    case "$triple" in
+      $t) printf "  LIBC_ABI_%s,\n" "$s"
+	  features="$features $s" ;;
+       *) ;;
+    esac
+  fi
+done
+
+printf "  LIBC_ABI_MAX\n};\n"
+printf "\n#endif\n"
+
+if test -n "$features"; then
+  printf "#define LIBC_ABIS_STRING \"libc ABIs:%s\\\\n\"\n" "$features"
+fi

From 8ed9a2b18bc6d9bb2be89562fe1e14f9c3cf3346 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Tue, 16 Mar 2010 14:39:45 -0700
Subject: [PATCH 10/76] Also update Linux-specific VALID_ELF_ABIVERSION
 definition.

---
 ChangeLog                          | 5 +++++
 sysdeps/unix/sysv/linux/ldsodefs.h | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 5d5df59c8b..ed27976ad6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-16  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_ABIVERSION): Update
+	definition to follow generic code.
+
 2010-03-15  Ulrich Drepper  <drepper@redhat.com>
 
 	* posix/getconf.c: Update copyright year.
diff --git a/sysdeps/unix/sysv/linux/ldsodefs.h b/sysdeps/unix/sysv/linux/ldsodefs.h
index 0965f1496f..438c9e0c8d 100644
--- a/sysdeps/unix/sysv/linux/ldsodefs.h
+++ b/sysdeps/unix/sysv/linux/ldsodefs.h
@@ -58,7 +58,7 @@ extern void _dl_non_dynamic_init (void) internal_function;
 					 || memcmp (hdr, expected2, size) == 0)
 #define VALID_ELF_OSABI(osabi)		(osabi == ELFOSABI_SYSV \
 					 || osabi == ELFOSABI_LINUX)
-#define VALID_ELF_ABIVERSION(ver)	(ver == 0)
+#define VALID_ELF_ABIVERSION(ver)	(ver < LIBC_ABI_MAX)
 #define MORE_ELF_HEADER_DATA \
   static const unsigned char expected2[EI_PAD] =	\
   {							\

From d8c47894ca28d5c5cf396aa271c579d41f21c1d4 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Tue, 16 Mar 2010 23:34:59 -0700
Subject: [PATCH 11/76] Extended ELF ABI version handling only for Linux.

If the OSABI is generic we should not allow the ABI version to be nonzero.
Move all the new functionality into Linux-specific files.
---
 ChangeLog                          | 10 ++++++++++
 elf/dl-load.c                      |  8 +++++---
 sysdeps/unix/sysv/linux/ldsodefs.h |  9 +++++----
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ed27976ad6..a8eba156a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2010-03-16  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/dl-load.c (VALID_ELF_ABIVERSION): Add additional osabi parameter.
+	Not used here.
+	(open_verify): Modify for extended VALID_ELF_ABIVERSION macro
+	interface.
+	* sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_ABIVERSION): Add
+	additional osabi parameter.  Only acceept nonzero ABI versions if osabi
+	is Linux.
+	Fix includes.
+	(expected2): Don't explicitly initialize EI_ABIVERSION byte.
+
 	* sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_ABIVERSION): Update
 	definition to follow generic code.
 
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1cfab353d0..756816f25f 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1569,7 +1569,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 #ifndef VALID_ELF_HEADER
 # define VALID_ELF_HEADER(hdr,exp,size)	(memcmp (hdr, exp, size) == 0)
 # define VALID_ELF_OSABI(osabi)		(osabi == ELFOSABI_SYSV)
-# define VALID_ELF_ABIVERSION(ver)	(ver < LIBC_ABI_MAX)
+# define VALID_ELF_ABIVERSION(osabi,ver) (ver == 0)
 #elif defined MORE_ELF_HEADER_DATA
   MORE_ELF_HEADER_DATA;
 #endif
@@ -1656,7 +1656,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
       /* See whether the ELF header is what we expect.  */
       if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected,
 						EI_ABIVERSION)
-			    || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]),
+			    || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI],
+						      ehdr->e_ident[EI_ABIVERSION]),
 			    0))
 	{
 	  /* Something is wrong.  */
@@ -1697,7 +1698,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 	     allowed here.  */
 	  else if (!VALID_ELF_OSABI (ehdr->e_ident[EI_OSABI]))
 	    errstring = N_("ELF file OS ABI invalid");
-	  else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]))
+	  else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI],
+					  ehdr->e_ident[EI_ABIVERSION]))
 	    errstring = N_("ELF file ABI version invalid");
 	  else
 	    /* Otherwise we don't know what went wrong.  */
diff --git a/sysdeps/unix/sysv/linux/ldsodefs.h b/sysdeps/unix/sysv/linux/ldsodefs.h
index 438c9e0c8d..5d5b1b4c06 100644
--- a/sysdeps/unix/sysv/linux/ldsodefs.h
+++ b/sysdeps/unix/sysv/linux/ldsodefs.h
@@ -1,5 +1,5 @@
 /* Run-time dynamic linker data structures for loaded ELF shared objects.
-   Copyright (C) 2001, 2002, 2003, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2006, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +19,7 @@
 
 #ifndef	_LDSODEFS_H
 
+#include <libc-abis.h>
 #include <kernel-features.h>
 
 /* Get the real definitions.  */
@@ -58,7 +59,8 @@ extern void _dl_non_dynamic_init (void) internal_function;
 					 || memcmp (hdr, expected2, size) == 0)
 #define VALID_ELF_OSABI(osabi)		(osabi == ELFOSABI_SYSV \
 					 || osabi == ELFOSABI_LINUX)
-#define VALID_ELF_ABIVERSION(ver)	(ver < LIBC_ABI_MAX)
+#define VALID_ELF_ABIVERSION(osabi,ver) \
+  (ver == 0 || (osabi == ELFOSABI_LINUX && ver < LIBC_ABI_MAX))
 #define MORE_ELF_HEADER_DATA \
   static const unsigned char expected2[EI_PAD] =	\
   {							\
@@ -69,8 +71,7 @@ extern void _dl_non_dynamic_init (void) internal_function;
     [EI_CLASS] = ELFW(CLASS),				\
     [EI_DATA] = byteorder,				\
     [EI_VERSION] = EV_CURRENT,				\
-    [EI_OSABI] = ELFOSABI_LINUX,			\
-    [EI_ABIVERSION] = 0					\
+    [EI_OSABI] = ELFOSABI_LINUX				\
   }
 
 #endif /* ldsodefs.h */

From 12e6ee86c4f2b17a0f702a46b782447389d4bd82 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Wed, 17 Mar 2010 02:43:12 -0700
Subject: [PATCH 12/76] A few more archs have IFUNC support.

---
 ChangeLog | 4 ++++
 libc-abis | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index a8eba156a8..4272925552 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* libc-abis: Add a few more entries.
+
 2010-03-16  Ulrich Drepper  <drepper@redhat.com>
 
 	* elf/dl-load.c (VALID_ELF_ABIVERSION): Add additional osabi parameter.
diff --git a/libc-abis b/libc-abis
index 6e9cce8904..8668e49d88 100644
--- a/libc-abis
+++ b/libc-abis
@@ -42,3 +42,7 @@ UNIQUE
 # Indirect PLT relocations.  Architecture dependent.
 IFUNC		x86_64-*-linux*
 IFUNC		i?86-*-linux*
+IFUNC		powerpc64-*-linux*
+IFUNC		powerpc-*-linux*
+IFUNC		sparc64-*-linux*
+IFUNC		sparc-*-linux*

From 94308fd0e071018cd823b654276acc103c8b509c Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Wed, 17 Mar 2010 06:57:38 -0700
Subject: [PATCH 13/76] Fix debug statements in resolver

---
 ChangeLog         |  6 ++++++
 resolv/res_send.c | 17 ++++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4272925552..462cd397fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-16  Andreas Schwab  <schwab@redhat.com>
+
+	* resolv/res_send.c (__libc_res_nsend): Fix printing of server
+	address in debug statement.
+	(send_dg): Pass correct buffer pointer to DprintQ.
+
 2010-03-17  Ulrich Drepper  <drepper@redhat.com>
 
 	* libc-abis: Add a few more entries.
diff --git a/resolv/res_send.c b/resolv/res_send.c
index b0966ae036..845b658e36 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -535,7 +535,10 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
 
 		Dprint(statp->options & RES_DEBUG,
 		       (stdout, ";; Querying server (# %d) address = %s\n",
-			ns + 1, inet_ntop(AF_INET6, &nsap->sin6_addr,
+			ns + 1, inet_ntop(nsap->sin6_family,
+					  (nsap->sin6_family == AF_INET6
+					   ? &nsap->sin6_addr
+					   : &((struct sockaddr_in *) nsap)->sin_addr),
 					  tmpbuf, sizeof (tmpbuf))));
 
 		if (__builtin_expect (v_circuit, 0)) {
@@ -1201,7 +1204,7 @@ send_dg(res_state statp,
 			DprintQ((statp->options & RES_DEBUG) ||
 				(statp->pfcode & RES_PRF_REPLY),
 				(stdout, ";; old answer:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			goto wait;
@@ -1216,7 +1219,7 @@ send_dg(res_state statp,
 			DprintQ((statp->options & RES_DEBUG) ||
 				(statp->pfcode & RES_PRF_REPLY),
 				(stdout, ";; not our server:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			goto wait;
@@ -1233,7 +1236,7 @@ send_dg(res_state statp,
 			DprintQ(statp->options & RES_DEBUG,
 				(stdout,
 				 "server rejected query with EDNS0:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			/* record the error */
@@ -1258,7 +1261,7 @@ send_dg(res_state statp,
 			DprintQ((statp->options & RES_DEBUG) ||
 				(statp->pfcode & RES_PRF_REPLY),
 				(stdout, ";; wrong query name:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			goto wait;
@@ -1268,7 +1271,7 @@ send_dg(res_state statp,
 		    anhp->rcode == REFUSED) {
 			DprintQ(statp->options & RES_DEBUG,
 				(stdout, "server rejected query:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 
@@ -1295,7 +1298,7 @@ send_dg(res_state statp,
 		    && anhp->aa == 0 && anhp->ra == 0 && anhp->arcount == 0) {
 			DprintQ(statp->options & RES_DEBUG,
 				(stdout, "referred query:\n"),
-				thisansp,
+				*thisansp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 			goto next_ns;

From 234333153e5b29fec2c0b383249db6f245a877e9 Mon Sep 17 00:00:00 2001
From: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Wed, 17 Mar 2010 09:01:34 -0700
Subject: [PATCH 14/76] Fix missing dependency of localedata tests on
 gconv-modules

---
 localedata/ChangeLog | 4 ++++
 localedata/Makefile  | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index cc47bbaf70..4da53bc804 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,7 @@
+2010-02-16  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* Makefile: Add missing gconv-modules dependency.
+
 2010-02-03  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #10414]
diff --git a/localedata/Makefile b/localedata/Makefile
index d364001551..8f356ec861 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -107,6 +107,8 @@ install-others := $(addprefix $(inst_i18ndir)/, \
 			      $(addsuffix .gz, $(charmaps)) \
 			      $(locales))
 
+tests: $(objdir)/iconvdata/gconv-modules
+
 include ../Rules
 
 # Install the charmap files in gzipped format.
@@ -298,3 +300,6 @@ tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
 		LOCPATH=$(common-objpfx)localedata
 $(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@
+
+$(objdir)/iconvdata/gconv-modules:
+	$(MAKE) -C ../iconvdata subdir=iconvdata $@

From b170ff0f8fb25d43dc6d6e9484fc33234110fd8d Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hongjiu.lu@intel.com>
Date: Thu, 18 Mar 2010 11:40:46 -0700
Subject: [PATCH 15/76] Fix sysdeps/i386/i686/multiarch/memcmp-ssse3.S

---
 ChangeLog                                  |  5 +++++
 sysdeps/i386/i686/multiarch/memcmp-ssse3.S | 15 +++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 462cd397fa..92b6a914b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/i386/i686/multiarch/memcmp-ssse3.S: Update %xmm3
+	when exit from loop.
+
 2010-03-16  Andreas Schwab  <schwab@redhat.com>
 
 	* resolv/res_send.c (__libc_res_nsend): Fix printing of server
diff --git a/sysdeps/i386/i686/multiarch/memcmp-ssse3.S b/sysdeps/i386/i686/multiarch/memcmp-ssse3.S
index d2f852f726..2e0d15fe55 100644
--- a/sysdeps/i386/i686/multiarch/memcmp-ssse3.S
+++ b/sysdeps/i386/i686/multiarch/memcmp-ssse3.S
@@ -269,6 +269,7 @@ L(shr_1_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_1_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_1_gobble_next)
@@ -352,6 +353,7 @@ L(shr_2_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_2_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_2_gobble_next)
@@ -434,6 +436,7 @@ L(shr_3_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_3_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_3_gobble_next)
@@ -516,6 +519,7 @@ L(shr_4_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_4_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_4_gobble_next)
@@ -598,6 +602,7 @@ L(shr_5_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_5_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_5_gobble_next)
@@ -680,6 +685,7 @@ L(shr_6_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_6_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_6_gobble_next)
@@ -762,6 +768,7 @@ L(shr_7_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_7_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_7_gobble_next)
@@ -844,6 +851,7 @@ L(shr_8_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_8_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_8_gobble_next)
@@ -926,6 +934,7 @@ L(shr_9_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_9_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_9_gobble_next)
@@ -1008,6 +1017,7 @@ L(shr_10_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_10_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_10_gobble_next)
@@ -1090,6 +1100,7 @@ L(shr_11_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_11_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_11_gobble_next)
@@ -1172,6 +1183,7 @@ L(shr_12_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_12_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_12_gobble_next)
@@ -1254,6 +1266,7 @@ L(shr_13_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_13_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_13_gobble_next)
@@ -1336,6 +1349,7 @@ L(shr_14_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_14_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_14_gobble_next)
@@ -1418,6 +1432,7 @@ L(shr_15_gobble_loop):
 
 	lea	32(%edi), %edi
 	jz	L(shr_15_gobble_loop)
+	pand	%xmm0, %xmm3
 
 	cmp	$0, %ecx
 	jge	L(shr_15_gobble_next)

From 04f2902d9fadb2b8221162247412fb2c4667d95e Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Thu, 18 Mar 2010 13:15:27 -0700
Subject: [PATCH 16/76] Future safety in checking ELF header.

If we should use further fields in the e_ident array in the ELF header
of files we want zero to mean the default.  Enforce zero for now so
that non-optional features indicated by nonzero values are not go
unnoticed when using an old dynamic linker.
---
 ChangeLog     |  6 ++++++
 elf/dl-load.c | 10 ++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 92b6a914b5..9ff497dcf9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-18  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/dl-load.c (open_verify): Extend expected to the full size of the
+	e_ident array.  When loading, check that the fields in e_ident we don't
+	know are zero to allow future extensions.
+
 2010-03-18  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/i386/i686/multiarch/memcmp-ssse3.S: Update %xmm3
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 756816f25f..d8f9131dd6 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1573,7 +1573,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 #elif defined MORE_ELF_HEADER_DATA
   MORE_ELF_HEADER_DATA;
 #endif
-  static const unsigned char expected[EI_PAD] =
+  static const unsigned char expected[EI_NIDENT] =
   {
     [EI_MAG0] = ELFMAG0,
     [EI_MAG1] = ELFMAG1,
@@ -1657,7 +1657,10 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
       if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected,
 						EI_ABIVERSION)
 			    || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI],
-						      ehdr->e_ident[EI_ABIVERSION]),
+						      ehdr->e_ident[EI_ABIVERSION])
+			    || memcmp (&ehdr->e_ident[EI_PAD],
+				       &expected[EI_PAD],
+				       EI_NIDENT - EI_PAD) != 0,
 			    0))
 	{
 	  /* Something is wrong.  */
@@ -1701,6 +1704,9 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 	  else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI],
 					  ehdr->e_ident[EI_ABIVERSION]))
 	    errstring = N_("ELF file ABI version invalid");
+	  else if (memcmp (&ehdr->e_ident[EI_PAD], &expected[EI_PAD],
+			   EI_NIDENT - EI_PAD) != 0)
+	    errstring = N_("nonzero padding in e_ident");
 	  else
 	    /* Otherwise we don't know what went wrong.  */
 	    errstring = N_("internal error");

From 9ac9129d496d27b93c6fdfe0a22b68b3e4ee55df Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Wed, 24 Mar 2010 06:59:02 -0700
Subject: [PATCH 17/76] Unify wint_t handling in wchar.h and wctype.h.

Fix a few typos in the process.
---
 ChangeLog       |  8 ++++++++
 wcsmbs/wchar.h  | 16 ++++++++--------
 wctype/wctype.h |  8 ++++----
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9ff497dcf9..6bf4fdc377 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-24  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11410]
+	* wctype/wctype.h: Use <wchar.h> to get the wint_t definition.
+
+	* wcsmbs/wchar.h: Correct preprocessor directive indentation.  Move
+	C++ prototype handling to a better place.
+
 2010-03-18  Ulrich Drepper  <drepper@redhat.com>
 
 	* elf/dl-load.c (open_verify): Extend expected to the full size of the
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 7a659116c3..5a4e10e543 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -51,11 +51,6 @@
 # define __need_wint_t
 # include <stddef.h>
 
-/* Tell the caller that we provide correct C++ prototypes.  */
-#if defined __cplusplus && __GNUC_PREREQ (4, 4)
-# define __CORRECT_ISO_CPP_WCHAR_H_PROTO
-#endif
-
 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
    there.  So define it ourselves if it remains undefined.  */
 # ifndef _WINT_T
@@ -75,6 +70,11 @@ typedef __WINT_TYPE__ wint_t;
 __END_NAMESPACE_STD
 #  endif
 # endif
+
+/* Tell the caller that we provide correct C++ prototypes.  */
+# if defined __cplusplus && __GNUC_PREREQ (4, 4)
+#  define __CORRECT_ISO_CPP_WCHAR_H_PROTO
+# endif
 #endif
 
 #if (defined _WCHAR_H || defined __need_mbstate_t) && !defined __mbstate_t_defined
@@ -219,7 +219,7 @@ __BEGIN_NAMESPACE_STD
 extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc)
      __THROW __asm ("wcschr") __attribute_pure__;
 extern "C++" __const wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
-     __THROW __asm ("wcschr")  __attribute_pure__;
+     __THROW __asm ("wcschr") __attribute_pure__;
 #else
 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
      __THROW __attribute_pure__;
@@ -892,7 +892,7 @@ __END_DECLS
 
 #endif /* wchar.h  */
 
-/* Undefined all __need_* constants in case we are included to get those
+/* Undefine all __need_* constants in case we are included to get those
    constants but the whole file was already read.  */
 #undef __need_mbstate_t
 #undef __need_wint_t
diff --git a/wctype/wctype.h b/wctype/wctype.h
index 9b29af5638..1e2fbf9fae 100644
--- a/wctype/wctype.h
+++ b/wctype/wctype.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002,2005,2007,2008,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2002,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
@@ -29,9 +29,9 @@
 #ifndef __need_iswxxx
 # define _WCTYPE_H	1
 
-/* Get wint_t from <stddef.h>.  */
+/* Get wint_t from <wchar.h>.  */
 # define __need_wint_t
-# include <stddef.h>
+# include <wchar.h>
 
 /* Constant expression of type `wint_t' whose value does not correspond
    to any member of the extended character set.  */
@@ -204,7 +204,7 @@ __END_DECLS
 
 
 /* The remaining definitions and declarations must not appear in the
-   <wcsmbs.h> header.  */
+   <wchar.h> header.  */
 #ifdef _WCTYPE_H
 
 /*

From 4ad43b62d6b893e73d5af72565f23c064b9c59b5 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Wed, 24 Mar 2010 10:14:22 -0700
Subject: [PATCH 18/76] Fix handling of STB_GNU_UNIQUE in LD_TRACE_PRELINKING

---
 ChangeLog       | 15 ++++++++++++++
 elf/dl-deps.c   |  9 +++++++--
 elf/dl-lookup.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++--
 include/link.h  |  6 +++++-
 4 files changed, 79 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6bf4fdc377..9a2b2ca64c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-23  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/dl-lookup.c (do_lookup_x): If tab->entries is NULL,
+	but tab->size != 0, just unlock and goto success, without
+	allocating anything or entering anything into the hash table.
+	(_dl_debug_bindings): Temporarily set tab->entries to NULL
+	around do_lookup_x in undef_map->l_local_scope[0].  If
+	undef_map->l_symbolic_in_local_scope, lookup also in
+	symbolic_searchlist of following libraries in l_local_scope
+	that have DT_SYMBOLIC set.
+	* elf/dl-deps.c (_dl_map_object_deps): Compute
+	l_symbolic_in_local_scope.
+	* include/link.h (struct link_map): Add l_symbolic_in_local_scope
+	bitfield.
+
 2010-03-24  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11410]
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 34c6024efa..a58de5c985 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -1,5 +1,5 @@
 /* Load the dependencies of a mapped object.
-   Copyright (C) 1996-2003, 2004, 2005, 2006, 2007
+   Copyright (C) 1996-2003, 2004, 2005, 2006, 2007, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -554,7 +554,12 @@ Filters not supported with LD_TRACE_PRELINKING"));
 	  cnt = _dl_build_local_scope (l_initfini, l);
 	  assert (cnt <= nlist);
 	  for (j = 0; j < cnt; j++)
-	    l_initfini[j]->l_reserved = 0;
+	    {
+	      l_initfini[j]->l_reserved = 0;
+	      if (j && __builtin_expect (l_initfini[j]->l_info[DT_SYMBOLIC]
+					 != NULL, 0))
+		l->l_symbolic_in_local_scope = true;
+	    }
 
 	  l->l_local_scope[0] =
 	    (struct r_scope_elem *) malloc (sizeof (struct r_scope_elem)
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 763ec16fa4..78c8669e30 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -1,5 +1,6 @@
 /* Look up a symbol in the loaded objects.
-   Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2005, 2006, 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
@@ -414,6 +415,20 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
 		  assert (!RTLD_CHECK_FOREIGN_CALL);
 #endif
 
+#ifdef SHARED
+		  /* If tab->entries is NULL, but tab->size is not, it means
+		     this is the second, conflict finding, lookup for
+		     LD_TRACE_PRELINKING in _dl_debug_bindings.  Don't
+		     allocate anything and don't enter anything into the
+		     hash table.  */
+		  if (__builtin_expect (tab->size, 0))
+		    {
+		      assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
+		      __rtld_lock_unlock_recursive (tab->lock);
+		      goto success;
+		    }
+#endif
+
 #define INITIAL_NUNIQUE_SYM_TABLE 31
 		  size = INITIAL_NUNIQUE_SYM_TABLE;
 		  entries = calloc (sizeof (struct unique_sym), size);
@@ -917,13 +932,48 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
 	{
 	  const uint_fast32_t new_hash = dl_new_hash (undef_name);
 	  unsigned long int old_hash = 0xffffffff;
+	  struct unique_sym *saved_entries
+	    = GL(dl_ns)[LM_ID_BASE]._ns_unique_sym_table.entries;
 
+	  GL(dl_ns)[LM_ID_BASE]._ns_unique_sym_table.entries = NULL;
 	  do_lookup_x (undef_name, new_hash, &old_hash, *ref, &val,
 		       undef_map->l_local_scope[0], 0, version, 0, NULL,
 		       type_class, undef_map);
-
 	  if (val.s != value->s || val.m != value->m)
 	    conflict = 1;
+	  else if (__builtin_expect (undef_map->l_symbolic_in_local_scope, 0)
+		   && val.s
+		   && __builtin_expect (ELFW(ST_BIND) (val.s->st_info),
+					STB_GLOBAL) == STB_GNU_UNIQUE)
+	    {
+	      /* If it is STB_GNU_UNIQUE and undef_map's l_local_scope
+		 contains any DT_SYMBOLIC libraries, unfortunately there
+		 can be conflicts even if the above is equal.  As symbol
+		 resolution goes from the last library to the first and
+		 if a STB_GNU_UNIQUE symbol is found in some late DT_SYMBOLIC
+		 library, it would be the one that is looked up.  */
+	      struct sym_val val2 = { NULL, NULL };
+	      size_t n;
+	      struct r_scope_elem *scope = undef_map->l_local_scope[0];
+
+	      for (n = 0; n < scope->r_nlist; n++)
+		if (scope->r_list[n] == val.m)
+		  break;
+
+	      for (n++; n < scope->r_nlist; n++)
+		if (scope->r_list[n]->l_info[DT_SYMBOLIC] != NULL
+		    && do_lookup_x (undef_name, new_hash, &old_hash, *ref,
+				    &val2,
+				    &scope->r_list[n]->l_symbolic_searchlist,
+				    0, version, 0, NULL, type_class,
+				    undef_map) > 0)
+		  {
+		    conflict = 1;
+		    val = val2;
+		    break;
+		  }
+	    }
+	  GL(dl_ns)[LM_ID_BASE]._ns_unique_sym_table.entries = saved_entries;
 	}
 
       if (value->s)
diff --git a/include/link.h b/include/link.h
index 26c67438f0..9d1fc1a8fe 100644
--- a/include/link.h
+++ b/include/link.h
@@ -1,6 +1,6 @@
 /* Data structure for communication from the run-time dynamic linker for
    loaded ELF shared objects.
-   Copyright (C) 1995-2006, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2006, 2007, 2009, 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
@@ -188,6 +188,10 @@ struct link_map
     unsigned int l_contiguous:1; /* Nonzero if inter-segment holes are
 				    mprotected or if no holes are present at
 				    all.  */
+    unsigned int l_symbolic_in_local_scope:1; /* Nonzero if l_local_scope
+						 during LD_TRACE_PRELINKING=1
+						 contains any DT_SYMBOLIC
+						 libraries.  */
 
     /* Collected information about own RPATH directories.  */
     struct r_search_path_struct l_rpath_dirs;

From 8f2e39941309c1a590e71b9a8035dbbc7e587fae Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Wed, 24 Mar 2010 11:58:05 -0700
Subject: [PATCH 19/76] Fix glob with empty pattern

---
 ChangeLog           |  6 ++++
 posix/glob.c        | 48 ++++++++++++++++-------------
 posix/tst-gnuglob.c | 75 ++++++++++++++++++++++++++++++++-------------
 3 files changed, 87 insertions(+), 42 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9a2b2ca64c..87d8d57ae1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-24  Ulrich Drepper  <drepper@redhat.com>
+	    Andreas Schwab  <andreas@redhat.com>
+
+	* posix/glob.c (glob): Clean up gl_pathc and gl_pathv earlier.
+	If pattern is "" bail out early
+
 2010-03-23  Jakub Jelinek  <jakub@redhat.com>
 
 	* elf/dl-lookup.c (do_lookup_x): If tab->entries is NULL,
diff --git a/posix/glob.c b/posix/glob.c
index 73081ece66..3ae055d430 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008
+/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -418,6 +418,24 @@ glob (pattern, flags, errfunc, pglob)
 	}
     }
 
+  if (!(flags & GLOB_APPEND))
+    {
+      pglob->gl_pathc = 0;
+      if (!(flags & GLOB_DOOFFS))
+	pglob->gl_pathv = NULL;
+      else
+	{
+	  size_t i;
+	  pglob->gl_pathv = (char **) malloc ((pglob->gl_offs + 1)
+					      * sizeof (char *));
+	  if (pglob->gl_pathv == NULL)
+	    return GLOB_NOSPACE;
+
+	  for (i = 0; i <= pglob->gl_offs; ++i)
+	    pglob->gl_pathv[i] = NULL;
+	}
+    }
+
   /* Find the filename.  */
   filename = strrchr (pattern, '/');
 #if defined __MSDOS__ || defined WINDOWS32
@@ -445,6 +463,12 @@ glob (pattern, flags, errfunc, pglob)
 	}
       else
 	{
+	  if (__builtin_expect (pattern[0] == '\0', 0))
+	    {
+	      dirs.gl_pathv = NULL;
+	      goto no_matches;
+	    }
+
 	  filename = pattern;
 #ifdef _AMIGA
 	  dirname = "";
@@ -492,7 +516,7 @@ glob (pattern, flags, errfunc, pglob)
 
       if (filename[0] == '\0'
 #if defined __MSDOS__ || defined WINDOWS32
-          && dirname[dirlen - 1] != ':'
+	  && dirname[dirlen - 1] != ':'
 	  && (dirlen < 3 || dirname[dirlen - 2] != ':'
 	      || dirname[dirlen - 1] != '/')
 #endif
@@ -529,24 +553,6 @@ glob (pattern, flags, errfunc, pglob)
 	}
     }
 
-  if (!(flags & GLOB_APPEND))
-    {
-      pglob->gl_pathc = 0;
-      if (!(flags & GLOB_DOOFFS))
-        pglob->gl_pathv = NULL;
-      else
-	{
-	  size_t i;
-	  pglob->gl_pathv = (char **) malloc ((pglob->gl_offs + 1)
-					      * sizeof (char *));
-	  if (pglob->gl_pathv == NULL)
-	    return GLOB_NOSPACE;
-
-	  for (i = 0; i <= pglob->gl_offs; ++i)
-	    pglob->gl_pathv[i] = NULL;
-	}
-    }
-
   oldcount = pglob->gl_pathc + pglob->gl_offs;
 
 #ifndef VMS
@@ -564,7 +570,7 @@ glob (pattern, flags, errfunc, pglob)
 # else
 #  ifdef WINDOWS32
 	  if (home_dir == NULL || home_dir[0] == '\0')
-            home_dir = "c:/users/default"; /* poor default */
+	    home_dir = "c:/users/default"; /* poor default */
 #  else
 	  if (home_dir == NULL || home_dir[0] == '\0')
 	    {
diff --git a/posix/tst-gnuglob.c b/posix/tst-gnuglob.c
index 95bfbae641..d4539bddbc 100644
--- a/posix/tst-gnuglob.c
+++ b/posix/tst-gnuglob.c
@@ -1,6 +1,6 @@
 /* Test the GNU extensions in glob which allow the user to provide callbacks
    for the filesystem access functions.
-   Copyright (C) 2001-2002, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2007, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -61,9 +61,9 @@ static struct
       { "..", 3, DT_DIR },
       { ".foo", 3, DT_REG },
       { "dir1lev3", 3, DT_DIR },
-        { ".", 4, DT_DIR },
-        { "..", 4, DT_DIR },
-        { "file1lev4", 4, DT_REG },
+	{ ".", 4, DT_DIR },
+	{ "..", 4, DT_DIR },
+	{ "file1lev4", 4, DT_REG },
       { "file1lev3", 3, DT_REG },
       { "file2lev3", 3, DT_REG },
     { "file2lev2", 2, DT_REG },
@@ -81,9 +81,9 @@ static struct
       { "..", 3, DT_DIR },
       { ".foo", 3, DT_REG },
       { ".dir", 3, DT_DIR },
-        { ".", 4, DT_DIR },
-        { "..", 4, DT_DIR },
-        { "hidden", 4, DT_REG }
+	{ ".", 4, DT_DIR },
+	{ "..", 4, DT_DIR },
+	{ "hidden", 4, DT_REG }
 };
 #define nfiles (sizeof (filesystem) / sizeof (filesystem[0]))
 
@@ -283,7 +283,7 @@ static const char *glob_errstring[] =
 static const char *
 flagstr (int flags)
 {
-  const char *strs[] =
+  static const char *const strs[] =
   {
     "GLOB_ERR", "GLOB_MARK", "GLOB_NOSORT", "GLOB_DOOFSS", "GLOB_NOCHECK",
     "GLOB_APPEND", "GLOB_NOESCAPE", "GLOB_PERIOD", "GLOB_MAGCHAR",
@@ -312,6 +312,29 @@ flagstr (int flags)
     }
 
   return buf;
+#undef nstrs
+}
+
+
+static const char *
+errstr (int val)
+{
+  static const char *const strs[] =
+    {
+      [GLOB_NOSPACE] = "GLOB_NOSPACE",
+      [GLOB_ABORTED] = "GLOB_ABORTED",
+      [GLOB_NOMATCH] = "GLOB_NOMATCH",
+      [GLOB_NOSYS] = "GLOB_NOSYS"
+    };
+#define nstrs (sizeof (strs) / sizeof (strs[0]))
+  static char buf[100];
+  if (val < 0 || val >= nstrs || strs[val] == NULL)
+    {
+      snprintf (buf, sizeof (buf), "GLOB_??? (%d)", val);
+      return buf;
+    }
+  return strs[val];
+#undef nstrs
 }
 
 
@@ -376,28 +399,34 @@ main (void)
   gl.gl_lstat = my_stat;
   gl.gl_stat = my_stat;
 
-#define test(a, b, c...) \
+#define test(a, b, r, c...) \
   fmt = a;								      \
-  flags = b;								      \
+  flags = GLOB_ALTDIRFUNC | b;						      \
   errval = glob (fmt, flags, NULL, &gl);				      \
-  if (errval != 0)							      \
+  if (errval != r)							      \
     {									      \
-      printf ("glob (\"%s\", %s) failed: %s\n", fmt, flagstr (flags),	      \
-	      errval >= 0 && errval < nglob_errstring			      \
-	      ? glob_errstring[errval] : "???");			      \
+      if (r == 0)							      \
+	printf ("glob (\"%s\", %s) failed: %s\n", fmt, flagstr (flags),	      \
+		errval >= 0 && errval < nglob_errstring			      \
+		? glob_errstring[errval] : "???");			      \
+      else								      \
+	printf ("glob (\"%s\", %s) did not fail\n", fmt, flagstr (flags));    \
       result = 1;							      \
     }									      \
+  else if (r == 0)							      \
+    result |= test_result (fmt, flags, &gl, (const char *[]) { c, NULL });    \
   else									      \
-    result |= test_result (fmt, flags, &gl, (const char *[]) { c, NULL })
+    printf ("result for glob (\"%s\", %s) = %s\n\n", fmt, flagstr (flags),    \
+	    errstr (errval))
 
-  test ("*/*/*", GLOB_ALTDIRFUNC,
+  test ("*/*/*", 0, 0,
 	"dir1lev1/dir2lev2/dir1lev3",
 	"dir1lev1/dir2lev2/file1lev3",
 	"dir1lev1/dir2lev2/file2lev3",
 	"dir1lev1/dir3lev2/file3lev3",
 	"dir1lev1/dir3lev2/file4lev3");
 
-  test ("*/*/*", GLOB_ALTDIRFUNC | GLOB_PERIOD,
+  test ("*/*/*", GLOB_PERIOD, 0,
 	"dir1lev1/dir1lev2/.",
 	"dir1lev1/dir1lev2/..",
 	"dir1lev1/dir2lev2/.",
@@ -415,7 +444,7 @@ main (void)
 	"dir2lev1/dir1lev2/.dir",
 	"dir2lev1/dir1lev2/.foo");
 
-  test ("*/*/.*", GLOB_ALTDIRFUNC,
+  test ("*/*/.*", 0, 0,
 	"dir1lev1/dir1lev2/.",
 	"dir1lev1/dir1lev2/..",
 	"dir1lev1/dir2lev2/.",
@@ -428,7 +457,7 @@ main (void)
 	"dir2lev1/dir1lev2/.dir",
 	"dir2lev1/dir1lev2/.foo");
 
-  test ("*1*/*2*/.*", GLOB_ALTDIRFUNC,
+  test ("*1*/*2*/.*", 0, 0,
 	"dir1lev1/dir1lev2/.",
 	"dir1lev1/dir1lev2/..",
 	"dir1lev1/dir2lev2/.",
@@ -441,7 +470,7 @@ main (void)
 	"dir2lev1/dir1lev2/.dir",
 	"dir2lev1/dir1lev2/.foo");
 
-  test ("*1*/*1*/.*", GLOB_ALTDIRFUNC,
+  test ("*1*/*1*/.*", 0, 0,
 	"dir1lev1/dir1lev2/.",
 	"dir1lev1/dir1lev2/..",
 	"dir2lev1/dir1lev2/.",
@@ -449,12 +478,16 @@ main (void)
 	"dir2lev1/dir1lev2/.dir",
 	"dir2lev1/dir1lev2/.foo");
 
-  test ("\\/*", GLOB_ALTDIRFUNC,
+  test ("\\/*", 0, 0,
 	"/dir1lev1",
 	"/dir2lev1",
 	"/file1lev1",
 	"/file2lev1");
 
+  test ("", 0, GLOB_NOMATCH, NULL);
+
+  test ("", GLOB_NOCHECK, 0, "");
+
   globfree (&gl);
 
   return result;

From c27849fbbf94f240704ac648f6b57daec08f0533 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Wed, 24 Mar 2010 12:10:51 -0700
Subject: [PATCH 20/76] Add test for last glob bug.

---
 ChangeLog         |  8 ++++++++
 posix/Makefile    |  4 ++--
 posix/bug-glob3.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 2 deletions(-)
 create mode 100644 posix/bug-glob3.c

diff --git a/ChangeLog b/ChangeLog
index 87d8d57ae1..b60b4a494e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-24  Ulrich Drepper  <drepper@redhat.com>
+
+	* posix/tst-gnuglob.c: Add tests with empty patterns.  For this
+	rewrite the tests to add support for failing glob calls.
+	Some other minor cleanups.
+	* posix/bug-glob3.c: New file.
+	* posix/Makefile (tests): Add bug-glob3.
+
 2010-03-24  Ulrich Drepper  <drepper@redhat.com>
 	    Andreas Schwab  <andreas@redhat.com>
 
diff --git a/posix/Makefile b/posix/Makefile
index 2a467a8f7b..1a369ddf84 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999, 2000-2006, 2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999, 2000-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
@@ -86,7 +86,7 @@ tests		:= tstgetopt testfnm runtests runptests	     \
 		   tst-nice tst-nanosleep tst-regex2 \
 		   transbug tst-rxspencer tst-pcre tst-boost \
 		   bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
-		   tst-getaddrinfo2 bug-glob1 bug-glob2 tst-sysconf \
+		   tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
 		   tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
 		   tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
 		   tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
diff --git a/posix/bug-glob3.c b/posix/bug-glob3.c
new file mode 100644
index 0000000000..f2fbd703dd
--- /dev/null
+++ b/posix/bug-glob3.c
@@ -0,0 +1,45 @@
+#include <glob.h>
+#include <stdio.h>
+#include <string.h>
+
+static int
+do_test (void)
+{
+  int result = 0;
+  glob_t g;
+  g.gl_pathc = 0;
+
+  int r = glob ("", 0, NULL, &g);
+  if (r != GLOB_NOMATCH)
+    {
+      puts ("glob (\"\", 0, NULL, &g) did not fail");
+      result = 1;
+    }
+  else if (g.gl_pathc != 0)
+    {
+      puts ("gl_pathc after glob (\"\", 0, NULL, &g) not zero");
+      result = 1;
+    }
+
+  r = glob ("", GLOB_NOCHECK, NULL, &g);
+  if (r != 0)
+    {
+      puts ("glob (\"\", GLOB_NOCHECK, NULL, &g) did fail");
+      result = 1;
+    }
+  else if (g.gl_pathc != 1)
+    {
+      puts ("gl_pathc after glob (\"\", GLOB_NOCHECK, NULL, &g) not 1");
+      result = 1;
+    }
+  else if (strcmp (g.gl_pathv[0], "") != 0)
+    {
+      puts ("gl_pathv[0] after glob (\"\", GLOB_NOCHECK, NULL, &g) not \"\"");
+      result = 1;
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

From 8863605af91a9a930c0e92e87775cf22780451e0 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hongjiu.lu@intel.com>
Date: Wed, 24 Mar 2010 12:14:03 -0700
Subject: [PATCH 21/76] Test case for last x86 memcmp problem

---
 ChangeLog            |   7 ++
 string/test-memcmp.c | 265 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 268 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b60b4a494e..88177a44a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* string/test-memcmp.c (check_result): New function.
+	(do_one_test): Use it.
+	(check1): New function.
+	(test_main): Use it.
+
 2010-03-24  Ulrich Drepper  <drepper@redhat.com>
 
 	* posix/tst-gnuglob.c: Add tests with empty patterns.  For this
diff --git a/string/test-memcmp.c b/string/test-memcmp.c
index af07a5e599..3040e212ae 100644
--- a/string/test-memcmp.c
+++ b/string/test-memcmp.c
@@ -37,9 +37,9 @@ simple_memcmp (const char *s1, const char *s2, size_t n)
   return ret;
 }
 
-static void
-do_one_test (impl_t *impl, const char *s1, const char *s2, size_t len,
-	     int exp_result)
+static int
+check_result (impl_t *impl, const char *s1, const char *s2, size_t len,
+	      int exp_result)
 {
   int result = CALL (impl, s1, s2, len);
   if ((exp_result == 0 && result != 0)
@@ -49,9 +49,19 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, size_t len,
       error (0, 0, "Wrong result in function %s %d %d", impl->name,
 	     result, exp_result);
       ret = 1;
-      return;
+      return -1;
     }
 
+  return 0;
+}
+
+static void
+do_one_test (impl_t *impl, const char *s1, const char *s2, size_t len,
+	     int exp_result)
+{
+  if (check_result (impl, s1, s2, len, exp_result) < 0)
+    return;
+
   if (HP_TIMING_AVAIL)
     {
       hp_timing_t start __attribute ((unused));
@@ -177,6 +187,251 @@ do_random_tests (void)
     }
 }
 
+static void
+check1 (void)
+{
+  char s1[116], s2[116];
+  int n, exp_result;
+
+  s1[0] = -108;
+  s2[0] = -108;
+  s1[1] = 99;
+  s2[1] = 99;
+  s1[2] = -113;
+  s2[2] = -113;
+  s1[3] = 1;
+  s2[3] = 1;
+  s1[4] = 116;
+  s2[4] = 116;
+  s1[5] = 99;
+  s2[5] = 99;
+  s1[6] = -113;
+  s2[6] = -113;
+  s1[7] = 1;
+  s2[7] = 1;
+  s1[8] = 84;
+  s2[8] = 84;
+  s1[9] = 99;
+  s2[9] = 99;
+  s1[10] = -113;
+  s2[10] = -113;
+  s1[11] = 1;
+  s2[11] = 1;
+  s1[12] = 52;
+  s2[12] = 52;
+  s1[13] = 99;
+  s2[13] = 99;
+  s1[14] = -113;
+  s2[14] = -113;
+  s1[15] = 1;
+  s2[15] = 1;
+  s1[16] = -76;
+  s2[16] = -76;
+  s1[17] = -14;
+  s2[17] = -14;
+  s1[18] = -109;
+  s2[18] = -109;
+  s1[19] = 1;
+  s2[19] = 1;
+  s1[20] = -108;
+  s2[20] = -108;
+  s1[21] = -14;
+  s2[21] = -14;
+  s1[22] = -109;
+  s2[22] = -109;
+  s1[23] = 1;
+  s2[23] = 1;
+  s1[24] = 84;
+  s2[24] = 84;
+  s1[25] = -15;
+  s2[25] = -15;
+  s1[26] = -109;
+  s2[26] = -109;
+  s1[27] = 1;
+  s2[27] = 1;
+  s1[28] = 52;
+  s2[28] = 52;
+  s1[29] = -15;
+  s2[29] = -15;
+  s1[30] = -109;
+  s2[30] = -109;
+  s1[31] = 1;
+  s2[31] = 1;
+  s1[32] = 20;
+  s2[32] = 20;
+  s1[33] = -15;
+  s2[33] = -15;
+  s1[34] = -109;
+  s2[34] = -109;
+  s1[35] = 1;
+  s2[35] = 1;
+  s1[36] = 20;
+  s2[36] = 20;
+  s1[37] = -14;
+  s2[37] = -14;
+  s1[38] = -109;
+  s2[38] = -109;
+  s1[39] = 1;
+  s2[39] = 1;
+  s1[40] = 52;
+  s2[40] = 52;
+  s1[41] = -14;
+  s2[41] = -14;
+  s1[42] = -109;
+  s2[42] = -109;
+  s1[43] = 1;
+  s2[43] = 1;
+  s1[44] = 84;
+  s2[44] = 84;
+  s1[45] = -14;
+  s2[45] = -14;
+  s1[46] = -109;
+  s2[46] = -109;
+  s1[47] = 1;
+  s2[47] = 1;
+  s1[48] = 116;
+  s2[48] = 116;
+  s1[49] = -14;
+  s2[49] = -14;
+  s1[50] = -109;
+  s2[50] = -109;
+  s1[51] = 1;
+  s2[51] = 1;
+  s1[52] = 116;
+  s2[52] = 116;
+  s1[53] = -15;
+  s2[53] = -15;
+  s1[54] = -109;
+  s2[54] = -109;
+  s1[55] = 1;
+  s2[55] = 1;
+  s1[56] = -44;
+  s2[56] = -44;
+  s1[57] = -14;
+  s2[57] = -14;
+  s1[58] = -109;
+  s2[58] = -109;
+  s1[59] = 1;
+  s2[59] = 1;
+  s1[60] = -108;
+  s2[60] = -108;
+  s1[61] = -15;
+  s2[61] = -15;
+  s1[62] = -109;
+  s2[62] = -109;
+  s1[63] = 1;
+  s2[63] = 1;
+  s1[64] = -76;
+  s2[64] = -76;
+  s1[65] = -15;
+  s2[65] = -15;
+  s1[66] = -109;
+  s2[66] = -109;
+  s1[67] = 1;
+  s2[67] = 1;
+  s1[68] = -44;
+  s2[68] = -44;
+  s1[69] = -15;
+  s2[69] = -15;
+  s1[70] = -109;
+  s2[70] = -109;
+  s1[71] = 1;
+  s2[71] = 1;
+  s1[72] = -12;
+  s2[72] = -12;
+  s1[73] = -15;
+  s2[73] = -15;
+  s1[74] = -109;
+  s2[74] = -109;
+  s1[75] = 1;
+  s2[75] = 1;
+  s1[76] = -12;
+  s2[76] = -12;
+  s1[77] = -14;
+  s2[77] = -14;
+  s1[78] = -109;
+  s2[78] = -109;
+  s1[79] = 1;
+  s2[79] = 1;
+  s1[80] = 20;
+  s2[80] = -68;
+  s1[81] = -12;
+  s2[81] = 64;
+  s1[82] = -109;
+  s2[82] = -106;
+  s1[83] = 1;
+  s2[83] = 1;
+  s1[84] = -12;
+  s2[84] = -12;
+  s1[85] = -13;
+  s2[85] = -13;
+  s1[86] = -109;
+  s2[86] = -109;
+  s1[87] = 1;
+  s2[87] = 1;
+  s1[88] = -44;
+  s2[88] = -44;
+  s1[89] = -13;
+  s2[89] = -13;
+  s1[90] = -109;
+  s2[90] = -109;
+  s1[91] = 1;
+  s2[91] = 1;
+  s1[92] = -76;
+  s2[92] = -76;
+  s1[93] = -13;
+  s2[93] = -13;
+  s1[94] = -109;
+  s2[94] = -109;
+  s1[95] = 1;
+  s2[95] = 1;
+  s1[96] = -108;
+  s2[96] = -108;
+  s1[97] = -13;
+  s2[97] = -13;
+  s1[98] = -109;
+  s2[98] = -109;
+  s1[99] = 1;
+  s2[99] = 1;
+  s1[100] = 116;
+  s2[100] = 116;
+  s1[101] = -13;
+  s2[101] = -13;
+  s1[102] = -109;
+  s2[102] = -109;
+  s1[103] = 1;
+  s2[103] = 1;
+  s1[104] = 84;
+  s2[104] = 84;
+  s1[105] = -13;
+  s2[105] = -13;
+  s1[106] = -109;
+  s2[106] = -109;
+  s1[107] = 1;
+  s2[107] = 1;
+  s1[108] = 52;
+  s2[108] = 52;
+  s1[109] = -13;
+  s2[109] = -13;
+  s1[110] = -109;
+  s2[110] = -109;
+  s1[111] = 1;
+  s2[111] = 1;
+  s1[112] = 20;
+  s2[112] = 20;
+  s1[113] = -13;
+  s2[113] = -13;
+  s1[114] = -109;
+  s2[114] = -109;
+  s1[115] = 1;
+  s2[115] = 1;
+
+  n = 116;
+  exp_result = simple_memcmp (s1, s2, n);
+  FOR_EACH_IMPL (impl, 0)
+    check_result (impl, s1, s2, n, exp_result);
+}
+
 int
 test_main (void)
 {
@@ -184,6 +439,8 @@ test_main (void)
 
   test_init ();
 
+  check1 ();
+
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)
     printf ("\t%s", impl->name);

From 7d9335ecd7ddd16bcbcfcc0f9cc1f0b5d392f849 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hongjiu.lu@intel.com>
Date: Wed, 24 Mar 2010 12:16:24 -0700
Subject: [PATCH 22/76] Don't define __strpbrk_sse42 in static library

---
 ChangeLog                            |  5 +++++
 sysdeps/x86_64/multiarch/strpbrk-c.c | 12 ++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 88177a44a7..004c6bfd41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/x86_64/multiarch/strpbrk-c.c: Define only if SHARED
+	is defined.
+
 2010-03-22  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* string/test-memcmp.c (check_result): New function.
diff --git a/sysdeps/x86_64/multiarch/strpbrk-c.c b/sysdeps/x86_64/multiarch/strpbrk-c.c
index c58dcb5605..bbf5c49d89 100644
--- a/sysdeps/x86_64/multiarch/strpbrk-c.c
+++ b/sysdeps/x86_64/multiarch/strpbrk-c.c
@@ -1,4 +1,8 @@
-#define USE_AS_STRPBRK
-#define STRCSPN_SSE2 __strpbrk_sse2
-#define STRCSPN_SSE42 __strpbrk_sse42
-#include "strcspn-c.c"
+/* Don't define multiple versions for strpbrk in static library since we
+   need strpbrk before the initialization happened.  */
+#ifdef SHARED
+# define USE_AS_STRPBRK
+# define STRCSPN_SSE2 __strpbrk_sse2
+# define STRCSPN_SSE42 __strpbrk_sse42
+# include "strcspn-c.c"
+#endif

From 7749bf5fe6ac0464db10a3a17a31121517f92530 Mon Sep 17 00:00:00 2001
From: Luis Machado <luisgpm@br.ibm.com>
Date: Wed, 24 Mar 2010 14:46:03 -0700
Subject: [PATCH 23/76] Enable common version of pthread_cond_timedwait to use
 clock_gettime in VDSO

---
 nptl/ChangeLog                |  7 +++++++
 nptl/pthread_cond_timedwait.c | 12 ++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index f51ad43265..bab38c7a8f 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-23  Luis Machado  <luisgpm@br.ibm.com>
+
+	* pthread_cond_timedwait.c: Add check for
+	HAVE_CLOCK_GETTIME_VSYSCALL to use VDSO whenever possible.
+	(pthread_cond_timedwait): Use INTERNAL_VSYSCALL instead of
+	INTERNAL_SYSCALL.
+
 2010-03-09  Ulrich Drepper  <drepper@redhat.com>
 
 	* pthread_create.c (__pthread_create_2_1): If priorities are incorrect
diff --git a/nptl/pthread_cond_timedwait.c b/nptl/pthread_cond_timedwait.c
index 9d268e911e..7278ec45b0 100644
--- a/nptl/pthread_cond_timedwait.c
+++ b/nptl/pthread_cond_timedwait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -27,6 +27,14 @@
 
 #include <shlib-compat.h>
 
+#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
+# undef INTERNAL_VSYSCALL
+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
+# undef INLINE_VSYSCALL
+# define INLINE_VSYSCALL INLINE_SYSCALL
+#else
+# include <bits/libc-vdso.h>
+#endif
 
 /* Cleanup handler, defined in pthread_cond_wait.c.  */
 extern void __condvar_cleanup (void *arg)
@@ -102,7 +110,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
 #ifdef __NR_clock_gettime
 	INTERNAL_SYSCALL_DECL (err);
 	int ret;
-	ret = INTERNAL_SYSCALL (clock_gettime, err, 2,
+	ret = INTERNAL_VSYSCALL (clock_gettime, err, 2,
 				(cond->__data.__nwaiters
 				 & ((1 << COND_NWAITERS_SHIFT) - 1)),
 				&rt);

From 085f930b8f263a0e0c87b5189c73f23c6991c556 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Wed, 24 Mar 2010 14:59:43 -0700
Subject: [PATCH 24/76] Allow variable shift values in mmap2.

---
 ChangeLog                        |  4 ++++
 sysdeps/unix/sysv/linux/mmap64.c | 21 +++++++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 004c6bfd41..7a7e46ca68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-24  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/mmap64.c: Allow variable shift values.
+
 2010-03-24  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/x86_64/multiarch/strpbrk-c.c: Define only if SHARED
diff --git a/sysdeps/unix/sysv/linux/mmap64.c b/sysdeps/unix/sysv/linux/mmap64.c
index d3c68cd106..85c801d501 100644
--- a/sysdeps/unix/sysv/linux/mmap64.c
+++ b/sysdeps/unix/sysv/linux/mmap64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2000,2001,2002,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2001,2002,2006,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -30,8 +30,13 @@
 #ifdef __NR_mmap2
 
 /* This is always 12, even on architectures where PAGE_SHIFT != 12.  */
-# ifndef MMAP2_PAGE_SHIFT
-#  define MMAP2_PAGE_SHIFT 12
+# if MMAP2_PAGE_SHIFT == -1
+static int page_shift;
+# else
+#  ifndef MMAP2_PAGE_SHIFT
+#   define MMAP2_PAGE_SHIFT 12
+#  endif
+# define page_shift MMAP2_PAGE_SHIFT
 # endif
 
 # ifndef __ASSUME_MMAP2_SYSCALL
@@ -44,7 +49,15 @@ void *
 __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset)
 {
 #ifdef __NR_mmap2
-  if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
+# ifdef MMAP2_PAGE_SHIFT == -1
+  if (page_shift == 0)
+    {
+      int page_size = getpagesize ();
+      while ((1 << ++page_shift) != page_size)
+	;
+    }
+# endif
+  if (offset & ((1 << page_shift) - 1))
     {
       __set_errno (EINVAL);
       return MAP_FAILED;

From 54bf215c6f6811161275654518161b6bd5b8e325 Mon Sep 17 00:00:00 2001
From: Priit Laes <plaes@plaes.org>
Date: Wed, 24 Mar 2010 15:50:02 -0700
Subject: [PATCH 25/76] Change first_weekday and first_workday in et_EE locale

---
 localedata/ChangeLog     |  6 ++++++
 localedata/locales/et_EE | 18 +++++++++---------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 4da53bc804..da271f94be 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-24  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #10554]
+	* locales/et_EE: Change first_weekday and first_workday.
+	Patch by Priit Laes <plaes@plaes.org>.
+
 2010-02-16  Paul Pluzhnikov  <ppluzhnikov@google.com>
 
 	* Makefile: Add missing gconv-modules dependency.
diff --git a/localedata/locales/et_EE b/localedata/locales/et_EE
index efec335e05..33d31102f4 100644
--- a/localedata/locales/et_EE
+++ b/localedata/locales/et_EE
@@ -209,7 +209,7 @@ collating-symbol <SPECIAL>
 % letter;accent;case;specials
 
 order_start forward;backward/
-            ;forward;position
+	    ;forward;position
 
 % <CAPITAL> or <SMALL> letters first:
 
@@ -2197,8 +2197,8 @@ date_fmt	"<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
 week    7;19971130;4
-first_weekday 1
-first_workday 1
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 LC_MESSAGES
@@ -2232,12 +2232,12 @@ END LC_NAME
 
 LC_ADDRESS
 postal_fmt      "<U0025><U0061><U0025><U004E>/
-                 <U0025><U0066><U0025><U004E>/
-                 <U0025><U0064><U0025><U004E>/
-                 <U0025><U0062><U0025><U004E>/
-                 <U0025><U0073><U0025><U0074><U0025><U0068><U0025><U0074><U0025><U0065><U0025><U0074><U0025><U0072><U0025><U004E>/
-                 <U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025><U004E>/
-                 <U0025><U0063><U0025><U004E>"
+		 <U0025><U0066><U0025><U004E>/
+		 <U0025><U0064><U0025><U004E>/
+		 <U0025><U0062><U0025><U004E>/
+		 <U0025><U0073><U0025><U0074><U0025><U0068><U0025><U0074><U0025><U0065><U0025><U0074><U0025><U0072><U0025><U004E>/
+		 <U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025><U004E>/
+		 <U0025><U0063><U0025><U004E>"
 country_name    "<U0045><U0065><U0073><U0074><U0069>"
 country_post    "<U0045><U0045>"
 country_ab2     "<U0045><U0045>"

From fd8ccb0427569ffdfbb70c8828029122f3459160 Mon Sep 17 00:00:00 2001
From: Jonathan Geisler <jgeisler@cse.taylor.edu>
Date: Wed, 24 Mar 2010 16:02:15 -0700
Subject: [PATCH 26/76] calls to cuserid() can result in buffer overruns and/or
 overflows

---
 ChangeLog               | 5 +++++
 sysdeps/posix/cuserid.c | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7a7e46ca68..0e606dd5d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-03-24  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11397]
+	* sysdeps/posix/cuserid.c (cuserid): Make sure the returned string
+	is NUL terminated.
+	Patch by Jonathan Geisler <jgeisler@cse.taylor.edu>.
+
 	* sysdeps/unix/sysv/linux/mmap64.c: Allow variable shift values.
 
 2010-03-24  H.J. Lu  <hongjiu.lu@intel.com>
diff --git a/sysdeps/posix/cuserid.c b/sysdeps/posix/cuserid.c
index 11c827a686..f30c20e3f8 100644
--- a/sysdeps/posix/cuserid.c
+++ b/sysdeps/posix/cuserid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1998, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1998, 1999, 2001, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -44,5 +44,6 @@ cuserid (s)
 
   if (s == NULL)
     s = name;
-  return strncpy (s, pwptr->pw_name, L_cuserid);
+  s[L_userid - 1] = '\0';
+  return strncpy (s, pwptr->pw_name, L_cuserid - 1);
 }

From c8727fa6e5073d28ed6d0eb40a006ac2c1b9f9f3 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Wed, 24 Mar 2010 17:02:57 -0700
Subject: [PATCH 27/76] Fix Linux getlogin{_r,} implementation

The old implementation uses fd 0 to determine the login TTY.  This
was needed because using /dev/tty it is not possible to deduce the
login TTY.  For some time now there is the pseudo-file
/proc/self/loginuid which directly helps us to find the user.  Prefer
using this file.  It also works if stdin is closed, redirected, or
re-opened.
---
 ChangeLog                            |   7 ++
 include/unistd.h                     |   3 +
 sysdeps/unix/getlogin.c              |   8 ++-
 sysdeps/unix/getlogin_r.c            |   7 +-
 sysdeps/unix/sysv/linux/getlogin.c   |  39 +++++++++++
 sysdeps/unix/sysv/linux/getlogin_r.c | 100 +++++++++++++++++++++++++++
 6 files changed, 161 insertions(+), 3 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/getlogin.c
 create mode 100644 sysdeps/unix/sysv/linux/getlogin_r.c

diff --git a/ChangeLog b/ChangeLog
index 0e606dd5d5..d3cd548f5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-03-24  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/unix/sysv/linux/getlogin_r.c: New file.
+	* sysdeps/unix/sysv/linux/getlogin.c: New file.
+	* sysdeps/unix/getlogin_r.c: Allow compiling getlogin as static
+	function.
+	* sysdeps/unix/getlogin.c: Likewise.  Move name variable to toplevel.
+	* include/unistd.h: Declare __getlogin_r_loginuid.
+
 	[BZ #11397]
 	* sysdeps/posix/cuserid.c (cuserid): Make sure the returned string
 	is NUL terminated.
diff --git a/include/unistd.h b/include/unistd.h
index ccba893abe..0ad2983280 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -176,6 +176,9 @@ extern int __have_sock_cloexec;
    unless it is really necessary.  */
 #define __have_pipe2 __have_sock_cloexec
 
+extern int __getlogin_r_loginuid (char *name, size_t namesize)
+     attribute_hidden;
+
 __END_DECLS
 
 #endif
diff --git a/sysdeps/unix/getlogin.c b/sysdeps/unix/getlogin.c
index 4752685f86..b0ad97cfa5 100644
--- a/sysdeps/unix/getlogin.c
+++ b/sysdeps/unix/getlogin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,16 +25,20 @@
 
 #include <utmp.h>
 
+static char name[UT_NAMESIZE + 1];
+
 /* Return the login name of the user, or NULL if it can't be determined.
    The returned pointer, if not NULL, is good only until the next call.  */
 
+#ifdef STATIC
+STATIC
+#endif
 char *
 getlogin (void)
 {
   char tty_pathname[2 + 2 * NAME_MAX];
   char *real_tty_path = tty_pathname;
   char *result = NULL;
-  static char name[UT_NAMESIZE + 1];
   struct utmp *ut, line, buffer;
 
   /* Get name of tty connected to fd 0.  Return NULL if not a tty or
diff --git a/sysdeps/unix/getlogin_r.c b/sysdeps/unix/getlogin_r.c
index ba7badd054..bf3c889e13 100644
--- a/sysdeps/unix/getlogin_r.c
+++ b/sysdeps/unix/getlogin_r.c
@@ -1,5 +1,5 @@
 /* Reentrant function to return the current login name.  Unix version.
-   Copyright (C) 1991,92,96,97,98,2002 Free Software Foundation, Inc.
+   Copyright (C) 1991,92,96,97,98,2002,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,6 +31,9 @@
    If it cannot be determined or some other error occurred, return the error
    code.  Otherwise return 0.  */
 
+#ifdef STATIC
+STATIC
+#endif
 int
 getlogin_r (name, name_len)
      char *name;
@@ -96,4 +99,6 @@ getlogin_r (name, name_len)
 
   return result;
 }
+#ifndef STATIC
 libc_hidden_def (getlogin_r)
+#endif
diff --git a/sysdeps/unix/sysv/linux/getlogin.c b/sysdeps/unix/sysv/linux/getlogin.c
new file mode 100644
index 0000000000..4d15db093d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getlogin.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 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
+   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 <pwd.h>
+#include <unistd.h>
+#include <not-cancel.h>
+
+#define STATIC static
+#define getlogin getlogin_fd0
+#include <sysdeps/unix/getlogin.c>
+#undef getlogin
+
+
+/* Return the login name of the user, or NULL if it can't be determined.
+   The returned pointer, if not NULL, is good only until the next call.  */
+
+char *
+getlogin (void)
+{
+  if (__getlogin_r_loginuid (name, sizeof (name)) == 0)
+    return name;
+
+  return getlogin_fd0 ();
+}
diff --git a/sysdeps/unix/sysv/linux/getlogin_r.c b/sysdeps/unix/sysv/linux/getlogin_r.c
new file mode 100644
index 0000000000..d07846ccb8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getlogin_r.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 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
+   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 <pwd.h>
+#include <unistd.h>
+#include <not-cancel.h>
+
+#define STATIC static
+static int getlogin_r_fd0 (char *name, size_t namesize);
+#define getlogin_r getlogin_r_fd0
+#include <sysdeps/unix/getlogin_r.c>
+#undef getlogin_r
+
+
+int
+attribute_hidden
+__getlogin_r_loginuid (name, namesize)
+     char *name;
+     size_t namesize;
+{
+  int fd = open_not_cancel_2 ("/proc/self/loginuid", O_RDONLY);
+  if (fd == -1)
+    return 1;
+
+  ssize_t n = TEMP_FAILURE_RETRY (read_not_cancel (fd, name, namesize));
+  close_not_cancel_no_status (fd);
+
+  uid_t uid;
+  char *endp;
+  if (n <= 0
+      || (uid = strtoul (name, &endp, 10), endp == name || *endp != '\0'))
+    return 1;
+
+  size_t buflen = 1024;
+  char *buf = alloca (buflen);
+  bool use_malloc = false;
+  struct passwd pwd;
+  struct passwd *tpwd;
+  int res;
+
+  while ((res = __getpwuid_r (uid, &pwd, buf, buflen, &tpwd)) != 0)
+    if (__libc_use_alloca (2 * buflen))
+      extend_alloca (buf, buflen, 2 * buflen);
+    else
+      {
+	buflen *= 2;
+	char *newp = realloc (use_malloc ? buf : NULL, buflen);
+	if (newp == NULL)
+	  {
+	  fail:
+	    if (use_malloc)
+	      free (buf);
+	    return 1;
+	  }
+	buf = newp;
+	use_malloc = true;
+      }
+
+  if (tpwd == NULL)
+    goto fail;
+
+  strncpy (name, pwd.pw_name, namesize - 1);
+  name[namesize - 1] = '\0';
+
+  if (use_malloc)
+    free (buf);
+
+  return 0;
+}
+
+
+/* Return the login name of the user, or NULL if it can't be determined.
+   The returned pointer, if not NULL, is good only until the next call.  */
+
+int
+getlogin_r (name, namesize)
+     char *name;
+     size_t namesize;
+{
+  if (__getlogin_r_loginuid (name, namesize) == 0)
+    return 0;
+
+  return getlogin_r_fd0 (name, namesize);
+}
+libc_hidden_def (getlogin_r)

From 03615f7d837398790f88f7bd936a33a99e799af5 Mon Sep 17 00:00:00 2001
From: Chris Demetriou <cgd@google.com>
Date: Wed, 24 Mar 2010 17:10:47 -0700
Subject: [PATCH 28/76] ocale-archive differs between 32 and 64 bit platforms

---
 ChangeLog                     | 7 +++++++
 locale/programs/simple-hash.c | 2 ++
 locale/programs/simple-hash.h | 3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d3cd548f5b..08db020060 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-16  Chris Demetriou  <cgd@google.com>
+
+	* locale/programs/simple-hash.c: Include inttypes.h.
+	(hashval_t): Defined to be uint32_t.
+	* locale/programs/simple_hash.h: Include inttypes.h.
+	(compute_hashval): Change return type to uint32_t.
+
 2010-03-24  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/getlogin_r.c: New file.
diff --git a/locale/programs/simple-hash.c b/locale/programs/simple-hash.c
index 5bd65f2478..b9cc237e49 100644
--- a/locale/programs/simple-hash.c
+++ b/locale/programs/simple-hash.c
@@ -21,6 +21,7 @@
 # include <config.h>
 #endif
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -49,6 +50,7 @@
 # define bcopy(s, d, n)	memcpy ((d), (s), (n))
 #endif
 
+#define hashval_t uint32_t
 #include "hashval.h"
 
 extern void *xmalloc (size_t __n);
diff --git a/locale/programs/simple-hash.h b/locale/programs/simple-hash.h
index b41c233b06..e0c32bcc34 100644
--- a/locale/programs/simple-hash.h
+++ b/locale/programs/simple-hash.h
@@ -19,6 +19,7 @@
 #ifndef _SIMPLE_HASH_H
 #define _SIMPLE_HASH_H
 
+#include <inttypes.h>
 #include <obstack.h>
 
 typedef struct hash_table
@@ -45,7 +46,7 @@ extern int iterate_table (const hash_table *htab, void **ptr,
 			  const void **key, size_t *keylen, void **data)
      __THROW;
 
-extern unsigned long int compute_hashval (const void *key, size_t keylen)
+extern uint32_t compute_hashval (const void *key, size_t keylen)
      __THROW;
 extern unsigned long int next_prime (unsigned long int seed) __THROW;
 

From 34b514dff6acf8f1cac0afefd24049e025fd62ea Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Thu, 25 Mar 2010 11:35:05 +0100
Subject: [PATCH 29/76] Fix typo in cuserid

---
 ChangeLog               | 4 ++++
 sysdeps/posix/cuserid.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 08db020060..13f07495d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-25  Andreas Schwab  <schwab@redhat.com>
+
+	* sysdeps/posix/cuserid.c: Fix typo.
+
 2010-03-16  Chris Demetriou  <cgd@google.com>
 
 	* locale/programs/simple-hash.c: Include inttypes.h.
diff --git a/sysdeps/posix/cuserid.c b/sysdeps/posix/cuserid.c
index f30c20e3f8..a74ff84368 100644
--- a/sysdeps/posix/cuserid.c
+++ b/sysdeps/posix/cuserid.c
@@ -44,6 +44,6 @@ cuserid (s)
 
   if (s == NULL)
     s = name;
-  s[L_userid - 1] = '\0';
+  s[L_cuserid - 1] = '\0';
   return strncpy (s, pwptr->pw_name, L_cuserid - 1);
 }

From 89a4419cc384c090b1eabe610647aa4e14436a3f Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Thu, 25 Mar 2010 04:01:33 -0700
Subject: [PATCH 30/76] Add support for new clocks.

Recent Linux kernels added support for the CLOCK_MONOTONIC_RAW,
CLOCK_REALTIME_COARSE, and CLOCK_MONOTONIC_COARSE clocks.
---
 ChangeLog                               | 11 +++++++++++
 bits/time.h                             |  8 +++++++-
 sysdeps/unix/sysv/linux/clock_getres.c  |  8 +++++++-
 sysdeps/unix/sysv/linux/clock_gettime.c |  5 ++++-
 sysdeps/unix/sysv/linux/clock_settime.c |  5 +++--
 5 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 08db020060..6029367106 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
+2010-03-24  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11389]
+	* bits/time.h: Define CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, and
+	CLOCK_MONOTONIC_COARSE.
+	* sysdeps/unix/sysv/linux/clock_getres.c: Handle CLOCK_MONOTONIC_RAW,
+	CLOCK_REALTIME_COARSE, and CLOCK_MONOTONIC_COARSE.
+	* sysdeps/unix/sysv/linux/clock_gettime.c: Likewise.
+	* sysdeps/unix/sysv/linux/clock_settime.c: Likewise.
+
 2010-03-16  Chris Demetriou  <cgd@google.com>
 
+	[BZ #11394]
 	* locale/programs/simple-hash.c: Include inttypes.h.
 	(hashval_t): Defined to be uint32_t.
 	* locale/programs/simple_hash.h: Include inttypes.h.
diff --git a/bits/time.h b/bits/time.h
index b3184d1de9..968ecc549f 100644
--- a/bits/time.h
+++ b/bits/time.h
@@ -1,5 +1,5 @@
 /* System-dependent timing definitions.  Generic version.
-   Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1999-2002,2003,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
@@ -50,6 +50,12 @@ extern long int __sysconf (int);
 #   define CLOCK_PROCESS_CPUTIME_ID	2
 /* Thread-specific CPU-time clock.  */
 #   define CLOCK_THREAD_CPUTIME_ID	3
+/* Monotonic system-wide clock, not adjusted for frequency scaling.  */
+#   define CLOCK_MONOTONIC_RAW		4
+/* Identifier for system-wide realtime clock, updated only on ticks.  */
+#   define CLOCK_REALTIME_COARSE	5
+/* Monotonic system-wide clock, updated only on ticks.  */
+#   define CLOCK_MONOTONIC_COARSE	6
 
 /* Flag to indicate time is absolute.  */
 #   define TIMER_ABSTIME		1
diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index 581ff22c7c..933580b609 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -1,5 +1,5 @@
 /* clock_getres -- Get the resolution of a POSIX clockid_t.  Linux version.
-   Copyright (C) 2003,2004,2005,2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003,2004,2005,2006,2008,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -44,6 +44,9 @@
   SYSDEP_GETRES_CPUTIME							      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
+  case CLOCK_MONOTONIC_RAW:						      \
+  case CLOCK_REALTIME_COARSE:						      \
+  case CLOCK_MONOTONIC_COARSE:						      \
     SYSCALL_GETRES
 
 # define __libc_missing_posix_timers 0
@@ -80,6 +83,9 @@ maybe_syscall_getres (clockid_t clock_id, struct timespec *res)
   SYSDEP_GETRES_CPUTIME							      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
+  case CLOCK_MONOTONIC_RAW:						      \
+  case CLOCK_REALTIME_COARSE:						      \
+  case CLOCK_MONOTONIC_COARSE:						      \
     retval = maybe_syscall_getres (clock_id, res);			      \
     if (retval == 0)							      \
       break;								      \
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index cd536a0fc0..dd3755cce7 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -1,5 +1,5 @@
 /* clock_gettime -- Get current time from a POSIX clockid_t.  Linux version.
-   Copyright (C) 2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 2003,2004,2005,2006,2007,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -80,6 +80,9 @@ maybe_syscall_gettime (clockid_t clock_id, struct timespec *tp)
   SYSDEP_GETTIME_CPUTIME						      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
+  case CLOCK_MONOTONIC_RAW:						      \
+  case CLOCK_REALTIME_COARSE:						      \
+  case CLOCK_MONOTONIC_COARSE:						      \
     retval = maybe_syscall_gettime (clock_id, tp);			      \
     if (retval == 0)							      \
       break;								      \
diff --git a/sysdeps/unix/sysv/linux/clock_settime.c b/sysdeps/unix/sysv/linux/clock_settime.c
index 217ae3f29b..8c52456fdd 100644
--- a/sysdeps/unix/sysv/linux/clock_settime.c
+++ b/sysdeps/unix/sysv/linux/clock_settime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -45,7 +45,7 @@ maybe_syscall_settime_cpu (clockid_t clock_id, const struct timespec *tp)
       INTERNAL_SYSCALL_DECL (err);
       int r = INTERNAL_SYSCALL (clock_settime, err, 2, clock_id, tp);
       if (!INTERNAL_SYSCALL_ERROR_P (r, err))
-        return 0;
+	return 0;
 
       e = INTERNAL_SYSCALL_ERRNO (r, err);
 # ifndef __ASSUME_POSIX_TIMERS
@@ -90,6 +90,7 @@ extern int __libc_missing_posix_timers attribute_hidden;
 /* The REALTIME clock might be available.  Try the syscall first.  */
 # define SYSDEP_SETTIME \
   case CLOCK_REALTIME:							      \
+  case CLOCK_REALTIME_COARSE:						      \
     {									      \
       int e = EINVAL;							      \
 									      \

From 3e259dbb32c2456e7fc0fc751b8544fd0939a704 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Fri, 26 Mar 2010 04:00:10 -0700
Subject: [PATCH 31/76] Remove unwanted malloc changes, again.

---
 malloc/malloc.c          | 15 +--------------
 malloc/tst-mallocstate.c |  6 ------
 2 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0004c878f3..763852ea3b 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4852,8 +4852,7 @@ _int_free(mstate av, mchunkptr p)
       free_perturb (chunk2mem(p), size - SIZE_SZ);
 
     set_fastchunks(av);
-    unsigned int idx = fastbin_index(size);
-    fb = &fastbin (av, idx);
+    fb = &fastbin (av, fastbin_index(size));
 
 #ifdef ATOMIC_FASTBINS
     mchunkptr fd;
@@ -4867,12 +4866,6 @@ _int_free(mstate av, mchunkptr p)
 	    errstr = "double free or corruption (fasttop)";
 	    goto errout;
 	  }
-	if (old != NULL
-	    && __builtin_expect (fastbin_index(chunksize(old)) != idx, 0))
-	  {
-	    errstr = "invalid fastbin entry (free)";
-	    goto errout;
-	  }
 	p->fd = fd = old;
       }
     while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
@@ -4884,12 +4877,6 @@ _int_free(mstate av, mchunkptr p)
 	errstr = "double free or corruption (fasttop)";
 	goto errout;
       }
-    if (*fb != NULL
-	&& __builtin_expect (fastbin_index(chunksize(*fb)) != idx, 0))
-      {
-	errstr = "invalid fastbin entry (free)";
-	goto errout;
-      }
 
     p->fd = *fb;
     *fb = p;
diff --git a/malloc/tst-mallocstate.c b/malloc/tst-mallocstate.c
index 2a1fd469ab..97a10586d3 100644
--- a/malloc/tst-mallocstate.c
+++ b/malloc/tst-mallocstate.c
@@ -51,7 +51,6 @@ main (void)
 
   for (i=0; i<100; ++i)
     {
-printf("round %li\n", i);
       save_state = malloc_get_state ();
       if (save_state == NULL)
 	{
@@ -65,18 +64,13 @@ printf("round %li\n", i);
 	merror ("realloc (i*4) failed.");
       free (save_state);
     }
-puts("done");
 
   p1 = realloc (p1, 40);
-puts("after realloc");
   free (p2);
-puts("after free 1");
   p2 = malloc (10);
-puts("after malloc");
   if (p2 == NULL)
     merror ("malloc (10) failed.");
   free (p1);
-puts("after free 2");
 
   return errors != 0;
 }

From 2b0fba7530eafb3d815b8c9f3d546d3494680102 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Fri, 26 Mar 2010 05:09:55 -0700
Subject: [PATCH 32/76] Remove stale reference to website

---
 ChangeLog       | 4 ++++
 malloc/malloc.c | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3845cafc25..d4d4826a2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* malloc/malloc.c: Remove stale reference to website.
+
 2010-03-24  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11389]
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 763852ea3b..6993aea0ec 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -148,8 +148,7 @@
   Thread-safety: thread-safe unless NO_THREADS is defined
 
   Compliance: I believe it is compliant with the 1997 Single Unix Specification
-       (See http://www.opennc.org). Also SVID/XPG, ANSI C, and probably
-       others as well.
+       Also SVID/XPG, ANSI C, and probably others as well.
 
 * Synopsis of compile-time options:
 

From c3dfadb87e16f0fab6f4d5242bcecf06c02976c7 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Fri, 26 Mar 2010 05:35:50 -0700
Subject: [PATCH 33/76] Fix spurious UNAVAIL status is getaddrinfo

---
 ChangeLog                   | 5 +++++
 sysdeps/posix/getaddrinfo.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index d4d4826a2c..2ba417bb2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-25  Andreas Schwab  <schwab@redhat.com>
+
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): Reset no_data before
+	each action.
+
 2010-03-26  Ulrich Drepper  <drepper@redhat.com>
 
 	* malloc/malloc.c: Remove stale reference to website.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 62c38f69be..8b7e38fdea 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -702,6 +702,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 
 	  while (!no_more)
 	    {
+	      no_data = 0;
 	      nss_gethostbyname4_r fct4
 		= __nss_lookup_function (nip, "gethostbyname4_r");
 	      if (fct4 != NULL)

From 7c9302908ee9ce1c21d930923a879c2cbef5242f Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Fri, 26 Mar 2010 05:40:27 -0700
Subject: [PATCH 34/76] Don't abort immediately on successful lookup in
 getaddrinfo.

When not using gethostbyname4 methods we immediately aborted the loop
over the nss modules on the first successful lookup.  While this is
almost always what is wanted the nsswitch.conf file allows to select
something different.
---
 ChangeLog                   |  5 +++++
 sysdeps/posix/getaddrinfo.c | 20 ++++++++++----------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2ba417bb2e..8117882671 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't assume success always
+	means aborting the loop over the NSS methods.
+
 2010-03-25  Andreas Schwab  <schwab@redhat.com>
 
 	* sysdeps/posix/getaddrinfo.c (gaih_inet): Reset no_data before
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 8b7e38fdea..597189f744 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -817,17 +817,17 @@ gaih_inet (const char *name, const struct gaih_service *service,
 				    canon = name;
 				}
 			    }
-
-			  break;
 			}
-
-		      /* We can have different states for AF_INET and
-			 AF_INET6.  Try to find a useful one for both.  */
-		      if (inet6_status == NSS_STATUS_TRYAGAIN)
-			status = NSS_STATUS_TRYAGAIN;
-		      else if (status == NSS_STATUS_UNAVAIL
-			       && inet6_status != NSS_STATUS_UNAVAIL)
-			status = inet6_status;
+		      else
+			{
+			  /* We can have different states for AF_INET and
+			     AF_INET6.  Try to find a useful one for both.  */
+			  if (inet6_status == NSS_STATUS_TRYAGAIN)
+			    status = NSS_STATUS_TRYAGAIN;
+			  else if (status == NSS_STATUS_UNAVAIL
+				   && inet6_status != NSS_STATUS_UNAVAIL)
+			    status = inet6_status;
+			}
 		    }
 		  else
 		    status = NSS_STATUS_UNAVAIL;

From 07f9ca32a96891c90cb80aee780c8cee2c9504e4 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Fri, 26 Mar 2010 05:52:39 -0700
Subject: [PATCH 35/76] Fix one case of last checkin.

If the v4 lookup failed but v6 succeeded we treat this as a success.
---
 sysdeps/posix/getaddrinfo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 597189f744..2e0c7248f0 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -817,6 +817,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 				    canon = name;
 				}
 			    }
+			  status = NSS_STATUS_SUCCESS;
 			}
 		      else
 			{

From b1c1949e60e7c61bcd9f40f712d07494596491b2 Mon Sep 17 00:00:00 2001
From: Richard Henderson <rth@twiddle.net>
Date: Fri, 26 Mar 2010 09:16:21 -0700
Subject: [PATCH 36/76] Don't take the address of a void object.

GCC 4.5 warns about "extern void _end; &end;".
Use char[] instead, as that also doesn't fall foul
of a target's .sdata optimizations.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 ChangeLog                           | 7 +++++++
 csu/gmon-start.c                    | 4 ++--
 elf/dl-sysdep.c                     | 6 +++---
 sysdeps/unix/sysv/linux/dl-sysdep.c | 8 ++++----
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8117882671..72cbef6681 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-26  Richard Henderson  <rth@redhat.com>
+
+	* csu/gmon-start.c (ENTRY_POINT, etext): Declare as char[], not void.
+	* elf/dl-sysdep.c (_end): Likewise.
+	* sysdeps/unix/sysv/dl-sysdep.c (frob_brk): Likewise with locally
+	declared _end, and associated variables.
+
 2010-03-26  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't assume success always
diff --git a/csu/gmon-start.c b/csu/gmon-start.c
index d11c9b9532..7d585e135f 100644
--- a/csu/gmon-start.c
+++ b/csu/gmon-start.c
@@ -31,9 +31,9 @@
 #ifdef ENTRY_POINT_DECL
 ENTRY_POINT_DECL(extern)
 #else
-extern void ENTRY_POINT;
+extern char ENTRY_POINT[];
 #endif
-extern void etext;
+extern char etext[];
 
 #ifndef TEXT_START
 # ifdef ENTRY_POINT_DECL
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index 5507e57b96..160503dac5 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -47,7 +47,7 @@
 #endif
 
 extern char **_environ attribute_hidden;
-extern void _end attribute_hidden;
+extern char _end[] attribute_hidden;
 
 /* Protect SUID program against misuse of file descriptors.  */
 extern void __libc_check_standard_fds (void);
@@ -226,14 +226,14 @@ _dl_sysdep_start (void **start_argptr,
   if (GLRO(dl_platform) != NULL)
     GLRO(dl_platformlen) = strlen (GLRO(dl_platform));
 
-  if (__sbrk (0) == &_end)
+  if (__sbrk (0) == _end)
     /* The dynamic linker was run as a program, and so the initial break
        starts just after our bss, at &_end.  The malloc in dl-minimal.c
        will consume the rest of this page, so tell the kernel to move the
        break up that far.  When the user program examines its break, it
        will see this new value and not clobber our data.  */
     __sbrk (GLRO(dl_pagesize)
-	    - ((&_end - (void *) 0) & (GLRO(dl_pagesize) - 1)));
+	    - ((_end - (char *) 0) & (GLRO(dl_pagesize) - 1)));
 
   /* If this is a SUID program we make sure that FDs 0, 1, and 2 are
      allocated.  If necessary we are doing it ourself.  If it is not
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
index 08ae9aa86d..34e8808928 100644
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
@@ -47,12 +47,12 @@ frob_brk (void)
      Later Linux kernels have changed this behavior so that the initial
      break value is rounded up to the page boundary before we start.  */
 
-  extern void *__curbrk attribute_hidden;
-  extern void _end attribute_hidden;
-  void *const endpage = (void *) 0 + (((__curbrk - (void *) 0)
+  extern char *__curbrk attribute_hidden;
+  extern char _end[] attribute_hidden;
+  char *const endpage = (void *) 0 + (((__curbrk - (char *) 0)
 				       + GLRO(dl_pagesize) - 1)
 				      & -GLRO(dl_pagesize));
-  if (__builtin_expect (__curbrk >= &_end && __curbrk < endpage, 0))
+  if (__builtin_expect (__curbrk >= _end && __curbrk < endpage, 0))
     __brk (endpage);
 #endif
 }

From 6e9331df8bb546363724aaf50d8b023a0167c06d Mon Sep 17 00:00:00 2001
From: Richard Henderson <rth@twiddle.net>
Date: Fri, 26 Mar 2010 09:21:34 -0700
Subject: [PATCH 37/76] Finish locale_data -> __locale_data transition.

The transition that was begun here
f095bb7204d80f609a73a22796edd6cffd4c6add
was not complete.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 ChangeLog          | 5 +++++
 locale/setlocale.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 72cbef6681..23393e6763 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-26  Richard Henderson  <rth@redhat.com>
+
+	* locale/setlocale.c (free_category): Finish renaming
+	struct locale_data to __locale_data.
+
 2010-03-26  Richard Henderson  <rth@redhat.com>
 
 	* csu/gmon-start.c (ENTRY_POINT, etext): Declare as char[], not void.
diff --git a/locale/setlocale.c b/locale/setlocale.c
index 4ebce78244..46372fdcac 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -465,7 +465,7 @@ libc_hidden_def (setlocale)
 
 static void __libc_freeres_fn_section
 free_category (int category,
-	       struct __locale_data *here, struct locale_data *c_data)
+	       struct __locale_data *here, struct __locale_data *c_data)
 {
   struct loaded_l10nfile *runp = _nl_locale_file_list[category];
 
@@ -481,7 +481,7 @@ free_category (int category,
   while (runp != NULL)
     {
       struct loaded_l10nfile *curr = runp;
-      struct __locale_data *data = (struct locale_data *) runp->data;
+      struct __locale_data *data = (struct __locale_data *) runp->data;
 
       if (data != NULL && data != c_data)
 	_nl_unload_locale (data);

From 68cf34be99d6d6241bd25a091d0e511121497ef9 Mon Sep 17 00:00:00 2001
From: Richard Henderson <rth@twiddle.net>
Date: Fri, 26 Mar 2010 09:48:44 -0700
Subject: [PATCH 38/76] Fix printf format warning for si_band.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 ChangeLog               | 5 +++++
 stdio-common/psiginfo.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 23393e6763..367eafd7ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-26  Richard Henderson  <rth@redhat.com>
+
+	* stdio-common/psiginfo.c (psiginfo): Fix printf format
+	warning for si_band.
+
 2010-03-26  Richard Henderson  <rth@redhat.com>
 
 	* locale/setlocale.c (free_category): Finish renaming
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index e089fcaa42..90cdf05909 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -170,7 +170,7 @@ Signal generated by the completion of an I/O request");
 	fprintf (fp, "%ld %d %ld)", (long int) pinfo->si_pid, pinfo->si_status,
 		 (long int) pinfo->si_uid);
       else if (pinfo->si_signo == SIGPOLL)
-	fprintf (fp, "%ld)", pinfo->si_band);
+	fprintf (fp, "%ld)", (long int) pinfo->si_band);
       else
 	fprintf (fp, "%ld %ld)",
 		 (long int) pinfo->si_pid, (long int) pinfo->si_uid);

From d09580b1e6c3158fd00a41e71ec5a4ace9f0a2fe Mon Sep 17 00:00:00 2001
From: Richard Henderson <rth@twiddle.net>
Date: Fri, 26 Mar 2010 09:51:57 -0700
Subject: [PATCH 39/76] Mark _dl_random attribute_relro in the header file.

It's already so marked in dl-sysdep.c.  Failure to so mark
in the header file leads the compiler to believe that the
variable should be addressable via the .sdata section.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 ChangeLog                  | 4 ++++
 sysdeps/generic/ldsodefs.h | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 367eafd7ad..cce81c2690 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-26  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/generic/ldsodefs.h (_dl_random): Mark attribute_relro;
+
 2010-03-26  Richard Henderson  <rth@redhat.com>
 
 	* stdio-common/psiginfo.c (psiginfo): Fix printf format
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 230c39a631..a14e8af92f 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -748,7 +748,7 @@ extern int _dl_starting_up_internal attribute_hidden;
 #endif
 
 /* Random data provided by the kernel.  */
-extern void *_dl_random attribute_hidden;
+extern void *_dl_random attribute_hidden attribute_relro;
 
 /* OS-dependent function to open the zero-fill device.  */
 extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */

From 8dc1d0baa059066dfce35dc0bfe192252fda431b Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Fri, 26 Mar 2010 13:33:26 -0700
Subject: [PATCH 40/76] Shorted ChangeLog.

---
 ChangeLog | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cce81c2690..a1bd98b6e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,18 +2,12 @@
 
 	* sysdeps/generic/ldsodefs.h (_dl_random): Mark attribute_relro;
 
-2010-03-26  Richard Henderson  <rth@redhat.com>
-
 	* stdio-common/psiginfo.c (psiginfo): Fix printf format
 	warning for si_band.
 
-2010-03-26  Richard Henderson  <rth@redhat.com>
-
 	* locale/setlocale.c (free_category): Finish renaming
 	struct locale_data to __locale_data.
 
-2010-03-26  Richard Henderson  <rth@redhat.com>
-
 	* csu/gmon-start.c (ENTRY_POINT, etext): Declare as char[], not void.
 	* elf/dl-sysdep.c (_end): Likewise.
 	* sysdeps/unix/sysv/dl-sysdep.c (frob_brk): Likewise with locally

From 62f8db6e495ccc77d2f4a0e37406ae97d2ccfd3c Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 27 Mar 2010 04:11:14 -0700
Subject: [PATCH 41/76] Define miss_F_GETOWN_EX only if needed.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When doing i686-unknown-linux-gnu build configured with --enable-kernel=2.6.24,
there are several warnings like this:

  ../sysdeps/unix/sysv/linux/i386/fcntl.c:36:12: warning: ‘miss_F_GETOWN_EX’ defined but not used
---
 ChangeLog                            |  6 ++++++
 sysdeps/unix/sysv/linux/i386/fcntl.c | 22 +++++++++++-----------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a1bd98b6e6..d020871231 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/fcntl.c: Define miss_F_GETOWN_EX
+	only if needed.
+	Patch mostly by Paul Pluzhnikov <ppluzhnikov@google.com>.
+
 2010-03-26  Richard Henderson  <rth@redhat.com>
 
 	* sysdeps/generic/ldsodefs.h (_dl_random): Mark attribute_relro;
diff --git a/sysdeps/unix/sysv/linux/i386/fcntl.c b/sysdeps/unix/sysv/linux/i386/fcntl.c
index 5544d6e0d9..e82a60a885 100644
--- a/sysdeps/unix/sysv/linux/i386/fcntl.c
+++ b/sysdeps/unix/sysv/linux/i386/fcntl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000,2002,2003,2004,2006,2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2002-2004,2006,2009,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,23 +25,23 @@
 #include <sys/syscall.h>
 #include <kernel-features.h>
 
-#if __ASSUME_FCNTL64 == 0
+#ifndef __ASSUME_FCNTL64
 /* This variable is shared with all files that check for fcntl64.  */
 int __have_no_fcntl64;
 #endif
 
 #ifdef __ASSUME_F_GETOWN_EX
 # define miss_F_GETOWN_EX 0
-#else
+#elif !defined __ASSUME_FCNTL64
 static int miss_F_GETOWN_EX;
 #endif
 
 
-#if defined NO_CANCELLATION && __ASSUME_FCNTL64 == 0
+#if defined NO_CANCELLATION && !defined __ASSUME_FCNTL64
 # define __fcntl_nocancel  __libc_fcntl
 #endif
 
-#if !defined NO_CANCELLATION || __ASSUME_FCNTL64 == 0
+#if !defined NO_CANCELLATION || !defined __ASSUME_FCNTL64
 int
 __fcntl_nocancel (int fd, int cmd, ...)
 {
@@ -52,7 +52,7 @@ __fcntl_nocancel (int fd, int cmd, ...)
   arg = va_arg (ap, void *);
   va_end (ap);
 
-#if __ASSUME_FCNTL64 == 0
+#ifndef __ASSUME_FCNTL64
 # ifdef __NR_fcntl64
   if (! __have_no_fcntl64)
     {
@@ -135,11 +135,11 @@ __fcntl_nocancel (int fd, int cmd, ...)
 	  if (!INTERNAL_SYSCALL_ERROR_P (res, err))
 	    return fex.type == F_OWNER_GID ? -fex.pid : fex.pid;
 
-#ifndef __ASSUME_F_GETOWN_EX
+# ifndef __ASSUME_F_GETOWN_EX
 	  if (INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL)
 	    miss_F_GETOWN_EX = 1;
 	  else
-#endif
+# endif
 	    {
 	      __set_errno (INTERNAL_SYSCALL_ERRNO (res, err));
 	      return -1;
@@ -168,21 +168,21 @@ __libc_fcntl (int fd, int cmd, ...)
   arg = va_arg (ap, void *);
   va_end (ap);
 
-#if __ASSUME_FCNTL64 > 0
+# ifdef __ASSUME_FCNTL64
   if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
     return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
 
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   int result = INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
-#else
+# else
   if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
     return __fcntl_nocancel (fd, cmd, arg);
 
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   int result = __fcntl_nocancel (fd, cmd, arg);
-#endif
+# endif
 
   LIBC_CANCEL_RESET (oldtype);
 

From 463ed2f0bee56eb61a83b401a0134a4b8955178a Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 27 Mar 2010 04:48:18 -0700
Subject: [PATCH 42/76] Fix comments and indentation.

---
 sysdeps/unix/sysv/linux/kernel-features.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index f48e644e09..275668b23c 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -1,6 +1,6 @@
 /* Set flags signalling availability of kernel features based on given
    kernel version number.
-   Copyright (C) 1999-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1999-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
@@ -65,7 +65,7 @@
 # define __ASSUME_LCHOWN_SYSCALL	1
 #endif
 
-/* When did the `setresuid' sysall became available?  */
+/* When did the `setresuid' syscall became available?  */
 #if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__
 # define __ASSUME_SETRESUID_SYSCALL	1
 #endif
@@ -126,7 +126,7 @@
 #endif
 
 /* I know for sure that these are in 2.3.35 on powerpc. But PowerPC64 does not
-   support separate 64-bit syscalls, already 64-bit */
+   support separate 64-bit syscalls, already 64-bit.  */
 #if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ \
     && !defined __powerpc64__
 # define __ASSUME_TRUNCATE64_SYSCALL	1
@@ -158,8 +158,8 @@
 # define __ASSUME_LDT_WORKS		1
 #endif
 
-/* Linux 2.4.0 on PPC introduced a correct IPC64. But PowerPC64 does not
-   support a separate 64-bit sys call, already 64-bit */
+/* Linux 2.4.0 on PPC introduced a correct IPC64.  But PowerPC64 does not
+   support a separate 64-bit syscall, already 64-bit.  */
 #if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__ \
     && !defined __powerpc64__
 # define __ASSUME_IPC64			1
@@ -208,7 +208,7 @@
 # define __ASSUME_GETDENTS64_SYSCALL	1
 #endif
 
-/* When did O_DIRECTORY became available?  Early in 2.3 but when?
+/* When did O_DIRECTORY become available?  Early in 2.3 but when?
    Be safe, use 2.3.99.  */
 #if __LINUX_KERNEL_VERSION >= 131939
 # define __ASSUME_O_DIRECTORY		1
@@ -412,7 +412,7 @@
 
 /* Starting with version 2.6.9, SSI_IEEE_RAISE_EXCEPTION exists.  */
 #if __LINUX_KERNEL_VERSION >= 0x020609 && defined __alpha__
-#define __ASSUME_IEEE_RAISE_EXCEPTION	1
+# define __ASSUME_IEEE_RAISE_EXCEPTION	1
 #endif
 
 /* On sparc64 stat64/lstat64/fstat64 syscalls were introduced in 2.6.12.  */

From a5f3b0f830920ae31e24cad8fe5d877bba556764 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 27 Mar 2010 05:48:17 -0700
Subject: [PATCH 43/76] Fix one more issue with the glob patch.

---
 ChangeLog    | 4 ++++
 posix/glob.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d020871231..0969ca2de1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-27  Ulrich Drepper  <drepper@redhat.com>
+
+	* posix/glob.c (glob): Initialize oldcount early, too.
+
 2010-03-26  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/i386/fcntl.c: Define miss_F_GETOWN_EX
diff --git a/posix/glob.c b/posix/glob.c
index 3ae055d430..e410d50ffe 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -436,6 +436,8 @@ glob (pattern, flags, errfunc, pglob)
 	}
     }
 
+  oldcount = pglob->gl_pathc + pglob->gl_offs;
+
   /* Find the filename.  */
   filename = strrchr (pattern, '/');
 #if defined __MSDOS__ || defined WINDOWS32
@@ -553,8 +555,6 @@ glob (pattern, flags, errfunc, pglob)
 	}
     }
 
-  oldcount = pglob->gl_pathc + pglob->gl_offs;
-
 #ifndef VMS
   if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~')
     {

From b9ea2dd05ee1684ca36ce7ee62ac679f391b6a7f Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 27 Mar 2010 06:06:35 -0700
Subject: [PATCH 44/76] Fix handling of __need_mbstate_t and __need_wint_t.

Like the real header, the libc-internal wrapper for wchar.h needs to
undefine the macros so that if the header was already included before
the macros don't stay defined and cause problems later.
---
 ChangeLog       | 3 +++
 include/wchar.h | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 0969ca2de1..d06b956810 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-03-27  Ulrich Drepper  <drepper@redhat.com>
 
+	* include/wchar.h: Undefine __need_mbstate_t and __need_wint_t
+	unconditionally in the end.
+
 	* posix/glob.c (glob): Initialize oldcount early, too.
 
 2010-03-26  Ulrich Drepper  <drepper@redhat.com>
diff --git a/include/wchar.h b/include/wchar.h
index bca847731d..3afe0b6e2e 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -195,3 +195,8 @@ extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
 
 # endif
 #endif
+
+/* Undefine all __need_* constants in case we are included to get those
+   constants but the whole file was already read.  */
+#undef __need_mbstate_t
+#undef __need_wint_t

From 0a164fe03ee79d93e5dd2b1e1917e4ff5d580e1f Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 27 Mar 2010 06:19:03 -0700
Subject: [PATCH 45/76] Whitespace fixes.

---
 posix/glob.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/posix/glob.c b/posix/glob.c
index e410d50ffe..6df083a67a 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -1042,9 +1042,9 @@ glob (pattern, flags, errfunc, pglob)
 	     : (__stat64 (pglob->gl_pathv[i], &st64) == 0
 		&& S_ISDIR (st64.st_mode))))
 	  {
- 	    size_t len = strlen (pglob->gl_pathv[i]) + 2;
+	    size_t len = strlen (pglob->gl_pathv[i]) + 2;
 	    char *new = realloc (pglob->gl_pathv[i], len);
- 	    if (new == NULL)
+	    if (new == NULL)
 	      {
 		globfree (pglob);
 		pglob->gl_pathc = 0;

From 8f4a5048eea6536ee85c0f2670adbb97d71e427d Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 27 Mar 2010 06:19:50 -0700
Subject: [PATCH 46/76] Optimize __getpagesize a bit.

---
 ChangeLog                             |  3 +++
 sysdeps/unix/sysv/linux/getpagesize.c | 27 +++++++++++++++++----------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d06b956810..4587248b6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-03-27  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/unix/sysv/linux/getpagesize.c (__getpagesize): If
+	__ASSUME_AT_PAGESIZE we can rely on the value being set.
+
 	* include/wchar.h: Undefine __need_mbstate_t and __need_wint_t
 	unconditionally in the end.
 
diff --git a/sysdeps/unix/sysv/linux/getpagesize.c b/sysdeps/unix/sysv/linux/getpagesize.c
index 6d03b3bbf2..0866079511 100644
--- a/sysdeps/unix/sysv/linux/getpagesize.c
+++ b/sysdeps/unix/sysv/linux/getpagesize.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1995-1997,2000,2002,2004
+/* Copyright (C) 1991,1992,1995-1997,2000,2002,2004,2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -17,30 +17,37 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <unistd.h>
 #include <sys/param.h>
 
 #include <ldsodefs.h>
+#include <kernel-features.h>
 
 /* Return the system page size.  */
 int
 __getpagesize ()
 {
+#ifdef __ASSUME_AT_PAGESIZE
+  assert (GLRO(dl_pagesize) != 0);
+  return GLRO(dl_pagesize);
+#else
   if (GLRO(dl_pagesize) != 0)
     return GLRO(dl_pagesize);
 
-#ifdef	EXEC_PAGESIZE
+# ifdef	EXEC_PAGESIZE
   return EXEC_PAGESIZE;
-#else	/* No EXEC_PAGESIZE.  */
-#ifdef	NBPG
-#ifndef	CLSIZE
-#define	CLSIZE	1
-#endif	/* No CLSIZE.  */
+# else	/* No EXEC_PAGESIZE.  */
+#  ifdef NBPG
+#   ifndef CLSIZE
+#    define CLSIZE	1
+#   endif	/* No CLSIZE.  */
   return NBPG * CLSIZE;
-#else	/* No NBPG.  */
+#  else	/* No NBPG.  */
   return NBPC;
-#endif	/* NBPG.  */
-#endif	/* EXEC_PAGESIZE.  */
+#  endif	/* NBPG.  */
+# endif	/* EXEC_PAGESIZE.  */
+#endif
 }
 libc_hidden_def (__getpagesize)
 weak_alias (__getpagesize, getpagesize)

From bc58236c652761240fbe52f946f4a5efdd503fab Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@schwinge.name>
Date: Mon, 29 Mar 2010 15:13:53 -0700
Subject: [PATCH 47/76] Handle platforms without aux vector

---
 ChangeLog                     | 7 +++++++
 elf/rtld.c                    | 6 +++---
 sysdeps/mach/hurd/dl-sysdep.c | 7 ++++---
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4587248b6d..5b70500d5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-28  Thomas Schwinge  <thomas@schwinge.name>
+
+	* sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start): Adapt to auxv
+	changes in the generic code.
+	* elf/rtld.c (dl_main): Conditionalize the code that dereferences auxv
+	to [HAVE_AUX_VECTOR].
+
 2010-03-27  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/getpagesize.c (__getpagesize): If
diff --git a/elf/rtld.c b/elf/rtld.c
index 3afb997f85..3c414461e9 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -928,8 +928,6 @@ dl_main (const ElfW(Phdr) *phdr,
 
   if (*user_entry == (ElfW(Addr)) ENTRY_POINT)
     {
-      ElfW(auxv_t) *av;
-
       /* Ho ho.  We are not the program interpreter!  We are the program
 	 itself!  This means someone ran ld.so as a command.  Well, that
 	 might be convenient to do sometimes.  We support it by
@@ -1086,9 +1084,10 @@ of this helper program; chances are you did not intend to run this program.\n\
       main_map->l_name = (char *) "";
       *user_entry = main_map->l_entry;
 
+#ifdef HAVE_AUX_VECTOR
       /* Adjust the on-stack auxiliary vector so that it looks like the
 	 binary was executed directly.  */
-      for (av = auxv; av->a_type != AT_NULL; av++)
+      for (ElfW(auxv_t) *av = auxv; av->a_type != AT_NULL; av++)
 	switch (av->a_type)
 	  {
 	  case AT_PHDR:
@@ -1101,6 +1100,7 @@ of this helper program; chances are you did not intend to run this program.\n\
 	    av->a_un.a_val = *user_entry;
 	    break;
 	  }
+#endif
     }
   else
     {
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 2440682903..f87b6e07dc 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -1,5 +1,5 @@
 /* Operating system support for run-time dynamic linker.  Hurd version.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2010
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -116,7 +116,8 @@ static void fmh(void) {
 ElfW(Addr)
 _dl_sysdep_start (void **start_argptr,
 		  void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phent,
-				   ElfW(Addr) *user_entry))
+				   ElfW(Addr) *user_entry,
+				   ElfW(auxv_t) *auxv)))
 {
   void go (intptr_t *argdata)
     {
@@ -197,7 +198,7 @@ unfmh();			/* XXX */
 	 up and leave us to transfer control to USER_ENTRY.  */
       (*dl_main) ((const ElfW(Phdr) *) _dl_hurd_data->phdr,
 		  _dl_hurd_data->phdrsz / sizeof (ElfW(Phdr)),
-		  &_dl_hurd_data->user_entry);
+		  &_dl_hurd_data->user_entry, NULLy);
 
       /* The call above might screw a few things up.
 

From ab61c641c21abaf58eda5198019db83657beb699 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Mon, 29 Mar 2010 18:43:06 -0700
Subject: [PATCH 48/76] Fix typos from last patch.

---
 sysdeps/mach/hurd/dl-sysdep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index f87b6e07dc..6f2787456f 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -117,7 +117,7 @@ ElfW(Addr)
 _dl_sysdep_start (void **start_argptr,
 		  void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phent,
 				   ElfW(Addr) *user_entry,
-				   ElfW(auxv_t) *auxv)))
+				   ElfW(auxv_t) *auxv))
 {
   void go (intptr_t *argdata)
     {
@@ -198,7 +198,7 @@ unfmh();			/* XXX */
 	 up and leave us to transfer control to USER_ENTRY.  */
       (*dl_main) ((const ElfW(Phdr) *) _dl_hurd_data->phdr,
 		  _dl_hurd_data->phdrsz / sizeof (ElfW(Phdr)),
-		  &_dl_hurd_data->user_entry, NULLy);
+		  &_dl_hurd_data->user_entry, NULL);
 
       /* The call above might screw a few things up.
 

From 6d28d423b2e47ad3534fb8807f4b0f31c2c0fa9a Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Mon, 29 Mar 2010 22:31:44 -0700
Subject: [PATCH 49/76] Define MSG_WAITFORONE.

---
 ChangeLog                             | 4 ++++
 sysdeps/unix/sysv/linux/bits/socket.h | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 5b70500d5c..55b4d843f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-29  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/bits/socket.h: Define MSG_WAITFORONE.
+
 2010-03-28  Thomas Schwinge  <thomas@schwinge.name>
 
 	* sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start): Adapt to auxv
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index aa78087a72..dba3a3914b 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, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -232,6 +232,8 @@ enum
 #define	MSG_NOSIGNAL	MSG_NOSIGNAL
     MSG_MORE		= 0x8000,  /* Sender will send more.  */
 #define	MSG_MORE	MSG_MORE
+    MSG_WAITFORONE	= 0x10000, /* Wait for at least one packet to return.*/
+#define MSG_WAITFORONE	MSG_WAITFORONE
 
     MSG_CMSG_CLOEXEC	= 0x40000000	/* Set close_on_exit for file
 					   descriptor received through

From 960af486d29fb1c233c5cd92e1d6dc029daeb7af Mon Sep 17 00:00:00 2001
From: "David S. Miller" <davem@davemloft.net>
Date: Wed, 31 Mar 2010 14:07:39 -0700
Subject: [PATCH 50/76] Fix build of mmap64.

---
 ChangeLog                        | 5 +++++
 sysdeps/unix/sysv/linux/mmap64.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 55b4d843f3..dafce4dc80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-30  David S. Miller  <davem@davemloft.net>
+
+	* sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Fix
+	MMAP2_PAGE_SHIFT test.
+
 2010-03-29  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/bits/socket.h: Define MSG_WAITFORONE.
diff --git a/sysdeps/unix/sysv/linux/mmap64.c b/sysdeps/unix/sysv/linux/mmap64.c
index 85c801d501..b24b3f0c8b 100644
--- a/sysdeps/unix/sysv/linux/mmap64.c
+++ b/sysdeps/unix/sysv/linux/mmap64.c
@@ -49,7 +49,7 @@ void *
 __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset)
 {
 #ifdef __NR_mmap2
-# ifdef MMAP2_PAGE_SHIFT == -1
+# if MMAP2_PAGE_SHIFT == -1
   if (page_shift == 0)
     {
       int page_size = getpagesize ();

From 991eda1ec17665ea0da247f8eabc6993d020ed8e Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 3 Apr 2010 09:43:10 -0700
Subject: [PATCH 51/76] Fix set_max_fast in malloc.

---
 ChangeLog       | 4 ++++
 malloc/malloc.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index dafce4dc80..f61697c1b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-03  Ulrich Drepper  <drepper@redhat.com>
+
+	* malloc/malloc.c (set_max_fast): Fix computation of the value.
+
 2010-03-30  David S. Miller  <davem@davemloft.net>
 
 	* sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Fix
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 6993aea0ec..784919e4bd 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2350,7 +2350,8 @@ typedef struct malloc_chunk* mfastbinptr;
 */
 
 #define set_max_fast(s) \
-  global_max_fast = ((s) == 0)? SMALLBIN_WIDTH: request2size(s)
+  global_max_fast = (((s) == 0)						      \
+		     ? SMALLBIN_WIDTH: ((s + SIZE_SZ) & ~MALLOC_ALIGN_MASK))
 #define get_max_fast() global_max_fast
 
 

From 90a3055e8bdd9308eceeadc0b37278f324ec6b5d Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 3 Apr 2010 09:47:01 -0700
Subject: [PATCH 52/76] One more sanity check in free.

---
 ChangeLog       |  2 ++
 malloc/malloc.c | 15 ++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f61697c1b2..83e6218b0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2010-04-03  Ulrich Drepper  <drepper@redhat.com>
 
+	* malloc/malloc.c (_int_free): Add one more sanity check for fastbins.
+
 	* malloc/malloc.c (set_max_fast): Fix computation of the value.
 
 2010-03-30  David S. Miller  <davem@davemloft.net>
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 784919e4bd..558e8bab0a 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4852,7 +4852,8 @@ _int_free(mstate av, mchunkptr p)
       free_perturb (chunk2mem(p), size - SIZE_SZ);
 
     set_fastchunks(av);
-    fb = &fastbin (av, fastbin_index(size));
+    unsigned int idx = fastbin_index(size);
+    fb = &fastbin (av, idx);
 
 #ifdef ATOMIC_FASTBINS
     mchunkptr fd;
@@ -4866,6 +4867,12 @@ _int_free(mstate av, mchunkptr p)
 	    errstr = "double free or corruption (fasttop)";
 	    goto errout;
 	  }
+	if (old != NULL
+	    && __builtin_expect (fastbin_index(chunksize(old)) != idx, 0))
+	  {
+	    errstr = "invalid fastbin entry (free)";
+	    goto errout;
+	  }
 	p->fd = fd = old;
       }
     while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
@@ -4877,6 +4884,12 @@ _int_free(mstate av, mchunkptr p)
 	errstr = "double free or corruption (fasttop)";
 	goto errout;
       }
+    if (*fb != NULL
+	&& __builtin_expect (fastbin_index(chunksize(*fb)) != idx, 0))
+      {
+	errstr = "invalid fastbin entry (free)";
+	goto errout;
+      }
 
     p->fd = *fb;
     *fb = p;

From 647450cfb089a60f1dc3de7d68874cd21f475ec7 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 3 Apr 2010 13:45:02 -0700
Subject: [PATCH 53/76] Missing memory barrier in DES initialization.

---
 ChangeLog          |  4 ++
 crypt/crypt_util.c | 97 +++++++++++++++++++++++-----------------------
 2 files changed, 53 insertions(+), 48 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 83e6218b0d..27678bf649 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-04-03  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11449]
+	* crypt/crypt_util.c (__init_des_r): Add memory barrier before setting
+	small_tables_initialized.
+
 	* malloc/malloc.c (_int_free): Add one more sanity check for fastbins.
 
 	* malloc/malloc.c (set_max_fast): Fix computation of the value.
diff --git a/crypt/crypt_util.c b/crypt/crypt_util.c
index 0db5be7b0f..a556389111 100644
--- a/crypt/crypt_util.c
+++ b/crypt/crypt_util.c
@@ -1,7 +1,7 @@
 /*
  * UFC-crypt: ultra fast crypt(3) implementation
  *
- * Copyright (C) 1991, 92, 93, 96, 97, 98, 2000 Free Software Foundation, Inc.
+ * Copyright (C) 1991-1993,1996-1998,2000,2010 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -114,53 +114,53 @@ static const int perm32[32] = {
  * The sboxes
  */
 static const int sbox[8][4][16]= {
-        { { 14,  4, 13,  1,  2, 15, 11,  8,  3, 10,  6, 12,  5,  9,  0,  7 },
-          {  0, 15,  7,  4, 14,  2, 13,  1, 10,  6, 12, 11,  9,  5,  3,  8 },
-          {  4,  1, 14,  8, 13,  6,  2, 11, 15, 12,  9,  7,  3, 10,  5,  0 },
-          { 15, 12,  8,  2,  4,  9,  1,  7,  5, 11,  3, 14, 10,  0,  6, 13 }
-        },
-
-        { { 15,  1,  8, 14,  6, 11,  3,  4,  9,  7,  2, 13, 12,  0,  5, 10 },
-          {  3, 13,  4,  7, 15,  2,  8, 14, 12,  0,  1, 10,  6,  9, 11,  5 },
-          {  0, 14,  7, 11, 10,  4, 13,  1,  5,  8, 12,  6,  9,  3,  2, 15 },
-          { 13,  8, 10,  1,  3, 15,  4,  2, 11,  6,  7, 12,  0,  5, 14,  9 }
-        },
-
-        { { 10,  0,  9, 14,  6,  3, 15,  5,  1, 13, 12,  7, 11,  4,  2,  8 },
-          { 13,  7,  0,  9,  3,  4,  6, 10,  2,  8,  5, 14, 12, 11, 15,  1 },
-          { 13,  6,  4,  9,  8, 15,  3,  0, 11,  1,  2, 12,  5, 10, 14,  7 },
-          {  1, 10, 13,  0,  6,  9,  8,  7,  4, 15, 14,  3, 11,  5,  2, 12 }
-        },
-
-        { {  7, 13, 14,  3,  0,  6,  9, 10,  1,  2,  8,  5, 11, 12,  4, 15 },
-          { 13,  8, 11,  5,  6, 15,  0,  3,  4,  7,  2, 12,  1, 10, 14,  9 },
-          { 10,  6,  9,  0, 12, 11,  7, 13, 15,  1,  3, 14,  5,  2,  8,  4 },
-          {  3, 15,  0,  6, 10,  1, 13,  8,  9,  4,  5, 11, 12,  7,  2, 14 }
-        },
-
-        { {  2, 12,  4,  1,  7, 10, 11,  6,  8,  5,  3, 15, 13,  0, 14,  9 },
-          { 14, 11,  2, 12,  4,  7, 13,  1,  5,  0, 15, 10,  3,  9,  8,  6 },
-          {  4,  2,  1, 11, 10, 13,  7,  8, 15,  9, 12,  5,  6,  3,  0, 14 },
-          { 11,  8, 12,  7,  1, 14,  2, 13,  6, 15,  0,  9, 10,  4,  5,  3 }
-        },
-
-        { { 12,  1, 10, 15,  9,  2,  6,  8,  0, 13,  3,  4, 14,  7,  5, 11 },
-          { 10, 15,  4,  2,  7, 12,  9,  5,  6,  1, 13, 14,  0, 11,  3,  8 },
-          {  9, 14, 15,  5,  2,  8, 12,  3,  7,  0,  4, 10,  1, 13, 11,  6 },
-          {  4,  3,  2, 12,  9,  5, 15, 10, 11, 14,  1,  7,  6,  0,  8, 13 }
-        },
-
-        { {  4, 11,  2, 14, 15,  0,  8, 13,  3, 12,  9,  7,  5, 10,  6,  1 },
-          { 13,  0, 11,  7,  4,  9,  1, 10, 14,  3,  5, 12,  2, 15,  8,  6 },
-          {  1,  4, 11, 13, 12,  3,  7, 14, 10, 15,  6,  8,  0,  5,  9,  2 },
-          {  6, 11, 13,  8,  1,  4, 10,  7,  9,  5,  0, 15, 14,  2,  3, 12 }
-        },
-
-        { { 13,  2,  8,  4,  6, 15, 11,  1, 10,  9,  3, 14,  5,  0, 12,  7 },
-          {  1, 15, 13,  8, 10,  3,  7,  4, 12,  5,  6, 11,  0, 14,  9,  2 },
-          {  7, 11,  4,  1,  9, 12, 14,  2,  0,  6, 10, 13, 15,  3,  5,  8 },
-          {  2,  1, 14,  7,  4, 10,  8, 13, 15, 12,  9,  0,  3,  5,  6, 11 }
-        }
+	{ { 14,  4, 13,  1,  2, 15, 11,  8,  3, 10,  6, 12,  5,  9,  0,  7 },
+	  {  0, 15,  7,  4, 14,  2, 13,  1, 10,  6, 12, 11,  9,  5,  3,  8 },
+	  {  4,  1, 14,  8, 13,  6,  2, 11, 15, 12,  9,  7,  3, 10,  5,  0 },
+	  { 15, 12,  8,  2,  4,  9,  1,  7,  5, 11,  3, 14, 10,  0,  6, 13 }
+	},
+
+	{ { 15,  1,  8, 14,  6, 11,  3,  4,  9,  7,  2, 13, 12,  0,  5, 10 },
+	  {  3, 13,  4,  7, 15,  2,  8, 14, 12,  0,  1, 10,  6,  9, 11,  5 },
+	  {  0, 14,  7, 11, 10,  4, 13,  1,  5,  8, 12,  6,  9,  3,  2, 15 },
+	  { 13,  8, 10,  1,  3, 15,  4,  2, 11,  6,  7, 12,  0,  5, 14,  9 }
+	},
+
+	{ { 10,  0,  9, 14,  6,  3, 15,  5,  1, 13, 12,  7, 11,  4,  2,  8 },
+	  { 13,  7,  0,  9,  3,  4,  6, 10,  2,  8,  5, 14, 12, 11, 15,  1 },
+	  { 13,  6,  4,  9,  8, 15,  3,  0, 11,  1,  2, 12,  5, 10, 14,  7 },
+	  {  1, 10, 13,  0,  6,  9,  8,  7,  4, 15, 14,  3, 11,  5,  2, 12 }
+	},
+
+	{ {  7, 13, 14,  3,  0,  6,  9, 10,  1,  2,  8,  5, 11, 12,  4, 15 },
+	  { 13,  8, 11,  5,  6, 15,  0,  3,  4,  7,  2, 12,  1, 10, 14,  9 },
+	  { 10,  6,  9,  0, 12, 11,  7, 13, 15,  1,  3, 14,  5,  2,  8,  4 },
+	  {  3, 15,  0,  6, 10,  1, 13,  8,  9,  4,  5, 11, 12,  7,  2, 14 }
+	},
+
+	{ {  2, 12,  4,  1,  7, 10, 11,  6,  8,  5,  3, 15, 13,  0, 14,  9 },
+	  { 14, 11,  2, 12,  4,  7, 13,  1,  5,  0, 15, 10,  3,  9,  8,  6 },
+	  {  4,  2,  1, 11, 10, 13,  7,  8, 15,  9, 12,  5,  6,  3,  0, 14 },
+	  { 11,  8, 12,  7,  1, 14,  2, 13,  6, 15,  0,  9, 10,  4,  5,  3 }
+	},
+
+	{ { 12,  1, 10, 15,  9,  2,  6,  8,  0, 13,  3,  4, 14,  7,  5, 11 },
+	  { 10, 15,  4,  2,  7, 12,  9,  5,  6,  1, 13, 14,  0, 11,  3,  8 },
+	  {  9, 14, 15,  5,  2,  8, 12,  3,  7,  0,  4, 10,  1, 13, 11,  6 },
+	  {  4,  3,  2, 12,  9,  5, 15, 10, 11, 14,  1,  7,  6,  0,  8, 13 }
+	},
+
+	{ {  4, 11,  2, 14, 15,  0,  8, 13,  3, 12,  9,  7,  5, 10,  6,  1 },
+	  { 13,  0, 11,  7,  4,  9,  1, 10, 14,  3,  5, 12,  2, 15,  8,  6 },
+	  {  1,  4, 11, 13, 12,  3,  7, 14, 10, 15,  6,  8,  0,  5,  9,  2 },
+	  {  6, 11, 13,  8,  1,  4, 10,  7,  9,  5,  0, 15, 14,  2,  3, 12 }
+	},
+
+	{ { 13,  2,  8,  4,  6, 15, 11,  1, 10,  9,  3, 14,  5,  0, 12,  7 },
+	  {  1, 15, 13,  8, 10,  3,  7,  4, 12,  5,  6, 11,  0, 14,  9,  2 },
+	  {  7, 11,  4,  1,  9, 12, 14,  2,  0,  6, 10, 13, 15,  3,  5,  8 },
+	  {  2,  1, 14,  7,  4, 10,  8, 13, 15, 12,  9,  0,  3,  5,  6, 11 }
+	}
 };
 
 /*
@@ -468,6 +468,7 @@ __init_des_r(__data)
 	  efp[comes_from_word][word_value][o_long] |= mask2;
       }
     }
+    atomic_write_barrier ();
     small_tables_initialized = 1;
 #ifdef __GNU_LIBRARY__
 small_tables_done:

From ed0874085976531bda8a05540b0816e8bf711b71 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 3 Apr 2010 17:56:51 -0700
Subject: [PATCH 54/76] Document problem with NATs in getaddrinfo.

---
 ChangeLog      | 4 ++++
 posix/gai.conf | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 27678bf649..dd6b608114 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-04-03  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11438]
+	* posix/gai.conf: Document problems with IPv4 site-local addresses and
+	NATs.
+
 	[BZ #11449]
 	* crypt/crypt_util.c (__init_des_r): Add memory barrier before setting
 	small_tables_initialized.
diff --git a/posix/gai.conf b/posix/gai.conf
index 3dba1a905d..195287e1c8 100644
--- a/posix/gai.conf
+++ b/posix/gai.conf
@@ -66,3 +66,12 @@
 #scopev4 ::ffff:172.16.0.0/108   5
 #scopev4 ::ffff:192.168.0.0/112  5
 #scopev4 ::ffff:0.0.0.0/96       14
+#
+#    For sites which use site-local IPv4 addresses behind NAT there is
+#    the problem that even if IPv4 addresses are preferred they do not
+#    have the same scope and are therefore not sorted first.  To change
+#    this use only these rules:
+#
+#scopev4 ::ffff:169.254.0.0/112  2
+#scopev4 ::ffff:127.0.0.0/104    2
+#scopev4 ::ffff:0.0.0.0/96       14

From 3ed8e241229e370cca96650ed727f09838c51d67 Mon Sep 17 00:00:00 2001
From: "Ryan S. Arnold" <rsa@us.ibm.com>
Date: Sat, 3 Apr 2010 19:20:29 -0700
Subject: [PATCH 55/76] Remove incorrect paring of /proc/stat etc.

---
 ChangeLog                             |  6 ++++++
 sysdeps/unix/sysv/linux/getsysstats.c | 14 +-------------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dd6b608114..6420b9df48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-25  Ryan S. Arnold  <rsa@us.ibm.com>
+
+	* sysdeps/unix/sysv/linux/getsysstats.c (next_line): Remove
+	redundant and incorrect else block which overwrites current line
+	with the partial next line.
+
 2010-04-03  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11438]
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 97e20d249b..af454b650d 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -1,5 +1,5 @@
 /* Determine various system internal values, Linux version.
-   Copyright (C) 1996-2003, 2006, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1996-2003,2006,2007,2009,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -117,18 +117,6 @@ next_line (int fd, char *const buffer, char **cp, char **re,
       if (nl == NULL)
 	nl = *re - 1;
     }
-  else if (nl + 5 >= *re)
-    {
-      memmove (buffer, nl, *re - nl);
-      *re = buffer + (*re - nl);
-      nl = *cp = buffer;
-
-      ssize_t n = read_not_cancel (fd, *re, buffer_end - *re);
-      if (n < 0)
-	return NULL;
-
-      *re += n;
-    }
 
   *cp = nl + 1;
   assert (*cp <= *re);

From b8b14c4cc38883032b8ebae50c9a8b3efd256483 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 3 Apr 2010 20:36:59 -0700
Subject: [PATCH 56/76] Fix changes to interface list during getifaddrs calls.

---
 ChangeLog                         | 10 ++++++
 sysdeps/unix/sysv/linux/ifaddrs.c | 55 ++++++++++++++++++++++++-------
 2 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6420b9df48..2b735fc980 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-04-03  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11387]
+	* sysdeps/unix/sysv/linux/ifaddrs.c (map_newlin): Don't abort on
+	unknown interface, return -1.
+	(getifaddrs_internal): Rename from getifaddrs.  Handle errors in
+	map_newlink be returning -EAGAIN.
+	(getifaddrs): If -EAGAIN is returned from getifaddrs_internal try
+	again.
+
 2010-03-25  Ryan S. Arnold  <rsa@us.ibm.com>
 
 	* sysdeps/unix/sysv/linux/getsysstats.c (next_line): Remove
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 149bd1c3ba..84f223ddbd 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -1,5 +1,5 @@
 /* getifaddrs -- get names and addresses of all network interfaces
-   Copyright (C) 2003-2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -315,17 +315,19 @@ map_newlink (int index, struct ifaddrs_storage *ifas, int *map, int max)
       else if (map[i] == index)
 	return i;
     }
-  /* This should never be reached. If this will be reached, we have
-     a very big problem.  */
-  abort ();
+
+  /* This means interfaces changed inbetween the reading of the
+     RTM_GETLINK and RTM_GETADDR information.  We have to repeat
+     everything.  */
+  return -1;
 }
 
 
 /* Create a linked list of `struct ifaddrs' structures, one for each
    network interface on the host machine.  If successful, store the
    list in *IFAP and return 0.  On errors, return -1 and set `errno'.  */
-int
-getifaddrs (struct ifaddrs **ifap)
+static int
+getifaddrs_internal (struct ifaddrs **ifap)
 {
   struct netlink_handle nh = { 0, 0, 0, NULL, NULL };
   struct netlink_res *nlp;
@@ -481,6 +483,13 @@ getifaddrs (struct ifaddrs **ifap)
 		 kernel.  */
 	      ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
 				       map_newlink_data, newlink);
+	      if (__builtin_expect (ifa_index == -1, 0))
+		{
+		try_again:
+		  result = -EAGAIN;
+		  free (ifas);
+		  goto exit_free;
+		}
 	      ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags;
 
 	      while (RTA_OK (rta, rtasize))
@@ -565,9 +574,11 @@ getifaddrs (struct ifaddrs **ifap)
 		 that we have holes in the interface part of the list,
 		 but we always have already the interface for this address.  */
 	      ifa_index = newlink + newaddr_idx;
-	      ifas[ifa_index].ifa.ifa_flags
-		= ifas[map_newlink (ifam->ifa_index - 1, ifas,
-				    map_newlink_data, newlink)].ifa.ifa_flags;
+	      int idx = map_newlink (ifam->ifa_index - 1, ifas,
+				     map_newlink_data, newlink);
+	      if (__builtin_expect (idx == -1, 0))
+		goto try_again;
+	      ifas[ifa_index].ifa.ifa_flags = ifas[idx].ifa.ifa_flags;
 	      if (ifa_index > 0)
 		ifas[ifa_index - 1].ifa.ifa_next = &ifas[ifa_index].ifa;
 	      ++newaddr_idx;
@@ -747,9 +758,13 @@ getifaddrs (struct ifaddrs **ifap)
 	      /* If we didn't get the interface name with the
 		 address, use the name from the interface entry.  */
 	      if (ifas[ifa_index].ifa.ifa_name == NULL)
-		ifas[ifa_index].ifa.ifa_name
-		  = ifas[map_newlink (ifam->ifa_index - 1, ifas,
-				      map_newlink_data, newlink)].ifa.ifa_name;
+		{
+		  int idx = map_newlink (ifam->ifa_index - 1, ifas,
+					 map_newlink_data, newlink);
+		  if (__builtin_expect (idx == -1, 0))
+		    goto try_again;
+		  ifas[ifa_index].ifa.ifa_name = ifas[idx].ifa.ifa_name;
+		}
 
 	      /* Calculate the netmask.  */
 	      if (ifas[ifa_index].ifa.ifa_addr
@@ -826,6 +841,22 @@ getifaddrs (struct ifaddrs **ifap)
 
   return result;
 }
+
+
+/* Create a linked list of `struct ifaddrs' structures, one for each
+   network interface on the host machine.  If successful, store the
+   list in *IFAP and return 0.  On errors, return -1 and set `errno'.  */
+int
+getifaddrs (struct ifaddrs **ifap)
+{
+  int res;
+
+  do
+    res = getifaddrs_internal (ifap);
+  while (res == -EAGAIN);
+
+  return res;
+}
 libc_hidden_def (getifaddrs)
 
 

From 3fedf0feb75457f7098a0119ca4203ff449546b6 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 3 Apr 2010 23:10:16 -0700
Subject: [PATCH 57/76] Add missing include.

---
 crypt/crypt_util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/crypt/crypt_util.c b/crypt/crypt_util.c
index a556389111..7999a30672 100644
--- a/crypt/crypt_util.c
+++ b/crypt/crypt_util.c
@@ -27,6 +27,7 @@
 #ifdef DEBUG
 #include <stdio.h>
 #endif
+#include <atomic.h>
 #include <string.h>
 
 #ifndef STATIC

From 1a81139728494810f65aaa0d0c538ff8c2783dd5 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 3 Apr 2010 23:51:40 -0700
Subject: [PATCH 58/76] Handle unnecessary padding in getdents64.

The getdents64 syscall adds on 32-but platforms padding which isn't needed
and not included in the userlevel data structure definition.  We have to
avoid copying those padding bytes in the readdir64_r function.
---
 ChangeLog                                  |  6 ++++++
 sysdeps/unix/readdir_r.c                   | 14 ++++++++++++--
 sysdeps/unix/sysv/linux/i386/readdir64_r.c |  3 ++-
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2b735fc980..91ae1056f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-04-03  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11333]
+	* sysdeps/unix/readdir_r.c (__READDIR_R): Add support for platforms
+	which include unnecessary padding in d_reclen.
+	* sysdeps/unix/sysv/linux/i386/readdir64_r.c: Select work-around for
+	unnecessary padding.
+
 	[BZ #11387]
 	* sysdeps/unix/sysv/linux/ifaddrs.c (map_newlin): Don't abort on
 	unknown interface, return -1.
diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c
index f84709e737..93727912c1 100644
--- a/sysdeps/unix/readdir_r.c
+++ b/sysdeps/unix/readdir_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,02
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,02,10
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -113,7 +113,17 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
   while (dp->d_ino == 0);
 
   if (dp != NULL)
-    *result = memcpy (entry, dp, reclen);
+    {
+#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));
+#endif
+      *result = memcpy (entry, dp, reclen);
+#ifdef GETDENTS_64BIT_ALIGNED
+      entry->d_reclen = reclen;
+#endif
+    }
   else
     *result = NULL;
 
diff --git a/sysdeps/unix/sysv/linux/i386/readdir64_r.c b/sysdeps/unix/sysv/linux/i386/readdir64_r.c
index c6da57b75e..f96f16a6f2 100644
--- a/sysdeps/unix/sysv/linux/i386/readdir64_r.c
+++ b/sysdeps/unix/sysv/linux/i386/readdir64_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2004, 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
@@ -19,6 +19,7 @@
 #define __READDIR_R __readdir64_r
 #define __GETDENTS __getdents64
 #define DIRENT_TYPE struct dirent64
+#define GETDENTS_64BIT_ALIGNED 1
 
 #include <sysdeps/unix/readdir_r.c>
 

From 22f4f44b6727887957aa1d4039eba290b064da63 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 4 Apr 2010 00:25:46 -0700
Subject: [PATCH 59/76] Fix concurrent handling of __cpu_features.

---
 ChangeLog                            | 12 ++++++++++
 sysdeps/x86_64/multiarch/init-arch.c | 33 ++++++++++++++++++----------
 sysdeps/x86_64/multiarch/init-arch.h |  4 ++--
 3 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 91ae1056f5..99aa68027c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-04-04  H.J. Lu  <hongjiu.lu@intel.com>
+	    Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11292]
+	* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): Allow
+	concurrent initialization and use of __cpu_features.
+
+2010-04-04  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/x86_64/multiarch/init-arch.h (cpu_features): Add tag to
+	the enum.
+
 2010-04-03  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11333]
diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c
index 50b2a38fbd..efb89b6c92 100644
--- a/sysdeps/x86_64/multiarch/init-arch.c
+++ b/sysdeps/x86_64/multiarch/init-arch.c
@@ -1,6 +1,6 @@
 /* Initialize CPU feature data.
    This file is part of the GNU C Library.
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@redhat.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <atomic.h>
 #include <cpuid.h>
 #include "init-arch.h"
 
@@ -26,7 +27,7 @@ struct cpu_features __cpu_features attribute_hidden;
 
 
 static void
-get_common_indeces (void)
+get_common_indeces (unsigned int *family, unsigned int *model)
 {
   __cpuid (1, __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax,
 	   __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ebx,
@@ -34,8 +35,8 @@ get_common_indeces (void)
 	   __cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx);
 
   unsigned int eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
-  __cpu_features.family = (eax >> 8) & 0x0f;
-  __cpu_features.model = (eax >> 4) & 0x0f;
+  *family = (eax >> 8) & 0x0f;
+  *model = (eax >> 4) & 0x0f;
 }
 
 
@@ -45,27 +46,30 @@ __init_cpu_features (void)
   unsigned int ebx;
   unsigned int ecx;
   unsigned int edx;
+  unsigned int family = 0;
+  unsigned int model = 0;
+  enum cpu_features_kind kind;
 
   __cpuid (0, __cpu_features.max_cpuid, ebx, ecx, edx);
 
   /* This spells out "GenuineIntel".  */
   if (ebx == 0x756e6547 && ecx == 0x6c65746e && edx == 0x49656e69)
     {
-      __cpu_features.kind = arch_kind_intel;
+      kind = arch_kind_intel;
 
-      get_common_indeces ();
+      get_common_indeces (&family, &model);
 
       unsigned int eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
       unsigned int extended_family = (eax >> 20) & 0xff;
       unsigned int extended_model = (eax >> 12) & 0xf0;
       if (__cpu_features.family == 0x0f)
 	{
-	  __cpu_features.family += extended_family;
-	  __cpu_features.model += extended_model;
+	  family += extended_family;
+	  model += extended_model;
 	}
       else if (__cpu_features.family == 0x06)
 	{
-	  __cpu_features.model += extended_model;
+	  model += extended_model;
 	  switch (__cpu_features.model)
 	    {
 	    case 0x1a:
@@ -85,12 +89,17 @@ __init_cpu_features (void)
   /* This spells out "AuthenticAMD".  */
   else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65)
     {
-      __cpu_features.kind = arch_kind_amd;
+      kind = arch_kind_amd;
 
-      get_common_indeces ();
+      get_common_indeces (&family, &model);
     }
   else
-    __cpu_features.kind = arch_kind_other;
+    kind = arch_kind_other;
+
+  __cpu_features.family = family;
+  __cpu_features.model = model;
+  atomic_write_barrier ();
+  __cpu_features.kind = kind;
 }
 
 #undef __get_cpu_features
diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h
index 69492cb3bf..5c73813404 100644
--- a/sysdeps/x86_64/multiarch/init-arch.h
+++ b/sysdeps/x86_64/multiarch/init-arch.h
@@ -1,5 +1,5 @@
 /* This file is part of the GNU C Library.
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -52,7 +52,7 @@ enum
 
 extern struct cpu_features
 {
-  enum
+  enum cpu_features_kind
     {
       arch_kind_unknown = 0,
       arch_kind_intel,

From 9e37946dba22b53c5108eef777e867f93c894502 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 4 Apr 2010 01:02:09 -0700
Subject: [PATCH 60/76] Fix retrieving of kernel header version.

---
 ChangeLog    |  6 ++++++
 csu/Makefile | 15 +++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 99aa68027c..7db74b326c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-04  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11287]
+	* csu/Makefile ($(objpfx)version-info.h): Handle newer kernel headers
+	which don't define UTS_RELEASE.
+
 2010-04-04  H.J. Lu  <hongjiu.lu@intel.com>
 	    Ulrich Drepper  <drepper@redhat.com>
 
diff --git a/csu/Makefile b/csu/Makefile
index 0e2ae07cf7..69e07c71cf 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -1,5 +1,5 @@
 # Makefile for csu code for GNU C library.
-# Copyright (C) 1995-2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004, 2005, 2006, 2010 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -209,8 +209,19 @@ $(objpfx)version-info.h: $(common-objpfx)config.make $(all-Banner-files)
 	   linux*) version=`(printf '%s\n%s\n' \
 				    '#include <linux/version.h>' \
 				    UTS_RELEASE \
-			     | $(CC) $(CPPFLAGS) -E -P - -DNOT_IN_libc=1 | \
+			     | $(CC) $(CPPFLAGS) -O -E -P - -DNOT_IN_libc=1 | \
 			     sed -e 's/"\([^"]*\)".*/\1/p' -e d) 2>/dev/null`;\
+		   if [ -z "$$version" ]; then \
+		     version=`(printf '%s\n%s\n' \
+				      '#include <linux/version.h>' \
+				       LINUX_VERSION_CODE \
+			       | $(CC) $(CPPFLAGS) -O -E -P - -DNOT_IN_libc=1 \
+			       | sed -n -e '/^[123456789].*/p' \
+			       | awk '{v=$$1; \
+				       printf("%d.%d.%d\n", \
+					      v/65535, v/256%256, v%256)}') \
+				2>/dev/null`; \
+		   fi; \
 		   if [ -z "$$version" ]; then \
 		     if [ -r /proc/version ]; then \
 		       version=`sed 's/.*Linux version \([^ ]*\) .*/>>\1<</' \

From 952df0afdca2333e9fae7d62a36077c348d2df93 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 4 Apr 2010 01:51:01 -0700
Subject: [PATCH 61/76] Fix definition and testing of S_ISSOCK.

---
 ChangeLog                    | 5 +++++
 conform/data/sys/stat.h-data | 5 ++---
 io/sys/stat.h                | 6 ++++--
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7db74b326c..a178be5de4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-04-04  Ulrich Drepper  <drepper@redhat.com>
 
+	* conform/data/sys/stat.h-data: Fix testing of S_IS* macros.
+
+	[BZ #11279]
+	* io/sys/stat.h: Always define S_ISSOCK for XPG6 and up.
+
 	[BZ #11287]
 	* csu/Makefile ($(objpfx)version-info.h): Handle newer kernel headers
 	which don't define UTS_RELEASE.
diff --git a/conform/data/sys/stat.h-data b/conform/data/sys/stat.h-data
index df39fd3d81..b0e10a4c7f 100644
--- a/conform/data/sys/stat.h-data
+++ b/conform/data/sys/stat.h-data
@@ -66,15 +66,14 @@ constant S_ISGID
 constant S_ISVTX
 #endif
 
-#if !defined POSIX && !defined POSIX2008
-macro S_IFMT
+#if !defined POSIX
 macro S_ISBLK
 macro S_ISCHR
 macro S_ISDIR
 macro S_ISFIFO
 macro S_ISREG
 macro S_ISLNK
-macro S_IFSOCK
+macro S_ISSOCK
 #endif
 
 // How to represent optional tests?
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 733a927888..ac740cad38 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995-2004, 2005, 2006, 2007, 2009
+/* Copyright (C) 1991, 1992, 1995-2004, 2005, 2006, 2007, 2009, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -143,9 +143,11 @@ __BEGIN_DECLS
 # define S_ISLNK(mode)  0
 #endif
 
-#if (defined __USE_BSD || defined __USE_UNIX98) \
+#if (defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K) \
     && defined __S_IFSOCK
 # define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK)
+#elif defined __USE_XOPEN2K
+# define S_ISSOCK(mode) 0
 #endif
 
 /* These are from POSIX.1b.  If the objects are not implemented using separate

From cb652f30b0aa17e65803962305e052e509a5316d Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 4 Apr 2010 02:08:37 -0700
Subject: [PATCH 62/76] Handle POSIX-compliant errno value of unlink in remove.

---
 ChangeLog                        |  6 ++++++
 sysdeps/posix/remove.c           | 10 ++++++++--
 sysdeps/unix/sysv/linux/remove.c |  2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/remove.c

diff --git a/ChangeLog b/ChangeLog
index a178be5de4..5cccc47274 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-04-04  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11276]
+	* sysdeps/posix/remove.c (IS_NO_DIRECTORY_ERROR): Define.
+	(remove): Use IS_NO_DIRECTORY_ERROR to check for file being no
+	directory.
+	* sysdeps/unix/sysv/linux/remove.c: New file.
+
 	* conform/data/sys/stat.h-data: Fix testing of S_IS* macros.
 
 	[BZ #11279]
diff --git a/sysdeps/posix/remove.c b/sysdeps/posix/remove.c
index c44af92d74..ae5bbdbdc9 100644
--- a/sysdeps/posix/remove.c
+++ b/sysdeps/posix/remove.c
@@ -1,5 +1,5 @@
 /* ANSI C `remove' function to delete a file or directory.  POSIX.1 version.
-   Copyright (C) 1995,96,97,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,2002,2003,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
@@ -21,6 +21,12 @@
 #include <stdio.h>
 #include <unistd.h>
 
+
+#ifndef IS_NO_DIRECTORY_ERROR
+# define IS_NO_DIRECTORY_ERROR errno != EPERM
+#endif
+
+
 int
 remove (file)
      const char *file;
@@ -28,7 +34,7 @@ remove (file)
   /* First try to unlink since this is more frequently the necessary action. */
   if (__unlink (file) != 0
       /* If it is indeed a directory...  */
-      && (errno != EISDIR
+      && (IS_NO_DIRECTORY_ERROR
 	  /* ...try to remove it.  */
 	  || __rmdir (file) != 0))
     /* Cannot remove the object for whatever reason.  */
diff --git a/sysdeps/unix/sysv/linux/remove.c b/sysdeps/unix/sysv/linux/remove.c
new file mode 100644
index 0000000000..4abf34a73d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/remove.c
@@ -0,0 +1,2 @@
+#define IS_NO_DIRECTORY_ERROR errno != EISDIR
+#include <sysdeps/posix/remove.c>

From 7e699e384212d48a55d10db8b845347da85a0cf4 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 4 Apr 2010 02:11:22 -0700
Subject: [PATCH 63/76] Fix weekday definition for fr_BE locale.

---
 localedata/ChangeLog     |  5 ++++
 localedata/locales/fr_BE | 54 +++++++++++++++++++++-------------------
 2 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index da271f94be..55f3c0a58e 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-04  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11272]
+	* locales/fr_BE: Define week, first_weekday, and first_workday.
+
 2010-03-24  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #10554]
diff --git a/localedata/locales/fr_BE b/localedata/locales/fr_BE
index 8a96d3c7ba..f9c911aba5 100644
--- a/localedata/locales/fr_BE
+++ b/localedata/locales/fr_BE
@@ -84,34 +84,34 @@ END LC_NUMERIC
 
 LC_TIME
 abday   "<U0064><U0069><U006D>";"<U006C><U0075><U006E>";/
-        "<U006D><U0061><U0072>";"<U006D><U0065><U0072>";/
-        "<U006A><U0065><U0075>";"<U0076><U0065><U006E>";/
-        "<U0073><U0061><U006D>"
+	"<U006D><U0061><U0072>";"<U006D><U0065><U0072>";/
+	"<U006A><U0065><U0075>";"<U0076><U0065><U006E>";/
+	"<U0073><U0061><U006D>"
 day     "<U0064><U0069><U006D><U0061><U006E><U0063><U0068><U0065>";/
-        "<U006C><U0075><U006E><U0064><U0069>";/
-        "<U006D><U0061><U0072><U0064><U0069>";/
-        "<U006D><U0065><U0072><U0063><U0072><U0065><U0064><U0069>";/
-        "<U006A><U0065><U0075><U0064><U0069>";/
-        "<U0076><U0065><U006E><U0064><U0072><U0065><U0064><U0069>";/
-        "<U0073><U0061><U006D><U0065><U0064><U0069>"
+	"<U006C><U0075><U006E><U0064><U0069>";/
+	"<U006D><U0061><U0072><U0064><U0069>";/
+	"<U006D><U0065><U0072><U0063><U0072><U0065><U0064><U0069>";/
+	"<U006A><U0065><U0075><U0064><U0069>";/
+	"<U0076><U0065><U006E><U0064><U0072><U0065><U0064><U0069>";/
+	"<U0073><U0061><U006D><U0065><U0064><U0069>"
 abmon   "<U006A><U0061><U006E>";"<U0066><U00E9><U0076>";/
-        "<U006D><U0061><U0072>";"<U0061><U0076><U0072>";/
-        "<U006D><U0061><U0069>";"<U006A><U0075><U006E>";/
-        "<U006A><U0075><U0069>";"<U0061><U006F><U00FB>";/
-        "<U0073><U0065><U0070>";"<U006F><U0063><U0074>";/
-        "<U006E><U006F><U0076>";"<U0064><U00E9><U0063>"
+	"<U006D><U0061><U0072>";"<U0061><U0076><U0072>";/
+	"<U006D><U0061><U0069>";"<U006A><U0075><U006E>";/
+	"<U006A><U0075><U0069>";"<U0061><U006F><U00FB>";/
+	"<U0073><U0065><U0070>";"<U006F><U0063><U0074>";/
+	"<U006E><U006F><U0076>";"<U0064><U00E9><U0063>"
 mon     "<U006A><U0061><U006E><U0076><U0069><U0065><U0072>";/
-        "<U0066><U00E9><U0076><U0072><U0069><U0065><U0072>";/
-        "<U006D><U0061><U0072><U0073>";/
-        "<U0061><U0076><U0072><U0069><U006C>";/
-        "<U006D><U0061><U0069>";/
-        "<U006A><U0075><U0069><U006E>";/
-        "<U006A><U0075><U0069><U006C><U006C><U0065><U0074>";/
-        "<U0061><U006F><U00FB><U0074>";/
-        "<U0073><U0065><U0070><U0074><U0065><U006D><U0062><U0072><U0065>";/
-        "<U006F><U0063><U0074><U006F><U0062><U0072><U0065>";/
-        "<U006E><U006F><U0076><U0065><U006D><U0062><U0072><U0065>";/
-        "<U0064><U00E9><U0063><U0065><U006D><U0062><U0072><U0065>"
+	"<U0066><U00E9><U0076><U0072><U0069><U0065><U0072>";/
+	"<U006D><U0061><U0072><U0073>";/
+	"<U0061><U0076><U0072><U0069><U006C>";/
+	"<U006D><U0061><U0069>";/
+	"<U006A><U0075><U0069><U006E>";/
+	"<U006A><U0075><U0069><U006C><U006C><U0065><U0074>";/
+	"<U0061><U006F><U00FB><U0074>";/
+	"<U0073><U0065><U0070><U0074><U0065><U006D><U0062><U0072><U0065>";/
+	"<U006F><U0063><U0074><U006F><U0062><U0072><U0065>";/
+	"<U006E><U006F><U0076><U0065><U006D><U0062><U0072><U0065>";/
+	"<U0064><U00E9><U0063><U0065><U006D><U0062><U0072><U0065>"
 d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
 d_fmt   "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
 t_fmt   "<U0025><U0054>"
@@ -120,6 +120,10 @@ t_fmt_ampm ""
 date_fmt       "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
+
+week    7;19971130;4
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 LC_PAPER

From 26f4163c6e6ca6543cb235960deaba09911d3d24 Mon Sep 17 00:00:00 2001
From: "Marcelo E. Magallon" <marcelo.magallon@gmail.com>
Date: Sun, 4 Apr 2010 02:14:37 -0700
Subject: [PATCH 64/76] Various changes to the es_CR locale.

---
 localedata/ChangeLog     |  6 +++++
 localedata/locales/es_CR | 48 +++++++++++++++++++++++++---------------
 2 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 55f3c0a58e..bbfae850f5 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-28  Marcelo E. Magallon  <marcelo.magallon@gmail.com>
+
+	[BZ #11258]
+	* locales/es_CR: Update for LC_MONETARY, LC_NUMERIC, LC_PAPER,
+	LC_TELEPHONE and LC_NAME and LC_ADDRESS.
+
 2010-04-04  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11272]
diff --git a/localedata/locales/es_CR b/localedata/locales/es_CR
index 038517973a..35a4b84ded 100644
--- a/localedata/locales/es_CR
+++ b/localedata/locales/es_CR
@@ -21,8 +21,8 @@ tel        ""
 fax        ""
 language   "Spanish"
 territory  "Costa Rica"
-revision   "1.0"
-date       "2000-08-21"
+revision   "1.1"
+date       "2009-12-23"
 %
 category  "es_CR:2000";LC_IDENTIFICATION
 category  "es_CR:2000";LC_CTYPE
@@ -53,9 +53,10 @@ END LC_MESSAGES
 
 LC_MONETARY
 int_curr_symbol      "<U0043><U0052><U0043><U0020>"
-currency_symbol      "<U0043>"
-mon_decimal_point    "<U002E>"
-mon_thousands_sep    "<U002C>"
+currency_symbol      "<U20A1>"
+% Decreto Ejecutivo 29660
+mon_decimal_point    "<U002C>"
+mon_thousands_sep    "<U0020>"
 mon_grouping         3;3
 positive_sign        ""
 negative_sign        "<U002D>"
@@ -70,9 +71,10 @@ n_sign_posn          1
 END LC_MONETARY
 
 LC_NUMERIC
-decimal_point        "<U002E>"
-thousands_sep        ""
-grouping             0;0
+% Decreto Ejecutivo 29660
+decimal_point        "<U002C>"
+thousands_sep        "<U0020>"
+grouping             3;3
 END LC_NUMERIC
 
 LC_TIME
@@ -106,39 +108,42 @@ mon     "<U0065><U006E><U0065><U0072><U006F>";/
         "<U006E><U006F><U0076><U0069><U0065><U006D><U0062><U0072><U0065>";/
         "<U0064><U0069><U0063><U0069><U0065><U006D><U0062><U0072><U0065>"
 d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
-d_fmt   "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
+d_fmt   "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"
 t_fmt   "<U0025><U0054>"
 am_pm   "<U0061><U002E><U006D><U002E>";"<U0070><U002E><U006D><U002E>"
 t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
-date_fmt	"<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
+date_fmt	"<U0025><U0061><U0020><U0025><U0065><U0020><U0025><U0062>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
-first_weekday 1
+first_weekday 2
 first_workday 2
 END LC_TIME
 
 LC_PAPER
-% FIXME
-height   297
-% FIXME
-width    210
+height   279
+width    216
 END LC_PAPER
 
 LC_TELEPHONE
-tel_int_fmt    "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
-<U006C>"
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020>/
+<U0025><U006C>"
+tel_dom_fmt "<U0025><U006C>"
 int_prefix     "<U0035><U0030><U0036>"
 int_select     "<U0030><U0030>"
 END LC_TELEPHONE
 
 LC_MEASUREMENT
-% FIXME
 measurement    1
 END LC_MEASUREMENT
 
 LC_NAME
 name_fmt    "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
 <U0025><U006D><U0025><U0074><U0025><U0066>"
+name_gen    "<U0053><U0072><U002E><U002F><U0053><U0072><U0061><U002E>"
+name_miss   "<U0053><U0072><U0074><U0061><U002E>"
+name_mr     "<U0053><U0072><U002E>"
+name_mrs    "<U0053><U0072><U0061><U002E>"
+name_ms     "<U0053><U0072><U0061><U002E>"
 END LC_NAME
 
 LC_ADDRESS
@@ -147,6 +152,13 @@ postal_fmt    "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
 <U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
 <U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
 <U004E><U0025><U0063><U0025><U004E>"
+country_name  "<U0043><U006F><U0073><U0074><U0061><U0020><U0052><U0069><U0063><U0061>"
+country_post  "<U0043><U0052>"
+country_car   "<U0043><U0052>"
+country_isbn  "9930,9977,9968"
+lang_name     "<U0045><U0073><U0070><U0061><U00F1><U006F><U006C>"
+lang_ab       "<0065><0073>"
+lang_term     "<U0073><U0070><U0061>"
 country_ab2   "<U0043><U0052>"
 country_ab3   "<U0043><U0052><U0049>"
 country_num   188

From 8c6de69d00c6be60657ca0d763dda803172c6aab Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org.ua>
Date: Sun, 4 Apr 2010 10:04:55 -0700
Subject: [PATCH 65/76] Fix option aliasing in argp.

---
 ChangeLog         |  6 ++++++
 argp/argp-parse.c | 12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5cccc47274..e8b494b1ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-05  Sergey Poznyakoff  <gray@gnu.org.ua>
+
+	[BZ #11254]
+	* argp/argp-parse.c (convert_options): Fix improper use of `|'
+	between character values.
+
 2010-04-04  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11276]
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 4718ced81d..604fcf0f3a 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing, layered over getopt
-   Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2002, 2003, 2004, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -99,7 +99,7 @@ static volatile int _argp_hang;
 
 static const struct argp_option argp_default_options[] =
 {
-  {"help",	  '?',    	0, 0,  N_("Give this help list"), -1},
+  {"help",	  '?',	  	0, 0,  N_("Give this help list"), -1},
   {"usage",	  OPT_USAGE,	0, 0,  N_("Give a short usage message")},
   {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")},
   {"HANG",	  OPT_HANG,    "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
@@ -164,7 +164,7 @@ static const struct argp argp_default_argp =
 
 static const struct argp_option argp_version_options[] =
 {
-  {"version",	  'V',    	0, 0,  N_("Print program version"), -1},
+  {"version",	  'V',	  	0, 0,  N_("Print program version"), -1},
   {0, 0}
 };
 
@@ -364,7 +364,7 @@ convert_options (const struct argp *argp,
 		       values (the sign of the lower bits is preserved
 		       however)...  */
 		    cvt->long_end->val =
-		      ((opt->key | real->key) & USER_MASK)
+		      ((opt->key ? opt->key : real->key) & USER_MASK)
 		      + (((group - cvt->parser->groups) + 1) << USER_BITS);
 
 		    /* Keep the LONG_OPTS list terminated.  */
@@ -385,7 +385,7 @@ convert_options (const struct argp *argp,
 
       if (children)
 	/* Assign GROUP's CHILD_INPUTS field some space from
-           CVT->child_inputs_end.*/
+	   CVT->child_inputs_end.*/
 	{
 	  unsigned num_children = 0;
 	  while (children[num_children].argp)
@@ -823,7 +823,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
 	  parser->try_getopt = 0;
 	  if (parser->state.next > 1
 	      && strcmp (parser->state.argv[parser->state.next - 1], QUOTE)
-	           == 0)
+		   == 0)
 	    /* Not only is this the end of the options, but it's a
 	       `quoted' region, which may have args that *look* like
 	       options, so we definitely shouldn't try to use getopt past

From 7ebaec64a0171a54dbe9aedd95497b130458060e Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 4 Apr 2010 11:28:36 -0700
Subject: [PATCH 66/76] Add test case for last argp bug.

---
 ChangeLog        |  5 +++++
 argp/Makefile    |  5 +++--
 argp/bug-argp2.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 2 deletions(-)
 create mode 100644 argp/bug-argp2.c

diff --git a/ChangeLog b/ChangeLog
index e8b494b1ff..69ba4dd9c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-04  Ulrich Drepper  <drepper@redhat.com>
+
+	* argp/Makefile: Add rules to build and run bug-argp2.
+	* argp/bug-argp2.c: New file.
+
 2010-02-05  Sergey Poznyakoff  <gray@gnu.org.ua>
 
 	[BZ #11254]
diff --git a/argp/Makefile b/argp/Makefile
index b8c9fca0fb..caa95dbb9f 100644
--- a/argp/Makefile
+++ b/argp/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1997,2002,2003,2006,2007,2010 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -26,12 +26,13 @@ distribute	= argp-fmtstream.h argp-namefrob.h
 routines	= $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
 				     pvh xinl eexst)
 
-tests		= argp-test tst-argp1 bug-argp1 tst-argp2
+tests		= argp-test tst-argp1 bug-argp1 tst-argp2 bug-argp2
 
 CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions
 CFLAGS-argp-parse.c = $(uses-callbacks)
 CFLAGS-argp-fmtstream.c = -fexceptions
 
 bug-argp1-ARGS = -- --help
+bug-argp2-ARGS = -- -d 111 --dstaddr 222 -p 333 --peer 444
 
 include ../Rules
diff --git a/argp/bug-argp2.c b/argp/bug-argp2.c
new file mode 100644
index 0000000000..133e5cf6e8
--- /dev/null
+++ b/argp/bug-argp2.c
@@ -0,0 +1,55 @@
+#include <argp.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static struct argp_option argp_options[] = {
+  { "dstaddr", 'd', "ADDR", 0,
+    "set destination (peer) address to ADDR" },
+  { "peer", 'p', "ADDR", OPTION_ALIAS },
+  { NULL }
+};
+
+static error_t parse_opt (int key, char *arg, struct argp_state *state);
+
+static struct argp argp =
+{
+  argp_options, parse_opt
+};
+
+static int cnt;
+
+static int
+do_test (int argc, char *argv[])
+{
+  int remaining;
+  argp_parse (&argp, argc, argv, 0, &remaining, NULL);
+  return cnt != 4;
+}
+
+static error_t
+parse_opt (int key, char *arg, struct argp_state *state)
+{
+  switch (key)
+  {
+  case 'd':
+  case 'p':
+    printf ("got '%c' with argument '%s'\n", key, arg);
+    ++cnt;
+    break;
+  case 0:
+  case ARGP_KEY_END:
+  case ARGP_KEY_NO_ARGS:
+  case ARGP_KEY_INIT:
+  case ARGP_KEY_SUCCESS:
+  case ARGP_KEY_FINI:
+    // Ignore.
+    return ARGP_ERR_UNKNOWN;
+  default:
+    printf ("invalid key '%x'\n", key);
+    exit (1);
+  }
+  return 0;
+}
+
+#define TEST_FUNCTION do_test (argc, argv)
+#include "../test-skeleton.c"

From 2cd9670885d32eed6f4de12ddbeb2a9d049f198e Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 4 Apr 2010 22:01:52 -0700
Subject: [PATCH 67/76] Declare iruserok and iruserok_af.

---
 ChangeLog      |  3 +++
 resolv/netdb.h | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 69ba4dd9c5..bd8e94fcd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-04-04  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11070]
+	* resolv/netdb.h: Declare iruserok and iruserok_af.
+
 	* argp/Makefile: Add rules to build and run bug-argp2.
 	* argp/bug-argp2.c: New file.
 
diff --git a/resolv/netdb.h b/resolv/netdb.h
index 7671c6aca5..e60dc4405b 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -518,6 +518,30 @@ extern int ruserok_af (__const char *__rhost, int __suser,
 		       __const char *__remuser, __const char *__locuser,
 		       sa_family_t __af);
 
+/* Check whether user REMUSER on system indicated by IPv4 address
+   RADDR is allowed to login as LOCUSER.  Non-IPv4 (e.g., IPv6) are
+   not supported.  If SUSER is not zero the user tries to become
+   superuser.  Return 0 if it is possible.
+
+   This function is not part of POSIX and therefore no official
+   cancellation point.  But due to similarity with an POSIX interface
+   or due to the implementation it is a cancellation point and
+   therefore not marked with __THROW.  */
+extern int iruserok (uint32_t __raddr, int __suser,
+		     __const char *__remuser, __const char *__locuser);
+
+/* This is the equivalent function where the pfamiliy if the address
+   pointed to by RADDR is determined by the value of AF.  It therefore
+   can be used for IPv6
+
+   This function is not part of POSIX and therefore no official
+   cancellation point.  But due to similarity with an POSIX interface
+   or due to the implementation it is a cancellation point and
+   therefore not marked with __THROW.  */
+extern int iruserok_af (__const void *__raddr, int __suser,
+			__const char *__remuser, __const char *__locuser,
+			sa_family_t __af);
+
 /* Try to allocate reserved port, returning a descriptor for a socket opened
    at this port or -1 if unsuccessful.  The search for an available port
    will start at ALPORT and continues with lower numbers.

From 247fdc8ee68cf49cd808becce56b2e923b4f776b Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 4 Apr 2010 22:48:55 -0700
Subject: [PATCH 68/76] Fix printing error messages in getopt.

---
 ChangeLog      |  4 ++++
 posix/getopt.c | 25 +++++++++++++------------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bd8e94fcd9..26b95e3382 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-04-04  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11043]
+	* posix/getopt.c (_getopt_internal_r): Fix arguments printed in error
+	messages.
+
 	[BZ #11070]
 	* resolv/netdb.h: Declare iruserok and iruserok_af.
 
diff --git a/posix/getopt.c b/posix/getopt.c
index a7f0b54857..88acff0e2f 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -2,7 +2,8 @@
    NOTE: getopt is part of the C library, so if you don't know what
    "Keep this file name-space clean" means, talk to drepper@gnu.org
    before changing it!
-   Copyright (C) 1987-1996,1998-2004,2008,2009 Free Software Foundation, Inc.
+   Copyright (C) 1987-1996,1998-2004,2008,2009,2010
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -679,8 +680,8 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 		      char *buf;
 
 		      if (__asprintf (&buf, _("\
-%s: option '%s' requires an argument\n"),
-				      argv[0], argv[d->optind - 1]) >= 0)
+%s: option '--%s' requires an argument\n"),
+				      argv[0], pfound->name) >= 0)
 			{
 			  _IO_flockfile (stderr);
 
@@ -697,8 +698,8 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 			}
 #else
 		      fprintf (stderr,
-			       _("%s: option '%s' requires an argument\n"),
-			       argv[0], argv[d->optind - 1]);
+			       _("%s: option '--%s' requires an argument\n"),
+			       argv[0], pfound->name);
 #endif
 		    }
 		  d->__nextchar += strlen (d->__nextchar);
@@ -922,7 +923,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 		char *buf;
 
 		if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"),
-				argv[0], argv[d->optind]) >= 0)
+				argv[0], d->optarg) >= 0)
 		  {
 		    _IO_flockfile (stderr);
 
@@ -938,7 +939,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 		  }
 #else
 		fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"),
-			 argv[0], argv[d->optind]);
+			 argv[0], d->optarg);
 #endif
 	      }
 	    d->__nextchar += strlen (d->__nextchar);
@@ -1001,8 +1002,8 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 			char *buf;
 
 			if (__asprintf (&buf, _("\
-%s: option '%s' requires an argument\n"),
-					argv[0], argv[d->optind - 1]) >= 0)
+%s: option '-W %s' requires an argument\n"),
+					argv[0], pfound->name) >= 0)
 			  {
 			    _IO_flockfile (stderr);
 
@@ -1018,9 +1019,9 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
 			    free (buf);
 			  }
 #else
-			fprintf (stderr,
-				 _("%s: option '%s' requires an argument\n"),
-				 argv[0], argv[d->optind - 1]);
+			fprintf (stderr, _("\
+%s: option '-W %s' requires an argument\n"),
+				 argv[0], pfound->name);
 #endif
 		      }
 		    d->__nextchar += strlen (d->__nextchar);

From 4bc2bcba67e870778fb9397f29435ee1b66bebf3 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Mon, 5 Apr 2010 11:26:43 -0700
Subject: [PATCH 69/76] Fix aux cache handling in ldconfig with chroot.

---
 ChangeLog      |  6 ++++++
 elf/ldconfig.c | 21 ++++++++++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 26b95e3382..866ec65f97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-05  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11149]
+	* elf/ldconfig.c (main): Respect chroot setting when looking for
+	the aux cache.
+
 2010-04-04  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11043]
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index efa67253f5..b9f1cc2d1b 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1305,11 +1305,9 @@ main (int argc, char **argv)
 				  p ? (*p = '\0', cache_file) : "/");
 
       if (canon == NULL)
-	{
-	  error (EXIT_FAILURE, errno,
-		 _("Can't open cache file directory %s\n"),
-		 p ? cache_file : "/");
-	}
+	error (EXIT_FAILURE, errno,
+	       _("Can't open cache file directory %s\n"),
+	       p ? cache_file : "/");
 
       if (p)
 	++p;
@@ -1346,8 +1344,17 @@ main (int argc, char **argv)
 	add_system_dir (LIBDIR);
     }
 
+  char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE;
+  if (opt_chroot)
+    {
+      aux_cache_file = chroot_canon (opt_chroot, aux_cache_file);
+      if (aux_cache_file == NULL)
+	error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"),
+	       _PATH_LDCONFIG_AUX_CACHE);
+    }
+
   if (! opt_ignore_aux_cache)
-    load_aux_cache (_PATH_LDCONFIG_AUX_CACHE);
+    load_aux_cache (aux_cache_file);
   else
     init_aux_cache ();
 
@@ -1356,7 +1363,7 @@ main (int argc, char **argv)
   if (opt_build_cache)
     {
       save_cache (cache_file);
-      save_aux_cache (_PATH_LDCONFIG_AUX_CACHE);
+      save_aux_cache (aux_cache_file);
     }
 
   return 0;

From 4535680d03d15dc9ce19d97b9d242a10941d5016 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Mon, 5 Apr 2010 12:21:20 -0700
Subject: [PATCH 70/76] Handle DNS timeouts in old-style lookkup code.

---
 ChangeLog                 |  4 ++++
 resolv/nss_dns/dns-host.c | 18 ++++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 866ec65f97..cecad61d0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-04-05  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11010]
+	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname3_r): Handle
+	timeouts from servers.
+
 	[BZ #11149]
 	* elf/ldconfig.c (main): Respect chroot setting when looking for
 	the aux cache.
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 818a40a898..e0c4978c3b 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004, 2007-2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -198,21 +198,27 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
 			  1024, &host_buffer.ptr, NULL, NULL, NULL);
   if (n < 0)
     {
-      if (errno == ESRCH)
+      switch (errno)
 	{
+	case ESRCH:
 	  status = NSS_STATUS_TRYAGAIN;
 	  h_errno = TRY_AGAIN;
+	  break;
+	case ECONNREFUSED:
+	case ETIMEDOUT:
+	  status = NSS_STATUS_UNAVAIL;
+	  break;
+	default:
+	  status = NSS_STATUS_NOTFOUND;
+	  break;
 	}
-      else
-	status = (errno == ECONNREFUSED
-		  ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND);
       *h_errnop = h_errno;
       if (h_errno == TRY_AGAIN)
 	*errnop = EAGAIN;
       else
 	__set_errno (olderr);
 
-      /* If we are looking for a IPv6 address and mapping is enabled
+      /* If we are looking for an IPv6 address and mapping is enabled
 	 by having the RES_USE_INET6 bit in _res.options set, we try
 	 another lookup.  */
       if (af == AF_INET6 && (_res.options & RES_USE_INET6))

From eb5e4d230567ef650bde32672cb86361c6deda18 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Mon, 5 Apr 2010 12:35:48 -0700
Subject: [PATCH 71/76] Define thousands separator handling for numbers in
 pt_BR.

---
 localedata/ChangeLog     |  5 ++++
 localedata/locales/pt_BR | 55 ++++++++++++++++++++--------------------
 2 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index bbfae850f5..16e2898ce9 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-05  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11007]
+	* locales/pt_BR: Define thousands_sep and grouping.
+
 2010-01-28  Marcelo E. Magallon  <marcelo.magallon@gmail.com>
 
 	[BZ #11258]
diff --git a/localedata/locales/pt_BR b/localedata/locales/pt_BR
index 8dbc14ea64..22f61317d7 100644
--- a/localedata/locales/pt_BR
+++ b/localedata/locales/pt_BR
@@ -14,7 +14,6 @@ escape_char  /
 % Revision: 4.4
 % Date: 1997-03-19
 % Users: general
-% Repertoiremap: mnemonic.ds
 % Charset: ISO-8859-1
 % Distribution and use is free, also
 % for commercial purposes.
@@ -79,40 +78,40 @@ END LC_CTYPE
 
 LC_NUMERIC
 decimal_point             "<U002C>"
-thousands_sep             ""
-grouping                  0;0
+thousands_sep             "<U002E>"
+grouping                  3;3
 END LC_NUMERIC
 
 LC_TIME
 abday   "<U0044><U006F><U006D>";"<U0053><U0065><U0067>";/
-        "<U0054><U0065><U0072>";"<U0051><U0075><U0061>";/
-        "<U0051><U0075><U0069>";"<U0053><U0065><U0078>";/
-        "<U0053><U00E1><U0062>"
+	"<U0054><U0065><U0072>";"<U0051><U0075><U0061>";/
+	"<U0051><U0075><U0069>";"<U0053><U0065><U0078>";/
+	"<U0053><U00E1><U0062>"
 day     "<U0064><U006F><U006D><U0069><U006E><U0067><U006F>";/
-        "<U0073><U0065><U0067><U0075><U006E><U0064><U0061>";/
-        "<U0074><U0065><U0072><U00E7><U0061>";/
-        "<U0071><U0075><U0061><U0072><U0074><U0061>";/
-        "<U0071><U0075><U0069><U006E><U0074><U0061>";/
-        "<U0073><U0065><U0078><U0074><U0061>";/
-        "<U0073><U00E1><U0062><U0061><U0064><U006F>"
+	"<U0073><U0065><U0067><U0075><U006E><U0064><U0061>";/
+	"<U0074><U0065><U0072><U00E7><U0061>";/
+	"<U0071><U0075><U0061><U0072><U0074><U0061>";/
+	"<U0071><U0075><U0069><U006E><U0074><U0061>";/
+	"<U0073><U0065><U0078><U0074><U0061>";/
+	"<U0073><U00E1><U0062><U0061><U0064><U006F>"
 abmon   "<U004A><U0061><U006E>";"<U0046><U0065><U0076>";/
-        "<U004D><U0061><U0072>";"<U0041><U0062><U0072>";/
-        "<U004D><U0061><U0069>";"<U004A><U0075><U006E>";/
-        "<U004A><U0075><U006C>";"<U0041><U0067><U006F>";/
-        "<U0053><U0065><U0074>";"<U004F><U0075><U0074>";/
-        "<U004E><U006F><U0076>";"<U0044><U0065><U007A>"
+	"<U004D><U0061><U0072>";"<U0041><U0062><U0072>";/
+	"<U004D><U0061><U0069>";"<U004A><U0075><U006E>";/
+	"<U004A><U0075><U006C>";"<U0041><U0067><U006F>";/
+	"<U0053><U0065><U0074>";"<U004F><U0075><U0074>";/
+	"<U004E><U006F><U0076>";"<U0044><U0065><U007A>"
 mon     "<U006A><U0061><U006E><U0065><U0069><U0072><U006F>";/
-        "<U0066><U0065><U0076><U0065><U0072><U0065><U0069><U0072><U006F>";/
-        "<U006D><U0061><U0072><U00E7><U006F>";/
-        "<U0061><U0062><U0072><U0069><U006C>";/
-        "<U006D><U0061><U0069><U006F>";/
-        "<U006A><U0075><U006E><U0068><U006F>";/
-        "<U006A><U0075><U006C><U0068><U006F>";/
-        "<U0061><U0067><U006F><U0073><U0074><U006F>";/
-        "<U0073><U0065><U0074><U0065><U006D><U0062><U0072><U006F>";/
-        "<U006F><U0075><U0074><U0075><U0062><U0072><U006F>";/
-        "<U006E><U006F><U0076><U0065><U006D><U0062><U0072><U006F>";/
-        "<U0064><U0065><U007A><U0065><U006D><U0062><U0072><U006F>"
+	"<U0066><U0065><U0076><U0065><U0072><U0065><U0069><U0072><U006F>";/
+	"<U006D><U0061><U0072><U00E7><U006F>";/
+	"<U0061><U0062><U0072><U0069><U006C>";/
+	"<U006D><U0061><U0069><U006F>";/
+	"<U006A><U0075><U006E><U0068><U006F>";/
+	"<U006A><U0075><U006C><U0068><U006F>";/
+	"<U0061><U0067><U006F><U0073><U0074><U006F>";/
+	"<U0073><U0065><U0074><U0065><U006D><U0062><U0072><U006F>";/
+	"<U006F><U0075><U0074><U0075><U0062><U0072><U006F>";/
+	"<U006E><U006F><U0076><U0065><U006D><U0062><U0072><U006F>";/
+	"<U0064><U0065><U007A><U0065><U006D><U0062><U0072><U006F>"
 d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
 d_fmt   "<U0025><U0064><U002D><U0025><U006D><U002D><U0025><U0059>"
 t_fmt   "<U0025><U0054>"

From e5c42595d0115c53ced9bb45ccd91b6ca9b7c701 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Mon, 5 Apr 2010 13:10:56 -0700
Subject: [PATCH 72/76] Update dutch translation.

---
 ChangeLog |   2 +
 po/nl.po  | 264 +++++++++++++++++++++---------------------------------
 2 files changed, 106 insertions(+), 160 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cecad61d0c..ef6c9def3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2010-04-05  Ulrich Drepper  <drepper@redhat.com>
 
+	* po/nl.po: Update from translation team.
+
 	[BZ #11010]
 	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname3_r): Handle
 	timeouts from servers.
diff --git a/po/nl.po b/po/nl.po
index 8ce51eb045..6c60a2362b 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -1,31 +1,33 @@
 # Dutch translations for libc.
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2010 Free Software Foundation, Inc.
 # This file is distributed under the same license as the glibc package.
 #
 # Elros Cyriatan <cyriatan@fastmail.fm>, 2004.
-# Benno Schulenberg <benno@vertaalt.nl>, 2006, 2007, 2008.
+# Erwin Poeze <erwin.poeze@gmail.com>, 2009.
+# Benno Schulenberg <benno@vertaalt.nl>, 2006, 2007, 2008, 2010.
 msgid ""
 msgstr ""
-"Project-Id-Version: libc-2.9.90\n"
+"Project-Id-Version: libc-2.11\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2009-02-06 12:40-0800\n"
-"PO-Revision-Date: 2009-03-04 11:41+0100\n"
-"Last-Translator: Erwin Poeze <erwin.poeze@gmail.com>\n"
+"PO-Revision-Date: 2010-04-05 16:30+0200\n"
+"Last-Translator: Benno Schulenberg <benno@vertaalt.nl>\n"
 "Language-Team: Dutch <vertaling@vrijschrift.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Lokalize 1.0\n"
 
 #: argp/argp-help.c:228
 #, c-format
 msgid "%.*s: ARGP_HELP_FMT parameter requires a value"
-msgstr "%.*s: parameter in ARGP_HELP_FMT vereist een waarde"
+msgstr "%.*s: Parameter in ARGP_HELP_FMT vereist een waarde"
 
 #: argp/argp-help.c:238
 #, c-format
 msgid "%.*s: Unknown ARGP_HELP_FMT parameter"
-msgstr "%.*s: onbekende parameter in ARGP_HELP_FMT"
+msgstr "%.*s: Onbekende parameter in ARGP_HELP_FMT"
 
 #: argp/argp-help.c:251
 #, c-format
@@ -80,7 +82,7 @@ msgstr "dit aantal seconden pauzeren (standaard 3600)"
 
 #: argp/argp-parse.c:167
 msgid "Print program version"
-msgstr "programmaversie tonen"
+msgstr "de programmaversie tonen"
 
 #: argp/argp-parse.c:183
 msgid "(PROGRAM ERROR) No version known!?"
@@ -328,9 +330,7 @@ msgstr ""
 "\n"
 "  -?,--help          deze hulptekst tonen\n"
 "     --usage         een korte gebruikssamenvatting tonen\n"
-"  -V,--version       programmaversie tonen\n"
-"\n"
-"Argumenten die verplicht zijn voor lange opties, zijn ook verplicht voor de overeenkomstige korte opties.\n"
+"  -V,--version       de programmaversie tonen\n"
 "\n"
 
 #: debug/xtrace.sh:127
@@ -703,7 +703,7 @@ msgstr "inhoud van de cache weergeven"
 
 #: elf/ldconfig.c:142
 msgid "Generate verbose messages"
-msgstr "breedsprakige uitvoer"
+msgstr "gedetailleerde uitvoer produceren"
 
 #: elf/ldconfig.c:143
 msgid "Don't build cache"
@@ -934,12 +934,15 @@ msgid ""
 "  -v, --verbose           print all information\n"
 msgstr ""
 "Gebruik:  ldd [OPTIE]... BESTAND...\n"
+"\n"
+"Bibliotheekafhankelijkheden weergeven.\n"
+"\n"
 "      --help              deze hulptekst tonen\n"
-"      --version           programmaversie tonen\n"
+"      --version           de programmaversie tonen\n"
 "  -d, --data-relocs       dataverplaatsingen verwerken\n"
 "  -r, --function-relocs   data- en functieverplaatsingen verwerken\n"
 "  -u, --unused            ongebruikte directe afhankelijkheden tonen\n"
-"  -v, --verbose           breedsprakige uitvoer\n"
+"  -v, --verbose           gedetailleerde uitvoer produceren\n"
 
 #: elf/ldd.bash.in:82
 msgid "ldd: option \\`$1' is ambiguous"
@@ -1045,7 +1048,7 @@ msgid ""
 "Usage: sln src dest|file\n"
 "\n"
 msgstr ""
-"Gebruik: sln src dest|bestand\n"
+"Gebruik:  sln BRON BESTEMMING|BESTAND\n"
 "\n"
 
 #: elf/sln.c:110
@@ -1066,7 +1069,7 @@ msgstr "%s: bestemming kan geen map zijn\n"
 #: elf/sln.c:185
 #, c-format
 msgid "%s: failed to remove the old destination\n"
-msgstr "%s: de oude bestemming verwijderen is mislukt\n"
+msgstr "%s: verwijderen van oude bestemming is mislukt\n"
 
 #: elf/sln.c:193
 #, c-format
@@ -1096,7 +1099,7 @@ msgstr "een aanroepengrafiek genereren"
 
 #: elf/sprof.c:89
 msgid "Read and display shared object profiling data."
-msgstr "Profielgegevens gedeeld object lezen en weergeven."
+msgstr "Profiling-gegevens van gedeeld object lezen en tonen."
 
 #: elf/sprof.c:94
 msgid "SHOBJ [PROFDATA]"
@@ -1111,7 +1114,7 @@ msgstr "laden van gedeeld object '%s' is mislukt"
 #: elf/sprof.c:429
 #, c-format
 msgid "cannot create internal descriptors"
-msgstr "kan interne descriptor niet aanmaken"
+msgstr "kan geen interne descriptors aanmaken"
 
 #: elf/sprof.c:548
 #, c-format
@@ -1756,7 +1759,7 @@ msgstr "'%.*s' is al gedefinieerd in tekensetdefinitie"
 #: locale/programs/ld-collate.c:426
 #, c-format
 msgid "`%.*s' already defined in repertoire"
-msgstr "`%.*s' is al gedefinieerd in repertoire"
+msgstr "'%.*s' is al gedefinieerd in repertoire"
 
 #: locale/programs/ld-collate.c:433
 #, c-format
@@ -2118,6 +2121,9 @@ msgstr "eindwaarde is kleiner dan beginwaarde"
 msgid "premature end of `translit_ignore' definition"
 msgstr "voortijdig einde van definitie van 'translit_ignore'"
 
+#
+# This error message is issued when yacc finds an error at parse time.
+#
 #: locale/programs/ld-ctype.c:2076 locale/programs/ld-ctype.c:2127
 #: locale/programs/ld-ctype.c:2169
 msgid "syntax error"
@@ -2437,11 +2443,11 @@ msgstr "namen van de geselecteerde sleutelwoorden tonen"
 
 #: locale/programs/locale.c:82
 msgid "Print more information"
-msgstr "uitgebreide uitvoer produceren"
+msgstr "gedetailleerde uitvoer produceren"
 
 #: locale/programs/locale.c:87
 msgid "Get locale-specific information."
-msgstr "Informatie over taalregio ophalen."
+msgstr "Informatie over taalregios tonen."
 
 #: locale/programs/locale.c:90
 msgid ""
@@ -2514,7 +2520,7 @@ msgstr "waarschuwingen en meldingen onderdrukken"
 
 #: locale/programs/localedef.c:135
 msgid "Print more messages"
-msgstr "breedsprakige uitvoer"
+msgstr "gedetailleerde uitvoer produceren"
 
 #: locale/programs/localedef.c:136
 msgid "Archive control:"
@@ -2759,7 +2765,7 @@ msgstr "kan uitvoerbestand '%s' niet aanmaken voor categorie '%s'"
 
 #: locale/programs/locfile.c:782
 msgid "expecting string argument for `copy'"
-msgstr "argument van `copy' dient een tekenreeks te zijn"
+msgstr "argument van 'copy' dient een tekenreeks te zijn"
 
 #: locale/programs/locfile.c:786
 msgid "locale name should consist only of portable characters"
@@ -2884,6 +2890,7 @@ msgid ""
 "\n"
 msgstr ""
 "Gebruik:  memusage [OPTIE]... PROGRAMMA [PROGRAMMA-OPTIE]...\n"
+"\n"
 "Het geheugengebruik van PROGRAMMA bijhouden.\n"
 "\n"
 "  -n,--progname=NAAM     te observeren programma\n"
@@ -2896,7 +2903,7 @@ msgstr ""
 "\n"
 "  -?,--help              deze hulptekst tonen\n"
 "     --usage             een korte gebruikssamenvatting tonen\n"
-"  -V,--version           programmaversie tonen\n"
+"  -V,--version           de programmaversie tonen\n"
 "\n"
 " De volgende opties zijn alleen bij grafische uitvoer van toepassing:\n"
 "  -t,--time-based        de grafiek lineair in de tijd maken\n"
@@ -3647,7 +3654,7 @@ msgstr "ongeldig persistent gegevensbestand '%s': %s"
 
 #: nscd/connections.c:578
 msgid "uninitialized header"
-msgstr "niet-geïnitialiseerde header"
+msgstr "ongeïnitialiseerde header"
 
 #: nscd/connections.c:583
 msgid "header size does not match"
@@ -3674,12 +3681,14 @@ msgstr "kan geen alleen-lezen-descriptor voor '%s' aanmaken; geen mmap()"
 #: nscd/connections.c:651
 #, c-format
 msgid "cannot access '%s'"
-msgstr "kan '%s' niet openen"
+msgstr "kan geen toegang tot '%s' verkrijgen"
 
 #: nscd/connections.c:699
 #, c-format
 msgid "database for %s corrupted or simultaneously used; remove %s manually if necessary and restart"
-msgstr "gegevensbestand voor %s is beschadigd of wordt al gebruikt; verwijder %s zo nodig handmatig en herstart"
+msgstr ""
+"gegevensbestand voor %s is beschadigd of wordt al gebruikt;\n"
+"verwijder %s zo nodig handmatig en herstart"
 
 #: nscd/connections.c:706
 #, c-format
@@ -3818,7 +3827,7 @@ msgstr "handle_request(): verzoek ontvangen (versie = %d)"
 #: nscd/connections.c:1903 nscd/connections.c:2101
 #, c-format
 msgid "disabled inotify after read error %d"
-msgstr "inotify uitgeschakeld na leesfout %d"
+msgstr "'inotify' is  uitgeschakeld na leesfout %d"
 
 #: nscd/connections.c:2230
 msgid "could not initialize conditional variable"
@@ -3826,11 +3835,11 @@ msgstr "kan conditionele variabele niet initialiseren"
 
 #: nscd/connections.c:2238
 msgid "could not start clean-up thread; terminating"
-msgstr "kan opschoon-thread niet starten; gestopt"
+msgstr "kan opschoon-thread niet starten -- gestopt"
 
 #: nscd/connections.c:2252
 msgid "could not start any worker thread; terminating"
-msgstr "kan geen worker-thread starten; gestopt"
+msgstr "kan geen enkele werk-thread starten -- gestopt"
 
 #: nscd/connections.c:2303 nscd/connections.c:2304 nscd/connections.c:2321
 #: nscd/connections.c:2330 nscd/connections.c:2348 nscd/connections.c:2359
@@ -3878,7 +3887,7 @@ msgstr "Ongeldig numeriek GID '%s'!"
 #: nscd/mem.c:457
 #, c-format
 msgid "freed %zu bytes in %s cache"
-msgstr "%zu bytes in cache %s vrijgegeven"
+msgstr "%zu bytes in cache %s zijn vrijgegeven"
 
 #: nscd/mem.c:594
 #, c-format
@@ -3968,7 +3977,7 @@ msgstr "Alleen root mag deze optie gebruiken!"
 #: nscd/nscd.c:345
 #, c-format
 msgid "'%s' is not a known database"
-msgstr "'%s' is geen bekende database"
+msgstr "'%s' is geen bekende gegevensbank"
 
 #: nscd/nscd.c:370 nscd/nscd_stat.c:191
 #, c-format
@@ -4248,7 +4257,7 @@ msgstr "Kan uit de context geen SID verkrijgen"
 
 #: nscd/selinux.c:374
 msgid "compile-time support for database policy missing"
-msgstr "ondersteuning compileertijd voor databasebeleid ontbreekt"
+msgstr "ondersteuning voor gegevensbankbeleid is niet meegecompileerd"
 
 #: nscd/selinux.c:407
 #, c-format
@@ -4297,7 +4306,7 @@ msgstr "te gebruiken configuratie"
 
 #: nss/getent.c:62
 msgid "Get entries from administrative database."
-msgstr "Haal items uit administratieve database."
+msgstr "Items uit administratieve gegevensbank ophalen."
 
 #: nss/getent.c:143 nss/getent.c:408
 #, c-format
@@ -4398,12 +4407,12 @@ msgid ""
 "environment SPEC.\n"
 "\n"
 msgstr ""
-"Gebruik: getconf [-v SPEC] VAR\n"
-"  of:    getconf [-v SPEC] PAD_VAR PAD\n"
+"Gebruik:  getconf [-v SPEC] VAR\n"
+"     of:  getconf [-v SPEC] PADVAR PAD\n"
 "\n"
-"De configuratiewaarde voor variabele VAR ophalen, of variabele PAD_VAR\n"
-"voor pad PAD. Als SPEC opgegeven wordt, gelden de waarden voor de\n"
-"compilatieomgeving.\n"
+"De configuratiewaarde van variabele VAR tonen, of van variabele PADVAR\n"
+"voor pad PAD.  Als SPEC gegeven is, de waarden uit compilatieomgeving\n"
+"SPEC weergeven.\n"
 "\n"
 
 #: posix/getconf.c:1081
@@ -4459,7 +4468,7 @@ msgstr "%s: onbekende optie '%c%s'\n"
 #: posix/getopt.c:800 posix/getopt.c:803
 #, c-format
 msgid "%s: invalid option -- '%c'\n"
-msgstr "%s: ongeldige optie -- %c\n"
+msgstr "%s: ongeldige optie -- '%c'\n"
 
 #: posix/getopt.c:853 posix/getopt.c:870 posix/getopt.c:1073
 #: posix/getopt.c:1091
@@ -4485,6 +4494,7 @@ msgstr "Geen overeenkomsten"
 msgid "Invalid regular expression"
 msgstr "Ongeldige reguliere expressie"
 
+# Zie http://mailman.vrijschrift.org/pipermail/vertaling/2005-August/004670.html
 #: posix/regcomp.c:142
 msgid "Invalid collation character"
 msgstr "Ongeldig samengesteld teken"
@@ -4919,122 +4929,122 @@ msgstr "          %s [-n netid]* [-o uitvoerbestand] [invoerbestand]\n"
 #: sunrpc/rpc_main.c:1469
 #, c-format
 msgid "options:\n"
-msgstr "opties:\n"
+msgstr "Opties:\n"
 
 #: sunrpc/rpc_main.c:1470
 #, c-format
 msgid "-a\t\tgenerate all files, including samples\n"
-msgstr "-a\t\talle bestanden genereren, inclusief voorbeelden\n"
+msgstr "-a               alle bestanden genereren, inclusief voorbeelden\n"
 
 #: sunrpc/rpc_main.c:1471
 #, c-format
 msgid "-b\t\tbackward compatibility mode (generates code for SunOS 4.1)\n"
-msgstr "-b\t\tterugwaardse compatibiliteitsmodus (maakt code voor SunOS 4.1 aan)\n"
+msgstr "-b               terugwaartse compatibiliteitsmodus (genereert SunOS 4.1-code)\n"
 
 #: sunrpc/rpc_main.c:1472
 #, c-format
 msgid "-c\t\tgenerate XDR routines\n"
-msgstr "-c\t\tXDR-routines genereren\n"
+msgstr "-c               XDR-routines genereren\n"
 
 #: sunrpc/rpc_main.c:1473
 #, c-format
 msgid "-C\t\tANSI C mode\n"
-msgstr "-C\t\tANSI C-modus\n"
+msgstr "-C               ANSI C-modus\n"
 
 #: sunrpc/rpc_main.c:1474
 #, c-format
 msgid "-Dname[=value]\tdefine a symbol (same as #define)\n"
-msgstr "-Dname[=waarde]\tdefineert een symbool (gelijk aan #define)\n"
+msgstr "-Dname[=WAARDE]  een symbool definiëren (hetzelfde als #define)\n"
 
 #: sunrpc/rpc_main.c:1475
 #, c-format
 msgid "-h\t\tgenerate header file\n"
-msgstr "-h\t\tgenereert headerbestand\n"
+msgstr "-h               headerbestand genereren\n"
 
 #: sunrpc/rpc_main.c:1476
 #, c-format
 msgid "-i size\t\tsize at which to start generating inline code\n"
-msgstr "-i grootte\t\tbij overschrijden grootte wordt inline-code aangemaakt\n"
+msgstr "-i GROOTTE       na overschrijden van GROOTTE wordt inline-code gegenereerd\n"
 
 #: sunrpc/rpc_main.c:1477
 #, c-format
 msgid "-I\t\tgenerate code for inetd support in server (for SunOS 4.1)\n"
-msgstr "-I\t\tgenereert code voor inetd-ondersteuning in server (voor SunOS 4.1)\n"
+msgstr "-I               code genereren voor inetd-serverondersteuning (voor SunOS 4.1)\n"
 
 #: sunrpc/rpc_main.c:1478
 #, c-format
 msgid "-K seconds\tserver exits after K seconds of inactivity\n"
-msgstr "-K seconden\tserver stopt na K seconden van inactiviteit\n"
+msgstr "-K SECONDEN      server stopt na dit aantal seconden van inactiviteit\n"
 
 #: sunrpc/rpc_main.c:1479
 #, c-format
 msgid "-l\t\tgenerate client side stubs\n"
-msgstr "-l\t\tgenereert client-side stubs\n"
+msgstr "-l               client-side stubs genereren\n"
 
 #: sunrpc/rpc_main.c:1480
 #, c-format
 msgid "-L\t\tserver errors will be printed to syslog\n"
-msgstr "-L\t\tserverfouten worden weggeschreven naar syslog\n"
+msgstr "-L               serverfouten worden naar syslog geschreven\n"
 
 #: sunrpc/rpc_main.c:1481
 #, c-format
 msgid "-m\t\tgenerate server side stubs\n"
-msgstr "-m\t\tgenereert server-side stubs\n"
+msgstr "-m               server-side stubs genereren\n"
 
 #: sunrpc/rpc_main.c:1482
 #, c-format
 msgid "-M\t\tgenerate MT-safe code\n"
-msgstr "-M\t\tgenereert MT-safe-code\n"
+msgstr "-M               MT-safe-code genereren\n"
 
 #: sunrpc/rpc_main.c:1483
 #, c-format
 msgid "-n netid\tgenerate server code that supports named netid\n"
-msgstr "-n netid\tgenereert servercode die benoemde netid ondersteund\n"
+msgstr "-n NETID         servercode genereren die deze NETID ondersteunt\n"
 
 #: sunrpc/rpc_main.c:1484
 #, c-format
 msgid "-N\t\tsupports multiple arguments and call-by-value\n"
-msgstr "-N\t\tondersteunt meervoudige argumenten en call-by-value\n"
+msgstr "-N               meervoudige argumenten en call-by-value ondersteunen\n"
 
 #: sunrpc/rpc_main.c:1485
 #, c-format
 msgid "-o outfile\tname of the output file\n"
-msgstr "-o uitvoer\tnaam van het uitvoerbestand\n"
+msgstr "-o UITBESTAND    naam van het uitvoerbestand\n"
 
 #: sunrpc/rpc_main.c:1486
 #, c-format
 msgid "-s nettype\tgenerate server code that supports named nettype\n"
-msgstr "-s nettype\tgenereert servercode dat benoemde nettype ondersteund\n"
+msgstr "-s NETTYPE       servercode generen die dit NETTYPE ondersteunt\n"
 
 #: sunrpc/rpc_main.c:1487
 #, c-format
 msgid "-Sc\t\tgenerate sample client code that uses remote procedures\n"
-msgstr "-Sc\t\tgenereert voorbeeld-clientcode die remote-procedures ondersteunt\n"
+msgstr "-Sc              voorbeeld-cliëntcode genereren die remote-procedures gebruikt\n"
 
 #: sunrpc/rpc_main.c:1488
 #, c-format
 msgid "-Ss\t\tgenerate sample server code that defines remote procedures\n"
-msgstr "-Ss\t\tgenereert voorbeeld-servercode die remote-procedures definieert\n"
+msgstr "-Ss              voorbeeld-servercode genereren die remote-procedures definieert\n"
 
 #: sunrpc/rpc_main.c:1489
 #, c-format
 msgid "-Sm \t\tgenerate makefile template \n"
-msgstr "-Sm \t\tgenereert makefilesjabloon \n"
+msgstr "-Sm              'makefile'-sjabloon genereren\n"
 
 #: sunrpc/rpc_main.c:1490
 #, c-format
 msgid "-t\t\tgenerate RPC dispatch table\n"
-msgstr "-t\t\tgenereert RPC-dispatchtabel\n"
+msgstr "-t               RPC-dispatch-tabel genereren\n"
 
 #: sunrpc/rpc_main.c:1491
 #, c-format
 msgid "-T\t\tgenerate code to support RPC dispatch tables\n"
-msgstr "-T\t\tgenereert code om RPC-dispatchtabellen te ondersteunen\n"
+msgstr "-T               code genereren om RPC-dispatch-tabellen te ondersteunen\n"
 
 #: sunrpc/rpc_main.c:1492
 #, c-format
 msgid "-Y path\t\tdirectory name to find C preprocessor (cpp)\n"
-msgstr "-Y pad\t\tmapnaam om C-voorverwerker (CPP) te vinden\n"
+msgstr "-Y PAD           naam van map waarin C-voorverwerker 'cpp' is te vinden\n"
 
 #: sunrpc/rpc_scan.c:114
 msgid "constant or identifier expected"
@@ -5225,17 +5235,20 @@ msgstr "svc_unix.c: probleem bij aanmaken van AF_UNIX-socket"
 msgid "svc_unix.c - cannot getsockname or listen"
 msgstr "svc_unix.c: getsockname() en listen() zijn mislukt"
 
+# Vroeger ging dit over het afsluiten van een modemverbinding,
+# tegenwoordig over het afsluiten van een pseudoterminal.
 #: sysdeps/generic/siglist.h:29 sysdeps/unix/siglist.c:27
 msgid "Hangup"
-msgstr "Ophangen"
+msgstr "Opgehangen"
 
 #: sysdeps/generic/siglist.h:30 sysdeps/unix/siglist.c:28
 msgid "Interrupt"
-msgstr "Onderbreken"
+msgstr "Onderbroken"
 
+# Verleden tijd, "Afgesloten", net als de andere actiesignaalnamen.
 #: sysdeps/generic/siglist.h:31 sysdeps/unix/siglist.c:29
 msgid "Quit"
-msgstr "Afsluiten"
+msgstr "Afgesloten"
 
 #: sysdeps/generic/siglist.h:32 sysdeps/unix/siglist.c:30
 msgid "Illegal instruction"
@@ -5251,7 +5264,7 @@ msgstr "Afgebroken"
 
 #: sysdeps/generic/siglist.h:35 sysdeps/unix/siglist.c:34
 msgid "Floating point exception"
-msgstr "Drijvende-komma-berekeningsfout"
+msgstr "Drijvendekomma-berekeningsfout"
 
 #: sysdeps/generic/siglist.h:36 sysdeps/unix/siglist.c:35
 msgid "Killed"
@@ -5277,23 +5290,23 @@ msgstr "Gebroken pijp"
 
 #: sysdeps/generic/siglist.h:40 sysdeps/unix/siglist.c:40
 msgid "Alarm clock"
-msgstr "Alarmklok"
+msgstr "Wekker"
 
 #: sysdeps/generic/siglist.h:41 sysdeps/unix/siglist.c:41
 msgid "Terminated"
-msgstr "Afgesloten"
+msgstr "Beëindigd"
 
 #: sysdeps/generic/siglist.h:42 sysdeps/unix/siglist.c:42
 msgid "Urgent I/O condition"
-msgstr "Spoedeisende I/O-toestand"
+msgstr "Urgente in-/uitvoertoestand"
 
 #: sysdeps/generic/siglist.h:43 sysdeps/unix/siglist.c:43
 msgid "Stopped (signal)"
-msgstr "Gestopt (signaal)"
+msgstr "Gepauzeerd (signaal)"
 
 #: sysdeps/generic/siglist.h:44 sysdeps/unix/siglist.c:44
 msgid "Stopped"
-msgstr "Gestopt"
+msgstr "Gepauzeerd"
 
 #: sysdeps/generic/siglist.h:45 sysdeps/unix/siglist.c:45
 msgid "Continued"
@@ -5301,19 +5314,19 @@ msgstr "Doorgegaan"
 
 #: sysdeps/generic/siglist.h:46 sysdeps/unix/siglist.c:46
 msgid "Child exited"
-msgstr "Kind is afgesloten"
+msgstr "Dochter is afgesloten"
 
 #: sysdeps/generic/siglist.h:47 sysdeps/unix/siglist.c:47
 msgid "Stopped (tty input)"
-msgstr "Gestopt (tty-invoer)"
+msgstr "Gepauzeerd (terminalinvoer)"
 
 #: sysdeps/generic/siglist.h:48 sysdeps/unix/siglist.c:48
 msgid "Stopped (tty output)"
-msgstr "Gestopt (tty-uitvoer)"
+msgstr "Gepauzeerd (terminaluitvoer)"
 
 #: sysdeps/generic/siglist.h:49 sysdeps/unix/siglist.c:49
 msgid "I/O possible"
-msgstr "I/O is mogelijk"
+msgstr "In-/uitvoer is mogelijk"
 
 #: sysdeps/generic/siglist.h:50 sysdeps/unix/siglist.c:50
 msgid "CPU time limit exceeded"
@@ -5337,11 +5350,11 @@ msgstr "Venster is veranderd"
 
 #: sysdeps/generic/siglist.h:55 sysdeps/unix/siglist.c:56
 msgid "User defined signal 1"
-msgstr "Eerste door gebruiker gedefinieerd signaal"
+msgstr "Gebruikergedefinieerd signaal 1"
 
 #: sysdeps/generic/siglist.h:56 sysdeps/unix/siglist.c:57
 msgid "User defined signal 2"
-msgstr "Tweede door gebruiker gedefinieerd signaal"
+msgstr "Gebruikergedefinieerd signaal 2"
 
 #: sysdeps/generic/siglist.h:60 sysdeps/unix/siglist.c:33
 msgid "EMT trap"
@@ -5353,7 +5366,7 @@ msgstr "Onjuiste systeemaanroep"
 
 #: sysdeps/generic/siglist.h:66
 msgid "Stack fault"
-msgstr "Stackfout"
+msgstr "Stack-fout"
 
 #: sysdeps/generic/siglist.h:69
 msgid "Information request"
@@ -5940,7 +5953,7 @@ msgstr "Ongepaste bewerking voor achtergrondproces"
 #. TRANS up, before it has connected to the file.
 #: sysdeps/gnu/errlist.c:955
 msgid "Translator died"
-msgstr "Vertaler bestaat niet meer"
+msgstr "Vertaalprogramma is gecrasht"
 
 #. TRANS The experienced user will know what is wrong.
 #. TRANS @c This error code is a joke.  Its perror text is part of the joke.
@@ -6206,7 +6219,7 @@ msgstr "Adresfamilie voor hostnaam wordt niet ondersteund"
 
 #: sysdeps/posix/gai_strerror-strs.h:2
 msgid "Temporary failure in name resolution"
-msgstr "Tijdelijke storing in naamsherleiding"
+msgstr "Tijdelijk probleem in naamsherleiding"
 
 #: sysdeps/posix/gai_strerror-strs.h:3
 msgid "Bad value for ai_flags"
@@ -6214,7 +6227,7 @@ msgstr "Ongeldige waarde voor 'ai_flags'"
 
 #: sysdeps/posix/gai_strerror-strs.h:4
 msgid "Non-recoverable failure in name resolution"
-msgstr "Onherstelbare mislukking in naamsherleiding"
+msgstr "Onherstelbaar probleem in naamsherleiding"
 
 #: sysdeps/posix/gai_strerror-strs.h:5
 msgid "ai_family not supported"
@@ -6292,7 +6305,7 @@ msgid ""
 "Usage: lddlibc4 FILE\n"
 "\n"
 msgstr ""
-"Gebruik: lddlibc4 BESTAND\n"
+"Gebruik:  lddlibc4 BESTAND\n"
 "\n"
 
 #: sysdeps/unix/sysv/linux/lddlibc4.c:82
@@ -6431,6 +6444,10 @@ msgstr "onhandelbare zone"
 msgid "%s in ruleless zone"
 msgstr "%s in voorschriftloze zone"
 
+#
+# This is the name of the program's standard input.  The place input
+# from getchar (et al) comes from.
+#
 #: timezone/zic.c:816
 msgid "standard input"
 msgstr "standaardinvoer"
@@ -6677,7 +6694,9 @@ msgstr "'29-2' gebruikt in een niet-schrikkeljaar"
 
 #: timezone/zic.c:2577
 msgid "rule goes past start/end of month--will not work with pre-2004 versions of zic"
-msgstr "voorschrift gaat voorbij begin of einde van maand -- dit werkt niet met versies van 'zic' van voor 2004"
+msgstr ""
+"voorschrift gaat voorbij begin of einde van maand --\n"
+"dit werkt niet met versies van 'zic' van voor 2004"
 
 #: timezone/zic.c:2609
 msgid "time zone abbreviation lacks alphabetic at start"
@@ -6708,78 +6727,3 @@ msgstr "%s: Kan map %s niet aanmaken: %s\n"
 #, c-format
 msgid "%s: %d did not sign extend correctly\n"
 msgstr "%s: %d is niet correct omgezet naar een grotere precisie\n"
-
-#~ msgid "cannot create searchlist"
-#~ msgstr "kan zoeklijst niet aanmaken"
-
-#~ msgid ""
-#~ "Read and display shared object profiling data.\vFor bug reporting instructions, please see:\n"
-#~ "<http://www.gnu.org/software/libc/bugs.html>.\n"
-#~ msgstr ""
-#~ "  \n"
-#~ "Gegevens van prestatie-analyse inlezen en afbeelden.\vVoor het rapporteren van fouten, zie:\n"
-#~ "  <http://www.gnu.org/software/libc/bugs.html>.\n"
-
-#~ msgid "%s: stopping date is invalid in string %Zd in `era' field"
-#~ msgstr "%s: einddatum is ongeldig in tekenreeks %Zd in het veld 'era'"
-
-#~ msgid ""
-#~ "Get locale-specific information.\vFor bug reporting instructions, please see:\n"
-#~ "<http://www.gnu.org/software/libc/bugs.html>.\n"
-#~ msgstr ""
-#~ "  \n"
-#~ "Informatie over taalregio-instellingen weergeven.\vVoor het rapporteren van fouten, zie:\n"
-#~ "  <http://www.gnu.org/software/libc/bugs.html>.\n"
-
-#~ msgid ""
-#~ "Get entries from administrative database.\vFor bug reporting instructions, please see:\n"
-#~ "<http://www.gnu.org/software/libc/bugs.html>.\n"
-#~ msgstr ""
-#~ "  \n"
-#~ "Items uit een gegevensbank weergeven.\vVoor het rapporteren van fouten, zie:\n"
-#~ "  <http://www.gnu.org/software/libc/bugs.html>.\n"
-
-#~ msgid "%s: illegal option -- %c\n"
-#~ msgstr "%s: ongeldige optie -- %c\n"
-
-#~ msgid "authunix_create: out of memory\n"
-#~ msgstr "authunix_create(): onvoldoende geheugen\n"
-
-#~ msgid "clnttcp_create: out of memory\n"
-#~ msgstr "clnttcp_create(): onvoldoende geheugen\n"
-
-#~ msgid "clntudp_create: out of memory\n"
-#~ msgstr "clntudp_create(): onvoldoende geheugen\n"
-
-#~ msgid "clntunix_create: out of memory\n"
-#~ msgstr "clntunix_create(): onvoldoende geheugen\n"
-
-#~ msgid "svctcp_create: out of memory\n"
-#~ msgstr "svctcp_create(): onvoldoende geheugen\n"
-
-#~ msgid "svc_tcp: makefd_xprt: out of memory\n"
-#~ msgstr "svc_tcp.c: makefd_xprt(): onvoldoende geheugen\n"
-
-#~ msgid "svcudp_create: out of memory\n"
-#~ msgstr "svcudp_create(): onvoldoende geheugen\n"
-
-#~ msgid "svcunix_create: out of memory\n"
-#~ msgstr "svcunix_create(): onvoldoende geheugen\n"
-
-#~ msgid "svc_unix: makefd_xprt: out of memory\n"
-#~ msgstr "svc_unix.c: makefd_xprt(): onvoldoende geheugen\n"
-
-#~ msgid "xdr_bytes: out of memory\n"
-#~ msgstr "xdr_bytes(): onvoldoende geheugen\n"
-
-#~ msgid "xdr_string: out of memory\n"
-#~ msgstr "xdr_string(): onvoldoende geheugen\n"
-
-#~ msgid "xdr_array: out of memory\n"
-#~ msgstr "xdr_array(): onvoldoende geheugen\n"
-
-#~ msgid "xdrrec_create: out of memory\n"
-#~ msgstr "xdrrec_create(): onvoldoende geheugen\n"
-
-#~ msgid "xdr_reference: out of memory\n"
-#~ msgstr "xdr_reference(): onvoldoende geheugen\n"

From 4dd019e3a1c68e2988ac35a97c95a59cd307eb05 Mon Sep 17 00:00:00 2001
From: Roland McGrath <roland@redhat.com>
Date: Mon, 5 Apr 2010 19:44:16 -0700
Subject: [PATCH 73/76] elf/rtld.c (dl_main) [HAVE_AUX_VECTOR]: Add a cast.

---
 ChangeLog  | 4 ++++
 elf/rtld.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ef6c9def3c..7485ec5429 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-05  Roland McGrath  <roland@redhat.com>
+
+	* elf/rtld.c (dl_main) [HAVE_AUX_VECTOR]: Add a cast.
+
 2010-04-05  Ulrich Drepper  <drepper@redhat.com>
 
 	* po/nl.po: Update from translation team.
diff --git a/elf/rtld.c b/elf/rtld.c
index 3c414461e9..e26b2b9e1b 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1091,7 +1091,7 @@ of this helper program; chances are you did not intend to run this program.\n\
 	switch (av->a_type)
 	  {
 	  case AT_PHDR:
-	    av->a_un.a_val = phdr;
+	    av->a_un.a_val = (uintptr_t) phdr;
 	    break;
 	  case AT_PHNUM:
 	    av->a_un.a_val = phnum;

From f571a994cec6be2f6edff2f0cd43cbdadcd94f5f Mon Sep 17 00:00:00 2001
From: Roland McGrath <roland@redhat.com>
Date: Mon, 5 Apr 2010 20:07:39 -0700
Subject: [PATCH 74/76] Move unwind-resume code from NPTL to sysdeps/gnu.

---
 ChangeLog                                         |  7 +++++++
 nptl/ChangeLog                                    |  7 +++++++
 nptl/sysdeps/pthread/Makefile                     | 12 ++----------
 sysdeps/gnu/Makefile                              | 15 ++++++++++++++-
 .../pthread => sysdeps/gnu}/rt-unwind-resume.c    |  0
 .../pthread => sysdeps/gnu}/unwind-resume.c       |  0
 6 files changed, 30 insertions(+), 11 deletions(-)
 rename {nptl/sysdeps/pthread => sysdeps/gnu}/rt-unwind-resume.c (100%)
 rename {nptl/sysdeps/pthread => sysdeps/gnu}/unwind-resume.c (100%)

diff --git a/ChangeLog b/ChangeLog
index 7485ec5429..71c3f01284 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-04-05  Thomas Schwinge  <thomas@schwinge.name>
+
+	* sysdeps/gnu/unwind-resume.c: New, moved from nptl/sysdeps/pthread/.
+	* sysdeps/gnu/rt-unwind-resume.c: Likewise.
+	* sysdeps/gnu/Makefile: Add sections for csu and rt subdirs to
+	build unwind-resume code, previously in nptl/sysdeps/pthread/Makefile.
+
 2010-04-05  Roland McGrath  <roland@redhat.com>
 
 	* elf/rtld.c (dl_main) [HAVE_AUX_VECTOR]: Add a cast.
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index bab38c7a8f..5b8b0e5555 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,10 @@
+2010-04-05  Thomas Schwinge  <thomas@schwinge.name>
+
+	* sysdeps/pthread/unwind-resume.c: Moved to main tree sysdeps/gnu/.
+	* sysdeps/pthread/rt-unwind-resume.c: Likewise.
+	* sysdeps/pthread/Makefile: Remove csu section and rt section's
+	unwind-resume bits, now in main tree sysdeps/gnu/Makefile instead.
+
 2010-03-23  Luis Machado  <luisgpm@br.ibm.com>
 
 	* pthread_cond_timedwait.c: Add check for
diff --git a/nptl/sysdeps/pthread/Makefile b/nptl/sysdeps/pthread/Makefile
index 72550d74a7..f4d9390d83 100644
--- a/nptl/sysdeps/pthread/Makefile
+++ b/nptl/sysdeps/pthread/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2002,2003,2004,2006 Free Software Foundation, Inc.
+# Copyright (C) 2002,2003,2004,2006,2010 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -17,21 +17,13 @@
 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 # 02111-1307 USA.
 
-ifeq ($(subdir),csu)
-routines += unwind-resume
-shared-only-routines += unwind-resume
-CFLAGS-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables
-endif
-
 ifeq ($(subdir),nptl)
 libpthread-sysdep_routines += errno-loc
 endif
 
 ifeq ($(subdir),rt)
-librt-sysdep_routines += timer_routines librt-cancellation rt-unwind-resume
-librt-shared-only-routines += rt-unwind-resume
+librt-sysdep_routines += timer_routines librt-cancellation
 CFLAGS-librt-cancellation.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-rt-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables
 
 ifeq (yes,$(build-shared))
 $(objpfx)tst-timer: $(objpfx)librt.so $(shared-thread-library)
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index 5b9a0a56ed..b33d1004a5 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996,1997,1998,1999,2001,2002,2003,2004,2005,2006
+# Copyright (C) 1996,1997,1998,1999,2001,2002,2003,2004,2005,2006,2010
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -77,3 +77,16 @@ endif
 ifeq ($(subdir),misc)
 sysdep_headers += sys/mtio.h
 endif
+
+
+ifeq ($(subdir),csu)
+routines += unwind-resume
+shared-only-routines += unwind-resume
+CFLAGS-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables
+endif
+
+ifeq ($(subdir),rt)
+librt-sysdep_routines += rt-unwind-resume
+librt-shared-only-routines += rt-unwind-resume
+CFLAGS-rt-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables
+endif
diff --git a/nptl/sysdeps/pthread/rt-unwind-resume.c b/sysdeps/gnu/rt-unwind-resume.c
similarity index 100%
rename from nptl/sysdeps/pthread/rt-unwind-resume.c
rename to sysdeps/gnu/rt-unwind-resume.c
diff --git a/nptl/sysdeps/pthread/unwind-resume.c b/sysdeps/gnu/unwind-resume.c
similarity index 100%
rename from nptl/sysdeps/pthread/unwind-resume.c
rename to sysdeps/gnu/unwind-resume.c

From afd46a4c7d49c6c7697591f931f20c745df46e49 Mon Sep 17 00:00:00 2001
From: Joseph Myers <joseph@codesourcery.com>
Date: Mon, 5 Apr 2010 20:14:43 -0700
Subject: [PATCH 75/76] elf/elf.h (ELFOSABI_ARM_AEABI): Define.

---
 ChangeLog | 4 ++++
 elf/elf.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 71c3f01284..6803147f89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,10 @@
 
 	* elf/rtld.c (dl_main) [HAVE_AUX_VECTOR]: Add a cast.
 
+2010-03-30  Joseph Myers  <joseph@codesourcery.com>
+
+	* elf/elf.h (ELFOSABI_ARM_AEABI): Define.
+
 2010-04-05  Ulrich Drepper  <drepper@redhat.com>
 
 	* po/nl.po: Update from translation team.
diff --git a/elf/elf.h b/elf/elf.h
index f41a02649e..1efe359119 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -150,6 +150,7 @@ typedef struct
 #define ELFOSABI_TRU64		10	/* Compaq TRU64 UNIX.  */
 #define ELFOSABI_MODESTO	11	/* Novell Modesto.  */
 #define ELFOSABI_OPENBSD	12	/* OpenBSD.  */
+#define ELFOSABI_ARM_AEABI	64	/* ARM EABI */
 #define ELFOSABI_ARM		97	/* ARM */
 #define ELFOSABI_STANDALONE	255	/* Standalone (embedded) application */
 

From 2e7c805d5ec1f0d2f46354bca65b1feffa7af63b Mon Sep 17 00:00:00 2001
From: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Mon, 5 Apr 2010 20:17:37 -0700
Subject: [PATCH 76/76] Propagate -fdebug-prefix-map from CFLAGS to ASFLAGS.

---
 ChangeLog  | 4 ++++
 Makeconfig | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6803147f89..48bdfecec4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,10 @@
 
 	* elf/rtld.c (dl_main) [HAVE_AUX_VECTOR]: Add a cast.
 
+2010-03-30  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* Makeconfig: Propagate -fdebug-prefix-map from CFLAGS to ASFLAGS.
+
 2010-03-30  Joseph Myers  <joseph@codesourcery.com>
 
 	* elf/elf.h (ELFOSABI_ARM_AEABI): Define.
diff --git a/Makeconfig b/Makeconfig
index 15cd4caad5..cd77fe16b8 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2003,2004,2005,2006,2007,2008,2009
+# Copyright (C) 1991-2003,2004,2005,2006,2007,2008,2009,2010
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -780,7 +780,7 @@ endif
 # The assembler can generate debug information too.
 ifndef ASFLAGS
 ifeq ($(have-cpp-asm-debuginfo),yes)
-ASFLAGS := $(filter -g%,$(CFLAGS))
+ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
 else
 ASFLAGS :=
 endif