libc/glibc: add 2.13
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 03 00:19:56 2011 +0200 (2011-05-03)
changeset 24382ba5655f6297
parent 2437 7657175fcb8c
child 2439 7eda1fcfd53d
libc/glibc: add 2.13

Patchset provided by "Ioannis E. Venetis" <venetis@mail.capsl.udel.edu>
http://sourceware.org/ml/crossgcc/2011-04/msg00072.html
http://sourceware.org/ml/crossgcc/2011-04/msg00073.html

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/libc/glibc.in
patches/glibc/2.13/900-march-i686.patch
patches/glibc/2.13/910-typedef-caddr.patch
patches/glibc/ports-2.13/100-respect-env-CPPFLAGS.patch
patches/glibc/ports-2.13/120-i386-x86_64-revert-clone-cfi.patch
patches/glibc/ports-2.13/140-disable-ldconfig.patch
patches/glibc/ports-2.13/150-queue-header-updates.patch
patches/glibc/ports-2.13/160-manual-no-perl.patch
patches/glibc/ports-2.13/170-localedef-fix-trampoline.patch
patches/glibc/ports-2.13/180-resolv-dynamic.patch
patches/glibc/ports-2.13/190-localedef-mmap.patch
patches/glibc/ports-2.13/200-fadvise64_64.patch
patches/glibc/ports-2.13/220-section-comments.patch
patches/glibc/ports-2.13/230-no-inline-gmon.patch
patches/glibc/ports-2.13/240-check_native-headers.patch
patches/glibc/ports-2.13/250-fix-pr631.patch
patches/glibc/ports-2.13/260-assume-pipe2.patch
patches/glibc/ports-2.13/270-china.patch
patches/glibc/ports-2.13/280-new-valencian-locale.patch
patches/glibc/ports-2.13/300-nscd-one-fork.patch
patches/glibc/ports-2.13/310-hppa-nptl-carlos.patch
patches/glibc/ports-2.13/330-m68k-sys-user.patch
patches/glibc/ports-2.13/340-dl_execstack-PaX-support.patch
patches/glibc/ports-2.13/350-pre20040117-pt_pax.patch
patches/glibc/ports-2.13/360-tests-sandbox-libdl-paths.patch
patches/glibc/ports-2.13/380-dont-build-timezone.patch
patches/glibc/ports-2.13/400-alpha-xstat.patch
patches/glibc/ports-2.13/410-alpha-SETPIPE-GETPIPE.patch
patches/glibc/ports-2.13/420-alpha-statfs.patch
patches/glibc/ports-2.13/430-alpha-creat.patch
patches/glibc/ports-2.13/440-alpha-cache-shape.patch
patches/glibc/ports-2.13/450-alpha-DEFAULT_STACK_PERMS.patch
patches/glibc/ports-2.13/460-alpha-fix-gcc-4.1-warnings.patch
patches/glibc/ports-2.13/470-alpha-feupdateenv.patch
patches/glibc/ports-2.13/490-alpha_alpha-add-fdatasync-support.patch
patches/glibc/ports-2.13/530-alpha-fix-rtld-fPIC.patch
patches/glibc/ports-2.13/560-ppc-atomic.patch
patches/glibc/ports-2.13/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
patches/glibc/ports-2.13/580-nptl-lowlevellock.patch
patches/glibc/ports-2.13/610-fpu-cw-mips.patch
patches/glibc/ports-2.13/630-mips_shn_undef-hack.patch
patches/glibc/ports-2.13/640-alpha-atfcts.patch
patches/glibc/ports-2.13/650-syslog.patch
patches/glibc/ports-2.13/660-debug-readlink_chk-readklinkat_chk.patch
     1.1 --- a/config/libc/glibc.in	Tue May 03 00:20:04 2011 +0200
     1.2 +++ b/config/libc/glibc.in	Tue May 03 00:19:56 2011 +0200
     1.3 @@ -41,6 +41,11 @@
     1.4  # Don't remove next line
     1.5  # CT_INSERT_VERSION_BELOW
     1.6  
     1.7 +config LIBC_GLIBC_V_2_13
     1.8 +    bool
     1.9 +    prompt "2.13 (EXPERIMENTAL)"
    1.10 +    depends on EXPERIMENTAL
    1.11 +
    1.12  config LIBC_GLIBC_V_2_12_2
    1.13      bool
    1.14      prompt "2.12.2 (EXPERIMENTAL)"
    1.15 @@ -108,6 +113,7 @@
    1.16      string
    1.17  # Don't remove next line
    1.18  # CT_INSERT_VERSION_STRING_BELOW
    1.19 +    default "2.13" if LIBC_GLIBC_V_2_13
    1.20      default "2.12.2" if LIBC_GLIBC_V_2_12_2
    1.21      default "2.12.1" if LIBC_GLIBC_V_2_12_1
    1.22      default "2.11.1" if LIBC_GLIBC_V_2_11_1
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/glibc/2.13/900-march-i686.patch	Tue May 03 00:19:56 2011 +0200
     2.3 @@ -0,0 +1,34 @@
     2.4 +2007-02-15  Khem Raj  <kraj@xxxxxxxxxx>
     2.5 +
     2.6 +       * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
     2.7 +       * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
     2.8 +
     2.9 +diff -urN glibc-2.12.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.12.1/nptl/sysdeps/pthread/pt-initfini.c
    2.10 +--- glibc-2.12.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-10-30 18:17:08.000000000 +0100
    2.11 ++++ glibc-2.12.1/nptl/sysdeps/pthread/pt-initfini.c	2010-12-30 11:36:19.858708534 +0100
    2.12 +@@ -45,6 +45,11 @@
    2.13 + /* Embed an #include to pull in the alignment and .end directives. */
    2.14 + asm ("\n#include \"defs.h\"");
    2.15 + 
    2.16 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
    2.17 ++asm ("\n#undef __i686");
    2.18 ++asm ("\n#define __i686 __i686");
    2.19 ++asm ("\n#endif");
    2.20 ++
    2.21 + /* The initial common code ends here. */
    2.22 + asm ("\n/*@HEADER_ENDS*/");
    2.23 + 
    2.24 +diff -urN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.12.1/sysdeps/unix/sysv/linux/i386/sysdep.h
    2.25 +--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-10-30 18:17:08.000000000 +0100
    2.26 ++++ glibc-2.12.1/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-12-30 11:36:19.858708534 +0100
    2.27 +@@ -29,6 +29,10 @@
    2.28 + #include <dl-sysdep.h>
    2.29 + #include <tls.h>
    2.30 + 
    2.31 ++#if defined __i686 && defined __ASSEMBLER__
    2.32 ++#undef __i686
    2.33 ++#define __i686 __i686
    2.34 ++#endif
    2.35 + 
    2.36 + /* For Linux we can use the system call table in the header file
    2.37 + 	/usr/include/asm/unistd.h
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/glibc/2.13/910-typedef-caddr.patch	Tue May 03 00:19:56 2011 +0200
     3.3 @@ -0,0 +1,28 @@
     3.4 +diff -urN glibc-2.12.1-orig/posix/sys/types.h glibc-2.12.1/posix/sys/types.h
     3.5 +--- glibc-2.12.1-orig/posix/sys/types.h	2010-12-13 11:47:26.000000000 +0100
     3.6 ++++ glibc-2.12.1/posix/sys/types.h	2011-03-29 14:16:00.374064708 +0200
     3.7 +@@ -114,7 +114,10 @@
     3.8 + #ifdef	__USE_BSD
     3.9 + # ifndef __daddr_t_defined
    3.10 + typedef __daddr_t daddr_t;
    3.11 ++#  if ! defined(caddr_t) && ! defined(__caddr_t_defined)
    3.12 + typedef __caddr_t caddr_t;
    3.13 ++#   define __caddr_t_defined
    3.14 ++#  endif
    3.15 + #  define __daddr_t_defined
    3.16 + # endif
    3.17 + #endif
    3.18 +diff -urN glibc-2.12.1-orig/sunrpc/rpc/types.h glibc-2.12.1/sunrpc/rpc/types.h
    3.19 +--- glibc-2.12.1-orig/sunrpc/rpc/types.h	2010-12-13 11:47:26.000000000 +0100
    3.20 ++++ glibc-2.12.1/sunrpc/rpc/types.h	2011-03-29 14:16:32.988910439 +0200
    3.21 +@@ -80,7 +80,10 @@
    3.22 + #endif
    3.23 + #ifndef __daddr_t_defined
    3.24 + typedef __daddr_t daddr_t;
    3.25 ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
    3.26 + typedef __caddr_t caddr_t;
    3.27 ++#  define __caddr_t_defined
    3.28 ++# endif
    3.29 + # define __daddr_t_defined
    3.30 + #endif
    3.31 + 
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/patches/glibc/ports-2.13/100-respect-env-CPPFLAGS.patch	Tue May 03 00:19:56 2011 +0200
     4.3 @@ -0,0 +1,14 @@
     4.4 +Respect environment CPPFLAGS when we run ./configure so we can inject
     4.5 +random -D things without having to set CFLAGS/ASFLAGS
     4.6 +
     4.7 +diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
     4.8 +--- glibc-2.13.orig/Makeconfig	2009-05-09 23:57:56.000000000 +0200
     4.9 ++++ glibc-2.13/Makeconfig	2009-11-13 00:49:41.000000000 +0100
    4.10 +@@ -697,6 +697,7 @@
    4.11 + 	   $(foreach lib,$(libof-$(basename $(@F))) \
    4.12 + 			 $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
    4.13 + 	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
    4.14 ++CPPFLAGS += $(CPPFLAGS-config)
    4.15 + override CFLAGS	= -std=gnu99 $(gnu89-inline-CFLAGS) \
    4.16 + 		  $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
    4.17 + 		  $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/patches/glibc/ports-2.13/120-i386-x86_64-revert-clone-cfi.patch	Tue May 03 00:19:56 2011 +0200
     5.3 @@ -0,0 +1,55 @@
     5.4 +revert cfi additions to clone on i386/x86_64 to workaround problems in
     5.5 +gcc's unwinder code.  this is not a bug in glibc, it triggers problems
     5.6 +elsewhere.  this cfi code does not gain us a whole lot anyways.
     5.7 +
     5.8 +http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
     5.9 +
    5.10 +Index: sysdeps/unix/sysv/linux/i386/clone.S
    5.11 +===================================================================
    5.12 +RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
    5.13 +retrieving revision 1.27
    5.14 +retrieving revision 1.26
    5.15 +diff -u -p -r1.27 -r1.26
    5.16 +
    5.17 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S
    5.18 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S	2006-12-04 00:12:36.000000000 +0100
    5.19 ++++ glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S	2009-11-13 00:49:45.000000000 +0100
    5.20 +@@ -120,9 +120,6 @@
    5.21 + 	ret
    5.22 + 
    5.23 + L(thread_start):
    5.24 +-	cfi_startproc;
    5.25 +-	/* Clearing frame pointer is insufficient, use CFI.  */
    5.26 +-	cfi_undefined (eip);
    5.27 + 	/* Note: %esi is zero.  */
    5.28 + 	movl	%esi,%ebp	/* terminate the stack frame */
    5.29 + #ifdef RESET_PID
    5.30 +@@ -155,7 +152,6 @@
    5.31 + 	jmp	L(haspid)
    5.32 + 	.previous
    5.33 + #endif
    5.34 +-	cfi_endproc;
    5.35 + 
    5.36 + 	cfi_startproc
    5.37 + PSEUDO_END (BP_SYM (__clone))
    5.38 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S
    5.39 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S	2006-12-04 00:12:36.000000000 +0100
    5.40 ++++ glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S	2009-11-13 00:49:45.000000000 +0100
    5.41 +@@ -89,9 +89,6 @@
    5.42 + 	ret
    5.43 + 
    5.44 + L(thread_start):
    5.45 +-	cfi_startproc;
    5.46 +-	/* Clearing frame pointer is insufficient, use CFI.  */
    5.47 +-	cfi_undefined (rip);
    5.48 + 	/* Clear the frame pointer.  The ABI suggests this be done, to mark
    5.49 + 	   the outermost frame obviously.  */
    5.50 + 	xorl	%ebp, %ebp
    5.51 +@@ -116,7 +113,6 @@
    5.52 + 	/* Call exit with return value from function call. */
    5.53 + 	movq	%rax, %rdi
    5.54 + 	call	HIDDEN_JUMPTARGET (_exit)
    5.55 +-	cfi_endproc;
    5.56 + 
    5.57 + 	cfi_startproc;
    5.58 + PSEUDO_END (BP_SYM (__clone))
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/patches/glibc/ports-2.13/140-disable-ldconfig.patch	Tue May 03 00:19:56 2011 +0200
     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.13.orig/Makefile glibc-2.13/Makefile
    6.10 +--- glibc-2.13.orig/Makefile	2009-04-23 20:23:03.000000000 +0200
    6.11 ++++ glibc-2.13/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.13/150-queue-header-updates.patch	Tue May 03 00:19:56 2011 +0200
     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.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
     7.9 +
    7.10 +diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
    7.11 +--- glibc-2.13.orig/misc/sys/queue.h	2008-03-05 06:50:30.000000000 +0100
    7.12 ++++ glibc-2.13/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.13/160-manual-no-perl.patch	Tue May 03 00:19:56 2011 +0200
     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.13.orig/manual/Makefile glibc-2.13/manual/Makefile
    8.11 +--- glibc-2.13.orig/manual/Makefile	2006-01-08 07:43:47.000000000 +0100
    8.12 ++++ glibc-2.13/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.13/170-localedef-fix-trampoline.patch	Tue May 03 00:19:56 2011 +0200
     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.13.orig/locale/programs/3level.h glibc-2.13/locale/programs/3level.h
    9.28 +--- glibc-2.13.orig/locale/programs/3level.h	2007-07-16 02:54:59.000000000 +0200
    9.29 ++++ glibc-2.13/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.13/180-resolv-dynamic.patch	Tue May 03 00:19:56 2011 +0200
    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.13.orig/resolv/res_libc.c glibc-2.13/resolv/res_libc.c
   10.12 +--- glibc-2.13.orig/resolv/res_libc.c	2009-02-07 05:27:42.000000000 +0100
   10.13 ++++ glibc-2.13/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.13/190-localedef-mmap.patch	Tue May 03 00:19:56 2011 +0200
    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.13.orig/locale/programs/locarchive.c glibc-2.13/locale/programs/locarchive.c
   11.14 +--- glibc-2.13.orig/locale/programs/locarchive.c	2009-04-27 16:07:47.000000000 +0200
   11.15 ++++ glibc-2.13/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.13/200-fadvise64_64.patch	Tue May 03 00:19:56 2011 +0200
    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.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c
   12.10 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c	2003-08-17 02:36:22.000000000 +0200
   12.11 ++++ glibc-2.13/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.13/220-section-comments.patch	Tue May 03 00:19:56 2011 +0200
    13.3 @@ -0,0 +1,24 @@
    13.4 +http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
    13.5 +
    13.6 +fixes building on some architectures (like m68k/arm/cris/etc...) because
    13.7 +it does the right thing
    13.8 +
    13.9 +diff -durN glibc-2.13.orig/include/libc-symbols.h glibc-2.13/include/libc-symbols.h
   13.10 +--- glibc-2.13.orig/include/libc-symbols.h	2009-03-14 00:51:46.000000000 +0100
   13.11 ++++ glibc-2.13/include/libc-symbols.h	2009-11-13 00:50:07.000000000 +0100
   13.12 +@@ -239,12 +239,12 @@
   13.13 + #  define __make_section_unallocated(section_string)
   13.14 + # endif
   13.15 + 
   13.16 +-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
   13.17 ++/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
   13.18 +    section attributes on what looks like a comment to the assembler.  */
   13.19 + # ifdef HAVE_SECTION_QUOTES
   13.20 +-#  define __sec_comment "\"\n\t#\""
   13.21 ++#  define __sec_comment "\"\n#APP\n\t#\""
   13.22 + # else
   13.23 +-#  define __sec_comment "\n\t#"
   13.24 ++#  define __sec_comment "\n#APP\n\t#"
   13.25 + # endif
   13.26 + # define link_warning(symbol, msg) \
   13.27 +   __make_section_unallocated (".gnu.warning." #symbol) \
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/patches/glibc/ports-2.13/230-no-inline-gmon.patch	Tue May 03 00:19:56 2011 +0200
    14.3 @@ -0,0 +1,36 @@
    14.4 +http://bugs.gentoo.org/196245
    14.5 +http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
    14.6 +
    14.7 +Attached is a patch to add __attribute__ ((noinline)) to
    14.8 +call_gmon_start.
    14.9 +
   14.10 +Without this patch, the sec script that processed initfini.s removes a
   14.11 +part of inlined call_gmon_start, causing undefined label errors.
   14.12 +
   14.13 +This patch solves the problem by forcing gcc not to inline
   14.14 +call_gmon_start with __attribute__ ((noinline)).
   14.15 +
   14.16 +Tested by building for arm-none-lixux-gnueabi.  OK to apply?
   14.17 +
   14.18 +Kazu Hirata
   14.19 +
   14.20 +2006-05-07  Kazu Hirata  &lt;kazu@codesourcery.com&gt;
   14.21 +
   14.22 +	* sysdeps/generic/initfini.c (call_gmon_start): Add
   14.23 +	__attribute__ ((noinline)).
   14.24 +
   14.25 +Index: sysdeps/generic/initfini.c
   14.26 +===================================================================
   14.27 +
   14.28 +diff -durN glibc-2.13.orig/sysdeps/generic/initfini.c glibc-2.13/sysdeps/generic/initfini.c
   14.29 +--- glibc-2.13.orig/sysdeps/generic/initfini.c	2007-06-17 20:02:40.000000000 +0200
   14.30 ++++ glibc-2.13/sysdeps/generic/initfini.c	2009-11-13 00:50:09.000000000 +0100
   14.31 +@@ -70,7 +70,7 @@
   14.32 + /* The beginning of _init:  */
   14.33 + asm ("\n/*@_init_PROLOG_BEGINS*/");
   14.34 + 
   14.35 +-static void
   14.36 ++static void __attribute__ ((noinline))
   14.37 + call_gmon_start(void)
   14.38 + {
   14.39 +   extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/patches/glibc/ports-2.13/240-check_native-headers.patch	Tue May 03 00:19:56 2011 +0200
    15.3 @@ -0,0 +1,17 @@
    15.4 +many ports hit this warning:
    15.5 +../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
    15.6 +../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
    15.7 +
    15.8 +snipped from suse
    15.9 +
   15.10 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/check_native.c glibc-2.13/sysdeps/unix/sysv/linux/check_native.c
   15.11 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/check_native.c	2007-11-24 04:12:17.000000000 +0100
   15.12 ++++ glibc-2.13/sysdeps/unix/sysv/linux/check_native.c	2009-11-13 00:50:11.000000000 +0100
   15.13 +@@ -23,6 +23,7 @@
   15.14 + #include <stddef.h>
   15.15 + #include <stdint.h>
   15.16 + #include <stdlib.h>
   15.17 ++#include <string.h>
   15.18 + #include <time.h>
   15.19 + #include <unistd.h>
   15.20 + #include <net/if.h>
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/patches/glibc/ports-2.13/250-fix-pr631.patch	Tue May 03 00:19:56 2011 +0200
    16.3 @@ -0,0 +1,45 @@
    16.4 +From dank@kegel.com
    16.5 +Wed Jun 15 09:12:43 PDT 2005
    16.6 +
    16.7 +Fixes
    16.8 +
    16.9 +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r'
   16.10 +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent'
   16.11 +... 53 lines deleted ...
   16.12 +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r'
   16.13 +collect2: ld returned 1 exit status
   16.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
   16.15 +
   16.16 +when building glibc with --enable-static-nss.
   16.17 +
   16.18 +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631
   16.19 +
   16.20 +diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
   16.21 +--- glibc-2.13.orig/Makeconfig	2009-11-13 00:49:41.000000000 +0100
   16.22 ++++ glibc-2.13/Makeconfig	2009-11-13 00:50:13.000000000 +0100
   16.23 +@@ -531,7 +531,7 @@
   16.24 + 
   16.25 + # The static libraries.
   16.26 + ifeq (yes,$(build-static))
   16.27 +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
   16.28 ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a
   16.29 + else
   16.30 + ifeq (yes,$(build-shared))
   16.31 + # We can try to link the programs with lib*_pic.a...
   16.32 +diff -durN glibc-2.13.orig/elf/Makefile glibc-2.13/elf/Makefile
   16.33 +--- glibc-2.13.orig/elf/Makefile	2009-01-31 01:20:55.000000000 +0100
   16.34 ++++ glibc-2.13/elf/Makefile	2009-11-13 00:50:13.000000000 +0100
   16.35 +@@ -146,6 +146,13 @@
   16.36 + install-bin-script = ldd
   16.37 + endif
   16.38 + 
   16.39 ++ifeq (yes,$(build-static-nss))
   16.40 ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
   16.41 ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
   16.42 ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
   16.43 ++	     $(resolvobjdir)/libresolv.a
   16.44 ++endif
   16.45 ++
   16.46 + others		= sprof sln
   16.47 + install-bin	= sprof
   16.48 + others-static   = sln
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/patches/glibc/ports-2.13/260-assume-pipe2.patch	Tue May 03 00:19:56 2011 +0200
    17.3 @@ -0,0 +1,40 @@
    17.4 +http://bugs.gentoo.org/250342
    17.5 +http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
    17.6 +
    17.7 +we cant assume sock_cloexec and pipe2 are bound together as the former defines
    17.8 +are found in glibc only while the latter are a combo of kernel headers and
    17.9 +glibc.  so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
   17.10 +inside of glibc, we hit a problem.  for example:
   17.11 +
   17.12 +#include <grp.h>
   17.13 +#include <stdio.h>
   17.14 +main()
   17.15 +{
   17.16 +	getgrnam("portage");
   17.17 +	if (!popen("ls", "r"))
   17.18 +		perror("popen()");
   17.19 +}
   17.20 +
   17.21 +getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
   17.22 +__have_sock_cloexec and __have_pipe2 to true.  but if glibc was built against
   17.23 +older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
   17.24 +stub for it.  so popen() will always fail as glibc assumes pipe2() works.
   17.25 +
   17.26 +diff -durN glibc-2.13.orig/socket/have_sock_cloexec.c glibc-2.13/socket/have_sock_cloexec.c
   17.27 +--- glibc-2.13.orig/socket/have_sock_cloexec.c	2008-07-25 18:46:23.000000000 +0200
   17.28 ++++ glibc-2.13/socket/have_sock_cloexec.c	2009-11-13 00:50:15.000000000 +0100
   17.29 +@@ -16,9 +16,14 @@
   17.30 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   17.31 +    02111-1307 USA.  */
   17.32 + 
   17.33 ++#include <fcntl.h>
   17.34 + #include <sys/socket.h>
   17.35 + #include <kernel-features.h>
   17.36 + 
   17.37 + #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
   17.38 + int __have_sock_cloexec;
   17.39 + #endif
   17.40 ++
   17.41 ++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
   17.42 ++int __have_pipe2;
   17.43 ++#endif
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/patches/glibc/ports-2.13/270-china.patch	Tue May 03 00:19:56 2011 +0200
    18.3 @@ -0,0 +1,32 @@
    18.4 +
    18.5 +
    18.6 +diff -durN glibc-2.13.orig/localedata/locales/zh_TW glibc-2.13/localedata/locales/zh_TW
    18.7 +--- glibc-2.13.orig/localedata/locales/zh_TW	2004-11-01 00:42:28.000000000 +0100
    18.8 ++++ glibc-2.13/localedata/locales/zh_TW	2009-11-13 00:50:17.000000000 +0100
    18.9 +@@ -1,7 +1,7 @@
   18.10 + comment_char %
   18.11 + escape_char /
   18.12 + %
   18.13 +-% Chinese language locale for Taiwan R.O.C.
   18.14 ++% Chinese language locale for Taiwan
   18.15 + % charmap: BIG5-CP950
   18.16 + %
   18.17 + % Original Author:
   18.18 +@@ -17,7 +17,7 @@
   18.19 + % Reference:	http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
   18.20 + 
   18.21 + LC_IDENTIFICATION
   18.22 +-title      "Chinese locale for Taiwan R.O.C."
   18.23 ++title      "Chinese locale for Taiwan"
   18.24 + source     ""
   18.25 + address    ""
   18.26 + contact    ""
   18.27 +@@ -25,7 +25,7 @@
   18.28 + tel        ""
   18.29 + fax        ""
   18.30 + language   "Chinese"
   18.31 +-territory  "Taiwan R.O.C."
   18.32 ++territory  "Taiwan"
   18.33 + revision   "0.2"
   18.34 + date       "2000-08-02"
   18.35 + %
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/patches/glibc/ports-2.13/280-new-valencian-locale.patch	Tue May 03 00:19:56 2011 +0200
    19.3 @@ -0,0 +1,115 @@
    19.4 +http://bugs.gentoo.org/show_bug.cgi?id=131815
    19.5 +http://sourceware.org/bugzilla/show_bug.cgi?id=2522
    19.6 +
    19.7 +diff -durN glibc-2.13.orig/localedata/SUPPORTED glibc-2.13/localedata/SUPPORTED
    19.8 +--- glibc-2.13.orig/localedata/SUPPORTED	2009-04-18 10:43:52.000000000 +0200
    19.9 ++++ glibc-2.13/localedata/SUPPORTED	2009-11-13 00:50:20.000000000 +0100
   19.10 +@@ -72,6 +72,8 @@
   19.11 + ca_ES.UTF-8/UTF-8 \
   19.12 + ca_ES/ISO-8859-1 \
   19.13 + ca_ES@euro/ISO-8859-15 \
   19.14 ++ca_ES.UTF-8@valencia/UTF-8 \
   19.15 ++ca_ES@valencia/ISO-8859-15 \
   19.16 + ca_FR.UTF-8/UTF-8 \
   19.17 + ca_FR/ISO-8859-15 \
   19.18 + ca_IT.UTF-8/UTF-8 \
   19.19 +diff -durN glibc-2.13.orig/localedata/locales/ca_ES@valencia glibc-2.13/localedata/locales/ca_ES@valencia
   19.20 +--- glibc-2.13.orig/localedata/locales/ca_ES@valencia	1970-01-01 01:00:00.000000000 +0100
   19.21 ++++ glibc-2.13/localedata/locales/ca_ES@valencia	2009-11-13 00:50:20.000000000 +0100
   19.22 +@@ -0,0 +1,96 @@
   19.23 ++comment_char %
   19.24 ++escape_char  /
   19.25 ++%
   19.26 ++% Valencian (southern Catalan) locale for Spain with Euro
   19.27 ++%
   19.28 ++% Note that this locale is almost the same as ca_ES@euro.  The point of having
   19.29 ++% a separate locale is only for PO translations, which have a lot of social
   19.30 ++% support and are very appreciated by the Valencian-speaking community.
   19.31 ++%
   19.32 ++% Contact: Jordi Mallach
   19.33 ++% Email: jordi@gnu.org
   19.34 ++% Tel:
   19.35 ++% Fax:
   19.36 ++% Language: ca
   19.37 ++% Territory: ES
   19.38 ++% Option: euro
   19.39 ++% Revision: 1.0
   19.40 ++% Date: 2006-04-06
   19.41 ++% Application: general
   19.42 ++% Users: general
   19.43 ++% Repertoiremap: mnemonic,ds
   19.44 ++% Charset: ISO-8859-15
   19.45 ++% Distribution and use is free, also
   19.46 ++% for commercial purposes.
   19.47 ++
   19.48 ++LC_IDENTIFICATION
   19.49 ++title      "Valencian (southern Catalan) locale for Spain with Euro"
   19.50 ++source     ""
   19.51 ++address    ""
   19.52 ++contact    "Jordi Mallach"
   19.53 ++email      "jordi@gnu.org"
   19.54 ++tel        ""
   19.55 ++fax        ""
   19.56 ++language   "Catalan"
   19.57 ++territory  "Spain"
   19.58 ++revision   "1.0"
   19.59 ++date       "2006-04-06"
   19.60 ++%
   19.61 ++category  "ca_ES@valencia:2006";LC_IDENTIFICATION
   19.62 ++category  "ca_ES@valencia:2006";LC_CTYPE
   19.63 ++category  "ca_ES@valencia:2006";LC_COLLATE
   19.64 ++category  "ca_ES@valencia:2006";LC_MONETARY
   19.65 ++category  "ca_ES@valencia:2006";LC_NUMERIC
   19.66 ++category  "ca_ES@valencia:2006";LC_TIME
   19.67 ++category  "ca_ES@valencia:2006";LC_MESSAGES
   19.68 ++category  "ca_ES@valencia:2006";LC_PAPER
   19.69 ++category  "ca_ES@valencia:2006";LC_NAME
   19.70 ++category  "ca_ES@valencia:2006";LC_ADDRESS
   19.71 ++category  "ca_ES@valencia:2006";LC_TELEPHONE
   19.72 ++category  "ca_ES@valencia:2006";LC_MEASUREMENT
   19.73 ++
   19.74 ++END LC_IDENTIFICATION
   19.75 ++
   19.76 ++LC_CTYPE
   19.77 ++copy "i18n"
   19.78 ++END LC_CTYPE
   19.79 ++
   19.80 ++LC_COLLATE
   19.81 ++copy "ca_ES"
   19.82 ++END LC_COLLATE
   19.83 ++
   19.84 ++LC_MONETARY
   19.85 ++copy "ca_ES"
   19.86 ++END LC_MONETARY
   19.87 ++
   19.88 ++LC_NUMERIC
   19.89 ++copy "ca_ES"
   19.90 ++END LC_NUMERIC
   19.91 ++
   19.92 ++LC_TIME
   19.93 ++copy "ca_ES"
   19.94 ++END LC_TIME
   19.95 ++
   19.96 ++LC_MESSAGES
   19.97 ++copy "ca_ES"
   19.98 ++END LC_MESSAGES
   19.99 ++
  19.100 ++LC_PAPER
  19.101 ++copy "ca_ES"
  19.102 ++END LC_PAPER
  19.103 ++
  19.104 ++LC_NAME
  19.105 ++copy "ca_ES"
  19.106 ++END LC_NAME
  19.107 ++
  19.108 ++LC_ADDRESS
  19.109 ++copy "ca_ES"
  19.110 ++END LC_ADDRESS
  19.111 ++
  19.112 ++LC_TELEPHONE
  19.113 ++copy "ca_ES"
  19.114 ++END LC_TELEPHONE
  19.115 ++
  19.116 ++LC_MEASUREMENT
  19.117 ++copy "ca_ES"
  19.118 ++END LC_MEASUREMENT
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/patches/glibc/ports-2.13/300-nscd-one-fork.patch	Tue May 03 00:19:56 2011 +0200
    20.3 @@ -0,0 +1,40 @@
    20.4 +only fork one to assist in stop-start-daemon assumptions about daemon behavior
    20.5 +
    20.6 +http://bugs.gentoo.org/190785
    20.7 +
    20.8 +diff -durN glibc-2.13.orig/nscd/nscd.c glibc-2.13/nscd/nscd.c
    20.9 +--- glibc-2.13.orig/nscd/nscd.c	2009-02-06 21:10:27.000000000 +0100
   20.10 ++++ glibc-2.13/nscd/nscd.c	2009-11-13 00:50:24.000000000 +0100
   20.11 +@@ -182,6 +182,9 @@
   20.12 +       if (pid != 0)
   20.13 + 	exit (0);
   20.14 + 
   20.15 ++       if (write_pid (_PATH_NSCDPID) < 0)
   20.16 ++	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
   20.17 ++
   20.18 +       int nullfd = open (_PATH_DEVNULL, O_RDWR);
   20.19 +       if (nullfd != -1)
   20.20 + 	{
   20.21 +@@ -231,12 +234,6 @@
   20.22 + 	for (i = min_close_fd; i < getdtablesize (); i++)
   20.23 + 	  close (i);
   20.24 + 
   20.25 +-      pid = fork ();
   20.26 +-      if (pid == -1)
   20.27 +-	error (EXIT_FAILURE, errno, _("cannot fork"));
   20.28 +-      if (pid != 0)
   20.29 +-	exit (0);
   20.30 +-
   20.31 +       setsid ();
   20.32 + 
   20.33 +       if (chdir ("/") != 0)
   20.34 +@@ -245,9 +242,6 @@
   20.35 + 
   20.36 +       openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
   20.37 + 
   20.38 +-      if (write_pid (_PATH_NSCDPID) < 0)
   20.39 +-	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
   20.40 +-
   20.41 +       if (!init_logfile ())
   20.42 + 	dbg_log (_("Could not create log file"));
   20.43 + 
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/patches/glibc/ports-2.13/310-hppa-nptl-carlos.patch	Tue May 03 00:19:56 2011 +0200
    21.3 @@ -0,0 +1,246 @@
    21.4 +
    21.5 +
    21.6 +diff -durN glibc-2.13.orig/elf/rtld.c glibc-2.13/elf/rtld.c
    21.7 +--- glibc-2.13.orig/elf/rtld.c	2009-04-17 02:00:08.000000000 +0200
    21.8 ++++ glibc-2.13/elf/rtld.c	2009-11-13 00:50:26.000000000 +0100
    21.9 +@@ -392,14 +392,14 @@
   21.10 +      know it is available.  We do not have to clear the memory if we
   21.11 +      do not have to use the temporary bootstrap_map.  Global variables
   21.12 +      are initialized to zero by default.  */
   21.13 +-#ifndef DONT_USE_BOOTSTRAP_MAP
   21.14 ++#if !defined DONT_USE_BOOTSTRAP_MAP
   21.15 + # ifdef HAVE_BUILTIN_MEMSET
   21.16 +   __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
   21.17 + # else
   21.18 +-  for (size_t cnt = 0;
   21.19 +-       cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
   21.20 +-       ++cnt)
   21.21 +-    bootstrap_map.l_info[cnt] = 0;
   21.22 ++  /* Clear the whole bootstrap_map structure */
   21.23 ++  for (char *cnt = (char *)&(bootstrap_map);
   21.24 ++       cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
   21.25 ++       *cnt++ = '\0');
   21.26 + # endif
   21.27 + # if USE___THREAD
   21.28 +   bootstrap_map.l_tls_modid = 0;
   21.29 +diff -durN glibc-2.13.orig/include/atomic.h glibc-2.13/include/atomic.h
   21.30 +--- glibc-2.13.orig/include/atomic.h	2009-02-09 00:49:53.000000000 +0100
   21.31 ++++ glibc-2.13/include/atomic.h	2009-11-13 00:50:26.000000000 +0100
   21.32 +@@ -185,7 +185,7 @@
   21.33 +      __typeof (*(mem)) __atg5_value = (newvalue);			      \
   21.34 + 									      \
   21.35 +      do									      \
   21.36 +-       __atg5_oldval = *__atg5_memp;					      \
   21.37 ++       __atg5_oldval = *(volatile __typeof (mem))__atg5_memp;		      \
   21.38 +      while (__builtin_expect						      \
   21.39 + 	    (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
   21.40 + 						   __atg5_oldval), 0));	      \
   21.41 +@@ -206,7 +206,7 @@
   21.42 +      __typeof (*(mem)) __atg6_value = (value);				      \
   21.43 + 									      \
   21.44 +      do									      \
   21.45 +-       __atg6_oldval = *__atg6_memp;					      \
   21.46 ++       __atg6_oldval = *(volatile __typeof (mem))__atg6_memp;		      \
   21.47 +      while (__builtin_expect						      \
   21.48 + 	    (atomic_compare_and_exchange_bool_acq (__atg6_memp,		      \
   21.49 + 						   __atg6_oldval	      \
   21.50 +@@ -224,7 +224,7 @@
   21.51 +      __typeof (*(mem)) __atg7_value = (value);				      \
   21.52 + 									      \
   21.53 +      do									      \
   21.54 +-       __atg7_oldv = *__atg7_memp;					      \
   21.55 ++       __atg7_oldv = *(volatile __typeof (mem))__atg7_memp;		      \
   21.56 +      while (__builtin_expect						      \
   21.57 + 	    (catomic_compare_and_exchange_bool_acq (__atg7_memp,	      \
   21.58 + 						    __atg7_oldv		      \
   21.59 +@@ -242,7 +242,7 @@
   21.60 +     __typeof (mem) __atg8_memp = (mem);					      \
   21.61 +     __typeof (*(mem)) __atg8_value = (value);				      \
   21.62 +     do {								      \
   21.63 +-      __atg8_oldval = *__atg8_memp;					      \
   21.64 ++      __atg8_oldval = *(volatile __typeof (mem))__atg8_memp;		      \
   21.65 +       if (__atg8_oldval >= __atg8_value)				      \
   21.66 + 	break;								      \
   21.67 +     } while (__builtin_expect						      \
   21.68 +@@ -259,7 +259,7 @@
   21.69 +     __typeof (mem) __atg9_memp = (mem);					      \
   21.70 +     __typeof (*(mem)) __atg9_value = (value);				      \
   21.71 +     do {								      \
   21.72 +-      __atg9_oldv = *__atg9_memp;					      \
   21.73 ++      __atg9_oldv = *(volatile __typeof (mem))__atg9_memp;		      \
   21.74 +       if (__atg9_oldv >= __atg9_value)					      \
   21.75 + 	break;								      \
   21.76 +     } while (__builtin_expect						      \
   21.77 +@@ -277,7 +277,7 @@
   21.78 +     __typeof (mem) __atg10_memp = (mem);				      \
   21.79 +     __typeof (*(mem)) __atg10_value = (value);				      \
   21.80 +     do {								      \
   21.81 +-      __atg10_oldval = *__atg10_memp;					      \
   21.82 ++      __atg10_oldval = *(volatile __typeof (mem))__atg10_memp;		      \
   21.83 +       if (__atg10_oldval <= __atg10_value)				      \
   21.84 + 	break;								      \
   21.85 +     } while (__builtin_expect						      \
   21.86 +@@ -361,7 +361,7 @@
   21.87 + 									      \
   21.88 +      do									      \
   21.89 +        {								      \
   21.90 +-	 __atg11_oldval = *__atg11_memp;				      \
   21.91 ++	 __atg11_oldval = *(volatile __typeof (mem))__atg11_memp;	      \
   21.92 + 	 if (__builtin_expect (__atg11_oldval <= 0, 0))			      \
   21.93 + 	   break;							      \
   21.94 +        }								      \
   21.95 +@@ -400,7 +400,7 @@
   21.96 +      __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit));	      \
   21.97 + 									      \
   21.98 +      do									      \
   21.99 +-       __atg14_old = (*__atg14_memp);					      \
  21.100 ++       __atg14_old = (*(volatile __typeof (mem))__atg14_memp);		      \
  21.101 +      while (__builtin_expect						      \
  21.102 + 	    (atomic_compare_and_exchange_bool_acq (__atg14_memp,	      \
  21.103 + 						   __atg14_old | __atg14_mask,\
  21.104 +@@ -418,7 +418,7 @@
  21.105 +     __typeof (*(mem)) __atg15_mask = (mask);				      \
  21.106 + 									      \
  21.107 +     do									      \
  21.108 +-      __atg15_old = (*__atg15_memp);					      \
  21.109 ++      __atg15_old = (*(volatile __typeof (mem))__atg15_memp);		      \
  21.110 +     while (__builtin_expect						      \
  21.111 + 	   (atomic_compare_and_exchange_bool_acq (__atg15_memp,		      \
  21.112 + 						  __atg15_old & __atg15_mask, \
  21.113 +@@ -450,7 +450,7 @@
  21.114 +      __typeof (*(mem)) __atg16_mask = (mask);				      \
  21.115 + 									      \
  21.116 +      do									      \
  21.117 +-       __atg16_old = (*__atg16_memp);					      \
  21.118 ++       __atg16_old = (*(volatile __typeof (mem))__atg16_memp);		      \
  21.119 +      while (__builtin_expect						      \
  21.120 + 	    (atomic_compare_and_exchange_bool_acq (__atg16_memp,	      \
  21.121 + 						   __atg16_old & __atg16_mask,\
  21.122 +@@ -468,7 +468,7 @@
  21.123 +     __typeof (*(mem)) __atg17_mask = (mask);				      \
  21.124 + 									      \
  21.125 +     do									      \
  21.126 +-      __atg17_old = (*__atg17_memp);					      \
  21.127 ++      __atg17_old = (*(volatile __typeof (mem))__atg17_memp);		      \
  21.128 +     while (__builtin_expect						      \
  21.129 + 	   (atomic_compare_and_exchange_bool_acq (__atg17_memp,		      \
  21.130 + 						  __atg17_old | __atg17_mask, \
  21.131 +@@ -484,7 +484,7 @@
  21.132 +     __typeof (*(mem)) __atg18_mask = (mask);				      \
  21.133 + 									      \
  21.134 +     do									      \
  21.135 +-      __atg18_old = (*__atg18_memp);					      \
  21.136 ++      __atg18_old = (*(volatile __typeof (mem))__atg18_memp);		      \
  21.137 +     while (__builtin_expect						      \
  21.138 + 	   (catomic_compare_and_exchange_bool_acq (__atg18_memp,	      \
  21.139 + 						   __atg18_old | __atg18_mask,\
  21.140 +@@ -500,7 +500,7 @@
  21.141 +      __typeof (*(mem)) __atg19_mask = (mask);				      \
  21.142 + 									      \
  21.143 +      do									      \
  21.144 +-       __atg19_old = (*__atg19_memp);					      \
  21.145 ++       __atg19_old = (*(volatile __typeof (mem))__atg19_memp);		      \
  21.146 +      while (__builtin_expect						      \
  21.147 + 	    (atomic_compare_and_exchange_bool_acq (__atg19_memp,	      \
  21.148 + 						   __atg19_old | __atg19_mask,\
  21.149 +diff -durN glibc-2.13.orig/nptl/Makefile glibc-2.13/nptl/Makefile
  21.150 +--- glibc-2.13.orig/nptl/Makefile	2008-11-12 14:38:23.000000000 +0100
  21.151 ++++ glibc-2.13/nptl/Makefile	2009-11-13 00:50:26.000000000 +0100
  21.152 +@@ -265,9 +265,9 @@
  21.153 + # Files which must not be linked with libpthread.
  21.154 + tests-nolibpthread = tst-unload
  21.155 + 
  21.156 +-# This sets the stack resource limit to 1023kb, which is not a multiple
  21.157 +-# of the page size since every architecture's page size is > 1k.
  21.158 +-tst-oddstacklimit-ENV = ; ulimit -s 1023;
  21.159 ++# This sets the stack resource limit to 8193kb, which is not a multiple
  21.160 ++# of the page size since every architecture's page size is 4096 bytes.
  21.161 ++tst-oddstacklimit-ENV = ; ulimit -s 8193;
  21.162 + 
  21.163 + distribute = eintr.c tst-cleanup4aux.c
  21.164 + 
  21.165 +@@ -426,6 +426,35 @@
  21.166 + CFLAGS-tst-cleanupx4.c += -fexceptions
  21.167 + CFLAGS-tst-oncex3.c += -fexceptions
  21.168 + CFLAGS-tst-oncex4.c += -fexceptions
  21.169 ++
  21.170 ++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
  21.171 ++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
  21.172 ++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
  21.173 ++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
  21.174 ++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
  21.175 ++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
  21.176 ++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
  21.177 ++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
  21.178 ++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
  21.179 ++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
  21.180 ++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
  21.181 ++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
  21.182 ++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
  21.183 ++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
  21.184 ++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
  21.185 ++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
  21.186 ++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
  21.187 ++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
  21.188 ++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
  21.189 ++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
  21.190 ++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
  21.191 ++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
  21.192 ++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
  21.193 ++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
  21.194 ++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
  21.195 ++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
  21.196 ++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
  21.197 ++
  21.198 + CFLAGS-tst-align.c += $(stack-align-test-flags)
  21.199 + CFLAGS-tst-align3.c += $(stack-align-test-flags)
  21.200 + CFLAGS-tst-initializers1.c = -W -Wall -Werror
  21.201 +diff -durN glibc-2.13.orig/nptl/pthread_barrier_wait.c glibc-2.13/nptl/pthread_barrier_wait.c
  21.202 +--- glibc-2.13.orig/nptl/pthread_barrier_wait.c	2007-08-01 06:18:50.000000000 +0200
  21.203 ++++ glibc-2.13/nptl/pthread_barrier_wait.c	2009-11-13 00:50:26.000000000 +0100
  21.204 +@@ -64,7 +64,7 @@
  21.205 +       do
  21.206 + 	lll_futex_wait (&ibarrier->curr_event, event,
  21.207 + 			ibarrier->private ^ FUTEX_PRIVATE_FLAG);
  21.208 +-      while (event == ibarrier->curr_event);
  21.209 ++      while (event == *(volatile unsigned int *)&ibarrier->curr_event);
  21.210 +     }
  21.211 + 
  21.212 +   /* Make sure the init_count is stored locally or in a register.  */
  21.213 +diff -durN glibc-2.13.orig/nptl/sysdeps/pthread/Makefile glibc-2.13/nptl/sysdeps/pthread/Makefile
  21.214 +--- glibc-2.13.orig/nptl/sysdeps/pthread/Makefile	2006-02-28 08:09:41.000000000 +0100
  21.215 ++++ glibc-2.13/nptl/sysdeps/pthread/Makefile	2009-11-13 00:50:26.000000000 +0100
  21.216 +@@ -33,7 +33,9 @@
  21.217 + 
  21.218 + ifeq ($(have-forced-unwind),yes)
  21.219 + tests += tst-mqueue8x
  21.220 ++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
  21.221 + CFLAGS-tst-mqueue8x.c += -fexceptions
  21.222 ++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s) 
  21.223 + endif
  21.224 + endif
  21.225 + 
  21.226 +diff -durN glibc-2.13.orig/stdio-common/Makefile glibc-2.13/stdio-common/Makefile
  21.227 +--- glibc-2.13.orig/stdio-common/Makefile	2009-04-11 07:29:56.000000000 +0200
  21.228 ++++ glibc-2.13/stdio-common/Makefile	2009-11-13 00:50:26.000000000 +0100
  21.229 +@@ -82,7 +82,7 @@
  21.230 + 	$(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
  21.231 + endif
  21.232 + 
  21.233 +-CFLAGS-vfprintf.c = -Wno-uninitialized
  21.234 ++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
  21.235 + CFLAGS-vfwprintf.c = -Wno-uninitialized
  21.236 + CFLAGS-tst-printf.c = -Wno-format
  21.237 + CFLAGS-tstdiomisc.c = -Wno-format
  21.238 +diff -durN glibc-2.13.orig/sunrpc/clnt_udp.c glibc-2.13/sunrpc/clnt_udp.c
  21.239 +--- glibc-2.13.orig/sunrpc/clnt_udp.c	2008-07-26 10:42:44.000000000 +0200
  21.240 ++++ glibc-2.13/sunrpc/clnt_udp.c	2009-11-13 00:50:26.000000000 +0100
  21.241 +@@ -456,7 +456,7 @@
  21.242 +       while (inlen < 0 && errno == EINTR);
  21.243 +       if (inlen < 0)
  21.244 + 	{
  21.245 +-	  if (errno == EWOULDBLOCK)
  21.246 ++	  if (errno == EWOULDBLOCK || errno == EAGAIN)
  21.247 + 	    continue;
  21.248 + 	  cu->cu_error.re_errno = errno;
  21.249 + 	  return (cu->cu_error.re_status = RPC_CANTRECV);
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/patches/glibc/ports-2.13/330-m68k-sys-user.patch	Tue May 03 00:19:56 2011 +0200
    22.3 @@ -0,0 +1,97 @@
    22.4 +copied from kernel as it is sanitized now
    22.5 +
    22.6 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/m68k/sys/user.h
    22.7 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/m68k/sys/user.h	2009-05-16 10:36:20.000000000 +0200
    22.8 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/m68k/sys/user.h	2009-11-13 00:50:31.000000000 +0100
    22.9 +@@ -1,3 +1,90 @@
   22.10 ++#ifndef _SYS_USER_H
   22.11 ++#define _SYS_USER_H
   22.12 ++
   22.13 ++/* Core file format: The core file is written in such a way that gdb
   22.14 ++   can understand it and provide useful information to the user (under
   22.15 ++   linux we use the 'trad-core' bfd).  There are quite a number of
   22.16 ++   obstacles to being able to view the contents of the floating point
   22.17 ++   registers, and until these are solved you will not be able to view the
   22.18 ++   contents of them.  Actually, you can read in the core file and look at
   22.19 ++   the contents of the user struct to find out what the floating point
   22.20 ++   registers contain.
   22.21 ++   The actual file contents are as follows:
   22.22 ++   UPAGE: 1 page consisting of a user struct that tells gdb what is present
   22.23 ++   in the file.  Directly after this is a copy of the task_struct, which
   22.24 ++   is currently not used by gdb, but it may come in useful at some point.
   22.25 ++   All of the registers are stored as part of the upage.  The upage should
   22.26 ++   always be only one page.
   22.27 ++   DATA: The data area is stored.  We use current->end_text to
   22.28 ++   current->brk to pick up all of the user variables, plus any memory
   22.29 ++   that may have been malloced.  No attempt is made to determine if a page
   22.30 ++   is demand-zero or if a page is totally unused, we just cover the entire
   22.31 ++   range.  All of the addresses are rounded in such a way that an integral
   22.32 ++   number of pages is written.
   22.33 ++   STACK: We need the stack information in order to get a meaningful
   22.34 ++   backtrace.  We need to write the data from (esp) to
   22.35 ++   current->start_stack, so we round each of these off in order to be able
   22.36 ++   to write an integer number of pages.
   22.37 ++   The minimum core file size is 3 pages, or 12288 bytes.
   22.38 ++*/
   22.39 ++
   22.40 ++struct user_m68kfp_struct {
   22.41 ++	unsigned long  fpregs[8*3];	/* fp0-fp7 registers */
   22.42 ++	unsigned long  fpcntl[3];	/* fp control regs */
   22.43 ++};
   22.44 ++
   22.45 ++/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
   22.46 ++   is still the layout used by user (the new pt_regs doesn't have
   22.47 ++   all registers). */
   22.48 ++struct user_regs_struct {
   22.49 ++	long d1,d2,d3,d4,d5,d6,d7;
   22.50 ++	long a0,a1,a2,a3,a4,a5,a6;
   22.51 ++	long d0;
   22.52 ++	long usp;
   22.53 ++	long orig_d0;
   22.54 ++	short stkadj;
   22.55 ++	short sr;
   22.56 ++	long pc;
   22.57 ++	short fmtvec;
   22.58 ++	short __fill;
   22.59 ++};
   22.60 ++
   22.61 ++
   22.62 ++/* When the kernel dumps core, it starts by dumping the user struct -
   22.63 ++   this will be used by gdb to figure out where the data and stack segments
   22.64 ++   are within the file, and what virtual addresses to use. */
   22.65 ++struct user{
   22.66 ++/* We start with the registers, to mimic the way that "memory" is returned
   22.67 ++   from the ptrace(3,...) function.  */
   22.68 ++  struct user_regs_struct regs;	/* Where the registers are actually stored */
   22.69 ++/* ptrace does not yet supply these.  Someday.... */
   22.70 ++  int u_fpvalid;		/* True if math co-processor being used. */
   22.71 ++                                /* for this mess. Not yet used. */
   22.72 ++  struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
   22.73 ++/* The rest of this junk is to help gdb figure out what goes where */
   22.74 ++  unsigned long int u_tsize;	/* Text segment size (pages). */
   22.75 ++  unsigned long int u_dsize;	/* Data segment size (pages). */
   22.76 ++  unsigned long int u_ssize;	/* Stack segment size (pages). */
   22.77 ++  unsigned long start_code;     /* Starting virtual address of text. */
   22.78 ++  unsigned long start_stack;	/* Starting virtual address of stack area.
   22.79 ++				   This is actually the bottom of the stack,
   22.80 ++				   the top of the stack is always found in the
   22.81 ++				   esp register.  */
   22.82 ++  long int signal;		/* Signal that caused the core dump. */
   22.83 ++  int reserved;			/* No longer used */
   22.84 ++  struct user_regs_struct *u_ar0;
   22.85 ++				/* Used by gdb to help find the values for */
   22.86 ++				/* the registers. */
   22.87 ++  struct user_m68kfp_struct* u_fpstate;	/* Math Co-processor pointer. */
   22.88 ++  unsigned long magic;		/* To uniquely identify a core file */
   22.89 ++  char u_comm[32];		/* User command that was responsible */
   22.90 ++};
   22.91 ++#define NBPG 4096
   22.92 ++#define UPAGES 1
   22.93 ++#define HOST_TEXT_START_ADDR (u.start_code)
   22.94 ++#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
   22.95 ++
   22.96 ++#endif
   22.97 + /* Copyright (C) 2008, 2010 Free Software Foundation, Inc.
   22.98 +    This file is part of the GNU C Library.
   22.99 + 
  22.100 +diff -durN glibc-2.13.orig/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.13/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/patches/glibc/ports-2.13/340-dl_execstack-PaX-support.patch	Tue May 03 00:19:56 2011 +0200
    23.3 @@ -0,0 +1,66 @@
    23.4 +	With latest versions of glibc, a lot of apps failed on a PaX enabled
    23.5 +	system with:
    23.6 +		 cannot enable executable stack as shared object requires: Permission denied
    23.7 +	
    23.8 +	This is due to PaX 'exec-protecting' the stack, and ld.so then trying
    23.9 +	to make the stack executable due to some libraries not containing the
   23.10 +	PT_GNU_STACK section.  Bug #32960.  <azarah@gentoo.org> (12 Nov 2003).
   23.11 +
   23.12 +	Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
   23.13 +
   23.14 +diff -durN glibc-2.13.orig/nptl/allocatestack.c glibc-2.13/nptl/allocatestack.c
   23.15 +--- glibc-2.13.orig/nptl/allocatestack.c	2009-01-29 21:34:16.000000000 +0100
   23.16 ++++ glibc-2.13/nptl/allocatestack.c	2009-11-13 00:50:33.000000000 +0100
   23.17 +@@ -329,7 +329,8 @@
   23.18 + # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
   23.19 + #endif
   23.20 +   if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
   23.21 +-    return errno;
   23.22 ++    if (errno != EACCES) /* PAX is enabled */
   23.23 ++    	return errno;
   23.24 + 
   23.25 +   return 0;
   23.26 + }
   23.27 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c
   23.28 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c	2006-01-08 09:21:15.000000000 +0100
   23.29 ++++ glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c	2009-11-13 00:50:33.000000000 +0100
   23.30 +@@ -63,7 +63,10 @@
   23.31 +       else
   23.32 + # endif
   23.33 + 	{
   23.34 +-	  result = errno;
   23.35 ++	  if (errno == EACCES)  /* PAX is enabled */
   23.36 ++	    result = 0;
   23.37 ++	  else
   23.38 ++	    result = errno;
   23.39 + 	  goto out;
   23.40 + 	}
   23.41 +     }
   23.42 +@@ -89,7 +92,12 @@
   23.43 + 	page -= size;
   23.44 +       else
   23.45 + 	{
   23.46 +-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
   23.47 ++	  if (errno == EACCES)		/* PAX is enabled */
   23.48 ++	    {
   23.49 ++	      result = 0;
   23.50 ++	      goto out;
   23.51 ++	    }
   23.52 ++	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
   23.53 + 	    {
   23.54 + 	      result = errno;
   23.55 + 	      goto out;
   23.56 +@@ -115,7 +123,12 @@
   23.57 + 	page += size;
   23.58 +       else
   23.59 + 	{
   23.60 +-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
   23.61 ++	  if (errno == EACCES)		/* PAX is enabled */
   23.62 ++	    {
   23.63 ++	      result = 0;
   23.64 ++	      goto out;
   23.65 ++	    }
   23.66 ++	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
   23.67 + 	    {
   23.68 + 	      result = errno;
   23.69 + 	      goto out;
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/patches/glibc/ports-2.13/350-pre20040117-pt_pax.patch	Tue May 03 00:19:56 2011 +0200
    24.3 @@ -0,0 +1,32 @@
    24.4 +
    24.5 +
    24.6 +diff -durN glibc-2.13.orig/elf/elf.h glibc-2.13/elf/elf.h
    24.7 +--- glibc-2.13.orig/elf/elf.h	2009-04-15 02:15:54.000000000 +0200
    24.8 ++++ glibc-2.13/elf/elf.h	2009-11-13 00:50:35.000000000 +0100
    24.9 +@@ -580,6 +580,7 @@
   24.10 + #define PT_GNU_EH_FRAME	0x6474e550	/* GCC .eh_frame_hdr segment */
   24.11 + #define PT_GNU_STACK	0x6474e551	/* Indicates stack executability */
   24.12 + #define PT_GNU_RELRO	0x6474e552	/* Read-only after relocation */
   24.13 ++#define PT_PAX_FLAGS	0x65041580	/* Indicates PaX flag markings */
   24.14 + #define PT_LOSUNW	0x6ffffffa
   24.15 + #define PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
   24.16 + #define PT_SUNWSTACK	0x6ffffffb	/* Stack segment */
   24.17 +@@ -593,6 +594,18 @@
   24.18 + #define PF_X		(1 << 0)	/* Segment is executable */
   24.19 + #define PF_W		(1 << 1)	/* Segment is writable */
   24.20 + #define PF_R		(1 << 2)	/* Segment is readable */
   24.21 ++#define PF_PAGEEXEC	(1 << 4)	/* Enable  PAGEEXEC */
   24.22 ++#define PF_NOPAGEEXEC	(1 << 5)	/* Disable PAGEEXEC */
   24.23 ++#define PF_SEGMEXEC	(1 << 6)	/* Enable  SEGMEXEC */
   24.24 ++#define PF_NOSEGMEXEC	(1 << 7)	/* Disable SEGMEXEC */
   24.25 ++#define PF_MPROTECT	(1 << 8)	/* Enable  MPROTECT */
   24.26 ++#define PF_NOMPROTECT	(1 << 9)	/* Disable MPROTECT */
   24.27 ++#define PF_RANDEXEC	(1 << 10)	/* Enable  RANDEXEC */
   24.28 ++#define PF_NORANDEXEC	(1 << 11)	/* Disable RANDEXEC */
   24.29 ++#define PF_EMUTRAMP	(1 << 12)	/* Enable  EMUTRAMP */
   24.30 ++#define PF_NOEMUTRAMP	(1 << 13)	/* Disable EMUTRAMP */
   24.31 ++#define PF_RANDMMAP	(1 << 14)	/* Enable  RANDMMAP */
   24.32 ++#define PF_NORANDMMAP	(1 << 15)	/* Disable RANDMMAP */
   24.33 + #define PF_MASKOS	0x0ff00000	/* OS-specific */
   24.34 + #define PF_MASKPROC	0xf0000000	/* Processor-specific */
   24.35 + 
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/patches/glibc/ports-2.13/360-tests-sandbox-libdl-paths.patch	Tue May 03 00:19:56 2011 +0200
    25.3 @@ -0,0 +1,193 @@
    25.4 +when glibc runs its tests, it does so by invoking the local library loader.
    25.5 +in Gentoo, we build/run inside of our "sandbox" which itself is linked against
    25.6 +libdl (so that it can load libraries and pull out symbols).  the trouble
    25.7 +is that when you upgrade from an older glibc to the new one, often times
    25.8 +internal symbols change name or abi.  this is normally OK as you cannot use
    25.9 +libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
   25.10 +we always say "keep all of the glibc libraries from the same build".  but
   25.11 +when glibc runs its tests, it uses dynamic paths to point to its new local
   25.12 +copies of libraries.  if the test doesnt use libdl, then glibc doesnt add
   25.13 +its path, and when sandbox triggers the loading of libdl, glibc does so
   25.14 +from the host system system.  this gets us into the case of all libraries
   25.15 +are from the locally compiled version of glibc except for libdl.so.
   25.16 +
   25.17 +Fix by Wormo
   25.18 +
   25.19 +http://bugs.gentoo.org/56898
   25.20 +
   25.21 +diff -durN glibc-2.13.orig/grp/tst_fgetgrent.sh glibc-2.13/grp/tst_fgetgrent.sh
   25.22 +--- glibc-2.13.orig/grp/tst_fgetgrent.sh	2001-07-06 06:54:46.000000000 +0200
   25.23 ++++ glibc-2.13/grp/tst_fgetgrent.sh	2009-11-13 00:50:37.000000000 +0100
   25.24 +@@ -24,7 +24,8 @@
   25.25 + rtld_installed_name=$1; shift
   25.26 + 
   25.27 + testout=${common_objpfx}/grp/tst_fgetgrent.out
   25.28 +-library_path=${common_objpfx}
   25.29 ++# make sure libdl is also in path in case sandbox is in use
   25.30 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   25.31 + 
   25.32 + result=0
   25.33 + 
   25.34 +diff -durN glibc-2.13.orig/iconvdata/run-iconv-test.sh glibc-2.13/iconvdata/run-iconv-test.sh
   25.35 +--- glibc-2.13.orig/iconvdata/run-iconv-test.sh	2008-05-15 03:59:44.000000000 +0200
   25.36 ++++ glibc-2.13/iconvdata/run-iconv-test.sh	2009-11-13 00:50:37.000000000 +0100
   25.37 +@@ -34,7 +34,7 @@
   25.38 + export GCONV_PATH
   25.39 + 
   25.40 + # We have to have some directories in the library path.
   25.41 +-LIBPATH=$codir:$codir/iconvdata
   25.42 ++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
   25.43 + 
   25.44 + # How the start the iconv(1) program.
   25.45 + ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
   25.46 +diff -durN glibc-2.13.orig/iconvdata/tst-table.sh glibc-2.13/iconvdata/tst-table.sh
   25.47 +--- glibc-2.13.orig/iconvdata/tst-table.sh	2002-04-24 23:39:35.000000000 +0200
   25.48 ++++ glibc-2.13/iconvdata/tst-table.sh	2009-11-13 00:50:37.000000000 +0100
   25.49 +@@ -59,8 +59,11 @@
   25.50 +   irreversible=${charset}.irreversible
   25.51 + fi
   25.52 + 
   25.53 ++# make sure libdl is also in path in case sandbox is in use
   25.54 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   25.55 ++
   25.56 + # iconv in one direction.
   25.57 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
   25.58 ++${common_objpfx}elf/ld.so --library-path $library_path \
   25.59 + ${objpfx}tst-table-from ${charset} \
   25.60 +   > ${objpfx}tst-${charset}.table
   25.61 + 
   25.62 +diff -durN glibc-2.13.orig/intl/tst-codeset.sh glibc-2.13/intl/tst-codeset.sh
   25.63 +--- glibc-2.13.orig/intl/tst-codeset.sh	2005-04-06 04:18:35.000000000 +0200
   25.64 ++++ glibc-2.13/intl/tst-codeset.sh	2009-11-13 00:50:37.000000000 +0100
   25.65 +@@ -37,6 +37,9 @@
   25.66 + LOCPATH=${common_objpfx}localedata
   25.67 + export LOCPATH
   25.68 + 
   25.69 ++# make sure libdl is also in path in case sandbox is in use
   25.70 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   25.71 ++
   25.72 + ${common_objpfx}elf/ld.so --library-path $common_objpfx \
   25.73 + ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
   25.74 + 
   25.75 +diff -durN glibc-2.13.orig/intl/tst-gettext.sh glibc-2.13/intl/tst-gettext.sh
   25.76 +--- glibc-2.13.orig/intl/tst-gettext.sh	2004-08-15 21:28:18.000000000 +0200
   25.77 ++++ glibc-2.13/intl/tst-gettext.sh	2009-11-13 00:50:37.000000000 +0100
   25.78 +@@ -51,9 +51,12 @@
   25.79 + LOCPATH=${common_objpfx}localedata
   25.80 + export LOCPATH
   25.81 + 
   25.82 ++# make sure libdl is also in path in case sandbox is in use
   25.83 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   25.84 ++
   25.85 + # Now run the test.
   25.86 + MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
   25.87 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
   25.88 ++${common_objpfx}elf/ld.so --library-path $library_path \
   25.89 + ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
   25.90 + 
   25.91 + exit $?
   25.92 +diff -durN glibc-2.13.orig/intl/tst-gettext2.sh glibc-2.13/intl/tst-gettext2.sh
   25.93 +--- glibc-2.13.orig/intl/tst-gettext2.sh	2005-05-04 19:54:48.000000000 +0200
   25.94 ++++ glibc-2.13/intl/tst-gettext2.sh	2009-11-13 00:50:37.000000000 +0100
   25.95 +@@ -65,8 +65,11 @@
   25.96 + LOCPATH=${objpfx}domaindir
   25.97 + export LOCPATH
   25.98 + 
   25.99 ++# make sure libdl is also in path in case sandbox is in use
  25.100 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  25.101 ++
  25.102 + # Now run the test.
  25.103 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
  25.104 ++${common_objpfx}elf/ld.so --library-path $library_path \
  25.105 + ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
  25.106 + cmp ${objpfx}tst-gettext2.out - <<EOF
  25.107 + String1 - Lang1: 1st string
  25.108 +diff -durN glibc-2.13.orig/intl/tst-translit.sh glibc-2.13/intl/tst-translit.sh
  25.109 +--- glibc-2.13.orig/intl/tst-translit.sh	2005-05-04 19:56:10.000000000 +0200
  25.110 ++++ glibc-2.13/intl/tst-translit.sh	2009-11-13 00:50:37.000000000 +0100
  25.111 +@@ -36,7 +36,10 @@
  25.112 + LOCPATH=${common_objpfx}localedata
  25.113 + export LOCPATH
  25.114 + 
  25.115 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
  25.116 ++# make sure libdl is also in path in case sandbox is in use
  25.117 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  25.118 ++
  25.119 ++${common_objpfx}elf/ld.so --library-path $library_path \
  25.120 + ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
  25.121 + 
  25.122 + exit $?
  25.123 +diff -durN glibc-2.13.orig/malloc/tst-mtrace.sh glibc-2.13/malloc/tst-mtrace.sh
  25.124 +--- glibc-2.13.orig/malloc/tst-mtrace.sh	2005-10-15 01:40:35.000000000 +0200
  25.125 ++++ glibc-2.13/malloc/tst-mtrace.sh	2009-11-13 00:50:37.000000000 +0100
  25.126 +@@ -24,9 +24,12 @@
  25.127 + status=0
  25.128 + trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
  25.129 + 
  25.130 ++# make sure libdl is also in path in case sandbox is in use
  25.131 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  25.132 ++
  25.133 + MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
  25.134 + LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
  25.135 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
  25.136 ++${common_objpfx}elf/ld.so --library-path $library_path \
  25.137 +   ${common_objpfx}malloc/tst-mtrace || status=1
  25.138 + 
  25.139 + if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
  25.140 +diff -durN glibc-2.13.orig/nptl/tst-tls6.sh glibc-2.13/nptl/tst-tls6.sh
  25.141 +--- glibc-2.13.orig/nptl/tst-tls6.sh	2003-09-03 00:02:59.000000000 +0200
  25.142 ++++ glibc-2.13/nptl/tst-tls6.sh	2009-11-13 00:50:37.000000000 +0100
  25.143 +@@ -5,8 +5,8 @@
  25.144 + rtld_installed_name=$1; shift
  25.145 + logfile=$common_objpfx/nptl/tst-tls6.out
  25.146 + 
  25.147 +-# We have to find libc and nptl
  25.148 +-library_path=${common_objpfx}:${common_objpfx}nptl
  25.149 ++# We have to find libc and nptl (also libdl in case sandbox is in use)
  25.150 ++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
  25.151 + tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
  25.152 + 	  ${common_objpfx}/nptl/tst-tls5"
  25.153 + 
  25.154 +diff -durN glibc-2.13.orig/posix/globtest.sh glibc-2.13/posix/globtest.sh
  25.155 +--- glibc-2.13.orig/posix/globtest.sh	2008-12-06 07:05:39.000000000 +0100
  25.156 ++++ glibc-2.13/posix/globtest.sh	2009-11-13 00:50:37.000000000 +0100
  25.157 +@@ -18,7 +18,7 @@
  25.158 + esac
  25.159 + 
  25.160 + # We have to find the libc and the NSS modules.
  25.161 +-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
  25.162 ++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
  25.163 + 
  25.164 + # Since we use `sort' we must make sure to use the same locale everywhere.
  25.165 + LC_ALL=C
  25.166 +diff -durN glibc-2.13.orig/posix/tst-getconf.sh glibc-2.13/posix/tst-getconf.sh
  25.167 +--- glibc-2.13.orig/posix/tst-getconf.sh	2002-09-01 13:11:25.000000000 +0200
  25.168 ++++ glibc-2.13/posix/tst-getconf.sh	2009-11-13 00:50:37.000000000 +0100
  25.169 +@@ -10,7 +10,10 @@
  25.170 + else
  25.171 +   rtld_installed_name=$1; shift
  25.172 +   runit() {
  25.173 +-    ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
  25.174 ++    
  25.175 ++  # make sure libdl is also in path in case sandbox is in use
  25.176 ++  library_path=${common_objpfx}:${common_objpfx}/dlfcn
  25.177 ++    ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
  25.178 +   }
  25.179 + fi
  25.180 + 
  25.181 +diff -durN glibc-2.13.orig/posix/wordexp-tst.sh glibc-2.13/posix/wordexp-tst.sh
  25.182 +--- glibc-2.13.orig/posix/wordexp-tst.sh	2000-10-20 18:23:30.000000000 +0200
  25.183 ++++ glibc-2.13/posix/wordexp-tst.sh	2009-11-13 00:50:37.000000000 +0100
  25.184 +@@ -19,8 +19,11 @@
  25.185 + "
  25.186 + export IFS
  25.187 + 
  25.188 ++# make sure libdl is also in path in case sandbox is in use
  25.189 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  25.190 ++
  25.191 + failed=0
  25.192 +-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
  25.193 ++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
  25.194 + ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
  25.195 + cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
  25.196 + wordexp returned 0
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/patches/glibc/ports-2.13/380-dont-build-timezone.patch	Tue May 03 00:19:56 2011 +0200
    26.3 @@ -0,0 +1,14 @@
    26.4 +timezone data has been split into the package sys-libs/timezone-data
    26.5 +
    26.6 +diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
    26.7 +--- glibc-2.13.orig/Makeconfig	2009-11-13 00:50:13.000000000 +0100
    26.8 ++++ glibc-2.13/Makeconfig	2009-11-13 00:50:41.000000000 +0100
    26.9 +@@ -944,7 +944,7 @@
   26.10 + 	      stdlib stdio-common libio malloc string wcsmbs time dirent    \
   26.11 + 	      grp pwd posix io termios resource misc socket sysvipc gmon    \
   26.12 + 	      gnulib iconv iconvdata wctype manual shadow gshadow po argp   \
   26.13 +-	      crypt nss localedata timezone rt conform debug		    \
   26.14 ++	      crypt nss localedata rt conform debug		    \
   26.15 + 	      $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
   26.16 + 
   26.17 + ifndef avoid-generated
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/patches/glibc/ports-2.13/400-alpha-xstat.patch	Tue May 03 00:19:56 2011 +0200
    27.3 @@ -0,0 +1,15 @@
    27.4 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
    27.5 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h	2009-05-09 08:54:20.000000000 +0200
    27.6 ++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h	2009-11-13 00:50:45.000000000 +0100
    27.7 +@@ -386,6 +386,11 @@
    27.8 + # define __ASSUME_GETDENTS32_D_TYPE	1
    27.9 + #endif
   27.10 + 
   27.11 ++/* Starting with version 2.6.4, alpha stat64 syscalls are available.  */
   27.12 ++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
   27.13 ++# define __ASSUME_STAT64_SYSCALL	1
   27.14 ++#endif
   27.15 ++
   27.16 + /* Starting with version 2.5.3, the initial location returned by `brk'
   27.17 +    after exec is always rounded up to the next page.  */
   27.18 + #if __LINUX_KERNEL_VERSION >= 132355
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/patches/glibc/ports-2.13/410-alpha-SETPIPE-GETPIPE.patch	Tue May 03 00:19:56 2011 +0200
    28.3 @@ -0,0 +1,19 @@
    28.4 +2011-02-28  Aurelien Jarno  <aurelien@aurel32.net>
    28.5 +
    28.6 +	* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (F_SETPIPE_SZ,
    28.7 +	F_GETPIPE_SZ): Define.
    28.8 +
    28.9 +diff --git glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
   28.10 +index 860e9ac..e5e726b 100644
   28.11 +--- glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
   28.12 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
   28.13 +@@ -97,6 +97,8 @@
   28.14 + # define F_SETLEASE	1024	/* Set a lease.	 */
   28.15 + # define F_GETLEASE	1025	/* Enquire what lease is active.  */
   28.16 + # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
   28.17 ++# define F_SETPIPE_SZ	1031    /* Set pipe page size array.  */
   28.18 ++# define F_GETPIPE_SZ	1032    /* Set pipe page size array.  */
   28.19 + #endif
   28.20 + #ifdef __USE_XOPEN2K8
   28.21 + # define F_DUPFD_CLOEXEC 1030	/* Duplicate file descriptor with
   28.22 +
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/patches/glibc/ports-2.13/420-alpha-statfs.patch	Tue May 03 00:19:56 2011 +0200
    29.3 @@ -0,0 +1,29 @@
    29.4 +2011-02-28  Aurelien Jarno  <aurelien@aurel32.net>
    29.5 +
    29.6 +	* sysdeps/unix/sysv/linux/mips/bits/statfs.h (struct statfs,
    29.7 +	struct statfs64): Add f_flags field.
    29.8 +
    29.9 +diff --git glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/statfs.h glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/statfs.h
   29.10 +index d838e6b..157591d 100644
   29.11 +--- glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/statfs.h
   29.12 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/statfs.h
   29.13 +@@ -42,7 +42,8 @@ struct statfs
   29.14 +     __fsid_t f_fsid;
   29.15 +     int f_namelen;
   29.16 +     int f_frsize;
   29.17 +-    int f_spare[5];
   29.18 ++    int f_flags;
   29.19 ++    int f_spare[4];
   29.20 +   };
   29.21 + 
   29.22 + #ifdef __USE_LARGEFILE64
   29.23 +@@ -58,7 +59,8 @@ struct statfs64
   29.24 +     __fsid_t f_fsid;
   29.25 +     int f_namelen;
   29.26 +     int f_frsize;
   29.27 +-    int f_spare[5];
   29.28 ++    int f_flags;
   29.29 ++    int f_spare[4];
   29.30 +   };
   29.31 + #endif
   29.32 +
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/patches/glibc/ports-2.13/430-alpha-creat.patch	Tue May 03 00:19:56 2011 +0200
    30.3 @@ -0,0 +1,14 @@
    30.4 +alpha does not have a __NR_creat
    30.5 +
    30.6 +http://bugs.gentoo.org/227275
    30.7 +http://sourceware.org/bugzilla/show_bug.cgi?id=6650
    30.8 +
    30.9 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
   30.10 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2007-11-10 20:34:26.000000000 +0100
   30.11 ++++ glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2009-11-13 00:50:51.000000000 +0100
   30.12 +@@ -1 +1,5 @@
   30.13 + /* Defined as alias for the syscall.  */
   30.14 ++#include <sysdep.h>
   30.15 ++#ifndef __NR_creat
   30.16 ++#include "../../../../../io/creat64.c"
   30.17 ++#endif
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/patches/glibc/ports-2.13/440-alpha-cache-shape.patch	Tue May 03 00:19:56 2011 +0200
    31.3 @@ -0,0 +1,13 @@
    31.4 +older verisons of glibc would build dl-sysdep as shared-only and dl-support as
    31.5 +static-only.  alpha hooks in a cache variable via dl-auxv.h.  newer versions of
    31.6 +glibc build dl-sysdep as both shared and static which means we now have symbol
    31.7 +duplication for static builds with dl-sysdep and dl-support.  since dl-sysdep
    31.8 +is both shared/static, there is no point in hooking dl-support anymore, so we
    31.9 +can punt it.
   31.10 +
   31.11 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/dl-support.c
   31.12 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/dl-support.c	2009-05-16 10:36:20.000000000 +0200
   31.13 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/dl-support.c	2009-11-13 00:50:53.000000000 +0100
   31.14 +@@ -1,2 +1,1 @@
   31.15 +-#include "dl-auxv.h"
   31.16 + #include <elf/dl-support.c>
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/patches/glibc/ports-2.13/450-alpha-DEFAULT_STACK_PERMS.patch	Tue May 03 00:19:56 2011 +0200
    32.3 @@ -0,0 +1,23 @@
    32.4 +2011-02-28  Aurelien Jarno  <aurelien@aurel32.net>
    32.5 +
    32.6 +	* sysdeps/alpha/stackinfo.h: Define DEFAULT_STACK_PERMS with PF_X.
    32.7 +
    32.8 +diff --git glibc-2.13/glibc-ports-2.13/sysdeps/alpha/stackinfo.h glibc-2.13/glibc-ports-2.13/sysdeps/alpha/stackinfo.h
    32.9 +index 0a281bd..d9dbc35 100644
   32.10 +--- glibc-2.13/glibc-ports-2.13/sysdeps/alpha/stackinfo.h
   32.11 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/alpha/stackinfo.h
   32.12 +@@ -22,7 +22,13 @@
   32.13 + #ifndef _STACKINFO_H
   32.14 + #define _STACKINFO_H	1
   32.15 + 
   32.16 ++#include <elf.h>
   32.17 ++
   32.18 + /* On Alpha the stack grows down.  */
   32.19 + #define _STACK_GROWS_DOWN	1
   32.20 + 
   32.21 ++/* Default to an executable stack.  PF_X can be overridden if PT_GNU_STACK is
   32.22 ++ * present, but it is presumed absent.  */
   32.23 ++#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
   32.24 ++
   32.25 + #endif	/* stackinfo.h */
   32.26 +
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/patches/glibc/ports-2.13/460-alpha-fix-gcc-4.1-warnings.patch	Tue May 03 00:19:56 2011 +0200
    33.3 @@ -0,0 +1,56 @@
    33.4 +2006-05-30  Falk Hueffner <falk@debian.org>
    33.5 +
    33.6 +	* sysdeps/unix/sysv/linux/alpha/ioperm.c: force the architecture
    33.7 +	  to ev6 in assembly code.
    33.8 +
    33.9 +{standard input}: Assembler messages:
   33.10 +{standard input}:341: Error: macro requires $at register while noat in effect
   33.11 +{standard input}:374: Error: macro requires $at register while noat in effect
   33.12 +{standard input}:438: Error: macro requires $at register while noat in effect
   33.13 +{standard input}:471: Error: macro requires $at register while noat in effect
   33.14 +make[3]: *** [/tmp/buildd/glibc-2.3.6/build-tree/alpha-libc/misc/ioperm.o] Error 1
   33.15 +
   33.16 +Hrm. gcc puts .arch ev4 into the .s, and this overrides -mev6 for as.
   33.17 +I cannot really think of anything better than
   33.18 +
   33.19 + ports/sysdeps/unix/sysv/linux/alpha/ioperm.c |    8 ++++----
   33.20 + 1 file changed, 4 insertions(+), 4 deletions(-)
   33.21 +
   33.22 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/ioperm.c
   33.23 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/ioperm.c	2009-05-16 10:36:20.000000000 +0200
   33.24 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/ioperm.c	2009-11-13 00:50:57.000000000 +0100
   33.25 +@@ -178,13 +178,13 @@
   33.26 + static inline void
   33.27 + stb_mb(unsigned char val, unsigned long addr)
   33.28 + {
   33.29 +-  __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
   33.30 ++  __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
   33.31 + }
   33.32 + 
   33.33 + static inline void
   33.34 + stw_mb(unsigned short val, unsigned long addr)
   33.35 + {
   33.36 +-  __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
   33.37 ++  __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
   33.38 + }
   33.39 + 
   33.40 + static inline void
   33.41 +@@ -356,7 +356,7 @@
   33.42 +   unsigned long int addr = dense_port_to_cpu_addr (port);
   33.43 +   unsigned char r;
   33.44 + 
   33.45 +-  __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
   33.46 ++  __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
   33.47 +   return r;
   33.48 + }
   33.49 + 
   33.50 +@@ -366,7 +366,7 @@
   33.51 +   unsigned long int addr = dense_port_to_cpu_addr (port);
   33.52 +   unsigned short r;
   33.53 + 
   33.54 +-  __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
   33.55 ++  __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
   33.56 +   return r;
   33.57 + }
   33.58 + 
   33.59 +diff -durN glibc-2.13.orig/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.13/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/patches/glibc/ports-2.13/470-alpha-feupdateenv.patch	Tue May 03 00:19:56 2011 +0200
    34.3 @@ -0,0 +1,26 @@
    34.4 +2011-03-01  Aurelien Jarno  <aurelien@aurel32.net>
    34.5 +
    34.6 +	* sysdeps/alpha/fpu/feupdateenv.c (feupdateenv): Add
    34.7 +	libm_hidden_def.
    34.8 +	* sysdeps/alpha/fpu/ftestexcept.c (fetestexcept): Likewise.
    34.9 +
   34.10 +diff --git glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/feupdateenv.c glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/feupdateenv.c
   34.11 +index c798070..9abbf11 100644
   34.12 +--- glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/feupdateenv.c
   34.13 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/feupdateenv.c
   34.14 +@@ -46,4 +46,5 @@ strong_alias (__feupdateenv, __old_feupdateenv)
   34.15 + compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
   34.16 + #endif
   34.17 + 
   34.18 ++libm_hidden_ver (__feupdateenv, feupdateenv)
   34.19 + versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
   34.20 +diff --git glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/ftestexcept.c glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/ftestexcept.c
   34.21 +index a4b3081..34d8113 100644
   34.22 +--- glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/ftestexcept.c
   34.23 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/ftestexcept.c
   34.24 +@@ -30,3 +30,4 @@ fetestexcept (int excepts)
   34.25 + 
   34.26 +   return tmp & excepts & SWCR_STATUS_MASK;
   34.27 + }
   34.28 ++libm_hidden_def (fetestexcept)
   34.29 +
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/patches/glibc/ports-2.13/490-alpha_alpha-add-fdatasync-support.patch	Tue May 03 00:19:56 2011 +0200
    35.3 @@ -0,0 +1,126 @@
    35.4 +2009-07-25  Aurelien Jarno  <aurelien@aurel32.net>
    35.5 +
    35.6 +	* sysdeps/unix/sysv/linux/kernel-features.h: define 
    35.7 +	__ASSUME_FDATASYNC. 
    35.8 +	* sysdeps/unix/sysv/linux/fdatasync.c: New file.
    35.9 +	* sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
   35.10 +	-fexceptions.
   35.11 +	* sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
   35.12 +
   35.13 + sysdeps/unix/sysv/linux/Makefile          |    1 
   35.14 + sysdeps/unix/sysv/linux/fdatasync.c       |   69 ++++++++++++++++++++++++++++++
   35.15 + sysdeps/unix/sysv/linux/kernel-features.h |    6 ++
   35.16 + sysdeps/unix/sysv/linux/syscalls.list     |    1 
   35.17 + 4 files changed, 76 insertions(+), 1 deletion(-)
   35.18 +
   35.19 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.13/sysdeps/unix/sysv/linux/Makefile
   35.20 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile	2009-03-02 17:15:13.000000000 +0100
   35.21 ++++ glibc-2.13/sysdeps/unix/sysv/linux/Makefile	2009-11-13 00:51:04.000000000 +0100
   35.22 +@@ -20,6 +20,7 @@
   35.23 + 		   setfsuid setfsgid makedev epoll_pwait signalfd \
   35.24 + 		   eventfd eventfd_read eventfd_write prlimit
   35.25 + 
   35.26 ++CFLAGS-fdatasync.c = -fexceptions
   35.27 + CFLAGS-gethostid.c = -fexceptions
   35.28 + 
   35.29 + sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   35.30 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c
   35.31 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c	1970-01-01 01:00:00.000000000 +0100
   35.32 ++++ glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c	2009-11-13 00:51:04.000000000 +0100
   35.33 +@@ -0,0 +1,69 @@
   35.34 ++/* fdatasync -- synchronize at least the data part of a file with 
   35.35 ++   the underlying media. Linux version. 
   35.36 ++
   35.37 ++   Copyright (C) 2007 Free Software Foundation, Inc.
   35.38 ++   This file is part of the GNU C Library.
   35.39 ++
   35.40 ++   The GNU C Library is free software; you can redistribute it and/or
   35.41 ++   modify it under the terms of the GNU Lesser General Public
   35.42 ++   License as published by the Free Software Foundation; either
   35.43 ++   version 2.1 of the License, or (at your option) any later version.
   35.44 ++
   35.45 ++   The GNU C Library is distributed in the hope that it will be useful,
   35.46 ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
   35.47 ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   35.48 ++   Lesser General Public License for more details.
   35.49 ++
   35.50 ++   You should have received a copy of the GNU Lesser General Public
   35.51 ++   License along with the GNU C Library; if not, write to the Free
   35.52 ++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   35.53 ++   02111-1307 USA.  */
   35.54 ++
   35.55 ++#include <errno.h>
   35.56 ++#include <unistd.h>
   35.57 ++
   35.58 ++#include <sysdep-cancel.h>
   35.59 ++#include <sys/syscall.h>
   35.60 ++#include <bp-checks.h>
   35.61 ++
   35.62 ++#include <kernel-features.h>
   35.63 ++
   35.64 ++#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
   35.65 ++static int __have_no_fdatasync;
   35.66 ++#endif
   35.67 ++
   35.68 ++static int
   35.69 ++do_fdatasync (int fd)
   35.70 ++{
   35.71 ++#ifdef __ASSUME_FDATASYNC
   35.72 ++  return INLINE_SYSCALL (fdatasync, 1, fd);
   35.73 ++#elif defined __NR_fdatasync
   35.74 ++  if (!__builtin_expect (__have_no_fdatasync, 0))
   35.75 ++    {
   35.76 ++      int result = INLINE_SYSCALL (fdatasync, 1, fd);
   35.77 ++      if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
   35.78 ++	return result;
   35.79 ++
   35.80 ++      __have_no_fdatasync = 1;
   35.81 ++    }
   35.82 ++#endif
   35.83 ++  return INLINE_SYSCALL (fsync, 1, fd);
   35.84 ++}
   35.85 ++
   35.86 ++int
   35.87 ++__fdatasync (int fd)
   35.88 ++{
   35.89 ++  if (SINGLE_THREAD_P)
   35.90 ++    return do_fdatasync (fd);
   35.91 ++
   35.92 ++  int oldtype = LIBC_CANCEL_ASYNC ();
   35.93 ++
   35.94 ++  int result = do_fdatasync (fd);
   35.95 ++
   35.96 ++  LIBC_CANCEL_RESET (oldtype);
   35.97 ++
   35.98 ++  return result;
   35.99 ++}
  35.100 ++
  35.101 ++weak_alias (__fdatasync, fdatasync)
  35.102 ++
  35.103 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
  35.104 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h	2009-11-13 00:50:45.000000000 +0100
  35.105 ++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h	2009-11-13 00:51:04.000000000 +0100
  35.106 +@@ -459,6 +459,12 @@
  35.107 + # define __ASSUME_FUTEX_LOCK_PI	1
  35.108 + #endif
  35.109 + 
  35.110 ++/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
  35.111 ++   was already present in 2.0 kernels on other architectures.  */
  35.112 ++#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
  35.113 ++# define __ASSUME_FDATASYNC	1
  35.114 ++#endif
  35.115 ++
  35.116 + /* Support for utimensat syscall was added in 2.6.22, on SH
  35.117 +    only after 2.6.22-rc1.  */
  35.118 + #if __LINUX_KERNEL_VERSION >= 0x020616 \
  35.119 +diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list
  35.120 +--- glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list	2008-08-02 01:29:08.000000000 +0200
  35.121 ++++ glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list	2009-11-13 00:51:04.000000000 +0100
  35.122 +@@ -11,7 +11,6 @@
  35.123 + epoll_create1	EXTRA	epoll_create1	i:i	epoll_create1
  35.124 + epoll_ctl	EXTRA	epoll_ctl	i:iiip	epoll_ctl
  35.125 + epoll_wait	EXTRA	epoll_wait	Ci:ipii	epoll_wait
  35.126 +-fdatasync	-	fdatasync	Ci:i	fdatasync
  35.127 + flock		-	flock		i:ii	__flock		flock
  35.128 + fork		-	fork		i:	__libc_fork	__fork fork
  35.129 + get_kernel_syms	EXTRA	get_kernel_syms	i:p	get_kernel_syms
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/patches/glibc/ports-2.13/530-alpha-fix-rtld-fPIC.patch	Tue May 03 00:19:56 2011 +0200
    36.3 @@ -0,0 +1,21 @@
    36.4 +2009-05-26  Aurelien Jarno  <aurelien@aurel32.net>
    36.5 +
    36.6 +	* sysdeps/alpha/Makefile (CFLAGS-rtld.c): add $(PIC-ccflag).
    36.7 +
    36.8 + ports/sysdeps/alpha/Makefile |    3 ++-
    36.9 + 1 file changed, 2 insertions(+), 1 deletion(-)
   36.10 +
   36.11 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/alpha/Makefile glibc-2.13/glibc-ports-2.13/sysdeps/alpha/Makefile
   36.12 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/alpha/Makefile	2009-05-16 10:36:20.000000000 +0200
   36.13 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/alpha/Makefile	2009-11-13 00:51:13.000000000 +0100
   36.14 +@@ -35,7 +35,8 @@
   36.15 + 
   36.16 + ifeq ($(subdir),elf)
   36.17 + # The ld.so startup code cannot use literals until it self-relocates.
   36.18 +-CFLAGS-rtld.c = -mbuild-constants
   36.19 ++# It uses more than 64k for the small data area.
   36.20 ++CFLAGS-rtld.c = -mbuild-constants $(PIC-ccflag)
   36.21 + endif
   36.22 + 
   36.23 + # Build everything with full IEEE math support, and with dynamic rounding;
   36.24 +diff -durN glibc-2.13.orig/ports/sysdeps/alpha/Makefile glibc-2.13/ports/sysdeps/alpha/Makefile
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/patches/glibc/ports-2.13/560-ppc-atomic.patch	Tue May 03 00:19:56 2011 +0200
    37.3 @@ -0,0 +1,415 @@
    37.4 +sniped from suse
    37.5 +
    37.6 +Index: sysdeps/powerpc/bits/atomic.h
    37.7 +===================================================================
    37.8 +RCS file: /cvs/glibc/libc/sysdeps/powerpc/bits/atomic.h,v
    37.9 +retrieving revision 1.17
   37.10 +diff -u -a -p -r1.17 atomic.h
   37.11 +
   37.12 +diff -durN glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h glibc-2.13/sysdeps/powerpc/bits/atomic.h
   37.13 +--- glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h	2007-03-26 22:15:28.000000000 +0200
   37.14 ++++ glibc-2.13/sysdeps/powerpc/bits/atomic.h	2009-11-13 00:51:19.000000000 +0100
   37.15 +@@ -85,14 +85,14 @@
   37.16 +       __typeof (*(mem)) __tmp;						      \
   37.17 +       __typeof (mem)  __memp = (mem);					      \
   37.18 +       __asm __volatile (						      \
   37.19 +-		        "1:	lwarx	%0,0,%1" MUTEX_HINT_ACQ "\n"	      \
   37.20 ++		        "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
   37.21 + 		        "	cmpw	%0,%2\n"			      \
   37.22 + 		        "	bne	2f\n"				      \
   37.23 +-		        "	stwcx.	%3,0,%1\n"			      \
   37.24 ++		        "	stwcx.	%3,%y1\n"			      \
   37.25 + 		        "	bne-	1b\n"				      \
   37.26 + 		        "2:	" __ARCH_ACQ_INSTR			      \
   37.27 +-		        : "=&r" (__tmp)					      \
   37.28 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
   37.29 ++		        : "=&r" (__tmp), "+Z" (*__memp)			      \
   37.30 ++		        : "r" (oldval), "r" (newval)			      \
   37.31 + 		        : "cr0", "memory");				      \
   37.32 +       __tmp;								      \
   37.33 +   })
   37.34 +@@ -102,14 +102,14 @@
   37.35 +       __typeof (*(mem)) __tmp;						      \
   37.36 +       __typeof (mem)  __memp = (mem);					      \
   37.37 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
   37.38 +-		        "1:	lwarx	%0,0,%1" MUTEX_HINT_REL "\n"	      \
   37.39 ++		        "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
   37.40 + 		        "	cmpw	%0,%2\n"			      \
   37.41 + 		        "	bne	2f\n"				      \
   37.42 +-		        "	stwcx.	%3,0,%1\n"			      \
   37.43 ++		        "	stwcx.	%3,%y1\n"			      \
   37.44 + 		        "	bne-	1b\n"				      \
   37.45 + 		        "2:	"					      \
   37.46 +-		        : "=&r" (__tmp)					      \
   37.47 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
   37.48 ++		        : "=&r" (__tmp), "+Z" (__memp)			      \
   37.49 ++		        : "r" (oldval), "r" (newval)			      \
   37.50 + 		        : "cr0", "memory");				      \
   37.51 +       __tmp;								      \
   37.52 +   })
   37.53 +@@ -118,12 +118,12 @@
   37.54 +   ({									      \
   37.55 +     __typeof (*mem) __val;						      \
   37.56 +     __asm __volatile (							      \
   37.57 +-		      "1:	lwarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	      \
   37.58 +-		      "		stwcx.	%3,0,%2\n"			      \
   37.59 ++		      "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
   37.60 ++		      "		stwcx.	%2,%y1\n"			      \
   37.61 + 		      "		bne-	1b\n"				      \
   37.62 + 		      "   " __ARCH_ACQ_INSTR				      \
   37.63 +-		      : "=&r" (__val), "=m" (*mem)			      \
   37.64 +-		      : "b" (mem), "r" (value), "m" (*mem)		      \
   37.65 ++		      : "=&r" (__val), "+Z" (*mem)			      \
   37.66 ++		      : "r" (value)					      \
   37.67 + 		      : "cr0", "memory");				      \
   37.68 +     __val;								      \
   37.69 +   })
   37.70 +@@ -132,11 +132,11 @@
   37.71 +   ({									      \
   37.72 +     __typeof (*mem) __val;						      \
   37.73 +     __asm __volatile (__ARCH_REL_INSTR "\n"				      \
   37.74 +-		      "1:	lwarx	%0,0,%2" MUTEX_HINT_REL "\n"	      \
   37.75 +-		      "		stwcx.	%3,0,%2\n"			      \
   37.76 ++		      "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
   37.77 ++		      "		stwcx.	%2,%y1\n"			      \
   37.78 + 		      "		bne-	1b"				      \
   37.79 +-		      : "=&r" (__val), "=m" (*mem)			      \
   37.80 +-		      : "b" (mem), "r" (value), "m" (*mem)		      \
   37.81 ++		      : "=&r" (__val), "+Z" (*mem)			      \
   37.82 ++		      : "r" (value)					      \
   37.83 + 		      : "cr0", "memory");				      \
   37.84 +     __val;								      \
   37.85 +   })
   37.86 +@@ -144,12 +144,12 @@
   37.87 + #define __arch_atomic_exchange_and_add_32(mem, value) \
   37.88 +   ({									      \
   37.89 +     __typeof (*mem) __val, __tmp;					      \
   37.90 +-    __asm __volatile ("1:	lwarx	%0,0,%3\n"			      \
   37.91 +-		      "		add	%1,%0,%4\n"			      \
   37.92 +-		      "		stwcx.	%1,0,%3\n"			      \
   37.93 ++    __asm __volatile ("1:	lwarx	%0,%y2\n"			      \
   37.94 ++		      "		add	%1,%0,%3\n"			      \
   37.95 ++		      "		stwcx.	%1,%y2\n"			      \
   37.96 + 		      "		bne-	1b"				      \
   37.97 +-		      : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
   37.98 +-		      : "b" (mem), "r" (value), "m" (*mem)		      \
   37.99 ++		      : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem)	      \
  37.100 ++		      : "r" (value)					      \
  37.101 + 		      : "cr0", "memory");				      \
  37.102 +     __val;								      \
  37.103 +   })
  37.104 +@@ -157,12 +157,12 @@
  37.105 + #define __arch_atomic_increment_val_32(mem) \
  37.106 +   ({									      \
  37.107 +     __typeof (*(mem)) __val;						      \
  37.108 +-    __asm __volatile ("1:	lwarx	%0,0,%2\n"			      \
  37.109 ++    __asm __volatile ("1:	lwarx	%0,%y1\n"			      \
  37.110 + 		      "		addi	%0,%0,1\n"			      \
  37.111 +-		      "		stwcx.	%0,0,%2\n"			      \
  37.112 ++		      "		stwcx.	%0,%y1\n"			      \
  37.113 + 		      "		bne-	1b"				      \
  37.114 +-		      : "=&b" (__val), "=m" (*mem)			      \
  37.115 +-		      : "b" (mem), "m" (*mem)				      \
  37.116 ++		      : "=&b" (__val), "+Z" (*mem)			      \
  37.117 ++		      :							      \
  37.118 + 		      : "cr0", "memory");				      \
  37.119 +     __val;								      \
  37.120 +   })
  37.121 +@@ -170,27 +170,27 @@
  37.122 + #define __arch_atomic_decrement_val_32(mem) \
  37.123 +   ({									      \
  37.124 +     __typeof (*(mem)) __val;						      \
  37.125 +-    __asm __volatile ("1:	lwarx	%0,0,%2\n"			      \
  37.126 ++    __asm __volatile ("1:	lwarx	%0,%y1\n"			      \
  37.127 + 		      "		subi	%0,%0,1\n"			      \
  37.128 +-		      "		stwcx.	%0,0,%2\n"			      \
  37.129 ++		      "		stwcx.	%0,%y1\n"			      \
  37.130 + 		      "		bne-	1b"				      \
  37.131 +-		      : "=&b" (__val), "=m" (*mem)			      \
  37.132 +-		      : "b" (mem), "m" (*mem)				      \
  37.133 ++		      : "=&b" (__val), "+Z" (*mem)			      \
  37.134 ++		      :							      \
  37.135 + 		      : "cr0", "memory");				      \
  37.136 +     __val;								      \
  37.137 +   })
  37.138 + 
  37.139 + #define __arch_atomic_decrement_if_positive_32(mem) \
  37.140 +   ({ int __val, __tmp;							      \
  37.141 +-     __asm __volatile ("1:	lwarx	%0,0,%3\n"			      \
  37.142 ++     __asm __volatile ("1:	lwarx	%0,%y2\n"			      \
  37.143 + 		       "	cmpwi	0,%0,0\n"			      \
  37.144 + 		       "	addi	%1,%0,-1\n"			      \
  37.145 + 		       "	ble	2f\n"				      \
  37.146 +-		       "	stwcx.	%1,0,%3\n"			      \
  37.147 ++		       "	stwcx.	%1,%y2\n"			      \
  37.148 + 		       "	bne-	1b\n"				      \
  37.149 + 		       "2:	" __ARCH_ACQ_INSTR			      \
  37.150 +-		       : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  37.151 +-		       : "b" (mem), "m" (*mem)				      \
  37.152 ++		       : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem)	      \
  37.153 ++		       :						      \
  37.154 + 		       : "cr0", "memory");				      \
  37.155 +      __val;								      \
  37.156 +   })
  37.157 +diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h
  37.158 +--- glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h	2007-03-26 22:15:45.000000000 +0200
  37.159 ++++ glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h	2009-11-13 00:51:19.000000000 +0100
  37.160 +@@ -44,14 +44,14 @@
  37.161 + ({									      \
  37.162 +   unsigned int __tmp;							      \
  37.163 +   __asm __volatile (							      \
  37.164 +-		    "1:	lwarx	%0,0,%1" MUTEX_HINT_ACQ "\n"		      \
  37.165 ++		    "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"		      \
  37.166 + 		    "	subf.	%0,%2,%0\n"				      \
  37.167 + 		    "	bne	2f\n"					      \
  37.168 +-		    "	stwcx.	%3,0,%1\n"				      \
  37.169 ++		    "	stwcx.	%3,%y1\n"				      \
  37.170 + 		    "	bne-	1b\n"					      \
  37.171 + 		    "2:	" __ARCH_ACQ_INSTR				      \
  37.172 +-		    : "=&r" (__tmp)					      \
  37.173 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  37.174 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  37.175 ++		    : "r" (oldval), "r" (newval)			      \
  37.176 + 		    : "cr0", "memory");					      \
  37.177 +   __tmp != 0;								      \
  37.178 + })
  37.179 +@@ -60,14 +60,14 @@
  37.180 + ({									      \
  37.181 +   unsigned int __tmp;							      \
  37.182 +   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  37.183 +-		    "1:	lwarx	%0,0,%1" MUTEX_HINT_REL "\n"		      \
  37.184 ++		    "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"		      \
  37.185 + 		    "	subf.	%0,%2,%0\n"				      \
  37.186 + 		    "	bne	2f\n"					      \
  37.187 +-		    "	stwcx.	%3,0,%1\n"				      \
  37.188 ++		    "	stwcx.	%3,%y1\n"				      \
  37.189 + 		    "	bne-	1b\n"					      \
  37.190 + 		    "2:	"						      \
  37.191 +-		    : "=&r" (__tmp)					      \
  37.192 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  37.193 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  37.194 ++		    : "r" (oldval), "r" (newval)			      \
  37.195 + 		    : "cr0", "memory");					      \
  37.196 +   __tmp != 0;								      \
  37.197 + })
  37.198 +diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h
  37.199 +--- glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h	2007-03-26 22:16:03.000000000 +0200
  37.200 ++++ glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h	2009-11-13 00:51:19.000000000 +0100
  37.201 +@@ -44,14 +44,14 @@
  37.202 + ({									      \
  37.203 +   unsigned int __tmp, __tmp2;						      \
  37.204 +   __asm __volatile ("   clrldi  %1,%1,32\n"				      \
  37.205 +-		    "1:	lwarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	 	      \
  37.206 ++		    "1:	lwarx	%0,%y2" MUTEX_HINT_ACQ "\n"	 	      \
  37.207 + 		    "	subf.	%0,%1,%0\n"				      \
  37.208 + 		    "	bne	2f\n"					      \
  37.209 +-		    "	stwcx.	%4,0,%2\n"				      \
  37.210 ++		    "	stwcx.	%4,%y2\n"				      \
  37.211 + 		    "	bne-	1b\n"					      \
  37.212 + 		    "2:	" __ARCH_ACQ_INSTR				      \
  37.213 +-		    : "=&r" (__tmp), "=r" (__tmp2)			      \
  37.214 +-		    : "b" (mem), "1" (oldval), "r" (newval)		      \
  37.215 ++		    : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem))	      \
  37.216 ++		    : "1" (oldval), "r" (newval)			      \
  37.217 + 		    : "cr0", "memory");					      \
  37.218 +   __tmp != 0;								      \
  37.219 + })
  37.220 +@@ -61,14 +61,14 @@
  37.221 +   unsigned int __tmp, __tmp2;						      \
  37.222 +   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  37.223 + 		    "   clrldi  %1,%1,32\n"				      \
  37.224 +-		    "1:	lwarx	%0,0,%2" MUTEX_HINT_REL "\n"		      \
  37.225 ++		    "1:	lwarx	%0,%y2" MUTEX_HINT_REL "\n"		      \
  37.226 + 		    "	subf.	%0,%1,%0\n"				      \
  37.227 + 		    "	bne	2f\n"					      \
  37.228 +-		    "	stwcx.	%4,0,%2\n"				      \
  37.229 ++		    "	stwcx.	%4,%y2\n"				      \
  37.230 + 		    "	bne-	1b\n"					      \
  37.231 + 		    "2:	"						      \
  37.232 +-		    : "=&r" (__tmp), "=r" (__tmp2)			      \
  37.233 +-		    : "b" (mem), "1" (oldval), "r" (newval)		      \
  37.234 ++		    : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem))	      \
  37.235 ++		    : "1" (oldval), "r" (newval)			      \
  37.236 + 		    : "cr0", "memory");					      \
  37.237 +   __tmp != 0;								      \
  37.238 + })
  37.239 +@@ -82,14 +82,14 @@
  37.240 + ({									      \
  37.241 +   unsigned long	__tmp;							      \
  37.242 +   __asm __volatile (							      \
  37.243 +-		    "1:	ldarx	%0,0,%1" MUTEX_HINT_ACQ "\n"		      \
  37.244 ++		    "1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"		      \
  37.245 + 		    "	subf.	%0,%2,%0\n"				      \
  37.246 + 		    "	bne	2f\n"					      \
  37.247 +-		    "	stdcx.	%3,0,%1\n"				      \
  37.248 ++		    "	stdcx.	%3,%y1\n"				      \
  37.249 + 		    "	bne-	1b\n"					      \
  37.250 + 		    "2:	" __ARCH_ACQ_INSTR				      \
  37.251 +-		    : "=&r" (__tmp)					      \
  37.252 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  37.253 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  37.254 ++		    : "r" (oldval), "r" (newval)			      \
  37.255 + 		    : "cr0", "memory");					      \
  37.256 +   __tmp != 0;								      \
  37.257 + })
  37.258 +@@ -98,14 +98,14 @@
  37.259 + ({									      \
  37.260 +   unsigned long	__tmp;							      \
  37.261 +   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  37.262 +-		    "1:	ldarx	%0,0,%2" MUTEX_HINT_REL "\n"		      \
  37.263 ++		    "1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"		      \
  37.264 + 		    "	subf.	%0,%2,%0\n"				      \
  37.265 + 		    "	bne	2f\n"					      \
  37.266 +-		    "	stdcx.	%3,0,%1\n"				      \
  37.267 ++		    "	stdcx.	%3,%y1\n"				      \
  37.268 + 		    "	bne-	1b\n"					      \
  37.269 + 		    "2:	"						      \
  37.270 +-		    : "=&r" (__tmp)					      \
  37.271 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  37.272 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  37.273 ++		    : "r" (oldval), "r" (newval)			      \
  37.274 + 		    : "cr0", "memory");					      \
  37.275 +   __tmp != 0;								      \
  37.276 + })
  37.277 +@@ -115,14 +115,14 @@
  37.278 +       __typeof (*(mem)) __tmp;						      \
  37.279 +       __typeof (mem)  __memp = (mem);					      \
  37.280 +       __asm __volatile (						      \
  37.281 +-		        "1:	ldarx	%0,0,%1" MUTEX_HINT_ACQ "\n"	      \
  37.282 ++		        "1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
  37.283 + 		        "	cmpd	%0,%2\n"			      \
  37.284 + 		        "	bne	2f\n"				      \
  37.285 +-		        "	stdcx.	%3,0,%1\n"			      \
  37.286 ++		        "	stdcx.	%3,%y1\n"			      \
  37.287 + 		        "	bne-	1b\n"				      \
  37.288 + 		        "2:	" __ARCH_ACQ_INSTR			      \
  37.289 +-		        : "=&r" (__tmp)					      \
  37.290 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
  37.291 ++		        : "=&r" (__tmp), "+Z" (*__memp)			      \
  37.292 ++		        : "r" (oldval), "r" (newval)			      \
  37.293 + 		        : "cr0", "memory");				      \
  37.294 +       __tmp;								      \
  37.295 +   })
  37.296 +@@ -132,14 +132,14 @@
  37.297 +       __typeof (*(mem)) __tmp;						      \
  37.298 +       __typeof (mem)  __memp = (mem);					      \
  37.299 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  37.300 +-		        "1:	ldarx	%0,0,%1" MUTEX_HINT_REL "\n"	      \
  37.301 ++		        "1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
  37.302 + 		        "	cmpd	%0,%2\n"			      \
  37.303 + 		        "	bne	2f\n"				      \
  37.304 +-		        "	stdcx.	%3,0,%1\n"			      \
  37.305 ++		        "	stdcx.	%3,%y1\n"			      \
  37.306 + 		        "	bne-	1b\n"				      \
  37.307 + 		        "2:	"					      \
  37.308 +-		        : "=&r" (__tmp)					      \
  37.309 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
  37.310 ++		        : "=&r" (__tmp), "+Z" (*__memp)			      \
  37.311 ++		        : "r" (oldval), "r" (newval)			      \
  37.312 + 		        : "cr0", "memory");				      \
  37.313 +       __tmp;								      \
  37.314 +   })
  37.315 +@@ -148,12 +148,12 @@
  37.316 +     ({									      \
  37.317 +       __typeof (*mem) __val;						      \
  37.318 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  37.319 +-			"1:	ldarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	      \
  37.320 +-			"	stdcx.	%3,0,%2\n"			      \
  37.321 ++			"1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
  37.322 ++			"	stdcx.	%2,%y1\n"			      \
  37.323 + 			"	bne-	1b\n"				      \
  37.324 + 		  " " __ARCH_ACQ_INSTR					      \
  37.325 +-			: "=&r" (__val), "=m" (*mem)			      \
  37.326 +-			: "b" (mem), "r" (value), "m" (*mem)		      \
  37.327 ++			: "=&r" (__val), "+Z" (*(mem))			      \
  37.328 ++			: "r" (value)					      \
  37.329 + 			: "cr0", "memory");				      \
  37.330 +       __val;								      \
  37.331 +     })
  37.332 +@@ -162,11 +162,11 @@
  37.333 +     ({									      \
  37.334 +       __typeof (*mem) __val;						      \
  37.335 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  37.336 +-			"1:	ldarx	%0,0,%2" MUTEX_HINT_REL "\n"	      \
  37.337 +-			"	stdcx.	%3,0,%2\n"			      \
  37.338 ++			"1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
  37.339 ++			"	stdcx.	%2,%y1\n"			      \
  37.340 + 			"	bne-	1b"				      \
  37.341 +-			: "=&r" (__val), "=m" (*mem)			      \
  37.342 +-			: "b" (mem), "r" (value), "m" (*mem)		      \
  37.343 ++			: "=&r" (__val), "+Z" (*(mem))			      \
  37.344 ++			: "r" (value)					      \
  37.345 + 			: "cr0", "memory");				      \
  37.346 +       __val;								      \
  37.347 +     })
  37.348 +@@ -174,12 +174,12 @@
  37.349 + #define __arch_atomic_exchange_and_add_64(mem, value) \
  37.350 +     ({									      \
  37.351 +       __typeof (*mem) __val, __tmp;					      \
  37.352 +-      __asm __volatile ("1:	ldarx	%0,0,%3\n"			      \
  37.353 +-			"	add	%1,%0,%4\n"			      \
  37.354 +-			"	stdcx.	%1,0,%3\n"			      \
  37.355 ++      __asm __volatile ("1:	ldarx	%0,%y2\n"			      \
  37.356 ++			"	add	%1,%0,%3\n"			      \
  37.357 ++			"	stdcx.	%1,%y2\n"			      \
  37.358 + 			"	bne-	1b"				      \
  37.359 +-			: "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  37.360 +-			: "b" (mem), "r" (value), "m" (*mem)		      \
  37.361 ++			: "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem))	      \
  37.362 ++			: "r" (value)					      \
  37.363 + 			: "cr0", "memory");				      \
  37.364 +       __val;								      \
  37.365 +     })
  37.366 +@@ -187,12 +187,12 @@
  37.367 + #define __arch_atomic_increment_val_64(mem) \
  37.368 +     ({									      \
  37.369 +       __typeof (*(mem)) __val;						      \
  37.370 +-      __asm __volatile ("1:	ldarx	%0,0,%2\n"			      \
  37.371 ++      __asm __volatile ("1:	ldarx	%0,%y1\n"			      \
  37.372 + 			"	addi	%0,%0,1\n"			      \
  37.373 +-			"	stdcx.	%0,0,%2\n"			      \
  37.374 ++			"	stdcx.	%0,%y1\n"			      \
  37.375 + 			"	bne-	1b"				      \
  37.376 +-			: "=&b" (__val), "=m" (*mem)			      \
  37.377 +-			: "b" (mem), "m" (*mem)				      \
  37.378 ++			: "=&b" (__val), "+Z" (*(mem))			      \
  37.379 ++			:						      \
  37.380 + 			: "cr0", "memory");				      \
  37.381 +       __val;								      \
  37.382 +     })
  37.383 +@@ -200,27 +200,27 @@
  37.384 + #define __arch_atomic_decrement_val_64(mem) \
  37.385 +     ({									      \
  37.386 +       __typeof (*(mem)) __val;						      \
  37.387 +-      __asm __volatile ("1:	ldarx	%0,0,%2\n"			      \
  37.388 ++      __asm __volatile ("1:	ldarx	%0,%y1\n"			      \
  37.389 + 			"	subi	%0,%0,1\n"			      \
  37.390 +-			"	stdcx.	%0,0,%2\n"			      \
  37.391 ++			"	stdcx.	%0,%y1\n"			      \
  37.392 + 			"	bne-	1b"				      \
  37.393 +-			: "=&b" (__val), "=m" (*mem)			      \
  37.394 +-			: "b" (mem), "m" (*mem)				      \
  37.395 ++			: "=&b" (__val), "+Z" (*(mem))			      \
  37.396 ++			:						      \
  37.397 + 			: "cr0", "memory");				      \
  37.398 +       __val;								      \
  37.399 +     })
  37.400 + 
  37.401 + #define __arch_atomic_decrement_if_positive_64(mem) \
  37.402 +   ({ int __val, __tmp;							      \
  37.403 +-     __asm __volatile ("1:	ldarx	%0,0,%3\n"			      \
  37.404 ++     __asm __volatile ("1:	ldarx	%0,%y2\n"			      \
  37.405 + 		       "	cmpdi	0,%0,0\n"			      \
  37.406 + 		       "	addi	%1,%0,-1\n"			      \
  37.407 + 		       "	ble	2f\n"				      \
  37.408 +-		       "	stdcx.	%1,0,%3\n"			      \
  37.409 ++		       "	stdcx.	%1,%y2\n"			      \
  37.410 + 		       "	bne-	1b\n"				      \
  37.411 + 		       "2:	" __ARCH_ACQ_INSTR			      \
  37.412 +-		       : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  37.413 +-		       : "b" (mem), "m" (*mem)				      \
  37.414 ++		       : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem))	      \
  37.415 ++		       :						      \
  37.416 + 		       : "cr0", "memory");				      \
  37.417 +      __val;								      \
  37.418 +   })
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/patches/glibc/ports-2.13/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch	Tue May 03 00:19:56 2011 +0200
    38.3 @@ -0,0 +1,374 @@
    38.4 +http://yann.poupet.free.fr/ep93xx/
    38.5 +Add support for the Maverick Crunch FPU on Cirrus EP93XX processor series
    38.6 +
    38.7 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/bits/endian.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/bits/endian.h
    38.8 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/bits/endian.h	2009-05-16 10:36:20.000000000 +0200
    38.9 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/bits/endian.h	2009-11-13 00:51:22.000000000 +0100
   38.10 +@@ -12,7 +12,7 @@
   38.11 + /* FPA floating point units are always big-endian, irrespective of the
   38.12 +    CPU endianness.  VFP floating point units use the same endianness
   38.13 +    as the rest of the system.  */
   38.14 +-#ifdef __VFP_FP__
   38.15 ++#if defined __VFP_FP__ || defined __MAVERICK__
   38.16 + #define __FLOAT_WORD_ORDER __BYTE_ORDER
   38.17 + #else
   38.18 + #define __FLOAT_WORD_ORDER __BIG_ENDIAN
   38.19 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/__longjmp.S glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/__longjmp.S
   38.20 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/__longjmp.S	2009-05-16 10:36:20.000000000 +0200
   38.21 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/__longjmp.S	2009-11-13 00:51:22.000000000 +0100
   38.22 +@@ -30,7 +30,33 @@
   38.23 + 	movs	r0, r1		/* get the return value in place */
   38.24 + 	moveq	r0, #1		/* can't let setjmp() return zero! */
   38.25 + 
   38.26 ++#ifdef __MAVERICK__
   38.27 ++	cfldrd	mvd4,  [ip], #8
   38.28 ++	nop
   38.29 ++	cfldrd	mvd5,  [ip], #8
   38.30 ++	nop
   38.31 ++	cfldrd	mvd6,  [ip], #8
   38.32 ++	nop
   38.33 ++	cfldrd	mvd7,  [ip], #8
   38.34 ++	nop
   38.35 ++	cfldrd	mvd8,  [ip], #8
   38.36 ++	nop
   38.37 ++	cfldrd	mvd9,  [ip], #8
   38.38 ++	nop
   38.39 ++	cfldrd	mvd10, [ip], #8
   38.40 ++	nop
   38.41 ++	cfldrd	mvd11, [ip], #8
   38.42 ++	nop
   38.43 ++	cfldrd	mvd12, [ip], #8
   38.44 ++	nop
   38.45 ++	cfldrd	mvd13, [ip], #8
   38.46 ++	nop
   38.47 ++	cfldrd	mvd14, [ip], #8
   38.48 ++	nop
   38.49 ++	cfldrd	mvd15, [ip], #8
   38.50 ++#else
   38.51 + 	lfmfd	f4, 4, [ip] !	/* load the floating point regs */
   38.52 ++#endif
   38.53 + 
   38.54 + 	LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
   38.55 + END (__longjmp)
   38.56 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/bits/fenv.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/bits/fenv.h
   38.57 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/bits/fenv.h	2009-05-16 10:36:20.000000000 +0200
   38.58 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/bits/fenv.h	2009-11-13 00:51:22.000000000 +0100
   38.59 +@@ -20,6 +20,45 @@
   38.60 + # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
   38.61 + #endif
   38.62 + 
   38.63 ++#if defined(__MAVERICK__)
   38.64 ++
   38.65 ++/* Define bits representing exceptions in the FPU status word.  */
   38.66 ++enum
   38.67 ++  {
   38.68 ++    FE_INVALID = 1,
   38.69 ++#define FE_INVALID FE_INVALID
   38.70 ++    FE_OVERFLOW = 4,
   38.71 ++#define FE_OVERFLOW FE_OVERFLOW
   38.72 ++    FE_UNDERFLOW = 8,
   38.73 ++#define FE_UNDERFLOW FE_UNDERFLOW
   38.74 ++    FE_INEXACT = 16,
   38.75 ++#define FE_INEXACT FE_INEXACT
   38.76 ++  };
   38.77 ++
   38.78 ++/* Amount to shift by to convert an exception to a mask bit.  */
   38.79 ++#define FE_EXCEPT_SHIFT	5
   38.80 ++
   38.81 ++/* All supported exceptions.  */
   38.82 ++#define FE_ALL_EXCEPT	\
   38.83 ++	(FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
   38.84 ++
   38.85 ++/* IEEE rounding modes.  */
   38.86 ++enum
   38.87 ++  {
   38.88 ++    FE_TONEAREST = 0,
   38.89 ++#define FE_TONEAREST    FE_TONEAREST
   38.90 ++    FE_TOWARDZERO = 0x400,
   38.91 ++#define FE_TOWARDZERO   FE_TOWARDZERO
   38.92 ++    FE_DOWNWARD = 0x800,
   38.93 ++#define FE_DOWNWARD     FE_DOWNWARD
   38.94 ++    FE_UPWARD = 0xc00,
   38.95 ++#define FE_UPWARD       FE_UPWARD
   38.96 ++  };
   38.97 ++
   38.98 ++#define FE_ROUND_MASK (FE_UPWARD)
   38.99 ++
  38.100 ++#else /* FPA */
  38.101 ++
  38.102 + /* Define bits representing exceptions in the FPU status word.  */
  38.103 + enum
  38.104 +   {
  38.105 +@@ -44,6 +83,8 @@
  38.106 +    modes exist, but you have to encode them in the actual instruction.  */
  38.107 + #define FE_TONEAREST	0
  38.108 + 
  38.109 ++#endif
  38.110 ++
  38.111 + /* Type representing exception flags. */
  38.112 + typedef unsigned long int fexcept_t;
  38.113 + 
  38.114 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/bits/setjmp.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/bits/setjmp.h
  38.115 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/bits/setjmp.h	2009-05-16 10:36:20.000000000 +0200
  38.116 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/bits/setjmp.h	2009-11-13 00:51:22.000000000 +0100
  38.117 +@@ -28,7 +28,11 @@
  38.118 + #ifndef _ASM
  38.119 + /* Jump buffer contains v1-v6, sl, fp, sp and pc.  Other registers are not
  38.120 +    saved.  */
  38.121 ++#ifdef __MAVERICK__
  38.122 ++typedef int __jmp_buf[34];
  38.123 ++#else
  38.124 + typedef int __jmp_buf[22];
  38.125 + #endif
  38.126 ++#endif
  38.127 + 
  38.128 + #endif
  38.129 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fegetround.c glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fegetround.c
  38.130 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fegetround.c	2009-05-16 10:36:20.000000000 +0200
  38.131 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fegetround.c	2009-11-13 00:51:22.000000000 +0100
  38.132 +@@ -18,9 +18,21 @@
  38.133 +    02111-1307 USA.  */
  38.134 + 
  38.135 + #include <fenv.h>
  38.136 ++#include <fpu_control.h>
  38.137 + 
  38.138 + int
  38.139 + fegetround (void)
  38.140 + {
  38.141 ++#if defined(__MAVERICK__)
  38.142 ++
  38.143 ++  unsigned long temp;
  38.144 ++
  38.145 ++  _FPU_GETCW (temp);
  38.146 ++  return temp & FE_ROUND_MASK;
  38.147 ++
  38.148 ++#else /* FPA */
  38.149 ++
  38.150 +   return FE_TONEAREST;		/* Easy. :-) */
  38.151 ++
  38.152 ++#endif
  38.153 + }
  38.154 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fesetround.c glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fesetround.c
  38.155 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fesetround.c	2009-05-16 10:36:20.000000000 +0200
  38.156 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fesetround.c	2009-11-13 00:51:22.000000000 +0100
  38.157 +@@ -18,12 +18,28 @@
  38.158 +    02111-1307 USA.  */
  38.159 + 
  38.160 + #include <fenv.h>
  38.161 ++#include <fpu_control.h>
  38.162 + 
  38.163 + int
  38.164 + fesetround (int round)
  38.165 + {
  38.166 ++#if defined(__MAVERICK__)
  38.167 ++  unsigned long temp;
  38.168 ++
  38.169 ++  if (round & ~FE_ROUND_MASK)
  38.170 ++    return 1;
  38.171 ++
  38.172 ++  _FPU_GETCW (temp);
  38.173 ++  temp = (temp & ~FE_ROUND_MASK) | round;
  38.174 ++  _FPU_SETCW (temp);
  38.175 ++  return 0;
  38.176 ++
  38.177 ++#else /* FPA */
  38.178 ++
  38.179 +   /* We only support FE_TONEAREST, so there is no need for any work.  */
  38.180 +   return (round == FE_TONEAREST)?0:1;
  38.181 ++
  38.182 ++#endif
  38.183 + }
  38.184 + 
  38.185 + libm_hidden_def (fesetround)
  38.186 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fpu_control.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fpu_control.h
  38.187 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fpu_control.h	2009-05-16 10:36:20.000000000 +0200
  38.188 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fpu_control.h	2009-11-13 00:51:22.000000000 +0100
  38.189 +@@ -1,5 +1,6 @@
  38.190 + /* FPU control word definitions.  ARM version.
  38.191 +-   Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
  38.192 ++   Copyright (C) 1996, 1997, 1998, 2000, 2005
  38.193 ++   Free Software Foundation, Inc.
  38.194 +    This file is part of the GNU C Library.
  38.195 + 
  38.196 +    The GNU C Library is free software; you can redistribute it and/or
  38.197 +@@ -20,6 +21,79 @@
  38.198 + #ifndef _FPU_CONTROL_H
  38.199 + #define _FPU_CONTROL_H
  38.200 + 
  38.201 ++#if defined(__MAVERICK__)
  38.202 ++
  38.203 ++/* DSPSC register: (from EP9312 User's Guide)
  38.204 ++ *
  38.205 ++ * bits 31..29	- DAID
  38.206 ++ * bits 28..26	- HVID
  38.207 ++ * bits 25..24	- RSVD
  38.208 ++ * bit  23	- ISAT
  38.209 ++ * bit  22	- UI
  38.210 ++ * bit  21	- INT
  38.211 ++ * bit  20	- AEXC
  38.212 ++ * bits 19..18	- SAT
  38.213 ++ * bits 17..16	- FCC
  38.214 ++ * bit  15	- V
  38.215 ++ * bit  14	- FWDEN
  38.216 ++ * bit  13	- Invalid
  38.217 ++ * bit	12	- Denorm
  38.218 ++ * bits 11..10	- RM
  38.219 ++ * bits 9..5	- IXE, UFE, OFE, RSVD, IOE
  38.220 ++ * bits 4..0	- IX, UF, OF, RSVD, IO
  38.221 ++ */
  38.222 ++
  38.223 ++/* masking of interrupts */
  38.224 ++#define _FPU_MASK_IM	(1 << 5)	/* invalid operation */
  38.225 ++#define _FPU_MASK_ZM	0		/* divide by zero */
  38.226 ++#define _FPU_MASK_OM	(1 << 7)	/* overflow */
  38.227 ++#define _FPU_MASK_UM	(1 << 8)	/* underflow */
  38.228 ++#define _FPU_MASK_PM	(1 << 9)	/* inexact */
  38.229 ++#define _FPU_MASK_DM	0		/* denormalized operation */
  38.230 ++
  38.231 ++#define _FPU_RESERVED	0xfffff000	/* These bits are reserved.  */
  38.232 ++
  38.233 ++#define _FPU_DEFAULT	0x00b00000	/* Default value.  */
  38.234 ++#define _FPU_IEEE	0x00b003a0	/* Default + exceptions enabled. */
  38.235 ++
  38.236 ++/* Type of the control word.  */
  38.237 ++typedef unsigned int fpu_control_t;
  38.238 ++
  38.239 ++/* Macros for accessing the hardware control word.  */
  38.240 ++#define _FPU_GETCW(cw) ({			\
  38.241 ++	register int __t1, __t2;		\
  38.242 ++						\
  38.243 ++	__asm__ volatile (			\
  38.244 ++	"cfmvr64l	%1, mvdx0\n\t"		\
  38.245 ++	"cfmvr64h	%2, mvdx0\n\t"		\
  38.246 ++	"cfmv32sc	mvdx0, dspsc\n\t"	\
  38.247 ++	"cfmvr64l	%0, mvdx0\n\t"		\
  38.248 ++	"cfmv64lr	mvdx0, %1\n\t"		\
  38.249 ++	"cfmv64hr	mvdx0, %2"		\
  38.250 ++	: "=r" (cw), "=r" (__t1), "=r" (__t2)	\
  38.251 ++	);					\
  38.252 ++})
  38.253 ++
  38.254 ++#define _FPU_SETCW(cw) ({			\
  38.255 ++	register int __t0, __t1, __t2;		\
  38.256 ++						\
  38.257 ++	__asm__ volatile (			\
  38.258 ++	"cfmvr64l	%1, mvdx0\n\t"		\
  38.259 ++	"cfmvr64h	%2, mvdx0\n\t"		\
  38.260 ++	"cfmv64lr	mvdx0, %0\n\t"		\
  38.261 ++	"cfmvsc32	dspsc, mvdx0\n\t"	\
  38.262 ++	"cfmv64lr	mvdx0, %1\n\t"		\
  38.263 ++	"cfmv64hr	mvdx0, %2"		\
  38.264 ++	: "=r" (__t0), "=r" (__t1), "=r" (__t2)	\
  38.265 ++	: "0" (cw)				\
  38.266 ++	);					\
  38.267 ++})
  38.268 ++
  38.269 ++/* Default control word set at startup.  */
  38.270 ++extern fpu_control_t __fpu_control;
  38.271 ++
  38.272 ++#else /* FPA */
  38.273 ++
  38.274 + /* We have a slight terminology confusion here.  On the ARM, the register
  38.275 +  * we're interested in is actually the FPU status word - the FPU control
  38.276 +  * word is something different (which is implementation-defined and only
  38.277 +@@ -99,4 +173,6 @@
  38.278 + /* Default control word set at startup.  */
  38.279 + extern fpu_control_t __fpu_control;
  38.280 + 
  38.281 ++#endif
  38.282 ++
  38.283 + #endif /* _FPU_CONTROL_H */
  38.284 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/jmpbuf-offsets.h
  38.285 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/jmpbuf-offsets.h	2009-05-16 10:36:20.000000000 +0200
  38.286 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/jmpbuf-offsets.h	2009-11-13 00:51:22.000000000 +0100
  38.287 +@@ -17,4 +17,8 @@
  38.288 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  38.289 +    02111-1307 USA.  */
  38.290 + 
  38.291 ++#ifdef __MAVERICK__
  38.292 ++#define __JMP_BUF_SP		32
  38.293 ++#else
  38.294 + #define __JMP_BUF_SP		20
  38.295 ++#endif
  38.296 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/setjmp.S glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/setjmp.S
  38.297 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/setjmp.S	2009-05-16 10:36:20.000000000 +0200
  38.298 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/setjmp.S	2009-11-13 00:51:22.000000000 +0100
  38.299 +@@ -24,11 +24,41 @@
  38.300 + 
  38.301 + ENTRY (__sigsetjmp)
  38.302 + 	/* Save registers */
  38.303 ++#ifdef __MAVERICK__
  38.304 ++	cfstrd	mvd4,  [r0], #8
  38.305 ++	nop
  38.306 ++	cfstrd	mvd5,  [r0], #8
  38.307 ++	nop
  38.308 ++	cfstrd	mvd6,  [r0], #8
  38.309 ++	nop
  38.310 ++	cfstrd	mvd7,  [r0], #8
  38.311 ++	nop
  38.312 ++	cfstrd	mvd8,  [r0], #8
  38.313 ++	nop
  38.314 ++	cfstrd	mvd9,  [r0], #8
  38.315 ++	nop
  38.316 ++	cfstrd	mvd10, [r0], #8
  38.317 ++	nop
  38.318 ++	cfstrd	mvd11, [r0], #8
  38.319 ++	nop
  38.320 ++	cfstrd	mvd12, [r0], #8
  38.321 ++	nop
  38.322 ++	cfstrd	mvd13, [r0], #8
  38.323 ++	nop
  38.324 ++	cfstrd	mvd14, [r0], #8
  38.325 ++	nop
  38.326 ++	cfstrd	mvd15, [r0], #8
  38.327 ++#else
  38.328 + 	sfmea	f4, 4, [r0]!
  38.329 ++#endif
  38.330 + 	stmia	r0, {v1-v6, sl, fp, sp, lr}
  38.331 + 
  38.332 + 	/* Restore pointer to jmp_buf */
  38.333 ++#ifdef __MAVERICK__
  38.334 ++	sub	r0, r0, #96
  38.335 ++#else
  38.336 + 	sub	r0, r0, #48
  38.337 ++#endif
  38.338 + 
  38.339 + 	/* Make a tail call to __sigjmp_save; it takes the same args.  */
  38.340 + 	B	PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
  38.341 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/gccframe.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/gccframe.h
  38.342 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/gccframe.h	2009-05-16 10:36:20.000000000 +0200
  38.343 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/gccframe.h	2009-11-13 00:51:22.000000000 +0100
  38.344 +@@ -17,6 +17,10 @@
  38.345 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  38.346 +    02111-1307 USA.  */
  38.347 + 
  38.348 ++#ifdef __MAVERICK__
  38.349 ++#define FIRST_PSEUDO_REGISTER 43
  38.350 ++#else
  38.351 + #define FIRST_PSEUDO_REGISTER 27
  38.352 ++#endif
  38.353 + 
  38.354 + #include <sysdeps/generic/gccframe.h>
  38.355 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/gmp-mparam.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/gmp-mparam.h
  38.356 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/gmp-mparam.h	2009-05-16 10:36:20.000000000 +0200
  38.357 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/gmp-mparam.h	2009-11-13 00:51:22.000000000 +0100
  38.358 +@@ -29,7 +29,7 @@
  38.359 + #if defined(__ARMEB__)
  38.360 + # define IEEE_DOUBLE_MIXED_ENDIAN 0
  38.361 + # define IEEE_DOUBLE_BIG_ENDIAN 1
  38.362 +-#elif defined(__VFP_FP__)
  38.363 ++#elif defined(__VFP_FP__) || defined(__MAVERICK__)
  38.364 + # define IEEE_DOUBLE_MIXED_ENDIAN 0
  38.365 + # define IEEE_DOUBLE_BIG_ENDIAN 0
  38.366 + #else
  38.367 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/bits/endian.h glibc-2.13/ports/sysdeps/arm/bits/endian.h
  38.368 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/__longjmp.S glibc-2.13/ports/sysdeps/arm/fpu/__longjmp.S
  38.369 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/bits/fenv.h glibc-2.13/ports/sysdeps/arm/fpu/bits/fenv.h
  38.370 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/bits/setjmp.h glibc-2.13/ports/sysdeps/arm/fpu/bits/setjmp.h
  38.371 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/fegetround.c glibc-2.13/ports/sysdeps/arm/fpu/fegetround.c
  38.372 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/fesetround.c glibc-2.13/ports/sysdeps/arm/fpu/fesetround.c
  38.373 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/fpu_control.h glibc-2.13/ports/sysdeps/arm/fpu/fpu_control.h
  38.374 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.13/ports/sysdeps/arm/fpu/jmpbuf-offsets.h
  38.375 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/setjmp.S glibc-2.13/ports/sysdeps/arm/fpu/setjmp.S
  38.376 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/gccframe.h glibc-2.13/ports/sysdeps/arm/gccframe.h
  38.377 +diff -durN glibc-2.13.orig/ports/sysdeps/arm/gmp-mparam.h glibc-2.13/ports/sysdeps/arm/gmp-mparam.h
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/patches/glibc/ports-2.13/580-nptl-lowlevellock.patch	Tue May 03 00:19:56 2011 +0200
    39.3 @@ -0,0 +1,23 @@
    39.4 +fix build error on arm like on hppa:
    39.5 +
    39.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
    39.7 +In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
    39.8 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
    39.9 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: warning: implicit declaration of function 'THREAD_GETMEM'
   39.10 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'THREAD_SELF' undeclared (first use in this function)
   39.11 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: (Each undeclared identifier is reported only once
   39.12 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: for each function it appears in.)
   39.13 +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'header' undeclared (first use in this function)
   39.14 +
   39.15 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
   39.16 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h	2009-05-16 10:36:20.000000000 +0200
   39.17 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h	2009-11-13 00:51:23.000000000 +0100
   39.18 +@@ -25,6 +25,7 @@
   39.19 + #include <atomic.h>
   39.20 + #include <sysdep.h>
   39.21 + #include <kernel-features.h>
   39.22 ++#include <tls.h>		/* Need THREAD_*, and header.*.  */
   39.23 + 
   39.24 + #define FUTEX_WAIT		0
   39.25 + #define FUTEX_WAKE		1
   39.26 +diff -durN glibc-2.13.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.13/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/patches/glibc/ports-2.13/610-fpu-cw-mips.patch	Tue May 03 00:19:56 2011 +0200
    40.3 @@ -0,0 +1,15 @@
    40.4 +http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
    40.5 +
    40.6 +diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/mips/fpu_control.h glibc-2.13/glibc-ports-2.13/sysdeps/mips/fpu_control.h
    40.7 +--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/mips/fpu_control.h	2009-05-16 10:36:20.000000000 +0200
    40.8 ++++ glibc-2.13/glibc-ports-2.13/sysdeps/mips/fpu_control.h	2009-11-13 00:51:31.000000000 +0100
    40.9 +@@ -86,7 +86,7 @@
   40.10 + #define _FPU_RC_UP      0x2
   40.11 + #define _FPU_RC_DOWN    0x3
   40.12 + 
   40.13 +-#define _FPU_RESERVED 0xfe3c0000  /* Reserved bits in cw */
   40.14 ++#define _FPU_RESERVED 0xfebc0000  /* Reserved bits in cw */
   40.15 + 
   40.16 + 
   40.17 + /* The fdlibm code requires strict IEEE double precision arithmetic,
   40.18 +diff -durN glibc-2.13.orig/ports/sysdeps/mips/fpu_control.h glibc-2.13/ports/sysdeps/mips/fpu_control.h
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/patches/glibc/ports-2.13/630-mips_shn_undef-hack.patch	Tue May 03 00:19:56 2011 +0200
    41.3 @@ -0,0 +1,16 @@
    41.4 +diff -durN glibc-2.13.orig/elf/dl-lookup.c glibc-2.13/elf/dl-lookup.c
    41.5 +--- glibc-2.13.orig/elf/dl-lookup.c	2009-03-30 23:14:32.000000000 +0200
    41.6 ++++ glibc-2.13/elf/dl-lookup.c	2009-11-13 00:51:36.000000000 +0100
    41.7 +@@ -301,6 +301,12 @@
    41.8 + 	      /* FALLTHROUGH */
    41.9 + 	    case STB_GLOBAL:
   41.10 +	    success:
   41.11 ++#ifdef __mips__
   41.12 ++	      /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
   41.13 ++		 symbols, we skip them. */
   41.14 ++	      if (sym->st_shndx == SHN_UNDEF)
   41.15 ++		break;
   41.16 ++#endif
   41.17 + 	      /* Global definition.  Just what we need.  */
   41.18 + 	      result->s = sym;
   41.19 + 	      result->m = (struct link_map *) map;
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/patches/glibc/ports-2.13/640-alpha-atfcts.patch	Tue May 03 00:19:56 2011 +0200
    42.3 @@ -0,0 +1,12 @@
    42.4 +--- glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h	2010-07-27 14:34:39.000000000 +0300
    42.5 ++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h.new	2011-03-10 18:54:37.686795979 +0200
    42.6 +@@ -437,7 +437,8 @@
    42.7 +    the code.  On PPC they were introduced in 2.6.17-rc1,
    42.8 +    on SH in 2.6.19-rc1.  */
    42.9 + #if __LINUX_KERNEL_VERSION >= 0x020611 \
   42.10 +-    && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
   42.11 ++    && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613) \
   42.12 ++    && (!defined __alpha__)
   42.13 + # define __ASSUME_ATFCTS	1
   42.14 + #endif
   42.15 + 
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/patches/glibc/ports-2.13/650-syslog.patch	Tue May 03 00:19:56 2011 +0200
    43.3 @@ -0,0 +1,12 @@
    43.4 +diff -durN glibc-cvs-2.9.orig/misc/syslog.c glibc-cvs-2.9/misc/syslog.c
    43.5 +--- glibc-cvs-2.9.orig/misc/syslog.c	2009-06-01 10:16:50.000000000 +0200
    43.6 ++++ glibc-cvs-2.9/misc/syslog.c	2009-06-01 10:17:20.000000000 +0200
    43.7 +@@ -152,7 +152,7 @@
    43.8 + #define	INTERNALLOG	LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
    43.9 + 	/* Check for invalid bits. */
   43.10 + 	if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
   43.11 +-		syslog(INTERNALLOG,
   43.12 ++		__syslog(INTERNALLOG,
   43.13 + 		    "syslog: unknown facility/priority: %x", pri);
   43.14 + 		pri &= LOG_PRIMASK|LOG_FACMASK;
   43.15 + 	}
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/patches/glibc/ports-2.13/660-debug-readlink_chk-readklinkat_chk.patch	Tue May 03 00:19:56 2011 +0200
    44.3 @@ -0,0 +1,24 @@
    44.4 +diff -dur glibc-cvs-2.9.orig/debug/readlink_chk.c glibc-cvs-2.9/debug/readlink_chk.c
    44.5 +--- glibc-cvs-2.9.orig/debug/readlink_chk.c	2005-03-01 01:41:15.000000000 +0100
    44.6 ++++ glibc-cvs-2.9/debug/readlink_chk.c	2009-06-01 10:59:37.000000000 +0200
    44.7 +@@ -25,7 +25,7 @@
    44.8 + 
    44.9 + 
   44.10 + ssize_t
   44.11 +-__readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
   44.12 ++__readlink_chk (const char *path, char *buf, size_t len, size_t buflen)
   44.13 + {
   44.14 +   if (len > buflen)
   44.15 +     __chk_fail ();
   44.16 +diff -dur glibc-cvs-2.9.orig/debug/readlinkat_chk.c glibc-cvs-2.9/debug/readlinkat_chk.c
   44.17 +--- glibc-cvs-2.9.orig/debug/readlinkat_chk.c	2006-04-24 18:56:12.000000000 +0200
   44.18 ++++ glibc-cvs-2.9/debug/readlinkat_chk.c	2009-06-01 11:07:26.000000000 +0200
   44.19 +@@ -21,7 +21,7 @@
   44.20 + 
   44.21 + 
   44.22 + ssize_t
   44.23 +-__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
   44.24 ++__readlinkat_chk (int fd, const char *path, char *buf, size_t len,
   44.25 + 		  size_t buflen)
   44.26 + {
   44.27 +   if (len > buflen)