libc/glibc: add 2.10.1
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Nov 13 21:37:18 2009 +0100 (2009-11-13)
changeset 1625fde082da9813
parent 1624 782dea79ae56
child 1626 9d84b4facaca
libc/glibc: add 2.10.1

Woo... It seems the glibc guys finally decided that tarballs
were not deprecated, in fact.

The patchset was vampirised from Gentoo (kudos, guys!), and
applies to glibc+ports, so that's why it's been added as a
patchset against ports, not against glibc.
config/libc/glibc.in
patches/glibc/ports-2.10.1/100-respect-env-CPPFLAGS.patch
patches/glibc/ports-2.10.1/110-binutils-2.20-compat.patch
patches/glibc/ports-2.10.1/120-i386-x86_64-revert-clone-cfi.patch
patches/glibc/ports-2.10.1/130-i386-no-fallocate.patch
patches/glibc/ports-2.10.1/140-disable-ldconfig.patch
patches/glibc/ports-2.10.1/150-queue-header-updates.patch
patches/glibc/ports-2.10.1/160-manual-no-perl.patch
patches/glibc/ports-2.10.1/170-localedef-fix-trampoline.patch
patches/glibc/ports-2.10.1/180-resolv-dynamic.patch
patches/glibc/ports-2.10.1/190-localedef-mmap.patch
patches/glibc/ports-2.10.1/200-fadvise64_64.patch
patches/glibc/ports-2.10.1/210-ldbl-nexttowardf.patch
patches/glibc/ports-2.10.1/220-section-comments.patch
patches/glibc/ports-2.10.1/230-no-inline-gmon.patch
patches/glibc/ports-2.10.1/240-check_native-headers.patch
patches/glibc/ports-2.10.1/250-fix-pr631.patch
patches/glibc/ports-2.10.1/260-assume-pipe2.patch
patches/glibc/ports-2.10.1/270-china.patch
patches/glibc/ports-2.10.1/280-new-valencian-locale.patch
patches/glibc/ports-2.10.1/290-undefine-__i686.patch
patches/glibc/ports-2.10.1/300-nscd-one-fork.patch
patches/glibc/ports-2.10.1/310-hppa-nptl-carlos.patch
patches/glibc/ports-2.10.1/320-hppa-pie.patch
patches/glibc/ports-2.10.1/330-m68k-sys-user.patch
patches/glibc/ports-2.10.1/340-dl_execstack-PaX-support.patch
patches/glibc/ports-2.10.1/350-pre20040117-pt_pax.patch
patches/glibc/ports-2.10.1/360-tests-sandbox-libdl-paths.patch
patches/glibc/ports-2.10.1/370-fnmatch.patch
patches/glibc/ports-2.10.1/380-dont-build-timezone.patch
patches/glibc/ports-2.10.1/390-cross-compile-nptl.patch
patches/glibc/ports-2.10.1/400-alpha-xstat.patch
patches/glibc/ports-2.10.1/410-alpha-no-page-header.patch
patches/glibc/ports-2.10.1/420-alpha-no-asm-elf-header.patch
patches/glibc/ports-2.10.1/430-alpha-creat.patch
patches/glibc/ports-2.10.1/440-alpha-cache-shape.patch
patches/glibc/ports-2.10.1/450-alpha-ptr-mangling.patch
patches/glibc/ports-2.10.1/460-alpha-fix-gcc-4.1-warnings.patch
patches/glibc/ports-2.10.1/470-alpha-floor_ceil_fix.patch
patches/glibc/ports-2.10.1/480-alpha-add-dl-procinfo-support.patch
patches/glibc/ports-2.10.1/490-alpha_alpha-add-fdatasync-support.patch
patches/glibc/ports-2.10.1/500-alpha-add-getsystats-support.patch
patches/glibc/ports-2.10.1/510-alpha-fix-includes.patch
patches/glibc/ports-2.10.1/520-alpha-add-futex-defines.patch
patches/glibc/ports-2.10.1/530-alpha-fix-rtld-fPIC.patch
patches/glibc/ports-2.10.1/540-alpha-fix-memchr.patch
patches/glibc/ports-2.10.1/550-alpha-fix-SOCK_NONBLOCK.patch
patches/glibc/ports-2.10.1/560-ppc-atomic.patch
patches/glibc/ports-2.10.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
patches/glibc/ports-2.10.1/580-nptl-lowlevellock.patch
patches/glibc/ports-2.10.1/590-sh-set-fpscr-proto.patch
patches/glibc/ports-2.10.1/600-mips_librt-mips.patch
patches/glibc/ports-2.10.1/610-fpu-cw-mips.patch
patches/glibc/ports-2.10.1/620-r10k-workarounds.patch
patches/glibc/ports-2.10.1/630-mips_shn_undef-hack.patch
     1.1 --- a/config/libc/glibc.in	Fri Nov 13 19:34:18 2009 +0100
     1.2 +++ b/config/libc/glibc.in	Fri Nov 13 21:37:18 2009 +0100
     1.3 @@ -14,6 +14,12 @@
     1.4  # Don't remove next line
     1.5  # CT_INSERT_VERSION_BELOW
     1.6  
     1.7 +config LIBC_V_2_10_1
     1.8 +    bool
     1.9 +    prompt "2.10.1 (EXPERIMENTAL)"
    1.10 +    depends on EXPERIMENTAL
    1.11 +    select LIBC_GLIBC_USE_PORTS
    1.12 +
    1.13  config LIBC_V_2_9
    1.14      bool
    1.15      prompt "2.9"
    1.16 @@ -60,6 +66,7 @@
    1.17      string
    1.18  # Don't remove next line
    1.19  # CT_INSERT_VERSION_STRING_BELOW
    1.20 +    default "2.10.1" if LIBC_V_2_10_1
    1.21      default "2.9" if LIBC_V_2_9
    1.22      default "2.8" if LIBC_V_2_8
    1.23      default "2.7" if LIBC_V_2_7
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/glibc/ports-2.10.1/100-respect-env-CPPFLAGS.patch	Fri Nov 13 21:37:18 2009 +0100
     2.3 @@ -0,0 +1,25 @@
     2.4 +Respect environment CPPFLAGS when we run ./configure so we can inject
     2.5 +random -D things without having to set CFLAGS/ASFLAGS
     2.6 +
     2.7 +diff -durN glibc-2.10.1.orig/Makeconfig glibc-2.10.1/Makeconfig
     2.8 +--- glibc-2.10.1.orig/Makeconfig	2009-05-09 23:57:56.000000000 +0200
     2.9 ++++ glibc-2.10.1/Makeconfig	2009-11-13 00:49:41.000000000 +0100
    2.10 +@@ -672,6 +672,7 @@
    2.11 + 	   $(foreach lib,$(libof-$(basename $(@F))) \
    2.12 + 		         $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
    2.13 + 	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
    2.14 ++CPPFLAGS += $(CPPFLAGS-config)
    2.15 + override CFLAGS	= -std=gnu99 $(gnu89-inline-CFLAGS) \
    2.16 + 		  $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
    2.17 + 		  $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
    2.18 +diff -durN glibc-2.10.1.orig/config.make.in glibc-2.10.1/config.make.in
    2.19 +--- glibc-2.10.1.orig/config.make.in	2009-05-09 17:59:38.000000000 +0200
    2.20 ++++ glibc-2.10.1/config.make.in	2009-11-13 00:49:41.000000000 +0100
    2.21 +@@ -103,6 +103,7 @@
    2.22 + CXX = @CXX@
    2.23 + BUILD_CC = @BUILD_CC@
    2.24 + CFLAGS = @CFLAGS@
    2.25 ++CPPFLAGS-config = @CPPFLAGS@
    2.26 + ASFLAGS-config = @ASFLAGS_config@
    2.27 + AR = @AR@
    2.28 + RANLIB = @RANLIB@
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/glibc/ports-2.10.1/110-binutils-2.20-compat.patch	Fri Nov 13 21:37:18 2009 +0100
     3.3 @@ -0,0 +1,39 @@
     3.4 +
     3.5 +
     3.6 +diff -durN glibc-2.10.1.orig/configure glibc-2.10.1/configure
     3.7 +--- glibc-2.10.1.orig/configure	2009-05-17 14:19:31.000000000 +0200
     3.8 ++++ glibc-2.10.1/configure	2009-11-13 00:49:43.000000000 +0100
     3.9 +@@ -4839,7 +4839,7 @@
    3.10 +   ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
    3.11 +   case $ac_prog_version in
    3.12 +     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
    3.13 +-    2.1[3-9]*)
    3.14 ++    2.1[3-9]*|[2-9].[2-9]*)
    3.15 +        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
    3.16 +     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
    3.17 + 
    3.18 +@@ -4902,7 +4902,7 @@
    3.19 +   ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
    3.20 +   case $ac_prog_version in
    3.21 +     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
    3.22 +-    2.1[3-9]*)
    3.23 ++    2.1[3-9]*|[2-9].[2-9]*)
    3.24 +        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
    3.25 +     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
    3.26 + 
    3.27 +diff -durN glibc-2.10.1.orig/configure.in glibc-2.10.1/configure.in
    3.28 +--- glibc-2.10.1.orig/configure.in	2009-04-04 01:51:47.000000000 +0200
    3.29 ++++ glibc-2.10.1/configure.in	2009-11-13 00:49:43.000000000 +0100
    3.30 +@@ -897,10 +897,10 @@
    3.31 + # Accept binutils 2.13 or newer.
    3.32 + AC_CHECK_PROG_VER(AS, $AS, --version,
    3.33 + 		  [GNU assembler.* \([0-9]*\.[0-9.]*\)],
    3.34 +-		  [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
    3.35 ++		  [2.1[3-9]*|[2-9].[2-9]*], AS=: critic_missing="$critic_missing as")
    3.36 + AC_CHECK_PROG_VER(LD, $LD, --version,
    3.37 + 		  [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
    3.38 +-		  [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
    3.39 ++		  [2.1[3-9]*|[2-9].[2-9]*], LD=: critic_missing="$critic_missing ld")
    3.40 + 
    3.41 + # We need the physical current working directory.  We cannot use the
    3.42 + # "pwd -P" shell builtin since that's not portable.  Instead we try to
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/patches/glibc/ports-2.10.1/120-i386-x86_64-revert-clone-cfi.patch	Fri Nov 13 21:37:18 2009 +0100
     4.3 @@ -0,0 +1,55 @@
     4.4 +revert cfi additions to clone on i386/x86_64 to workaround problems in
     4.5 +gcc's unwinder code.  this is not a bug in glibc, it triggers problems
     4.6 +elsewhere.  this cfi code does not gain us a whole lot anyways.
     4.7 +
     4.8 +http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
     4.9 +
    4.10 +Index: sysdeps/unix/sysv/linux/i386/clone.S
    4.11 +===================================================================
    4.12 +RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
    4.13 +retrieving revision 1.27
    4.14 +retrieving revision 1.26
    4.15 +diff -u -p -r1.27 -r1.26
    4.16 +
    4.17 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.10.1/sysdeps/unix/sysv/linux/i386/clone.S
    4.18 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/clone.S	2006-12-04 00:12:36.000000000 +0100
    4.19 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/clone.S	2009-11-13 00:49:45.000000000 +0100
    4.20 +@@ -120,9 +120,6 @@
    4.21 + 	ret
    4.22 + 
    4.23 + L(thread_start):
    4.24 +-	cfi_startproc;
    4.25 +-	/* Clearing frame pointer is insufficient, use CFI.  */
    4.26 +-	cfi_undefined (eip);
    4.27 + 	/* Note: %esi is zero.  */
    4.28 + 	movl	%esi,%ebp	/* terminate the stack frame */
    4.29 + #ifdef RESET_PID
    4.30 +@@ -155,7 +152,6 @@
    4.31 + 	jmp	L(haspid)
    4.32 + 	.previous
    4.33 + #endif
    4.34 +-	cfi_endproc;
    4.35 + 
    4.36 + 	cfi_startproc
    4.37 + PSEUDO_END (BP_SYM (__clone))
    4.38 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.10.1/sysdeps/unix/sysv/linux/x86_64/clone.S
    4.39 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/x86_64/clone.S	2006-12-04 00:12:36.000000000 +0100
    4.40 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/x86_64/clone.S	2009-11-13 00:49:45.000000000 +0100
    4.41 +@@ -89,9 +89,6 @@
    4.42 + 	ret
    4.43 + 
    4.44 + L(thread_start):
    4.45 +-	cfi_startproc;
    4.46 +-	/* Clearing frame pointer is insufficient, use CFI.  */
    4.47 +-	cfi_undefined (rip);
    4.48 + 	/* Clear the frame pointer.  The ABI suggests this be done, to mark
    4.49 + 	   the outermost frame obviously.  */
    4.50 + 	xorl	%ebp, %ebp
    4.51 +@@ -116,7 +113,6 @@
    4.52 + 	/* Call exit with return value from function call. */
    4.53 + 	movq	%rax, %rdi
    4.54 + 	call	HIDDEN_JUMPTARGET (_exit)
    4.55 +-	cfi_endproc;
    4.56 + 
    4.57 + 	cfi_startproc;
    4.58 + PSEUDO_END (BP_SYM (__clone))
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/patches/glibc/ports-2.10.1/130-i386-no-fallocate.patch	Fri Nov 13 21:37:18 2009 +0100
     5.3 @@ -0,0 +1,55 @@
     5.4 +Fix building on x86 when older linux headers lack __NR_fallocate define.
     5.5 +
     5.6 +URL: http://bugs.gentoo.org/274269
     5.7 +Reported-by: Mikael Magnusson <mikachu@gmail.com>
     5.8 +
     5.9 +2009-11-09  Mike Frysinger  <vapier@gentoo.org>
    5.10 +
    5.11 +	* sysdeps/unix/sysv/linux/i386/fallocate.c: Include errno.h.
    5.12 +	(fallocate): Return ENOSYS if __NR_fallocate is not defined.
    5.13 +	* sysdeps/unix/sysv/linux/i386/fallocate64.c: Likewise.
    5.14 +
    5.15 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate.c glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate.c
    5.16 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate.c	2009-03-02 17:11:06.000000000 +0100
    5.17 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate.c	2009-11-13 00:49:47.000000000 +0100
    5.18 +@@ -16,6 +16,7 @@
    5.19 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    5.20 +    02111-1307 USA.  */
    5.21 + 
    5.22 ++#include <errno.h>
    5.23 + #include <fcntl.h>
    5.24 + #include <sysdep.h>
    5.25 + 
    5.26 +@@ -28,5 +29,10 @@
    5.27 + int
    5.28 + fallocate (int fd, int mode, __off_t offset, __off_t len)
    5.29 + {
    5.30 ++#ifdef __NR_fallocate
    5.31 +   return __call_fallocate (fd, mode, offset, len);
    5.32 ++#else
    5.33 ++  __set_errno (ENOSYS);
    5.34 ++  return -1;
    5.35 ++#endif
    5.36 + }
    5.37 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate64.c glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate64.c
    5.38 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate64.c	2009-03-02 17:10:29.000000000 +0100
    5.39 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate64.c	2009-11-13 00:49:47.000000000 +0100
    5.40 +@@ -16,6 +16,7 @@
    5.41 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    5.42 +    02111-1307 USA.  */
    5.43 + 
    5.44 ++#include <errno.h>
    5.45 + #include <fcntl.h>
    5.46 + #include <sysdep.h>
    5.47 + 
    5.48 +@@ -28,5 +29,10 @@
    5.49 + int
    5.50 + __fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
    5.51 + {
    5.52 ++#ifdef __NR_fallocate
    5.53 +   return __call_fallocate (fd, mode, offset, len);
    5.54 ++#else
    5.55 ++  __set_errno (ENOSYS);
    5.56 ++  return -1;
    5.57 ++#endif
    5.58 + }
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/patches/glibc/ports-2.10.1/140-disable-ldconfig.patch	Fri Nov 13 21:37:18 2009 +0100
     6.3 @@ -0,0 +1,16 @@
     6.4 +do not bother running ldconfig on DESTDIR.  it wants to write the temp cache
     6.5 +file outside of the chroot.  doesnt matter anyways as we wont use the cache
     6.6 +results (portage will rebuild cache), so running ldconfig is simply a waste
     6.7 +of time.
     6.8 +
     6.9 +diff -durN glibc-2.10.1.orig/Makefile glibc-2.10.1/Makefile
    6.10 +--- glibc-2.10.1.orig/Makefile	2009-04-23 20:23:03.000000000 +0200
    6.11 ++++ glibc-2.10.1/Makefile	2009-11-13 00:49:49.000000000 +0100
    6.12 +@@ -116,6 +116,7 @@
    6.13 + 	rm -f $(symbolic-link-list)
    6.14 + 
    6.15 + install:
    6.16 ++dont-bother-with-destdir:
    6.17 + 	-test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
    6.18 + 	  $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
    6.19 + 				       $(slibdir) $(libdir)
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/patches/glibc/ports-2.10.1/150-queue-header-updates.patch	Fri Nov 13 21:37:18 2009 +0100
     7.3 @@ -0,0 +1,85 @@
     7.4 +grab some updates from FreeBSD
     7.5 +
     7.6 +http://bugs.gentoo.org/201979
     7.7 +
     7.8 +diff -durN glibc-2.10.1.orig/misc/sys/queue.h glibc-2.10.1/misc/sys/queue.h
     7.9 +
    7.10 +diff -durN glibc-2.10.1.orig/misc/sys/queue.h glibc-2.10.1/misc/sys/queue.h
    7.11 +--- glibc-2.10.1.orig/misc/sys/queue.h	2008-03-05 06:50:30.000000000 +0100
    7.12 ++++ glibc-2.10.1/misc/sys/queue.h	2009-11-13 00:49:51.000000000 +0100
    7.13 +@@ -136,6 +136,11 @@
    7.14 + 		(var);							\
    7.15 + 		(var) = ((var)->field.le_next))
    7.16 + 
    7.17 ++#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
    7.18 ++	for ((var) = LIST_FIRST((head));				\
    7.19 ++	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
    7.20 ++	    (var) = (tvar))
    7.21 ++
    7.22 + /*
    7.23 +  * List access methods.
    7.24 +  */
    7.25 +@@ -197,6 +202,16 @@
    7.26 + #define	SLIST_FOREACH(var, head, field)					\
    7.27 + 	for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
    7.28 + 
    7.29 ++#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
    7.30 ++	for ((var) = SLIST_FIRST((head));				\
    7.31 ++	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
    7.32 ++	    (var) = (tvar))
    7.33 ++
    7.34 ++#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
    7.35 ++	for ((varp) = &SLIST_FIRST((head));				\
    7.36 ++	    ((var) = *(varp)) != NULL;					\
    7.37 ++	    (varp) = &SLIST_NEXT((var), field))
    7.38 ++
    7.39 + /*
    7.40 +  * Singly-linked List access methods.
    7.41 +  */
    7.42 +@@ -242,6 +257,12 @@
    7.43 + 	(head)->stqh_last = &(elm)->field.stqe_next;			\
    7.44 + } while (/*CONSTCOND*/0)
    7.45 + 
    7.46 ++#define	STAILQ_LAST(head, type, field)					\
    7.47 ++	(STAILQ_EMPTY((head)) ?						\
    7.48 ++		NULL :							\
    7.49 ++	        ((struct type *)(void *)				\
    7.50 ++		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
    7.51 ++
    7.52 + #define	STAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
    7.53 + 	if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
    7.54 + 		(head)->stqh_last = &(elm)->field.stqe_next;		\
    7.55 +@@ -271,6 +292,11 @@
    7.56 + 		(var);							\
    7.57 + 		(var) = ((var)->field.stqe_next))
    7.58 + 
    7.59 ++#define STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
    7.60 ++	for ((var) = STAILQ_FIRST((head));				\
    7.61 ++		(var) && ((tvar) = STAILQ_NEXT((var), field), 1);	\
    7.62 ++		(var) = (tvar))
    7.63 ++
    7.64 + #define	STAILQ_CONCAT(head1, head2) do {				\
    7.65 + 	if (!STAILQ_EMPTY((head2))) {					\
    7.66 + 		*(head1)->stqh_last = (head2)->stqh_first;		\
    7.67 +@@ -437,11 +463,21 @@
    7.68 + 		(var);							\
    7.69 + 		(var) = ((var)->field.tqe_next))
    7.70 + 
    7.71 ++define TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
    7.72 ++	for ((var) = TAILQ_FIRST((head));				\
    7.73 ++		(var) && ((tvar) = TAILQ_NEXT((var), field), 1);	\
    7.74 ++		(var) = (tvar))
    7.75 ++
    7.76 + #define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
    7.77 + 	for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));	\
    7.78 + 		(var);							\
    7.79 + 		(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
    7.80 + 
    7.81 ++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
    7.82 ++	for ((var) = TAILQ_LAST((head), headname);			\
    7.83 ++		(var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
    7.84 ++		(var) = (tvar))
    7.85 ++
    7.86 + #define	TAILQ_CONCAT(head1, head2, field) do {				\
    7.87 + 	if (!TAILQ_EMPTY(head2)) {					\
    7.88 + 		*(head1)->tqh_last = (head2)->tqh_first;		\
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/patches/glibc/ports-2.10.1/160-manual-no-perl.patch	Fri Nov 13 21:37:18 2009 +0100
     8.3 @@ -0,0 +1,24 @@
     8.4 +If we're using a cvs snapshot which updates the source files, and
     8.5 +perl isn't installed yet, then we can't regen the docs.  Not a big
     8.6 +deal, so just whine a little and continue on our merry way.
     8.7 +
     8.8 +http://bugs.gentoo.org/60132
     8.9 +
    8.10 +diff -durN glibc-2.10.1.orig/manual/Makefile glibc-2.10.1/manual/Makefile
    8.11 +--- glibc-2.10.1.orig/manual/Makefile	2006-01-08 07:43:47.000000000 +0100
    8.12 ++++ glibc-2.10.1/manual/Makefile	2009-11-13 00:49:54.000000000 +0100
    8.13 +@@ -104,9 +104,14 @@
    8.14 + libm-err.texi: stamp-libm-err
    8.15 + stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
    8.16 + 						     $(dir)/libm-test-ulps))
    8.17 ++ifneq ($(PERL),no)
    8.18 + 	pwd=`pwd`; \
    8.19 + 	$(PERL) $< $$pwd/.. > libm-err-tmp
    8.20 + 	$(move-if-change) libm-err-tmp libm-err.texi
    8.21 ++else
    8.22 ++	echo "Unable to rebuild math docs, no perl installed"
    8.23 ++	touch libm-err.texi
    8.24 ++endif
    8.25 + 	touch $@
    8.26 + 
    8.27 + # Generate Texinfo files from the C source for the example programs.
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/patches/glibc/ports-2.10.1/170-localedef-fix-trampoline.patch	Fri Nov 13 21:37:18 2009 +0100
     9.3 @@ -0,0 +1,69 @@
     9.4 +#! /bin/sh -e
     9.5 +
     9.6 +# DP: Description: Fix localedef segfault when run under exec-shield,
     9.7 +#        PaX or similar. (#231438, #198099)
     9.8 +# DP: Dpatch Author: James Troup <james@nocrew.org>
     9.9 +# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
    9.10 +# DP: Upstream status: Unknown
    9.11 +# DP: Status Details: Unknown
    9.12 +# DP: Date: 2004-03-16
    9.13 +
    9.14 +if [ $# -ne 2 ]; then
    9.15 +    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    9.16 +    exit 1
    9.17 +fi
    9.18 +case "$1" in
    9.19 +    -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
    9.20 +    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
    9.21 +    *)
    9.22 +	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    9.23 +	exit 1
    9.24 +esac
    9.25 +exit 0
    9.26 +
    9.27 +diff -durN glibc-2.10.1.orig/locale/programs/3level.h glibc-2.10.1/locale/programs/3level.h
    9.28 +--- glibc-2.10.1.orig/locale/programs/3level.h	2007-07-16 02:54:59.000000000 +0200
    9.29 ++++ glibc-2.10.1/locale/programs/3level.h	2009-11-13 00:49:56.000000000 +0100
    9.30 +@@ -203,6 +203,42 @@
    9.31 + 	}
    9.32 +     }
    9.33 + }
    9.34 ++
    9.35 ++/* GCC ATM seems to do a poor job with pointers to nested functions passed
    9.36 ++   to inlined functions.  Help it a little bit with this hack.  */
    9.37 ++#define wchead_table_iterate(tp, fn) \
    9.38 ++do									      \
    9.39 ++  {									      \
    9.40 ++    struct wchead_table *t = (tp);					      \
    9.41 ++    uint32_t index1;							      \
    9.42 ++    for (index1 = 0; index1 < t->level1_size; index1++)			      \
    9.43 ++      {									      \
    9.44 ++	uint32_t lookup1 = t->level1[index1];				      \
    9.45 ++	if (lookup1 != ((uint32_t) ~0))					      \
    9.46 ++	  {								      \
    9.47 ++	    uint32_t lookup1_shifted = lookup1 << t->q;			      \
    9.48 ++	    uint32_t index2;						      \
    9.49 ++	    for (index2 = 0; index2 < (1 << t->q); index2++)		      \
    9.50 ++	      {								      \
    9.51 ++		uint32_t lookup2 = t->level2[index2 + lookup1_shifted];	      \
    9.52 ++		if (lookup2 != ((uint32_t) ~0))				      \
    9.53 ++		  {							      \
    9.54 ++		    uint32_t lookup2_shifted = lookup2 << t->p;		      \
    9.55 ++		    uint32_t index3;					      \
    9.56 ++		    for (index3 = 0; index3 < (1 << t->p); index3++)	      \
    9.57 ++		      {							      \
    9.58 ++			struct element_t *lookup3			      \
    9.59 ++			  = t->level3[index3 + lookup2_shifted];	      \
    9.60 ++			if (lookup3 != NULL)				      \
    9.61 ++			  fn ((((index1 << t->q) + index2) << t->p) + index3, \
    9.62 ++			      lookup3);					      \
    9.63 ++		      }							      \
    9.64 ++		  }							      \
    9.65 ++	      }								      \
    9.66 ++	  }								      \
    9.67 ++      }									      \
    9.68 ++  } while (0)
    9.69 ++
    9.70 + #endif
    9.71 + 
    9.72 + #ifndef NO_FINALIZE
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/patches/glibc/ports-2.10.1/180-resolv-dynamic.patch	Fri Nov 13 21:37:18 2009 +0100
    10.3 @@ -0,0 +1,39 @@
    10.4 +ripped from SuSE
    10.5 +
    10.6 +if /etc/resolv.conf is updated, then make sure applications
    10.7 +already running get the updated information.
    10.8 +
    10.9 +http://bugs.gentoo.org/177416
   10.10 +
   10.11 +diff -durN glibc-2.10.1.orig/resolv/res_libc.c glibc-2.10.1/resolv/res_libc.c
   10.12 +--- glibc-2.10.1.orig/resolv/res_libc.c	2009-02-07 05:27:42.000000000 +0100
   10.13 ++++ glibc-2.10.1/resolv/res_libc.c	2009-11-13 00:49:59.000000000 +0100
   10.14 +@@ -22,6 +22,7 @@
   10.15 + #include <arpa/nameser.h>
   10.16 + #include <resolv.h>
   10.17 + #include <bits/libc-lock.h>
   10.18 ++#include <sys/stat.h>
   10.19 + 
   10.20 + 
   10.21 + /* The following bit is copied from res_data.c (where it is #ifdef'ed
   10.22 +@@ -95,6 +96,20 @@
   10.23 + __res_maybe_init (res_state resp, int preinit)
   10.24 + {
   10.25 + 	if (resp->options & RES_INIT) {
   10.26 ++		static time_t last_mtime, last_check;
   10.27 ++		time_t now;
   10.28 ++		struct stat statbuf;
   10.29 ++		
   10.30 ++		time (&now);
   10.31 ++		if (now != last_check) {
   10.32 ++			last_check = now;
   10.33 ++			if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
   10.34 ++				last_mtime = statbuf.st_mtime;
   10.35 ++				atomicinclock (lock);
   10.36 ++				atomicinc (__res_initstamp);
   10.37 ++				atomicincunlock (lock);
   10.38 ++			}
   10.39 ++		}
   10.40 + 		if (__res_initstamp != resp->_u._ext.initstamp) {
   10.41 + 			if (resp->nscount > 0)
   10.42 + 				__res_iclose (resp, true);
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/patches/glibc/ports-2.10.1/190-localedef-mmap.patch	Fri Nov 13 21:37:18 2009 +0100
    11.3 @@ -0,0 +1,39 @@
    11.4 +sniped from Debian
    11.5 +http://bugs.gentoo.org/289615
    11.6 +
    11.7 +2009-10-27  Aurelien Jarno  <aurelien@aurel32.net>
    11.8 +
    11.9 +	* locale/programs/locarchive.c: use MMAP_SHARED to reserve memory
   11.10 +	used later with MMAP_FIXED | MMAP_SHARED to cope with different
   11.11 +	alignment restrictions.
   11.12 +
   11.13 +diff -durN glibc-2.10.1.orig/locale/programs/locarchive.c glibc-2.10.1/locale/programs/locarchive.c
   11.14 +--- glibc-2.10.1.orig/locale/programs/locarchive.c	2009-04-27 16:07:47.000000000 +0200
   11.15 ++++ glibc-2.10.1/locale/programs/locarchive.c	2009-11-13 00:50:01.000000000 +0100
   11.16 +@@ -134,7 +134,7 @@
   11.17 +   size_t reserved = RESERVE_MMAP_SIZE;
   11.18 +   int xflags = 0;
   11.19 +   if (total < reserved
   11.20 +-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
   11.21 ++      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
   11.22 + 		       -1, 0)) != MAP_FAILED))
   11.23 +     xflags = MAP_FIXED;
   11.24 +   else
   11.25 +@@ -396,7 +396,7 @@
   11.26 +   size_t reserved = RESERVE_MMAP_SIZE;
   11.27 +   int xflags = 0;
   11.28 +   if (total < reserved
   11.29 +-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
   11.30 ++      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
   11.31 + 		       -1, 0)) != MAP_FAILED))
   11.32 +     xflags = MAP_FIXED;
   11.33 +   else
   11.34 +@@ -614,7 +614,7 @@
   11.35 +   int xflags = 0;
   11.36 +   void *p;
   11.37 +   if (st.st_size < reserved
   11.38 +-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
   11.39 ++      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
   11.40 + 		       -1, 0)) != MAP_FAILED))
   11.41 +     xflags = MAP_FIXED;
   11.42 +   else
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/patches/glibc/ports-2.10.1/200-fadvise64_64.patch	Fri Nov 13 21:37:18 2009 +0100
    12.3 @@ -0,0 +1,28 @@
    12.4 +ripped from Debian
    12.5 +
    12.6 + sysdeps/unix/sysv/linux/posix_fadvise.c |   13 +++++++++++++
    12.7 + 1 file changed, 13 insertions(+)
    12.8 +
    12.9 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2.10.1/sysdeps/unix/sysv/linux/posix_fadvise.c
   12.10 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/posix_fadvise.c	2003-08-17 02:36:22.000000000 +0200
   12.11 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/posix_fadvise.c	2009-11-13 00:50:03.000000000 +0100
   12.12 +@@ -35,6 +35,19 @@
   12.13 +     return INTERNAL_SYSCALL_ERRNO (ret, err);
   12.14 +   return 0;
   12.15 + #else
   12.16 ++# ifdef __NR_fadvise64_64
   12.17 ++  INTERNAL_SYSCALL_DECL (err);  
   12.18 ++  int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
   12.19 ++			      __LONG_LONG_PAIR ((long) (offset >> 31),
   12.20 ++						(long) offset),
   12.21 ++			      __LONG_LONG_PAIR ((long) (len >> 31),
   12.22 ++						(long) len),
   12.23 ++			      advise);
   12.24 ++  if (INTERNAL_SYSCALL_ERROR_P (ret, err))
   12.25 ++    return INTERNAL_SYSCALL_ERRNO (ret, err);
   12.26 ++  return 0;
   12.27 ++# else
   12.28 +   return ENOSYS;
   12.29 ++# endif
   12.30 + #endif
   12.31 + }
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/patches/glibc/ports-2.10.1/210-ldbl-nexttowardf.patch	Fri Nov 13 21:37:18 2009 +0100
    13.3 @@ -0,0 +1,66 @@
    13.4 +ripped from Debian
    13.5 +
    13.6 +this change was made to generic __nexttowardf, but not the long double version
    13.7 +
    13.8 +2008-05-05  Aurelien Jarno  <aurelien@aurel32.net>
    13.9 +
   13.10 +	* sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include float.h.
   13.11 +	(__nexttowardf): Use math_opt_barrier and
   13.12 +	math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
   13.13 +	x to float using asm.
   13.14 +
   13.15 + sysdeps/ieee754/ldbl-128/s_nexttowardf.c |   26 ++++++++++++++++----------
   13.16 + 1 file changed, 16 insertions(+), 10 deletions(-)
   13.17 +
   13.18 +diff -durN glibc-2.10.1.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c glibc-2.10.1/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
   13.19 +--- glibc-2.10.1.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	1999-07-14 02:09:42.000000000 +0200
   13.20 ++++ glibc-2.10.1/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	2009-11-13 00:50:06.000000000 +0100
   13.21 +@@ -19,7 +19,8 @@
   13.22 + #endif
   13.23 + 
   13.24 + #include "math.h"
   13.25 +-#include "math_private.h"
   13.26 ++#include <math_private.h>
   13.27 ++#include <float.h>
   13.28 + 
   13.29 + #ifdef __STDC__
   13.30 + 	float __nexttowardf(float x, long double y)
   13.31 +@@ -44,10 +45,12 @@
   13.32 + 	   return x+y;
   13.33 + 	if((long double) x==y) return y;	/* x=y, return y */
   13.34 + 	if(ix==0) {				/* x == 0 */
   13.35 +-	    float x2;
   13.36 ++	    float u;
   13.37 + 	    SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
   13.38 +-	    x2 = x*x;
   13.39 +-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
   13.40 ++	    u = math_opt_barrier (x);
   13.41 ++	    u = u * u;
   13.42 ++	    math_force_eval (u);		/* raise underflow flag */
   13.43 ++	    return x;
   13.44 + 	}
   13.45 + 	if(hx>=0) {				/* x > 0 */
   13.46 + 	    if(hy<0||(ix>>23)>(iy>>48)-0x3f80
   13.47 +@@ -67,13 +70,16 @@
   13.48 + 	    }
   13.49 + 	}
   13.50 + 	hy = hx&0x7f800000;
   13.51 +-	if(hy>=0x7f800000) return x+x;	/* overflow  */
   13.52 ++	if(hy>=0x7f800000) {
   13.53 ++	  x = x+x;	/* overflow  */
   13.54 ++	  if (FLT_EVAL_METHOD != 0)
   13.55 ++	    /* Force conversion to float.  */
   13.56 ++	    asm ("" : "+m"(x));
   13.57 ++	  return x;
   13.58 ++	}
   13.59 + 	if(hy<0x00800000) {		/* underflow */
   13.60 +-	    float x2 = x*x;
   13.61 +-	    if(x2!=x) {		/* raise underflow flag */
   13.62 +-	        SET_FLOAT_WORD(x2,hx);
   13.63 +-		return x2;
   13.64 +-	    }
   13.65 ++	    float u = x*x;
   13.66 ++	    math_force_eval (u);	/* raise underflow flag */
   13.67 + 	}
   13.68 + 	SET_FLOAT_WORD(x,hx);
   13.69 + 	return x;
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/patches/glibc/ports-2.10.1/220-section-comments.patch	Fri Nov 13 21:37:18 2009 +0100
    14.3 @@ -0,0 +1,24 @@
    14.4 +http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
    14.5 +
    14.6 +fixes building on some architectures (like m68k/arm/cris/etc...) because
    14.7 +it does the right thing
    14.8 +
    14.9 +diff -durN glibc-2.10.1.orig/include/libc-symbols.h glibc-2.10.1/include/libc-symbols.h
   14.10 +--- glibc-2.10.1.orig/include/libc-symbols.h	2009-03-14 00:51:46.000000000 +0100
   14.11 ++++ glibc-2.10.1/include/libc-symbols.h	2009-11-13 00:50:07.000000000 +0100
   14.12 +@@ -239,12 +239,12 @@
   14.13 + #  define __make_section_unallocated(section_string)
   14.14 + # endif
   14.15 + 
   14.16 +-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
   14.17 ++/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
   14.18 +    section attributes on what looks like a comment to the assembler.  */
   14.19 + # ifdef HAVE_SECTION_QUOTES
   14.20 +-#  define __sec_comment "\"\n\t#\""
   14.21 ++#  define __sec_comment "\"\n#APP\n\t#\""
   14.22 + # else
   14.23 +-#  define __sec_comment "\n\t#"
   14.24 ++#  define __sec_comment "\n#APP\n\t#"
   14.25 + # endif
   14.26 + # define link_warning(symbol, msg) \
   14.27 +   __make_section_unallocated (".gnu.warning." #symbol) \
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/patches/glibc/ports-2.10.1/230-no-inline-gmon.patch	Fri Nov 13 21:37:18 2009 +0100
    15.3 @@ -0,0 +1,36 @@
    15.4 +http://bugs.gentoo.org/196245
    15.5 +http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
    15.6 +
    15.7 +Attached is a patch to add __attribute__ ((noinline)) to
    15.8 +call_gmon_start.
    15.9 +
   15.10 +Without this patch, the sec script that processed initfini.s removes a
   15.11 +part of inlined call_gmon_start, causing undefined label errors.
   15.12 +
   15.13 +This patch solves the problem by forcing gcc not to inline
   15.14 +call_gmon_start with __attribute__ ((noinline)).
   15.15 +
   15.16 +Tested by building for arm-none-lixux-gnueabi.  OK to apply?
   15.17 +
   15.18 +Kazu Hirata
   15.19 +
   15.20 +2006-05-07  Kazu Hirata  &lt;kazu@codesourcery.com&gt;
   15.21 +
   15.22 +	* sysdeps/generic/initfini.c (call_gmon_start): Add
   15.23 +	__attribute__ ((noinline)).
   15.24 +
   15.25 +Index: sysdeps/generic/initfini.c
   15.26 +===================================================================
   15.27 +
   15.28 +diff -durN glibc-2.10.1.orig/sysdeps/generic/initfini.c glibc-2.10.1/sysdeps/generic/initfini.c
   15.29 +--- glibc-2.10.1.orig/sysdeps/generic/initfini.c	2007-06-17 20:02:40.000000000 +0200
   15.30 ++++ glibc-2.10.1/sysdeps/generic/initfini.c	2009-11-13 00:50:09.000000000 +0100
   15.31 +@@ -70,7 +70,7 @@
   15.32 + /* The beginning of _init:  */
   15.33 + asm ("\n/*@_init_PROLOG_BEGINS*/");
   15.34 + 
   15.35 +-static void
   15.36 ++static void __attribute__ ((noinline))
   15.37 + call_gmon_start(void)
   15.38 + {
   15.39 +   extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/patches/glibc/ports-2.10.1/240-check_native-headers.patch	Fri Nov 13 21:37:18 2009 +0100
    16.3 @@ -0,0 +1,17 @@
    16.4 +many ports hit this warning:
    16.5 +../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
    16.6 +../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
    16.7 +
    16.8 +snipped from suse
    16.9 +
   16.10 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/check_native.c glibc-2.10.1/sysdeps/unix/sysv/linux/check_native.c
   16.11 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/check_native.c	2007-11-24 04:12:17.000000000 +0100
   16.12 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/check_native.c	2009-11-13 00:50:11.000000000 +0100
   16.13 +@@ -23,6 +23,7 @@
   16.14 + #include <stddef.h>
   16.15 + #include <stdint.h>
   16.16 + #include <stdlib.h>
   16.17 ++#include <string.h>
   16.18 + #include <time.h>
   16.19 + #include <unistd.h>
   16.20 + #include <net/if.h>
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/patches/glibc/ports-2.10.1/250-fix-pr631.patch	Fri Nov 13 21:37:18 2009 +0100
    17.3 @@ -0,0 +1,45 @@
    17.4 +From dank@kegel.com
    17.5 +Wed Jun 15 09:12:43 PDT 2005
    17.6 +
    17.7 +Fixes
    17.8 +
    17.9 +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r'
   17.10 +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent'
   17.11 +... 53 lines deleted ...
   17.12 +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r'
   17.13 +collect2: ld returned 1 exit status
   17.14 +make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1
   17.15 +
   17.16 +when building glibc with --enable-static-nss.
   17.17 +
   17.18 +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631
   17.19 +
   17.20 +diff -durN glibc-2.10.1.orig/Makeconfig glibc-2.10.1/Makeconfig
   17.21 +--- glibc-2.10.1.orig/Makeconfig	2009-11-13 00:49:41.000000000 +0100
   17.22 ++++ glibc-2.10.1/Makeconfig	2009-11-13 00:50:13.000000000 +0100
   17.23 +@@ -509,7 +509,7 @@
   17.24 + 
   17.25 + # The static libraries.
   17.26 + ifeq (yes,$(build-static))
   17.27 +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
   17.28 ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a
   17.29 + else
   17.30 + ifeq (yes,$(build-shared))
   17.31 + # We can try to link the programs with lib*_pic.a...
   17.32 +diff -durN glibc-2.10.1.orig/elf/Makefile glibc-2.10.1/elf/Makefile
   17.33 +--- glibc-2.10.1.orig/elf/Makefile	2009-01-31 01:20:55.000000000 +0100
   17.34 ++++ glibc-2.10.1/elf/Makefile	2009-11-13 00:50:13.000000000 +0100
   17.35 +@@ -121,6 +121,13 @@
   17.36 + install-bin-script = ldd
   17.37 + endif
   17.38 + 
   17.39 ++ifeq (yes,$(build-static-nss))
   17.40 ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
   17.41 ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
   17.42 ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
   17.43 ++	     $(resolvobjdir)/libresolv.a
   17.44 ++endif
   17.45 ++
   17.46 + others		= sprof sln
   17.47 + install-bin	= sprof
   17.48 + others-static   = sln
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/patches/glibc/ports-2.10.1/260-assume-pipe2.patch	Fri Nov 13 21:37:18 2009 +0100
    18.3 @@ -0,0 +1,54 @@
    18.4 +http://bugs.gentoo.org/250342
    18.5 +http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
    18.6 +
    18.7 +we cant assume sock_cloexec and pipe2 are bound together as the former defines
    18.8 +are found in glibc only while the latter are a combo of kernel headers and
    18.9 +glibc.  so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
   18.10 +inside of glibc, we hit a problem.  for example:
   18.11 +
   18.12 +#include <grp.h>
   18.13 +#include <stdio.h>
   18.14 +main()
   18.15 +{
   18.16 +	getgrnam("portage");
   18.17 +	if (!popen("ls", "r"))
   18.18 +		perror("popen()");
   18.19 +}
   18.20 +
   18.21 +getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
   18.22 +__have_sock_cloexec and __have_pipe2 to true.  but if glibc was built against
   18.23 +older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
   18.24 +stub for it.  so popen() will always fail as glibc assumes pipe2() works.
   18.25 +
   18.26 +diff -durN glibc-2.10.1.orig/include/unistd.h glibc-2.10.1/include/unistd.h
   18.27 +--- glibc-2.10.1.orig/include/unistd.h	2008-07-27 20:23:17.000000000 +0200
   18.28 ++++ glibc-2.10.1/include/unistd.h	2009-11-13 00:50:15.000000000 +0100
   18.29 +@@ -167,9 +167,6 @@
   18.30 + extern int __pause_nocancel (void) attribute_hidden;
   18.31 + 
   18.32 + extern int __have_sock_cloexec;
   18.33 +-/* At lot of other functionality became available at the same time as
   18.34 +-   SOCK_CLOEXEC.  Avoid defining separate variables for all of them
   18.35 +-   unless it is really necessary.  */
   18.36 +-#define __have_pipe2 __have_sock_cloexec
   18.37 ++extern int __have_pipe2;
   18.38 + 
   18.39 + #endif
   18.40 +diff -durN glibc-2.10.1.orig/socket/have_sock_cloexec.c glibc-2.10.1/socket/have_sock_cloexec.c
   18.41 +--- glibc-2.10.1.orig/socket/have_sock_cloexec.c	2008-07-25 18:46:23.000000000 +0200
   18.42 ++++ glibc-2.10.1/socket/have_sock_cloexec.c	2009-11-13 00:50:15.000000000 +0100
   18.43 +@@ -16,9 +16,14 @@
   18.44 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   18.45 +    02111-1307 USA.  */
   18.46 + 
   18.47 ++#include <fcntl.h>
   18.48 + #include <sys/socket.h>
   18.49 + #include <kernel-features.h>
   18.50 + 
   18.51 + #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
   18.52 + int __have_sock_cloexec;
   18.53 + #endif
   18.54 ++
   18.55 ++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
   18.56 ++int __have_pipe2;
   18.57 ++#endif
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/patches/glibc/ports-2.10.1/270-china.patch	Fri Nov 13 21:37:18 2009 +0100
    19.3 @@ -0,0 +1,32 @@
    19.4 +
    19.5 +
    19.6 +diff -durN glibc-2.10.1.orig/localedata/locales/zh_TW glibc-2.10.1/localedata/locales/zh_TW
    19.7 +--- glibc-2.10.1.orig/localedata/locales/zh_TW	2004-11-01 00:42:28.000000000 +0100
    19.8 ++++ glibc-2.10.1/localedata/locales/zh_TW	2009-11-13 00:50:17.000000000 +0100
    19.9 +@@ -1,7 +1,7 @@
   19.10 + comment_char %
   19.11 + escape_char /
   19.12 + %
   19.13 +-% Chinese language locale for Taiwan R.O.C.
   19.14 ++% Chinese language locale for Taiwan
   19.15 + % charmap: BIG5-CP950
   19.16 + %
   19.17 + % Original Author:
   19.18 +@@ -17,7 +17,7 @@
   19.19 + % Reference:	http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
   19.20 + 
   19.21 + LC_IDENTIFICATION
   19.22 +-title      "Chinese locale for Taiwan R.O.C."
   19.23 ++title      "Chinese locale for Taiwan"
   19.24 + source     ""
   19.25 + address    ""
   19.26 + contact    ""
   19.27 +@@ -25,7 +25,7 @@
   19.28 + tel        ""
   19.29 + fax        ""
   19.30 + language   "Chinese"
   19.31 +-territory  "Taiwan R.O.C."
   19.32 ++territory  "Taiwan"
   19.33 + revision   "0.2"
   19.34 + date       "2000-08-02"
   19.35 + %
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/patches/glibc/ports-2.10.1/280-new-valencian-locale.patch	Fri Nov 13 21:37:18 2009 +0100
    20.3 @@ -0,0 +1,115 @@
    20.4 +http://bugs.gentoo.org/show_bug.cgi?id=131815
    20.5 +http://sourceware.org/bugzilla/show_bug.cgi?id=2522
    20.6 +
    20.7 +diff -durN glibc-2.10.1.orig/localedata/SUPPORTED glibc-2.10.1/localedata/SUPPORTED
    20.8 +--- glibc-2.10.1.orig/localedata/SUPPORTED	2009-04-18 10:43:52.000000000 +0200
    20.9 ++++ glibc-2.10.1/localedata/SUPPORTED	2009-11-13 00:50:20.000000000 +0100
   20.10 +@@ -72,6 +72,8 @@
   20.11 + ca_ES.UTF-8/UTF-8 \
   20.12 + ca_ES/ISO-8859-1 \
   20.13 + ca_ES@euro/ISO-8859-15 \
   20.14 ++ca_ES.UTF-8@valencia/UTF-8 \
   20.15 ++ca_ES@valencia/ISO-8859-15 \
   20.16 + ca_FR.UTF-8/UTF-8 \
   20.17 + ca_FR/ISO-8859-15 \
   20.18 + ca_IT.UTF-8/UTF-8 \
   20.19 +diff -durN glibc-2.10.1.orig/localedata/locales/ca_ES@valencia glibc-2.10.1/localedata/locales/ca_ES@valencia
   20.20 +--- glibc-2.10.1.orig/localedata/locales/ca_ES@valencia	1970-01-01 01:00:00.000000000 +0100
   20.21 ++++ glibc-2.10.1/localedata/locales/ca_ES@valencia	2009-11-13 00:50:20.000000000 +0100
   20.22 +@@ -0,0 +1,96 @@
   20.23 ++comment_char %
   20.24 ++escape_char  /
   20.25 ++%
   20.26 ++% Valencian (southern Catalan) locale for Spain with Euro
   20.27 ++%
   20.28 ++% Note that this locale is almost the same as ca_ES@euro.  The point of having
   20.29 ++% a separate locale is only for PO translations, which have a lot of social
   20.30 ++% support and are very appreciated by the Valencian-speaking community.
   20.31 ++%
   20.32 ++% Contact: Jordi Mallach
   20.33 ++% Email: jordi@gnu.org
   20.34 ++% Tel:
   20.35 ++% Fax:
   20.36 ++% Language: ca
   20.37 ++% Territory: ES
   20.38 ++% Option: euro
   20.39 ++% Revision: 1.0
   20.40 ++% Date: 2006-04-06
   20.41 ++% Application: general
   20.42 ++% Users: general
   20.43 ++% Repertoiremap: mnemonic,ds
   20.44 ++% Charset: ISO-8859-15
   20.45 ++% Distribution and use is free, also
   20.46 ++% for commercial purposes.
   20.47 ++
   20.48 ++LC_IDENTIFICATION
   20.49 ++title      "Valencian (southern Catalan) locale for Spain with Euro"
   20.50 ++source     ""
   20.51 ++address    ""
   20.52 ++contact    "Jordi Mallach"
   20.53 ++email      "jordi@gnu.org"
   20.54 ++tel        ""
   20.55 ++fax        ""
   20.56 ++language   "Catalan"
   20.57 ++territory  "Spain"
   20.58 ++revision   "1.0"
   20.59 ++date       "2006-04-06"
   20.60 ++%
   20.61 ++category  "ca_ES@valencia:2006";LC_IDENTIFICATION
   20.62 ++category  "ca_ES@valencia:2006";LC_CTYPE
   20.63 ++category  "ca_ES@valencia:2006";LC_COLLATE
   20.64 ++category  "ca_ES@valencia:2006";LC_MONETARY
   20.65 ++category  "ca_ES@valencia:2006";LC_NUMERIC
   20.66 ++category  "ca_ES@valencia:2006";LC_TIME
   20.67 ++category  "ca_ES@valencia:2006";LC_MESSAGES
   20.68 ++category  "ca_ES@valencia:2006";LC_PAPER
   20.69 ++category  "ca_ES@valencia:2006";LC_NAME
   20.70 ++category  "ca_ES@valencia:2006";LC_ADDRESS
   20.71 ++category  "ca_ES@valencia:2006";LC_TELEPHONE
   20.72 ++category  "ca_ES@valencia:2006";LC_MEASUREMENT
   20.73 ++
   20.74 ++END LC_IDENTIFICATION
   20.75 ++
   20.76 ++LC_CTYPE
   20.77 ++copy "i18n"
   20.78 ++END LC_CTYPE
   20.79 ++
   20.80 ++LC_COLLATE
   20.81 ++copy "ca_ES"
   20.82 ++END LC_COLLATE
   20.83 ++
   20.84 ++LC_MONETARY
   20.85 ++copy "ca_ES"
   20.86 ++END LC_MONETARY
   20.87 ++
   20.88 ++LC_NUMERIC
   20.89 ++copy "ca_ES"
   20.90 ++END LC_NUMERIC
   20.91 ++
   20.92 ++LC_TIME
   20.93 ++copy "ca_ES"
   20.94 ++END LC_TIME
   20.95 ++
   20.96 ++LC_MESSAGES
   20.97 ++copy "ca_ES"
   20.98 ++END LC_MESSAGES
   20.99 ++
  20.100 ++LC_PAPER
  20.101 ++copy "ca_ES"
  20.102 ++END LC_PAPER
  20.103 ++
  20.104 ++LC_NAME
  20.105 ++copy "ca_ES"
  20.106 ++END LC_NAME
  20.107 ++
  20.108 ++LC_ADDRESS
  20.109 ++copy "ca_ES"
  20.110 ++END LC_ADDRESS
  20.111 ++
  20.112 ++LC_TELEPHONE
  20.113 ++copy "ca_ES"
  20.114 ++END LC_TELEPHONE
  20.115 ++
  20.116 ++LC_MEASUREMENT
  20.117 ++copy "ca_ES"
  20.118 ++END LC_MEASUREMENT
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/patches/glibc/ports-2.10.1/290-undefine-__i686.patch	Fri Nov 13 21:37:18 2009 +0100
    21.3 @@ -0,0 +1,42 @@
    21.4 +If gcc is configured to generate i686 code or better by default (like 
    21.5 +when using the --with-arch=pentium3 configure option), then the __i686
    21.6 +macro will always be defined automatically and thus screw up the
    21.7 +compilation of some .S files.
    21.8 +http://bugs.gentoo.org/131108
    21.9 +http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html
   21.10 +
   21.11 +2006-04-25  Mike Frysinger  <vapier@gentoo.org>
   21.12 +
   21.13 +	* sysdeps/i386/sysdep.h (__i686): Undefine.
   21.14 +
   21.15 +diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c
   21.16 +--- glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2007-06-17 20:02:01.000000000 +0200
   21.17 ++++ glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c	2009-11-13 00:50:22.000000000 +0100
   21.18 +@@ -45,6 +45,9 @@
   21.19 + /* Embed an #include to pull in the alignment and .end directives. */
   21.20 + asm ("\n#include \"defs.h\"");
   21.21 + 
   21.22 ++/* Embed an #include to pull in asm settings. */
   21.23 ++asm ("\n#ifdef __i686__\n#include <sysdep.h>\n#endif");
   21.24 ++
   21.25 + /* The initial common code ends here. */
   21.26 + asm ("\n/*@HEADER_ENDS*/");
   21.27 + 
   21.28 +diff -durN glibc-2.10.1.orig/sysdeps/i386/sysdep.h glibc-2.10.1/sysdeps/i386/sysdep.h
   21.29 +--- glibc-2.10.1.orig/sysdeps/i386/sysdep.h	2006-10-28 08:44:03.000000000 +0200
   21.30 ++++ glibc-2.10.1/sysdeps/i386/sysdep.h	2009-11-13 00:50:22.000000000 +0100
   21.31 +@@ -18,6 +18,14 @@
   21.32 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   21.33 +    02111-1307 USA.  */
   21.34 + 
   21.35 ++/*
   21.36 ++ * When building for i686 targets or better, gcc automatically defines
   21.37 ++ * '__i686' to '1' for us which causes trouble when using section names
   21.38 ++ * like '__i686.get_pc_thunk.reg'.  Since we check for __i686__ in the
   21.39 ++ * code, killing '__i686' shouldn't be a problem.
   21.40 ++ */
   21.41 ++#undef __i686
   21.42 ++
   21.43 + #include <sysdeps/generic/sysdep.h>
   21.44 + 
   21.45 + #ifdef	__ASSEMBLER__
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/patches/glibc/ports-2.10.1/300-nscd-one-fork.patch	Fri Nov 13 21:37:18 2009 +0100
    22.3 @@ -0,0 +1,40 @@
    22.4 +only fork one to assist in stop-start-daemon assumptions about daemon behavior
    22.5 +
    22.6 +http://bugs.gentoo.org/190785
    22.7 +
    22.8 +diff -durN glibc-2.10.1.orig/nscd/nscd.c glibc-2.10.1/nscd/nscd.c
    22.9 +--- glibc-2.10.1.orig/nscd/nscd.c	2009-02-06 21:10:27.000000000 +0100
   22.10 ++++ glibc-2.10.1/nscd/nscd.c	2009-11-13 00:50:24.000000000 +0100
   22.11 +@@ -182,6 +182,9 @@
   22.12 +       if (pid != 0)
   22.13 + 	exit (0);
   22.14 + 
   22.15 ++       if (write_pid (_PATH_NSCDPID) < 0)
   22.16 ++	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
   22.17 ++
   22.18 +       int nullfd = open (_PATH_DEVNULL, O_RDWR);
   22.19 +       if (nullfd != -1)
   22.20 + 	{
   22.21 +@@ -231,12 +234,6 @@
   22.22 + 	for (i = min_close_fd; i < getdtablesize (); i++)
   22.23 + 	  close (i);
   22.24 + 
   22.25 +-      pid = fork ();
   22.26 +-      if (pid == -1)
   22.27 +-	error (EXIT_FAILURE, errno, _("cannot fork"));
   22.28 +-      if (pid != 0)
   22.29 +-	exit (0);
   22.30 +-
   22.31 +       setsid ();
   22.32 + 
   22.33 +       if (chdir ("/") != 0)
   22.34 +@@ -245,9 +242,6 @@
   22.35 + 
   22.36 +       openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
   22.37 + 
   22.38 +-      if (write_pid (_PATH_NSCDPID) < 0)
   22.39 +-        dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
   22.40 +-
   22.41 +       if (!init_logfile ())
   22.42 + 	dbg_log (_("Could not create log file"));
   22.43 + 
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/patches/glibc/ports-2.10.1/310-hppa-nptl-carlos.patch	Fri Nov 13 21:37:18 2009 +0100
    23.3 @@ -0,0 +1,246 @@
    23.4 +
    23.5 +
    23.6 +diff -durN glibc-2.10.1.orig/elf/rtld.c glibc-2.10.1/elf/rtld.c
    23.7 +--- glibc-2.10.1.orig/elf/rtld.c	2009-04-17 02:00:08.000000000 +0200
    23.8 ++++ glibc-2.10.1/elf/rtld.c	2009-11-13 00:50:26.000000000 +0100
    23.9 +@@ -384,14 +384,14 @@
   23.10 +      know it is available.  We do not have to clear the memory if we
   23.11 +      do not have to use the temporary bootstrap_map.  Global variables
   23.12 +      are initialized to zero by default.  */
   23.13 +-#ifndef DONT_USE_BOOTSTRAP_MAP
   23.14 ++#if !defined DONT_USE_BOOTSTRAP_MAP
   23.15 + # ifdef HAVE_BUILTIN_MEMSET
   23.16 +   __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
   23.17 + # else
   23.18 +-  for (size_t cnt = 0;
   23.19 +-       cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
   23.20 +-       ++cnt)
   23.21 +-    bootstrap_map.l_info[cnt] = 0;
   23.22 ++  /* Clear the whole bootstrap_map structure */
   23.23 ++  for (char *cnt = (char *)&(bootstrap_map);
   23.24 ++       cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
   23.25 ++       *cnt++ = '\0');
   23.26 + # endif
   23.27 + # if USE___THREAD
   23.28 +   bootstrap_map.l_tls_modid = 0;
   23.29 +diff -durN glibc-2.10.1.orig/include/atomic.h glibc-2.10.1/include/atomic.h
   23.30 +--- glibc-2.10.1.orig/include/atomic.h	2009-02-09 00:49:53.000000000 +0100
   23.31 ++++ glibc-2.10.1/include/atomic.h	2009-11-13 00:50:26.000000000 +0100
   23.32 +@@ -174,7 +174,7 @@
   23.33 +      __typeof (*(mem)) __atg5_value = (newvalue);			      \
   23.34 + 									      \
   23.35 +      do									      \
   23.36 +-       __atg5_oldval = *__atg5_memp;					      \
   23.37 ++       __atg5_oldval = *(volatile __typeof (mem))__atg5_memp;		      \
   23.38 +      while (__builtin_expect						      \
   23.39 + 	    (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
   23.40 + 						   __atg5_oldval), 0));	      \
   23.41 +@@ -195,7 +195,7 @@
   23.42 +      __typeof (*(mem)) __atg6_value = (value);				      \
   23.43 + 									      \
   23.44 +      do									      \
   23.45 +-       __atg6_oldval = *__atg6_memp;					      \
   23.46 ++       __atg6_oldval = *(volatile __typeof (mem))__atg6_memp;		      \
   23.47 +      while (__builtin_expect						      \
   23.48 + 	    (atomic_compare_and_exchange_bool_acq (__atg6_memp,		      \
   23.49 + 						   __atg6_oldval	      \
   23.50 +@@ -213,7 +213,7 @@
   23.51 +      __typeof (*(mem)) __atg7_value = (value);				      \
   23.52 + 									      \
   23.53 +      do									      \
   23.54 +-       __atg7_oldv = *__atg7_memp;					      \
   23.55 ++       __atg7_oldv = *(volatile __typeof (mem))__atg7_memp;		      \
   23.56 +      while (__builtin_expect						      \
   23.57 + 	    (catomic_compare_and_exchange_bool_acq (__atg7_memp,	      \
   23.58 + 						    __atg7_oldv		      \
   23.59 +@@ -231,7 +231,7 @@
   23.60 +     __typeof (mem) __atg8_memp = (mem);					      \
   23.61 +     __typeof (*(mem)) __atg8_value = (value);				      \
   23.62 +     do {								      \
   23.63 +-      __atg8_oldval = *__atg8_memp;					      \
   23.64 ++      __atg8_oldval = *(volatile __typeof (mem))__atg8_memp;		      \
   23.65 +       if (__atg8_oldval >= __atg8_value)				      \
   23.66 + 	break;								      \
   23.67 +     } while (__builtin_expect						      \
   23.68 +@@ -248,7 +248,7 @@
   23.69 +     __typeof (mem) __atg9_memp = (mem);					      \
   23.70 +     __typeof (*(mem)) __atg9_value = (value);				      \
   23.71 +     do {								      \
   23.72 +-      __atg9_oldv = *__atg9_memp;					      \
   23.73 ++      __atg9_oldv = *(volatile __typeof (mem))__atg9_memp;		      \
   23.74 +       if (__atg9_oldv >= __atg9_value)					      \
   23.75 + 	break;								      \
   23.76 +     } while (__builtin_expect						      \
   23.77 +@@ -266,7 +266,7 @@
   23.78 +     __typeof (mem) __atg10_memp = (mem);				      \
   23.79 +     __typeof (*(mem)) __atg10_value = (value);				      \
   23.80 +     do {								      \
   23.81 +-      __atg10_oldval = *__atg10_memp;					      \
   23.82 ++      __atg10_oldval = *(volatile __typeof (mem))__atg10_memp;		      \
   23.83 +       if (__atg10_oldval <= __atg10_value)				      \
   23.84 + 	break;								      \
   23.85 +     } while (__builtin_expect						      \
   23.86 +@@ -350,7 +350,7 @@
   23.87 + 									      \
   23.88 +      do									      \
   23.89 +        {								      \
   23.90 +-	 __atg11_oldval = *__atg11_memp;				      \
   23.91 ++	 __atg11_oldval = *(volatile __typeof (mem))__atg11_memp;	      \
   23.92 + 	 if (__builtin_expect (__atg11_oldval <= 0, 0))			      \
   23.93 + 	   break;							      \
   23.94 +        }								      \
   23.95 +@@ -389,7 +389,7 @@
   23.96 +      __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit));	      \
   23.97 + 									      \
   23.98 +      do									      \
   23.99 +-       __atg14_old = (*__atg14_memp);					      \
  23.100 ++       __atg14_old = (*(volatile __typeof (mem))__atg14_memp);		      \
  23.101 +      while (__builtin_expect						      \
  23.102 + 	    (atomic_compare_and_exchange_bool_acq (__atg14_memp,	      \
  23.103 + 						   __atg14_old | __atg14_mask,\
  23.104 +@@ -407,7 +407,7 @@
  23.105 +     __typeof (*(mem)) __atg15_mask = (mask);				      \
  23.106 + 									      \
  23.107 +     do									      \
  23.108 +-      __atg15_old = (*__atg15_memp);					      \
  23.109 ++      __atg15_old = (*(volatile __typeof (mem))__atg15_memp);		      \
  23.110 +     while (__builtin_expect						      \
  23.111 + 	   (atomic_compare_and_exchange_bool_acq (__atg15_memp,		      \
  23.112 + 						  __atg15_old & __atg15_mask, \
  23.113 +@@ -439,7 +439,7 @@
  23.114 +      __typeof (*(mem)) __atg16_mask = (mask);				      \
  23.115 + 									      \
  23.116 +      do									      \
  23.117 +-       __atg16_old = (*__atg16_memp);					      \
  23.118 ++       __atg16_old = (*(volatile __typeof (mem))__atg16_memp);		      \
  23.119 +      while (__builtin_expect						      \
  23.120 + 	    (atomic_compare_and_exchange_bool_acq (__atg16_memp,	      \
  23.121 + 						   __atg16_old & __atg16_mask,\
  23.122 +@@ -457,7 +457,7 @@
  23.123 +     __typeof (*(mem)) __atg17_mask = (mask);				      \
  23.124 + 									      \
  23.125 +     do									      \
  23.126 +-      __atg17_old = (*__atg17_memp);					      \
  23.127 ++      __atg17_old = (*(volatile __typeof (mem))__atg17_memp);		      \
  23.128 +     while (__builtin_expect						      \
  23.129 + 	   (atomic_compare_and_exchange_bool_acq (__atg17_memp,		      \
  23.130 + 						  __atg17_old | __atg17_mask, \
  23.131 +@@ -473,7 +473,7 @@
  23.132 +     __typeof (*(mem)) __atg18_mask = (mask);				      \
  23.133 + 									      \
  23.134 +     do									      \
  23.135 +-      __atg18_old = (*__atg18_memp);					      \
  23.136 ++      __atg18_old = (*(volatile __typeof (mem))__atg18_memp);		      \
  23.137 +     while (__builtin_expect						      \
  23.138 + 	   (catomic_compare_and_exchange_bool_acq (__atg18_memp,	      \
  23.139 + 						   __atg18_old | __atg18_mask,\
  23.140 +@@ -489,7 +489,7 @@
  23.141 +      __typeof (*(mem)) __atg19_mask = (mask);				      \
  23.142 + 									      \
  23.143 +      do									      \
  23.144 +-       __atg19_old = (*__atg19_memp);					      \
  23.145 ++       __atg19_old = (*(volatile __typeof (mem))__atg19_memp);		      \
  23.146 +      while (__builtin_expect						      \
  23.147 + 	    (atomic_compare_and_exchange_bool_acq (__atg19_memp,	      \
  23.148 + 						   __atg19_old | __atg19_mask,\
  23.149 +diff -durN glibc-2.10.1.orig/nptl/Makefile glibc-2.10.1/nptl/Makefile
  23.150 +--- glibc-2.10.1.orig/nptl/Makefile	2008-11-12 14:38:23.000000000 +0100
  23.151 ++++ glibc-2.10.1/nptl/Makefile	2009-11-13 00:50:26.000000000 +0100
  23.152 +@@ -262,9 +262,9 @@
  23.153 + # Files which must not be linked with libpthread.
  23.154 + tests-nolibpthread = tst-unload
  23.155 + 
  23.156 +-# This sets the stack resource limit to 1023kb, which is not a multiple
  23.157 +-# of the page size since every architecture's page size is > 1k.
  23.158 +-tst-oddstacklimit-ENV = ; ulimit -s 1023;
  23.159 ++# This sets the stack resource limit to 8193kb, which is not a multiple
  23.160 ++# of the page size since every architecture's page size is 4096 bytes.
  23.161 ++tst-oddstacklimit-ENV = ; ulimit -s 8193;
  23.162 + 
  23.163 + distribute = eintr.c tst-cleanup4aux.c
  23.164 + 
  23.165 +@@ -423,6 +423,35 @@
  23.166 + CFLAGS-tst-cleanupx4.c += -fexceptions
  23.167 + CFLAGS-tst-oncex3.c += -fexceptions
  23.168 + CFLAGS-tst-oncex4.c += -fexceptions
  23.169 ++
  23.170 ++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
  23.171 ++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
  23.172 ++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
  23.173 ++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
  23.174 ++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
  23.175 ++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
  23.176 ++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
  23.177 ++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
  23.178 ++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
  23.179 ++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
  23.180 ++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
  23.181 ++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
  23.182 ++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
  23.183 ++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
  23.184 ++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
  23.185 ++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
  23.186 ++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
  23.187 ++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
  23.188 ++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
  23.189 ++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
  23.190 ++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
  23.191 ++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
  23.192 ++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
  23.193 ++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
  23.194 ++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
  23.195 ++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
  23.196 ++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
  23.197 ++
  23.198 + CFLAGS-tst-align.c += $(stack-align-test-flags)
  23.199 + CFLAGS-tst-align3.c += $(stack-align-test-flags)
  23.200 + CFLAGS-tst-initializers1.c = -W -Wall -Werror
  23.201 +diff -durN glibc-2.10.1.orig/nptl/pthread_barrier_wait.c glibc-2.10.1/nptl/pthread_barrier_wait.c
  23.202 +--- glibc-2.10.1.orig/nptl/pthread_barrier_wait.c	2007-08-01 06:18:50.000000000 +0200
  23.203 ++++ glibc-2.10.1/nptl/pthread_barrier_wait.c	2009-11-13 00:50:26.000000000 +0100
  23.204 +@@ -64,7 +64,7 @@
  23.205 +       do
  23.206 + 	lll_futex_wait (&ibarrier->curr_event, event,
  23.207 + 			ibarrier->private ^ FUTEX_PRIVATE_FLAG);
  23.208 +-      while (event == ibarrier->curr_event);
  23.209 ++      while (event == *(volatile unsigned int *)&ibarrier->curr_event);
  23.210 +     }
  23.211 + 
  23.212 +   /* Make sure the init_count is stored locally or in a register.  */
  23.213 +diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/Makefile glibc-2.10.1/nptl/sysdeps/pthread/Makefile
  23.214 +--- glibc-2.10.1.orig/nptl/sysdeps/pthread/Makefile	2006-02-28 08:09:41.000000000 +0100
  23.215 ++++ glibc-2.10.1/nptl/sysdeps/pthread/Makefile	2009-11-13 00:50:26.000000000 +0100
  23.216 +@@ -41,7 +41,9 @@
  23.217 + 
  23.218 + ifeq ($(have-forced-unwind),yes)
  23.219 + tests += tst-mqueue8x
  23.220 ++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
  23.221 + CFLAGS-tst-mqueue8x.c += -fexceptions
  23.222 ++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s) 
  23.223 + endif
  23.224 + endif
  23.225 + 
  23.226 +diff -durN glibc-2.10.1.orig/stdio-common/Makefile glibc-2.10.1/stdio-common/Makefile
  23.227 +--- glibc-2.10.1.orig/stdio-common/Makefile	2009-04-11 07:29:56.000000000 +0200
  23.228 ++++ glibc-2.10.1/stdio-common/Makefile	2009-11-13 00:50:26.000000000 +0100
  23.229 +@@ -82,7 +82,7 @@
  23.230 + 	$(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
  23.231 + endif
  23.232 + 
  23.233 +-CFLAGS-vfprintf.c = -Wno-uninitialized
  23.234 ++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
  23.235 + CFLAGS-vfwprintf.c = -Wno-uninitialized
  23.236 + CFLAGS-tst-printf.c = -Wno-format
  23.237 + CFLAGS-tstdiomisc.c = -Wno-format
  23.238 +diff -durN glibc-2.10.1.orig/sunrpc/clnt_udp.c glibc-2.10.1/sunrpc/clnt_udp.c
  23.239 +--- glibc-2.10.1.orig/sunrpc/clnt_udp.c	2008-07-26 10:42:44.000000000 +0200
  23.240 ++++ glibc-2.10.1/sunrpc/clnt_udp.c	2009-11-13 00:50:26.000000000 +0100
  23.241 +@@ -462,7 +462,7 @@
  23.242 +       while (inlen < 0 && errno == EINTR);
  23.243 +       if (inlen < 0)
  23.244 + 	{
  23.245 +-	  if (errno == EWOULDBLOCK)
  23.246 ++	  if (errno == EWOULDBLOCK || errno == EAGAIN)
  23.247 + 	    continue;
  23.248 + 	  cu->cu_error.re_errno = errno;
  23.249 + 	  return (cu->cu_error.re_status = RPC_CANTRECV);
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/patches/glibc/ports-2.10.1/320-hppa-pie.patch	Fri Nov 13 21:37:18 2009 +0100
    24.3 @@ -0,0 +1,29 @@
    24.4 +
    24.5 +
    24.6 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/hppa/elf/start.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/hppa/elf/start.S
    24.7 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/hppa/elf/start.S	2009-05-16 10:36:20.000000000 +0200
    24.8 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/hppa/elf/start.S	2009-11-13 00:50:28.000000000 +0100
    24.9 +@@ -96,16 +96,16 @@
   24.10 + 
   24.11 + #if SHARED
   24.12 + 	/* load main (1st argument) */
   24.13 +-	addil	LR'.Lpmain, %r19
   24.14 +-	ldw	RR'.Lpmain(%r1), %r26
   24.15 ++	addil	LT'.Lpmain, %r19
   24.16 ++	ldw	RT'.Lpmain(%r1), %r26
   24.17 + 	ldw	0(%r26),%r26
   24.18 + 	/* void (*init) (void) (4th argument) */
   24.19 +-	addil	LR'.Lp__libc_csu_init, %r19
   24.20 +-	ldw	RR'.Lp__libc_csu_init(%r1), %r23
   24.21 ++	addil	LT'.Lp__libc_csu_init, %r19
   24.22 ++	ldw	RT'.Lp__libc_csu_init(%r1), %r23
   24.23 + 	ldw	0(%r23), %r23
   24.24 + 	/* void (*fini) (void) (5th argument) */
   24.25 +-	addil	LR'.Lp__libc_csu_fini, %r19
   24.26 +-	ldw	RR'.Lp__libc_csu_fini(%r1), %r22
   24.27 ++	addil	LT'.Lp__libc_csu_fini, %r19
   24.28 ++	ldw	RT'.Lp__libc_csu_fini(%r1), %r22
   24.29 + 	ldw	0(%r22), %r22
   24.30 + #else
   24.31 + 	/* load main (1st argument) */
   24.32 +diff -durN glibc-2.10.1.orig/ports/sysdeps/hppa/elf/start.S glibc-2.10.1/ports/sysdeps/hppa/elf/start.S
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/patches/glibc/ports-2.10.1/330-m68k-sys-user.patch	Fri Nov 13 21:37:18 2009 +0100
    25.3 @@ -0,0 +1,97 @@
    25.4 +copied from kernel as it is sanitized now
    25.5 +
    25.6 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/m68k/sys/user.h
    25.7 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/m68k/sys/user.h	2009-05-16 10:36:20.000000000 +0200
    25.8 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/m68k/sys/user.h	2009-11-13 00:50:31.000000000 +0100
    25.9 +@@ -1,3 +1,90 @@
   25.10 ++#ifndef _SYS_USER_H
   25.11 ++#define _SYS_USER_H
   25.12 ++
   25.13 ++/* Core file format: The core file is written in such a way that gdb
   25.14 ++   can understand it and provide useful information to the user (under
   25.15 ++   linux we use the 'trad-core' bfd).  There are quite a number of
   25.16 ++   obstacles to being able to view the contents of the floating point
   25.17 ++   registers, and until these are solved you will not be able to view the
   25.18 ++   contents of them.  Actually, you can read in the core file and look at
   25.19 ++   the contents of the user struct to find out what the floating point
   25.20 ++   registers contain.
   25.21 ++   The actual file contents are as follows:
   25.22 ++   UPAGE: 1 page consisting of a user struct that tells gdb what is present
   25.23 ++   in the file.  Directly after this is a copy of the task_struct, which
   25.24 ++   is currently not used by gdb, but it may come in useful at some point.
   25.25 ++   All of the registers are stored as part of the upage.  The upage should
   25.26 ++   always be only one page.
   25.27 ++   DATA: The data area is stored.  We use current->end_text to
   25.28 ++   current->brk to pick up all of the user variables, plus any memory
   25.29 ++   that may have been malloced.  No attempt is made to determine if a page
   25.30 ++   is demand-zero or if a page is totally unused, we just cover the entire
   25.31 ++   range.  All of the addresses are rounded in such a way that an integral
   25.32 ++   number of pages is written.
   25.33 ++   STACK: We need the stack information in order to get a meaningful
   25.34 ++   backtrace.  We need to write the data from (esp) to
   25.35 ++   current->start_stack, so we round each of these off in order to be able
   25.36 ++   to write an integer number of pages.
   25.37 ++   The minimum core file size is 3 pages, or 12288 bytes.
   25.38 ++*/
   25.39 ++
   25.40 ++struct user_m68kfp_struct {
   25.41 ++	unsigned long  fpregs[8*3];	/* fp0-fp7 registers */
   25.42 ++	unsigned long  fpcntl[3];	/* fp control regs */
   25.43 ++};
   25.44 ++
   25.45 ++/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
   25.46 ++   is still the layout used by user (the new pt_regs doesn't have
   25.47 ++   all registers). */
   25.48 ++struct user_regs_struct {
   25.49 ++	long d1,d2,d3,d4,d5,d6,d7;
   25.50 ++	long a0,a1,a2,a3,a4,a5,a6;
   25.51 ++	long d0;
   25.52 ++	long usp;
   25.53 ++	long orig_d0;
   25.54 ++	short stkadj;
   25.55 ++	short sr;
   25.56 ++	long pc;
   25.57 ++	short fmtvec;
   25.58 ++	short __fill;
   25.59 ++};
   25.60 ++
   25.61 ++
   25.62 ++/* When the kernel dumps core, it starts by dumping the user struct -
   25.63 ++   this will be used by gdb to figure out where the data and stack segments
   25.64 ++   are within the file, and what virtual addresses to use. */
   25.65 ++struct user{
   25.66 ++/* We start with the registers, to mimic the way that "memory" is returned
   25.67 ++   from the ptrace(3,...) function.  */
   25.68 ++  struct user_regs_struct regs;	/* Where the registers are actually stored */
   25.69 ++/* ptrace does not yet supply these.  Someday.... */
   25.70 ++  int u_fpvalid;		/* True if math co-processor being used. */
   25.71 ++                                /* for this mess. Not yet used. */
   25.72 ++  struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
   25.73 ++/* The rest of this junk is to help gdb figure out what goes where */
   25.74 ++  unsigned long int u_tsize;	/* Text segment size (pages). */
   25.75 ++  unsigned long int u_dsize;	/* Data segment size (pages). */
   25.76 ++  unsigned long int u_ssize;	/* Stack segment size (pages). */
   25.77 ++  unsigned long start_code;     /* Starting virtual address of text. */
   25.78 ++  unsigned long start_stack;	/* Starting virtual address of stack area.
   25.79 ++				   This is actually the bottom of the stack,
   25.80 ++				   the top of the stack is always found in the
   25.81 ++				   esp register.  */
   25.82 ++  long int signal;		/* Signal that caused the core dump. */
   25.83 ++  int reserved;			/* No longer used */
   25.84 ++  struct user_regs_struct *u_ar0;
   25.85 ++				/* Used by gdb to help find the values for */
   25.86 ++				/* the registers. */
   25.87 ++  struct user_m68kfp_struct* u_fpstate;	/* Math Co-processor pointer. */
   25.88 ++  unsigned long magic;		/* To uniquely identify a core file */
   25.89 ++  char u_comm[32];		/* User command that was responsible */
   25.90 ++};
   25.91 ++#define NBPG 4096
   25.92 ++#define UPAGES 1
   25.93 ++#define HOST_TEXT_START_ADDR (u.start_code)
   25.94 ++#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
   25.95 ++
   25.96 ++#endif
   25.97 + /* Copyright (C) 2008 Free Software Foundation, Inc.
   25.98 +    This file is part of the GNU C Library.
   25.99 + 
  25.100 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/patches/glibc/ports-2.10.1/340-dl_execstack-PaX-support.patch	Fri Nov 13 21:37:18 2009 +0100
    26.3 @@ -0,0 +1,66 @@
    26.4 +	With latest versions of glibc, a lot of apps failed on a PaX enabled
    26.5 +	system with:
    26.6 +		 cannot enable executable stack as shared object requires: Permission denied
    26.7 +	
    26.8 +	This is due to PaX 'exec-protecting' the stack, and ld.so then trying
    26.9 +	to make the stack executable due to some libraries not containing the
   26.10 +	PT_GNU_STACK section.  Bug #32960.  <azarah@gentoo.org> (12 Nov 2003).
   26.11 +
   26.12 +	Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
   26.13 +
   26.14 +diff -durN glibc-2.10.1.orig/nptl/allocatestack.c glibc-2.10.1/nptl/allocatestack.c
   26.15 +--- glibc-2.10.1.orig/nptl/allocatestack.c	2009-01-29 21:34:16.000000000 +0100
   26.16 ++++ glibc-2.10.1/nptl/allocatestack.c	2009-11-13 00:50:33.000000000 +0100
   26.17 +@@ -326,7 +326,8 @@
   26.18 + # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
   26.19 + #endif
   26.20 +   if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
   26.21 +-    return errno;
   26.22 ++    if (errno != EACCES) /* PAX is enabled */
   26.23 ++    	return errno;
   26.24 + 
   26.25 +   return 0;
   26.26 + }
   26.27 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.10.1/sysdeps/unix/sysv/linux/dl-execstack.c
   26.28 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/dl-execstack.c	2006-01-08 09:21:15.000000000 +0100
   26.29 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/dl-execstack.c	2009-11-13 00:50:33.000000000 +0100
   26.30 +@@ -63,7 +63,10 @@
   26.31 +       else
   26.32 + # endif
   26.33 + 	{
   26.34 +-	  result = errno;
   26.35 ++	  if (errno == EACCES)  /* PAX is enabled */
   26.36 ++	    result = 0;
   26.37 ++	  else
   26.38 ++	    result = errno;
   26.39 + 	  goto out;
   26.40 + 	}
   26.41 +     }
   26.42 +@@ -89,7 +92,12 @@
   26.43 + 	page -= size;
   26.44 +       else
   26.45 + 	{
   26.46 +-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
   26.47 ++	  if (errno == EACCES)		/* PAX is enabled */
   26.48 ++	    {
   26.49 ++	      result = 0;
   26.50 ++	      goto out;
   26.51 ++	    }
   26.52 ++	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
   26.53 + 	    {
   26.54 + 	      result = errno;
   26.55 + 	      goto out;
   26.56 +@@ -115,7 +123,12 @@
   26.57 + 	page += size;
   26.58 +       else
   26.59 + 	{
   26.60 +-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
   26.61 ++	  if (errno == EACCES)		/* PAX is enabled */
   26.62 ++	    {
   26.63 ++	      result = 0;
   26.64 ++	      goto out;
   26.65 ++	    }
   26.66 ++	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
   26.67 + 	    {
   26.68 + 	      result = errno;
   26.69 + 	      goto out;
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/patches/glibc/ports-2.10.1/350-pre20040117-pt_pax.patch	Fri Nov 13 21:37:18 2009 +0100
    27.3 @@ -0,0 +1,32 @@
    27.4 +
    27.5 +
    27.6 +diff -durN glibc-2.10.1.orig/elf/elf.h glibc-2.10.1/elf/elf.h
    27.7 +--- glibc-2.10.1.orig/elf/elf.h	2009-04-15 02:15:54.000000000 +0200
    27.8 ++++ glibc-2.10.1/elf/elf.h	2009-11-13 00:50:35.000000000 +0100
    27.9 +@@ -572,6 +572,7 @@
   27.10 + #define PT_GNU_EH_FRAME	0x6474e550	/* GCC .eh_frame_hdr segment */
   27.11 + #define PT_GNU_STACK	0x6474e551	/* Indicates stack executability */
   27.12 + #define PT_GNU_RELRO	0x6474e552	/* Read-only after relocation */
   27.13 ++#define PT_PAX_FLAGS	0x65041580	/* Indicates PaX flag markings */
   27.14 + #define PT_LOSUNW	0x6ffffffa
   27.15 + #define PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
   27.16 + #define PT_SUNWSTACK	0x6ffffffb	/* Stack segment */
   27.17 +@@ -585,6 +586,18 @@
   27.18 + #define PF_X		(1 << 0)	/* Segment is executable */
   27.19 + #define PF_W		(1 << 1)	/* Segment is writable */
   27.20 + #define PF_R		(1 << 2)	/* Segment is readable */
   27.21 ++#define PF_PAGEEXEC	(1 << 4)	/* Enable  PAGEEXEC */
   27.22 ++#define PF_NOPAGEEXEC	(1 << 5)	/* Disable PAGEEXEC */
   27.23 ++#define PF_SEGMEXEC	(1 << 6)	/* Enable  SEGMEXEC */
   27.24 ++#define PF_NOSEGMEXEC	(1 << 7)	/* Disable SEGMEXEC */
   27.25 ++#define PF_MPROTECT	(1 << 8)	/* Enable  MPROTECT */
   27.26 ++#define PF_NOMPROTECT	(1 << 9)	/* Disable MPROTECT */
   27.27 ++#define PF_RANDEXEC	(1 << 10)	/* Enable  RANDEXEC */
   27.28 ++#define PF_NORANDEXEC	(1 << 11)	/* Disable RANDEXEC */
   27.29 ++#define PF_EMUTRAMP	(1 << 12)	/* Enable  EMUTRAMP */
   27.30 ++#define PF_NOEMUTRAMP	(1 << 13)	/* Disable EMUTRAMP */
   27.31 ++#define PF_RANDMMAP	(1 << 14)	/* Enable  RANDMMAP */
   27.32 ++#define PF_NORANDMMAP	(1 << 15)	/* Disable RANDMMAP */
   27.33 + #define PF_MASKOS	0x0ff00000	/* OS-specific */
   27.34 + #define PF_MASKPROC	0xf0000000	/* Processor-specific */
   27.35 + 
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/patches/glibc/ports-2.10.1/360-tests-sandbox-libdl-paths.patch	Fri Nov 13 21:37:18 2009 +0100
    28.3 @@ -0,0 +1,193 @@
    28.4 +when glibc runs its tests, it does so by invoking the local library loader.
    28.5 +in Gentoo, we build/run inside of our "sandbox" which itself is linked against
    28.6 +libdl (so that it can load libraries and pull out symbols).  the trouble
    28.7 +is that when you upgrade from an older glibc to the new one, often times
    28.8 +internal symbols change name or abi.  this is normally OK as you cannot use
    28.9 +libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
   28.10 +we always say "keep all of the glibc libraries from the same build".  but
   28.11 +when glibc runs its tests, it uses dynamic paths to point to its new local
   28.12 +copies of libraries.  if the test doesnt use libdl, then glibc doesnt add
   28.13 +its path, and when sandbox triggers the loading of libdl, glibc does so
   28.14 +from the host system system.  this gets us into the case of all libraries
   28.15 +are from the locally compiled version of glibc except for libdl.so.
   28.16 +
   28.17 +Fix by Wormo
   28.18 +
   28.19 +http://bugs.gentoo.org/56898
   28.20 +
   28.21 +diff -durN glibc-2.10.1.orig/grp/tst_fgetgrent.sh glibc-2.10.1/grp/tst_fgetgrent.sh
   28.22 +--- glibc-2.10.1.orig/grp/tst_fgetgrent.sh	2001-07-06 06:54:46.000000000 +0200
   28.23 ++++ glibc-2.10.1/grp/tst_fgetgrent.sh	2009-11-13 00:50:37.000000000 +0100
   28.24 +@@ -24,7 +24,8 @@
   28.25 + rtld_installed_name=$1; shift
   28.26 + 
   28.27 + testout=${common_objpfx}/grp/tst_fgetgrent.out
   28.28 +-library_path=${common_objpfx}
   28.29 ++# make sure libdl is also in path in case sandbox is in use
   28.30 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   28.31 + 
   28.32 + result=0
   28.33 + 
   28.34 +diff -durN glibc-2.10.1.orig/iconvdata/run-iconv-test.sh glibc-2.10.1/iconvdata/run-iconv-test.sh
   28.35 +--- glibc-2.10.1.orig/iconvdata/run-iconv-test.sh	2008-05-15 03:59:44.000000000 +0200
   28.36 ++++ glibc-2.10.1/iconvdata/run-iconv-test.sh	2009-11-13 00:50:37.000000000 +0100
   28.37 +@@ -34,7 +34,7 @@
   28.38 + export GCONV_PATH
   28.39 + 
   28.40 + # We have to have some directories in the library path.
   28.41 +-LIBPATH=$codir:$codir/iconvdata
   28.42 ++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
   28.43 + 
   28.44 + # How the start the iconv(1) program.
   28.45 + ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
   28.46 +diff -durN glibc-2.10.1.orig/iconvdata/tst-table.sh glibc-2.10.1/iconvdata/tst-table.sh
   28.47 +--- glibc-2.10.1.orig/iconvdata/tst-table.sh	2002-04-24 23:39:35.000000000 +0200
   28.48 ++++ glibc-2.10.1/iconvdata/tst-table.sh	2009-11-13 00:50:37.000000000 +0100
   28.49 +@@ -59,8 +59,11 @@
   28.50 +   irreversible=${charset}.irreversible
   28.51 + fi
   28.52 + 
   28.53 ++# make sure libdl is also in path in case sandbox is in use
   28.54 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   28.55 ++
   28.56 + # iconv in one direction.
   28.57 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
   28.58 ++${common_objpfx}elf/ld.so --library-path $library_path \
   28.59 + ${objpfx}tst-table-from ${charset} \
   28.60 +   > ${objpfx}tst-${charset}.table
   28.61 + 
   28.62 +diff -durN glibc-2.10.1.orig/intl/tst-codeset.sh glibc-2.10.1/intl/tst-codeset.sh
   28.63 +--- glibc-2.10.1.orig/intl/tst-codeset.sh	2005-04-06 04:18:35.000000000 +0200
   28.64 ++++ glibc-2.10.1/intl/tst-codeset.sh	2009-11-13 00:50:37.000000000 +0100
   28.65 +@@ -37,6 +37,9 @@
   28.66 + LOCPATH=${common_objpfx}localedata
   28.67 + export LOCPATH
   28.68 + 
   28.69 ++# make sure libdl is also in path in case sandbox is in use
   28.70 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   28.71 ++
   28.72 + ${common_objpfx}elf/ld.so --library-path $common_objpfx \
   28.73 + ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
   28.74 + 
   28.75 +diff -durN glibc-2.10.1.orig/intl/tst-gettext.sh glibc-2.10.1/intl/tst-gettext.sh
   28.76 +--- glibc-2.10.1.orig/intl/tst-gettext.sh	2004-08-15 21:28:18.000000000 +0200
   28.77 ++++ glibc-2.10.1/intl/tst-gettext.sh	2009-11-13 00:50:37.000000000 +0100
   28.78 +@@ -51,9 +51,12 @@
   28.79 + LOCPATH=${common_objpfx}localedata
   28.80 + export LOCPATH
   28.81 + 
   28.82 ++# make sure libdl is also in path in case sandbox is in use
   28.83 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   28.84 ++
   28.85 + # Now run the test.
   28.86 + MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
   28.87 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
   28.88 ++${common_objpfx}elf/ld.so --library-path $library_path \
   28.89 + ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
   28.90 + 
   28.91 + exit $?
   28.92 +diff -durN glibc-2.10.1.orig/intl/tst-gettext2.sh glibc-2.10.1/intl/tst-gettext2.sh
   28.93 +--- glibc-2.10.1.orig/intl/tst-gettext2.sh	2005-05-04 19:54:48.000000000 +0200
   28.94 ++++ glibc-2.10.1/intl/tst-gettext2.sh	2009-11-13 00:50:37.000000000 +0100
   28.95 +@@ -65,8 +65,11 @@
   28.96 + LOCPATH=${objpfx}domaindir
   28.97 + export LOCPATH
   28.98 + 
   28.99 ++# make sure libdl is also in path in case sandbox is in use
  28.100 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  28.101 ++
  28.102 + # Now run the test.
  28.103 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
  28.104 ++${common_objpfx}elf/ld.so --library-path $library_path \
  28.105 + ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
  28.106 + cmp ${objpfx}tst-gettext2.out - <<EOF
  28.107 + String1 - Lang1: 1st string
  28.108 +diff -durN glibc-2.10.1.orig/intl/tst-translit.sh glibc-2.10.1/intl/tst-translit.sh
  28.109 +--- glibc-2.10.1.orig/intl/tst-translit.sh	2005-05-04 19:56:10.000000000 +0200
  28.110 ++++ glibc-2.10.1/intl/tst-translit.sh	2009-11-13 00:50:37.000000000 +0100
  28.111 +@@ -36,7 +36,10 @@
  28.112 + LOCPATH=${common_objpfx}localedata
  28.113 + export LOCPATH
  28.114 + 
  28.115 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
  28.116 ++# make sure libdl is also in path in case sandbox is in use
  28.117 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  28.118 ++
  28.119 ++${common_objpfx}elf/ld.so --library-path $library_path \
  28.120 + ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
  28.121 + 
  28.122 + exit $?
  28.123 +diff -durN glibc-2.10.1.orig/malloc/tst-mtrace.sh glibc-2.10.1/malloc/tst-mtrace.sh
  28.124 +--- glibc-2.10.1.orig/malloc/tst-mtrace.sh	2005-10-15 01:40:35.000000000 +0200
  28.125 ++++ glibc-2.10.1/malloc/tst-mtrace.sh	2009-11-13 00:50:37.000000000 +0100
  28.126 +@@ -24,9 +24,12 @@
  28.127 + status=0
  28.128 + trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
  28.129 + 
  28.130 ++# make sure libdl is also in path in case sandbox is in use
  28.131 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  28.132 ++
  28.133 + MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
  28.134 + LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
  28.135 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
  28.136 ++${common_objpfx}elf/ld.so --library-path $library_path \
  28.137 +   ${common_objpfx}malloc/tst-mtrace || status=1
  28.138 + 
  28.139 + if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
  28.140 +diff -durN glibc-2.10.1.orig/nptl/tst-tls6.sh glibc-2.10.1/nptl/tst-tls6.sh
  28.141 +--- glibc-2.10.1.orig/nptl/tst-tls6.sh	2003-09-03 00:02:59.000000000 +0200
  28.142 ++++ glibc-2.10.1/nptl/tst-tls6.sh	2009-11-13 00:50:37.000000000 +0100
  28.143 +@@ -5,8 +5,8 @@
  28.144 + rtld_installed_name=$1; shift
  28.145 + logfile=$common_objpfx/nptl/tst-tls6.out
  28.146 + 
  28.147 +-# We have to find libc and nptl
  28.148 +-library_path=${common_objpfx}:${common_objpfx}nptl
  28.149 ++# We have to find libc and nptl (also libdl in case sandbox is in use)
  28.150 ++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
  28.151 + tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
  28.152 + 	  ${common_objpfx}/nptl/tst-tls5"
  28.153 + 
  28.154 +diff -durN glibc-2.10.1.orig/posix/globtest.sh glibc-2.10.1/posix/globtest.sh
  28.155 +--- glibc-2.10.1.orig/posix/globtest.sh	2008-12-06 07:05:39.000000000 +0100
  28.156 ++++ glibc-2.10.1/posix/globtest.sh	2009-11-13 00:50:37.000000000 +0100
  28.157 +@@ -18,7 +18,7 @@
  28.158 + esac
  28.159 + 
  28.160 + # We have to find the libc and the NSS modules.
  28.161 +-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
  28.162 ++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
  28.163 + 
  28.164 + # Since we use `sort' we must make sure to use the same locale everywhere.
  28.165 + LC_ALL=C
  28.166 +diff -durN glibc-2.10.1.orig/posix/tst-getconf.sh glibc-2.10.1/posix/tst-getconf.sh
  28.167 +--- glibc-2.10.1.orig/posix/tst-getconf.sh	2002-09-01 13:11:25.000000000 +0200
  28.168 ++++ glibc-2.10.1/posix/tst-getconf.sh	2009-11-13 00:50:37.000000000 +0100
  28.169 +@@ -10,7 +10,10 @@
  28.170 + else
  28.171 +   rtld_installed_name=$1; shift
  28.172 +   runit() {
  28.173 +-    ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
  28.174 ++    
  28.175 ++  # make sure libdl is also in path in case sandbox is in use
  28.176 ++  library_path=${common_objpfx}:${common_objpfx}/dlfcn
  28.177 ++    ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
  28.178 +   }
  28.179 + fi
  28.180 + 
  28.181 +diff -durN glibc-2.10.1.orig/posix/wordexp-tst.sh glibc-2.10.1/posix/wordexp-tst.sh
  28.182 +--- glibc-2.10.1.orig/posix/wordexp-tst.sh	2000-10-20 18:23:30.000000000 +0200
  28.183 ++++ glibc-2.10.1/posix/wordexp-tst.sh	2009-11-13 00:50:37.000000000 +0100
  28.184 +@@ -19,8 +19,11 @@
  28.185 + "
  28.186 + export IFS
  28.187 + 
  28.188 ++# make sure libdl is also in path in case sandbox is in use
  28.189 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  28.190 ++
  28.191 + failed=0
  28.192 +-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
  28.193 ++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
  28.194 + ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
  28.195 + cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
  28.196 + wordexp returned 0
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/patches/glibc/ports-2.10.1/370-fnmatch.patch	Fri Nov 13 21:37:18 2009 +0100
    29.3 @@ -0,0 +1,62 @@
    29.4 +http://sourceware.org/ml/libc-hacker/2002-11/msg00071.html
    29.5 +
    29.6 +When fnmatch detects an invalid multibyte character it should fall back to
    29.7 +single byte matching, so that "*" has a chance to match such a string.
    29.8 +
    29.9 +Andreas.
   29.10 +
   29.11 +2005-04-12  Andreas Schwab  <schwab@suse.de>
   29.12 +
   29.13 +	* posix/fnmatch.c (fnmatch): If conversion to wide character
   29.14 +	fails fall back to single byte matching.
   29.15 +
   29.16 +Index: posix/fnmatch.c
   29.17 +===================================================================
   29.18 +
   29.19 +diff -durN glibc-2.10.1.orig/posix/fnmatch.c glibc-2.10.1/posix/fnmatch.c
   29.20 +--- glibc-2.10.1.orig/posix/fnmatch.c	2007-07-28 22:35:00.000000000 +0200
   29.21 ++++ glibc-2.10.1/posix/fnmatch.c	2009-11-13 00:50:39.000000000 +0100
   29.22 +@@ -327,6 +327,7 @@
   29.23 + # if HANDLE_MULTIBYTE
   29.24 +   if (__builtin_expect (MB_CUR_MAX, 1) != 1)
   29.25 +     {
   29.26 ++      const char *orig_pattern = pattern;
   29.27 +       mbstate_t ps;
   29.28 +       size_t n;
   29.29 +       const char *p;
   29.30 +@@ -382,10 +383,8 @@
   29.31 + 	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
   29.32 + 	  n = mbsrtowcs (wstring, &p, n + 1, &ps);
   29.33 + 	  if (__builtin_expect (n == (size_t) -1, 0))
   29.34 +-	    /* Something wrong.
   29.35 +-	       XXX Do we have to set `errno' to something which mbsrtows hasn't
   29.36 +-	       already done?  */
   29.37 +-	    return -1;
   29.38 ++	    /* Something wrong.  Fall back to single byte matching.  */
   29.39 ++	    goto try_singlebyte;
   29.40 + 	  if (p)
   29.41 + 	    {
   29.42 + 	      memset (&ps, '\0', sizeof (ps));
   29.43 +@@ -397,10 +396,8 @@
   29.44 + 	prepare_wstring:
   29.45 + 	  n = mbsrtowcs (NULL, &string, 0, &ps);
   29.46 + 	  if (__builtin_expect (n == (size_t) -1, 0))
   29.47 +-	    /* Something wrong.
   29.48 +-	       XXX Do we have to set `errno' to something which mbsrtows hasn't
   29.49 +-	       already done?  */
   29.50 +-	    return -1;
   29.51 ++	    /* Something wrong.  Fall back to single byte matching.  */
   29.52 ++	    goto try_singlebyte;
   29.53 + 	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
   29.54 + 	  assert (mbsinit (&ps));
   29.55 + 	  (void) mbsrtowcs (wstring, &string, n + 1, &ps);
   29.56 +@@ -408,6 +405,9 @@
   29.57 + 
   29.58 +       return internal_fnwmatch (wpattern, wstring, wstring + n,
   29.59 + 				flags & FNM_PERIOD, flags, NULL);
   29.60 ++
   29.61 ++    try_singlebyte:
   29.62 ++      pattern = orig_pattern;
   29.63 +     }
   29.64 + # endif  /* mbstate_t and mbsrtowcs or _LIBC.  */
   29.65 + 
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/patches/glibc/ports-2.10.1/380-dont-build-timezone.patch	Fri Nov 13 21:37:18 2009 +0100
    30.3 @@ -0,0 +1,14 @@
    30.4 +timezone data has been split into the package sys-libs/timezone-data
    30.5 +
    30.6 +diff -durN glibc-2.10.1.orig/Makeconfig glibc-2.10.1/Makeconfig
    30.7 +--- glibc-2.10.1.orig/Makeconfig	2009-11-13 00:50:13.000000000 +0100
    30.8 ++++ glibc-2.10.1/Makeconfig	2009-11-13 00:50:41.000000000 +0100
    30.9 +@@ -919,7 +919,7 @@
   30.10 + 	      stdlib stdio-common libio malloc string wcsmbs time dirent    \
   30.11 + 	      grp pwd posix io termios resource misc socket sysvipc gmon    \
   30.12 + 	      gnulib iconv iconvdata wctype manual shadow gshadow po argp   \
   30.13 +-	      crypt nss localedata timezone rt conform debug		    \
   30.14 ++	      crypt nss localedata rt conform debug		    \
   30.15 + 	      $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
   30.16 + 
   30.17 + ifndef avoid-generated
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/patches/glibc/ports-2.10.1/390-cross-compile-nptl.patch	Fri Nov 13 21:37:18 2009 +0100
    31.3 @@ -0,0 +1,52 @@
    31.4 +A little hack for cross-compiling NPTL
    31.5 +
    31.6 +http://sourceware.org/ml/libc-alpha/2005-02/msg00043.html
    31.7 +
    31.8 +diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/configure glibc-2.10.1/nptl/sysdeps/pthread/configure
    31.9 +--- glibc-2.10.1.orig/nptl/sysdeps/pthread/configure	2009-05-17 14:19:31.000000000 +0200
   31.10 ++++ glibc-2.10.1/nptl/sysdeps/pthread/configure	2009-11-13 00:50:43.000000000 +0100
   31.11 +@@ -78,6 +78,10 @@
   31.12 + fi
   31.13 + { echo "$as_me:$LINENO: result: $libc_cv_forced_unwind" >&5
   31.14 + echo "${ECHO_T}$libc_cv_forced_unwind" >&6; }
   31.15 ++if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
   31.16 ++  echo "$as_me:$LINENO: forcing libc_cv_forced_unwind = yes for cross-compile"
   31.17 ++  libc_cv_forced_unwind=yes
   31.18 ++fi
   31.19 + if test $libc_cv_forced_unwind = yes; then
   31.20 +   cat >>confdefs.h <<\_ACEOF
   31.21 + #define HAVE_FORCED_UNWIND 1
   31.22 +@@ -141,6 +145,10 @@
   31.23 + { echo "$as_me:$LINENO: result: $libc_cv_c_cleanup" >&5
   31.24 + echo "${ECHO_T}$libc_cv_c_cleanup" >&6; }
   31.25 +   CFLAGS="$old_CFLAGS"
   31.26 ++  if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
   31.27 ++    echo "$as_me:$LINENO: result: forcing libc_cv_c_cleanup = yes for cross-compile"
   31.28 ++    libc_cv_c_cleanup=yes
   31.29 ++  fi
   31.30 +   if test $libc_cv_c_cleanup = no; then
   31.31 +     { { echo "$as_me:$LINENO: error: the compiler must support C cleanup handling" >&5
   31.32 + echo "$as_me: error: the compiler must support C cleanup handling" >&2;}
   31.33 +diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/configure.in glibc-2.10.1/nptl/sysdeps/pthread/configure.in
   31.34 +--- glibc-2.10.1.orig/nptl/sysdeps/pthread/configure.in	2003-12-03 07:50:01.000000000 +0100
   31.35 ++++ glibc-2.10.1/nptl/sysdeps/pthread/configure.in	2009-11-13 00:50:43.000000000 +0100
   31.36 +@@ -28,6 +28,9 @@
   31.37 + struct _Unwind_Context *context;
   31.38 + _Unwind_GetCFA (context)],
   31.39 + libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)])
   31.40 ++if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
   31.41 ++  libc_cv_forced_unwind=yes
   31.42 ++fi
   31.43 + if test $libc_cv_forced_unwind = yes; then
   31.44 +   AC_DEFINE(HAVE_FORCED_UNWIND)
   31.45 + dnl Check for C cleanup handling.
   31.46 +@@ -41,6 +44,9 @@
   31.47 +   puts ("test")],
   31.48 + libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)])
   31.49 +   CFLAGS="$old_CFLAGS"
   31.50 ++  if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
   31.51 ++    libc_cv_c_cleanup=yes
   31.52 ++  fi
   31.53 +   if test $libc_cv_c_cleanup = no; then
   31.54 +     AC_MSG_ERROR([the compiler must support C cleanup handling])
   31.55 +   fi
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/patches/glibc/ports-2.10.1/400-alpha-xstat.patch	Fri Nov 13 21:37:18 2009 +0100
    32.3 @@ -0,0 +1,250 @@
    32.4 +http://sources.redhat.com/bugzilla/show_bug.cgi?id=1026
    32.5 +http://sourceware.org/ml/libc-alpha/2005-02/msg00122.html
    32.6 +
    32.7 +2005-02-26  GOTO Masanori  <gotom@debian.or.jp>
    32.8 +
    32.9 +	* sysdeps/unix/sysv/linux/kernel-features.h: Define
   32.10 +	__ASSUME_STAT64_SYSCALL.
   32.11 +	* sysdeps/unix/sysv/linux/alpha/fxstat.c: Check
   32.12 +	__ASSUME_STAT64_SYSCALL.
   32.13 +	* sysdeps/unix/sysv/linux/alpha/fxstatat.c: Likewise.
   32.14 +	* sysdeps/unix/sysv/linux/alpha/lxstat.c: Likewise.
   32.15 +	* sysdeps/unix/sysv/linux/alpha/xstat.c: Likewise.
   32.16 +	* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Don't define
   32.17 +	__libc_missing_axp_stat64 when it's not needed.
   32.18 +	* sysdeps/unix/sysv/linux/alpha/xstatconv.h: Likewise.
   32.19 +
   32.20 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstat.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstat.c
   32.21 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstat.c	2009-05-16 10:36:20.000000000 +0200
   32.22 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstat.c	2009-11-13 00:50:45.000000000 +0100
   32.23 +@@ -35,27 +35,39 @@
   32.24 + __fxstat (int vers, int fd, struct stat *buf)
   32.25 + {
   32.26 +   INTERNAL_SYSCALL_DECL (err);
   32.27 +-  int result, errno_out;
   32.28 ++  int result;
   32.29 +   struct kernel_stat kbuf;
   32.30 + 
   32.31 ++#if __ASSUME_STAT64_SYSCALL > 0
   32.32 ++  if (vers == _STAT_VER_KERNEL64)
   32.33 ++    {
   32.34 ++      result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
   32.35 ++      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   32.36 ++	return result;
   32.37 ++      __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
   32.38 ++      return -1;
   32.39 ++    }
   32.40 ++#elif defined __NR_fstat64
   32.41 +   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
   32.42 +     {
   32.43 ++      int errno_out;
   32.44 +       result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
   32.45 +       if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   32.46 + 	return result;
   32.47 +       errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
   32.48 +       if (errno_out != ENOSYS)
   32.49 +-	goto fail;
   32.50 ++	{
   32.51 ++	  __set_errno (errno_out);
   32.52 ++	  return -1;
   32.53 ++	}
   32.54 +       __libc_missing_axp_stat64 = 1;
   32.55 +     }
   32.56 ++#endif
   32.57 + 
   32.58 +   result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf);
   32.59 +   if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   32.60 +     return __xstat_conv (vers, &kbuf, buf);
   32.61 +-  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
   32.62 +-  
   32.63 +- fail:
   32.64 +-  __set_errno (errno_out);
   32.65 ++  __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
   32.66 +   return -1;
   32.67 + }
   32.68 + hidden_def (__fxstat)
   32.69 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstatat.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstatat.c
   32.70 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstatat.c	2009-05-16 10:36:20.000000000 +0200
   32.71 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstatat.c	2009-11-13 00:50:45.000000000 +0100
   32.72 +@@ -65,6 +65,20 @@
   32.73 +   int result, errno_out;
   32.74 +   struct kernel_stat kst;
   32.75 + 
   32.76 ++#if __ASSUME_STAT64_SYSCALL > 0
   32.77 ++  if (vers == _STAT_VER_KERNEL64)
   32.78 ++    {
   32.79 ++      if (flag & AT_SYMLINK_NOFOLLOW)
   32.80 ++	result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
   32.81 ++      else
   32.82 ++	result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
   32.83 ++
   32.84 ++      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   32.85 ++	return result;
   32.86 ++      errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
   32.87 ++      goto fail;
   32.88 ++    }
   32.89 ++#elif defined __NR_stat64
   32.90 +   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
   32.91 +     {
   32.92 +       if (flag & AT_SYMLINK_NOFOLLOW)
   32.93 +@@ -79,6 +93,7 @@
   32.94 + 	goto fail;
   32.95 +       __libc_missing_axp_stat64 = 1;
   32.96 +     }
   32.97 ++#endif
   32.98 + 
   32.99 +   if (flag & AT_SYMLINK_NOFOLLOW)
  32.100 +     result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst);
  32.101 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/lxstat.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/lxstat.c
  32.102 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/lxstat.c	2009-05-16 10:36:20.000000000 +0200
  32.103 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/lxstat.c	2009-11-13 00:50:45.000000000 +0100
  32.104 +@@ -35,27 +35,39 @@
  32.105 + __lxstat (int vers, const char *name, struct stat *buf)
  32.106 + {
  32.107 +   INTERNAL_SYSCALL_DECL (err);
  32.108 +-  int result, errno_out;
  32.109 ++  int result;
  32.110 +   struct kernel_stat kbuf;
  32.111 + 
  32.112 ++#if __ASSUME_STAT64_SYSCALL > 0
  32.113 ++  if (vers == _STAT_VER_KERNEL64)
  32.114 ++    {
  32.115 ++      result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
  32.116 ++      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  32.117 ++	return result;
  32.118 ++      __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  32.119 ++      return -1;
  32.120 ++    }
  32.121 ++#elif defined __NR_lstat64
  32.122 +   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
  32.123 +     {
  32.124 ++      int errno_out;
  32.125 +       result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
  32.126 +       if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  32.127 + 	return result;
  32.128 +       errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  32.129 +       if (errno_out != ENOSYS)
  32.130 +-	goto fail;
  32.131 ++	{
  32.132 ++	  __set_errno (errno_out);
  32.133 ++	  return -1;
  32.134 ++	}
  32.135 +       __libc_missing_axp_stat64 = 1;
  32.136 +     }
  32.137 ++#endif
  32.138 + 
  32.139 +   result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf);
  32.140 +   if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  32.141 +     return __xstat_conv (vers, &kbuf, buf);
  32.142 +-  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  32.143 +-  
  32.144 +- fail:
  32.145 +-  __set_errno (errno_out);
  32.146 ++  __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  32.147 +   return -1;
  32.148 + }
  32.149 + hidden_def (__lxstat)
  32.150 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstat.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstat.c
  32.151 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstat.c	2009-05-16 10:36:20.000000000 +0200
  32.152 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstat.c	2009-11-13 00:50:45.000000000 +0100
  32.153 +@@ -35,27 +35,39 @@
  32.154 + __xstat (int vers, const char *name, struct stat *buf)
  32.155 + {
  32.156 +   INTERNAL_SYSCALL_DECL (err);
  32.157 +-  int result, errno_out;
  32.158 ++  int result;
  32.159 +   struct kernel_stat kbuf;
  32.160 + 
  32.161 ++#if __ASSUME_STAT64_SYSCALL > 0
  32.162 ++  if (vers == _STAT_VER_KERNEL64)
  32.163 ++    {
  32.164 ++      result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
  32.165 ++      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  32.166 ++	return result;
  32.167 ++      __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  32.168 ++      return -1;
  32.169 ++    }
  32.170 ++#elif defined __NR_stat64
  32.171 +   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
  32.172 +     {
  32.173 ++      int errno_out;
  32.174 +       result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
  32.175 +       if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  32.176 + 	return result;
  32.177 +       errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  32.178 +       if (errno_out != ENOSYS)
  32.179 +-	goto fail;
  32.180 ++	{
  32.181 ++	  __set_errno (errno_out);
  32.182 ++	  return -1;
  32.183 ++	}
  32.184 +       __libc_missing_axp_stat64 = 1;
  32.185 +     }
  32.186 ++#endif
  32.187 + 
  32.188 +   result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf);
  32.189 +   if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  32.190 +     return __xstat_conv (vers, &kbuf, buf);
  32.191 +-  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  32.192 +-  
  32.193 +- fail:
  32.194 +-  __set_errno (errno_out);
  32.195 ++  __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  32.196 +   return -1;
  32.197 + }
  32.198 + hidden_def (__xstat)
  32.199 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.c
  32.200 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.c	2009-05-16 10:36:20.000000000 +0200
  32.201 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.c	2009-11-13 00:50:45.000000000 +0100
  32.202 +@@ -22,9 +22,14 @@
  32.203 + #include <sys/stat.h>
  32.204 + #include <kernel_stat.h>
  32.205 + #include <xstatconv.h>
  32.206 ++#include <sys/syscall.h>
  32.207 + 
  32.208 + 
  32.209 ++#ifdef __NR_stat64
  32.210 ++# if __ASSUME_STAT64_SYSCALL == 0
  32.211 + int __libc_missing_axp_stat64;
  32.212 ++# endif
  32.213 ++#endif
  32.214 + 
  32.215 + int
  32.216 + __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
  32.217 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.h
  32.218 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.h	2009-05-16 10:36:20.000000000 +0200
  32.219 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.h	2009-11-13 00:50:45.000000000 +0100
  32.220 +@@ -18,7 +18,12 @@
  32.221 +    02111-1307 USA.  */
  32.222 + 
  32.223 + #include <kernel-features.h>
  32.224 ++#include <sys/syscall.h>
  32.225 + 
  32.226 ++#ifdef __NR_stat64
  32.227 ++# if __ASSUME_STAT64_SYSCALL == 0
  32.228 + extern int __libc_missing_axp_stat64 attribute_hidden;
  32.229 ++# endif
  32.230 ++#endif
  32.231 + extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
  32.232 +   attribute_hidden;
  32.233 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/fxstat.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/fxstat.c
  32.234 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/fxstatat.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/fxstatat.c
  32.235 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/lxstat.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/lxstat.c
  32.236 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/xstat.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/xstat.c
  32.237 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.c
  32.238 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.h
  32.239 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h
  32.240 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h	2009-05-09 08:54:20.000000000 +0200
  32.241 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h	2009-11-13 00:50:45.000000000 +0100
  32.242 +@@ -395,6 +395,11 @@
  32.243 + # define __ASSUME_GETDENTS32_D_TYPE	1
  32.244 + #endif
  32.245 + 
  32.246 ++/* Starting with version 2.6.4, alpha stat64 syscalls are available.  */
  32.247 ++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
  32.248 ++# define __ASSUME_STAT64_SYSCALL	1
  32.249 ++#endif
  32.250 ++
  32.251 + /* Starting with version 2.5.3, the initial location returned by `brk'
  32.252 +    after exec is always rounded up to the next page.  */
  32.253 + #if __LINUX_KERNEL_VERSION >= 132355
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/patches/glibc/ports-2.10.1/410-alpha-no-page-header.patch	Fri Nov 13 21:37:18 2009 +0100
    33.3 @@ -0,0 +1,28 @@
    33.4 +2008-06-07  Mike Frysinger  <vapier@gentoo.org>
    33.5 +
    33.6 +	* sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions
    33.7 +	from the kernel header to sys/user.h and remove the #include of
    33.8 +	sys/user.h.
    33.9 +
   33.10 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/user.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/user.h
   33.11 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/user.h	2009-05-16 10:36:20.000000000 +0200
   33.12 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/user.h	2009-11-13 00:50:47.000000000 +0100
   33.13 +@@ -23,7 +23,6 @@
   33.14 +    only. Don't read too much into it. Don't use it for anything other
   33.15 +    than gdb/strace unless you know what you are doing. */
   33.16 + 
   33.17 +-#include <asm/page.h>
   33.18 + #include <asm/reg.h>
   33.19 + 
   33.20 + struct user
   33.21 +@@ -41,6 +40,9 @@
   33.22 +   char u_comm[32];				/* user command name */
   33.23 + };
   33.24 + 
   33.25 ++#define PAGE_SHIFT		13
   33.26 ++#define PAGE_SIZE		(1 << PAGE_SHIFT)
   33.27 ++#define PAGE_MASK		(~(PAGE_SIZE-1))
   33.28 + #define NBPG			PAGE_SIZE
   33.29 + #define UPAGES			1
   33.30 + #define HOST_TEXT_START_ADDR	(u.start_code)
   33.31 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/sys/user.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/sys/user.h
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/patches/glibc/ports-2.10.1/420-alpha-no-asm-elf-header.patch	Fri Nov 13 21:37:18 2009 +0100
    34.3 @@ -0,0 +1,34 @@
    34.4 +2007-03-13  Mike Frysinger  <vapier@gentoo.org>
    34.5 +
    34.6 +	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some defines
    34.7 +	from alpha's asm/elf.h
    34.8 +
    34.9 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/procfs.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
   34.10 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/procfs.h	2009-05-16 10:36:20.000000000 +0200
   34.11 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/procfs.h	2009-11-13 00:50:49.000000000 +0100
   34.12 +@@ -29,10 +29,23 @@
   34.13 + #include <sys/types.h>
   34.14 + #include <sys/ucontext.h>
   34.15 + #include <sys/user.h>
   34.16 +-#include <asm/elf.h>
   34.17 + 
   34.18 + __BEGIN_DECLS
   34.19 + 
   34.20 ++/*
   34.21 ++ * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
   34.22 ++ * I have no idea why that is so.  For now, we just leave it at 33
   34.23 ++ * (32 general regs + processor status word). 
   34.24 ++ */
   34.25 ++#define ELF_NGREG	33
   34.26 ++#define ELF_NFPREG	32
   34.27 ++
   34.28 ++typedef unsigned long elf_greg_t;
   34.29 ++typedef elf_greg_t elf_gregset_t[ELF_NGREG];
   34.30 ++
   34.31 ++typedef double elf_fpreg_t;
   34.32 ++typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
   34.33 ++
   34.34 + struct elf_siginfo
   34.35 +   {
   34.36 +     int si_signo;			/* Signal number.  */
   34.37 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/sys/procfs.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/patches/glibc/ports-2.10.1/430-alpha-creat.patch	Fri Nov 13 21:37:18 2009 +0100
    35.3 @@ -0,0 +1,14 @@
    35.4 +alpha does not have a __NR_creat
    35.5 +
    35.6 +http://bugs.gentoo.org/227275
    35.7 +http://sourceware.org/bugzilla/show_bug.cgi?id=6650
    35.8 +
    35.9 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.10.1/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
   35.10 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2007-11-10 20:34:26.000000000 +0100
   35.11 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2009-11-13 00:50:51.000000000 +0100
   35.12 +@@ -1 +1,5 @@
   35.13 + /* Defined as alias for the syscall.  */
   35.14 ++#include <sysdep.h>
   35.15 ++#ifndef __NR_creat
   35.16 ++#include "../../../../../io/creat64.c"
   35.17 ++#endif
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/patches/glibc/ports-2.10.1/440-alpha-cache-shape.patch	Fri Nov 13 21:37:18 2009 +0100
    36.3 @@ -0,0 +1,14 @@
    36.4 +older verisons of glibc would build dl-sysdep as shared-only and dl-support as
    36.5 +static-only.  alpha hooks in a cache variable via dl-auxv.h.  newer versions of
    36.6 +glibc build dl-sysdep as both shared and static which means we now have symbol
    36.7 +duplication for static builds with dl-sysdep and dl-support.  since dl-sysdep
    36.8 +is both shared/static, there is no point in hooking dl-support anymore, so we
    36.9 +can punt it.
   36.10 +
   36.11 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/dl-support.c
   36.12 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/dl-support.c	2009-05-16 10:36:20.000000000 +0200
   36.13 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/dl-support.c	2009-11-13 00:50:53.000000000 +0100
   36.14 +@@ -1,2 +0,0 @@
   36.15 +-#include "dl-auxv.h"
   36.16 +-#include <elf/dl-support.c>
   36.17 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/dl-support.c
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/patches/glibc/ports-2.10.1/450-alpha-ptr-mangling.patch	Fri Nov 13 21:37:18 2009 +0100
    37.3 @@ -0,0 +1,111 @@
    37.4 +http://bugs.gentoo.org/201910
    37.5 +
    37.6 +For every arch, PTR_MANGLE and PTR_DEMANGLE defines are in
    37.7 +sysdeps/unix/sysv/linux/<arch>/sysdep.h. But for alpha this is not true. The
    37.8 +defines are in sysdeps/unix/alpha/sysdep.h and unix/sysv/linux/alpha/sysdep.h
    37.9 +includes the first.
   37.10 +
   37.11 +This is a patch that fixes the issue and let alpha build, at the expense of
   37.12 +disabling MANGLING in the non PIC case, but googling showed that the issue is
   37.13 +known, and that nobody really cares about it. 
   37.14 +
   37.15 +Info from: http://sourceware.org/bugzilla/show_bug.cgi?id=5216
   37.16 +
   37.17 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h
   37.18 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h	2009-05-16 10:36:20.000000000 +0200
   37.19 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h	2009-11-13 00:50:55.000000000 +0100
   37.20 +@@ -397,42 +397,4 @@
   37.21 + 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
   37.22 + }
   37.23 + 
   37.24 +-/* Pointer mangling support.  Note that tls access is slow enough that
   37.25 +-   we don't deoptimize things by placing the pointer check value there.  */
   37.26 +-
   37.27 +-#include <stdint.h>
   37.28 +-
   37.29 +-#if defined NOT_IN_libc && defined IS_IN_rtld
   37.30 +-# ifdef __ASSEMBLER__
   37.31 +-#  define PTR_MANGLE(dst, src, tmp)				\
   37.32 +-	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
   37.33 +-	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
   37.34 +-	xor	src, tmp, dst
   37.35 +-#  define PTR_MANGLE2(dst, src, tmp)				\
   37.36 +-	xor	src, tmp, dst
   37.37 +-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   37.38 +-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   37.39 +-# else
   37.40 +-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
   37.41 +-#  define PTR_MANGLE(var)	\
   37.42 +-  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
   37.43 +-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
   37.44 +-# endif
   37.45 +-#elif defined PIC
   37.46 +-# ifdef __ASSEMBLER__
   37.47 +-#  define PTR_MANGLE(dst, src, tmp)		\
   37.48 +-	ldq	tmp, __pointer_chk_guard;	\
   37.49 +-	xor	src, tmp, dst
   37.50 +-#  define PTR_MANGLE2(dst, src, tmp)		\
   37.51 +-	xor	src, tmp, dst
   37.52 +-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   37.53 +-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   37.54 +-# else
   37.55 +-extern uintptr_t __pointer_chk_guard attribute_relro;
   37.56 +-#  define PTR_MANGLE(var)	\
   37.57 +-	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
   37.58 +-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
   37.59 +-# endif
   37.60 +-#endif
   37.61 +-
   37.62 + #endif /* ASSEMBLER */
   37.63 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h
   37.64 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h	2009-05-16 10:36:20.000000000 +0200
   37.65 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h	2009-11-13 00:50:55.000000000 +0100
   37.66 +@@ -98,4 +98,46 @@
   37.67 + 	INTERNAL_SYSCALL1(name, err_out, nr, args);			\
   37.68 + })
   37.69 + 
   37.70 ++/* Pointer mangling support.  Note that tls access is slow enough that
   37.71 ++   we don't deoptimize things by placing the pointer check value there.  */
   37.72 ++
   37.73 ++#if defined NOT_IN_libc && defined IS_IN_rtld
   37.74 ++# ifdef __ASSEMBLER__
   37.75 ++#  define PTR_MANGLE(dst, src, tmp)                            \
   37.76 ++       ldah    tmp, __pointer_chk_guard_local($29) !gprelhigh; \
   37.77 ++       ldq     tmp, __pointer_chk_guard_local(tmp) !gprellow;  \
   37.78 ++       xor     src, tmp, dst
   37.79 ++#  define PTR_MANGLE2(dst, src, tmp)                           \
   37.80 ++       xor     src, tmp, dst
   37.81 ++#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   37.82 ++#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   37.83 ++# else
   37.84 ++extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
   37.85 ++#  define PTR_MANGLE(var)      \
   37.86 ++  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
   37.87 ++#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
   37.88 ++# endif
   37.89 ++#elif defined PIC
   37.90 ++# ifdef __ASSEMBLER__
   37.91 ++#  define PTR_MANGLE(dst, src, tmp)            \
   37.92 ++       ldq     tmp, __pointer_chk_guard;       \
   37.93 ++       xor     src, tmp, dst
   37.94 ++#  define PTR_MANGLE2(dst, src, tmp)           \
   37.95 ++       xor     src, tmp, dst
   37.96 ++#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   37.97 ++#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   37.98 ++# else
   37.99 ++extern uintptr_t __pointer_chk_guard attribute_relro;
  37.100 ++#  define PTR_MANGLE(var)      \
  37.101 ++       (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
  37.102 ++#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
  37.103 ++# endif
  37.104 ++#else
  37.105 ++/* Pointer mangling is not yet supported for static libc on alpha.  */
  37.106 ++# ifndef __ASSEMBLER__
  37.107 ++#  define PTR_MANGLE(var)   (void) (var)
  37.108 ++#  define PTR_DEMANGLE(var) (void) (var)
  37.109 ++# endif
  37.110 ++#endif
  37.111 ++
  37.112 + #endif /* _LINUX_ALPHA_SYSDEP_H */
  37.113 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/alpha/sysdep.h glibc-2.10.1/ports/sysdeps/unix/alpha/sysdep.h
  37.114 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/sysdep.h
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/patches/glibc/ports-2.10.1/460-alpha-fix-gcc-4.1-warnings.patch	Fri Nov 13 21:37:18 2009 +0100
    38.3 @@ -0,0 +1,56 @@
    38.4 +2006-05-30  Falk Hueffner <falk@debian.org>
    38.5 +
    38.6 +	* sysdeps/unix/sysv/linux/alpha/ioperm.c: force the architecture
    38.7 +	  to ev6 in assembly code.
    38.8 +
    38.9 +{standard input}: Assembler messages:
   38.10 +{standard input}:341: Error: macro requires $at register while noat in effect
   38.11 +{standard input}:374: Error: macro requires $at register while noat in effect
   38.12 +{standard input}:438: Error: macro requires $at register while noat in effect
   38.13 +{standard input}:471: Error: macro requires $at register while noat in effect
   38.14 +make[3]: *** [/tmp/buildd/glibc-2.3.6/build-tree/alpha-libc/misc/ioperm.o] Error 1
   38.15 +
   38.16 +Hrm. gcc puts .arch ev4 into the .s, and this overrides -mev6 for as.
   38.17 +I cannot really think of anything better than
   38.18 +
   38.19 + ports/sysdeps/unix/sysv/linux/alpha/ioperm.c |    8 ++++----
   38.20 + 1 file changed, 4 insertions(+), 4 deletions(-)
   38.21 +
   38.22 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/ioperm.c
   38.23 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/ioperm.c	2009-05-16 10:36:20.000000000 +0200
   38.24 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/ioperm.c	2009-11-13 00:50:57.000000000 +0100
   38.25 +@@ -178,13 +178,13 @@
   38.26 + static inline void
   38.27 + stb_mb(unsigned char val, unsigned long addr)
   38.28 + {
   38.29 +-  __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
   38.30 ++  __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
   38.31 + }
   38.32 + 
   38.33 + static inline void
   38.34 + stw_mb(unsigned short val, unsigned long addr)
   38.35 + {
   38.36 +-  __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
   38.37 ++  __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
   38.38 + }
   38.39 + 
   38.40 + static inline void
   38.41 +@@ -356,7 +356,7 @@
   38.42 +   unsigned long int addr = dense_port_to_cpu_addr (port);
   38.43 +   unsigned char r;
   38.44 + 
   38.45 +-  __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
   38.46 ++  __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
   38.47 +   return r;
   38.48 + }
   38.49 + 
   38.50 +@@ -366,7 +366,7 @@
   38.51 +   unsigned long int addr = dense_port_to_cpu_addr (port);
   38.52 +   unsigned short r;
   38.53 + 
   38.54 +-  __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
   38.55 ++  __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
   38.56 +   return r;
   38.57 + }
   38.58 + 
   38.59 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/patches/glibc/ports-2.10.1/470-alpha-floor_ceil_fix.patch	Fri Nov 13 21:37:18 2009 +0100
    39.3 @@ -0,0 +1,270 @@
    39.4 +http://sources.redhat.com/bugzilla/show_bug.cgi?id=5350
    39.5 +https://bugs.gentoo.org/264335
    39.6 +
    39.7 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c
    39.8 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c	2009-05-16 10:36:20.000000000 +0200
    39.9 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c	2009-11-13 00:50:59.000000000 +0100
   39.10 +@@ -27,20 +27,25 @@
   39.11 + double
   39.12 + __ceil (double x)
   39.13 + {
   39.14 +-  double two52 = copysign (0x1.0p52, x);
   39.15 +-  double r, tmp;
   39.16 +-  
   39.17 +-  __asm (
   39.18 ++  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
   39.19 ++    {
   39.20 ++      double tmp1, new_x;
   39.21 ++
   39.22 ++      new_x = -x;
   39.23 ++      __asm (
   39.24 + #ifdef _IEEE_FP_INEXACT
   39.25 +-	 "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
   39.26 ++	     "cvttq/svim %2,%1\n\t"
   39.27 + #else
   39.28 +-	 "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
   39.29 ++	     "cvttq/svm %2,%1\n\t"
   39.30 + #endif
   39.31 +-	 : "=&f"(r), "=&f"(tmp)
   39.32 +-	 : "f"(-x), "f"(-two52));
   39.33 ++	     "cvtqt/m %1,%0\n\t"
   39.34 ++	     : "=f"(new_x), "=&f"(tmp1)
   39.35 ++	     : "f"(new_x));
   39.36 + 
   39.37 +-  /* Fix up the negation we did above, as well as handling -0 properly. */
   39.38 +-  return copysign (r, x);
   39.39 ++      /* Fix up the negation we did above, as well as handling -0 properly. */
   39.40 ++      x = copysign(new_x, x);
   39.41 ++    }
   39.42 ++  return x;
   39.43 + }
   39.44 + 
   39.45 + weak_alias (__ceil, ceil)
   39.46 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c
   39.47 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c	2009-05-16 10:36:20.000000000 +0200
   39.48 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c	2009-11-13 00:50:59.000000000 +0100
   39.49 +@@ -26,20 +26,30 @@
   39.50 + float
   39.51 + __ceilf (float x)
   39.52 + {
   39.53 +-  float two23 = copysignf (0x1.0p23, x);
   39.54 +-  float r, tmp;
   39.55 +-  
   39.56 +-  __asm (
   39.57 ++  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
   39.58 ++    {
   39.59 ++      /* Note that Alpha S_Floating is stored in registers in a
   39.60 ++	 restricted T_Floating format, so we don't even need to
   39.61 ++	 convert back to S_Floating in the end.  The initial
   39.62 ++	 conversion to T_Floating is needed to handle denormals.  */
   39.63 ++
   39.64 ++      float tmp1, tmp2, new_x;
   39.65 ++
   39.66 ++      new_x = -x;
   39.67 ++      __asm ("cvtst/s %3,%2\n\t"
   39.68 + #ifdef _IEEE_FP_INEXACT
   39.69 +-	 "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
   39.70 ++	     "cvttq/svim %2,%1\n\t"
   39.71 + #else
   39.72 +-	 "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
   39.73 ++	     "cvttq/svm %2,%1\n\t"
   39.74 + #endif
   39.75 +-	 : "=&f"(r), "=&f"(tmp)
   39.76 +-	 : "f"(-x), "f"(-two23));
   39.77 ++	     "cvtqt/m %1,%0\n\t"
   39.78 ++	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
   39.79 ++	     : "f"(new_x));
   39.80 + 
   39.81 +-  /* Fix up the negation we did above, as well as handling -0 properly. */
   39.82 +-  return copysignf (r, x);
   39.83 ++      /* Fix up the negation we did above, as well as handling -0 properly. */
   39.84 ++      x = copysignf(new_x, x);
   39.85 ++    }
   39.86 ++  return x;
   39.87 + }
   39.88 + 
   39.89 + weak_alias (__ceilf, ceilf)
   39.90 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c
   39.91 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c	2009-05-16 10:36:20.000000000 +0200
   39.92 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c	2009-11-13 00:50:59.000000000 +0100
   39.93 +@@ -21,26 +21,32 @@
   39.94 + #include <math_ldbl_opt.h>
   39.95 + 
   39.96 + 
   39.97 +-/* Use the -inf rounding mode conversion instructions to implement floor.  */
   39.98 ++/* Use the -inf rounding mode conversion instructions to implement
   39.99 ++   floor.  We note when the exponent is large enough that the value
  39.100 ++   must be integral, as this avoids unpleasant integer overflows.  */
  39.101 + 
  39.102 + double
  39.103 + __floor (double x)
  39.104 + {
  39.105 +-  double two52 = copysign (0x1.0p52, x);
  39.106 +-  double r, tmp;
  39.107 +-  
  39.108 +-  __asm (
  39.109 ++  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
  39.110 ++    {
  39.111 ++      double tmp1, new_x;
  39.112 ++
  39.113 ++      __asm (
  39.114 + #ifdef _IEEE_FP_INEXACT
  39.115 +-	 "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
  39.116 ++	     "cvttq/svim %2,%1\n\t"
  39.117 + #else
  39.118 +-	 "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
  39.119 ++	     "cvttq/svm %2,%1\n\t"
  39.120 + #endif
  39.121 +-	 : "=&f"(r), "=&f"(tmp)
  39.122 +-	 : "f"(x), "f"(two52));
  39.123 ++	     "cvtqt/m %1,%0\n\t"
  39.124 ++	     : "=f"(new_x), "=&f"(tmp1)
  39.125 ++	     : "f"(x));
  39.126 + 
  39.127 +-  /* floor(-0) == -0, and in general we'll always have the same
  39.128 +-     sign as our input.  */
  39.129 +-  return copysign (r, x);
  39.130 ++      /* floor(-0) == -0, and in general we'll always have the same
  39.131 ++	 sign as our input.  */
  39.132 ++      x = copysign(new_x, x);
  39.133 ++    }
  39.134 ++  return x;
  39.135 + }
  39.136 + 
  39.137 + weak_alias (__floor, floor)
  39.138 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c
  39.139 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c	2009-05-16 10:36:20.000000000 +0200
  39.140 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c	2009-11-13 00:50:59.000000000 +0100
  39.141 +@@ -20,26 +20,37 @@
  39.142 + #include <math.h>
  39.143 + 
  39.144 + 
  39.145 +-/* Use the -inf rounding mode conversion instructions to implement floor.  */
  39.146 ++/* Use the -inf rounding mode conversion instructions to implement
  39.147 ++   floor.  We note when the exponent is large enough that the value
  39.148 ++   must be integral, as this avoids unpleasant integer overflows.  */
  39.149 + 
  39.150 + float
  39.151 + __floorf (float x)
  39.152 + {
  39.153 +-  float two23 = copysignf (0x1.0p23, x);
  39.154 +-  float r, tmp;
  39.155 +-  
  39.156 +-  __asm (
  39.157 ++  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
  39.158 ++    {
  39.159 ++      /* Note that Alpha S_Floating is stored in registers in a
  39.160 ++	 restricted T_Floating format, so we don't even need to
  39.161 ++	 convert back to S_Floating in the end.  The initial
  39.162 ++	 conversion to T_Floating is needed to handle denormals.  */
  39.163 ++
  39.164 ++      float tmp1, tmp2, new_x;
  39.165 ++
  39.166 ++      __asm ("cvtst/s %3,%2\n\t"
  39.167 + #ifdef _IEEE_FP_INEXACT
  39.168 +-	 "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
  39.169 ++	     "cvttq/svim %2,%1\n\t"
  39.170 + #else
  39.171 +-	 "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
  39.172 ++	     "cvttq/svm %2,%1\n\t"
  39.173 + #endif
  39.174 +-	 : "=&f"(r), "=&f"(tmp)
  39.175 +-	 : "f"(x), "f"(two23));
  39.176 ++	     "cvtqt/m %1,%0\n\t"
  39.177 ++	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
  39.178 ++	     : "f"(x));
  39.179 + 
  39.180 +-  /* floor(-0) == -0, and in general we'll always have the same
  39.181 +-     sign as our input.  */
  39.182 +-  return copysignf (r, x);
  39.183 ++      /* floor(-0) == -0, and in general we'll always have the same
  39.184 ++	 sign as our input.  */
  39.185 ++      x = copysignf(new_x, x);
  39.186 ++    }
  39.187 ++  return x;
  39.188 + }
  39.189 + 
  39.190 + weak_alias (__floorf, floorf)
  39.191 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c
  39.192 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c	2009-05-16 10:36:20.000000000 +0200
  39.193 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c	2009-11-13 00:50:59.000000000 +0100
  39.194 +@@ -24,15 +24,24 @@
  39.195 + double
  39.196 + __rint (double x)
  39.197 + {
  39.198 +-  double two52 = copysign (0x1.0p52, x);
  39.199 +-  double r;
  39.200 +-  
  39.201 +-  r = x + two52;
  39.202 +-  r = r - two52;
  39.203 ++  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
  39.204 ++    {
  39.205 ++      double tmp1, new_x;
  39.206 ++      __asm (
  39.207 ++#ifdef _IEEE_FP_INEXACT
  39.208 ++	     "cvttq/svid %2,%1\n\t"
  39.209 ++#else
  39.210 ++	     "cvttq/svd %2,%1\n\t"
  39.211 ++#endif
  39.212 ++	     "cvtqt/d %1,%0\n\t"
  39.213 ++	     : "=f"(new_x), "=&f"(tmp1)
  39.214 ++	     : "f"(x));
  39.215 + 
  39.216 +-  /* rint(-0.1) == -0, and in general we'll always have the same sign
  39.217 +-     as our input.  */
  39.218 +-  return copysign (r, x);
  39.219 ++      /* rint(-0.1) == -0, and in general we'll always have the same
  39.220 ++	 sign as our input.  */
  39.221 ++      x = copysign(new_x, x);
  39.222 ++    }
  39.223 ++  return x;
  39.224 + }
  39.225 + 
  39.226 + weak_alias (__rint, rint)
  39.227 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c
  39.228 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c	2009-05-16 10:36:20.000000000 +0200
  39.229 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c	2009-11-13 00:50:59.000000000 +0100
  39.230 +@@ -23,15 +23,30 @@
  39.231 + float
  39.232 + __rintf (float x)
  39.233 + {
  39.234 +-  float two23 = copysignf (0x1.0p23, x);
  39.235 +-  float r;
  39.236 ++  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
  39.237 ++    {
  39.238 ++      /* Note that Alpha S_Floating is stored in registers in a
  39.239 ++	 restricted T_Floating format, so we don't even need to
  39.240 ++	 convert back to S_Floating in the end.  The initial
  39.241 ++	 conversion to T_Floating is needed to handle denormals.  */
  39.242 + 
  39.243 +-  r = x + two23;
  39.244 +-  r = r - two23;
  39.245 ++      float tmp1, tmp2, new_x;
  39.246 + 
  39.247 +-  /* rint(-0.1) == -0, and in general we'll always have the same sign
  39.248 +-     as our input.  */
  39.249 +-  return copysign (r, x);
  39.250 ++      __asm ("cvtst/s %3,%2\n\t"
  39.251 ++#ifdef _IEEE_FP_INEXACT
  39.252 ++	     "cvttq/svid %2,%1\n\t"
  39.253 ++#else
  39.254 ++	     "cvttq/svd %2,%1\n\t"
  39.255 ++#endif
  39.256 ++	     "cvtqt/d %1,%0\n\t"
  39.257 ++	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
  39.258 ++	     : "f"(x));
  39.259 ++
  39.260 ++      /* rint(-0.1) == -0, and in general we'll always have the same
  39.261 ++	 sign as our input.  */
  39.262 ++      x = copysignf(new_x, x);
  39.263 ++    }
  39.264 ++  return x;
  39.265 + }
  39.266 + 
  39.267 + weak_alias (__rintf, rintf)
  39.268 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_ceil.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_ceil.c
  39.269 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_ceilf.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_ceilf.c
  39.270 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_floor.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_floor.c
  39.271 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_floorf.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_floorf.c
  39.272 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_rint.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_rint.c
  39.273 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_rintf.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_rintf.c
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/patches/glibc/ports-2.10.1/480-alpha-add-dl-procinfo-support.patch	Fri Nov 13 21:37:18 2009 +0100
    40.3 @@ -0,0 +1,170 @@
    40.4 + ports/sysdeps/alpha/dl-machine.h  |   12 ++++++
    40.5 + ports/sysdeps/alpha/dl-procinfo.c |   64 +++++++++++++++++++++++++++++++++++
    40.6 + ports/sysdeps/alpha/dl-procinfo.h |   68 ++++++++++++++++++++++++++++++++++++++
    40.7 + 3 files changed, 144 insertions(+)
    40.8 +
    40.9 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h
   40.10 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h	2009-05-16 10:36:20.000000000 +0200
   40.11 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h	2009-11-13 00:51:02.000000000 +0100
   40.12 +@@ -249,6 +249,18 @@
   40.13 + /* The alpha never uses Elf64_Rel relocations.  */
   40.14 + #define ELF_MACHINE_NO_REL 1
   40.15 + 
   40.16 ++/* We define an initialization functions.  This is called very early in
   40.17 ++ *    _dl_sysdep_start.  */
   40.18 ++#define DL_PLATFORM_INIT dl_platform_init ()
   40.19 ++
   40.20 ++static inline void __attribute__ ((unused))
   40.21 ++dl_platform_init (void)
   40.22 ++{
   40.23 ++	if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
   40.24 ++	/* Avoid an empty string which would disturb us.  */
   40.25 ++		GLRO(dl_platform) = NULL;
   40.26 ++}
   40.27 ++	
   40.28 + /* Fix up the instructions of a PLT entry to invoke the function
   40.29 +    rather than the dynamic linker.  */
   40.30 + static inline Elf64_Addr
   40.31 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c
   40.32 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c	1970-01-01 01:00:00.000000000 +0100
   40.33 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c	2009-11-13 00:51:02.000000000 +0100
   40.34 +@@ -0,0 +1,64 @@
   40.35 ++/* Data for Alpha version of processor capability information.
   40.36 ++   Copyright (C) 2007 Free Software Foundation, Inc.
   40.37 ++   This file is part of the GNU C Library.
   40.38 ++   Contributed by Aurelien Jarno <aurelien@aurel32.net>, 2007.
   40.39 ++
   40.40 ++   The GNU C Library is free software; you can redistribute it and/or
   40.41 ++   modify it under the terms of the GNU Lesser General Public
   40.42 ++   License as published by the Free Software Foundation; either
   40.43 ++   version 2.1 of the License, or (at your option) any later version.
   40.44 ++
   40.45 ++   The GNU C Library is distributed in the hope that it will be useful,
   40.46 ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
   40.47 ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   40.48 ++   Lesser General Public License for more details.
   40.49 ++
   40.50 ++   You should have received a copy of the GNU Lesser General Public
   40.51 ++   License along with the GNU C Library; if not, write to the Free
   40.52 ++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   40.53 ++   02111-1307 USA.  */
   40.54 ++
   40.55 ++/* This information must be kept in sync with the _DL_PLATFORM_COUNT 
   40.56 ++   definitions in procinfo.h.
   40.57 ++
   40.58 ++   If anything should be added here check whether the size of each string
   40.59 ++   is still ok with the given array size.
   40.60 ++
   40.61 ++   All the #ifdefs in the definitions are quite irritating but
   40.62 ++   necessary if we want to avoid duplicating the information.  There
   40.63 ++   are three different modes:
   40.64 ++
   40.65 ++   - PROCINFO_DECL is defined.  This means we are only interested in
   40.66 ++     declarations.
   40.67 ++
   40.68 ++   - PROCINFO_DECL is not defined:
   40.69 ++
   40.70 ++     + if SHARED is defined the file is included in an array
   40.71 ++       initializer.  The .element = { ... } syntax is needed.
   40.72 ++
   40.73 ++     + if SHARED is not defined a normal array initialization is
   40.74 ++       needed.
   40.75 ++  */
   40.76 ++
   40.77 ++#ifndef PROCINFO_CLASS
   40.78 ++#define PROCINFO_CLASS
   40.79 ++#endif
   40.80 ++
   40.81 ++#if !defined PROCINFO_DECL && defined SHARED
   40.82 ++  ._dl_alpha_platforms
   40.83 ++#else
   40.84 ++PROCINFO_CLASS const char _dl_alpha_platforms[5][5]
   40.85 ++#endif
   40.86 ++#ifndef PROCINFO_DECL
   40.87 ++= {
   40.88 ++    "ev4", "ev5", "ev56", "ev6", "ev67"
   40.89 ++  }
   40.90 ++#endif
   40.91 ++#if !defined SHARED || defined PROCINFO_DECL
   40.92 ++;
   40.93 ++#else
   40.94 ++,
   40.95 ++#endif
   40.96 ++
   40.97 ++#undef PROCINFO_DECL
   40.98 ++#undef PROCINFO_CLASS
   40.99 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h
  40.100 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h	1970-01-01 01:00:00.000000000 +0100
  40.101 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h	2009-11-13 00:51:02.000000000 +0100
  40.102 +@@ -0,0 +1,68 @@
  40.103 ++/* Alpha version of processor capability information handling macros.
  40.104 ++   Copyright (C) 2007 Free Software Foundation, Inc.
  40.105 ++   This file is part of the GNU C Library.
  40.106 ++   Contributed by Aurelien Jarno <aurelien@aurel32.net>, 2007.
  40.107 ++
  40.108 ++   The GNU C Library is free software; you can redistribute it and/or
  40.109 ++   modify it under the terms of the GNU Lesser General Public
  40.110 ++   License as published by the Free Software Foundation; either
  40.111 ++   version 2.1 of the License, or (at your option) any later version.
  40.112 ++
  40.113 ++   The GNU C Library is distributed in the hope that it will be useful,
  40.114 ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
  40.115 ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  40.116 ++   Lesser General Public License for more details.
  40.117 ++
  40.118 ++   You should have received a copy of the GNU Lesser General Public
  40.119 ++   License along with the GNU C Library; if not, write to the Free
  40.120 ++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  40.121 ++   02111-1307 USA.  */
  40.122 ++
  40.123 ++#ifndef _DL_PROCINFO_H
  40.124 ++#define _DL_PROCINFO_H	1
  40.125 ++
  40.126 ++#include <ldsodefs.h>
  40.127 ++
  40.128 ++
  40.129 ++/* Mask to filter out platforms.  */
  40.130 ++#define _DL_HWCAP_PLATFORM    (-1ULL)
  40.131 ++
  40.132 ++#define _DL_PLATFORMS_COUNT   5
  40.133 ++
  40.134 ++static inline const char *
  40.135 ++__attribute__ ((unused))
  40.136 ++_dl_platform_string (int idx)
  40.137 ++{
  40.138 ++  return GLRO(dl_alpha_platforms)[idx];
  40.139 ++};
  40.140 ++
  40.141 ++static inline int
  40.142 ++__attribute__ ((unused, always_inline))
  40.143 ++_dl_string_platform (const char *str)
  40.144 ++{
  40.145 ++  int i;
  40.146 ++
  40.147 ++  if (str != NULL)
  40.148 ++    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
  40.149 ++      {
  40.150 ++        if (strcmp (str, _dl_platform_string (i)) == 0)
  40.151 ++          return i;
  40.152 ++      }
  40.153 ++  return -1;
  40.154 ++};
  40.155 ++
  40.156 ++/* We cannot provide a general printing function.  */
  40.157 ++#define _dl_procinfo(word) -1
  40.158 ++
  40.159 ++/* There are no hardware capabilities defined.  */
  40.160 ++#define _dl_hwcap_string(idx) ""
  40.161 ++
  40.162 ++/* By default there is no important hardware capability.  */
  40.163 ++#define HWCAP_IMPORTANT (0)
  40.164 ++
  40.165 ++/* We don't have any hardware capabilities.  */
  40.166 ++#define _DL_HWCAP_COUNT	0
  40.167 ++
  40.168 ++#define _dl_string_hwcap(str) (-1)
  40.169 ++
  40.170 ++#endif /* dl-procinfo.h */
  40.171 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/dl-machine.h glibc-2.10.1/ports/sysdeps/alpha/dl-machine.h
  40.172 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/dl-procinfo.c glibc-2.10.1/ports/sysdeps/alpha/dl-procinfo.c
  40.173 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/dl-procinfo.h glibc-2.10.1/ports/sysdeps/alpha/dl-procinfo.h
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/patches/glibc/ports-2.10.1/490-alpha_alpha-add-fdatasync-support.patch	Fri Nov 13 21:37:18 2009 +0100
    41.3 @@ -0,0 +1,126 @@
    41.4 +2009-07-25  Aurelien Jarno  <aurelien@aurel32.net>
    41.5 +
    41.6 +	* sysdeps/unix/sysv/linux/kernel-features.h: define 
    41.7 +	__ASSUME_FDATASYNC. 
    41.8 +	* sysdeps/unix/sysv/linux/fdatasync.c: New file.
    41.9 +	* sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
   41.10 +	-fexceptions.
   41.11 +	* sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
   41.12 +
   41.13 + sysdeps/unix/sysv/linux/Makefile          |    1 
   41.14 + sysdeps/unix/sysv/linux/fdatasync.c       |   69 ++++++++++++++++++++++++++++++
   41.15 + sysdeps/unix/sysv/linux/kernel-features.h |    6 ++
   41.16 + sysdeps/unix/sysv/linux/syscalls.list     |    1 
   41.17 + 4 files changed, 76 insertions(+), 1 deletion(-)
   41.18 +
   41.19 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.10.1/sysdeps/unix/sysv/linux/Makefile
   41.20 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/Makefile	2009-03-02 17:15:13.000000000 +0100
   41.21 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/Makefile	2009-11-13 00:51:04.000000000 +0100
   41.22 +@@ -16,6 +16,7 @@
   41.23 + 		   setfsuid setfsgid makedev epoll_pwait signalfd \
   41.24 + 		   eventfd eventfd_read eventfd_write
   41.25 + 
   41.26 ++CFLAGS-fdatasync.c = -fexceptions
   41.27 + CFLAGS-gethostid.c = -fexceptions
   41.28 + 
   41.29 + sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   41.30 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.10.1/sysdeps/unix/sysv/linux/fdatasync.c
   41.31 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/fdatasync.c	1970-01-01 01:00:00.000000000 +0100
   41.32 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/fdatasync.c	2009-11-13 00:51:04.000000000 +0100
   41.33 +@@ -0,0 +1,69 @@
   41.34 ++/* fdatasync -- synchronize at least the data part of a file with 
   41.35 ++   the underlying media. Linux version. 
   41.36 ++
   41.37 ++   Copyright (C) 2007 Free Software Foundation, Inc.
   41.38 ++   This file is part of the GNU C Library.
   41.39 ++
   41.40 ++   The GNU C Library is free software; you can redistribute it and/or
   41.41 ++   modify it under the terms of the GNU Lesser General Public
   41.42 ++   License as published by the Free Software Foundation; either
   41.43 ++   version 2.1 of the License, or (at your option) any later version.
   41.44 ++
   41.45 ++   The GNU C Library is distributed in the hope that it will be useful,
   41.46 ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
   41.47 ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   41.48 ++   Lesser General Public License for more details.
   41.49 ++
   41.50 ++   You should have received a copy of the GNU Lesser General Public
   41.51 ++   License along with the GNU C Library; if not, write to the Free
   41.52 ++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   41.53 ++   02111-1307 USA.  */
   41.54 ++
   41.55 ++#include <errno.h>
   41.56 ++#include <unistd.h>
   41.57 ++
   41.58 ++#include <sysdep-cancel.h>
   41.59 ++#include <sys/syscall.h>
   41.60 ++#include <bp-checks.h>
   41.61 ++
   41.62 ++#include <kernel-features.h>
   41.63 ++
   41.64 ++#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
   41.65 ++static int __have_no_fdatasync;
   41.66 ++#endif
   41.67 ++
   41.68 ++static int
   41.69 ++do_fdatasync (int fd)
   41.70 ++{
   41.71 ++#ifdef __ASSUME_FDATASYNC
   41.72 ++  return INLINE_SYSCALL (fdatasync, 1, fd);
   41.73 ++#elif defined __NR_fdatasync
   41.74 ++  if (!__builtin_expect (__have_no_fdatasync, 0))
   41.75 ++    {
   41.76 ++      int result = INLINE_SYSCALL (fdatasync, 1, fd);
   41.77 ++      if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
   41.78 ++	return result;
   41.79 ++
   41.80 ++      __have_no_fdatasync = 1;
   41.81 ++    }
   41.82 ++#endif
   41.83 ++  return INLINE_SYSCALL (fsync, 1, fd);
   41.84 ++}
   41.85 ++
   41.86 ++int
   41.87 ++__fdatasync (int fd)
   41.88 ++{
   41.89 ++  if (SINGLE_THREAD_P)
   41.90 ++    return do_fdatasync (fd);
   41.91 ++
   41.92 ++  int oldtype = LIBC_CANCEL_ASYNC ();
   41.93 ++
   41.94 ++  int result = do_fdatasync (fd);
   41.95 ++
   41.96 ++  LIBC_CANCEL_RESET (oldtype);
   41.97 ++
   41.98 ++  return result;
   41.99 ++}
  41.100 ++
  41.101 ++weak_alias (__fdatasync, fdatasync)
  41.102 ++
  41.103 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h
  41.104 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h	2009-11-13 00:50:45.000000000 +0100
  41.105 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h	2009-11-13 00:51:04.000000000 +0100
  41.106 +@@ -479,6 +479,12 @@
  41.107 + # define __ASSUME_FUTEX_LOCK_PI	1
  41.108 + #endif
  41.109 + 
  41.110 ++/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
  41.111 ++   was already present in 2.0 kernels on other architectures.  */
  41.112 ++#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
  41.113 ++# define __ASSUME_FDATASYNC	1
  41.114 ++#endif
  41.115 ++
  41.116 + /* Support for utimensat syscall was added in 2.6.22, on alpha and s390
  41.117 +    only after 2.6.22-rc1.  */
  41.118 + #if __LINUX_KERNEL_VERSION >= 0x020616 \
  41.119 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.10.1/sysdeps/unix/sysv/linux/syscalls.list
  41.120 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/syscalls.list	2008-08-02 01:29:08.000000000 +0200
  41.121 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/syscalls.list	2009-11-13 00:51:04.000000000 +0100
  41.122 +@@ -11,7 +11,6 @@
  41.123 + epoll_create1	EXTRA	epoll_create1	i:i	epoll_create1
  41.124 + epoll_ctl	EXTRA	epoll_ctl	i:iiip	epoll_ctl
  41.125 + epoll_wait	EXTRA	epoll_wait	Ci:ipii	epoll_wait
  41.126 +-fdatasync	-	fdatasync	Ci:i	fdatasync
  41.127 + flock		-	flock		i:ii	__flock		flock
  41.128 + fork		-	fork		i:	__libc_fork	__fork fork
  41.129 + get_kernel_syms	EXTRA	get_kernel_syms	i:p	get_kernel_syms
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/patches/glibc/ports-2.10.1/500-alpha-add-getsystats-support.patch	Fri Nov 13 21:37:18 2009 +0100
    42.3 @@ -0,0 +1,31 @@
    42.4 +2009-05-16  Aurelien Jarno  <aurelien@aurel32.net>
    42.5 +
    42.6 +        * sysdeps/unix/sysv/linux/alpha/getsysstats.c (GET_NPROCS_PARSER):
    42.7 +        Change parameters and use next_line.
    42.8 +
    42.9 + ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c |    5 +++--
   42.10 + 1 file changed, 3 insertions(+), 2 deletions(-)
   42.11 +
   42.12 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getsysstats.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getsysstats.c
   42.13 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getsysstats.c	2009-05-16 10:36:20.000000000 +0200
   42.14 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getsysstats.c	2009-11-13 00:51:07.000000000 +0100
   42.15 +@@ -20,15 +20,16 @@
   42.16 + 
   42.17 + 
   42.18 + /* We need to define a special parser for /proc/cpuinfo.  */
   42.19 +-#define GET_NPROCS_PARSER(FP, BUFFER, RESULT)				   \
   42.20 ++#define GET_NPROCS_PARSER(FD, BUFFER, CP, RE, BUFFER_END, RESULT)	   \
   42.21 +   do									   \
   42.22 +     {									   \
   42.23 +       /* Find the line that contains the information about the number of   \
   42.24 + 	 active cpus.  We don't have to fear extremely long lines since	   \
   42.25 + 	 the kernel will not generate them.  8192 bytes are really enough. \
   42.26 + 	 If there is no "CPUs ..." line then we are on a UP system.  */	   \
   42.27 ++      char *l;								   \
   42.28 +       (RESULT) = 1;							   \
   42.29 +-      while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL)	   \
   42.30 ++      while ((l = next_line (FD, BUFFER, &CP, &RE, BUFFER_END)) != NULL)  \
   42.31 + 	if ((sscanf (BUFFER, "cpus active : %d", &(RESULT)) == 1)	   \
   42.32 + 	    || (sscanf (BUFFER, "CPUs probed %*d active %d",		   \
   42.33 + 			&(RESULT)) == 1))  				   \
   42.34 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/patches/glibc/ports-2.10.1/510-alpha-fix-includes.patch	Fri Nov 13 21:37:18 2009 +0100
    43.3 @@ -0,0 +1,95 @@
    43.4 +2009-05-15  Aurelien Jarno  <aurelien@aurel32.net>
    43.5 +
    43.6 +	* sysdeps/unix/sysv/linux/alpha/getdents64.c: Adjust include path.
    43.7 +	* sysdeps/unix/sysv/linux/alpha/nptl/fork.c: Likewise.
    43.8 +	* sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c: Likewise.
    43.9 +	* sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c: Likewise.
   43.10 +	* sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c: Likewise.
   43.11 +	* sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c: Likewise.
   43.12 +	* sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c: Likewise.
   43.13 +	* sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c: Likewise.
   43.14 +	* sysdeps/unix/sysv/linux/alpha/sysconf.c: Likewise.
   43.15 +
   43.16 + ports/sysdeps/unix/sysv/linux/alpha/getdents64.c          |    2 +-
   43.17 + ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c           |    2 +-
   43.18 + ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c       |    2 +-
   43.19 + ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c   |    2 +-
   43.20 + ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c   |    2 +-
   43.21 + ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c |    2 +-
   43.22 + ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c  |    2 +-
   43.23 + ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c  |    2 +-
   43.24 + ports/sysdeps/unix/sysv/linux/alpha/sysconf.c             |    2 +-
   43.25 + 9 files changed, 9 insertions(+), 9 deletions(-)
   43.26 +
   43.27 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getdents64.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getdents64.c
   43.28 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getdents64.c	2009-05-16 10:36:20.000000000 +0200
   43.29 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getdents64.c	2009-11-13 00:51:08.000000000 +0100
   43.30 +@@ -1 +1 @@
   43.31 +-#include "../getdents64.c"
   43.32 ++#include <sysdeps/unix/sysv/linux/getdents64.c>
   43.33 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/fork.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/fork.c
   43.34 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/fork.c	2009-05-16 10:36:20.000000000 +0200
   43.35 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/fork.c	2009-11-13 00:51:08.000000000 +0100
   43.36 +@@ -27,4 +27,4 @@
   43.37 + 		  CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD,	\
   43.38 + 		  NULL, NULL, &THREAD_SELF->tid, NULL)
   43.39 + 
   43.40 +-#include "../fork.c"
   43.41 ++#include <sysdeps/unix/sysv/linux/fork.c>
   43.42 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c
   43.43 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c	2009-05-16 10:36:20.000000000 +0200
   43.44 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c	2009-11-13 00:51:08.000000000 +0100
   43.45 +@@ -2,4 +2,4 @@
   43.46 +    the acquire/release semantics of atomic_exchange_and_add.  And even if
   43.47 +    we don't do this, we should be using atomic_full_barrier or otherwise.  */
   43.48 + #define __lll_rel_instr  "mb"
   43.49 +-#include "../sem_post.c"
   43.50 ++#include <nptl/sysdeps/unix/sysv/linux/sem_post.c>
   43.51 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c
   43.52 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c	2009-05-16 10:36:20.000000000 +0200
   43.53 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c	2009-11-13 00:51:08.000000000 +0100
   43.54 +@@ -1 +1 @@
   43.55 +-#include "../x86_64/timer_create.c"
   43.56 ++#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c>
   43.57 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c
   43.58 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c	2009-05-16 10:36:20.000000000 +0200
   43.59 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c	2009-11-13 00:51:08.000000000 +0100
   43.60 +@@ -1 +1 @@
   43.61 +-#include "../x86_64/timer_delete.c"
   43.62 ++#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_delete.c>
   43.63 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c
   43.64 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c	2009-05-16 10:36:20.000000000 +0200
   43.65 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c	2009-11-13 00:51:08.000000000 +0100
   43.66 +@@ -1 +1 @@
   43.67 +-#include "../x86_64/timer_getoverr.c"
   43.68 ++#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c>
   43.69 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c
   43.70 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c	2009-05-16 10:36:20.000000000 +0200
   43.71 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c	2009-11-13 00:51:08.000000000 +0100
   43.72 +@@ -1 +1 @@
   43.73 +-#include "../x86_64/timer_gettime.c"
   43.74 ++#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c>
   43.75 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c
   43.76 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c	2009-05-16 10:36:20.000000000 +0200
   43.77 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c	2009-11-13 00:51:08.000000000 +0100
   43.78 +@@ -1 +1 @@
   43.79 +-#include "../x86_64/timer_settime.c"
   43.80 ++#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_settime.c>
   43.81 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysconf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysconf.c
   43.82 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysconf.c	2009-05-16 10:36:20.000000000 +0200
   43.83 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysconf.c	2009-11-13 00:51:08.000000000 +0100
   43.84 +@@ -149,4 +149,4 @@
   43.85 + /* Now the generic Linux version.  */
   43.86 + #undef __sysconf
   43.87 + #define __sysconf static linux_sysconf
   43.88 +-#include "../sysconf.c"
   43.89 ++#include <sysdeps/unix/sysv/linux/sysconf.c>
   43.90 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/getdents64.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/getdents64.c
   43.91 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c
   43.92 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c
   43.93 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c
   43.94 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c
   43.95 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c
   43.96 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c
   43.97 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c
   43.98 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/sysconf.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/sysconf.c
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/patches/glibc/ports-2.10.1/520-alpha-add-futex-defines.patch	Fri Nov 13 21:37:18 2009 +0100
    44.3 @@ -0,0 +1,26 @@
    44.4 +2009-05-19  Aurelien Jarno  <aurelien@aurel32.net>
    44.5 +
    44.6 +	* sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h: Define
    44.7 +	FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET, FUTEX_CLOCK_REALTIME and
    44.8 +	FUTEX_BITSET_MATCH_ANY.
    44.9 +
   44.10 + ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h |    5 +++++
   44.11 + 1 file changed, 5 insertions(+)
   44.12 +
   44.13 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h
   44.14 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h	2009-05-16 10:36:20.000000000 +0200
   44.15 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h	2009-11-13 00:51:11.000000000 +0100
   44.16 +@@ -37,7 +37,12 @@
   44.17 + #define FUTEX_LOCK_PI		6
   44.18 + #define FUTEX_UNLOCK_PI		7
   44.19 + #define FUTEX_TRYLOCK_PI	8
   44.20 ++#define FUTEX_WAIT_BITSET	9
   44.21 ++#define FUTEX_WAKE_BITSET	10
   44.22 + #define FUTEX_PRIVATE_FLAG	128
   44.23 ++#define FUTEX_CLOCK_REALTIME	256
   44.24 ++
   44.25 ++#define FUTEX_BITSET_MATCH_ANY	0xffffffff
   44.26 + 
   44.27 + /* Values for 'private' parameter of locking macros.  Yes, the
   44.28 +    definition seems to be backwards.  But it is not.  The bit will be
   44.29 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/patches/glibc/ports-2.10.1/530-alpha-fix-rtld-fPIC.patch	Fri Nov 13 21:37:18 2009 +0100
    45.3 @@ -0,0 +1,21 @@
    45.4 +2009-05-26  Aurelien Jarno  <aurelien@aurel32.net>
    45.5 +
    45.6 +	* sysdeps/alpha/Makefile (CFLAGS-rtld.c): add $(PIC-ccflag).
    45.7 +
    45.8 + ports/sysdeps/alpha/Makefile |    3 ++-
    45.9 + 1 file changed, 2 insertions(+), 1 deletion(-)
   45.10 +
   45.11 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/Makefile glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/Makefile
   45.12 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/Makefile	2009-05-16 10:36:20.000000000 +0200
   45.13 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/Makefile	2009-11-13 00:51:13.000000000 +0100
   45.14 +@@ -35,7 +35,8 @@
   45.15 + 
   45.16 + ifeq ($(subdir),elf)
   45.17 + # The ld.so startup code cannot use literals until it self-relocates.
   45.18 +-CFLAGS-rtld.c = -mbuild-constants
   45.19 ++# It uses more than 64k for the small data area.
   45.20 ++CFLAGS-rtld.c = -mbuild-constants $(PIC-ccflag)
   45.21 + endif
   45.22 + 
   45.23 + # Build everything with full IEEE math support, and with dynamic rounding;
   45.24 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/Makefile glibc-2.10.1/ports/sysdeps/alpha/Makefile
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/patches/glibc/ports-2.10.1/540-alpha-fix-memchr.patch	Fri Nov 13 21:37:18 2009 +0100
    46.3 @@ -0,0 +1,121 @@
    46.4 +2009-07-27  Aurelien Jarno  <aurelien@aurel32.net>
    46.5 +
    46.6 +	* sysdeps/alpha/memchr.S: Use prefetch load.
    46.7 +	* sysdeps/alpha/alphaev6/memchr.S: Likewise.
    46.8 +
    46.9 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/alphaev6/memchr.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/alphaev6/memchr.S
   46.10 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/alphaev6/memchr.S	2009-05-16 10:36:20.000000000 +0200
   46.11 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/alphaev6/memchr.S	2009-11-13 00:51:15.000000000 +0100
   46.12 +@@ -127,7 +127,7 @@
   46.13 +         cmpbge  $31, $1, $2	# E :
   46.14 +         bne     $2, $found_it	# U :
   46.15 + 	# At least one byte left to process.
   46.16 +-	ldq	$1, 8($0)	# L :
   46.17 ++	ldq	$31, 8($0)	# L :
   46.18 + 	subq	$5, 1, $18	# E : U L U L
   46.19 + 
   46.20 + 	addq	$0, 8, $0	# E :
   46.21 +@@ -143,38 +143,38 @@
   46.22 + 	and	$4, 8, $4	# E : odd number of quads?
   46.23 + 	bne	$4, $odd_quad_count # U :
   46.24 + 	# At least three quads remain to be accessed
   46.25 +-	mov	$1, $4		# E : L U L U : move prefetched value to correct reg
   46.26 ++	nop			# E : L U L U : move prefetched value to correct reg
   46.27 + 
   46.28 + 	.align	4
   46.29 + $unrolled_loop:
   46.30 +-	ldq	$1, 8($0)	# L : prefetch $1
   46.31 +-	xor	$17, $4, $2	# E :
   46.32 +-	cmpbge	$31, $2, $2	# E :
   46.33 +-	bne	$2, $found_it	# U : U L U L
   46.34 ++	ldq	$1, 0($0)	# L : load quad
   46.35 ++	xor	$17, $1, $2	# E :
   46.36 ++	ldq	$31, 8($0)	# L : prefetch next quad
   46.37 ++	cmpbge	$31, $2, $2	# E : U L U L
   46.38 + 
   46.39 ++	bne	$2, $found_it	# U :
   46.40 + 	addq	$0, 8, $0	# E :
   46.41 + 	nop			# E :
   46.42 + 	nop			# E :
   46.43 +-	nop			# E :
   46.44 + 
   46.45 + $odd_quad_count:
   46.46 ++	ldq	$1, 0($0)	# L : load quad
   46.47 + 	xor	$17, $1, $2	# E :
   46.48 +-	ldq	$4, 8($0)	# L : prefetch $4
   46.49 ++	ldq	$31, 8($0)	# L : prefetch $4
   46.50 + 	cmpbge	$31, $2, $2	# E :
   46.51 +-	addq	$0, 8, $6	# E :
   46.52 + 
   46.53 ++	addq	$0, 8, $6	# E :
   46.54 + 	bne	$2, $found_it	# U :
   46.55 + 	cmpult	$6, $18, $6	# E :
   46.56 + 	addq	$0, 8, $0	# E :
   46.57 +-	nop			# E :
   46.58 + 
   46.59 + 	bne	$6, $unrolled_loop # U :
   46.60 +-	mov	$4, $1		# E : move prefetched value into $1
   46.61 + 	nop			# E :
   46.62 + 	nop			# E :
   46.63 +-
   46.64 +-$final:	subq	$5, $0, $18	# E : $18 <- number of bytes left to do
   46.65 + 	nop			# E :
   46.66 ++
   46.67 ++$final:	ldq	$1, 0($0)	# L : load last quad
   46.68 ++	subq	$5, $0, $18	# E : $18 <- number of bytes left to do
   46.69 + 	nop			# E :
   46.70 + 	bne	$18, $last_quad	# U :
   46.71 + 
   46.72 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/memchr.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/memchr.S
   46.73 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/memchr.S	2009-05-16 10:36:20.000000000 +0200
   46.74 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/memchr.S	2009-11-13 00:51:15.000000000 +0100
   46.75 +@@ -119,7 +119,7 @@
   46.76 + 
   46.77 + 	# At least one byte left to process.
   46.78 + 
   46.79 +-	ldq	t0, 8(v0)	# e0	:
   46.80 ++	ldq	zero, 8(v0)	# e0	: prefetch next quad
   46.81 + 	subq	t4, 1, a2	# .. e1 :
   46.82 + 	addq	v0, 8, v0	#-e0	:
   46.83 + 
   46.84 +@@ -138,19 +138,19 @@
   46.85 + 
   46.86 + 	# At least three quads remain to be accessed
   46.87 + 
   46.88 +-	mov	t0, t3		# e0	: move prefetched value to correct reg
   46.89 +-
   46.90 + 	.align	4
   46.91 + $unrolled_loop:
   46.92 +-	ldq	t0, 8(v0)	#-e0	: prefetch t0
   46.93 +-	xor	a1, t3, t1	# .. e1 :
   46.94 +-	cmpbge	zero, t1, t1	# e0	:
   46.95 +-	bne	t1, $found_it	# .. e1 :
   46.96 ++	ldq	t0, 0(v0)	# e0	: load quad
   46.97 ++	xor	a1, t0, t1	# .. e1 :
   46.98 ++	ldq	zero, 8(v0)	# e0	: prefetch next quad
   46.99 ++	cmpbge	zero, t1, t1	# .. e1:
  46.100 ++	bne	t1, $found_it	# e0    :
  46.101 + 
  46.102 +-	addq	v0, 8, v0	#-e0	:
  46.103 ++	addq	v0, 8, v0	#    e1	:
  46.104 + $odd_quad_count:
  46.105 ++	ldq	t0, 0(v0)	# e0	: load quad
  46.106 + 	xor	a1, t0, t1	# .. e1 :
  46.107 +-	ldq	t3, 8(v0)	# e0	: prefetch t3
  46.108 ++	ldq	zero, 8(v0)	# e0	: prefetch next quad
  46.109 + 	cmpbge	zero, t1, t1	# .. e1 :
  46.110 + 	addq	v0, 8, t5	#-e0	:
  46.111 + 	bne	t1, $found_it	# .. e1	:
  46.112 +@@ -159,8 +159,8 @@
  46.113 + 	addq	v0, 8, v0	# .. e1 :
  46.114 + 	bne	t5, $unrolled_loop #-e1 :
  46.115 + 
  46.116 +-	mov	t3, t0		# e0	: move prefetched value into t0
  46.117 +-$final:	subq	t4, v0, a2	# .. e1	: a2 <- number of bytes left to do
  46.118 ++$final:	ldq	t0, 0(v0)	# e0	: load last quad
  46.119 ++	subq	t4, v0, a2	# .. e1	: a2 <- number of bytes left to do
  46.120 + 	bne	a2, $last_quad	# e1	:
  46.121 + 
  46.122 + $not_found:
  46.123 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/alphaev6/memchr.S glibc-2.10.1/ports/sysdeps/alpha/alphaev6/memchr.S
  46.124 +diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/memchr.S glibc-2.10.1/ports/sysdeps/alpha/memchr.S
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/patches/glibc/ports-2.10.1/550-alpha-fix-SOCK_NONBLOCK.patch	Fri Nov 13 21:37:18 2009 +0100
    47.3 @@ -0,0 +1,417 @@
    47.4 +2009-08-16  Aurelien Jarno  <aurelien@aurel32.net>
    47.5 +
    47.6 +	* ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h: New file based on
    47.7 +	the generic version, with SOCK_NONBLOCK matching the kernel value.
    47.8 +
    47.9 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h
   47.10 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h	1970-01-01 01:00:00.000000000 +0100
   47.11 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h	2009-11-13 00:51:17.000000000 +0100
   47.12 +@@ -0,0 +1,407 @@
   47.13 ++/* System-specific socket constants and types.  Linux version.
   47.14 ++   Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009
   47.15 ++   Free Software Foundation, Inc.
   47.16 ++   This file is part of the GNU C Library.
   47.17 ++
   47.18 ++   The GNU C Library is free software; you can redistribute it and/or
   47.19 ++   modify it under the terms of the GNU Lesser General Public
   47.20 ++   License as published by the Free Software Foundation; either
   47.21 ++   version 2.1 of the License, or (at your option) any later version.
   47.22 ++
   47.23 ++   The GNU C Library is distributed in the hope that it will be useful,
   47.24 ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
   47.25 ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   47.26 ++   Lesser General Public License for more details.
   47.27 ++
   47.28 ++   You should have received a copy of the GNU Lesser General Public
   47.29 ++   License along with the GNU C Library; if not, write to the Free
   47.30 ++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   47.31 ++   02111-1307 USA.  */
   47.32 ++
   47.33 ++#ifndef __BITS_SOCKET_H
   47.34 ++#define __BITS_SOCKET_H
   47.35 ++
   47.36 ++#ifndef _SYS_SOCKET_H
   47.37 ++# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
   47.38 ++#endif
   47.39 ++
   47.40 ++#define	__need_size_t
   47.41 ++#include <stddef.h>
   47.42 ++
   47.43 ++#include <sys/types.h>
   47.44 ++
   47.45 ++/* Type for length arguments in socket calls.  */
   47.46 ++#ifndef __socklen_t_defined
   47.47 ++typedef __socklen_t socklen_t;
   47.48 ++# define __socklen_t_defined
   47.49 ++#endif
   47.50 ++
   47.51 ++/* Types of sockets.  */
   47.52 ++enum __socket_type
   47.53 ++{
   47.54 ++  SOCK_STREAM = 1,		/* Sequenced, reliable, connection-based
   47.55 ++				   byte streams.  */
   47.56 ++#define SOCK_STREAM SOCK_STREAM
   47.57 ++  SOCK_DGRAM = 2,		/* Connectionless, unreliable datagrams
   47.58 ++				   of fixed maximum length.  */
   47.59 ++#define SOCK_DGRAM SOCK_DGRAM
   47.60 ++  SOCK_RAW = 3,			/* Raw protocol interface.  */
   47.61 ++#define SOCK_RAW SOCK_RAW
   47.62 ++  SOCK_RDM = 4,			/* Reliably-delivered messages.  */
   47.63 ++#define SOCK_RDM SOCK_RDM
   47.64 ++  SOCK_SEQPACKET = 5,		/* Sequenced, reliable, connection-based,
   47.65 ++				   datagrams of fixed maximum length.  */
   47.66 ++#define SOCK_SEQPACKET SOCK_SEQPACKET
   47.67 ++  SOCK_DCCP = 6,		/* Datagram Congestion Control Protocol.  */
   47.68 ++#define SOCK_DCCP SOCK_DCCP
   47.69 ++  SOCK_PACKET = 10,		/* Linux specific way of getting packets
   47.70 ++				   at the dev level.  For writing rarp and
   47.71 ++				   other similar things on the user level. */
   47.72 ++#define SOCK_PACKET SOCK_PACKET
   47.73 ++
   47.74 ++  /* Flags to be ORed into the type parameter of socket and socketpair and
   47.75 ++     used for the flags parameter of paccept.  */
   47.76 ++
   47.77 ++  SOCK_CLOEXEC = 02000000,	/* Atomically set close-on-exec flag for the
   47.78 ++				   new descriptor(s).  */
   47.79 ++#define SOCK_CLOEXEC SOCK_CLOEXEC
   47.80 ++#undef SOCK_NONBLOCK
   47.81 ++  SOCK_NONBLOCK = 0x40000000	/* Atomically mark descriptor(s) as
   47.82 ++				   non-blocking.  */
   47.83 ++#define SOCK_NONBLOCK SOCK_NONBLOCK
   47.84 ++};
   47.85 ++
   47.86 ++/* Protocol families.  */
   47.87 ++#define	PF_UNSPEC	0	/* Unspecified.  */
   47.88 ++#define	PF_LOCAL	1	/* Local to host (pipes and file-domain).  */
   47.89 ++#define	PF_UNIX		PF_LOCAL /* POSIX name for PF_LOCAL.  */
   47.90 ++#define	PF_FILE		PF_LOCAL /* Another non-standard name for PF_LOCAL.  */
   47.91 ++#define	PF_INET		2	/* IP protocol family.  */
   47.92 ++#define	PF_AX25		3	/* Amateur Radio AX.25.  */
   47.93 ++#define	PF_IPX		4	/* Novell Internet Protocol.  */
   47.94 ++#define	PF_APPLETALK	5	/* Appletalk DDP.  */
   47.95 ++#define	PF_NETROM	6	/* Amateur radio NetROM.  */
   47.96 ++#define	PF_BRIDGE	7	/* Multiprotocol bridge.  */
   47.97 ++#define	PF_ATMPVC	8	/* ATM PVCs.  */
   47.98 ++#define	PF_X25		9	/* Reserved for X.25 project.  */
   47.99 ++#define	PF_INET6	10	/* IP version 6.  */
  47.100 ++#define	PF_ROSE		11	/* Amateur Radio X.25 PLP.  */
  47.101 ++#define	PF_DECnet	12	/* Reserved for DECnet project.  */
  47.102 ++#define	PF_NETBEUI	13	/* Reserved for 802.2LLC project.  */
  47.103 ++#define	PF_SECURITY	14	/* Security callback pseudo AF.  */
  47.104 ++#define	PF_KEY		15	/* PF_KEY key management API.  */
  47.105 ++#define	PF_NETLINK	16
  47.106 ++#define	PF_ROUTE	PF_NETLINK /* Alias to emulate 4.4BSD.  */
  47.107 ++#define	PF_PACKET	17	/* Packet family.  */
  47.108 ++#define	PF_ASH		18	/* Ash.  */
  47.109 ++#define	PF_ECONET	19	/* Acorn Econet.  */
  47.110 ++#define	PF_ATMSVC	20	/* ATM SVCs.  */
  47.111 ++#define PF_RDS		21	/* RDS sockets.  */
  47.112 ++#define	PF_SNA		22	/* Linux SNA Project */
  47.113 ++#define	PF_IRDA		23	/* IRDA sockets.  */
  47.114 ++#define	PF_PPPOX	24	/* PPPoX sockets.  */
  47.115 ++#define	PF_WANPIPE	25	/* Wanpipe API sockets.  */
  47.116 ++#define PF_LLC		26	/* Linux LLC.  */
  47.117 ++#define PF_CAN		29	/* Controller Area Network.  */
  47.118 ++#define PF_TIPC		30	/* TIPC sockets.  */
  47.119 ++#define	PF_BLUETOOTH	31	/* Bluetooth sockets.  */
  47.120 ++#define	PF_IUCV		32	/* IUCV sockets.  */
  47.121 ++#define PF_RXRPC	33	/* RxRPC sockets.  */
  47.122 ++#define PF_ISDN		34	/* mISDN sockets.  */
  47.123 ++#define PF_PHONET	35	/* Phonet sockets.  */
  47.124 ++#define PF_IEEE802154	36	/* IEEE 802.15.4 sockets.  */
  47.125 ++#define	PF_MAX		37	/* For now..  */
  47.126 ++
  47.127 ++/* Address families.  */
  47.128 ++#define	AF_UNSPEC	PF_UNSPEC
  47.129 ++#define	AF_LOCAL	PF_LOCAL
  47.130 ++#define	AF_UNIX		PF_UNIX
  47.131 ++#define	AF_FILE		PF_FILE
  47.132 ++#define	AF_INET		PF_INET
  47.133 ++#define	AF_AX25		PF_AX25
  47.134 ++#define	AF_IPX		PF_IPX
  47.135 ++#define	AF_APPLETALK	PF_APPLETALK
  47.136 ++#define	AF_NETROM	PF_NETROM
  47.137 ++#define	AF_BRIDGE	PF_BRIDGE
  47.138 ++#define	AF_ATMPVC	PF_ATMPVC
  47.139 ++#define	AF_X25		PF_X25
  47.140 ++#define	AF_INET6	PF_INET6
  47.141 ++#define	AF_ROSE		PF_ROSE
  47.142 ++#define	AF_DECnet	PF_DECnet
  47.143 ++#define	AF_NETBEUI	PF_NETBEUI
  47.144 ++#define	AF_SECURITY	PF_SECURITY
  47.145 ++#define	AF_KEY		PF_KEY
  47.146 ++#define	AF_NETLINK	PF_NETLINK
  47.147 ++#define	AF_ROUTE	PF_ROUTE
  47.148 ++#define	AF_PACKET	PF_PACKET
  47.149 ++#define	AF_ASH		PF_ASH
  47.150 ++#define	AF_ECONET	PF_ECONET
  47.151 ++#define	AF_ATMSVC	PF_ATMSVC
  47.152 ++#define AF_RDS		PF_RDS
  47.153 ++#define	AF_SNA		PF_SNA
  47.154 ++#define	AF_IRDA		PF_IRDA
  47.155 ++#define	AF_PPPOX	PF_PPPOX
  47.156 ++#define	AF_WANPIPE	PF_WANPIPE
  47.157 ++#define AF_LLC		PF_LLC
  47.158 ++#define AF_CAN		PF_CAN
  47.159 ++#define AF_TIPC		PF_TIPC
  47.160 ++#define	AF_BLUETOOTH	PF_BLUETOOTH
  47.161 ++#define	AF_IUCV		PF_IUCV
  47.162 ++#define AF_RXRPC	PF_RXRPC
  47.163 ++#define AF_ISDN		PF_ISDN
  47.164 ++#define AF_PHONET	PF_PHONET
  47.165 ++#define AF_IEEE802154	PF_IEEE802154
  47.166 ++#define	AF_MAX		PF_MAX
  47.167 ++
  47.168 ++/* Socket level values.  Others are defined in the appropriate headers.
  47.169 ++
  47.170 ++   XXX These definitions also should go into the appropriate headers as
  47.171 ++   far as they are available.  */
  47.172 ++#define SOL_RAW		255
  47.173 ++#define SOL_DECNET      261
  47.174 ++#define SOL_X25         262
  47.175 ++#define SOL_PACKET	263
  47.176 ++#define SOL_ATM		264	/* ATM layer (cell level).  */
  47.177 ++#define SOL_AAL		265	/* ATM Adaption Layer (packet level).  */
  47.178 ++#define SOL_IRDA	266
  47.179 ++
  47.180 ++/* Maximum queue length specifiable by listen.  */
  47.181 ++#define SOMAXCONN	128
  47.182 ++
  47.183 ++/* Get the definition of the macro to define the common sockaddr members.  */
  47.184 ++#include <bits/sockaddr.h>
  47.185 ++
  47.186 ++/* Structure describing a generic socket address.  */
  47.187 ++struct sockaddr
  47.188 ++  {
  47.189 ++    __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
  47.190 ++    char sa_data[14];		/* Address data.  */
  47.191 ++  };
  47.192 ++
  47.193 ++
  47.194 ++/* Structure large enough to hold any socket address (with the historical
  47.195 ++   exception of AF_UNIX).  We reserve 128 bytes.  */
  47.196 ++#define __ss_aligntype	unsigned long int
  47.197 ++#define _SS_SIZE	128
  47.198 ++#define _SS_PADSIZE	(_SS_SIZE - (2 * sizeof (__ss_aligntype)))
  47.199 ++
  47.200 ++struct sockaddr_storage
  47.201 ++  {
  47.202 ++    __SOCKADDR_COMMON (ss_);	/* Address family, etc.  */
  47.203 ++    __ss_aligntype __ss_align;	/* Force desired alignment.  */
  47.204 ++    char __ss_padding[_SS_PADSIZE];
  47.205 ++  };
  47.206 ++
  47.207 ++
  47.208 ++/* Bits in the FLAGS argument to `send', `recv', et al.  */
  47.209 ++enum
  47.210 ++  {
  47.211 ++    MSG_OOB		= 0x01,	/* Process out-of-band data.  */
  47.212 ++#define MSG_OOB		MSG_OOB
  47.213 ++    MSG_PEEK		= 0x02,	/* Peek at incoming messages.  */
  47.214 ++#define MSG_PEEK	MSG_PEEK
  47.215 ++    MSG_DONTROUTE	= 0x04,	/* Don't use local routing.  */
  47.216 ++#define MSG_DONTROUTE	MSG_DONTROUTE
  47.217 ++#ifdef __USE_GNU
  47.218 ++    /* DECnet uses a different name.  */
  47.219 ++    MSG_TRYHARD		= MSG_DONTROUTE,
  47.220 ++# define MSG_TRYHARD	MSG_DONTROUTE
  47.221 ++#endif
  47.222 ++    MSG_CTRUNC		= 0x08,	/* Control data lost before delivery.  */
  47.223 ++#define MSG_CTRUNC	MSG_CTRUNC
  47.224 ++    MSG_PROXY		= 0x10,	/* Supply or ask second address.  */
  47.225 ++#define MSG_PROXY	MSG_PROXY
  47.226 ++    MSG_TRUNC		= 0x20,
  47.227 ++#define	MSG_TRUNC	MSG_TRUNC
  47.228 ++    MSG_DONTWAIT	= 0x40, /* Nonblocking IO.  */
  47.229 ++#define	MSG_DONTWAIT	MSG_DONTWAIT
  47.230 ++    MSG_EOR		= 0x80, /* End of record.  */
  47.231 ++#define	MSG_EOR		MSG_EOR
  47.232 ++    MSG_WAITALL		= 0x100, /* Wait for a full request.  */
  47.233 ++#define	MSG_WAITALL	MSG_WAITALL
  47.234 ++    MSG_FIN		= 0x200,
  47.235 ++#define	MSG_FIN		MSG_FIN
  47.236 ++    MSG_SYN		= 0x400,
  47.237 ++#define	MSG_SYN		MSG_SYN
  47.238 ++    MSG_CONFIRM		= 0x800, /* Confirm path validity.  */
  47.239 ++#define	MSG_CONFIRM	MSG_CONFIRM
  47.240 ++    MSG_RST		= 0x1000,
  47.241 ++#define	MSG_RST		MSG_RST
  47.242 ++    MSG_ERRQUEUE	= 0x2000, /* Fetch message from error queue.  */
  47.243 ++#define	MSG_ERRQUEUE	MSG_ERRQUEUE
  47.244 ++    MSG_NOSIGNAL	= 0x4000, /* Do not generate SIGPIPE.  */
  47.245 ++#define	MSG_NOSIGNAL	MSG_NOSIGNAL
  47.246 ++    MSG_MORE		= 0x8000,  /* Sender will send more.  */
  47.247 ++#define	MSG_MORE	MSG_MORE
  47.248 ++
  47.249 ++    MSG_CMSG_CLOEXEC	= 0x40000000	/* Set close_on_exit for file
  47.250 ++                                           descriptor received through
  47.251 ++                                           SCM_RIGHTS.  */
  47.252 ++#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
  47.253 ++  };
  47.254 ++
  47.255 ++
  47.256 ++/* Structure describing messages sent by
  47.257 ++   `sendmsg' and received by `recvmsg'.  */
  47.258 ++struct msghdr
  47.259 ++  {
  47.260 ++    void *msg_name;		/* Address to send to/receive from.  */
  47.261 ++    socklen_t msg_namelen;	/* Length of address data.  */
  47.262 ++
  47.263 ++    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
  47.264 ++    size_t msg_iovlen;		/* Number of elements in the vector.  */
  47.265 ++
  47.266 ++    void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
  47.267 ++    size_t msg_controllen;	/* Ancillary data buffer length.
  47.268 ++				   !! The type should be socklen_t but the
  47.269 ++				   definition of the kernel is incompatible
  47.270 ++				   with this.  */
  47.271 ++
  47.272 ++    int msg_flags;		/* Flags on received message.  */
  47.273 ++  };
  47.274 ++
  47.275 ++/* Structure used for storage of ancillary data object information.  */
  47.276 ++struct cmsghdr
  47.277 ++  {
  47.278 ++    size_t cmsg_len;		/* Length of data in cmsg_data plus length
  47.279 ++				   of cmsghdr structure.
  47.280 ++				   !! The type should be socklen_t but the
  47.281 ++				   definition of the kernel is incompatible
  47.282 ++				   with this.  */
  47.283 ++    int cmsg_level;		/* Originating protocol.  */
  47.284 ++    int cmsg_type;		/* Protocol specific type.  */
  47.285 ++#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
  47.286 ++    __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
  47.287 ++#endif
  47.288 ++  };
  47.289 ++
  47.290 ++/* Ancillary data object manipulation macros.  */
  47.291 ++#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
  47.292 ++# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
  47.293 ++#else
  47.294 ++# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
  47.295 ++#endif
  47.296 ++#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
  47.297 ++#define CMSG_FIRSTHDR(mhdr) \
  47.298 ++  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)		      \
  47.299 ++   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
  47.300 ++#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
  47.301 ++			 & (size_t) ~(sizeof (size_t) - 1))
  47.302 ++#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
  47.303 ++			 + CMSG_ALIGN (sizeof (struct cmsghdr)))
  47.304 ++#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
  47.305 ++
  47.306 ++extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
  47.307 ++				      struct cmsghdr *__cmsg) __THROW;
  47.308 ++#ifdef __USE_EXTERN_INLINES
  47.309 ++# ifndef _EXTERN_INLINE
  47.310 ++#  define _EXTERN_INLINE __extern_inline
  47.311 ++# endif
  47.312 ++_EXTERN_INLINE struct cmsghdr *
  47.313 ++__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
  47.314 ++{
  47.315 ++  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
  47.316 ++    /* The kernel header does this so there may be a reason.  */
  47.317 ++    return 0;
  47.318 ++
  47.319 ++  __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
  47.320 ++			       + CMSG_ALIGN (__cmsg->cmsg_len));
  47.321 ++  if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
  47.322 ++					+ __mhdr->msg_controllen)
  47.323 ++      || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
  47.324 ++	  > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
  47.325 ++    /* No more entries.  */
  47.326 ++    return 0;
  47.327 ++  return __cmsg;
  47.328 ++}
  47.329 ++#endif	/* Use `extern inline'.  */
  47.330 ++
  47.331 ++/* Socket level message types.  This must match the definitions in
  47.332 ++   <linux/socket.h>.  */
  47.333 ++enum
  47.334 ++  {
  47.335 ++    SCM_RIGHTS = 0x01		/* Transfer file descriptors.  */
  47.336 ++#define SCM_RIGHTS SCM_RIGHTS
  47.337 ++#ifdef __USE_GNU
  47.338 ++    , SCM_CREDENTIALS = 0x02	/* Credentials passing.  */
  47.339 ++# define SCM_CREDENTIALS SCM_CREDENTIALS
  47.340 ++#endif
  47.341 ++  };
  47.342 ++
  47.343 ++#ifdef __USE_GNU
  47.344 ++/* User visible structure for SCM_CREDENTIALS message */
  47.345 ++struct ucred
  47.346 ++{
  47.347 ++  pid_t pid;			/* PID of sending process.  */
  47.348 ++  uid_t uid;			/* UID of sending process.  */
  47.349 ++  gid_t gid;			/* GID of sending process.  */
  47.350 ++};
  47.351 ++#endif
  47.352 ++
  47.353 ++/* Ugly workaround for unclean kernel headers.  */
  47.354 ++#if !defined __USE_MISC && !defined __USE_GNU
  47.355 ++# ifndef FIOGETOWN
  47.356 ++#  define __SYS_SOCKET_H_undef_FIOGETOWN
  47.357 ++# endif
  47.358 ++# ifndef FIOSETOWN
  47.359 ++#  define __SYS_SOCKET_H_undef_FIOSETOWN
  47.360 ++# endif
  47.361 ++# ifndef SIOCATMARK
  47.362 ++#  define __SYS_SOCKET_H_undef_SIOCATMARK
  47.363 ++# endif
  47.364 ++# ifndef SIOCGPGRP
  47.365 ++#  define __SYS_SOCKET_H_undef_SIOCGPGRP
  47.366 ++# endif
  47.367 ++# ifndef SIOCGSTAMP
  47.368 ++#  define __SYS_SOCKET_H_undef_SIOCGSTAMP
  47.369 ++# endif
  47.370 ++# ifndef SIOCGSTAMPNS
  47.371 ++#  define __SYS_SOCKET_H_undef_SIOCGSTAMPNS
  47.372 ++# endif
  47.373 ++# ifndef SIOCSPGRP
  47.374 ++#  define __SYS_SOCKET_H_undef_SIOCSPGRP
  47.375 ++# endif
  47.376 ++#endif
  47.377 ++
  47.378 ++/* Get socket manipulation related informations from kernel headers.  */
  47.379 ++#include <asm/socket.h>
  47.380 ++
  47.381 ++#if !defined __USE_MISC && !defined __USE_GNU
  47.382 ++# ifdef __SYS_SOCKET_H_undef_FIOGETOWN
  47.383 ++#  undef __SYS_SOCKET_H_undef_FIOGETOWN
  47.384 ++#  undef FIOGETOWN
  47.385 ++# endif
  47.386 ++# ifdef __SYS_SOCKET_H_undef_FIOSETOWN
  47.387 ++#  undef __SYS_SOCKET_H_undef_FIOSETOWN
  47.388 ++#  undef FIOSETOWN
  47.389 ++# endif
  47.390 ++# ifdef __SYS_SOCKET_H_undef_SIOCATMARK
  47.391 ++#  undef __SYS_SOCKET_H_undef_SIOCATMARK
  47.392 ++#  undef SIOCATMARK
  47.393 ++# endif
  47.394 ++# ifdef __SYS_SOCKET_H_undef_SIOCGPGRP
  47.395 ++#  undef __SYS_SOCKET_H_undef_SIOCGPGRP
  47.396 ++#  undef SIOCGPGRP
  47.397 ++# endif
  47.398 ++# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP
  47.399 ++#  undef __SYS_SOCKET_H_undef_SIOCGSTAMP
  47.400 ++#  undef SIOCGSTAMP
  47.401 ++# endif
  47.402 ++# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
  47.403 ++#  undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
  47.404 ++#  undef SIOCGSTAMPNS
  47.405 ++# endif
  47.406 ++# ifdef __SYS_SOCKET_H_undef_SIOCSPGRP
  47.407 ++#  undef __SYS_SOCKET_H_undef_SIOCSPGRP
  47.408 ++#  undef SIOCSPGRP
  47.409 ++# endif
  47.410 ++#endif
  47.411 ++
  47.412 ++/* Structure used to manipulate the SO_LINGER option.  */
  47.413 ++struct linger
  47.414 ++  {
  47.415 ++    int l_onoff;		/* Nonzero to linger on close.  */
  47.416 ++    int l_linger;		/* Time to linger.  */
  47.417 ++  };
  47.418 ++
  47.419 ++#endif	/* bits/socket.h */
  47.420 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/patches/glibc/ports-2.10.1/560-ppc-atomic.patch	Fri Nov 13 21:37:18 2009 +0100
    48.3 @@ -0,0 +1,415 @@
    48.4 +sniped from suse
    48.5 +
    48.6 +Index: sysdeps/powerpc/bits/atomic.h
    48.7 +===================================================================
    48.8 +RCS file: /cvs/glibc/libc/sysdeps/powerpc/bits/atomic.h,v
    48.9 +retrieving revision 1.17
   48.10 +diff -u -a -p -r1.17 atomic.h
   48.11 +
   48.12 +diff -durN glibc-2.10.1.orig/sysdeps/powerpc/bits/atomic.h glibc-2.10.1/sysdeps/powerpc/bits/atomic.h
   48.13 +--- glibc-2.10.1.orig/sysdeps/powerpc/bits/atomic.h	2007-03-26 22:15:28.000000000 +0200
   48.14 ++++ glibc-2.10.1/sysdeps/powerpc/bits/atomic.h	2009-11-13 00:51:19.000000000 +0100
   48.15 +@@ -85,14 +85,14 @@
   48.16 +       __typeof (*(mem)) __tmp;						      \
   48.17 +       __typeof (mem)  __memp = (mem);					      \
   48.18 +       __asm __volatile (						      \
   48.19 +-		        "1:	lwarx	%0,0,%1" MUTEX_HINT_ACQ "\n"	      \
   48.20 ++		        "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
   48.21 + 		        "	cmpw	%0,%2\n"			      \
   48.22 + 		        "	bne	2f\n"				      \
   48.23 +-		        "	stwcx.	%3,0,%1\n"			      \
   48.24 ++		        "	stwcx.	%3,%y1\n"			      \
   48.25 + 		        "	bne-	1b\n"				      \
   48.26 + 		        "2:	" __ARCH_ACQ_INSTR			      \
   48.27 +-		        : "=&r" (__tmp)					      \
   48.28 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
   48.29 ++		        : "=&r" (__tmp), "+Z" (*__memp)			      \
   48.30 ++		        : "r" (oldval), "r" (newval)			      \
   48.31 + 		        : "cr0", "memory");				      \
   48.32 +       __tmp;								      \
   48.33 +   })
   48.34 +@@ -102,14 +102,14 @@
   48.35 +       __typeof (*(mem)) __tmp;						      \
   48.36 +       __typeof (mem)  __memp = (mem);					      \
   48.37 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
   48.38 +-		        "1:	lwarx	%0,0,%1" MUTEX_HINT_REL "\n"	      \
   48.39 ++		        "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
   48.40 + 		        "	cmpw	%0,%2\n"			      \
   48.41 + 		        "	bne	2f\n"				      \
   48.42 +-		        "	stwcx.	%3,0,%1\n"			      \
   48.43 ++		        "	stwcx.	%3,%y1\n"			      \
   48.44 + 		        "	bne-	1b\n"				      \
   48.45 + 		        "2:	"					      \
   48.46 +-		        : "=&r" (__tmp)					      \
   48.47 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
   48.48 ++		        : "=&r" (__tmp), "+Z" (__memp)			      \
   48.49 ++		        : "r" (oldval), "r" (newval)			      \
   48.50 + 		        : "cr0", "memory");				      \
   48.51 +       __tmp;								      \
   48.52 +   })
   48.53 +@@ -118,12 +118,12 @@
   48.54 +   ({									      \
   48.55 +     __typeof (*mem) __val;						      \
   48.56 +     __asm __volatile (							      \
   48.57 +-		      "1:	lwarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	      \
   48.58 +-		      "		stwcx.	%3,0,%2\n"			      \
   48.59 ++		      "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
   48.60 ++		      "		stwcx.	%2,%y1\n"			      \
   48.61 + 		      "		bne-	1b\n"				      \
   48.62 + 		      "   " __ARCH_ACQ_INSTR				      \
   48.63 +-		      : "=&r" (__val), "=m" (*mem)			      \
   48.64 +-		      : "b" (mem), "r" (value), "m" (*mem)		      \
   48.65 ++		      : "=&r" (__val), "+Z" (*mem)			      \
   48.66 ++		      : "r" (value)					      \
   48.67 + 		      : "cr0", "memory");				      \
   48.68 +     __val;								      \
   48.69 +   })
   48.70 +@@ -132,11 +132,11 @@
   48.71 +   ({									      \
   48.72 +     __typeof (*mem) __val;						      \
   48.73 +     __asm __volatile (__ARCH_REL_INSTR "\n"				      \
   48.74 +-		      "1:	lwarx	%0,0,%2" MUTEX_HINT_REL "\n"	      \
   48.75 +-		      "		stwcx.	%3,0,%2\n"			      \
   48.76 ++		      "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
   48.77 ++		      "		stwcx.	%2,%y1\n"			      \
   48.78 + 		      "		bne-	1b"				      \
   48.79 +-		      : "=&r" (__val), "=m" (*mem)			      \
   48.80 +-		      : "b" (mem), "r" (value), "m" (*mem)		      \
   48.81 ++		      : "=&r" (__val), "+Z" (*mem)			      \
   48.82 ++		      : "r" (value)					      \
   48.83 + 		      : "cr0", "memory");				      \
   48.84 +     __val;								      \
   48.85 +   })
   48.86 +@@ -144,12 +144,12 @@
   48.87 + #define __arch_atomic_exchange_and_add_32(mem, value) \
   48.88 +   ({									      \
   48.89 +     __typeof (*mem) __val, __tmp;					      \
   48.90 +-    __asm __volatile ("1:	lwarx	%0,0,%3\n"			      \
   48.91 +-		      "		add	%1,%0,%4\n"			      \
   48.92 +-		      "		stwcx.	%1,0,%3\n"			      \
   48.93 ++    __asm __volatile ("1:	lwarx	%0,%y2\n"			      \
   48.94 ++		      "		add	%1,%0,%3\n"			      \
   48.95 ++		      "		stwcx.	%1,%y2\n"			      \
   48.96 + 		      "		bne-	1b"				      \
   48.97 +-		      : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
   48.98 +-		      : "b" (mem), "r" (value), "m" (*mem)		      \
   48.99 ++		      : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem)	      \
  48.100 ++		      : "r" (value)					      \
  48.101 + 		      : "cr0", "memory");				      \
  48.102 +     __val;								      \
  48.103 +   })
  48.104 +@@ -157,12 +157,12 @@
  48.105 + #define __arch_atomic_increment_val_32(mem) \
  48.106 +   ({									      \
  48.107 +     __typeof (*(mem)) __val;						      \
  48.108 +-    __asm __volatile ("1:	lwarx	%0,0,%2\n"			      \
  48.109 ++    __asm __volatile ("1:	lwarx	%0,%y1\n"			      \
  48.110 + 		      "		addi	%0,%0,1\n"			      \
  48.111 +-		      "		stwcx.	%0,0,%2\n"			      \
  48.112 ++		      "		stwcx.	%0,%y1\n"			      \
  48.113 + 		      "		bne-	1b"				      \
  48.114 +-		      : "=&b" (__val), "=m" (*mem)			      \
  48.115 +-		      : "b" (mem), "m" (*mem)				      \
  48.116 ++		      : "=&b" (__val), "+Z" (*mem)			      \
  48.117 ++		      :							      \
  48.118 + 		      : "cr0", "memory");				      \
  48.119 +     __val;								      \
  48.120 +   })
  48.121 +@@ -170,27 +170,27 @@
  48.122 + #define __arch_atomic_decrement_val_32(mem) \
  48.123 +   ({									      \
  48.124 +     __typeof (*(mem)) __val;						      \
  48.125 +-    __asm __volatile ("1:	lwarx	%0,0,%2\n"			      \
  48.126 ++    __asm __volatile ("1:	lwarx	%0,%y1\n"			      \
  48.127 + 		      "		subi	%0,%0,1\n"			      \
  48.128 +-		      "		stwcx.	%0,0,%2\n"			      \
  48.129 ++		      "		stwcx.	%0,%y1\n"			      \
  48.130 + 		      "		bne-	1b"				      \
  48.131 +-		      : "=&b" (__val), "=m" (*mem)			      \
  48.132 +-		      : "b" (mem), "m" (*mem)				      \
  48.133 ++		      : "=&b" (__val), "+Z" (*mem)			      \
  48.134 ++		      :							      \
  48.135 + 		      : "cr0", "memory");				      \
  48.136 +     __val;								      \
  48.137 +   })
  48.138 + 
  48.139 + #define __arch_atomic_decrement_if_positive_32(mem) \
  48.140 +   ({ int __val, __tmp;							      \
  48.141 +-     __asm __volatile ("1:	lwarx	%0,0,%3\n"			      \
  48.142 ++     __asm __volatile ("1:	lwarx	%0,%y2\n"			      \
  48.143 + 		       "	cmpwi	0,%0,0\n"			      \
  48.144 + 		       "	addi	%1,%0,-1\n"			      \
  48.145 + 		       "	ble	2f\n"				      \
  48.146 +-		       "	stwcx.	%1,0,%3\n"			      \
  48.147 ++		       "	stwcx.	%1,%y2\n"			      \
  48.148 + 		       "	bne-	1b\n"				      \
  48.149 + 		       "2:	" __ARCH_ACQ_INSTR			      \
  48.150 +-		       : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  48.151 +-		       : "b" (mem), "m" (*mem)				      \
  48.152 ++		       : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem)	      \
  48.153 ++		       :						      \
  48.154 + 		       : "cr0", "memory");				      \
  48.155 +      __val;								      \
  48.156 +   })
  48.157 +diff -durN glibc-2.10.1.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2.10.1/sysdeps/powerpc/powerpc32/bits/atomic.h
  48.158 +--- glibc-2.10.1.orig/sysdeps/powerpc/powerpc32/bits/atomic.h	2007-03-26 22:15:45.000000000 +0200
  48.159 ++++ glibc-2.10.1/sysdeps/powerpc/powerpc32/bits/atomic.h	2009-11-13 00:51:19.000000000 +0100
  48.160 +@@ -44,14 +44,14 @@
  48.161 + ({									      \
  48.162 +   unsigned int __tmp;							      \
  48.163 +   __asm __volatile (							      \
  48.164 +-		    "1:	lwarx	%0,0,%1" MUTEX_HINT_ACQ "\n"		      \
  48.165 ++		    "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"		      \
  48.166 + 		    "	subf.	%0,%2,%0\n"				      \
  48.167 + 		    "	bne	2f\n"					      \
  48.168 +-		    "	stwcx.	%3,0,%1\n"				      \
  48.169 ++		    "	stwcx.	%3,%y1\n"				      \
  48.170 + 		    "	bne-	1b\n"					      \
  48.171 + 		    "2:	" __ARCH_ACQ_INSTR				      \
  48.172 +-		    : "=&r" (__tmp)					      \
  48.173 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  48.174 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  48.175 ++		    : "r" (oldval), "r" (newval)			      \
  48.176 + 		    : "cr0", "memory");					      \
  48.177 +   __tmp != 0;								      \
  48.178 + })
  48.179 +@@ -60,14 +60,14 @@
  48.180 + ({									      \
  48.181 +   unsigned int __tmp;							      \
  48.182 +   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  48.183 +-		    "1:	lwarx	%0,0,%1" MUTEX_HINT_REL "\n"		      \
  48.184 ++		    "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"		      \
  48.185 + 		    "	subf.	%0,%2,%0\n"				      \
  48.186 + 		    "	bne	2f\n"					      \
  48.187 +-		    "	stwcx.	%3,0,%1\n"				      \
  48.188 ++		    "	stwcx.	%3,%y1\n"				      \
  48.189 + 		    "	bne-	1b\n"					      \
  48.190 + 		    "2:	"						      \
  48.191 +-		    : "=&r" (__tmp)					      \
  48.192 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  48.193 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  48.194 ++		    : "r" (oldval), "r" (newval)			      \
  48.195 + 		    : "cr0", "memory");					      \
  48.196 +   __tmp != 0;								      \
  48.197 + })
  48.198 +diff -durN glibc-2.10.1.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2.10.1/sysdeps/powerpc/powerpc64/bits/atomic.h
  48.199 +--- glibc-2.10.1.orig/sysdeps/powerpc/powerpc64/bits/atomic.h	2007-03-26 22:16:03.000000000 +0200
  48.200 ++++ glibc-2.10.1/sysdeps/powerpc/powerpc64/bits/atomic.h	2009-11-13 00:51:19.000000000 +0100
  48.201 +@@ -44,14 +44,14 @@
  48.202 + ({									      \
  48.203 +   unsigned int __tmp, __tmp2;						      \
  48.204 +   __asm __volatile ("   clrldi  %1,%1,32\n"				      \
  48.205 +-		    "1:	lwarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	 	      \
  48.206 ++		    "1:	lwarx	%0,%y2" MUTEX_HINT_ACQ "\n"	 	      \
  48.207 + 		    "	subf.	%0,%1,%0\n"				      \
  48.208 + 		    "	bne	2f\n"					      \
  48.209 +-		    "	stwcx.	%4,0,%2\n"				      \
  48.210 ++		    "	stwcx.	%4,%y2\n"				      \
  48.211 + 		    "	bne-	1b\n"					      \
  48.212 + 		    "2:	" __ARCH_ACQ_INSTR				      \
  48.213 +-		    : "=&r" (__tmp), "=r" (__tmp2)			      \
  48.214 +-		    : "b" (mem), "1" (oldval), "r" (newval)		      \
  48.215 ++		    : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem))	      \
  48.216 ++		    : "1" (oldval), "r" (newval)			      \
  48.217 + 		    : "cr0", "memory");					      \
  48.218 +   __tmp != 0;								      \
  48.219 + })
  48.220 +@@ -61,14 +61,14 @@
  48.221 +   unsigned int __tmp, __tmp2;						      \
  48.222 +   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  48.223 + 		    "   clrldi  %1,%1,32\n"				      \
  48.224 +-		    "1:	lwarx	%0,0,%2" MUTEX_HINT_REL "\n"		      \
  48.225 ++		    "1:	lwarx	%0,%y2" MUTEX_HINT_REL "\n"		      \
  48.226 + 		    "	subf.	%0,%1,%0\n"				      \
  48.227 + 		    "	bne	2f\n"					      \
  48.228 +-		    "	stwcx.	%4,0,%2\n"				      \
  48.229 ++		    "	stwcx.	%4,%y2\n"				      \
  48.230 + 		    "	bne-	1b\n"					      \
  48.231 + 		    "2:	"						      \
  48.232 +-		    : "=&r" (__tmp), "=r" (__tmp2)			      \
  48.233 +-		    : "b" (mem), "1" (oldval), "r" (newval)		      \
  48.234 ++		    : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem))	      \
  48.235 ++		    : "1" (oldval), "r" (newval)			      \
  48.236 + 		    : "cr0", "memory");					      \
  48.237 +   __tmp != 0;								      \
  48.238 + })
  48.239 +@@ -82,14 +82,14 @@
  48.240 + ({									      \
  48.241 +   unsigned long	__tmp;							      \
  48.242 +   __asm __volatile (							      \
  48.243 +-		    "1:	ldarx	%0,0,%1" MUTEX_HINT_ACQ "\n"		      \
  48.244 ++		    "1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"		      \
  48.245 + 		    "	subf.	%0,%2,%0\n"				      \
  48.246 + 		    "	bne	2f\n"					      \
  48.247 +-		    "	stdcx.	%3,0,%1\n"				      \
  48.248 ++		    "	stdcx.	%3,%y1\n"				      \
  48.249 + 		    "	bne-	1b\n"					      \
  48.250 + 		    "2:	" __ARCH_ACQ_INSTR				      \
  48.251 +-		    : "=&r" (__tmp)					      \
  48.252 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  48.253 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  48.254 ++		    : "r" (oldval), "r" (newval)			      \
  48.255 + 		    : "cr0", "memory");					      \
  48.256 +   __tmp != 0;								      \
  48.257 + })
  48.258 +@@ -98,14 +98,14 @@
  48.259 + ({									      \
  48.260 +   unsigned long	__tmp;							      \
  48.261 +   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  48.262 +-		    "1:	ldarx	%0,0,%2" MUTEX_HINT_REL "\n"		      \
  48.263 ++		    "1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"		      \
  48.264 + 		    "	subf.	%0,%2,%0\n"				      \
  48.265 + 		    "	bne	2f\n"					      \
  48.266 +-		    "	stdcx.	%3,0,%1\n"				      \
  48.267 ++		    "	stdcx.	%3,%y1\n"				      \
  48.268 + 		    "	bne-	1b\n"					      \
  48.269 + 		    "2:	"						      \
  48.270 +-		    : "=&r" (__tmp)					      \
  48.271 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  48.272 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  48.273 ++		    : "r" (oldval), "r" (newval)			      \
  48.274 + 		    : "cr0", "memory");					      \
  48.275 +   __tmp != 0;								      \
  48.276 + })
  48.277 +@@ -115,14 +115,14 @@
  48.278 +       __typeof (*(mem)) __tmp;						      \
  48.279 +       __typeof (mem)  __memp = (mem);					      \
  48.280 +       __asm __volatile (						      \
  48.281 +-		        "1:	ldarx	%0,0,%1" MUTEX_HINT_ACQ "\n"	      \
  48.282 ++		        "1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
  48.283 + 		        "	cmpd	%0,%2\n"			      \
  48.284 + 		        "	bne	2f\n"				      \
  48.285 +-		        "	stdcx.	%3,0,%1\n"			      \
  48.286 ++		        "	stdcx.	%3,%y1\n"			      \
  48.287 + 		        "	bne-	1b\n"				      \
  48.288 + 		        "2:	" __ARCH_ACQ_INSTR			      \
  48.289 +-		        : "=&r" (__tmp)					      \
  48.290 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
  48.291 ++		        : "=&r" (__tmp), "+Z" (*__memp)			      \
  48.292 ++		        : "r" (oldval), "r" (newval)			      \
  48.293 + 		        : "cr0", "memory");				      \
  48.294 +       __tmp;								      \
  48.295 +   })
  48.296 +@@ -132,14 +132,14 @@
  48.297 +       __typeof (*(mem)) __tmp;						      \
  48.298 +       __typeof (mem)  __memp = (mem);					      \
  48.299 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  48.300 +-		        "1:	ldarx	%0,0,%1" MUTEX_HINT_REL "\n"	      \
  48.301 ++		        "1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
  48.302 + 		        "	cmpd	%0,%2\n"			      \
  48.303 + 		        "	bne	2f\n"				      \
  48.304 +-		        "	stdcx.	%3,0,%1\n"			      \
  48.305 ++		        "	stdcx.	%3,%y1\n"			      \
  48.306 + 		        "	bne-	1b\n"				      \
  48.307 + 		        "2:	"					      \
  48.308 +-		        : "=&r" (__tmp)					      \
  48.309 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
  48.310 ++		        : "=&r" (__tmp), "+Z" (*__memp)			      \
  48.311 ++		        : "r" (oldval), "r" (newval)			      \
  48.312 + 		        : "cr0", "memory");				      \
  48.313 +       __tmp;								      \
  48.314 +   })
  48.315 +@@ -148,12 +148,12 @@
  48.316 +     ({									      \
  48.317 +       __typeof (*mem) __val;						      \
  48.318 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  48.319 +-			"1:	ldarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	      \
  48.320 +-			"	stdcx.	%3,0,%2\n"			      \
  48.321 ++			"1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
  48.322 ++			"	stdcx.	%2,%y1\n"			      \
  48.323 + 			"	bne-	1b\n"				      \
  48.324 + 		  " " __ARCH_ACQ_INSTR					      \
  48.325 +-			: "=&r" (__val), "=m" (*mem)			      \
  48.326 +-			: "b" (mem), "r" (value), "m" (*mem)		      \
  48.327 ++			: "=&r" (__val), "+Z" (*(mem))			      \
  48.328 ++			: "r" (value)					      \
  48.329 + 			: "cr0", "memory");				      \
  48.330 +       __val;								      \
  48.331 +     })
  48.332 +@@ -162,11 +162,11 @@
  48.333 +     ({									      \
  48.334 +       __typeof (*mem) __val;						      \
  48.335 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  48.336 +-			"1:	ldarx	%0,0,%2" MUTEX_HINT_REL "\n"	      \
  48.337 +-			"	stdcx.	%3,0,%2\n"			      \
  48.338 ++			"1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
  48.339 ++			"	stdcx.	%2,%y1\n"			      \
  48.340 + 			"	bne-	1b"				      \
  48.341 +-			: "=&r" (__val), "=m" (*mem)			      \
  48.342 +-			: "b" (mem), "r" (value), "m" (*mem)		      \
  48.343 ++			: "=&r" (__val), "+Z" (*(mem))			      \
  48.344 ++			: "r" (value)					      \
  48.345 + 			: "cr0", "memory");				      \
  48.346 +       __val;								      \
  48.347 +     })
  48.348 +@@ -174,12 +174,12 @@
  48.349 + #define __arch_atomic_exchange_and_add_64(mem, value) \
  48.350 +     ({									      \
  48.351 +       __typeof (*mem) __val, __tmp;					      \
  48.352 +-      __asm __volatile ("1:	ldarx	%0,0,%3\n"			      \
  48.353 +-			"	add	%1,%0,%4\n"			      \
  48.354 +-			"	stdcx.	%1,0,%3\n"			      \
  48.355 ++      __asm __volatile ("1:	ldarx	%0,%y2\n"			      \
  48.356 ++			"	add	%1,%0,%3\n"			      \
  48.357 ++			"	stdcx.	%1,%y2\n"			      \
  48.358 + 			"	bne-	1b"				      \
  48.359 +-			: "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  48.360 +-			: "b" (mem), "r" (value), "m" (*mem)		      \
  48.361 ++			: "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem))	      \
  48.362 ++			: "r" (value)					      \
  48.363 + 			: "cr0", "memory");				      \
  48.364 +       __val;								      \
  48.365 +     })
  48.366 +@@ -187,12 +187,12 @@
  48.367 + #define __arch_atomic_increment_val_64(mem) \
  48.368 +     ({									      \
  48.369 +       __typeof (*(mem)) __val;						      \
  48.370 +-      __asm __volatile ("1:	ldarx	%0,0,%2\n"			      \
  48.371 ++      __asm __volatile ("1:	ldarx	%0,%y1\n"			      \
  48.372 + 			"	addi	%0,%0,1\n"			      \
  48.373 +-			"	stdcx.	%0,0,%2\n"			      \
  48.374 ++			"	stdcx.	%0,%y1\n"			      \
  48.375 + 			"	bne-	1b"				      \
  48.376 +-			: "=&b" (__val), "=m" (*mem)			      \
  48.377 +-			: "b" (mem), "m" (*mem)				      \
  48.378 ++			: "=&b" (__val), "+Z" (*(mem))			      \
  48.379 ++			:						      \
  48.380 + 			: "cr0", "memory");				      \
  48.381 +       __val;								      \
  48.382 +     })
  48.383 +@@ -200,27 +200,27 @@
  48.384 + #define __arch_atomic_decrement_val_64(mem) \
  48.385 +     ({									      \
  48.386 +       __typeof (*(mem)) __val;						      \
  48.387 +-      __asm __volatile ("1:	ldarx	%0,0,%2\n"			      \
  48.388 ++      __asm __volatile ("1:	ldarx	%0,%y1\n"			      \
  48.389 + 			"	subi	%0,%0,1\n"			      \
  48.390 +-			"	stdcx.	%0,0,%2\n"			      \
  48.391 ++			"	stdcx.	%0,%y1\n"			      \
  48.392 + 			"	bne-	1b"				      \
  48.393 +-			: "=&b" (__val), "=m" (*mem)			      \
  48.394 +-			: "b" (mem), "m" (*mem)				      \
  48.395 ++			: "=&b" (__val), "+Z" (*(mem))			      \
  48.396 ++			:						      \
  48.397 + 			: "cr0", "memory");				      \
  48.398 +       __val;								      \
  48.399 +     })
  48.400 + 
  48.401 + #define __arch_atomic_decrement_if_positive_64(mem) \
  48.402 +   ({ int __val, __tmp;							      \
  48.403 +-     __asm __volatile ("1:	ldarx	%0,0,%3\n"			      \
  48.404 ++     __asm __volatile ("1:	ldarx	%0,%y2\n"			      \
  48.405 + 		       "	cmpdi	0,%0,0\n"			      \
  48.406 + 		       "	addi	%1,%0,-1\n"			      \
  48.407 + 		       "	ble	2f\n"				      \
  48.408 +-		       "	stdcx.	%1,0,%3\n"			      \
  48.409 ++		       "	stdcx.	%1,%y2\n"			      \
  48.410 + 		       "	bne-	1b\n"				      \
  48.411 + 		       "2:	" __ARCH_ACQ_INSTR			      \
  48.412 +-		       : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  48.413 +-		       : "b" (mem), "m" (*mem)				      \
  48.414 ++		       : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem))	      \
  48.415 ++		       :						      \
  48.416 + 		       : "cr0", "memory");				      \
  48.417 +      __val;								      \
  48.418 +   })
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/patches/glibc/ports-2.10.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch	Fri Nov 13 21:37:18 2009 +0100
    49.3 @@ -0,0 +1,374 @@
    49.4 +http://yann.poupet.free.fr/ep93xx/
    49.5 +Add support for the Maverick Crunch FPU on Cirrus EP93XX processor series
    49.6 +
    49.7 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/bits/endian.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/bits/endian.h
    49.8 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/bits/endian.h	2009-05-16 10:36:20.000000000 +0200
    49.9 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/bits/endian.h	2009-11-13 00:51:22.000000000 +0100
   49.10 +@@ -12,7 +12,7 @@
   49.11 + /* FPA floating point units are always big-endian, irrespective of the
   49.12 +    CPU endianness.  VFP floating point units use the same endianness
   49.13 +    as the rest of the system.  */
   49.14 +-#ifdef __VFP_FP__
   49.15 ++#if defined __VFP_FP__ || defined __MAVERICK__
   49.16 + #define __FLOAT_WORD_ORDER __BYTE_ORDER
   49.17 + #else
   49.18 + #define __FLOAT_WORD_ORDER __BIG_ENDIAN
   49.19 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/__longjmp.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/__longjmp.S
   49.20 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/__longjmp.S	2009-05-16 10:36:20.000000000 +0200
   49.21 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/__longjmp.S	2009-11-13 00:51:22.000000000 +0100
   49.22 +@@ -30,7 +30,33 @@
   49.23 + 	movs	r0, r1		/* get the return value in place */
   49.24 + 	moveq	r0, #1		/* can't let setjmp() return zero! */
   49.25 + 
   49.26 ++#ifdef __MAVERICK__
   49.27 ++	cfldrd	mvd4,  [ip], #8
   49.28 ++	nop
   49.29 ++	cfldrd	mvd5,  [ip], #8
   49.30 ++	nop
   49.31 ++	cfldrd	mvd6,  [ip], #8
   49.32 ++	nop
   49.33 ++	cfldrd	mvd7,  [ip], #8
   49.34 ++	nop
   49.35 ++	cfldrd	mvd8,  [ip], #8
   49.36 ++	nop
   49.37 ++	cfldrd	mvd9,  [ip], #8
   49.38 ++	nop
   49.39 ++	cfldrd	mvd10, [ip], #8
   49.40 ++	nop
   49.41 ++	cfldrd	mvd11, [ip], #8
   49.42 ++	nop
   49.43 ++	cfldrd	mvd12, [ip], #8
   49.44 ++	nop
   49.45 ++	cfldrd	mvd13, [ip], #8
   49.46 ++	nop
   49.47 ++	cfldrd	mvd14, [ip], #8
   49.48 ++	nop
   49.49 ++	cfldrd	mvd15, [ip], #8
   49.50 ++#else
   49.51 + 	lfmfd	f4, 4, [ip] !	/* load the floating point regs */
   49.52 ++#endif
   49.53 + 
   49.54 + 	LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
   49.55 + END (__longjmp)
   49.56 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/fenv.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/fenv.h
   49.57 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/fenv.h	2009-05-16 10:36:20.000000000 +0200
   49.58 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/fenv.h	2009-11-13 00:51:22.000000000 +0100
   49.59 +@@ -20,6 +20,45 @@
   49.60 + # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
   49.61 + #endif
   49.62 + 
   49.63 ++#if defined(__MAVERICK__)
   49.64 ++
   49.65 ++/* Define bits representing exceptions in the FPU status word.  */
   49.66 ++enum
   49.67 ++  {
   49.68 ++    FE_INVALID = 1,
   49.69 ++#define FE_INVALID FE_INVALID
   49.70 ++    FE_OVERFLOW = 4,
   49.71 ++#define FE_OVERFLOW FE_OVERFLOW
   49.72 ++    FE_UNDERFLOW = 8,
   49.73 ++#define FE_UNDERFLOW FE_UNDERFLOW
   49.74 ++    FE_INEXACT = 16,
   49.75 ++#define FE_INEXACT FE_INEXACT
   49.76 ++  };
   49.77 ++
   49.78 ++/* Amount to shift by to convert an exception to a mask bit.  */
   49.79 ++#define FE_EXCEPT_SHIFT	5
   49.80 ++
   49.81 ++/* All supported exceptions.  */
   49.82 ++#define FE_ALL_EXCEPT	\
   49.83 ++	(FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
   49.84 ++
   49.85 ++/* IEEE rounding modes.  */
   49.86 ++enum
   49.87 ++  {
   49.88 ++    FE_TONEAREST = 0,
   49.89 ++#define FE_TONEAREST    FE_TONEAREST
   49.90 ++    FE_TOWARDZERO = 0x400,
   49.91 ++#define FE_TOWARDZERO   FE_TOWARDZERO
   49.92 ++    FE_DOWNWARD = 0x800,
   49.93 ++#define FE_DOWNWARD     FE_DOWNWARD
   49.94 ++    FE_UPWARD = 0xc00,
   49.95 ++#define FE_UPWARD       FE_UPWARD
   49.96 ++  };
   49.97 ++
   49.98 ++#define FE_ROUND_MASK (FE_UPWARD)
   49.99 ++
  49.100 ++#else /* FPA */
  49.101 ++
  49.102 + /* Define bits representing exceptions in the FPU status word.  */
  49.103 + enum
  49.104 +   {
  49.105 +@@ -44,6 +83,8 @@
  49.106 +    modes exist, but you have to encode them in the actual instruction.  */
  49.107 + #define FE_TONEAREST	0
  49.108 + 
  49.109 ++#endif
  49.110 ++
  49.111 + /* Type representing exception flags. */
  49.112 + typedef unsigned long int fexcept_t;
  49.113 + 
  49.114 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/setjmp.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/setjmp.h
  49.115 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/setjmp.h	2009-05-16 10:36:20.000000000 +0200
  49.116 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/setjmp.h	2009-11-13 00:51:22.000000000 +0100
  49.117 +@@ -28,7 +28,11 @@
  49.118 + #ifndef _ASM
  49.119 + /* Jump buffer contains v1-v6, sl, fp, sp and pc.  Other registers are not
  49.120 +    saved.  */
  49.121 ++#ifdef __MAVERICK__
  49.122 ++typedef int __jmp_buf[34];
  49.123 ++#else
  49.124 + typedef int __jmp_buf[22];
  49.125 + #endif
  49.126 ++#endif
  49.127 + 
  49.128 + #endif
  49.129 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fegetround.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fegetround.c
  49.130 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fegetround.c	2009-05-16 10:36:20.000000000 +0200
  49.131 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fegetround.c	2009-11-13 00:51:22.000000000 +0100
  49.132 +@@ -18,9 +18,21 @@
  49.133 +    02111-1307 USA.  */
  49.134 + 
  49.135 + #include <fenv.h>
  49.136 ++#include <fpu_control.h>
  49.137 + 
  49.138 + int
  49.139 + fegetround (void)
  49.140 + {
  49.141 ++#if defined(__MAVERICK__)
  49.142 ++
  49.143 ++  unsigned long temp;
  49.144 ++
  49.145 ++  _FPU_GETCW (temp);
  49.146 ++  return temp & FE_ROUND_MASK;
  49.147 ++
  49.148 ++#else /* FPA */
  49.149 ++
  49.150 +   return FE_TONEAREST;		/* Easy. :-) */
  49.151 ++
  49.152 ++#endif
  49.153 + }
  49.154 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fesetround.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fesetround.c
  49.155 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fesetround.c	2009-05-16 10:36:20.000000000 +0200
  49.156 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fesetround.c	2009-11-13 00:51:22.000000000 +0100
  49.157 +@@ -18,12 +18,28 @@
  49.158 +    02111-1307 USA.  */
  49.159 + 
  49.160 + #include <fenv.h>
  49.161 ++#include <fpu_control.h>
  49.162 + 
  49.163 + int
  49.164 + fesetround (int round)
  49.165 + {
  49.166 ++#if defined(__MAVERICK__)
  49.167 ++  unsigned long temp;
  49.168 ++
  49.169 ++  if (round & ~FE_ROUND_MASK)
  49.170 ++    return 1;
  49.171 ++
  49.172 ++  _FPU_GETCW (temp);
  49.173 ++  temp = (temp & ~FE_ROUND_MASK) | round;
  49.174 ++  _FPU_SETCW (temp);
  49.175 ++  return 0;
  49.176 ++
  49.177 ++#else /* FPA */
  49.178 ++
  49.179 +   /* We only support FE_TONEAREST, so there is no need for any work.  */
  49.180 +   return (round == FE_TONEAREST)?0:1;
  49.181 ++
  49.182 ++#endif
  49.183 + }
  49.184 + 
  49.185 + libm_hidden_def (fesetround)
  49.186 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fpu_control.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fpu_control.h
  49.187 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fpu_control.h	2009-05-16 10:36:20.000000000 +0200
  49.188 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fpu_control.h	2009-11-13 00:51:22.000000000 +0100
  49.189 +@@ -1,5 +1,6 @@
  49.190 + /* FPU control word definitions.  ARM version.
  49.191 +-   Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
  49.192 ++   Copyright (C) 1996, 1997, 1998, 2000, 2005
  49.193 ++   Free Software Foundation, Inc.
  49.194 +    This file is part of the GNU C Library.
  49.195 + 
  49.196 +    The GNU C Library is free software; you can redistribute it and/or
  49.197 +@@ -20,6 +21,79 @@
  49.198 + #ifndef _FPU_CONTROL_H
  49.199 + #define _FPU_CONTROL_H
  49.200 + 
  49.201 ++#if defined(__MAVERICK__)
  49.202 ++
  49.203 ++/* DSPSC register: (from EP9312 User's Guide)
  49.204 ++ *
  49.205 ++ * bits 31..29	- DAID
  49.206 ++ * bits 28..26	- HVID
  49.207 ++ * bits 25..24	- RSVD
  49.208 ++ * bit  23	- ISAT
  49.209 ++ * bit  22	- UI
  49.210 ++ * bit  21	- INT
  49.211 ++ * bit  20	- AEXC
  49.212 ++ * bits 19..18	- SAT
  49.213 ++ * bits 17..16	- FCC
  49.214 ++ * bit  15	- V
  49.215 ++ * bit  14	- FWDEN
  49.216 ++ * bit  13	- Invalid
  49.217 ++ * bit	12	- Denorm
  49.218 ++ * bits 11..10	- RM
  49.219 ++ * bits 9..5	- IXE, UFE, OFE, RSVD, IOE
  49.220 ++ * bits 4..0	- IX, UF, OF, RSVD, IO
  49.221 ++ */
  49.222 ++
  49.223 ++/* masking of interrupts */
  49.224 ++#define _FPU_MASK_IM	(1 << 5)	/* invalid operation */
  49.225 ++#define _FPU_MASK_ZM	0		/* divide by zero */
  49.226 ++#define _FPU_MASK_OM	(1 << 7)	/* overflow */
  49.227 ++#define _FPU_MASK_UM	(1 << 8)	/* underflow */
  49.228 ++#define _FPU_MASK_PM	(1 << 9)	/* inexact */
  49.229 ++#define _FPU_MASK_DM	0		/* denormalized operation */
  49.230 ++
  49.231 ++#define _FPU_RESERVED	0xfffff000	/* These bits are reserved.  */
  49.232 ++
  49.233 ++#define _FPU_DEFAULT	0x00b00000	/* Default value.  */
  49.234 ++#define _FPU_IEEE	0x00b003a0	/* Default + exceptions enabled. */
  49.235 ++
  49.236 ++/* Type of the control word.  */
  49.237 ++typedef unsigned int fpu_control_t;
  49.238 ++
  49.239 ++/* Macros for accessing the hardware control word.  */
  49.240 ++#define _FPU_GETCW(cw) ({			\
  49.241 ++	register int __t1, __t2;		\
  49.242 ++						\
  49.243 ++	__asm__ volatile (			\
  49.244 ++	"cfmvr64l	%1, mvdx0\n\t"		\
  49.245 ++	"cfmvr64h	%2, mvdx0\n\t"		\
  49.246 ++	"cfmv32sc	mvdx0, dspsc\n\t"	\
  49.247 ++	"cfmvr64l	%0, mvdx0\n\t"		\
  49.248 ++	"cfmv64lr	mvdx0, %1\n\t"		\
  49.249 ++	"cfmv64hr	mvdx0, %2"		\
  49.250 ++	: "=r" (cw), "=r" (__t1), "=r" (__t2)	\
  49.251 ++	);					\
  49.252 ++})
  49.253 ++
  49.254 ++#define _FPU_SETCW(cw) ({			\
  49.255 ++	register int __t0, __t1, __t2;		\
  49.256 ++						\
  49.257 ++	__asm__ volatile (			\
  49.258 ++	"cfmvr64l	%1, mvdx0\n\t"		\
  49.259 ++	"cfmvr64h	%2, mvdx0\n\t"		\
  49.260 ++	"cfmv64lr	mvdx0, %0\n\t"		\
  49.261 ++	"cfmvsc32	dspsc, mvdx0\n\t"	\
  49.262 ++	"cfmv64lr	mvdx0, %1\n\t"		\
  49.263 ++	"cfmv64hr	mvdx0, %2"		\
  49.264 ++	: "=r" (__t0), "=r" (__t1), "=r" (__t2)	\
  49.265 ++	: "0" (cw)				\
  49.266 ++	);					\
  49.267 ++})
  49.268 ++
  49.269 ++/* Default control word set at startup.  */
  49.270 ++extern fpu_control_t __fpu_control;
  49.271 ++
  49.272 ++#else /* FPA */
  49.273 ++
  49.274 + /* We have a slight terminology confusion here.  On the ARM, the register
  49.275 +  * we're interested in is actually the FPU status word - the FPU control
  49.276 +  * word is something different (which is implementation-defined and only
  49.277 +@@ -99,4 +173,6 @@
  49.278 + /* Default control word set at startup.  */
  49.279 + extern fpu_control_t __fpu_control;
  49.280 + 
  49.281 ++#endif
  49.282 ++
  49.283 + #endif /* _FPU_CONTROL_H */
  49.284 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/jmpbuf-offsets.h
  49.285 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/jmpbuf-offsets.h	2009-05-16 10:36:20.000000000 +0200
  49.286 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/jmpbuf-offsets.h	2009-11-13 00:51:22.000000000 +0100
  49.287 +@@ -17,4 +17,8 @@
  49.288 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  49.289 +    02111-1307 USA.  */
  49.290 + 
  49.291 ++#ifdef __MAVERICK__
  49.292 ++#define __JMP_BUF_SP		32
  49.293 ++#else
  49.294 + #define __JMP_BUF_SP		20
  49.295 ++#endif
  49.296 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/setjmp.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/setjmp.S
  49.297 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/setjmp.S	2009-05-16 10:36:20.000000000 +0200
  49.298 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/setjmp.S	2009-11-13 00:51:22.000000000 +0100
  49.299 +@@ -24,11 +24,41 @@
  49.300 + 
  49.301 + ENTRY (__sigsetjmp)
  49.302 + 	/* Save registers */
  49.303 ++#ifdef __MAVERICK__
  49.304 ++	cfstrd	mvd4,  [r0], #8
  49.305 ++	nop
  49.306 ++	cfstrd	mvd5,  [r0], #8
  49.307 ++	nop
  49.308 ++	cfstrd	mvd6,  [r0], #8
  49.309 ++	nop
  49.310 ++	cfstrd	mvd7,  [r0], #8
  49.311 ++	nop
  49.312 ++	cfstrd	mvd8,  [r0], #8
  49.313 ++	nop
  49.314 ++	cfstrd	mvd9,  [r0], #8
  49.315 ++	nop
  49.316 ++	cfstrd	mvd10, [r0], #8
  49.317 ++	nop
  49.318 ++	cfstrd	mvd11, [r0], #8
  49.319 ++	nop
  49.320 ++	cfstrd	mvd12, [r0], #8
  49.321 ++	nop
  49.322 ++	cfstrd	mvd13, [r0], #8
  49.323 ++	nop
  49.324 ++	cfstrd	mvd14, [r0], #8
  49.325 ++	nop
  49.326 ++	cfstrd	mvd15, [r0], #8
  49.327 ++#else
  49.328 + 	sfmea	f4, 4, [r0]!
  49.329 ++#endif
  49.330 + 	stmia	r0, {v1-v6, sl, fp, sp, lr}
  49.331 + 
  49.332 + 	/* Restore pointer to jmp_buf */
  49.333 ++#ifdef __MAVERICK__
  49.334 ++	sub	r0, r0, #96
  49.335 ++#else
  49.336 + 	sub	r0, r0, #48
  49.337 ++#endif
  49.338 + 
  49.339 + 	/* Make a tail call to __sigjmp_save; it takes the same args.  */
  49.340 + 	B	PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
  49.341 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/gccframe.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/gccframe.h
  49.342 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/gccframe.h	2009-05-16 10:36:20.000000000 +0200
  49.343 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/gccframe.h	2009-11-13 00:51:22.000000000 +0100
  49.344 +@@ -17,6 +17,10 @@
  49.345 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  49.346 +    02111-1307 USA.  */
  49.347 + 
  49.348 ++#ifdef __MAVERICK__
  49.349 ++#define FIRST_PSEUDO_REGISTER 43
  49.350 ++#else
  49.351 + #define FIRST_PSEUDO_REGISTER 27
  49.352 ++#endif
  49.353 + 
  49.354 + #include <sysdeps/generic/gccframe.h>
  49.355 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/gmp-mparam.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/gmp-mparam.h
  49.356 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/gmp-mparam.h	2009-05-16 10:36:20.000000000 +0200
  49.357 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/gmp-mparam.h	2009-11-13 00:51:22.000000000 +0100
  49.358 +@@ -29,7 +29,7 @@
  49.359 + #if defined(__ARMEB__)
  49.360 + # define IEEE_DOUBLE_MIXED_ENDIAN 0
  49.361 + # define IEEE_DOUBLE_BIG_ENDIAN 1
  49.362 +-#elif defined(__VFP_FP__)
  49.363 ++#elif defined(__VFP_FP__) || defined(__MAVERICK__)
  49.364 + # define IEEE_DOUBLE_MIXED_ENDIAN 0
  49.365 + # define IEEE_DOUBLE_BIG_ENDIAN 0
  49.366 + #else
  49.367 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/bits/endian.h glibc-2.10.1/ports/sysdeps/arm/bits/endian.h
  49.368 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/__longjmp.S glibc-2.10.1/ports/sysdeps/arm/fpu/__longjmp.S
  49.369 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/bits/fenv.h glibc-2.10.1/ports/sysdeps/arm/fpu/bits/fenv.h
  49.370 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/bits/setjmp.h glibc-2.10.1/ports/sysdeps/arm/fpu/bits/setjmp.h
  49.371 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/fegetround.c glibc-2.10.1/ports/sysdeps/arm/fpu/fegetround.c
  49.372 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/fesetround.c glibc-2.10.1/ports/sysdeps/arm/fpu/fesetround.c
  49.373 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/fpu_control.h glibc-2.10.1/ports/sysdeps/arm/fpu/fpu_control.h
  49.374 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.10.1/ports/sysdeps/arm/fpu/jmpbuf-offsets.h
  49.375 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/setjmp.S glibc-2.10.1/ports/sysdeps/arm/fpu/setjmp.S
  49.376 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/gccframe.h glibc-2.10.1/ports/sysdeps/arm/gccframe.h
  49.377 +diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/gmp-mparam.h glibc-2.10.1/ports/sysdeps/arm/gmp-mparam.h
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/patches/glibc/ports-2.10.1/580-nptl-lowlevellock.patch	Fri Nov 13 21:37:18 2009 +0100
    50.3 @@ -0,0 +1,23 @@
    50.4 +fix build error on arm like on hppa:
    50.5 +
    50.6 +arm-unknown-linux-gnu-gcc ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -g -pipe -Wstrict-prototypes   -fPIC    -I../include -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports  -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include-fixed -isystem /usr/arm-unknown-linux-gnu/usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h  -DPIC -DSHARED      -o /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -MD -MP -MF /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os.dt -MT /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -DNOT_IN_libc=1 -DIS_IN_rtld=1
    50.7 +In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
    50.8 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
    50.9 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: warning: implicit declaration of function 'THREAD_GETMEM'
   50.10 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'THREAD_SELF' undeclared (first use in this function)
   50.11 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: (Each undeclared identifier is reported only once
   50.12 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: for each function it appears in.)
   50.13 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'header' undeclared (first use in this function)
   50.14 +
   50.15 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
   50.16 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h	2009-05-16 10:36:20.000000000 +0200
   50.17 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h	2009-11-13 00:51:23.000000000 +0100
   50.18 +@@ -25,6 +25,7 @@
   50.19 + #include <atomic.h>
   50.20 + #include <sysdep.h>
   50.21 + #include <kernel-features.h>
   50.22 ++#include <tls.h>		/* Need THREAD_*, and header.*.  */
   50.23 + 
   50.24 + #define FUTEX_WAIT		0
   50.25 + #define FUTEX_WAKE		1
   50.26 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/patches/glibc/ports-2.10.1/590-sh-set-fpscr-proto.patch	Fri Nov 13 21:37:18 2009 +0100
    51.3 @@ -0,0 +1,13 @@
    51.4 +
    51.5 +
    51.6 +diff -durN glibc-2.10.1.orig/sysdeps/sh/sh4/fpu/fpu_control.h glibc-2.10.1/sysdeps/sh/sh4/fpu/fpu_control.h
    51.7 +--- glibc-2.10.1.orig/sysdeps/sh/sh4/fpu/fpu_control.h	2001-07-06 06:56:04.000000000 +0200
    51.8 ++++ glibc-2.10.1/sysdeps/sh/sh4/fpu/fpu_control.h	2009-11-13 00:51:26.000000000 +0100
    51.9 +@@ -45,6 +45,7 @@
   51.10 + #define _FPU_GETCW(cw) __asm__ ("sts fpscr,%0" : "=r" (cw))
   51.11 + 
   51.12 + #if defined __GNUC__
   51.13 ++extern void __set_fpscr(unsigned long);
   51.14 + #define _FPU_SETCW(cw) __set_fpscr ((cw))
   51.15 + #else
   51.16 + #define _FPU_SETCW(cw) __asm__ ("lds %0,fpscr" : : "r" (cw))
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/patches/glibc/ports-2.10.1/600-mips_librt-mips.patch	Fri Nov 13 21:37:18 2009 +0100
    52.3 @@ -0,0 +1,94 @@
    52.4 +we kind of screwed ourselves into a corner by having the clock symbols
    52.5 +exported only with the glibc-2.0 version ... this patch fixes the
    52.6 +export so all new binaries built against librt will use the correct
    52.7 +glibc-2.2 symbol version
    52.8 +
    52.9 +one day, we'll just drop this on the floor (maybe after 2006.1)
   52.10 +
   52.11 +diff -durN glibc-2.10.1.orig/Versions.def glibc-2.10.1/Versions.def
   52.12 +--- glibc-2.10.1.orig/Versions.def	2008-12-03 05:19:06.000000000 +0100
   52.13 ++++ glibc-2.10.1/Versions.def	2009-11-13 00:51:27.000000000 +0100
   52.14 +@@ -98,6 +98,7 @@
   52.15 +   GLIBC_PRIVATE
   52.16 + }
   52.17 + librt {
   52.18 ++  GLIBC_2.0
   52.19 +   GLIBC_2.1
   52.20 +   GLIBC_2.2
   52.21 +   GLIBC_2.3
   52.22 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions
   52.23 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions	2009-05-16 10:36:20.000000000 +0200
   52.24 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions	2009-11-13 00:51:27.000000000 +0100
   52.25 +@@ -35,3 +35,9 @@
   52.26 +     _test_and_set;
   52.27 +   }
   52.28 + }
   52.29 ++librt {
   52.30 ++  GLIBC_2.0 {
   52.31 ++    # c*
   52.32 ++    clock_gettime; clock_settime;
   52.33 ++  }
   52.34 ++}
   52.35 +diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/mips/Versions glibc-2.10.1/ports/sysdeps/unix/sysv/linux/mips/Versions
   52.36 +diff -durN glibc-2.10.1.orig/sysdeps/unix/clock_gettime.c glibc-2.10.1/sysdeps/unix/clock_gettime.c
   52.37 +--- glibc-2.10.1.orig/sysdeps/unix/clock_gettime.c	2007-07-28 22:36:04.000000000 +0200
   52.38 ++++ glibc-2.10.1/sysdeps/unix/clock_gettime.c	2009-11-13 00:51:27.000000000 +0100
   52.39 +@@ -23,6 +23,7 @@
   52.40 + #include <sys/time.h>
   52.41 + #include <libc-internal.h>
   52.42 + #include <ldsodefs.h>
   52.43 ++#include <shlib-compat.h>
   52.44 + 
   52.45 + 
   52.46 + #if HP_TIMING_AVAIL
   52.47 +@@ -90,7 +91,7 @@
   52.48 + 
   52.49 + /* Get current value of CLOCK and store it in TP.  */
   52.50 + int
   52.51 +-clock_gettime (clockid_t clock_id, struct timespec *tp)
   52.52 ++__clock_gettime (clockid_t clock_id, struct timespec *tp)
   52.53 + {
   52.54 +   int retval = -1;
   52.55 + 
   52.56 +@@ -133,4 +134,10 @@
   52.57 + 
   52.58 +   return retval;
   52.59 + }
   52.60 +-librt_hidden_def (clock_gettime)
   52.61 ++versioned_symbol (librt, __clock_gettime, clock_gettime, GLIBC_2_2);
   52.62 ++librt_hidden_ver (__clock_gettime, clock_gettime)
   52.63 ++
   52.64 ++#if defined __mips__ && defined SHARED
   52.65 ++strong_alias (__clock_gettime, __mips_clock_gettime)
   52.66 ++compat_symbol (librt, __mips_clock_gettime, clock_gettime, GLIBC_2_0);
   52.67 ++#endif
   52.68 +diff -durN glibc-2.10.1.orig/sysdeps/unix/clock_settime.c glibc-2.10.1/sysdeps/unix/clock_settime.c
   52.69 +--- glibc-2.10.1.orig/sysdeps/unix/clock_settime.c	2007-08-14 05:19:33.000000000 +0200
   52.70 ++++ glibc-2.10.1/sysdeps/unix/clock_settime.c	2009-11-13 00:51:27.000000000 +0100
   52.71 +@@ -21,6 +21,7 @@
   52.72 + #include <sys/time.h>
   52.73 + #include <libc-internal.h>
   52.74 + #include <ldsodefs.h>
   52.75 ++#include <shlib-compat.h>
   52.76 + 
   52.77 + 
   52.78 + #if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
   52.79 +@@ -73,7 +74,7 @@
   52.80 + 
   52.81 + /* Set CLOCK to value TP.  */
   52.82 + int
   52.83 +-clock_settime (clockid_t clock_id, const struct timespec *tp)
   52.84 ++__clock_settime (clockid_t clock_id, const struct timespec *tp)
   52.85 + {
   52.86 +   int retval;
   52.87 + 
   52.88 +@@ -125,3 +126,9 @@
   52.89 + 
   52.90 +   return retval;
   52.91 + }
   52.92 ++versioned_symbol (librt, __clock_settime, clock_settime, GLIBC_2_2);
   52.93 ++
   52.94 ++#if defined __mips__ && defined SHARED
   52.95 ++strong_alias (__clock_settime, __mips_clock_settime)
   52.96 ++compat_symbol (librt, __mips_clock_settime, clock_settime, GLIBC_2_0);
   52.97 ++#endif
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/patches/glibc/ports-2.10.1/610-fpu-cw-mips.patch	Fri Nov 13 21:37:18 2009 +0100
    53.3 @@ -0,0 +1,15 @@
    53.4 +http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
    53.5 +
    53.6 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/mips/fpu_control.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/mips/fpu_control.h
    53.7 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/mips/fpu_control.h	2009-05-16 10:36:20.000000000 +0200
    53.8 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/mips/fpu_control.h	2009-11-13 00:51:31.000000000 +0100
    53.9 +@@ -86,7 +86,7 @@
   53.10 + #define _FPU_RC_UP      0x2
   53.11 + #define _FPU_RC_DOWN    0x3
   53.12 + 
   53.13 +-#define _FPU_RESERVED 0xfe3c0000  /* Reserved bits in cw */
   53.14 ++#define _FPU_RESERVED 0xfebc0000  /* Reserved bits in cw */
   53.15 + 
   53.16 + 
   53.17 + /* The fdlibm code requires strict IEEE double precision arithmetic,
   53.18 +diff -durN glibc-2.10.1.orig/ports/sysdeps/mips/fpu_control.h glibc-2.10.1/ports/sysdeps/mips/fpu_control.h
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/patches/glibc/ports-2.10.1/620-r10k-workarounds.patch	Fri Nov 13 21:37:18 2009 +0100
    54.3 @@ -0,0 +1,67 @@
    54.4 +ripped from Debian
    54.5 +
    54.6 +the R10000 needs an LL/SC Workaround. If not applied all R10k before
    54.7 +rev 3.0 misbehave on atomic ops and rev 2.6 and lower (e.g. SGI IP28)
    54.8 +die after very few seconds with a deadlock due to even more erratas.
    54.9 +
   54.10 + ports/sysdeps/mips/bits/atomic.h |   12 ++++++------
   54.11 + 1 file changed, 6 insertions(+), 6 deletions(-)
   54.12 +
   54.13 +diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/mips/bits/atomic.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/mips/bits/atomic.h
   54.14 +--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/mips/bits/atomic.h	2009-05-16 10:36:20.000000000 +0200
   54.15 ++++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/mips/bits/atomic.h	2009-11-13 00:51:34.000000000 +0100
   54.16 +@@ -74,7 +74,7 @@
   54.17 +      "bne	%0,%2,2f\n\t"						      \
   54.18 +      "move	%1,%3\n\t"						      \
   54.19 +      "sc	%1,%4\n\t"						      \
   54.20 +-     "beqz	%1,1b\n"						      \
   54.21 ++     "beqzl	%1,1b\n"						      \
   54.22 +      acq	"\n\t"							      \
   54.23 +      ".set	pop\n"							      \
   54.24 +      "2:\n\t"								      \
   54.25 +@@ -98,7 +98,7 @@
   54.26 +      "bne	%0,%2,2f\n\t"						      \
   54.27 +      "move	%1,%3\n\t"						      \
   54.28 +      "scd	%1,%4\n\t"						      \
   54.29 +-     "beqz	%1,1b\n"						      \
   54.30 ++     "beqzl	%1,1b\n"						      \
   54.31 +      acq	"\n\t"							      \
   54.32 +      ".set	pop\n"							      \
   54.33 +      "2:\n\t"								      \
   54.34 +@@ -192,7 +192,7 @@
   54.35 +      "ll	%0,%3\n\t"						      \
   54.36 +      "move	%1,%2\n\t"						      \
   54.37 +      "sc	%1,%3\n\t"						      \
   54.38 +-     "beqz	%1,1b\n"						      \
   54.39 ++     "beqzl	%1,1b\n"						      \
   54.40 +      acq	"\n\t"							      \
   54.41 +      ".set	pop\n"							      \
   54.42 +      "2:\n\t"								      \
   54.43 +@@ -216,7 +216,7 @@
   54.44 +      "lld	%0,%3\n\t"						      \
   54.45 +      "move	%1,%2\n\t"						      \
   54.46 +      "scd	%1,%3\n\t"						      \
   54.47 +-     "beqz	%1,1b\n"						      \
   54.48 ++     "beqzl	%1,1b\n"						      \
   54.49 +      acq	"\n\t"							      \
   54.50 +      ".set	pop\n"							      \
   54.51 +      "2:\n\t"								      \
   54.52 +@@ -251,7 +251,7 @@
   54.53 +      "ll	%0,%3\n\t"						      \
   54.54 +      "addu	%1,%0,%2\n\t"						      \
   54.55 +      "sc	%1,%3\n\t"						      \
   54.56 +-     "beqz	%1,1b\n"						      \
   54.57 ++     "beqzl	%1,1b\n"						      \
   54.58 +      acq	"\n\t"							      \
   54.59 +      ".set	pop\n"							      \
   54.60 +      "2:\n\t"								      \
   54.61 +@@ -275,7 +275,7 @@
   54.62 +      "lld	%0,%3\n\t"						      \
   54.63 +      "daddu	%1,%0,%2\n\t"						      \
   54.64 +      "scd	%1,%3\n\t"						      \
   54.65 +-     "beqz	%1,1b\n"						      \
   54.66 ++     "beqzl	%1,1b\n"						      \
   54.67 +      acq	"\n\t"							      \
   54.68 +      ".set	pop\n"							      \
   54.69 +      "2:\n\t"								      \
   54.70 +diff -durN glibc-2.10.1.orig/ports/sysdeps/mips/bits/atomic.h glibc-2.10.1/ports/sysdeps/mips/bits/atomic.h
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/patches/glibc/ports-2.10.1/630-mips_shn_undef-hack.patch	Fri Nov 13 21:37:18 2009 +0100
    55.3 @@ -0,0 +1,24 @@
    55.4 +	Hack from Debian to hopefully get sandbox working on mips
    55.5 +
    55.6 +<`Kumba> ths: given the SHN_UNDEF thing is a hack, what's the preferred solution?
    55.7 +<ths> For fakeroot the simplest trigger is "fakeroot file /bin/ls".
    55.8 +<ths> `Kumba: I haven't found a better one yet.
    55.9 +<ths> Probably marker symbols around the stub section, and then exclude it from the link map.
   55.10 +<ths> This needs a ld change.
   55.11 +
   55.12 +diff -durN glibc-2.10.1.orig/elf/do-lookup.h glibc-2.10.1/elf/do-lookup.h
   55.13 +--- glibc-2.10.1.orig/elf/do-lookup.h	2009-03-30 23:14:32.000000000 +0200
   55.14 ++++ glibc-2.10.1/elf/do-lookup.h	2009-11-13 00:51:36.000000000 +0100
   55.15 +@@ -248,6 +248,12 @@
   55.16 + 		}
   55.17 + 	      /* FALLTHROUGH */
   55.18 + 	    case STB_GLOBAL:
   55.19 ++#ifdef __mips__
   55.20 ++	      /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
   55.21 ++		 symbols, we skip them. */
   55.22 ++	      if (sym->st_shndx == SHN_UNDEF)
   55.23 ++		break;
   55.24 ++#endif
   55.25 + 	      /* Global definition.  Just what we need.  */
   55.26 + 	      result->s = sym;
   55.27 + 	      result->m = (struct link_map *) map;