Rename patch dir for glibc-2.9: version string is 2.9, not 2_9.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Mar 28 13:34:41 2009 +0000 (2009-03-28)
changeset 127333f0fcab7f03
parent 1272 ddac62e7c428
child 1274 96dfd5b53e38
Rename patch dir for glibc-2.9: version string is 2.9, not 2_9.
patches/glibc/2.9/100-ssp-compat.patch
patches/glibc/2.9/110-respect-env-CPPFLAGS.patch
patches/glibc/2.9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch
patches/glibc/2.9/130-add_prio-macros.patch
patches/glibc/2.9/140-regex-BZ9697.patch
patches/glibc/2.9/150-regex-BZ697.patch
patches/glibc/2.9/160-i386-x86_64-revert-clone-cfi.patch
patches/glibc/2.9/170-2.10-dns-no-gethostbyname4.patch
patches/glibc/2.9/180-math-tests.patch
patches/glibc/2.9/190-queue-header-updates.patch
patches/glibc/2.9/200-awk-in-C-locale.patch
patches/glibc/2.9/210-2.9-strlen-hack.patch
patches/glibc/2.9/220-manual-no-perl.patch
patches/glibc/2.9/230-2.3.3-localedef-fix-trampoline.patch
patches/glibc/2.9/240-i386-LOAD_PIC_REG.patch
patches/glibc/2.9/250-resolv-dynamic.patch
patches/glibc/2.9/260-fadvise64_64.patch
patches/glibc/2.9/270-ldbl-nexttowardf.patch
patches/glibc/2.9/280-section-comments.patch
patches/glibc/2.9/290-no-inline-gmon.patch
patches/glibc/2.9/300-2.9-check_native-headers.patch
patches/glibc/2.9/310-2.3.6-fix-pr631.patch
patches/glibc/2.9/320-2.9-assume-pipe2.patch
patches/glibc/2.9/330-2.3.3-china.patch
patches/glibc/2.9/340-new-valencian-locale.patch
patches/glibc/2.9/350-2.4-undefine-__i686.patch
patches/glibc/2.9/360-2.8-nscd-one-fork.patch
patches/glibc/2.9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch
patches/glibc/2.9/380-2.3.6-dl_execstack-PaX-support.patch
patches/glibc/2.9/390-2.3.3_pre20040117-pt_pax.patch
patches/glibc/2.9/400-tests-sandbox-libdl-paths.patch
patches/glibc/2.9/410-2.9-fnmatch.patch
patches/glibc/2.9/420-dont-build-timezone.patch
patches/glibc/2.9/430-2.7-cross-compile-nptl.patch
patches/glibc/2.9/440-alpha-glibc-2.4-xstat.patch
patches/glibc/2.9/450-alpha-glibc-2.5-no-page-header.patch
patches/glibc/2.9/460-alpha-glibc-2.5-no-asm-elf-header.patch
patches/glibc/2.9/470-alpha-glibc-2.8-creat.patch
patches/glibc/2.9/480-alpha-glibc-2.8-cache-shape.patch
patches/glibc/2.9/490-ptr-mangling.patch
patches/glibc/2.9/500-ppc-glibc-2.9-atomic.patch
patches/glibc/2.9/510-sh-no-asm-user-header.patch
patches/glibc/2.9/520-sh-no-asm-elf-header.patch
patches/glibc/2_9/100-ssp-compat.patch
patches/glibc/2_9/110-respect-env-CPPFLAGS.patch
patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch
patches/glibc/2_9/130-add_prio-macros.patch
patches/glibc/2_9/140-regex-BZ9697.patch
patches/glibc/2_9/150-regex-BZ697.patch
patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch
patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch
patches/glibc/2_9/180-math-tests.patch
patches/glibc/2_9/190-queue-header-updates.patch
patches/glibc/2_9/200-awk-in-C-locale.patch
patches/glibc/2_9/210-2.9-strlen-hack.patch
patches/glibc/2_9/220-manual-no-perl.patch
patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch
patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch
patches/glibc/2_9/250-resolv-dynamic.patch
patches/glibc/2_9/260-fadvise64_64.patch
patches/glibc/2_9/270-ldbl-nexttowardf.patch
patches/glibc/2_9/280-section-comments.patch
patches/glibc/2_9/290-no-inline-gmon.patch
patches/glibc/2_9/300-2.9-check_native-headers.patch
patches/glibc/2_9/310-2.3.6-fix-pr631.patch
patches/glibc/2_9/320-2.9-assume-pipe2.patch
patches/glibc/2_9/330-2.3.3-china.patch
patches/glibc/2_9/340-new-valencian-locale.patch
patches/glibc/2_9/350-2.4-undefine-__i686.patch
patches/glibc/2_9/360-2.8-nscd-one-fork.patch
patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch
patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch
patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch
patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch
patches/glibc/2_9/410-2.9-fnmatch.patch
patches/glibc/2_9/420-dont-build-timezone.patch
patches/glibc/2_9/430-2.7-cross-compile-nptl.patch
patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch
patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch
patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch
patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch
patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch
patches/glibc/2_9/490-ptr-mangling.patch
patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch
patches/glibc/2_9/510-sh-no-asm-user-header.patch
patches/glibc/2_9/520-sh-no-asm-elf-header.patch
patches/glibc/ports-2.9/100-arm_linux_tls.patch
patches/glibc/ports-2_9/100-arm_linux_tls.patch
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.9/100-ssp-compat.patch	Sat Mar 28 13:34:41 2009 +0000
     1.3 @@ -0,0 +1,193 @@
     1.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/0010_all_glibc-2.7-ssp-compat.patch
     1.5 +
     1.6 +-= BEGIN original header =-
     1.7 +Add backwards compat support for gcc-3.x ssp ... older ssp versions
     1.8 +used __guard and __stack_smash_handler symbols while gcc-4.1 and newer
     1.9 +uses __stack_chk_guard and __stack_chk_fail.
    1.10 +
    1.11 +-= END original header =-
    1.12 +
    1.13 +diff -durN glibc-2_9.orig/Versions.def glibc-2_9/Versions.def
    1.14 +--- glibc-2_9.orig/Versions.def	2008-08-01 19:13:40.000000000 +0200
    1.15 ++++ glibc-2_9/Versions.def	2009-02-02 22:00:33.000000000 +0100
    1.16 +@@ -113,6 +113,9 @@
    1.17 +   GLIBC_2.0
    1.18 +   GLIBC_2.1
    1.19 +   GLIBC_2.3
    1.20 ++%ifdef ENABLE_OLD_SSP_COMPAT
    1.21 ++  GLIBC_2.3.2
    1.22 ++%endif
    1.23 +   GLIBC_2.4
    1.24 +   GLIBC_PRIVATE
    1.25 + }
    1.26 +diff -durN glibc-2_9.orig/config.h.in glibc-2_9/config.h.in
    1.27 +--- glibc-2_9.orig/config.h.in	2007-03-26 22:40:08.000000000 +0200
    1.28 ++++ glibc-2_9/config.h.in	2009-02-02 22:00:32.000000000 +0100
    1.29 +@@ -42,6 +42,9 @@
    1.30 +    assembler instructions per line.  Default is `;'  */
    1.31 + #undef ASM_LINE_SEP
    1.32 + 
    1.33 ++/* Define if we want to enable support for old ssp symbols */
    1.34 ++#undef	ENABLE_OLD_SSP_COMPAT
    1.35 ++
    1.36 + /* Define if not using ELF, but `.init' and `.fini' sections are available.  */
    1.37 + #undef	HAVE_INITFINI
    1.38 + 
    1.39 +diff -durN glibc-2_9.orig/configure glibc-2_9/configure
    1.40 +--- glibc-2_9.orig/configure	2008-11-11 10:50:11.000000000 +0100
    1.41 ++++ glibc-2_9/configure	2009-02-02 22:00:32.000000000 +0100
    1.42 +@@ -1380,6 +1380,9 @@
    1.43 +   --enable-kernel=VERSION compile for compatibility with kernel not older than
    1.44 +                           VERSION
    1.45 +   --enable-all-warnings   enable all useful warnings gcc can issue
    1.46 ++  --disable-old-ssp-compat
    1.47 ++                          enable support for older ssp symbols
    1.48 ++                          [default=no]
    1.49 + 
    1.50 + Optional Packages:
    1.51 +   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
    1.52 +@@ -6470,6 +6473,20 @@
    1.53 + echo "${ECHO_T}$libc_cv_ssp" >&6; }
    1.54 + 
    1.55 + 
    1.56 ++# Check whether --enable-old-ssp-compat or --disable-old-ssp-compat was given.
    1.57 ++if test "${enable_old_ssp_compat+set}" = set; then
    1.58 ++  enableval="$enable_old_ssp_compat"
    1.59 ++  enable_old_ssp_compat=$enableval
    1.60 ++else
    1.61 ++  enable_old_ssp_compat=no
    1.62 ++fi;
    1.63 ++if test "x$enable_old_ssp_compat" = "xyes"; then
    1.64 ++  cat >>confdefs.h <<\_ACEOF
    1.65 ++#define ENABLE_OLD_SSP_COMPAT 1
    1.66 ++_ACEOF
    1.67 ++
    1.68 ++fi
    1.69 ++
    1.70 + { echo "$as_me:$LINENO: checking for -fgnu89-inline" >&5
    1.71 + echo $ECHO_N "checking for -fgnu89-inline... $ECHO_C" >&6; }
    1.72 + if test "${libc_cv_gnu89_inline+set}" = set; then
    1.73 +diff -durN glibc-2_9.orig/configure.in glibc-2_9/configure.in
    1.74 +--- glibc-2_9.orig/configure.in	2008-11-11 10:50:11.000000000 +0100
    1.75 ++++ glibc-2_9/configure.in	2009-02-02 22:00:32.000000000 +0100
    1.76 +@@ -1647,6 +1647,15 @@
    1.77 + rm -f conftest*])
    1.78 + AC_SUBST(libc_cv_ssp)
    1.79 + 
    1.80 ++AC_ARG_ENABLE([old-ssp-compat],
    1.81 ++	      AC_HELP_STRING([--enable-old-ssp-compat],
    1.82 ++	                     [enable support for older ssp symbols @<:@default=no@:>@]),
    1.83 ++	      [enable_old_ssp_compat=$enableval],
    1.84 ++	      [enable_old_ssp_compat=no])
    1.85 ++if test "x$enable_old_ssp_compat" = "xyes"; then
    1.86 ++  AC_DEFINE(ENABLE_OLD_SSP_COMPAT)
    1.87 ++fi
    1.88 ++
    1.89 + AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
    1.90 + cat > conftest.c <<EOF
    1.91 + int foo;
    1.92 +diff -durN glibc-2_9.orig/csu/Versions glibc-2_9/csu/Versions
    1.93 +--- glibc-2_9.orig/csu/Versions	2006-10-28 01:11:41.000000000 +0200
    1.94 ++++ glibc-2_9/csu/Versions	2009-02-02 22:00:32.000000000 +0100
    1.95 +@@ -17,6 +17,12 @@
    1.96 +     # New special glibc functions.
    1.97 +     gnu_get_libc_release; gnu_get_libc_version;
    1.98 +   }
    1.99 ++  GLIBC_2.3.2 {
   1.100 ++%ifdef ENABLE_OLD_SSP_COMPAT
   1.101 ++    # global objects and functions for the old propolice patch in gcc
   1.102 ++    __guard;
   1.103 ++%endif
   1.104 ++  }
   1.105 +   GLIBC_PRIVATE {
   1.106 + %if HAVE___THREAD
   1.107 +     # This version is for the TLS symbol, GLIBC_2.0 is the old object symbol.
   1.108 +diff -durN glibc-2_9.orig/csu/libc-start.c glibc-2_9/csu/libc-start.c
   1.109 +--- glibc-2_9.orig/csu/libc-start.c	2007-08-21 00:27:50.000000000 +0200
   1.110 ++++ glibc-2_9/csu/libc-start.c	2009-02-02 22:00:32.000000000 +0100
   1.111 +@@ -37,6 +37,9 @@
   1.112 + uintptr_t __stack_chk_guard attribute_relro;
   1.113 + # endif
   1.114 + #endif
   1.115 ++#ifdef ENABLE_OLD_SSP_COMPAT
   1.116 ++uintptr_t __guard attribute_relro;
   1.117 ++#endif
   1.118 + 
   1.119 + #ifdef HAVE_PTR_NTHREADS
   1.120 + /* We need atomic operations.  */
   1.121 +@@ -141,6 +144,9 @@
   1.122 + 
   1.123 +   /* Set up the stack checker's canary.  */
   1.124 +   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
   1.125 ++#ifdef ENABLE_OLD_SSP_COMPAT
   1.126 ++  __guard = stack_chk_guard;
   1.127 ++#endif
   1.128 + # ifdef THREAD_SET_STACK_GUARD
   1.129 +   THREAD_SET_STACK_GUARD (stack_chk_guard);
   1.130 + # else
   1.131 +diff -durN glibc-2_9.orig/debug/Versions glibc-2_9/debug/Versions
   1.132 +--- glibc-2_9.orig/debug/Versions	2008-03-05 07:53:41.000000000 +0100
   1.133 ++++ glibc-2_9/debug/Versions	2009-02-02 22:00:32.000000000 +0100
   1.134 +@@ -10,6 +10,12 @@
   1.135 +     # These are to support some gcc features.
   1.136 +     __cyg_profile_func_enter; __cyg_profile_func_exit;
   1.137 +   }
   1.138 ++%ifdef ENABLE_OLD_SSP_COMPAT
   1.139 ++  GLIBC_2.3.2 {
   1.140 ++    # backwards ssp compat support; alias to __stack_chk_fail
   1.141 ++    __stack_smash_handler;
   1.142 ++  }
   1.143 ++%endif
   1.144 +   GLIBC_2.3.4 {
   1.145 +     __chk_fail;
   1.146 +     __memcpy_chk; __memmove_chk; __mempcpy_chk; __memset_chk; __stpcpy_chk;
   1.147 +diff -durN glibc-2_9.orig/debug/stack_chk_fail.c glibc-2_9/debug/stack_chk_fail.c
   1.148 +--- glibc-2_9.orig/debug/stack_chk_fail.c	2007-05-25 01:47:08.000000000 +0200
   1.149 ++++ glibc-2_9/debug/stack_chk_fail.c	2009-02-02 22:00:32.000000000 +0100
   1.150 +@@ -28,3 +28,7 @@
   1.151 + {
   1.152 +   __fortify_fail ("stack smashing detected");
   1.153 + }
   1.154 ++
   1.155 ++#ifdef ENABLE_OLD_SSP_COMPAT
   1.156 ++strong_alias (__stack_chk_fail, __stack_smash_handler)
   1.157 ++#endif
   1.158 +diff -durN glibc-2_9.orig/elf/Versions glibc-2_9/elf/Versions
   1.159 +--- glibc-2_9.orig/elf/Versions	2008-03-08 06:42:26.000000000 +0100
   1.160 ++++ glibc-2_9/elf/Versions	2009-02-02 22:00:33.000000000 +0100
   1.161 +@@ -43,6 +43,12 @@
   1.162 +     # runtime interface to TLS
   1.163 +     __tls_get_addr;
   1.164 +   }
   1.165 ++%ifdef ENABLE_OLD_SSP_COMPAT
   1.166 ++  GLIBC_2.3.2 {
   1.167 ++    # backwards ssp compat support
   1.168 ++    __guard;
   1.169 ++  }
   1.170 ++%endif
   1.171 +   GLIBC_2.4 {
   1.172 +     # stack canary
   1.173 +     __stack_chk_guard;
   1.174 +diff -durN glibc-2_9.orig/elf/rtld.c glibc-2_9/elf/rtld.c
   1.175 +--- glibc-2_9.orig/elf/rtld.c	2008-08-14 19:01:56.000000000 +0200
   1.176 ++++ glibc-2_9/elf/rtld.c	2009-02-02 22:00:32.000000000 +0100
   1.177 +@@ -89,6 +89,9 @@
   1.178 +    in thread local area.  */
   1.179 + uintptr_t __stack_chk_guard attribute_relro;
   1.180 + #endif
   1.181 ++#ifdef ENABLE_OLD_SSP_COMPAT
   1.182 ++uintptr_t __guard attribute_relro;
   1.183 ++#endif
   1.184 + 
   1.185 + /* Only exported for architectures that don't store the pointer guard
   1.186 +    value in thread local area.  */
   1.187 +@@ -842,6 +845,9 @@
   1.188 + {
   1.189 +   /* Set up the stack checker's canary.  */
   1.190 +   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
   1.191 ++#ifdef ENABLE_OLD_SSP_COMPAT
   1.192 ++  __guard = stack_chk_guard;
   1.193 ++#endif
   1.194 + #ifdef THREAD_SET_STACK_GUARD
   1.195 +   THREAD_SET_STACK_GUARD (stack_chk_guard);
   1.196 + #else
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/glibc/2.9/110-respect-env-CPPFLAGS.patch	Sat Mar 28 13:34:41 2009 +0000
     2.3 @@ -0,0 +1,30 @@
     2.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/0030_all_glibc-respect-env-CPPFLAGS.patch
     2.5 +
     2.6 +-= BEGIN original header =-
     2.7 +Respect environment CPPFLAGS when we run ./configure so we can inject
     2.8 +random -D things without having to set CFLAGS/ASFLAGS
     2.9 +
    2.10 +-= END original header =-
    2.11 +
    2.12 +diff -durN glibc-2_9.orig/Makeconfig glibc-2_9/Makeconfig
    2.13 +--- glibc-2_9.orig/Makeconfig	2008-08-18 11:42:17.000000000 +0200
    2.14 ++++ glibc-2_9/Makeconfig	2009-02-02 22:00:35.000000000 +0100
    2.15 +@@ -673,6 +673,7 @@
    2.16 + 	   $(foreach lib,$(libof-$(basename $(@F))) \
    2.17 + 		         $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
    2.18 + 	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
    2.19 ++CPPFLAGS += $(CPPFLAGS-config)
    2.20 + override CFLAGS	= -std=gnu99 $(gnu89-inline-CFLAGS) \
    2.21 + 		  $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
    2.22 + 		  $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
    2.23 +diff -durN glibc-2_9.orig/config.make.in glibc-2_9/config.make.in
    2.24 +--- glibc-2_9.orig/config.make.in	2008-08-18 11:42:17.000000000 +0200
    2.25 ++++ glibc-2_9/config.make.in	2009-02-02 22:00:35.000000000 +0100
    2.26 +@@ -97,6 +97,7 @@
    2.27 + CXX = @CXX@
    2.28 + BUILD_CC = @BUILD_CC@
    2.29 + CFLAGS = @CFLAGS@
    2.30 ++CPPFLAGS-config = @CPPFLAGS@
    2.31 + ASFLAGS-config = @ASFLAGS_config@
    2.32 + AR = @AR@
    2.33 + RANLIB = @RANLIB@
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/glibc/2.9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch	Sat Mar 28 13:34:41 2009 +0000
     3.3 @@ -0,0 +1,35 @@
     3.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/0050_all_glibc-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch
     3.5 +
     3.6 +-= BEGIN original header =-
     3.7 +http://sourceware.org/ml/libc-alpha/2009-01/msg00000.html
     3.8 +
     3.9 +From 8ad7030880eaa18dcabf8e284e79026301fd3fa4 Mon Sep 17 00:00:00 2001
    3.10 +From: Ulrich Drepper <drepper@redhat.com>
    3.11 +Date: Thu, 8 Jan 2009 00:02:38 +0000
    3.12 +Subject: [PATCH] (_nss_dns_gethostbyaddr2_r): Check and adjust the buffer alignment.
    3.13 +
    3.14 +-= END original header =-
    3.15 +
    3.16 +diff -durN glibc-2_9.orig/resolv/nss_dns/dns-host.c glibc-2_9/resolv/nss_dns/dns-host.c
    3.17 +--- glibc-2_9.orig/resolv/nss_dns/dns-host.c	2008-11-12 08:52:20.000000000 +0100
    3.18 ++++ glibc-2_9/resolv/nss_dns/dns-host.c	2009-02-02 22:00:36.000000000 +0100
    3.19 +@@ -364,6 +364,19 @@
    3.20 +   int n, status;
    3.21 +   int olderr = errno;
    3.22 + 
    3.23 ++ uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
    3.24 ++ buffer += pad;
    3.25 ++ buflen = buflen > pad ? buflen - pad : 0;
    3.26 ++
    3.27 ++ if (__builtin_expect (buflen < sizeof (struct host_data), 0))
    3.28 ++   {
    3.29 ++     *errnop = ERANGE;
    3.30 ++     *h_errnop = NETDB_INTERNAL;
    3.31 ++     return NSS_STATUS_TRYAGAIN;
    3.32 ++   }
    3.33 ++
    3.34 ++ host_data = (struct host_data *) buffer;
    3.35 ++
    3.36 +   if (__res_maybe_init (&_res, 0) == -1)
    3.37 +     return NSS_STATUS_UNAVAIL;
    3.38 + 
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/patches/glibc/2.9/130-add_prio-macros.patch	Sat Mar 28 13:34:41 2009 +0000
     4.3 @@ -0,0 +1,26 @@
     4.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/0051_all_glibc-2.9-add_prio-macros.patch
     4.5 +
     4.6 +-= BEGIN original header =-
     4.7 +http://sourceware.org/ml/libc-alpha/2009-01/msg00003.html
     4.8 +
     4.9 +From a1737958e074e8f990760acc8abeb0c23715a859 Mon Sep 17 00:00:00 2001
    4.10 +From: Roland McGrath <roland@gnu.org>
    4.11 +Date: Sat, 3 Jan 2009 21:04:01 +0000
    4.12 +Subject: [PATCH] 2009-01-03  Samuel Thibault  <samuel.thibault@ens-lyon.org>
    4.13 +
    4.14 +	* bits/resource.h (PRIO_PROCESS, PRIO_PGRP, PRIO_USER): Add macros.
    4.15 +-= END original header =-
    4.16 +
    4.17 +diff -durN glibc-2_9.orig/bits/resource.h glibc-2_9/bits/resource.h
    4.18 +--- glibc-2_9.orig/bits/resource.h	2006-03-05 23:48:10.000000000 +0100
    4.19 ++++ glibc-2_9/bits/resource.h	2009-02-02 22:00:38.000000000 +0100
    4.20 +@@ -185,6 +185,9 @@
    4.21 + enum __priority_which
    4.22 +   {
    4.23 +     PRIO_PROCESS = 0,           /* WHO is a process ID.  */
    4.24 ++#define PRIO_PROCESS PRIO_PROCESS
    4.25 +     PRIO_PGRP = 1,              /* WHO is a process group ID.  */
    4.26 ++#define PRIO_PGRP PRIO_PGRP
    4.27 +     PRIO_USER = 2               /* WHO is a user ID.  */
    4.28 ++#define PRIO_USER PRIO_USER
    4.29 +   };
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/patches/glibc/2.9/140-regex-BZ9697.patch	Sat Mar 28 13:34:41 2009 +0000
     5.3 @@ -0,0 +1,111 @@
     5.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/0052_all_glibc-2.9-regex-BZ9697.patch
     5.5 +
     5.6 +-= BEGIN original header =-
     5.7 +http://sourceware.org/ml/libc-alpha/2009-01/msg00005.html
     5.8 +
     5.9 +From ea8ca0dfcbf2721bcf2c08ce3c01d5764b827572 Mon Sep 17 00:00:00 2001
    5.10 +From: Ulrich Drepper <drepper@redhat.com>
    5.11 +Date: Thu, 8 Jan 2009 00:42:28 +0000
    5.12 +Subject: [PATCH] (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET handling.
    5.13 +
    5.14 +-= END original header =-
    5.15 +
    5.16 +diff -durN glibc-2_9.orig/posix/regcomp.c glibc-2_9/posix/regcomp.c
    5.17 +--- glibc-2_9.orig/posix/regcomp.c	2008-05-15 05:07:21.000000000 +0200
    5.18 ++++ glibc-2_9/posix/regcomp.c	2009-02-02 22:00:41.000000000 +0100
    5.19 +@@ -350,47 +350,67 @@
    5.20 + #ifdef RE_ENABLE_I18N
    5.21 +       else if (type == COMPLEX_BRACKET)
    5.22 + 	{
    5.23 +-	  int i;
    5.24 + 	  re_charset_t *cset = dfa->nodes[node].opr.mbcset;
    5.25 +-	  if (cset->non_match || cset->ncoll_syms || cset->nequiv_classes
    5.26 +-	      || cset->nranges || cset->nchar_classes)
    5.27 +-	    {
    5.28 ++	  int i;
    5.29 ++
    5.30 + # ifdef _LIBC
    5.31 +-	      if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0)
    5.32 ++	  /* See if we have to try all bytes which start multiple collation
    5.33 ++	     elements.
    5.34 ++	     e.g. In da_DK, we want to catch 'a' since "aa" is a valid
    5.35 ++		  collation element, and don't catch 'b' since 'b' is
    5.36 ++		  the only collation element which starts from 'b' (and
    5.37 ++		  it is caught by SIMPLE_BRACKET).  */
    5.38 ++	      if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0
    5.39 ++		  && (cset->ncoll_syms || cset->nranges))
    5.40 + 		{
    5.41 +-		  /* In this case we want to catch the bytes which are
    5.42 +-		     the first byte of any collation elements.
    5.43 +-		     e.g. In da_DK, we want to catch 'a' since "aa"
    5.44 +-			  is a valid collation element, and don't catch
    5.45 +-			  'b' since 'b' is the only collation element
    5.46 +-			  which starts from 'b'.  */
    5.47 + 		  const int32_t *table = (const int32_t *)
    5.48 + 		    _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
    5.49 + 		  for (i = 0; i < SBC_MAX; ++i)
    5.50 + 		    if (table[i] < 0)
    5.51 + 		      re_set_fastmap (fastmap, icase, i);
    5.52 + 		}
    5.53 +-# else
    5.54 +-	      if (dfa->mb_cur_max > 1)
    5.55 +-		for (i = 0; i < SBC_MAX; ++i)
    5.56 +-		  if (__btowc (i) == WEOF)
    5.57 +-		    re_set_fastmap (fastmap, icase, i);
    5.58 +-# endif /* not _LIBC */
    5.59 +-	    }
    5.60 +-	  for (i = 0; i < cset->nmbchars; ++i)
    5.61 ++# endif /* _LIBC */
    5.62 ++
    5.63 ++	  /* See if we have to start the match at all multibyte characters,
    5.64 ++	     i.e. where we would not find an invalid sequence.  This only
    5.65 ++	     applies to multibyte character sets; for single byte character
    5.66 ++	     sets, the SIMPLE_BRACKET again suffices.  */
    5.67 ++	  if (dfa->mb_cur_max > 1
    5.68 ++	      && (cset->nchar_classes || cset->non_match
    5.69 ++# ifdef _LIBC
    5.70 ++		  || cset->nequiv_classes
    5.71 ++# endif /* _LIBC */
    5.72 ++		 ))
    5.73 + 	    {
    5.74 +-	      char buf[256];
    5.75 +-	      mbstate_t state;
    5.76 +-	      memset (&state, '\0', sizeof (state));
    5.77 +-	      if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
    5.78 +-		re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
    5.79 +-	      if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
    5.80 ++	      unsigned char c = 0;
    5.81 ++	      do
    5.82 + 		{
    5.83 +-		  if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
    5.84 +-		      != (size_t) -1)
    5.85 +-		    re_set_fastmap (fastmap, 0, *(unsigned char *) buf);
    5.86 ++		  mbstate_t mbs;
    5.87 ++		  memset (&mbs, 0, sizeof (mbs));
    5.88 ++		  if (__mbrtowc (NULL, (char *) &c, 1, &mbs) == (size_t) -2)
    5.89 ++		    re_set_fastmap (fastmap, false, (int) c);
    5.90 + 		}
    5.91 ++	      while (++c != 0);
    5.92 + 	    }
    5.93 ++
    5.94 ++	  else
    5.95 ++	    {
    5.96 ++	      /* ... Else catch all bytes which can start the mbchars.  */
    5.97 ++	      for (i = 0; i < cset->nmbchars; ++i)
    5.98 ++		{
    5.99 ++		  char buf[256];
   5.100 ++		  mbstate_t state;
   5.101 ++		  memset (&state, '\0', sizeof (state));
   5.102 ++		  if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
   5.103 ++		    re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
   5.104 ++		  if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
   5.105 ++		    {
   5.106 ++		      if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
   5.107 ++			  != (size_t) -1)
   5.108 ++			re_set_fastmap (fastmap, false, *(unsigned char *) buf);
   5.109 ++		    }
   5.110 ++ 		}
   5.111 ++ 	    }
   5.112 + 	}
   5.113 + #endif /* RE_ENABLE_I18N */
   5.114 +       else if (type == OP_PERIOD
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/patches/glibc/2.9/150-regex-BZ697.patch	Sat Mar 28 13:34:41 2009 +0000
     6.3 @@ -0,0 +1,28 @@
     6.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/0053_all_glibc-2.9-regex-BZ697.patch
     6.5 +
     6.6 +-= BEGIN original header =-
     6.7 +http://sourceware.org/ml/libc-alpha/2009-01/msg00006.html
     6.8 +
     6.9 +From 37bdc055ceeb6b1144c07448a7210d9ab3fbb2f5 Mon Sep 17 00:00:00 2001
    6.10 +From: Ulrich Drepper <drepper@redhat.com>
    6.11 +Date: Thu, 8 Jan 2009 00:47:05 +0000
    6.12 +Subject: [PATCH] (prune_impossible_nodes): Handle sifted_states[0] being NULL also if
    6.13 + there are no backreferences.
    6.14 +
    6.15 +-= END original header =-
    6.16 +
    6.17 +diff -durN glibc-2_9.orig/posix/regexec.c glibc-2_9/posix/regexec.c
    6.18 +--- glibc-2_9.orig/posix/regexec.c	2007-10-12 19:47:13.000000000 +0200
    6.19 ++++ glibc-2_9/posix/regexec.c	2009-02-02 22:00:43.000000000 +0100
    6.20 +@@ -1004,6 +1004,11 @@
    6.21 +       re_node_set_free (&sctx.limits);
    6.22 +       if (BE (ret != REG_NOERROR, 0))
    6.23 + 	goto free_return;
    6.24 ++      if (sifted_states[0] == NULL)
    6.25 ++	{
    6.26 ++	  ret = REG_NOMATCH;
    6.27 ++	  goto free_return;
    6.28 ++	}
    6.29 +     }
    6.30 +   re_free (mctx->state_log);
    6.31 +   mctx->state_log = sifted_states;
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/patches/glibc/2.9/160-i386-x86_64-revert-clone-cfi.patch	Sat Mar 28 13:34:41 2009 +0000
     7.3 @@ -0,0 +1,53 @@
     7.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/0070_all_glibc-i386-x86_64-revert-clone-cfi.patch
     7.5 +
     7.6 +-= BEGIN original header =-
     7.7 +revert cfi additions to clone on i386/x86_64 to workaround problems in
     7.8 +gcc's unwinder code.  this is not a bug in glibc, it triggers problems
     7.9 +elsewhere.  this cfi code does not gain us a whole lot anyways.
    7.10 +
    7.11 +http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
    7.12 +
    7.13 +-= END original header =-
    7.14 +
    7.15 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2_9/sysdeps/unix/sysv/linux/i386/clone.S
    7.16 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/i386/clone.S	2006-12-04 00:12:36.000000000 +0100
    7.17 ++++ glibc-2_9/sysdeps/unix/sysv/linux/i386/clone.S	2009-02-02 22:00:45.000000000 +0100
    7.18 +@@ -120,9 +120,6 @@
    7.19 + 	ret
    7.20 + 
    7.21 + L(thread_start):
    7.22 +-	cfi_startproc;
    7.23 +-	/* Clearing frame pointer is insufficient, use CFI.  */
    7.24 +-	cfi_undefined (eip);
    7.25 + 	/* Note: %esi is zero.  */
    7.26 + 	movl	%esi,%ebp	/* terminate the stack frame */
    7.27 + #ifdef RESET_PID
    7.28 +@@ -155,7 +152,6 @@
    7.29 + 	jmp	L(haspid)
    7.30 + 	.previous
    7.31 + #endif
    7.32 +-	cfi_endproc;
    7.33 + 
    7.34 + 	cfi_startproc
    7.35 + PSEUDO_END (BP_SYM (__clone))
    7.36 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2_9/sysdeps/unix/sysv/linux/x86_64/clone.S
    7.37 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/x86_64/clone.S	2006-12-04 00:12:36.000000000 +0100
    7.38 ++++ glibc-2_9/sysdeps/unix/sysv/linux/x86_64/clone.S	2009-02-02 22:00:45.000000000 +0100
    7.39 +@@ -89,9 +89,6 @@
    7.40 + 	ret
    7.41 + 
    7.42 + L(thread_start):
    7.43 +-	cfi_startproc;
    7.44 +-	/* Clearing frame pointer is insufficient, use CFI.  */
    7.45 +-	cfi_undefined (rip);
    7.46 + 	/* Clear the frame pointer.  The ABI suggests this be done, to mark
    7.47 + 	   the outermost frame obviously.  */
    7.48 + 	xorl	%ebp, %ebp
    7.49 +@@ -116,7 +113,6 @@
    7.50 + 	/* Call exit with return value from function call. */
    7.51 + 	movq	%rax, %rdi
    7.52 + 	call	HIDDEN_JUMPTARGET (_exit)
    7.53 +-	cfi_endproc;
    7.54 + 
    7.55 + 	cfi_startproc;
    7.56 + PSEUDO_END (BP_SYM (__clone))
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/patches/glibc/2.9/170-2.10-dns-no-gethostbyname4.patch	Sat Mar 28 13:34:41 2009 +0000
     8.3 @@ -0,0 +1,35 @@
     8.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/0080_all_glibc-2.10-dns-no-gethostbyname4.patch
     8.5 +
     8.6 +-= BEGIN original header =-
     8.7 +http://sourceware.org/bugzilla/show_bug.cgi?id=7060
     8.8 +http://bugs.gentoo.org/250468
     8.9 +
    8.10 +The gethostbyname4() lookup method is problematic since it fires out both
    8.11 +the A and AAAA DNS queries in parallel and over the same socket. This
    8.12 +should work in theory, but it turns out that many cheap DSL modems and
    8.13 +similar devices have buggy DNS servers - if the AAAA query arrives too
    8.14 +quickly after the A query, the server will generate only a single reply
    8.15 +with the A query id but returning an error for the AAAA query; we get
    8.16 +stuck waiting for the second reply.
    8.17 +
    8.18 +For gethostbyname4() users affected, disabling IPv6 in the system might
    8.19 +work around the issue, unfortunately it only helps with applications
    8.20 +using AI_ADDRCONFIG (e.g. Firefox); some (notably e.g. Pidgin) neglect
    8.21 +to do that.
    8.22 +
    8.23 +Real fix should be using separate ports for the A and AAAA queries.
    8.24 +
    8.25 +-= END original header =-
    8.26 +
    8.27 +diff -durN glibc-2_9.orig/resolv/Versions glibc-2_9/resolv/Versions
    8.28 +--- glibc-2_9.orig/resolv/Versions	2008-08-01 19:15:34.000000000 +0200
    8.29 ++++ glibc-2_9/resolv/Versions	2009-02-02 22:00:46.000000000 +0100
    8.30 +@@ -102,7 +102,7 @@
    8.31 +     _nss_dns_gethostbyname_r; _nss_dns_getnetbyaddr_r;
    8.32 +     _nss_dns_getnetbyname_r; _nss_dns_getcanonname_r;
    8.33 +     _nss_dns_gethostbyaddr2_r;
    8.34 +-    _nss_dns_gethostbyname4_r;
    8.35 ++#    _nss_dns_gethostbyname4_r;
    8.36 +   }
    8.37 + }
    8.38 + 
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/patches/glibc/2.9/180-math-tests.patch	Sat Mar 28 13:34:41 2009 +0000
     9.3 @@ -0,0 +1,72 @@
     9.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/0090_all_glibc-math-tests.patch
     9.5 +
     9.6 +-= BEGIN original header =-
     9.7 +From: "Joseph S. Myers" <joseph at codesourcery dot com>
     9.8 +To: libc-alpha at sourceware dot org
     9.9 +Date: Tue, 15 Jul 2008 14:43:04 +0000 (UTC)
    9.10 +Subject: expm1 ulps
    9.11 +
    9.12 +If you test glibc on i686 with GCC 4.3, you get a test-ildoubl failure:
    9.13 +
    9.14 +Failure: Test: expm1 (1) == M_El - 1.0
    9.15 +Result:
    9.16 + is:          1.71828182845904523532e+00   0xd.bf0a8b14576953500000p-3
    9.17 + should be:   1.71828182845904523543e+00   0xd.bf0a8b14576953600000p-3
    9.18 + difference:  1.08420217248550443401e-19   0x8.00000000000000000000p-66
    9.19 + ulp       :  1.0000
    9.20 + max.ulp   :  0.0000
    9.21 +Maximal error of `expm1'
    9.22 + is      : 1 ulp
    9.23 + accepted: 0 ulp
    9.24 +
    9.25 +What happens is that the inline expansion of expm1l uses __builtin_expm1l,
    9.26 +and GCC 4.3 optimizes calls to __builtin_expm1l with constant argument to
    9.27 +a correctly rounded result using MPFR.  The result returned is thus the
    9.28 +value of e-1 rounded once to long double precision.  However, the test
    9.29 +expects M_El - 1.0, and the result of rounding e to long double precision,
    9.30 +then subtracting 1, differs in the last place from the result of rounding
    9.31 +e-1 to long double precision (the latter has smaller exponent, and the
    9.32 +last bit is 1).
    9.33 +
    9.34 +There are two obvious approaches possible to fixing this.  The first patch
    9.35 +below changes the expectation to a decimal expansion for e-1 (taken from
    9.36 +that of M_El) rather than doing arithmetic in the expected value.  This in
    9.37 +turn requires ulps to be set for the out-of-line version of expm1.  It
    9.38 +might also need ulps to be set for the inline version for older compilers
    9.39 +if they should continue to pass the test, and possibly for other targets.
    9.40 +The second patch below takes the alternative approach of keeping the
    9.41 +existing expectation (which has the wrong bit in the last place) and
    9.42 +setting ulps for the inline expansion of expm1, which avoids the risk of
    9.43 +breaking the test for other targets.
    9.44 +
    9.45 +2008-07-15  Joseph Myers  <joseph@codesourcery.com>
    9.46 +
    9.47 +        * sysdeps/i386/fpu/libm-test-ulps: Add inline long double ulps for
    9.48 +        expm1.
    9.49 +
    9.50 +-= END original header =-
    9.51 +
    9.52 +diff -durN glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps glibc-2_9/sysdeps/i386/fpu/libm-test-ulps
    9.53 +--- glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps	2006-01-15 18:59:37.000000000 +0100
    9.54 ++++ glibc-2_9/sysdeps/i386/fpu/libm-test-ulps	2009-02-02 22:00:47.000000000 +0100
    9.55 +@@ -453,6 +453,10 @@
    9.56 + ildouble: 8
    9.57 + ldouble: 8
    9.58 + 
    9.59 ++# expm1
    9.60 ++Test "expm1 (1) == M_El - 1.0":
    9.61 ++ildouble: 1
    9.62 ++
    9.63 + # gamma
    9.64 + Test "gamma (-0.5) == log(2*sqrt(pi))":
    9.65 + double: 1
    9.66 +@@ -1134,6 +1138,9 @@
    9.67 + ildouble: 8
    9.68 + ldouble: 8
    9.69 + 
    9.70 ++Function: "expm1":
    9.71 ++ildouble: 1
    9.72 ++
    9.73 + Function: "gamma":
    9.74 + double: 1
    9.75 + idouble: 1
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/patches/glibc/2.9/190-queue-header-updates.patch	Sat Mar 28 13:34:41 2009 +0000
    10.3 @@ -0,0 +1,89 @@
    10.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1010_all_glibc-queue-header-updates.patch
    10.5 +
    10.6 +-= BEGIN original header =-
    10.7 +grab some updates from FreeBSD
    10.8 +
    10.9 +http://bugs.gentoo.org/201979
   10.10 +
   10.11 +-= END original header =-
   10.12 +
   10.13 +diff -durN glibc-2_9.orig/misc/sys/queue.h glibc-2_9/misc/sys/queue.h
   10.14 +--- glibc-2_9.orig/misc/sys/queue.h	2008-03-05 06:50:30.000000000 +0100
   10.15 ++++ glibc-2_9/misc/sys/queue.h	2009-02-02 22:00:48.000000000 +0100
   10.16 +@@ -136,6 +136,11 @@
   10.17 + 		(var);							\
   10.18 + 		(var) = ((var)->field.le_next))
   10.19 + 
   10.20 ++#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
   10.21 ++	for ((var) = LIST_FIRST((head));				\
   10.22 ++	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
   10.23 ++	    (var) = (tvar))
   10.24 ++
   10.25 + /*
   10.26 +  * List access methods.
   10.27 +  */
   10.28 +@@ -197,6 +202,16 @@
   10.29 + #define	SLIST_FOREACH(var, head, field)					\
   10.30 + 	for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
   10.31 + 
   10.32 ++#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
   10.33 ++	for ((var) = SLIST_FIRST((head));				\
   10.34 ++	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
   10.35 ++	    (var) = (tvar))
   10.36 ++
   10.37 ++#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
   10.38 ++	for ((varp) = &SLIST_FIRST((head));				\
   10.39 ++	    ((var) = *(varp)) != NULL;					\
   10.40 ++	    (varp) = &SLIST_NEXT((var), field))
   10.41 ++
   10.42 + /*
   10.43 +  * Singly-linked List access methods.
   10.44 +  */
   10.45 +@@ -242,6 +257,12 @@
   10.46 + 	(head)->stqh_last = &(elm)->field.stqe_next;			\
   10.47 + } while (/*CONSTCOND*/0)
   10.48 + 
   10.49 ++#define	STAILQ_LAST(head, type, field)					\
   10.50 ++	(STAILQ_EMPTY((head)) ?						\
   10.51 ++		NULL :							\
   10.52 ++	        ((struct type *)(void *)				\
   10.53 ++		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
   10.54 ++
   10.55 + #define	STAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
   10.56 + 	if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
   10.57 + 		(head)->stqh_last = &(elm)->field.stqe_next;		\
   10.58 +@@ -286,6 +307,11 @@
   10.59 + #define	STAILQ_FIRST(head)	((head)->stqh_first)
   10.60 + #define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
   10.61 + 
   10.62 ++#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
   10.63 ++	for ((var) = STAILQ_FIRST((head));				\
   10.64 ++	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
   10.65 ++	    (var) = (tvar))
   10.66 ++
   10.67 + 
   10.68 + /*
   10.69 +  * Simple queue definitions.
   10.70 +@@ -437,11 +463,22 @@
   10.71 + 		(var);							\
   10.72 + 		(var) = ((var)->field.tqe_next))
   10.73 + 
   10.74 ++#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
   10.75 ++	for ((var) = TAILQ_FIRST((head));				\
   10.76 ++	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
   10.77 ++	    (var) = (tvar))
   10.78 ++
   10.79 + #define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
   10.80 + 	for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));	\
   10.81 + 		(var);							\
   10.82 + 		(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
   10.83 + 
   10.84 ++#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
   10.85 ++	for ((var) = TAILQ_LAST((head), headname);			\
   10.86 ++	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
   10.87 ++	    (var) = (tvar))
   10.88 ++
   10.89 ++
   10.90 + #define	TAILQ_CONCAT(head1, head2, field) do {				\
   10.91 + 	if (!TAILQ_EMPTY(head2)) {					\
   10.92 + 		*(head1)->tqh_last = (head2)->tqh_first;		\
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/patches/glibc/2.9/200-awk-in-C-locale.patch	Sat Mar 28 13:34:41 2009 +0000
    11.3 @@ -0,0 +1,23 @@
    11.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1018_all_glibc-awk-in-C-locale.patch
    11.5 +
    11.6 +-= BEGIN original header =-
    11.7 +http://bugs.gentoo.org/252802
    11.8 +
    11.9 +2008-12-29  Mike Frysinger  <vapier@gentoo.org>
   11.10 +
   11.11 +	* iconvdata/Makefile (iconv-rules): Use LC_ALL=C when running awk script.
   11.12 +
   11.13 +-= END original header =-
   11.14 +
   11.15 +diff -durN glibc-2_9.orig/iconvdata/Makefile glibc-2_9/iconvdata/Makefile
   11.16 +--- glibc-2_9.orig/iconvdata/Makefile	2008-05-15 03:54:31.000000000 +0200
   11.17 ++++ glibc-2_9/iconvdata/Makefile	2009-02-02 22:00:50.000000000 +0100
   11.18 +@@ -286,7 +286,7 @@
   11.19 + 	{ echo $(filter-out lib%, $(modules)); \
   11.20 + 	  echo 8bit $(gen-8bit-modules); \
   11.21 + 	  echo 8bit-gap $(gen-8bit-gap-modules); } | \
   11.22 +-	$(AWK) 'NR == 1 { \
   11.23 ++	LC_ALL=C $(AWK) 'NR == 1 { \
   11.24 + 		  for (i = 1; i <= NF; i++) { \
   11.25 + 		    printf "%s-routines := %s\n", $$i, tolower($$i); \
   11.26 + 		    printf "%s-map := gconv.map\n", $$i; \
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/patches/glibc/2.9/210-2.9-strlen-hack.patch	Sat Mar 28 13:34:41 2009 +0000
    12.3 @@ -0,0 +1,109 @@
    12.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1020_all_glibc-2.9-strlen-hack.patch
    12.5 +
    12.6 +-= BEGIN original header =-
    12.7 +http://sourceware.org/bugzilla/show_bug.cgi?id=5807
    12.8 +http://www.cl.cam.ac.uk/~am21/progtricks.html
    12.9 +
   12.10 +-= END original header =-
   12.11 +
   12.12 +diff -durN glibc-2_9.orig/string/strlen.c glibc-2_9/string/strlen.c
   12.13 +--- glibc-2_9.orig/string/strlen.c	2005-12-14 12:09:07.000000000 +0100
   12.14 ++++ glibc-2_9/string/strlen.c	2009-02-02 22:00:51.000000000 +0100
   12.15 +@@ -32,7 +32,7 @@
   12.16 + {
   12.17 +   const char *char_ptr;
   12.18 +   const unsigned long int *longword_ptr;
   12.19 +-  unsigned long int longword, magic_bits, himagic, lomagic;
   12.20 ++  unsigned long int longword, himagic, lomagic;
   12.21 + 
   12.22 +   /* Handle the first few characters by reading one character at a time.
   12.23 +      Do this until CHAR_PTR is aligned on a longword boundary.  */
   12.24 +@@ -42,28 +42,14 @@
   12.25 +     if (*char_ptr == '\0')
   12.26 +       return char_ptr - str;
   12.27 + 
   12.28 +-  /* All these elucidatory comments refer to 4-byte longwords,
   12.29 +-     but the theory applies equally well to 8-byte longwords.  */
   12.30 +-
   12.31 +   longword_ptr = (unsigned long int *) char_ptr;
   12.32 + 
   12.33 +-  /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
   12.34 +-     the "holes."  Note that there is a hole just to the left of
   12.35 +-     each byte, with an extra at the end:
   12.36 +-
   12.37 +-     bits:  01111110 11111110 11111110 11111111
   12.38 +-     bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
   12.39 +-
   12.40 +-     The 1-bits make sure that carries propagate to the next 0-bit.
   12.41 +-     The 0-bits provide holes for carries to fall into.  */
   12.42 +-  magic_bits = 0x7efefeffL;
   12.43 +   himagic = 0x80808080L;
   12.44 +   lomagic = 0x01010101L;
   12.45 +   if (sizeof (longword) > 4)
   12.46 +     {
   12.47 +       /* 64-bit version of the magic.  */
   12.48 +       /* Do the shift in two steps to avoid a warning if long has 32 bits.  */
   12.49 +-      magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
   12.50 +       himagic = ((himagic << 16) << 16) | himagic;
   12.51 +       lomagic = ((lomagic << 16) << 16) | lomagic;
   12.52 +     }
   12.53 +@@ -75,56 +61,12 @@
   12.54 +      if *any of the four* bytes in the longword in question are zero.  */
   12.55 +   for (;;)
   12.56 +     {
   12.57 +-      /* We tentatively exit the loop if adding MAGIC_BITS to
   12.58 +-	 LONGWORD fails to change any of the hole bits of LONGWORD.
   12.59 +-
   12.60 +-	 1) Is this safe?  Will it catch all the zero bytes?
   12.61 +-	 Suppose there is a byte with all zeros.  Any carry bits
   12.62 +-	 propagating from its left will fall into the hole at its
   12.63 +-	 least significant bit and stop.  Since there will be no
   12.64 +-	 carry from its most significant bit, the LSB of the
   12.65 +-	 byte to the left will be unchanged, and the zero will be
   12.66 +-	 detected.
   12.67 +-
   12.68 +-	 2) Is this worthwhile?  Will it ignore everything except
   12.69 +-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
   12.70 +-	 somewhere.  There will be a carry into bit 8.  If bit 8
   12.71 +-	 is set, this will carry into bit 16.  If bit 8 is clear,
   12.72 +-	 one of bits 9-15 must be set, so there will be a carry
   12.73 +-	 into bit 16.  Similarly, there will be a carry into bit
   12.74 +-	 24.  If one of bits 24-30 is set, there will be a carry
   12.75 +-	 into bit 31, so all of the hole bits will be changed.
   12.76 +-
   12.77 +-	 The one misfire occurs when bits 24-30 are clear and bit
   12.78 +-	 31 is set; in this case, the hole at bit 31 is not
   12.79 +-	 changed.  If we had access to the processor carry flag,
   12.80 +-	 we could close this loophole by putting the fourth hole
   12.81 +-	 at bit 32!
   12.82 +-
   12.83 +-	 So it ignores everything except 128's, when they're aligned
   12.84 +-	 properly.  */
   12.85 +-
   12.86 +       longword = *longword_ptr++;
   12.87 + 
   12.88 +-      if (
   12.89 +-#if 0
   12.90 +-	  /* Add MAGIC_BITS to LONGWORD.  */
   12.91 +-	  (((longword + magic_bits)
   12.92 +-
   12.93 +-	    /* Set those bits that were unchanged by the addition.  */
   12.94 +-	    ^ ~longword)
   12.95 +-
   12.96 +-	   /* Look at only the hole bits.  If any of the hole bits
   12.97 +-	      are unchanged, most likely one of the bytes was a
   12.98 +-	      zero.  */
   12.99 +-	   & ~magic_bits)
  12.100 +-#else
  12.101 +-	  ((longword - lomagic) & himagic)
  12.102 +-#endif
  12.103 +-	  != 0)
  12.104 ++      /* This hack taken from Alan Mycroft's HAKMEMC postings.
  12.105 ++         See: http://www.cl.cam.ac.uk/~am21/progtricks.html */
  12.106 ++      if (((longword - lomagic) & ~longword & himagic) != 0)
  12.107 + 	{
  12.108 +-	  /* Which of the bytes was the zero?  If none of them were, it was
  12.109 +-	     a misfire; continue the search.  */
  12.110 + 
  12.111 + 	  const char *cp = (const char *) (longword_ptr - 1);
  12.112 + 
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/patches/glibc/2.9/220-manual-no-perl.patch	Sat Mar 28 13:34:41 2009 +0000
    13.3 @@ -0,0 +1,29 @@
    13.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1030_all_glibc-manual-no-perl.patch
    13.5 +
    13.6 +-= BEGIN original header =-
    13.7 +If we're using a cvs snapshot which updates the source files, and
    13.8 +perl isn't installed yet, then we can't regen the docs.  Not a big
    13.9 +deal, so just whine a little and continue on our merry way.
   13.10 +
   13.11 +http://bugs.gentoo.org/60132
   13.12 +
   13.13 +-= END original header =-
   13.14 +
   13.15 +diff -durN glibc-2_9.orig/manual/Makefile glibc-2_9/manual/Makefile
   13.16 +--- glibc-2_9.orig/manual/Makefile	2006-01-08 07:43:47.000000000 +0100
   13.17 ++++ glibc-2_9/manual/Makefile	2009-02-02 22:00:53.000000000 +0100
   13.18 +@@ -104,9 +104,14 @@
   13.19 + libm-err.texi: stamp-libm-err
   13.20 + stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
   13.21 + 						     $(dir)/libm-test-ulps))
   13.22 ++ifneq ($(PERL),no)
   13.23 + 	pwd=`pwd`; \
   13.24 + 	$(PERL) $< $$pwd/.. > libm-err-tmp
   13.25 + 	$(move-if-change) libm-err-tmp libm-err.texi
   13.26 ++else
   13.27 ++	echo "Unable to rebuild math docs, no perl installed"
   13.28 ++	touch libm-err.texi
   13.29 ++endif
   13.30 + 	touch $@
   13.31 + 
   13.32 + # Generate Texinfo files from the C source for the example programs.
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/patches/glibc/2.9/230-2.3.3-localedef-fix-trampoline.patch	Sat Mar 28 13:34:41 2009 +0000
    14.3 @@ -0,0 +1,74 @@
    14.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1040_all_2.3.3-localedef-fix-trampoline.patch
    14.5 +
    14.6 +-= BEGIN original header =-
    14.7 +#! /bin/sh -e
    14.8 +
    14.9 +# DP: Description: Fix localedef segfault when run under exec-shield,
   14.10 +#        PaX or similar. (#231438, #198099)
   14.11 +# DP: Dpatch Author: James Troup <james@nocrew.org>
   14.12 +# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
   14.13 +# DP: Upstream status: Unknown
   14.14 +# DP: Status Details: Unknown
   14.15 +# DP: Date: 2004-03-16
   14.16 +
   14.17 +if [ $# -ne 2 ]; then
   14.18 +    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
   14.19 +    exit 1
   14.20 +fi
   14.21 +case "$1" in
   14.22 +    -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
   14.23 +    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
   14.24 +    *)
   14.25 +	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
   14.26 +	exit 1
   14.27 +esac
   14.28 +exit 0
   14.29 +
   14.30 +-= END original header =-
   14.31 +
   14.32 +diff -durN glibc-2_9.orig/locale/programs/3level.h glibc-2_9/locale/programs/3level.h
   14.33 +--- glibc-2_9.orig/locale/programs/3level.h	2007-07-16 02:54:59.000000000 +0200
   14.34 ++++ glibc-2_9/locale/programs/3level.h	2009-02-02 22:00:54.000000000 +0100
   14.35 +@@ -203,6 +203,42 @@
   14.36 + 	}
   14.37 +     }
   14.38 + }
   14.39 ++
   14.40 ++/* GCC ATM seems to do a poor job with pointers to nested functions passed
   14.41 ++   to inlined functions.  Help it a little bit with this hack.  */
   14.42 ++#define wchead_table_iterate(tp, fn) \
   14.43 ++do									      \
   14.44 ++  {									      \
   14.45 ++    struct wchead_table *t = (tp);					      \
   14.46 ++    uint32_t index1;							      \
   14.47 ++    for (index1 = 0; index1 < t->level1_size; index1++)			      \
   14.48 ++      {									      \
   14.49 ++	uint32_t lookup1 = t->level1[index1];				      \
   14.50 ++	if (lookup1 != ((uint32_t) ~0))					      \
   14.51 ++	  {								      \
   14.52 ++	    uint32_t lookup1_shifted = lookup1 << t->q;			      \
   14.53 ++	    uint32_t index2;						      \
   14.54 ++	    for (index2 = 0; index2 < (1 << t->q); index2++)		      \
   14.55 ++	      {								      \
   14.56 ++		uint32_t lookup2 = t->level2[index2 + lookup1_shifted];	      \
   14.57 ++		if (lookup2 != ((uint32_t) ~0))				      \
   14.58 ++		  {							      \
   14.59 ++		    uint32_t lookup2_shifted = lookup2 << t->p;		      \
   14.60 ++		    uint32_t index3;					      \
   14.61 ++		    for (index3 = 0; index3 < (1 << t->p); index3++)	      \
   14.62 ++		      {							      \
   14.63 ++			struct element_t *lookup3			      \
   14.64 ++			  = t->level3[index3 + lookup2_shifted];	      \
   14.65 ++			if (lookup3 != NULL)				      \
   14.66 ++			  fn ((((index1 << t->q) + index2) << t->p) + index3, \
   14.67 ++			      lookup3);					      \
   14.68 ++		      }							      \
   14.69 ++		  }							      \
   14.70 ++	      }								      \
   14.71 ++	  }								      \
   14.72 ++      }									      \
   14.73 ++  } while (0)
   14.74 ++
   14.75 + #endif
   14.76 + 
   14.77 + #ifndef NO_FINALIZE
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/patches/glibc/2.9/240-i386-LOAD_PIC_REG.patch	Sat Mar 28 13:34:41 2009 +0000
    15.3 @@ -0,0 +1,23 @@
    15.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1050_all_glibc-i386-LOAD_PIC_REG.patch
    15.5 +
    15.6 +-= BEGIN original header =-
    15.7 +From e41177ea18a77a7f62328293b4fd49ae17482e77 Mon Sep 17 00:00:00 2001
    15.8 +From: Ulrich Drepper <drepper@redhat.com>
    15.9 +Date: Sat, 6 Dec 2008 00:15:17 +0000
   15.10 +Subject: [PATCH] (_dl_tlsdesc_dynamic): Use LOAD_PIC_REG instead of doing things manually.
   15.11 +
   15.12 +-= END original header =-
   15.13 +
   15.14 +diff -durN glibc-2_9.orig/sysdeps/i386/dl-tlsdesc.S glibc-2_9/sysdeps/i386/dl-tlsdesc.S
   15.15 +--- glibc-2_9.orig/sysdeps/i386/dl-tlsdesc.S	2008-05-13 07:33:06.000000000 +0200
   15.16 ++++ glibc-2_9/sysdeps/i386/dl-tlsdesc.S	2009-02-02 22:00:56.000000000 +0100
   15.17 +@@ -128,8 +128,7 @@
   15.18 + .Lslow:
   15.19 + 	cfi_adjust_cfa_offset (28)
   15.20 + 	movl	%ebx, 16(%esp)
   15.21 +-	call	__i686.get_pc_thunk.bx
   15.22 +-	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
   15.23 ++	LOAD_PIC_REG (bx)
   15.24 + 	call	___tls_get_addr@PLT
   15.25 + 	movl	16(%esp), %ebx
   15.26 + 	jmp	.Lret
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/patches/glibc/2.9/250-resolv-dynamic.patch	Sat Mar 28 13:34:41 2009 +0000
    16.3 @@ -0,0 +1,44 @@
    16.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1055_all_glibc-resolv-dynamic.patch
    16.5 +
    16.6 +-= BEGIN original header =-
    16.7 +ripped from SuSE
    16.8 +
    16.9 +if /etc/resolv.conf is updated, then make sure applications
   16.10 +already running get the updated information.
   16.11 +
   16.12 +http://bugs.gentoo.org/177416
   16.13 +
   16.14 +-= END original header =-
   16.15 +
   16.16 +diff -durN glibc-2_9.orig/resolv/res_libc.c glibc-2_9/resolv/res_libc.c
   16.17 +--- glibc-2_9.orig/resolv/res_libc.c	2006-10-11 10:59:28.000000000 +0200
   16.18 ++++ glibc-2_9/resolv/res_libc.c	2009-02-02 22:00:57.000000000 +0100
   16.19 +@@ -22,6 +22,7 @@
   16.20 + #include <arpa/nameser.h>
   16.21 + #include <resolv.h>
   16.22 + #include <bits/libc-lock.h>
   16.23 ++#include <sys/stat.h>
   16.24 + 
   16.25 + 
   16.26 + /* The following bit is copied from res_data.c (where it is #ifdef'ed
   16.27 +@@ -95,6 +96,20 @@
   16.28 + __res_maybe_init (res_state resp, int preinit)
   16.29 + {
   16.30 + 	if (resp->options & RES_INIT) {
   16.31 ++		static time_t last_mtime, last_check;
   16.32 ++		time_t now;
   16.33 ++		struct stat statbuf;
   16.34 ++		
   16.35 ++		time (&now);
   16.36 ++		if (now != last_check) {
   16.37 ++			last_check = now;
   16.38 ++			if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
   16.39 ++				last_mtime = statbuf.st_mtime;
   16.40 ++				atomicinclock (lock);
   16.41 ++				atomicinc (__res_initstamp);
   16.42 ++				atomicincunlock (lock);
   16.43 ++			}
   16.44 ++		}
   16.45 + 		if (__res_initstamp != resp->_u._ext.initstamp) {
   16.46 + 			if (resp->nscount > 0) {
   16.47 + 				__res_iclose (resp, true);
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/patches/glibc/2.9/260-fadvise64_64.patch	Sat Mar 28 13:34:41 2009 +0000
    17.3 @@ -0,0 +1,30 @@
    17.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1070_all_glibc-fadvise64_64.patch
    17.5 +
    17.6 +-= BEGIN original header =-
    17.7 +ripped from Debian
    17.8 +
    17.9 +-= END original header =-
   17.10 +
   17.11 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2_9/sysdeps/unix/sysv/linux/posix_fadvise.c
   17.12 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/posix_fadvise.c	2003-08-17 02:36:22.000000000 +0200
   17.13 ++++ glibc-2_9/sysdeps/unix/sysv/linux/posix_fadvise.c	2009-02-02 22:00:58.000000000 +0100
   17.14 +@@ -35,6 +35,19 @@
   17.15 +     return INTERNAL_SYSCALL_ERRNO (ret, err);
   17.16 +   return 0;
   17.17 + #else
   17.18 ++# ifdef __NR_fadvise64_64
   17.19 ++  INTERNAL_SYSCALL_DECL (err);  
   17.20 ++  int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
   17.21 ++			      __LONG_LONG_PAIR ((long) (offset >> 31),
   17.22 ++						(long) offset),
   17.23 ++			      __LONG_LONG_PAIR ((long) (len >> 31),
   17.24 ++						(long) len),
   17.25 ++			      advise);
   17.26 ++  if (INTERNAL_SYSCALL_ERROR_P (ret, err))
   17.27 ++    return INTERNAL_SYSCALL_ERRNO (ret, err);
   17.28 ++  return 0;
   17.29 ++# else
   17.30 +   return ENOSYS;
   17.31 ++# endif
   17.32 + #endif
   17.33 + }
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/patches/glibc/2.9/270-ldbl-nexttowardf.patch	Sat Mar 28 13:34:41 2009 +0000
    18.3 @@ -0,0 +1,68 @@
    18.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1073_all_glibc-ldbl-nexttowardf.patch
    18.5 +
    18.6 +-= BEGIN original header =-
    18.7 +ripped from Debian
    18.8 +
    18.9 +this change was made to generic __nexttowardf, but not the long double version
   18.10 +
   18.11 +2008-05-05  Aurelien Jarno  <aurelien@aurel32.net>
   18.12 +
   18.13 +	* sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include float.h.
   18.14 +	(__nexttowardf): Use math_opt_barrier and
   18.15 +	math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
   18.16 +	x to float using asm.
   18.17 +
   18.18 +-= END original header =-
   18.19 +
   18.20 +diff -durN glibc-2_9.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c glibc-2_9/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
   18.21 +--- glibc-2_9.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	1999-07-14 02:09:42.000000000 +0200
   18.22 ++++ glibc-2_9/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	2009-02-02 22:00:59.000000000 +0100
   18.23 +@@ -19,7 +19,8 @@
   18.24 + #endif
   18.25 + 
   18.26 + #include "math.h"
   18.27 +-#include "math_private.h"
   18.28 ++#include <math_private.h>
   18.29 ++#include <float.h>
   18.30 + 
   18.31 + #ifdef __STDC__
   18.32 + 	float __nexttowardf(float x, long double y)
   18.33 +@@ -44,10 +45,12 @@
   18.34 + 	   return x+y;
   18.35 + 	if((long double) x==y) return y;	/* x=y, return y */
   18.36 + 	if(ix==0) {				/* x == 0 */
   18.37 +-	    float x2;
   18.38 ++	    float u;
   18.39 + 	    SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
   18.40 +-	    x2 = x*x;
   18.41 +-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
   18.42 ++	    u = math_opt_barrier (x);
   18.43 ++	    u = u * u;
   18.44 ++	    math_force_eval (u);		/* raise underflow flag */
   18.45 ++	    return x;
   18.46 + 	}
   18.47 + 	if(hx>=0) {				/* x > 0 */
   18.48 + 	    if(hy<0||(ix>>23)>(iy>>48)-0x3f80
   18.49 +@@ -67,13 +70,16 @@
   18.50 + 	    }
   18.51 + 	}
   18.52 + 	hy = hx&0x7f800000;
   18.53 +-	if(hy>=0x7f800000) return x+x;	/* overflow  */
   18.54 ++	if(hy>=0x7f800000) {
   18.55 ++	  x = x+x;	/* overflow  */
   18.56 ++	  if (FLT_EVAL_METHOD != 0)
   18.57 ++	    /* Force conversion to float.  */
   18.58 ++	    asm ("" : "+m"(x));
   18.59 ++	  return x;
   18.60 ++	}
   18.61 + 	if(hy<0x00800000) {		/* underflow */
   18.62 +-	    float x2 = x*x;
   18.63 +-	    if(x2!=x) {		/* raise underflow flag */
   18.64 +-	        SET_FLOAT_WORD(x2,hx);
   18.65 +-		return x2;
   18.66 +-	    }
   18.67 ++	    float u = x*x;
   18.68 ++	    math_force_eval (u);	/* raise underflow flag */
   18.69 + 	}
   18.70 + 	SET_FLOAT_WORD(x,hx);
   18.71 + 	return x;
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/patches/glibc/2.9/280-section-comments.patch	Sat Mar 28 13:34:41 2009 +0000
    19.3 @@ -0,0 +1,29 @@
    19.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1075_all_glibc-section-comments.patch
    19.5 +
    19.6 +-= BEGIN original header =-
    19.7 +http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
    19.8 +
    19.9 +fixes building on some architectures (like m68k/arm/cris/etc...) because
   19.10 +it does the right thing
   19.11 +
   19.12 +-= END original header =-
   19.13 +
   19.14 +diff -durN glibc-2_9.orig/include/libc-symbols.h glibc-2_9/include/libc-symbols.h
   19.15 +--- glibc-2_9.orig/include/libc-symbols.h	2006-11-09 16:57:12.000000000 +0100
   19.16 ++++ glibc-2_9/include/libc-symbols.h	2009-02-02 22:01:00.000000000 +0100
   19.17 +@@ -240,12 +240,12 @@
   19.18 + #  define __make_section_unallocated(section_string)
   19.19 + # endif
   19.20 + 
   19.21 +-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
   19.22 ++/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
   19.23 +    section attributes on what looks like a comment to the assembler.  */
   19.24 + # ifdef HAVE_SECTION_QUOTES
   19.25 +-#  define __sec_comment "\"\n\t#\""
   19.26 ++#  define __sec_comment "\"\n#APP\n\t#\""
   19.27 + # else
   19.28 +-#  define __sec_comment "\n\t#"
   19.29 ++#  define __sec_comment "\n#APP\n\t#"
   19.30 + # endif
   19.31 + # define link_warning(symbol, msg) \
   19.32 +   __make_section_unallocated (".gnu.warning." #symbol) \
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/patches/glibc/2.9/290-no-inline-gmon.patch	Sat Mar 28 13:34:41 2009 +0000
    20.3 @@ -0,0 +1,38 @@
    20.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1080_all_glibc-no-inline-gmon.patch
    20.5 +
    20.6 +-= BEGIN original header =-
    20.7 +http://bugs.gentoo.org/196245
    20.8 +http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
    20.9 +
   20.10 +Attached is a patch to add __attribute__ ((noinline)) to
   20.11 +call_gmon_start.
   20.12 +
   20.13 +Without this patch, the sec script that processed initfini.s removes a
   20.14 +part of inlined call_gmon_start, causing undefined label errors.
   20.15 +
   20.16 +This patch solves the problem by forcing gcc not to inline
   20.17 +call_gmon_start with __attribute__ ((noinline)).
   20.18 +
   20.19 +Tested by building for arm-none-lixux-gnueabi.  OK to apply?
   20.20 +
   20.21 +Kazu Hirata
   20.22 +
   20.23 +2006-05-07  Kazu Hirata  &lt;kazu@codesourcery.com&gt;
   20.24 +
   20.25 +	* sysdeps/generic/initfini.c (call_gmon_start): Add
   20.26 +	__attribute__ ((noinline)).
   20.27 +
   20.28 +-= END original header =-
   20.29 +
   20.30 +diff -durN glibc-2_9.orig/sysdeps/generic/initfini.c glibc-2_9/sysdeps/generic/initfini.c
   20.31 +--- glibc-2_9.orig/sysdeps/generic/initfini.c	2007-06-17 20:02:40.000000000 +0200
   20.32 ++++ glibc-2_9/sysdeps/generic/initfini.c	2009-02-02 22:01:01.000000000 +0100
   20.33 +@@ -70,7 +70,7 @@
   20.34 + /* The beginning of _init:  */
   20.35 + asm ("\n/*@_init_PROLOG_BEGINS*/");
   20.36 + 
   20.37 +-static void
   20.38 ++static void __attribute__ ((noinline))
   20.39 + call_gmon_start(void)
   20.40 + {
   20.41 +   extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/patches/glibc/2.9/300-2.9-check_native-headers.patch	Sat Mar 28 13:34:41 2009 +0000
    21.3 @@ -0,0 +1,22 @@
    21.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1085_all_glibc-2.9-check_native-headers.patch
    21.5 +
    21.6 +-= BEGIN original header =-
    21.7 +many ports hit this warning:
    21.8 +../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
    21.9 +../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
   21.10 +
   21.11 +snipped from suse
   21.12 +
   21.13 +-= END original header =-
   21.14 +
   21.15 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/check_native.c glibc-2_9/sysdeps/unix/sysv/linux/check_native.c
   21.16 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/check_native.c	2007-11-24 04:12:17.000000000 +0100
   21.17 ++++ glibc-2_9/sysdeps/unix/sysv/linux/check_native.c	2009-02-02 22:01:03.000000000 +0100
   21.18 +@@ -23,6 +23,7 @@
   21.19 + #include <stddef.h>
   21.20 + #include <stdint.h>
   21.21 + #include <stdlib.h>
   21.22 ++#include <string.h>
   21.23 + #include <time.h>
   21.24 + #include <unistd.h>
   21.25 + #include <net/if.h>
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/patches/glibc/2.9/310-2.3.6-fix-pr631.patch	Sat Mar 28 13:34:41 2009 +0000
    22.3 @@ -0,0 +1,50 @@
    22.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1090_all_glibc-2.3.6-fix-pr631.patch
    22.5 +
    22.6 +-= BEGIN original header =-
    22.7 +From dank@kegel.com
    22.8 +Wed Jun 15 09:12:43 PDT 2005
    22.9 +
   22.10 +Fixes
   22.11 +
   22.12 +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r'
   22.13 +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent'
   22.14 +... 53 lines deleted ...
   22.15 +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r'
   22.16 +collect2: ld returned 1 exit status
   22.17 +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
   22.18 +
   22.19 +when building glibc with --enable-static-nss.
   22.20 +
   22.21 +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631
   22.22 +
   22.23 +-= END original header =-
   22.24 +
   22.25 +diff -durN glibc-2_9.orig/Makeconfig glibc-2_9/Makeconfig
   22.26 +--- glibc-2_9.orig/Makeconfig	2009-02-02 22:00:36.000000000 +0100
   22.27 ++++ glibc-2_9/Makeconfig	2009-02-02 22:01:04.000000000 +0100
   22.28 +@@ -509,7 +509,7 @@
   22.29 + 
   22.30 + # The static libraries.
   22.31 + ifeq (yes,$(build-static))
   22.32 +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
   22.33 ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a
   22.34 + else
   22.35 + ifeq (yes,$(build-shared))
   22.36 + # We can try to link the programs with lib*_pic.a...
   22.37 +diff -durN glibc-2_9.orig/elf/Makefile glibc-2_9/elf/Makefile
   22.38 +--- glibc-2_9.orig/elf/Makefile	2008-10-31 21:35:11.000000000 +0100
   22.39 ++++ glibc-2_9/elf/Makefile	2009-02-02 22:01:04.000000000 +0100
   22.40 +@@ -121,6 +121,13 @@
   22.41 + install-bin-script = ldd
   22.42 + endif
   22.43 + 
   22.44 ++ifeq (yes,$(build-static-nss))
   22.45 ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
   22.46 ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
   22.47 ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
   22.48 ++	     $(resolvobjdir)/libresolv.a
   22.49 ++endif
   22.50 ++
   22.51 + others		= sprof sln
   22.52 + install-bin	= sprof
   22.53 + others-static   = sln
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/patches/glibc/2.9/320-2.9-assume-pipe2.patch	Sat Mar 28 13:34:41 2009 +0000
    23.3 @@ -0,0 +1,59 @@
    23.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1095_all_glibc-2.9-assume-pipe2.patch
    23.5 +
    23.6 +-= BEGIN original header =-
    23.7 +http://bugs.gentoo.org/250342
    23.8 +http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
    23.9 +
   23.10 +we cant assume sock_cloexec and pipe2 are bound together as the former defines
   23.11 +are found in glibc only while the latter are a combo of kernel headers and
   23.12 +glibc.  so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
   23.13 +inside of glibc, we hit a problem.  for example:
   23.14 +
   23.15 +#include <grp.h>
   23.16 +#include <stdio.h>
   23.17 +main()
   23.18 +{
   23.19 +	getgrnam("portage");
   23.20 +	if (!popen("ls", "r"))
   23.21 +		perror("popen()");
   23.22 +}
   23.23 +
   23.24 +getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
   23.25 +__have_sock_cloexec and __have_pipe2 to true.  but if glibc was built against
   23.26 +older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
   23.27 +stub for it.  so popen() will always fail as glibc assumes pipe2() works.
   23.28 +
   23.29 +-= END original header =-
   23.30 +
   23.31 +diff -durN glibc-2_9.orig/include/unistd.h glibc-2_9/include/unistd.h
   23.32 +--- glibc-2_9.orig/include/unistd.h	2008-07-27 20:23:17.000000000 +0200
   23.33 ++++ glibc-2_9/include/unistd.h	2009-02-02 22:01:05.000000000 +0100
   23.34 +@@ -167,9 +167,6 @@
   23.35 + extern int __pause_nocancel (void) attribute_hidden;
   23.36 + 
   23.37 + extern int __have_sock_cloexec;
   23.38 +-/* At lot of other functionality became available at the same time as
   23.39 +-   SOCK_CLOEXEC.  Avoid defining separate variables for all of them
   23.40 +-   unless it is really necessary.  */
   23.41 +-#define __have_pipe2 __have_sock_cloexec
   23.42 ++extern int __have_pipe2;
   23.43 + 
   23.44 + #endif
   23.45 +diff -durN glibc-2_9.orig/socket/have_sock_cloexec.c glibc-2_9/socket/have_sock_cloexec.c
   23.46 +--- glibc-2_9.orig/socket/have_sock_cloexec.c	2008-07-25 18:46:23.000000000 +0200
   23.47 ++++ glibc-2_9/socket/have_sock_cloexec.c	2009-02-02 22:01:05.000000000 +0100
   23.48 +@@ -16,9 +16,14 @@
   23.49 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   23.50 +    02111-1307 USA.  */
   23.51 + 
   23.52 ++#include <fcntl.h>
   23.53 + #include <sys/socket.h>
   23.54 + #include <kernel-features.h>
   23.55 + 
   23.56 + #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
   23.57 + int __have_sock_cloexec;
   23.58 + #endif
   23.59 ++
   23.60 ++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
   23.61 ++int __have_pipe2;
   23.62 ++#endif
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/patches/glibc/2.9/330-2.3.3-china.patch	Sat Mar 28 13:34:41 2009 +0000
    24.3 @@ -0,0 +1,35 @@
    24.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1100_all_glibc-2.3.3-china.patch
    24.5 +
    24.6 +-= BEGIN original header =-
    24.7 +-= END original header =-
    24.8 +
    24.9 +diff -durN glibc-2_9.orig/localedata/locales/zh_TW glibc-2_9/localedata/locales/zh_TW
   24.10 +--- glibc-2_9.orig/localedata/locales/zh_TW	2004-11-01 00:42:28.000000000 +0100
   24.11 ++++ glibc-2_9/localedata/locales/zh_TW	2009-02-02 22:01:06.000000000 +0100
   24.12 +@@ -1,7 +1,7 @@
   24.13 + comment_char %
   24.14 + escape_char /
   24.15 + %
   24.16 +-% Chinese language locale for Taiwan R.O.C.
   24.17 ++% Chinese language locale for Taiwan
   24.18 + % charmap: BIG5-CP950
   24.19 + %
   24.20 + % Original Author:
   24.21 +@@ -17,7 +17,7 @@
   24.22 + % Reference:	http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
   24.23 + 
   24.24 + LC_IDENTIFICATION
   24.25 +-title      "Chinese locale for Taiwan R.O.C."
   24.26 ++title      "Chinese locale for Taiwan"
   24.27 + source     ""
   24.28 + address    ""
   24.29 + contact    ""
   24.30 +@@ -25,7 +25,7 @@
   24.31 + tel        ""
   24.32 + fax        ""
   24.33 + language   "Chinese"
   24.34 +-territory  "Taiwan R.O.C."
   24.35 ++territory  "Taiwan"
   24.36 + revision   "0.2"
   24.37 + date       "2000-08-02"
   24.38 + %
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/patches/glibc/2.9/340-new-valencian-locale.patch	Sat Mar 28 13:34:41 2009 +0000
    25.3 @@ -0,0 +1,120 @@
    25.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1103_all_glibc-new-valencian-locale.patch
    25.5 +
    25.6 +-= BEGIN original header =-
    25.7 +http://bugs.gentoo.org/show_bug.cgi?id=131815
    25.8 +http://sourceware.org/bugzilla/show_bug.cgi?id=2522
    25.9 +
   25.10 +-= END original header =-
   25.11 +
   25.12 +diff -durN glibc-2_9.orig/localedata/SUPPORTED glibc-2_9/localedata/SUPPORTED
   25.13 +--- glibc-2_9.orig/localedata/SUPPORTED	2008-09-16 23:24:57.000000000 +0200
   25.14 ++++ glibc-2_9/localedata/SUPPORTED	2009-02-02 22:01:08.000000000 +0100
   25.15 +@@ -72,6 +72,8 @@
   25.16 + ca_ES.UTF-8/UTF-8 \
   25.17 + ca_ES/ISO-8859-1 \
   25.18 + ca_ES@euro/ISO-8859-15 \
   25.19 ++ca_ES.UTF-8@valencia/UTF-8 \
   25.20 ++ca_ES@valencia/ISO-8859-15 \
   25.21 + ca_FR.UTF-8/UTF-8 \
   25.22 + ca_FR/ISO-8859-15 \
   25.23 + ca_IT.UTF-8/UTF-8 \
   25.24 +diff -durN glibc-2_9.orig/localedata/locales/ca_ES@valencia glibc-2_9/localedata/locales/ca_ES@valencia
   25.25 +--- glibc-2_9.orig/localedata/locales/ca_ES@valencia	1970-01-01 01:00:00.000000000 +0100
   25.26 ++++ glibc-2_9/localedata/locales/ca_ES@valencia	2009-02-02 22:01:08.000000000 +0100
   25.27 +@@ -0,0 +1,96 @@
   25.28 ++comment_char %
   25.29 ++escape_char  /
   25.30 ++%
   25.31 ++% Valencian (southern Catalan) locale for Spain with Euro
   25.32 ++%
   25.33 ++% Note that this locale is almost the same as ca_ES@euro.  The point of having
   25.34 ++% a separate locale is only for PO translations, which have a lot of social
   25.35 ++% support and are very appreciated by the Valencian-speaking community.
   25.36 ++%
   25.37 ++% Contact: Jordi Mallach
   25.38 ++% Email: jordi@gnu.org
   25.39 ++% Tel:
   25.40 ++% Fax:
   25.41 ++% Language: ca
   25.42 ++% Territory: ES
   25.43 ++% Option: euro
   25.44 ++% Revision: 1.0
   25.45 ++% Date: 2006-04-06
   25.46 ++% Application: general
   25.47 ++% Users: general
   25.48 ++% Repertoiremap: mnemonic,ds
   25.49 ++% Charset: ISO-8859-15
   25.50 ++% Distribution and use is free, also
   25.51 ++% for commercial purposes.
   25.52 ++
   25.53 ++LC_IDENTIFICATION
   25.54 ++title      "Valencian (southern Catalan) locale for Spain with Euro"
   25.55 ++source     ""
   25.56 ++address    ""
   25.57 ++contact    "Jordi Mallach"
   25.58 ++email      "jordi@gnu.org"
   25.59 ++tel        ""
   25.60 ++fax        ""
   25.61 ++language   "Catalan"
   25.62 ++territory  "Spain"
   25.63 ++revision   "1.0"
   25.64 ++date       "2006-04-06"
   25.65 ++%
   25.66 ++category  "ca_ES@valencia:2006";LC_IDENTIFICATION
   25.67 ++category  "ca_ES@valencia:2006";LC_CTYPE
   25.68 ++category  "ca_ES@valencia:2006";LC_COLLATE
   25.69 ++category  "ca_ES@valencia:2006";LC_MONETARY
   25.70 ++category  "ca_ES@valencia:2006";LC_NUMERIC
   25.71 ++category  "ca_ES@valencia:2006";LC_TIME
   25.72 ++category  "ca_ES@valencia:2006";LC_MESSAGES
   25.73 ++category  "ca_ES@valencia:2006";LC_PAPER
   25.74 ++category  "ca_ES@valencia:2006";LC_NAME
   25.75 ++category  "ca_ES@valencia:2006";LC_ADDRESS
   25.76 ++category  "ca_ES@valencia:2006";LC_TELEPHONE
   25.77 ++category  "ca_ES@valencia:2006";LC_MEASUREMENT
   25.78 ++
   25.79 ++END LC_IDENTIFICATION
   25.80 ++
   25.81 ++LC_CTYPE
   25.82 ++copy "i18n"
   25.83 ++END LC_CTYPE
   25.84 ++
   25.85 ++LC_COLLATE
   25.86 ++copy "ca_ES"
   25.87 ++END LC_COLLATE
   25.88 ++
   25.89 ++LC_MONETARY
   25.90 ++copy "ca_ES"
   25.91 ++END LC_MONETARY
   25.92 ++
   25.93 ++LC_NUMERIC
   25.94 ++copy "ca_ES"
   25.95 ++END LC_NUMERIC
   25.96 ++
   25.97 ++LC_TIME
   25.98 ++copy "ca_ES"
   25.99 ++END LC_TIME
  25.100 ++
  25.101 ++LC_MESSAGES
  25.102 ++copy "ca_ES"
  25.103 ++END LC_MESSAGES
  25.104 ++
  25.105 ++LC_PAPER
  25.106 ++copy "ca_ES"
  25.107 ++END LC_PAPER
  25.108 ++
  25.109 ++LC_NAME
  25.110 ++copy "ca_ES"
  25.111 ++END LC_NAME
  25.112 ++
  25.113 ++LC_ADDRESS
  25.114 ++copy "ca_ES"
  25.115 ++END LC_ADDRESS
  25.116 ++
  25.117 ++LC_TELEPHONE
  25.118 ++copy "ca_ES"
  25.119 ++END LC_TELEPHONE
  25.120 ++
  25.121 ++LC_MEASUREMENT
  25.122 ++copy "ca_ES"
  25.123 ++END LC_MEASUREMENT
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/patches/glibc/2.9/350-2.4-undefine-__i686.patch	Sat Mar 28 13:34:41 2009 +0000
    26.3 @@ -0,0 +1,47 @@
    26.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1130_all_glibc-2.4-undefine-__i686.patch
    26.5 +
    26.6 +-= BEGIN original header =-
    26.7 +If gcc is configured to generate i686 code or better by default (like 
    26.8 +when using the --with-arch=pentium3 configure option), then the __i686
    26.9 +macro will always be defined automatically and thus screw up the
   26.10 +compilation of some .S files.
   26.11 +http://bugs.gentoo.org/131108
   26.12 +http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html
   26.13 +
   26.14 +2006-04-25  Mike Frysinger  <vapier@gentoo.org>
   26.15 +
   26.16 +	* sysdeps/i386/sysdep.h (__i686): Undefine.
   26.17 +
   26.18 +-= END original header =-
   26.19 +
   26.20 +diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2_9/nptl/sysdeps/pthread/pt-initfini.c
   26.21 +--- glibc-2_9.orig/nptl/sysdeps/pthread/pt-initfini.c	2007-06-17 20:02:01.000000000 +0200
   26.22 ++++ glibc-2_9/nptl/sysdeps/pthread/pt-initfini.c	2009-02-02 22:01:09.000000000 +0100
   26.23 +@@ -45,6 +45,9 @@
   26.24 + /* Embed an #include to pull in the alignment and .end directives. */
   26.25 + asm ("\n#include \"defs.h\"");
   26.26 + 
   26.27 ++/* Embed an #include to pull in asm settings. */
   26.28 ++asm ("\n#ifdef __i686__\n#include <sysdep.h>\n#endif");
   26.29 ++
   26.30 + /* The initial common code ends here. */
   26.31 + asm ("\n/*@HEADER_ENDS*/");
   26.32 + 
   26.33 +diff -durN glibc-2_9.orig/sysdeps/i386/sysdep.h glibc-2_9/sysdeps/i386/sysdep.h
   26.34 +--- glibc-2_9.orig/sysdeps/i386/sysdep.h	2006-10-28 08:44:03.000000000 +0200
   26.35 ++++ glibc-2_9/sysdeps/i386/sysdep.h	2009-02-02 22:01:09.000000000 +0100
   26.36 +@@ -18,6 +18,14 @@
   26.37 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   26.38 +    02111-1307 USA.  */
   26.39 + 
   26.40 ++/*
   26.41 ++ * When building for i686 targets or better, gcc automatically defines
   26.42 ++ * '__i686' to '1' for us which causes trouble when using section names
   26.43 ++ * like '__i686.get_pc_thunk.reg'.  Since we check for __i686__ in the
   26.44 ++ * code, killing '__i686' shouldn't be a problem.
   26.45 ++ */
   26.46 ++#undef __i686
   26.47 ++
   26.48 + #include <sysdeps/generic/sysdep.h>
   26.49 + 
   26.50 + #ifdef	__ASSEMBLER__
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/patches/glibc/2.9/360-2.8-nscd-one-fork.patch	Sat Mar 28 13:34:41 2009 +0000
    27.3 @@ -0,0 +1,45 @@
    27.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1160_all_glibc-2.8-nscd-one-fork.patch
    27.5 +
    27.6 +-= BEGIN original header =-
    27.7 +only fork one to assist in stop-start-daemon assumptions about daemon behavior
    27.8 +
    27.9 +http://bugs.gentoo.org/190785
   27.10 +
   27.11 +-= END original header =-
   27.12 +
   27.13 +diff -durN glibc-2_9.orig/nscd/nscd.c glibc-2_9/nscd/nscd.c
   27.14 +--- glibc-2_9.orig/nscd/nscd.c	2008-03-29 19:08:12.000000000 +0100
   27.15 ++++ glibc-2_9/nscd/nscd.c	2009-02-02 22:01:10.000000000 +0100
   27.16 +@@ -179,6 +179,9 @@
   27.17 +       if (pid != 0)
   27.18 + 	exit (0);
   27.19 + 
   27.20 ++       if (write_pid (_PATH_NSCDPID) < 0)
   27.21 ++	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
   27.22 ++
   27.23 +       int nullfd = open (_PATH_DEVNULL, O_RDWR);
   27.24 +       if (nullfd != -1)
   27.25 + 	{
   27.26 +@@ -228,12 +231,6 @@
   27.27 + 	for (i = min_close_fd; i < getdtablesize (); i++)
   27.28 + 	  close (i);
   27.29 + 
   27.30 +-      pid = fork ();
   27.31 +-      if (pid == -1)
   27.32 +-	error (EXIT_FAILURE, errno, _("cannot fork"));
   27.33 +-      if (pid != 0)
   27.34 +-	exit (0);
   27.35 +-
   27.36 +       setsid ();
   27.37 + 
   27.38 +       if (chdir ("/") != 0)
   27.39 +@@ -242,9 +239,6 @@
   27.40 + 
   27.41 +       openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
   27.42 + 
   27.43 +-      if (write_pid (_PATH_NSCDPID) < 0)
   27.44 +-        dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
   27.45 +-
   27.46 +       if (!init_logfile ())
   27.47 + 	dbg_log (_("Could not create log file"));
   27.48 + 
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/patches/glibc/2.9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch	Sat Mar 28 13:34:41 2009 +0000
    28.3 @@ -0,0 +1,249 @@
    28.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1503_hppa_glibc-2.7-hppa-nptl-carlos.patch
    28.5 +
    28.6 +-= BEGIN original header =-
    28.7 +-= END original header =-
    28.8 +
    28.9 +diff -durN glibc-2_9.orig/elf/rtld.c glibc-2_9/elf/rtld.c
   28.10 +--- glibc-2_9.orig/elf/rtld.c	2009-02-02 22:00:34.000000000 +0100
   28.11 ++++ glibc-2_9/elf/rtld.c	2009-02-02 22:01:12.000000000 +0100
   28.12 +@@ -386,14 +386,14 @@
   28.13 +      know it is available.  We do not have to clear the memory if we
   28.14 +      do not have to use the temporary bootstrap_map.  Global variables
   28.15 +      are initialized to zero by default.  */
   28.16 +-#ifndef DONT_USE_BOOTSTRAP_MAP
   28.17 ++#if !defined DONT_USE_BOOTSTRAP_MAP
   28.18 + # ifdef HAVE_BUILTIN_MEMSET
   28.19 +   __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
   28.20 + # else
   28.21 +-  for (size_t cnt = 0;
   28.22 +-       cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
   28.23 +-       ++cnt)
   28.24 +-    bootstrap_map.l_info[cnt] = 0;
   28.25 ++  /* Clear the whole bootstrap_map structure */
   28.26 ++  for (char *cnt = (char *)&(bootstrap_map);
   28.27 ++       cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
   28.28 ++       *cnt++ = '\0');
   28.29 + # endif
   28.30 + # if USE___THREAD
   28.31 +   bootstrap_map.l_tls_modid = 0;
   28.32 +diff -durN glibc-2_9.orig/include/atomic.h glibc-2_9/include/atomic.h
   28.33 +--- glibc-2_9.orig/include/atomic.h	2006-12-21 22:44:00.000000000 +0100
   28.34 ++++ glibc-2_9/include/atomic.h	2009-02-02 22:01:12.000000000 +0100
   28.35 +@@ -174,7 +174,7 @@
   28.36 +      __typeof (*(mem)) __atg5_value = (newvalue);			      \
   28.37 + 									      \
   28.38 +      do									      \
   28.39 +-       __atg5_oldval = *__atg5_memp;					      \
   28.40 ++       __atg5_oldval = *(volatile __typeof (mem))__atg5_memp;		      \
   28.41 +      while (__builtin_expect						      \
   28.42 + 	    (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
   28.43 + 						   __atg5_oldval), 0));	      \
   28.44 +@@ -195,7 +195,7 @@
   28.45 +      __typeof (*(mem)) __atg6_value = (value);				      \
   28.46 + 									      \
   28.47 +      do									      \
   28.48 +-       __atg6_oldval = *__atg6_memp;					      \
   28.49 ++       __atg6_oldval = *(volatile __typeof (mem))__atg6_memp;		      \
   28.50 +      while (__builtin_expect						      \
   28.51 + 	    (atomic_compare_and_exchange_bool_acq (__atg6_memp,		      \
   28.52 + 						   __atg6_oldval	      \
   28.53 +@@ -213,7 +213,7 @@
   28.54 +      __typeof (*(mem)) __atg7_value = (value);				      \
   28.55 + 									      \
   28.56 +      do									      \
   28.57 +-       __atg7_oldv = *__atg7_memp;					      \
   28.58 ++       __atg7_oldv = *(volatile __typeof (mem))__atg7_memp;		      \
   28.59 +      while (__builtin_expect						      \
   28.60 + 	    (catomic_compare_and_exchange_bool_acq (__atg7_memp,	      \
   28.61 + 						    __atg7_oldv		      \
   28.62 +@@ -231,7 +231,7 @@
   28.63 +     __typeof (mem) __atg8_memp = (mem);					      \
   28.64 +     __typeof (*(mem)) __atg8_value = (value);				      \
   28.65 +     do {								      \
   28.66 +-      __atg8_oldval = *__atg8_memp;					      \
   28.67 ++      __atg8_oldval = *(volatile __typeof (mem))__atg8_memp;		      \
   28.68 +       if (__atg8_oldval >= __atg8_value)				      \
   28.69 + 	break;								      \
   28.70 +     } while (__builtin_expect						      \
   28.71 +@@ -248,7 +248,7 @@
   28.72 +     __typeof (mem) __atg9_memp = (mem);					      \
   28.73 +     __typeof (*(mem)) __atg9_value = (value);				      \
   28.74 +     do {								      \
   28.75 +-      __atg9_oldv = *__atg9_memp;					      \
   28.76 ++      __atg9_oldv = *(volatile __typeof (mem))__atg9_memp;		      \
   28.77 +       if (__atg9_oldv >= __atg9_value)					      \
   28.78 + 	break;								      \
   28.79 +     } while (__builtin_expect						      \
   28.80 +@@ -266,7 +266,7 @@
   28.81 +     __typeof (mem) __atg10_memp = (mem);				      \
   28.82 +     __typeof (*(mem)) __atg10_value = (value);				      \
   28.83 +     do {								      \
   28.84 +-      __atg10_oldval = *__atg10_memp;					      \
   28.85 ++      __atg10_oldval = *(volatile __typeof (mem))__atg10_memp;		      \
   28.86 +       if (__atg10_oldval <= __atg10_value)				      \
   28.87 + 	break;								      \
   28.88 +     } while (__builtin_expect						      \
   28.89 +@@ -350,7 +350,7 @@
   28.90 + 									      \
   28.91 +      do									      \
   28.92 +        {								      \
   28.93 +-	 __atg11_oldval = *__atg11_memp;				      \
   28.94 ++	 __atg11_oldval = *(volatile __typeof (mem))__atg11_memp;	      \
   28.95 + 	 if (__builtin_expect (__atg11_oldval <= 0, 0))			      \
   28.96 + 	   break;							      \
   28.97 +        }								      \
   28.98 +@@ -389,7 +389,7 @@
   28.99 +      __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit));	      \
  28.100 + 									      \
  28.101 +      do									      \
  28.102 +-       __atg14_old = (*__atg14_memp);					      \
  28.103 ++       __atg14_old = (*(volatile __typeof (mem))__atg14_memp);		      \
  28.104 +      while (__builtin_expect						      \
  28.105 + 	    (atomic_compare_and_exchange_bool_acq (__atg14_memp,	      \
  28.106 + 						   __atg14_old | __atg14_mask,\
  28.107 +@@ -407,7 +407,7 @@
  28.108 +     __typeof (*(mem)) __atg15_mask = (mask);				      \
  28.109 + 									      \
  28.110 +     do									      \
  28.111 +-      __atg15_old = (*__atg15_memp);					      \
  28.112 ++      __atg15_old = (*(volatile __typeof (mem))__atg15_memp);		      \
  28.113 +     while (__builtin_expect						      \
  28.114 + 	   (atomic_compare_and_exchange_bool_acq (__atg15_memp,		      \
  28.115 + 						  __atg15_old & __atg15_mask, \
  28.116 +@@ -423,7 +423,7 @@
  28.117 +      __typeof (*(mem)) __atg16_mask = (mask);				      \
  28.118 + 									      \
  28.119 +      do									      \
  28.120 +-       __atg16_old = (*__atg16_memp);					      \
  28.121 ++       __atg16_old = (*(volatile __typeof (mem))__atg16_memp);		      \
  28.122 +      while (__builtin_expect						      \
  28.123 + 	    (atomic_compare_and_exchange_bool_acq (__atg16_memp,	      \
  28.124 + 						   __atg16_old & __atg16_mask,\
  28.125 +@@ -441,7 +441,7 @@
  28.126 +     __typeof (*(mem)) __atg17_mask = (mask);				      \
  28.127 + 									      \
  28.128 +     do									      \
  28.129 +-      __atg17_old = (*__atg17_memp);					      \
  28.130 ++      __atg17_old = (*(volatile __typeof (mem))__atg17_memp);		      \
  28.131 +     while (__builtin_expect						      \
  28.132 + 	   (atomic_compare_and_exchange_bool_acq (__atg17_memp,		      \
  28.133 + 						  __atg17_old | __atg17_mask, \
  28.134 +@@ -457,7 +457,7 @@
  28.135 +     __typeof (*(mem)) __atg18_mask = (mask);				      \
  28.136 + 									      \
  28.137 +     do									      \
  28.138 +-      __atg18_old = (*__atg18_memp);					      \
  28.139 ++      __atg18_old = (*(volatile __typeof (mem))__atg18_memp);		      \
  28.140 +     while (__builtin_expect						      \
  28.141 + 	   (catomic_compare_and_exchange_bool_acq (__atg18_memp,	      \
  28.142 + 						   __atg18_old | __atg18_mask,\
  28.143 +@@ -473,7 +473,7 @@
  28.144 +      __typeof (*(mem)) __atg19_mask = (mask);				      \
  28.145 + 									      \
  28.146 +      do									      \
  28.147 +-       __atg19_old = (*__atg19_memp);					      \
  28.148 ++       __atg19_old = (*(volatile __typeof (mem))__atg19_memp);		      \
  28.149 +      while (__builtin_expect						      \
  28.150 + 	    (atomic_compare_and_exchange_bool_acq (__atg19_memp,	      \
  28.151 + 						   __atg19_old | __atg19_mask,\
  28.152 +diff -durN glibc-2_9.orig/nptl/Makefile glibc-2_9/nptl/Makefile
  28.153 +--- glibc-2_9.orig/nptl/Makefile	2008-11-12 14:38:23.000000000 +0100
  28.154 ++++ glibc-2_9/nptl/Makefile	2009-02-02 22:01:12.000000000 +0100
  28.155 +@@ -262,9 +262,9 @@
  28.156 + # Files which must not be linked with libpthread.
  28.157 + tests-nolibpthread = tst-unload
  28.158 + 
  28.159 +-# This sets the stack resource limit to 1023kb, which is not a multiple
  28.160 +-# of the page size since every architecture's page size is > 1k.
  28.161 +-tst-oddstacklimit-ENV = ; ulimit -s 1023;
  28.162 ++# This sets the stack resource limit to 8193kb, which is not a multiple
  28.163 ++# of the page size since every architecture's page size is 4096 bytes.
  28.164 ++tst-oddstacklimit-ENV = ; ulimit -s 8193;
  28.165 + 
  28.166 + distribute = eintr.c tst-cleanup4aux.c
  28.167 + 
  28.168 +@@ -423,6 +423,35 @@
  28.169 + CFLAGS-tst-cleanupx4.c += -fexceptions
  28.170 + CFLAGS-tst-oncex3.c += -fexceptions
  28.171 + CFLAGS-tst-oncex4.c += -fexceptions
  28.172 ++
  28.173 ++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
  28.174 ++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
  28.175 ++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
  28.176 ++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
  28.177 ++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
  28.178 ++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
  28.179 ++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
  28.180 ++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
  28.181 ++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
  28.182 ++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
  28.183 ++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
  28.184 ++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
  28.185 ++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
  28.186 ++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
  28.187 ++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
  28.188 ++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
  28.189 ++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
  28.190 ++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
  28.191 ++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
  28.192 ++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
  28.193 ++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
  28.194 ++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
  28.195 ++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
  28.196 ++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
  28.197 ++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
  28.198 ++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
  28.199 ++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
  28.200 ++
  28.201 + CFLAGS-tst-align.c += $(stack-align-test-flags)
  28.202 + CFLAGS-tst-align3.c += $(stack-align-test-flags)
  28.203 + CFLAGS-tst-initializers1.c = -W -Wall -Werror
  28.204 +diff -durN glibc-2_9.orig/nptl/pthread_barrier_wait.c glibc-2_9/nptl/pthread_barrier_wait.c
  28.205 +--- glibc-2_9.orig/nptl/pthread_barrier_wait.c	2007-08-01 06:18:50.000000000 +0200
  28.206 ++++ glibc-2_9/nptl/pthread_barrier_wait.c	2009-02-02 22:01:12.000000000 +0100
  28.207 +@@ -64,7 +64,7 @@
  28.208 +       do
  28.209 + 	lll_futex_wait (&ibarrier->curr_event, event,
  28.210 + 			ibarrier->private ^ FUTEX_PRIVATE_FLAG);
  28.211 +-      while (event == ibarrier->curr_event);
  28.212 ++      while (event == *(volatile unsigned int *)&ibarrier->curr_event);
  28.213 +     }
  28.214 + 
  28.215 +   /* Make sure the init_count is stored locally or in a register.  */
  28.216 +diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/Makefile glibc-2_9/nptl/sysdeps/pthread/Makefile
  28.217 +--- glibc-2_9.orig/nptl/sysdeps/pthread/Makefile	2006-02-28 08:09:41.000000000 +0100
  28.218 ++++ glibc-2_9/nptl/sysdeps/pthread/Makefile	2009-02-02 22:01:12.000000000 +0100
  28.219 +@@ -41,7 +41,9 @@
  28.220 + 
  28.221 + ifeq ($(have-forced-unwind),yes)
  28.222 + tests += tst-mqueue8x
  28.223 ++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
  28.224 + CFLAGS-tst-mqueue8x.c += -fexceptions
  28.225 ++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s) 
  28.226 + endif
  28.227 + endif
  28.228 + 
  28.229 +diff -durN glibc-2_9.orig/stdio-common/Makefile glibc-2_9/stdio-common/Makefile
  28.230 +--- glibc-2_9.orig/stdio-common/Makefile	2008-07-08 18:32:28.000000000 +0200
  28.231 ++++ glibc-2_9/stdio-common/Makefile	2009-02-02 22:01:12.000000000 +0100
  28.232 +@@ -80,7 +80,7 @@
  28.233 + 	$(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
  28.234 + endif
  28.235 + 
  28.236 +-CFLAGS-vfprintf.c = -Wno-uninitialized
  28.237 ++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
  28.238 + CFLAGS-vfwprintf.c = -Wno-uninitialized
  28.239 + CFLAGS-tst-printf.c = -Wno-format
  28.240 + CFLAGS-tstdiomisc.c = -Wno-format
  28.241 +diff -durN glibc-2_9.orig/sunrpc/clnt_udp.c glibc-2_9/sunrpc/clnt_udp.c
  28.242 +--- glibc-2_9.orig/sunrpc/clnt_udp.c	2008-07-26 10:42:44.000000000 +0200
  28.243 ++++ glibc-2_9/sunrpc/clnt_udp.c	2009-02-02 22:01:12.000000000 +0100
  28.244 +@@ -462,7 +462,7 @@
  28.245 +       while (inlen < 0 && errno == EINTR);
  28.246 +       if (inlen < 0)
  28.247 + 	{
  28.248 +-	  if (errno == EWOULDBLOCK)
  28.249 ++	  if (errno == EWOULDBLOCK || errno == EAGAIN)
  28.250 + 	    continue;
  28.251 + 	  cu->cu_error.re_errno = errno;
  28.252 + 	  return (cu->cu_error.re_status = RPC_CANTRECV);
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/patches/glibc/2.9/380-2.3.6-dl_execstack-PaX-support.patch	Sat Mar 28 13:34:41 2009 +0000
    29.3 @@ -0,0 +1,71 @@
    29.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/3000_all_2.3.6-dl_execstack-PaX-support.patch
    29.5 +
    29.6 +-= BEGIN original header =-
    29.7 +	With latest versions of glibc, a lot of apps failed on a PaX enabled
    29.8 +	system with:
    29.9 +		 cannot enable executable stack as shared object requires: Permission denied
   29.10 +	
   29.11 +	This is due to PaX 'exec-protecting' the stack, and ld.so then trying
   29.12 +	to make the stack executable due to some libraries not containing the
   29.13 +	PT_GNU_STACK section.  Bug #32960.  <azarah@gentoo.org> (12 Nov 2003).
   29.14 +
   29.15 +	Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
   29.16 +
   29.17 +-= END original header =-
   29.18 +
   29.19 +diff -durN glibc-2_9.orig/nptl/allocatestack.c glibc-2_9/nptl/allocatestack.c
   29.20 +--- glibc-2_9.orig/nptl/allocatestack.c	2008-08-16 00:35:27.000000000 +0200
   29.21 ++++ glibc-2_9/nptl/allocatestack.c	2009-02-02 22:01:20.000000000 +0100
   29.22 +@@ -299,7 +299,8 @@
   29.23 + # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
   29.24 + #endif
   29.25 +   if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
   29.26 +-    return errno;
   29.27 ++    if (errno != EACCES) /* PAX is enabled */
   29.28 ++    	return errno;
   29.29 + 
   29.30 +   return 0;
   29.31 + }
   29.32 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2_9/sysdeps/unix/sysv/linux/dl-execstack.c
   29.33 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/dl-execstack.c	2006-01-08 09:21:15.000000000 +0100
   29.34 ++++ glibc-2_9/sysdeps/unix/sysv/linux/dl-execstack.c	2009-02-02 22:01:20.000000000 +0100
   29.35 +@@ -63,7 +63,10 @@
   29.36 +       else
   29.37 + # endif
   29.38 + 	{
   29.39 +-	  result = errno;
   29.40 ++	  if (errno == EACCES)  /* PAX is enabled */
   29.41 ++	    result = 0;
   29.42 ++	  else
   29.43 ++	    result = errno;
   29.44 + 	  goto out;
   29.45 + 	}
   29.46 +     }
   29.47 +@@ -89,7 +92,12 @@
   29.48 + 	page -= size;
   29.49 +       else
   29.50 + 	{
   29.51 +-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
   29.52 ++	  if (errno == EACCES)		/* PAX is enabled */
   29.53 ++	    {
   29.54 ++	      result = 0;
   29.55 ++	      goto out;
   29.56 ++	    }
   29.57 ++	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
   29.58 + 	    {
   29.59 + 	      result = errno;
   29.60 + 	      goto out;
   29.61 +@@ -115,7 +123,12 @@
   29.62 + 	page += size;
   29.63 +       else
   29.64 + 	{
   29.65 +-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
   29.66 ++	  if (errno == EACCES)		/* PAX is enabled */
   29.67 ++	    {
   29.68 ++	      result = 0;
   29.69 ++	      goto out;
   29.70 ++	    }
   29.71 ++	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
   29.72 + 	    {
   29.73 + 	      result = errno;
   29.74 + 	      goto out;
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/patches/glibc/2.9/390-2.3.3_pre20040117-pt_pax.patch	Sat Mar 28 13:34:41 2009 +0000
    30.3 @@ -0,0 +1,35 @@
    30.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/3010_all_2.3.3_pre20040117-pt_pax.patch
    30.5 +
    30.6 +-= BEGIN original header =-
    30.7 +-= END original header =-
    30.8 +
    30.9 +diff -durN glibc-2_9.orig/elf/elf.h glibc-2_9/elf/elf.h
   30.10 +--- glibc-2_9.orig/elf/elf.h	2008-10-01 21:41:34.000000000 +0200
   30.11 ++++ glibc-2_9/elf/elf.h	2009-02-02 22:01:21.000000000 +0100
   30.12 +@@ -571,6 +571,7 @@
   30.13 + #define PT_GNU_EH_FRAME	0x6474e550	/* GCC .eh_frame_hdr segment */
   30.14 + #define PT_GNU_STACK	0x6474e551	/* Indicates stack executability */
   30.15 + #define PT_GNU_RELRO	0x6474e552	/* Read-only after relocation */
   30.16 ++#define PT_PAX_FLAGS	0x65041580	/* Indicates PaX flag markings */
   30.17 + #define PT_LOSUNW	0x6ffffffa
   30.18 + #define PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
   30.19 + #define PT_SUNWSTACK	0x6ffffffb	/* Stack segment */
   30.20 +@@ -584,6 +585,18 @@
   30.21 + #define PF_X		(1 << 0)	/* Segment is executable */
   30.22 + #define PF_W		(1 << 1)	/* Segment is writable */
   30.23 + #define PF_R		(1 << 2)	/* Segment is readable */
   30.24 ++#define PF_PAGEEXEC	(1 << 4)	/* Enable  PAGEEXEC */
   30.25 ++#define PF_NOPAGEEXEC	(1 << 5)	/* Disable PAGEEXEC */
   30.26 ++#define PF_SEGMEXEC	(1 << 6)	/* Enable  SEGMEXEC */
   30.27 ++#define PF_NOSEGMEXEC	(1 << 7)	/* Disable SEGMEXEC */
   30.28 ++#define PF_MPROTECT	(1 << 8)	/* Enable  MPROTECT */
   30.29 ++#define PF_NOMPROTECT	(1 << 9)	/* Disable MPROTECT */
   30.30 ++#define PF_RANDEXEC	(1 << 10)	/* Enable  RANDEXEC */
   30.31 ++#define PF_NORANDEXEC	(1 << 11)	/* Disable RANDEXEC */
   30.32 ++#define PF_EMUTRAMP	(1 << 12)	/* Enable  EMUTRAMP */
   30.33 ++#define PF_NOEMUTRAMP	(1 << 13)	/* Disable EMUTRAMP */
   30.34 ++#define PF_RANDMMAP	(1 << 14)	/* Enable  RANDMMAP */
   30.35 ++#define PF_NORANDMMAP	(1 << 15)	/* Disable RANDMMAP */
   30.36 + #define PF_MASKOS	0x0ff00000	/* OS-specific */
   30.37 + #define PF_MASKPROC	0xf0000000	/* Processor-specific */
   30.38 + 
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/patches/glibc/2.9/400-tests-sandbox-libdl-paths.patch	Sat Mar 28 13:34:41 2009 +0000
    31.3 @@ -0,0 +1,198 @@
    31.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/3020_all_glibc-tests-sandbox-libdl-paths.patch
    31.5 +
    31.6 +-= BEGIN original header =-
    31.7 +when glibc runs its tests, it does so by invoking the local library loader.
    31.8 +in Gentoo, we build/run inside of our "sandbox" which itself is linked against
    31.9 +libdl (so that it can load libraries and pull out symbols).  the trouble
   31.10 +is that when you upgrade from an older glibc to the new one, often times
   31.11 +internal symbols change name or abi.  this is normally OK as you cannot use
   31.12 +libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
   31.13 +we always say "keep all of the glibc libraries from the same build".  but
   31.14 +when glibc runs its tests, it uses dynamic paths to point to its new local
   31.15 +copies of libraries.  if the test doesnt use libdl, then glibc doesnt add
   31.16 +its path, and when sandbox triggers the loading of libdl, glibc does so
   31.17 +from the host system system.  this gets us into the case of all libraries
   31.18 +are from the locally compiled version of glibc except for libdl.so.
   31.19 +
   31.20 +Fix by Wormo
   31.21 +
   31.22 +http://bugs.gentoo.org/56898
   31.23 +
   31.24 +-= END original header =-
   31.25 +
   31.26 +diff -durN glibc-2_9.orig/grp/tst_fgetgrent.sh glibc-2_9/grp/tst_fgetgrent.sh
   31.27 +--- glibc-2_9.orig/grp/tst_fgetgrent.sh	2001-07-06 06:54:46.000000000 +0200
   31.28 ++++ glibc-2_9/grp/tst_fgetgrent.sh	2009-02-02 22:01:23.000000000 +0100
   31.29 +@@ -24,7 +24,8 @@
   31.30 + rtld_installed_name=$1; shift
   31.31 + 
   31.32 + testout=${common_objpfx}/grp/tst_fgetgrent.out
   31.33 +-library_path=${common_objpfx}
   31.34 ++# make sure libdl is also in path in case sandbox is in use
   31.35 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   31.36 + 
   31.37 + result=0
   31.38 + 
   31.39 +diff -durN glibc-2_9.orig/iconvdata/run-iconv-test.sh glibc-2_9/iconvdata/run-iconv-test.sh
   31.40 +--- glibc-2_9.orig/iconvdata/run-iconv-test.sh	2008-05-15 03:59:44.000000000 +0200
   31.41 ++++ glibc-2_9/iconvdata/run-iconv-test.sh	2009-02-02 22:01:23.000000000 +0100
   31.42 +@@ -34,7 +34,7 @@
   31.43 + export GCONV_PATH
   31.44 + 
   31.45 + # We have to have some directories in the library path.
   31.46 +-LIBPATH=$codir:$codir/iconvdata
   31.47 ++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
   31.48 + 
   31.49 + # How the start the iconv(1) program.
   31.50 + ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
   31.51 +diff -durN glibc-2_9.orig/iconvdata/tst-table.sh glibc-2_9/iconvdata/tst-table.sh
   31.52 +--- glibc-2_9.orig/iconvdata/tst-table.sh	2002-04-24 23:39:35.000000000 +0200
   31.53 ++++ glibc-2_9/iconvdata/tst-table.sh	2009-02-02 22:01:23.000000000 +0100
   31.54 +@@ -59,8 +59,11 @@
   31.55 +   irreversible=${charset}.irreversible
   31.56 + fi
   31.57 + 
   31.58 ++# make sure libdl is also in path in case sandbox is in use
   31.59 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   31.60 ++
   31.61 + # iconv in one direction.
   31.62 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
   31.63 ++${common_objpfx}elf/ld.so --library-path $library_path \
   31.64 + ${objpfx}tst-table-from ${charset} \
   31.65 +   > ${objpfx}tst-${charset}.table
   31.66 + 
   31.67 +diff -durN glibc-2_9.orig/intl/tst-codeset.sh glibc-2_9/intl/tst-codeset.sh
   31.68 +--- glibc-2_9.orig/intl/tst-codeset.sh	2005-04-06 04:18:35.000000000 +0200
   31.69 ++++ glibc-2_9/intl/tst-codeset.sh	2009-02-02 22:01:23.000000000 +0100
   31.70 +@@ -37,6 +37,9 @@
   31.71 + LOCPATH=${common_objpfx}localedata
   31.72 + export LOCPATH
   31.73 + 
   31.74 ++# make sure libdl is also in path in case sandbox is in use
   31.75 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   31.76 ++
   31.77 + ${common_objpfx}elf/ld.so --library-path $common_objpfx \
   31.78 + ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
   31.79 + 
   31.80 +diff -durN glibc-2_9.orig/intl/tst-gettext.sh glibc-2_9/intl/tst-gettext.sh
   31.81 +--- glibc-2_9.orig/intl/tst-gettext.sh	2004-08-15 21:28:18.000000000 +0200
   31.82 ++++ glibc-2_9/intl/tst-gettext.sh	2009-02-02 22:01:23.000000000 +0100
   31.83 +@@ -51,9 +51,12 @@
   31.84 + LOCPATH=${common_objpfx}localedata
   31.85 + export LOCPATH
   31.86 + 
   31.87 ++# make sure libdl is also in path in case sandbox is in use
   31.88 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
   31.89 ++
   31.90 + # Now run the test.
   31.91 + MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
   31.92 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
   31.93 ++${common_objpfx}elf/ld.so --library-path $library_path \
   31.94 + ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
   31.95 + 
   31.96 + exit $?
   31.97 +diff -durN glibc-2_9.orig/intl/tst-gettext2.sh glibc-2_9/intl/tst-gettext2.sh
   31.98 +--- glibc-2_9.orig/intl/tst-gettext2.sh	2005-05-04 19:54:48.000000000 +0200
   31.99 ++++ glibc-2_9/intl/tst-gettext2.sh	2009-02-02 22:01:23.000000000 +0100
  31.100 +@@ -65,8 +65,11 @@
  31.101 + LOCPATH=${objpfx}domaindir
  31.102 + export LOCPATH
  31.103 + 
  31.104 ++# make sure libdl is also in path in case sandbox is in use
  31.105 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  31.106 ++
  31.107 + # Now run the test.
  31.108 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
  31.109 ++${common_objpfx}elf/ld.so --library-path $library_path \
  31.110 + ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
  31.111 + cmp ${objpfx}tst-gettext2.out - <<EOF
  31.112 + String1 - Lang1: 1st string
  31.113 +diff -durN glibc-2_9.orig/intl/tst-translit.sh glibc-2_9/intl/tst-translit.sh
  31.114 +--- glibc-2_9.orig/intl/tst-translit.sh	2005-05-04 19:56:10.000000000 +0200
  31.115 ++++ glibc-2_9/intl/tst-translit.sh	2009-02-02 22:01:23.000000000 +0100
  31.116 +@@ -36,7 +36,10 @@
  31.117 + LOCPATH=${common_objpfx}localedata
  31.118 + export LOCPATH
  31.119 + 
  31.120 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
  31.121 ++# make sure libdl is also in path in case sandbox is in use
  31.122 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  31.123 ++
  31.124 ++${common_objpfx}elf/ld.so --library-path $library_path \
  31.125 + ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
  31.126 + 
  31.127 + exit $?
  31.128 +diff -durN glibc-2_9.orig/malloc/tst-mtrace.sh glibc-2_9/malloc/tst-mtrace.sh
  31.129 +--- glibc-2_9.orig/malloc/tst-mtrace.sh	2005-10-15 01:40:35.000000000 +0200
  31.130 ++++ glibc-2_9/malloc/tst-mtrace.sh	2009-02-02 22:01:23.000000000 +0100
  31.131 +@@ -24,9 +24,12 @@
  31.132 + status=0
  31.133 + trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
  31.134 + 
  31.135 ++# make sure libdl is also in path in case sandbox is in use
  31.136 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  31.137 ++
  31.138 + MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
  31.139 + LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
  31.140 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
  31.141 ++${common_objpfx}elf/ld.so --library-path $library_path \
  31.142 +   ${common_objpfx}malloc/tst-mtrace || status=1
  31.143 + 
  31.144 + if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
  31.145 +diff -durN glibc-2_9.orig/nptl/tst-tls6.sh glibc-2_9/nptl/tst-tls6.sh
  31.146 +--- glibc-2_9.orig/nptl/tst-tls6.sh	2003-09-03 00:02:59.000000000 +0200
  31.147 ++++ glibc-2_9/nptl/tst-tls6.sh	2009-02-02 22:01:23.000000000 +0100
  31.148 +@@ -5,8 +5,8 @@
  31.149 + rtld_installed_name=$1; shift
  31.150 + logfile=$common_objpfx/nptl/tst-tls6.out
  31.151 + 
  31.152 +-# We have to find libc and nptl
  31.153 +-library_path=${common_objpfx}:${common_objpfx}nptl
  31.154 ++# We have to find libc and nptl (also libdl in case sandbox is in use)
  31.155 ++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
  31.156 + tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
  31.157 + 	  ${common_objpfx}/nptl/tst-tls5"
  31.158 + 
  31.159 +diff -durN glibc-2_9.orig/posix/globtest.sh glibc-2_9/posix/globtest.sh
  31.160 +--- glibc-2_9.orig/posix/globtest.sh	2007-02-14 20:52:33.000000000 +0100
  31.161 ++++ glibc-2_9/posix/globtest.sh	2009-02-02 22:01:23.000000000 +0100
  31.162 +@@ -18,7 +18,7 @@
  31.163 + esac
  31.164 + 
  31.165 + # We have to find the libc and the NSS modules.
  31.166 +-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
  31.167 ++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
  31.168 + 
  31.169 + # Since we use `sort' we must make sure to use the same locale everywhere.
  31.170 + LC_ALL=C
  31.171 +diff -durN glibc-2_9.orig/posix/tst-getconf.sh glibc-2_9/posix/tst-getconf.sh
  31.172 +--- glibc-2_9.orig/posix/tst-getconf.sh	2002-09-01 13:11:25.000000000 +0200
  31.173 ++++ glibc-2_9/posix/tst-getconf.sh	2009-02-02 22:01:23.000000000 +0100
  31.174 +@@ -10,7 +10,10 @@
  31.175 + else
  31.176 +   rtld_installed_name=$1; shift
  31.177 +   runit() {
  31.178 +-    ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
  31.179 ++    
  31.180 ++  # make sure libdl is also in path in case sandbox is in use
  31.181 ++  library_path=${common_objpfx}:${common_objpfx}/dlfcn
  31.182 ++    ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
  31.183 +   }
  31.184 + fi
  31.185 + 
  31.186 +diff -durN glibc-2_9.orig/posix/wordexp-tst.sh glibc-2_9/posix/wordexp-tst.sh
  31.187 +--- glibc-2_9.orig/posix/wordexp-tst.sh	2000-10-20 18:23:30.000000000 +0200
  31.188 ++++ glibc-2_9/posix/wordexp-tst.sh	2009-02-02 22:01:23.000000000 +0100
  31.189 +@@ -19,8 +19,11 @@
  31.190 + "
  31.191 + export IFS
  31.192 + 
  31.193 ++# make sure libdl is also in path in case sandbox is in use
  31.194 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
  31.195 ++
  31.196 + failed=0
  31.197 +-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
  31.198 ++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
  31.199 + ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
  31.200 + cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
  31.201 + wordexp returned 0
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/patches/glibc/2.9/410-2.9-fnmatch.patch	Sat Mar 28 13:34:41 2009 +0000
    32.3 @@ -0,0 +1,64 @@
    32.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/5021_all_2.9-fnmatch.patch
    32.5 +
    32.6 +-= BEGIN original header =-
    32.7 +http://sourceware.org/ml/libc-hacker/2002-11/msg00071.html
    32.8 +
    32.9 +When fnmatch detects an invalid multibyte character it should fall back to
   32.10 +single byte matching, so that "*" has a chance to match such a string.
   32.11 +
   32.12 +Andreas.
   32.13 +
   32.14 +2005-04-12  Andreas Schwab  <schwab@suse.de>
   32.15 +
   32.16 +	* posix/fnmatch.c (fnmatch): If conversion to wide character
   32.17 +	fails fall back to single byte matching.
   32.18 +
   32.19 +-= END original header =-
   32.20 +
   32.21 +diff -durN glibc-2_9.orig/posix/fnmatch.c glibc-2_9/posix/fnmatch.c
   32.22 +--- glibc-2_9.orig/posix/fnmatch.c	2007-07-28 22:35:00.000000000 +0200
   32.23 ++++ glibc-2_9/posix/fnmatch.c	2009-02-02 22:01:25.000000000 +0100
   32.24 +@@ -327,6 +327,7 @@
   32.25 + # if HANDLE_MULTIBYTE
   32.26 +   if (__builtin_expect (MB_CUR_MAX, 1) != 1)
   32.27 +     {
   32.28 ++      const char *orig_pattern = pattern;
   32.29 +       mbstate_t ps;
   32.30 +       size_t n;
   32.31 +       const char *p;
   32.32 +@@ -382,10 +383,8 @@
   32.33 + 	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
   32.34 + 	  n = mbsrtowcs (wstring, &p, n + 1, &ps);
   32.35 + 	  if (__builtin_expect (n == (size_t) -1, 0))
   32.36 +-	    /* Something wrong.
   32.37 +-	       XXX Do we have to set `errno' to something which mbsrtows hasn't
   32.38 +-	       already done?  */
   32.39 +-	    return -1;
   32.40 ++	    /* Something wrong.  Fall back to single byte matching.  */
   32.41 ++	    goto try_singlebyte;
   32.42 + 	  if (p)
   32.43 + 	    {
   32.44 + 	      memset (&ps, '\0', sizeof (ps));
   32.45 +@@ -397,10 +396,8 @@
   32.46 + 	prepare_wstring:
   32.47 + 	  n = mbsrtowcs (NULL, &string, 0, &ps);
   32.48 + 	  if (__builtin_expect (n == (size_t) -1, 0))
   32.49 +-	    /* Something wrong.
   32.50 +-	       XXX Do we have to set `errno' to something which mbsrtows hasn't
   32.51 +-	       already done?  */
   32.52 +-	    return -1;
   32.53 ++	    /* Something wrong.  Fall back to single byte matching.  */
   32.54 ++	    goto try_singlebyte;
   32.55 + 	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
   32.56 + 	  assert (mbsinit (&ps));
   32.57 + 	  (void) mbsrtowcs (wstring, &string, n + 1, &ps);
   32.58 +@@ -408,6 +405,9 @@
   32.59 + 
   32.60 +       return internal_fnwmatch (wpattern, wstring, wstring + n,
   32.61 + 				flags & FNM_PERIOD, flags, NULL);
   32.62 ++
   32.63 ++    try_singlebyte:
   32.64 ++      pattern = orig_pattern;
   32.65 +     }
   32.66 + # endif  /* mbstate_t and mbsrtowcs or _LIBC.  */
   32.67 + 
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/patches/glibc/2.9/420-dont-build-timezone.patch	Sat Mar 28 13:34:41 2009 +0000
    33.3 @@ -0,0 +1,19 @@
    33.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/5063_all_glibc-dont-build-timezone.patch
    33.5 +
    33.6 +-= BEGIN original header =-
    33.7 +timezone data has been split into the package sys-libs/timezone-data
    33.8 +
    33.9 +-= END original header =-
   33.10 +
   33.11 +diff -durN glibc-2_9.orig/Makeconfig glibc-2_9/Makeconfig
   33.12 +--- glibc-2_9.orig/Makeconfig	2009-02-02 22:01:05.000000000 +0100
   33.13 ++++ glibc-2_9/Makeconfig	2009-02-02 22:01:27.000000000 +0100
   33.14 +@@ -919,7 +919,7 @@
   33.15 + 	      stdlib stdio-common libio malloc string wcsmbs time dirent    \
   33.16 + 	      grp pwd posix io termios resource misc socket sysvipc gmon    \
   33.17 + 	      gnulib iconv iconvdata wctype manual shadow po argp	    \
   33.18 +-	      crypt nss localedata timezone rt conform debug		    \
   33.19 ++	      crypt nss localedata rt conform debug		    \
   33.20 + 	      $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
   33.21 + 
   33.22 + ifndef avoid-generated
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/patches/glibc/2.9/430-2.7-cross-compile-nptl.patch	Sat Mar 28 13:34:41 2009 +0000
    34.3 @@ -0,0 +1,57 @@
    34.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/5070_all_glibc-2.7-cross-compile-nptl.patch
    34.5 +
    34.6 +-= BEGIN original header =-
    34.7 +A little hack for cross-compiling NPTL
    34.8 +
    34.9 +http://sourceware.org/ml/libc-alpha/2005-02/msg00043.html
   34.10 +
   34.11 +-= END original header =-
   34.12 +
   34.13 +diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/configure glibc-2_9/nptl/sysdeps/pthread/configure
   34.14 +--- glibc-2_9.orig/nptl/sysdeps/pthread/configure	2007-10-17 00:24:30.000000000 +0200
   34.15 ++++ glibc-2_9/nptl/sysdeps/pthread/configure	2009-02-02 22:01:28.000000000 +0100
   34.16 +@@ -78,6 +78,10 @@
   34.17 + fi
   34.18 + { echo "$as_me:$LINENO: result: $libc_cv_forced_unwind" >&5
   34.19 + echo "${ECHO_T}$libc_cv_forced_unwind" >&6; }
   34.20 ++if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
   34.21 ++  echo "$as_me:$LINENO: forcing libc_cv_forced_unwind = yes for cross-compile"
   34.22 ++  libc_cv_forced_unwind=yes
   34.23 ++fi
   34.24 + if test $libc_cv_forced_unwind = yes; then
   34.25 +   cat >>confdefs.h <<\_ACEOF
   34.26 + #define HAVE_FORCED_UNWIND 1
   34.27 +@@ -141,6 +145,10 @@
   34.28 + { echo "$as_me:$LINENO: result: $libc_cv_c_cleanup" >&5
   34.29 + echo "${ECHO_T}$libc_cv_c_cleanup" >&6; }
   34.30 +   CFLAGS="$old_CFLAGS"
   34.31 ++  if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
   34.32 ++    echo "$as_me:$LINENO: result: forcing libc_cv_c_cleanup = yes for cross-compile"
   34.33 ++    libc_cv_c_cleanup=yes
   34.34 ++  fi
   34.35 +   if test $libc_cv_c_cleanup = no; then
   34.36 +     { { echo "$as_me:$LINENO: error: the compiler must support C cleanup handling" >&5
   34.37 + echo "$as_me: error: the compiler must support C cleanup handling" >&2;}
   34.38 +diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/configure.in glibc-2_9/nptl/sysdeps/pthread/configure.in
   34.39 +--- glibc-2_9.orig/nptl/sysdeps/pthread/configure.in	2003-12-03 07:50:01.000000000 +0100
   34.40 ++++ glibc-2_9/nptl/sysdeps/pthread/configure.in	2009-02-02 22:01:28.000000000 +0100
   34.41 +@@ -28,6 +28,9 @@
   34.42 + struct _Unwind_Context *context;
   34.43 + _Unwind_GetCFA (context)],
   34.44 + libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)])
   34.45 ++if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
   34.46 ++  libc_cv_forced_unwind=yes
   34.47 ++fi
   34.48 + if test $libc_cv_forced_unwind = yes; then
   34.49 +   AC_DEFINE(HAVE_FORCED_UNWIND)
   34.50 + dnl Check for C cleanup handling.
   34.51 +@@ -41,6 +44,9 @@
   34.52 +   puts ("test")],
   34.53 + libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)])
   34.54 +   CFLAGS="$old_CFLAGS"
   34.55 ++  if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
   34.56 ++    libc_cv_c_cleanup=yes
   34.57 ++  fi
   34.58 +   if test $libc_cv_c_cleanup = no; then
   34.59 +     AC_MSG_ERROR([the compiler must support C cleanup handling])
   34.60 +   fi
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/patches/glibc/2.9/440-alpha-glibc-2.4-xstat.patch	Sat Mar 28 13:34:41 2009 +0000
    35.3 @@ -0,0 +1,249 @@
    35.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/6001_all_alpha-glibc-2.4-xstat.patch
    35.5 +
    35.6 +-= BEGIN original header =-
    35.7 +http://sources.redhat.com/bugzilla/show_bug.cgi?id=1026
    35.8 +http://sourceware.org/ml/libc-alpha/2005-02/msg00122.html
    35.9 +
   35.10 +2005-02-26  GOTO Masanori  <gotom@debian.or.jp>
   35.11 +
   35.12 +	* sysdeps/unix/sysv/linux/kernel-features.h: Define
   35.13 +	__ASSUME_STAT64_SYSCALL.
   35.14 +	* sysdeps/unix/sysv/linux/alpha/fxstat.c: Check
   35.15 +	__ASSUME_STAT64_SYSCALL.
   35.16 +	* sysdeps/unix/sysv/linux/alpha/fxstatat.c: Likewise.
   35.17 +	* sysdeps/unix/sysv/linux/alpha/lxstat.c: Likewise.
   35.18 +	* sysdeps/unix/sysv/linux/alpha/xstat.c: Likewise.
   35.19 +	* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Don't define
   35.20 +	__libc_missing_axp_stat64 when it's not needed.
   35.21 +	* sysdeps/unix/sysv/linux/alpha/xstatconv.h: Likewise.
   35.22 +
   35.23 +-= END original header =-
   35.24 +
   35.25 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstat.c
   35.26 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstat.c	2004-03-11 03:58:44.000000000 +0100
   35.27 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstat.c	2009-02-02 22:01:30.000000000 +0100
   35.28 +@@ -35,27 +35,39 @@
   35.29 + __fxstat (int vers, int fd, struct stat *buf)
   35.30 + {
   35.31 +   INTERNAL_SYSCALL_DECL (err);
   35.32 +-  int result, errno_out;
   35.33 ++  int result;
   35.34 +   struct kernel_stat kbuf;
   35.35 + 
   35.36 ++#if __ASSUME_STAT64_SYSCALL > 0
   35.37 ++  if (vers == _STAT_VER_KERNEL64)
   35.38 ++    {
   35.39 ++      result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
   35.40 ++      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   35.41 ++	return result;
   35.42 ++      __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
   35.43 ++      return -1;
   35.44 ++    }
   35.45 ++#elif defined __NR_fstat64
   35.46 +   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
   35.47 +     {
   35.48 ++      int errno_out;
   35.49 +       result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
   35.50 +       if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   35.51 + 	return result;
   35.52 +       errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
   35.53 +       if (errno_out != ENOSYS)
   35.54 +-	goto fail;
   35.55 ++	{
   35.56 ++	  __set_errno (errno_out);
   35.57 ++	  return -1;
   35.58 ++	}
   35.59 +       __libc_missing_axp_stat64 = 1;
   35.60 +     }
   35.61 ++#endif
   35.62 + 
   35.63 +   result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf);
   35.64 +   if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   35.65 +     return __xstat_conv (vers, &kbuf, buf);
   35.66 +-  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
   35.67 +-  
   35.68 +- fail:
   35.69 +-  __set_errno (errno_out);
   35.70 ++  __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
   35.71 +   return -1;
   35.72 + }
   35.73 + hidden_def (__fxstat)
   35.74 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstatat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstatat.c
   35.75 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstatat.c	2006-02-20 23:51:48.000000000 +0100
   35.76 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstatat.c	2009-02-02 22:01:30.000000000 +0100
   35.77 +@@ -65,6 +65,20 @@
   35.78 +   int result, errno_out;
   35.79 +   struct kernel_stat kst;
   35.80 + 
   35.81 ++#if __ASSUME_STAT64_SYSCALL > 0
   35.82 ++  if (vers == _STAT_VER_KERNEL64)
   35.83 ++    {
   35.84 ++      if (flag & AT_SYMLINK_NOFOLLOW)
   35.85 ++	result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
   35.86 ++      else
   35.87 ++	result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
   35.88 ++
   35.89 ++      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   35.90 ++	return result;
   35.91 ++      errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
   35.92 ++      goto fail;
   35.93 ++    }
   35.94 ++#elif defined __NR_stat64
   35.95 +   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
   35.96 +     {
   35.97 +       if (flag & AT_SYMLINK_NOFOLLOW)
   35.98 +@@ -79,6 +93,7 @@
   35.99 + 	goto fail;
  35.100 +       __libc_missing_axp_stat64 = 1;
  35.101 +     }
  35.102 ++#endif
  35.103 + 
  35.104 +   if (flag & AT_SYMLINK_NOFOLLOW)
  35.105 +     result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst);
  35.106 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/lxstat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/lxstat.c
  35.107 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/lxstat.c	2004-03-11 03:58:44.000000000 +0100
  35.108 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/lxstat.c	2009-02-02 22:01:30.000000000 +0100
  35.109 +@@ -35,27 +35,39 @@
  35.110 + __lxstat (int vers, const char *name, struct stat *buf)
  35.111 + {
  35.112 +   INTERNAL_SYSCALL_DECL (err);
  35.113 +-  int result, errno_out;
  35.114 ++  int result;
  35.115 +   struct kernel_stat kbuf;
  35.116 + 
  35.117 ++#if __ASSUME_STAT64_SYSCALL > 0
  35.118 ++  if (vers == _STAT_VER_KERNEL64)
  35.119 ++    {
  35.120 ++      result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
  35.121 ++      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  35.122 ++	return result;
  35.123 ++      __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  35.124 ++      return -1;
  35.125 ++    }
  35.126 ++#elif defined __NR_lstat64
  35.127 +   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
  35.128 +     {
  35.129 ++      int errno_out;
  35.130 +       result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
  35.131 +       if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  35.132 + 	return result;
  35.133 +       errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  35.134 +       if (errno_out != ENOSYS)
  35.135 +-	goto fail;
  35.136 ++	{
  35.137 ++	  __set_errno (errno_out);
  35.138 ++	  return -1;
  35.139 ++	}
  35.140 +       __libc_missing_axp_stat64 = 1;
  35.141 +     }
  35.142 ++#endif
  35.143 + 
  35.144 +   result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf);
  35.145 +   if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  35.146 +     return __xstat_conv (vers, &kbuf, buf);
  35.147 +-  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  35.148 +-  
  35.149 +- fail:
  35.150 +-  __set_errno (errno_out);
  35.151 ++  __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  35.152 +   return -1;
  35.153 + }
  35.154 + hidden_def (__lxstat)
  35.155 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstat.c
  35.156 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstat.c	2004-03-11 03:58:44.000000000 +0100
  35.157 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstat.c	2009-02-02 22:01:30.000000000 +0100
  35.158 +@@ -35,27 +35,39 @@
  35.159 + __xstat (int vers, const char *name, struct stat *buf)
  35.160 + {
  35.161 +   INTERNAL_SYSCALL_DECL (err);
  35.162 +-  int result, errno_out;
  35.163 ++  int result;
  35.164 +   struct kernel_stat kbuf;
  35.165 + 
  35.166 ++#if __ASSUME_STAT64_SYSCALL > 0
  35.167 ++  if (vers == _STAT_VER_KERNEL64)
  35.168 ++    {
  35.169 ++      result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
  35.170 ++      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  35.171 ++	return result;
  35.172 ++      __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  35.173 ++      return -1;
  35.174 ++    }
  35.175 ++#elif defined __NR_stat64
  35.176 +   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
  35.177 +     {
  35.178 ++      int errno_out;
  35.179 +       result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
  35.180 +       if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  35.181 + 	return result;
  35.182 +       errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  35.183 +       if (errno_out != ENOSYS)
  35.184 +-	goto fail;
  35.185 ++	{
  35.186 ++	  __set_errno (errno_out);
  35.187 ++	  return -1;
  35.188 ++	}
  35.189 +       __libc_missing_axp_stat64 = 1;
  35.190 +     }
  35.191 ++#endif
  35.192 + 
  35.193 +   result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf);
  35.194 +   if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  35.195 +     return __xstat_conv (vers, &kbuf, buf);
  35.196 +-  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  35.197 +-  
  35.198 +- fail:
  35.199 +-  __set_errno (errno_out);
  35.200 ++  __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  35.201 +   return -1;
  35.202 + }
  35.203 + hidden_def (__xstat)
  35.204 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.c
  35.205 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.c	2004-03-11 03:58:44.000000000 +0100
  35.206 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.c	2009-02-02 22:01:30.000000000 +0100
  35.207 +@@ -22,9 +22,14 @@
  35.208 + #include <sys/stat.h>
  35.209 + #include <kernel_stat.h>
  35.210 + #include <xstatconv.h>
  35.211 ++#include <sys/syscall.h>
  35.212 + 
  35.213 + 
  35.214 ++#ifdef __NR_stat64
  35.215 ++# if __ASSUME_STAT64_SYSCALL == 0
  35.216 + int __libc_missing_axp_stat64;
  35.217 ++# endif
  35.218 ++#endif
  35.219 + 
  35.220 + int
  35.221 + __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
  35.222 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.h
  35.223 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.h	2006-01-08 09:21:16.000000000 +0100
  35.224 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.h	2009-02-02 22:01:30.000000000 +0100
  35.225 +@@ -18,7 +18,12 @@
  35.226 +    02111-1307 USA.  */
  35.227 + 
  35.228 + #include <kernel-features.h>
  35.229 ++#include <sys/syscall.h>
  35.230 + 
  35.231 ++#ifdef __NR_stat64
  35.232 ++# if __ASSUME_STAT64_SYSCALL == 0
  35.233 + extern int __libc_missing_axp_stat64 attribute_hidden;
  35.234 ++# endif
  35.235 ++#endif
  35.236 + extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
  35.237 +   attribute_hidden;
  35.238 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2_9/sysdeps/unix/sysv/linux/kernel-features.h
  35.239 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/kernel-features.h	2008-08-01 23:51:04.000000000 +0200
  35.240 ++++ glibc-2_9/sysdeps/unix/sysv/linux/kernel-features.h	2009-02-02 22:01:30.000000000 +0100
  35.241 +@@ -395,6 +395,11 @@
  35.242 + # define __ASSUME_GETDENTS32_D_TYPE	1
  35.243 + #endif
  35.244 + 
  35.245 ++/* Starting with version 2.6.4, alpha stat64 syscalls are available.  */
  35.246 ++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
  35.247 ++# define __ASSUME_STAT64_SYSCALL	1
  35.248 ++#endif
  35.249 ++
  35.250 + /* Starting with version 2.5.3, the initial location returned by `brk'
  35.251 +    after exec is always rounded up to the next page.  */
  35.252 + #if __LINUX_KERNEL_VERSION >= 132355
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/patches/glibc/2.9/450-alpha-glibc-2.5-no-page-header.patch	Sat Mar 28 13:34:41 2009 +0000
    36.3 @@ -0,0 +1,32 @@
    36.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/6015_all_alpha-glibc-2.5-no-page-header.patch
    36.5 +
    36.6 +-= BEGIN original header =-
    36.7 +2008-06-07  Mike Frysinger  <vapier@gentoo.org>
    36.8 +
    36.9 +	* sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions
   36.10 +	from the kernel header to sys/user.h and remove the #include of
   36.11 +	sys/user.h.
   36.12 +
   36.13 +-= END original header =-
   36.14 +
   36.15 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/user.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/user.h
   36.16 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/user.h	2001-07-06 06:56:13.000000000 +0200
   36.17 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/user.h	2009-02-02 22:01:32.000000000 +0100
   36.18 +@@ -23,7 +23,6 @@
   36.19 +    only. Don't read too much into it. Don't use it for anything other
   36.20 +    than gdb/strace unless you know what you are doing. */
   36.21 + 
   36.22 +-#include <asm/page.h>
   36.23 + #include <asm/reg.h>
   36.24 + 
   36.25 + struct user
   36.26 +@@ -41,6 +40,9 @@
   36.27 +   char u_comm[32];				/* user command name */
   36.28 + };
   36.29 + 
   36.30 ++#define PAGE_SHIFT		13
   36.31 ++#define PAGE_SIZE		(1 << PAGE_SHIFT)
   36.32 ++#define PAGE_MASK		(~(PAGE_SIZE-1))
   36.33 + #define NBPG			PAGE_SIZE
   36.34 + #define UPAGES			1
   36.35 + #define HOST_TEXT_START_ADDR	(u.start_code)
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/patches/glibc/2.9/460-alpha-glibc-2.5-no-asm-elf-header.patch	Sat Mar 28 13:34:41 2009 +0000
    37.3 @@ -0,0 +1,38 @@
    37.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/6016_all_alpha-glibc-2.5-no-asm-elf-header.patch
    37.5 +
    37.6 +-= BEGIN original header =-
    37.7 +2007-03-13  Mike Frysinger  <vapier@gentoo.org>
    37.8 +
    37.9 +	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some defines
   37.10 +	from alpha's asm/elf.h
   37.11 +
   37.12 +-= END original header =-
   37.13 +
   37.14 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/procfs.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
   37.15 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/procfs.h	2001-07-06 06:56:13.000000000 +0200
   37.16 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/procfs.h	2009-02-02 22:01:33.000000000 +0100
   37.17 +@@ -29,10 +29,23 @@
   37.18 + #include <sys/types.h>
   37.19 + #include <sys/ucontext.h>
   37.20 + #include <sys/user.h>
   37.21 +-#include <asm/elf.h>
   37.22 + 
   37.23 + __BEGIN_DECLS
   37.24 + 
   37.25 ++/*
   37.26 ++ * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
   37.27 ++ * I have no idea why that is so.  For now, we just leave it at 33
   37.28 ++ * (32 general regs + processor status word). 
   37.29 ++ */
   37.30 ++#define ELF_NGREG	33
   37.31 ++#define ELF_NFPREG	32
   37.32 ++
   37.33 ++typedef unsigned long elf_greg_t;
   37.34 ++typedef elf_greg_t elf_gregset_t[ELF_NGREG];
   37.35 ++
   37.36 ++typedef double elf_fpreg_t;
   37.37 ++typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
   37.38 ++
   37.39 + struct elf_siginfo
   37.40 +   {
   37.41 +     int si_signo;			/* Signal number.  */
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/patches/glibc/2.9/470-alpha-glibc-2.8-creat.patch	Sat Mar 28 13:34:41 2009 +0000
    38.3 @@ -0,0 +1,19 @@
    38.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/6017_all_alpha-glibc-2.8-creat.patch
    38.5 +
    38.6 +-= BEGIN original header =-
    38.7 +alpha does not have a __NR_creat
    38.8 +
    38.9 +http://bugs.gentoo.org/227275
   38.10 +http://sourceware.org/bugzilla/show_bug.cgi?id=6650
   38.11 +
   38.12 +-= END original header =-
   38.13 +
   38.14 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2_9/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
   38.15 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2007-11-10 20:34:26.000000000 +0100
   38.16 ++++ glibc-2_9/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2009-02-02 22:01:35.000000000 +0100
   38.17 +@@ -1 +1,5 @@
   38.18 + /* Defined as alias for the syscall.  */
   38.19 ++#include <sysdep.h>
   38.20 ++#ifndef __NR_creat
   38.21 ++#include "../../../../../io/creat64.c"
   38.22 ++#endif
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/patches/glibc/2.9/480-alpha-glibc-2.8-cache-shape.patch	Sat Mar 28 13:34:41 2009 +0000
    39.3 @@ -0,0 +1,18 @@
    39.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/6018_all_alpha-glibc-2.8-cache-shape.patch
    39.5 +
    39.6 +-= BEGIN original header =-
    39.7 +older verisons of glibc would build dl-sysdep as shared-only and dl-support as
    39.8 +static-only.  alpha hooks in a cache variable via dl-auxv.h.  newer versions of
    39.9 +glibc build dl-sysdep as both shared and static which means we now have symbol
   39.10 +duplication for static builds with dl-sysdep and dl-support.  since dl-sysdep
   39.11 +is both shared/static, there is no point in hooking dl-support anymore, so we
   39.12 +can punt it.
   39.13 +
   39.14 +-= END original header =-
   39.15 +
   39.16 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/dl-support.c
   39.17 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/dl-support.c	2007-03-13 22:25:16.000000000 +0100
   39.18 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/dl-support.c	2009-02-02 22:01:37.000000000 +0100
   39.19 +@@ -1,2 +0,0 @@
   39.20 +-#include "dl-auxv.h"
   39.21 +-#include <elf/dl-support.c>
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/patches/glibc/2.9/490-ptr-mangling.patch	Sat Mar 28 13:34:41 2009 +0000
    40.3 @@ -0,0 +1,114 @@
    40.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/6018_all_glibc-ptr-mangling.patch
    40.5 +
    40.6 +-= BEGIN original header =-
    40.7 +http://bugs.gentoo.org/201910
    40.8 +
    40.9 +For every arch, PTR_MANGLE and PTR_DEMANGLE defines are in
   40.10 +sysdeps/unix/sysv/linux/<arch>/sysdep.h. But for alpha this is not true. The
   40.11 +defines are in sysdeps/unix/alpha/sysdep.h and unix/sysv/linux/alpha/sysdep.h
   40.12 +includes the first.
   40.13 +
   40.14 +This is a patch that fixes the issue and let alpha build, at the expense of
   40.15 +disabling MANGLING in the non PIC case, but googling showed that the issue is
   40.16 +known, and that nobody really cares about it. 
   40.17 +
   40.18 +Info from: http://sourceware.org/bugzilla/show_bug.cgi?id=5216
   40.19 +
   40.20 +-= END original header =-
   40.21 +
   40.22 +diff -durN glibc-2_9.orig/sysdeps/unix/alpha/sysdep.h glibc-2_9/sysdeps/unix/alpha/sysdep.h
   40.23 +--- glibc-2_9.orig/sysdeps/unix/alpha/sysdep.h	2006-03-03 12:21:28.000000000 +0100
   40.24 ++++ glibc-2_9/sysdeps/unix/alpha/sysdep.h	2009-02-02 22:01:39.000000000 +0100
   40.25 +@@ -397,42 +397,4 @@
   40.26 + 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
   40.27 + }
   40.28 + 
   40.29 +-/* Pointer mangling support.  Note that tls access is slow enough that
   40.30 +-   we don't deoptimize things by placing the pointer check value there.  */
   40.31 +-
   40.32 +-#include <stdint.h>
   40.33 +-
   40.34 +-#if defined NOT_IN_libc && defined IS_IN_rtld
   40.35 +-# ifdef __ASSEMBLER__
   40.36 +-#  define PTR_MANGLE(dst, src, tmp)				\
   40.37 +-	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
   40.38 +-	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
   40.39 +-	xor	src, tmp, dst
   40.40 +-#  define PTR_MANGLE2(dst, src, tmp)				\
   40.41 +-	xor	src, tmp, dst
   40.42 +-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   40.43 +-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   40.44 +-# else
   40.45 +-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
   40.46 +-#  define PTR_MANGLE(var)	\
   40.47 +-  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
   40.48 +-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
   40.49 +-# endif
   40.50 +-#elif defined PIC
   40.51 +-# ifdef __ASSEMBLER__
   40.52 +-#  define PTR_MANGLE(dst, src, tmp)		\
   40.53 +-	ldq	tmp, __pointer_chk_guard;	\
   40.54 +-	xor	src, tmp, dst
   40.55 +-#  define PTR_MANGLE2(dst, src, tmp)		\
   40.56 +-	xor	src, tmp, dst
   40.57 +-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   40.58 +-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   40.59 +-# else
   40.60 +-extern uintptr_t __pointer_chk_guard attribute_relro;
   40.61 +-#  define PTR_MANGLE(var)	\
   40.62 +-	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
   40.63 +-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
   40.64 +-# endif
   40.65 +-#endif
   40.66 +-
   40.67 + #endif /* ASSEMBLER */
   40.68 +diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/sysdep.h
   40.69 +--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h	2007-08-21 10:07:28.000000000 +0200
   40.70 ++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sysdep.h	2009-02-02 22:01:39.000000000 +0100
   40.71 +@@ -98,4 +98,46 @@
   40.72 + 	INTERNAL_SYSCALL1(name, err_out, nr, args);			\
   40.73 + })
   40.74 + 
   40.75 ++/* Pointer mangling support.  Note that tls access is slow enough that
   40.76 ++   we don't deoptimize things by placing the pointer check value there.  */
   40.77 ++
   40.78 ++#if defined NOT_IN_libc && defined IS_IN_rtld
   40.79 ++# ifdef __ASSEMBLER__
   40.80 ++#  define PTR_MANGLE(dst, src, tmp)                            \
   40.81 ++       ldah    tmp, __pointer_chk_guard_local($29) !gprelhigh; \
   40.82 ++       ldq     tmp, __pointer_chk_guard_local(tmp) !gprellow;  \
   40.83 ++       xor     src, tmp, dst
   40.84 ++#  define PTR_MANGLE2(dst, src, tmp)                           \
   40.85 ++       xor     src, tmp, dst
   40.86 ++#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   40.87 ++#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   40.88 ++# else
   40.89 ++extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
   40.90 ++#  define PTR_MANGLE(var)      \
   40.91 ++  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
   40.92 ++#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
   40.93 ++# endif
   40.94 ++#elif defined PIC
   40.95 ++# ifdef __ASSEMBLER__
   40.96 ++#  define PTR_MANGLE(dst, src, tmp)            \
   40.97 ++       ldq     tmp, __pointer_chk_guard;       \
   40.98 ++       xor     src, tmp, dst
   40.99 ++#  define PTR_MANGLE2(dst, src, tmp)           \
  40.100 ++       xor     src, tmp, dst
  40.101 ++#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
  40.102 ++#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
  40.103 ++# else
  40.104 ++extern uintptr_t __pointer_chk_guard attribute_relro;
  40.105 ++#  define PTR_MANGLE(var)      \
  40.106 ++       (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
  40.107 ++#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
  40.108 ++# endif
  40.109 ++#else
  40.110 ++/* Pointer mangling is not yet supported for static libc on alpha.  */
  40.111 ++# ifndef __ASSEMBLER__
  40.112 ++#  define PTR_MANGLE(var)   (void) (var)
  40.113 ++#  define PTR_DEMANGLE(var) (void) (var)
  40.114 ++# endif
  40.115 ++#endif
  40.116 ++
  40.117 + #endif /* _LINUX_ALPHA_SYSDEP_H */
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/patches/glibc/2.9/500-ppc-glibc-2.9-atomic.patch	Sat Mar 28 13:34:41 2009 +0000
    41.3 @@ -0,0 +1,414 @@
    41.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/6120_all_ppc-glibc-2.9-atomic.patch
    41.5 +
    41.6 +-= BEGIN original header =-
    41.7 +sniped from suse
    41.8 +
    41.9 +-= END original header =-
   41.10 +
   41.11 +diff -durN glibc-2_9.orig/sysdeps/powerpc/bits/atomic.h glibc-2_9/sysdeps/powerpc/bits/atomic.h
   41.12 +--- glibc-2_9.orig/sysdeps/powerpc/bits/atomic.h	2007-03-26 22:15:28.000000000 +0200
   41.13 ++++ glibc-2_9/sysdeps/powerpc/bits/atomic.h	2009-02-02 22:01:40.000000000 +0100
   41.14 +@@ -85,14 +85,14 @@
   41.15 +       __typeof (*(mem)) __tmp;						      \
   41.16 +       __typeof (mem)  __memp = (mem);					      \
   41.17 +       __asm __volatile (						      \
   41.18 +-		        "1:	lwarx	%0,0,%1" MUTEX_HINT_ACQ "\n"	      \
   41.19 ++		        "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
   41.20 + 		        "	cmpw	%0,%2\n"			      \
   41.21 + 		        "	bne	2f\n"				      \
   41.22 +-		        "	stwcx.	%3,0,%1\n"			      \
   41.23 ++		        "	stwcx.	%3,%y1\n"			      \
   41.24 + 		        "	bne-	1b\n"				      \
   41.25 + 		        "2:	" __ARCH_ACQ_INSTR			      \
   41.26 +-		        : "=&r" (__tmp)					      \
   41.27 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
   41.28 ++		        : "=&r" (__tmp), "+Z" (*__memp)			      \
   41.29 ++		        : "r" (oldval), "r" (newval)			      \
   41.30 + 		        : "cr0", "memory");				      \
   41.31 +       __tmp;								      \
   41.32 +   })
   41.33 +@@ -102,14 +102,14 @@
   41.34 +       __typeof (*(mem)) __tmp;						      \
   41.35 +       __typeof (mem)  __memp = (mem);					      \
   41.36 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
   41.37 +-		        "1:	lwarx	%0,0,%1" MUTEX_HINT_REL "\n"	      \
   41.38 ++		        "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
   41.39 + 		        "	cmpw	%0,%2\n"			      \
   41.40 + 		        "	bne	2f\n"				      \
   41.41 +-		        "	stwcx.	%3,0,%1\n"			      \
   41.42 ++		        "	stwcx.	%3,%y1\n"			      \
   41.43 + 		        "	bne-	1b\n"				      \
   41.44 + 		        "2:	"					      \
   41.45 +-		        : "=&r" (__tmp)					      \
   41.46 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
   41.47 ++		        : "=&r" (__tmp), "+Z" (__memp)			      \
   41.48 ++		        : "r" (oldval), "r" (newval)			      \
   41.49 + 		        : "cr0", "memory");				      \
   41.50 +       __tmp;								      \
   41.51 +   })
   41.52 +@@ -118,12 +118,12 @@
   41.53 +   ({									      \
   41.54 +     __typeof (*mem) __val;						      \
   41.55 +     __asm __volatile (							      \
   41.56 +-		      "1:	lwarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	      \
   41.57 +-		      "		stwcx.	%3,0,%2\n"			      \
   41.58 ++		      "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
   41.59 ++		      "		stwcx.	%2,%y1\n"			      \
   41.60 + 		      "		bne-	1b\n"				      \
   41.61 + 		      "   " __ARCH_ACQ_INSTR				      \
   41.62 +-		      : "=&r" (__val), "=m" (*mem)			      \
   41.63 +-		      : "b" (mem), "r" (value), "m" (*mem)		      \
   41.64 ++		      : "=&r" (__val), "+Z" (*mem)			      \
   41.65 ++		      : "r" (value)					      \
   41.66 + 		      : "cr0", "memory");				      \
   41.67 +     __val;								      \
   41.68 +   })
   41.69 +@@ -132,11 +132,11 @@
   41.70 +   ({									      \
   41.71 +     __typeof (*mem) __val;						      \
   41.72 +     __asm __volatile (__ARCH_REL_INSTR "\n"				      \
   41.73 +-		      "1:	lwarx	%0,0,%2" MUTEX_HINT_REL "\n"	      \
   41.74 +-		      "		stwcx.	%3,0,%2\n"			      \
   41.75 ++		      "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
   41.76 ++		      "		stwcx.	%2,%y1\n"			      \
   41.77 + 		      "		bne-	1b"				      \
   41.78 +-		      : "=&r" (__val), "=m" (*mem)			      \
   41.79 +-		      : "b" (mem), "r" (value), "m" (*mem)		      \
   41.80 ++		      : "=&r" (__val), "+Z" (*mem)			      \
   41.81 ++		      : "r" (value)					      \
   41.82 + 		      : "cr0", "memory");				      \
   41.83 +     __val;								      \
   41.84 +   })
   41.85 +@@ -144,12 +144,12 @@
   41.86 + #define __arch_atomic_exchange_and_add_32(mem, value) \
   41.87 +   ({									      \
   41.88 +     __typeof (*mem) __val, __tmp;					      \
   41.89 +-    __asm __volatile ("1:	lwarx	%0,0,%3\n"			      \
   41.90 +-		      "		add	%1,%0,%4\n"			      \
   41.91 +-		      "		stwcx.	%1,0,%3\n"			      \
   41.92 ++    __asm __volatile ("1:	lwarx	%0,%y2\n"			      \
   41.93 ++		      "		add	%1,%0,%3\n"			      \
   41.94 ++		      "		stwcx.	%1,%y2\n"			      \
   41.95 + 		      "		bne-	1b"				      \
   41.96 +-		      : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
   41.97 +-		      : "b" (mem), "r" (value), "m" (*mem)		      \
   41.98 ++		      : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem)	      \
   41.99 ++		      : "r" (value)					      \
  41.100 + 		      : "cr0", "memory");				      \
  41.101 +     __val;								      \
  41.102 +   })
  41.103 +@@ -157,12 +157,12 @@
  41.104 + #define __arch_atomic_increment_val_32(mem) \
  41.105 +   ({									      \
  41.106 +     __typeof (*(mem)) __val;						      \
  41.107 +-    __asm __volatile ("1:	lwarx	%0,0,%2\n"			      \
  41.108 ++    __asm __volatile ("1:	lwarx	%0,%y1\n"			      \
  41.109 + 		      "		addi	%0,%0,1\n"			      \
  41.110 +-		      "		stwcx.	%0,0,%2\n"			      \
  41.111 ++		      "		stwcx.	%0,%y1\n"			      \
  41.112 + 		      "		bne-	1b"				      \
  41.113 +-		      : "=&b" (__val), "=m" (*mem)			      \
  41.114 +-		      : "b" (mem), "m" (*mem)				      \
  41.115 ++		      : "=&b" (__val), "+Z" (*mem)			      \
  41.116 ++		      :							      \
  41.117 + 		      : "cr0", "memory");				      \
  41.118 +     __val;								      \
  41.119 +   })
  41.120 +@@ -170,27 +170,27 @@
  41.121 + #define __arch_atomic_decrement_val_32(mem) \
  41.122 +   ({									      \
  41.123 +     __typeof (*(mem)) __val;						      \
  41.124 +-    __asm __volatile ("1:	lwarx	%0,0,%2\n"			      \
  41.125 ++    __asm __volatile ("1:	lwarx	%0,%y1\n"			      \
  41.126 + 		      "		subi	%0,%0,1\n"			      \
  41.127 +-		      "		stwcx.	%0,0,%2\n"			      \
  41.128 ++		      "		stwcx.	%0,%y1\n"			      \
  41.129 + 		      "		bne-	1b"				      \
  41.130 +-		      : "=&b" (__val), "=m" (*mem)			      \
  41.131 +-		      : "b" (mem), "m" (*mem)				      \
  41.132 ++		      : "=&b" (__val), "+Z" (*mem)			      \
  41.133 ++		      :							      \
  41.134 + 		      : "cr0", "memory");				      \
  41.135 +     __val;								      \
  41.136 +   })
  41.137 + 
  41.138 + #define __arch_atomic_decrement_if_positive_32(mem) \
  41.139 +   ({ int __val, __tmp;							      \
  41.140 +-     __asm __volatile ("1:	lwarx	%0,0,%3\n"			      \
  41.141 ++     __asm __volatile ("1:	lwarx	%0,%y2\n"			      \
  41.142 + 		       "	cmpwi	0,%0,0\n"			      \
  41.143 + 		       "	addi	%1,%0,-1\n"			      \
  41.144 + 		       "	ble	2f\n"				      \
  41.145 +-		       "	stwcx.	%1,0,%3\n"			      \
  41.146 ++		       "	stwcx.	%1,%y2\n"			      \
  41.147 + 		       "	bne-	1b\n"				      \
  41.148 + 		       "2:	" __ARCH_ACQ_INSTR			      \
  41.149 +-		       : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  41.150 +-		       : "b" (mem), "m" (*mem)				      \
  41.151 ++		       : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem)	      \
  41.152 ++		       :						      \
  41.153 + 		       : "cr0", "memory");				      \
  41.154 +      __val;								      \
  41.155 +   })
  41.156 +diff -durN glibc-2_9.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2_9/sysdeps/powerpc/powerpc32/bits/atomic.h
  41.157 +--- glibc-2_9.orig/sysdeps/powerpc/powerpc32/bits/atomic.h	2007-03-26 22:15:45.000000000 +0200
  41.158 ++++ glibc-2_9/sysdeps/powerpc/powerpc32/bits/atomic.h	2009-02-02 22:01:40.000000000 +0100
  41.159 +@@ -44,14 +44,14 @@
  41.160 + ({									      \
  41.161 +   unsigned int __tmp;							      \
  41.162 +   __asm __volatile (							      \
  41.163 +-		    "1:	lwarx	%0,0,%1" MUTEX_HINT_ACQ "\n"		      \
  41.164 ++		    "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"		      \
  41.165 + 		    "	subf.	%0,%2,%0\n"				      \
  41.166 + 		    "	bne	2f\n"					      \
  41.167 +-		    "	stwcx.	%3,0,%1\n"				      \
  41.168 ++		    "	stwcx.	%3,%y1\n"				      \
  41.169 + 		    "	bne-	1b\n"					      \
  41.170 + 		    "2:	" __ARCH_ACQ_INSTR				      \
  41.171 +-		    : "=&r" (__tmp)					      \
  41.172 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  41.173 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  41.174 ++		    : "r" (oldval), "r" (newval)			      \
  41.175 + 		    : "cr0", "memory");					      \
  41.176 +   __tmp != 0;								      \
  41.177 + })
  41.178 +@@ -60,14 +60,14 @@
  41.179 + ({									      \
  41.180 +   unsigned int __tmp;							      \
  41.181 +   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  41.182 +-		    "1:	lwarx	%0,0,%1" MUTEX_HINT_REL "\n"		      \
  41.183 ++		    "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"		      \
  41.184 + 		    "	subf.	%0,%2,%0\n"				      \
  41.185 + 		    "	bne	2f\n"					      \
  41.186 +-		    "	stwcx.	%3,0,%1\n"				      \
  41.187 ++		    "	stwcx.	%3,%y1\n"				      \
  41.188 + 		    "	bne-	1b\n"					      \
  41.189 + 		    "2:	"						      \
  41.190 +-		    : "=&r" (__tmp)					      \
  41.191 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  41.192 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  41.193 ++		    : "r" (oldval), "r" (newval)			      \
  41.194 + 		    : "cr0", "memory");					      \
  41.195 +   __tmp != 0;								      \
  41.196 + })
  41.197 +diff -durN glibc-2_9.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2_9/sysdeps/powerpc/powerpc64/bits/atomic.h
  41.198 +--- glibc-2_9.orig/sysdeps/powerpc/powerpc64/bits/atomic.h	2007-03-26 22:16:03.000000000 +0200
  41.199 ++++ glibc-2_9/sysdeps/powerpc/powerpc64/bits/atomic.h	2009-02-02 22:01:40.000000000 +0100
  41.200 +@@ -44,14 +44,14 @@
  41.201 + ({									      \
  41.202 +   unsigned int __tmp, __tmp2;						      \
  41.203 +   __asm __volatile ("   clrldi  %1,%1,32\n"				      \
  41.204 +-		    "1:	lwarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	 	      \
  41.205 ++		    "1:	lwarx	%0,%y2" MUTEX_HINT_ACQ "\n"	 	      \
  41.206 + 		    "	subf.	%0,%1,%0\n"				      \
  41.207 + 		    "	bne	2f\n"					      \
  41.208 +-		    "	stwcx.	%4,0,%2\n"				      \
  41.209 ++		    "	stwcx.	%4,%y2\n"				      \
  41.210 + 		    "	bne-	1b\n"					      \
  41.211 + 		    "2:	" __ARCH_ACQ_INSTR				      \
  41.212 +-		    : "=&r" (__tmp), "=r" (__tmp2)			      \
  41.213 +-		    : "b" (mem), "1" (oldval), "r" (newval)		      \
  41.214 ++		    : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem))	      \
  41.215 ++		    : "1" (oldval), "r" (newval)			      \
  41.216 + 		    : "cr0", "memory");					      \
  41.217 +   __tmp != 0;								      \
  41.218 + })
  41.219 +@@ -61,14 +61,14 @@
  41.220 +   unsigned int __tmp, __tmp2;						      \
  41.221 +   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  41.222 + 		    "   clrldi  %1,%1,32\n"				      \
  41.223 +-		    "1:	lwarx	%0,0,%2" MUTEX_HINT_REL "\n"		      \
  41.224 ++		    "1:	lwarx	%0,%y2" MUTEX_HINT_REL "\n"		      \
  41.225 + 		    "	subf.	%0,%1,%0\n"				      \
  41.226 + 		    "	bne	2f\n"					      \
  41.227 +-		    "	stwcx.	%4,0,%2\n"				      \
  41.228 ++		    "	stwcx.	%4,%y2\n"				      \
  41.229 + 		    "	bne-	1b\n"					      \
  41.230 + 		    "2:	"						      \
  41.231 +-		    : "=&r" (__tmp), "=r" (__tmp2)			      \
  41.232 +-		    : "b" (mem), "1" (oldval), "r" (newval)		      \
  41.233 ++		    : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem))	      \
  41.234 ++		    : "1" (oldval), "r" (newval)			      \
  41.235 + 		    : "cr0", "memory");					      \
  41.236 +   __tmp != 0;								      \
  41.237 + })
  41.238 +@@ -82,14 +82,14 @@
  41.239 + ({									      \
  41.240 +   unsigned long	__tmp;							      \
  41.241 +   __asm __volatile (							      \
  41.242 +-		    "1:	ldarx	%0,0,%1" MUTEX_HINT_ACQ "\n"		      \
  41.243 ++		    "1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"		      \
  41.244 + 		    "	subf.	%0,%2,%0\n"				      \
  41.245 + 		    "	bne	2f\n"					      \
  41.246 +-		    "	stdcx.	%3,0,%1\n"				      \
  41.247 ++		    "	stdcx.	%3,%y1\n"				      \
  41.248 + 		    "	bne-	1b\n"					      \
  41.249 + 		    "2:	" __ARCH_ACQ_INSTR				      \
  41.250 +-		    : "=&r" (__tmp)					      \
  41.251 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  41.252 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  41.253 ++		    : "r" (oldval), "r" (newval)			      \
  41.254 + 		    : "cr0", "memory");					      \
  41.255 +   __tmp != 0;								      \
  41.256 + })
  41.257 +@@ -98,14 +98,14 @@
  41.258 + ({									      \
  41.259 +   unsigned long	__tmp;							      \
  41.260 +   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  41.261 +-		    "1:	ldarx	%0,0,%2" MUTEX_HINT_REL "\n"		      \
  41.262 ++		    "1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"		      \
  41.263 + 		    "	subf.	%0,%2,%0\n"				      \
  41.264 + 		    "	bne	2f\n"					      \
  41.265 +-		    "	stdcx.	%3,0,%1\n"				      \
  41.266 ++		    "	stdcx.	%3,%y1\n"				      \
  41.267 + 		    "	bne-	1b\n"					      \
  41.268 + 		    "2:	"						      \
  41.269 +-		    : "=&r" (__tmp)					      \
  41.270 +-		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  41.271 ++		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  41.272 ++		    : "r" (oldval), "r" (newval)			      \
  41.273 + 		    : "cr0", "memory");					      \
  41.274 +   __tmp != 0;								      \
  41.275 + })
  41.276 +@@ -115,14 +115,14 @@
  41.277 +       __typeof (*(mem)) __tmp;						      \
  41.278 +       __typeof (mem)  __memp = (mem);					      \
  41.279 +       __asm __volatile (						      \
  41.280 +-		        "1:	ldarx	%0,0,%1" MUTEX_HINT_ACQ "\n"	      \
  41.281 ++		        "1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
  41.282 + 		        "	cmpd	%0,%2\n"			      \
  41.283 + 		        "	bne	2f\n"				      \
  41.284 +-		        "	stdcx.	%3,0,%1\n"			      \
  41.285 ++		        "	stdcx.	%3,%y1\n"			      \
  41.286 + 		        "	bne-	1b\n"				      \
  41.287 + 		        "2:	" __ARCH_ACQ_INSTR			      \
  41.288 +-		        : "=&r" (__tmp)					      \
  41.289 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
  41.290 ++		        : "=&r" (__tmp), "+Z" (*__memp)			      \
  41.291 ++		        : "r" (oldval), "r" (newval)			      \
  41.292 + 		        : "cr0", "memory");				      \
  41.293 +       __tmp;								      \
  41.294 +   })
  41.295 +@@ -132,14 +132,14 @@
  41.296 +       __typeof (*(mem)) __tmp;						      \
  41.297 +       __typeof (mem)  __memp = (mem);					      \
  41.298 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  41.299 +-		        "1:	ldarx	%0,0,%1" MUTEX_HINT_REL "\n"	      \
  41.300 ++		        "1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
  41.301 + 		        "	cmpd	%0,%2\n"			      \
  41.302 + 		        "	bne	2f\n"				      \
  41.303 +-		        "	stdcx.	%3,0,%1\n"			      \
  41.304 ++		        "	stdcx.	%3,%y1\n"			      \
  41.305 + 		        "	bne-	1b\n"				      \
  41.306 + 		        "2:	"					      \
  41.307 +-		        : "=&r" (__tmp)					      \
  41.308 +-		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
  41.309 ++		        : "=&r" (__tmp), "+Z" (*__memp)			      \
  41.310 ++		        : "r" (oldval), "r" (newval)			      \
  41.311 + 		        : "cr0", "memory");				      \
  41.312 +       __tmp;								      \
  41.313 +   })
  41.314 +@@ -148,12 +148,12 @@
  41.315 +     ({									      \
  41.316 +       __typeof (*mem) __val;						      \
  41.317 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  41.318 +-			"1:	ldarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	      \
  41.319 +-			"	stdcx.	%3,0,%2\n"			      \
  41.320 ++			"1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
  41.321 ++			"	stdcx.	%2,%y1\n"			      \
  41.322 + 			"	bne-	1b\n"				      \
  41.323 + 		  " " __ARCH_ACQ_INSTR					      \
  41.324 +-			: "=&r" (__val), "=m" (*mem)			      \
  41.325 +-			: "b" (mem), "r" (value), "m" (*mem)		      \
  41.326 ++			: "=&r" (__val), "+Z" (*(mem))			      \
  41.327 ++			: "r" (value)					      \
  41.328 + 			: "cr0", "memory");				      \
  41.329 +       __val;								      \
  41.330 +     })
  41.331 +@@ -162,11 +162,11 @@
  41.332 +     ({									      \
  41.333 +       __typeof (*mem) __val;						      \
  41.334 +       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  41.335 +-			"1:	ldarx	%0,0,%2" MUTEX_HINT_REL "\n"	      \
  41.336 +-			"	stdcx.	%3,0,%2\n"			      \
  41.337 ++			"1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
  41.338 ++			"	stdcx.	%2,%y1\n"			      \
  41.339 + 			"	bne-	1b"				      \
  41.340 +-			: "=&r" (__val), "=m" (*mem)			      \
  41.341 +-			: "b" (mem), "r" (value), "m" (*mem)		      \
  41.342 ++			: "=&r" (__val), "+Z" (*(mem))			      \
  41.343 ++			: "r" (value)					      \
  41.344 + 			: "cr0", "memory");				      \
  41.345 +       __val;								      \
  41.346 +     })
  41.347 +@@ -174,12 +174,12 @@
  41.348 + #define __arch_atomic_exchange_and_add_64(mem, value) \
  41.349 +     ({									      \
  41.350 +       __typeof (*mem) __val, __tmp;					      \
  41.351 +-      __asm __volatile ("1:	ldarx	%0,0,%3\n"			      \
  41.352 +-			"	add	%1,%0,%4\n"			      \
  41.353 +-			"	stdcx.	%1,0,%3\n"			      \
  41.354 ++      __asm __volatile ("1:	ldarx	%0,%y2\n"			      \
  41.355 ++			"	add	%1,%0,%3\n"			      \
  41.356 ++			"	stdcx.	%1,%y2\n"			      \
  41.357 + 			"	bne-	1b"				      \
  41.358 +-			: "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  41.359 +-			: "b" (mem), "r" (value), "m" (*mem)		      \
  41.360 ++			: "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem))	      \
  41.361 ++			: "r" (value)					      \
  41.362 + 			: "cr0", "memory");				      \
  41.363 +       __val;								      \
  41.364 +     })
  41.365 +@@ -187,12 +187,12 @@
  41.366 + #define __arch_atomic_increment_val_64(mem) \
  41.367 +     ({									      \
  41.368 +       __typeof (*(mem)) __val;						      \
  41.369 +-      __asm __volatile ("1:	ldarx	%0,0,%2\n"			      \
  41.370 ++      __asm __volatile ("1:	ldarx	%0,%y1\n"			      \
  41.371 + 			"	addi	%0,%0,1\n"			      \
  41.372 +-			"	stdcx.	%0,0,%2\n"			      \
  41.373 ++			"	stdcx.	%0,%y1\n"			      \
  41.374 + 			"	bne-	1b"				      \
  41.375 +-			: "=&b" (__val), "=m" (*mem)			      \
  41.376 +-			: "b" (mem), "m" (*mem)				      \
  41.377 ++			: "=&b" (__val), "+Z" (*(mem))			      \
  41.378 ++			:						      \
  41.379 + 			: "cr0", "memory");				      \
  41.380 +       __val;								      \
  41.381 +     })
  41.382 +@@ -200,27 +200,27 @@
  41.383 + #define __arch_atomic_decrement_val_64(mem) \
  41.384 +     ({									      \
  41.385 +       __typeof (*(mem)) __val;						      \
  41.386 +-      __asm __volatile ("1:	ldarx	%0,0,%2\n"			      \
  41.387 ++      __asm __volatile ("1:	ldarx	%0,%y1\n"			      \
  41.388 + 			"	subi	%0,%0,1\n"			      \
  41.389 +-			"	stdcx.	%0,0,%2\n"			      \
  41.390 ++			"	stdcx.	%0,%y1\n"			      \
  41.391 + 			"	bne-	1b"				      \
  41.392 +-			: "=&b" (__val), "=m" (*mem)			      \
  41.393 +-			: "b" (mem), "m" (*mem)				      \
  41.394 ++			: "=&b" (__val), "+Z" (*(mem))			      \
  41.395 ++			:						      \
  41.396 + 			: "cr0", "memory");				      \
  41.397 +       __val;								      \
  41.398 +     })
  41.399 + 
  41.400 + #define __arch_atomic_decrement_if_positive_64(mem) \
  41.401 +   ({ int __val, __tmp;							      \
  41.402 +-     __asm __volatile ("1:	ldarx	%0,0,%3\n"			      \
  41.403 ++     __asm __volatile ("1:	ldarx	%0,%y2\n"			      \
  41.404 + 		       "	cmpdi	0,%0,0\n"			      \
  41.405 + 		       "	addi	%1,%0,-1\n"			      \
  41.406 + 		       "	ble	2f\n"				      \
  41.407 +-		       "	stdcx.	%1,0,%3\n"			      \
  41.408 ++		       "	stdcx.	%1,%y2\n"			      \
  41.409 + 		       "	bne-	1b\n"				      \
  41.410 + 		       "2:	" __ARCH_ACQ_INSTR			      \
  41.411 +-		       : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  41.412 +-		       : "b" (mem), "m" (*mem)				      \
  41.413 ++		       : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem))	      \
  41.414 ++		       :						      \
  41.415 + 		       : "cr0", "memory");				      \
  41.416 +      __val;								      \
  41.417 +   })
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/patches/glibc/2.9/510-sh-no-asm-user-header.patch	Sat Mar 28 13:34:41 2009 +0000
    42.3 @@ -0,0 +1,70 @@
    42.4 +2007-03-13  Mike Frysinger  <vapier@gentoo.org>
    42.5 +
    42.6 +	* sysdeps/unix/sysv/linux/sh/sys/user.h: Copy Linux's asm-sh/user.h.
    42.7 +
    42.8 +--- glibc-2_9/sysdeps/unix/sysv/linux/sh/sys/user.h
    42.9 ++++ glibc-2_9/sysdeps/unix/sysv/linux/sh/sys/user.h
   42.10 +@@ -19,10 +19,60 @@
   42.11 + #ifndef _SYS_USER_H
   42.12 + #define _SYS_USER_H	1
   42.13 + 
   42.14 +-#include <features.h>
   42.15 ++#include <unistd.h>
   42.16 ++#include <asm/ptrace.h>
   42.17 + 
   42.18 +-#include <asm/user.h>
   42.19 ++/*
   42.20 ++ * Core file format: The core file is written in such a way that gdb
   42.21 ++ * can understand it and provide useful information to the user (under
   42.22 ++ * linux we use the `trad-core' bfd).  The file contents are as follows:
   42.23 ++ *
   42.24 ++ *  upage: 1 page consisting of a user struct that tells gdb
   42.25 ++ *	what is present in the file.  Directly after this is a
   42.26 ++ *	copy of the task_struct, which is currently not used by gdb,
   42.27 ++ *	but it may come in handy at some point.  All of the registers
   42.28 ++ *	are stored as part of the upage.  The upage should always be
   42.29 ++ *	only one page long.
   42.30 ++ *  data: The data segment follows next.  We use current->end_text to
   42.31 ++ *	current->brk to pick up all of the user variables, plus any memory
   42.32 ++ *	that may have been sbrk'ed.  No attempt is made to determine if a
   42.33 ++ *	page is demand-zero or if a page is totally unused, we just cover
   42.34 ++ *	the entire range.  All of the addresses are rounded in such a way
   42.35 ++ *	that an integral number of pages is written.
   42.36 ++ *  stack: We need the stack information in order to get a meaningful
   42.37 ++ *	backtrace.  We need to write the data from usp to
   42.38 ++ *	current->start_stack, so we round each of these in order to be able
   42.39 ++ *	to write an integer number of pages.
   42.40 ++ */
   42.41 + 
   42.42 +-#undef start_thread
   42.43 ++struct user_fpu_struct {
   42.44 ++	unsigned long fp_regs[16];
   42.45 ++	unsigned long xfp_regs[16];
   42.46 ++	unsigned long fpscr;
   42.47 ++	unsigned long fpul;
   42.48 ++};
   42.49 ++
   42.50 ++struct user {
   42.51 ++	struct pt_regs	regs;			/* entire machine state */
   42.52 ++	struct user_fpu_struct fpu;	/* Math Co-processor registers  */
   42.53 ++	int u_fpvalid;		/* True if math co-processor being used */
   42.54 ++	size_t		u_tsize;		/* text size (pages) */
   42.55 ++	size_t		u_dsize;		/* data size (pages) */
   42.56 ++	size_t		u_ssize;		/* stack size (pages) */
   42.57 ++	unsigned long	start_code;		/* text starting address */
   42.58 ++	unsigned long	start_data;		/* data starting address */
   42.59 ++	unsigned long	start_stack;		/* stack starting address */
   42.60 ++	long int	signal;			/* signal causing core dump */
   42.61 ++	struct regs *	u_ar0;			/* help gdb find registers */
   42.62 ++	struct user_fpu_struct* u_fpstate;	/* Math Co-processor pointer */
   42.63 ++	unsigned long	magic;			/* identifies a core file */
   42.64 ++	char		u_comm[32];		/* user command name */
   42.65 ++};
   42.66 ++
   42.67 ++#define NBPG			getpagesize()
   42.68 ++#define UPAGES			1
   42.69 ++#define HOST_TEXT_START_ADDR	(u.start_code)
   42.70 ++#define HOST_DATA_START_ADDR	(u.start_data)
   42.71 ++#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
   42.72 + 
   42.73 + #endif  /* sys/user.h */
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/patches/glibc/2.9/520-sh-no-asm-elf-header.patch	Sat Mar 28 13:34:41 2009 +0000
    43.3 @@ -0,0 +1,27 @@
    43.4 +2007-03-13  Mike Frysinger  <vapier@gentoo.org>
    43.5 +
    43.6 +	* sysdeps/unix/sysv/linux/sh/sys/procfs.h: Copy Linux's asm-sh/elf.h types.
    43.7 +
    43.8 +--- glibc-2_9/sysdeps/unix/sysv/linux/sh/sys/procfs.h
    43.9 ++++ glibc-2_9/sysdeps/unix/sysv/linux/sh/sys/procfs.h
   43.10 +@@ -29,10 +29,19 @@
   43.11 + #include <sys/types.h>
   43.12 + #include <sys/ucontext.h>
   43.13 + #include <sys/user.h>
   43.14 +-#include <asm/elf.h>
   43.15 + 
   43.16 + __BEGIN_DECLS
   43.17 + 
   43.18 ++/*
   43.19 ++ * ELF register definitions...
   43.20 ++ */
   43.21 ++typedef unsigned long elf_greg_t;
   43.22 ++
   43.23 ++#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
   43.24 ++typedef elf_greg_t elf_gregset_t[ELF_NGREG];
   43.25 ++
   43.26 ++typedef struct user_fpu_struct elf_fpregset_t;
   43.27 ++
   43.28 + struct elf_siginfo
   43.29 +   {
   43.30 +     int si_signo;			/* Signal number.  */
    44.1 --- a/patches/glibc/2_9/100-ssp-compat.patch	Fri Mar 27 23:40:07 2009 +0000
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,193 +0,0 @@
    44.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/0010_all_glibc-2.7-ssp-compat.patch
    44.5 -
    44.6 --= BEGIN original header =-
    44.7 -Add backwards compat support for gcc-3.x ssp ... older ssp versions
    44.8 -used __guard and __stack_smash_handler symbols while gcc-4.1 and newer
    44.9 -uses __stack_chk_guard and __stack_chk_fail.
   44.10 -
   44.11 --= END original header =-
   44.12 -
   44.13 -diff -durN glibc-2_9.orig/Versions.def glibc-2_9/Versions.def
   44.14 ---- glibc-2_9.orig/Versions.def	2008-08-01 19:13:40.000000000 +0200
   44.15 -+++ glibc-2_9/Versions.def	2009-02-02 22:00:33.000000000 +0100
   44.16 -@@ -113,6 +113,9 @@
   44.17 -   GLIBC_2.0
   44.18 -   GLIBC_2.1
   44.19 -   GLIBC_2.3
   44.20 -+%ifdef ENABLE_OLD_SSP_COMPAT
   44.21 -+  GLIBC_2.3.2
   44.22 -+%endif
   44.23 -   GLIBC_2.4
   44.24 -   GLIBC_PRIVATE
   44.25 - }
   44.26 -diff -durN glibc-2_9.orig/config.h.in glibc-2_9/config.h.in
   44.27 ---- glibc-2_9.orig/config.h.in	2007-03-26 22:40:08.000000000 +0200
   44.28 -+++ glibc-2_9/config.h.in	2009-02-02 22:00:32.000000000 +0100
   44.29 -@@ -42,6 +42,9 @@
   44.30 -    assembler instructions per line.  Default is `;'  */
   44.31 - #undef ASM_LINE_SEP
   44.32 - 
   44.33 -+/* Define if we want to enable support for old ssp symbols */
   44.34 -+#undef	ENABLE_OLD_SSP_COMPAT
   44.35 -+
   44.36 - /* Define if not using ELF, but `.init' and `.fini' sections are available.  */
   44.37 - #undef	HAVE_INITFINI
   44.38 - 
   44.39 -diff -durN glibc-2_9.orig/configure glibc-2_9/configure
   44.40 ---- glibc-2_9.orig/configure	2008-11-11 10:50:11.000000000 +0100
   44.41 -+++ glibc-2_9/configure	2009-02-02 22:00:32.000000000 +0100
   44.42 -@@ -1380,6 +1380,9 @@
   44.43 -   --enable-kernel=VERSION compile for compatibility with kernel not older than
   44.44 -                           VERSION
   44.45 -   --enable-all-warnings   enable all useful warnings gcc can issue
   44.46 -+  --disable-old-ssp-compat
   44.47 -+                          enable support for older ssp symbols
   44.48 -+                          [default=no]
   44.49 - 
   44.50 - Optional Packages:
   44.51 -   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   44.52 -@@ -6470,6 +6473,20 @@
   44.53 - echo "${ECHO_T}$libc_cv_ssp" >&6; }
   44.54 - 
   44.55 - 
   44.56 -+# Check whether --enable-old-ssp-compat or --disable-old-ssp-compat was given.
   44.57 -+if test "${enable_old_ssp_compat+set}" = set; then
   44.58 -+  enableval="$enable_old_ssp_compat"
   44.59 -+  enable_old_ssp_compat=$enableval
   44.60 -+else
   44.61 -+  enable_old_ssp_compat=no
   44.62 -+fi;
   44.63 -+if test "x$enable_old_ssp_compat" = "xyes"; then
   44.64 -+  cat >>confdefs.h <<\_ACEOF
   44.65 -+#define ENABLE_OLD_SSP_COMPAT 1
   44.66 -+_ACEOF
   44.67 -+
   44.68 -+fi
   44.69 -+
   44.70 - { echo "$as_me:$LINENO: checking for -fgnu89-inline" >&5
   44.71 - echo $ECHO_N "checking for -fgnu89-inline... $ECHO_C" >&6; }
   44.72 - if test "${libc_cv_gnu89_inline+set}" = set; then
   44.73 -diff -durN glibc-2_9.orig/configure.in glibc-2_9/configure.in
   44.74 ---- glibc-2_9.orig/configure.in	2008-11-11 10:50:11.000000000 +0100
   44.75 -+++ glibc-2_9/configure.in	2009-02-02 22:00:32.000000000 +0100
   44.76 -@@ -1647,6 +1647,15 @@
   44.77 - rm -f conftest*])
   44.78 - AC_SUBST(libc_cv_ssp)
   44.79 - 
   44.80 -+AC_ARG_ENABLE([old-ssp-compat],
   44.81 -+	      AC_HELP_STRING([--enable-old-ssp-compat],
   44.82 -+	                     [enable support for older ssp symbols @<:@default=no@:>@]),
   44.83 -+	      [enable_old_ssp_compat=$enableval],
   44.84 -+	      [enable_old_ssp_compat=no])
   44.85 -+if test "x$enable_old_ssp_compat" = "xyes"; then
   44.86 -+  AC_DEFINE(ENABLE_OLD_SSP_COMPAT)
   44.87 -+fi
   44.88 -+
   44.89 - AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
   44.90 - cat > conftest.c <<EOF
   44.91 - int foo;
   44.92 -diff -durN glibc-2_9.orig/csu/Versions glibc-2_9/csu/Versions
   44.93 ---- glibc-2_9.orig/csu/Versions	2006-10-28 01:11:41.000000000 +0200
   44.94 -+++ glibc-2_9/csu/Versions	2009-02-02 22:00:32.000000000 +0100
   44.95 -@@ -17,6 +17,12 @@
   44.96 -     # New special glibc functions.
   44.97 -     gnu_get_libc_release; gnu_get_libc_version;
   44.98 -   }
   44.99 -+  GLIBC_2.3.2 {
  44.100 -+%ifdef ENABLE_OLD_SSP_COMPAT
  44.101 -+    # global objects and functions for the old propolice patch in gcc
  44.102 -+    __guard;
  44.103 -+%endif
  44.104 -+  }
  44.105 -   GLIBC_PRIVATE {
  44.106 - %if HAVE___THREAD
  44.107 -     # This version is for the TLS symbol, GLIBC_2.0 is the old object symbol.
  44.108 -diff -durN glibc-2_9.orig/csu/libc-start.c glibc-2_9/csu/libc-start.c
  44.109 ---- glibc-2_9.orig/csu/libc-start.c	2007-08-21 00:27:50.000000000 +0200
  44.110 -+++ glibc-2_9/csu/libc-start.c	2009-02-02 22:00:32.000000000 +0100
  44.111 -@@ -37,6 +37,9 @@
  44.112 - uintptr_t __stack_chk_guard attribute_relro;
  44.113 - # endif
  44.114 - #endif
  44.115 -+#ifdef ENABLE_OLD_SSP_COMPAT
  44.116 -+uintptr_t __guard attribute_relro;
  44.117 -+#endif
  44.118 - 
  44.119 - #ifdef HAVE_PTR_NTHREADS
  44.120 - /* We need atomic operations.  */
  44.121 -@@ -141,6 +144,9 @@
  44.122 - 
  44.123 -   /* Set up the stack checker's canary.  */
  44.124 -   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
  44.125 -+#ifdef ENABLE_OLD_SSP_COMPAT
  44.126 -+  __guard = stack_chk_guard;
  44.127 -+#endif
  44.128 - # ifdef THREAD_SET_STACK_GUARD
  44.129 -   THREAD_SET_STACK_GUARD (stack_chk_guard);
  44.130 - # else
  44.131 -diff -durN glibc-2_9.orig/debug/Versions glibc-2_9/debug/Versions
  44.132 ---- glibc-2_9.orig/debug/Versions	2008-03-05 07:53:41.000000000 +0100
  44.133 -+++ glibc-2_9/debug/Versions	2009-02-02 22:00:32.000000000 +0100
  44.134 -@@ -10,6 +10,12 @@
  44.135 -     # These are to support some gcc features.
  44.136 -     __cyg_profile_func_enter; __cyg_profile_func_exit;
  44.137 -   }
  44.138 -+%ifdef ENABLE_OLD_SSP_COMPAT
  44.139 -+  GLIBC_2.3.2 {
  44.140 -+    # backwards ssp compat support; alias to __stack_chk_fail
  44.141 -+    __stack_smash_handler;
  44.142 -+  }
  44.143 -+%endif
  44.144 -   GLIBC_2.3.4 {
  44.145 -     __chk_fail;
  44.146 -     __memcpy_chk; __memmove_chk; __mempcpy_chk; __memset_chk; __stpcpy_chk;
  44.147 -diff -durN glibc-2_9.orig/debug/stack_chk_fail.c glibc-2_9/debug/stack_chk_fail.c
  44.148 ---- glibc-2_9.orig/debug/stack_chk_fail.c	2007-05-25 01:47:08.000000000 +0200
  44.149 -+++ glibc-2_9/debug/stack_chk_fail.c	2009-02-02 22:00:32.000000000 +0100
  44.150 -@@ -28,3 +28,7 @@
  44.151 - {
  44.152 -   __fortify_fail ("stack smashing detected");
  44.153 - }
  44.154 -+
  44.155 -+#ifdef ENABLE_OLD_SSP_COMPAT
  44.156 -+strong_alias (__stack_chk_fail, __stack_smash_handler)
  44.157 -+#endif
  44.158 -diff -durN glibc-2_9.orig/elf/Versions glibc-2_9/elf/Versions
  44.159 ---- glibc-2_9.orig/elf/Versions	2008-03-08 06:42:26.000000000 +0100
  44.160 -+++ glibc-2_9/elf/Versions	2009-02-02 22:00:33.000000000 +0100
  44.161 -@@ -43,6 +43,12 @@
  44.162 -     # runtime interface to TLS
  44.163 -     __tls_get_addr;
  44.164 -   }
  44.165 -+%ifdef ENABLE_OLD_SSP_COMPAT
  44.166 -+  GLIBC_2.3.2 {
  44.167 -+    # backwards ssp compat support
  44.168 -+    __guard;
  44.169 -+  }
  44.170 -+%endif
  44.171 -   GLIBC_2.4 {
  44.172 -     # stack canary
  44.173 -     __stack_chk_guard;
  44.174 -diff -durN glibc-2_9.orig/elf/rtld.c glibc-2_9/elf/rtld.c
  44.175 ---- glibc-2_9.orig/elf/rtld.c	2008-08-14 19:01:56.000000000 +0200
  44.176 -+++ glibc-2_9/elf/rtld.c	2009-02-02 22:00:32.000000000 +0100
  44.177 -@@ -89,6 +89,9 @@
  44.178 -    in thread local area.  */
  44.179 - uintptr_t __stack_chk_guard attribute_relro;
  44.180 - #endif
  44.181 -+#ifdef ENABLE_OLD_SSP_COMPAT
  44.182 -+uintptr_t __guard attribute_relro;
  44.183 -+#endif
  44.184 - 
  44.185 - /* Only exported for architectures that don't store the pointer guard
  44.186 -    value in thread local area.  */
  44.187 -@@ -842,6 +845,9 @@
  44.188 - {
  44.189 -   /* Set up the stack checker's canary.  */
  44.190 -   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
  44.191 -+#ifdef ENABLE_OLD_SSP_COMPAT
  44.192 -+  __guard = stack_chk_guard;
  44.193 -+#endif
  44.194 - #ifdef THREAD_SET_STACK_GUARD
  44.195 -   THREAD_SET_STACK_GUARD (stack_chk_guard);
  44.196 - #else
    45.1 --- a/patches/glibc/2_9/110-respect-env-CPPFLAGS.patch	Fri Mar 27 23:40:07 2009 +0000
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,30 +0,0 @@
    45.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/0030_all_glibc-respect-env-CPPFLAGS.patch
    45.5 -
    45.6 --= BEGIN original header =-
    45.7 -Respect environment CPPFLAGS when we run ./configure so we can inject
    45.8 -random -D things without having to set CFLAGS/ASFLAGS
    45.9 -
   45.10 --= END original header =-
   45.11 -
   45.12 -diff -durN glibc-2_9.orig/Makeconfig glibc-2_9/Makeconfig
   45.13 ---- glibc-2_9.orig/Makeconfig	2008-08-18 11:42:17.000000000 +0200
   45.14 -+++ glibc-2_9/Makeconfig	2009-02-02 22:00:35.000000000 +0100
   45.15 -@@ -673,6 +673,7 @@
   45.16 - 	   $(foreach lib,$(libof-$(basename $(@F))) \
   45.17 - 		         $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
   45.18 - 	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
   45.19 -+CPPFLAGS += $(CPPFLAGS-config)
   45.20 - override CFLAGS	= -std=gnu99 $(gnu89-inline-CFLAGS) \
   45.21 - 		  $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
   45.22 - 		  $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
   45.23 -diff -durN glibc-2_9.orig/config.make.in glibc-2_9/config.make.in
   45.24 ---- glibc-2_9.orig/config.make.in	2008-08-18 11:42:17.000000000 +0200
   45.25 -+++ glibc-2_9/config.make.in	2009-02-02 22:00:35.000000000 +0100
   45.26 -@@ -97,6 +97,7 @@
   45.27 - CXX = @CXX@
   45.28 - BUILD_CC = @BUILD_CC@
   45.29 - CFLAGS = @CFLAGS@
   45.30 -+CPPFLAGS-config = @CPPFLAGS@
   45.31 - ASFLAGS-config = @ASFLAGS_config@
   45.32 - AR = @AR@
   45.33 - RANLIB = @RANLIB@
    46.1 --- a/patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch	Fri Mar 27 23:40:07 2009 +0000
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,35 +0,0 @@
    46.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/0050_all_glibc-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch
    46.5 -
    46.6 --= BEGIN original header =-
    46.7 -http://sourceware.org/ml/libc-alpha/2009-01/msg00000.html
    46.8 -
    46.9 -From 8ad7030880eaa18dcabf8e284e79026301fd3fa4 Mon Sep 17 00:00:00 2001
   46.10 -From: Ulrich Drepper <drepper@redhat.com>
   46.11 -Date: Thu, 8 Jan 2009 00:02:38 +0000
   46.12 -Subject: [PATCH] (_nss_dns_gethostbyaddr2_r): Check and adjust the buffer alignment.
   46.13 -
   46.14 --= END original header =-
   46.15 -
   46.16 -diff -durN glibc-2_9.orig/resolv/nss_dns/dns-host.c glibc-2_9/resolv/nss_dns/dns-host.c
   46.17 ---- glibc-2_9.orig/resolv/nss_dns/dns-host.c	2008-11-12 08:52:20.000000000 +0100
   46.18 -+++ glibc-2_9/resolv/nss_dns/dns-host.c	2009-02-02 22:00:36.000000000 +0100
   46.19 -@@ -364,6 +364,19 @@
   46.20 -   int n, status;
   46.21 -   int olderr = errno;
   46.22 - 
   46.23 -+ uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
   46.24 -+ buffer += pad;
   46.25 -+ buflen = buflen > pad ? buflen - pad : 0;
   46.26 -+
   46.27 -+ if (__builtin_expect (buflen < sizeof (struct host_data), 0))
   46.28 -+   {
   46.29 -+     *errnop = ERANGE;
   46.30 -+     *h_errnop = NETDB_INTERNAL;
   46.31 -+     return NSS_STATUS_TRYAGAIN;
   46.32 -+   }
   46.33 -+
   46.34 -+ host_data = (struct host_data *) buffer;
   46.35 -+
   46.36 -   if (__res_maybe_init (&_res, 0) == -1)
   46.37 -     return NSS_STATUS_UNAVAIL;
   46.38 - 
    47.1 --- a/patches/glibc/2_9/130-add_prio-macros.patch	Fri Mar 27 23:40:07 2009 +0000
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,26 +0,0 @@
    47.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/0051_all_glibc-2.9-add_prio-macros.patch
    47.5 -
    47.6 --= BEGIN original header =-
    47.7 -http://sourceware.org/ml/libc-alpha/2009-01/msg00003.html
    47.8 -
    47.9 -From a1737958e074e8f990760acc8abeb0c23715a859 Mon Sep 17 00:00:00 2001
   47.10 -From: Roland McGrath <roland@gnu.org>
   47.11 -Date: Sat, 3 Jan 2009 21:04:01 +0000
   47.12 -Subject: [PATCH] 2009-01-03  Samuel Thibault  <samuel.thibault@ens-lyon.org>
   47.13 -
   47.14 -	* bits/resource.h (PRIO_PROCESS, PRIO_PGRP, PRIO_USER): Add macros.
   47.15 --= END original header =-
   47.16 -
   47.17 -diff -durN glibc-2_9.orig/bits/resource.h glibc-2_9/bits/resource.h
   47.18 ---- glibc-2_9.orig/bits/resource.h	2006-03-05 23:48:10.000000000 +0100
   47.19 -+++ glibc-2_9/bits/resource.h	2009-02-02 22:00:38.000000000 +0100
   47.20 -@@ -185,6 +185,9 @@
   47.21 - enum __priority_which
   47.22 -   {
   47.23 -     PRIO_PROCESS = 0,           /* WHO is a process ID.  */
   47.24 -+#define PRIO_PROCESS PRIO_PROCESS
   47.25 -     PRIO_PGRP = 1,              /* WHO is a process group ID.  */
   47.26 -+#define PRIO_PGRP PRIO_PGRP
   47.27 -     PRIO_USER = 2               /* WHO is a user ID.  */
   47.28 -+#define PRIO_USER PRIO_USER
   47.29 -   };
    48.1 --- a/patches/glibc/2_9/140-regex-BZ9697.patch	Fri Mar 27 23:40:07 2009 +0000
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,111 +0,0 @@
    48.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/0052_all_glibc-2.9-regex-BZ9697.patch
    48.5 -
    48.6 --= BEGIN original header =-
    48.7 -http://sourceware.org/ml/libc-alpha/2009-01/msg00005.html
    48.8 -
    48.9 -From ea8ca0dfcbf2721bcf2c08ce3c01d5764b827572 Mon Sep 17 00:00:00 2001
   48.10 -From: Ulrich Drepper <drepper@redhat.com>
   48.11 -Date: Thu, 8 Jan 2009 00:42:28 +0000
   48.12 -Subject: [PATCH] (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET handling.
   48.13 -
   48.14 --= END original header =-
   48.15 -
   48.16 -diff -durN glibc-2_9.orig/posix/regcomp.c glibc-2_9/posix/regcomp.c
   48.17 ---- glibc-2_9.orig/posix/regcomp.c	2008-05-15 05:07:21.000000000 +0200
   48.18 -+++ glibc-2_9/posix/regcomp.c	2009-02-02 22:00:41.000000000 +0100
   48.19 -@@ -350,47 +350,67 @@
   48.20 - #ifdef RE_ENABLE_I18N
   48.21 -       else if (type == COMPLEX_BRACKET)
   48.22 - 	{
   48.23 --	  int i;
   48.24 - 	  re_charset_t *cset = dfa->nodes[node].opr.mbcset;
   48.25 --	  if (cset->non_match || cset->ncoll_syms || cset->nequiv_classes
   48.26 --	      || cset->nranges || cset->nchar_classes)
   48.27 --	    {
   48.28 -+	  int i;
   48.29 -+
   48.30 - # ifdef _LIBC
   48.31 --	      if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0)
   48.32 -+	  /* See if we have to try all bytes which start multiple collation
   48.33 -+	     elements.
   48.34 -+	     e.g. In da_DK, we want to catch 'a' since "aa" is a valid
   48.35 -+		  collation element, and don't catch 'b' since 'b' is
   48.36 -+		  the only collation element which starts from 'b' (and
   48.37 -+		  it is caught by SIMPLE_BRACKET).  */
   48.38 -+	      if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0
   48.39 -+		  && (cset->ncoll_syms || cset->nranges))
   48.40 - 		{
   48.41 --		  /* In this case we want to catch the bytes which are
   48.42 --		     the first byte of any collation elements.
   48.43 --		     e.g. In da_DK, we want to catch 'a' since "aa"
   48.44 --			  is a valid collation element, and don't catch
   48.45 --			  'b' since 'b' is the only collation element
   48.46 --			  which starts from 'b'.  */
   48.47 - 		  const int32_t *table = (const int32_t *)
   48.48 - 		    _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
   48.49 - 		  for (i = 0; i < SBC_MAX; ++i)
   48.50 - 		    if (table[i] < 0)
   48.51 - 		      re_set_fastmap (fastmap, icase, i);
   48.52 - 		}
   48.53 --# else
   48.54 --	      if (dfa->mb_cur_max > 1)
   48.55 --		for (i = 0; i < SBC_MAX; ++i)
   48.56 --		  if (__btowc (i) == WEOF)
   48.57 --		    re_set_fastmap (fastmap, icase, i);
   48.58 --# endif /* not _LIBC */
   48.59 --	    }
   48.60 --	  for (i = 0; i < cset->nmbchars; ++i)
   48.61 -+# endif /* _LIBC */
   48.62 -+
   48.63 -+	  /* See if we have to start the match at all multibyte characters,
   48.64 -+	     i.e. where we would not find an invalid sequence.  This only
   48.65 -+	     applies to multibyte character sets; for single byte character
   48.66 -+	     sets, the SIMPLE_BRACKET again suffices.  */
   48.67 -+	  if (dfa->mb_cur_max > 1
   48.68 -+	      && (cset->nchar_classes || cset->non_match
   48.69 -+# ifdef _LIBC
   48.70 -+		  || cset->nequiv_classes
   48.71 -+# endif /* _LIBC */
   48.72 -+		 ))
   48.73 - 	    {
   48.74 --	      char buf[256];
   48.75 --	      mbstate_t state;
   48.76 --	      memset (&state, '\0', sizeof (state));
   48.77 --	      if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
   48.78 --		re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
   48.79 --	      if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
   48.80 -+	      unsigned char c = 0;
   48.81 -+	      do
   48.82 - 		{
   48.83 --		  if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
   48.84 --		      != (size_t) -1)
   48.85 --		    re_set_fastmap (fastmap, 0, *(unsigned char *) buf);
   48.86 -+		  mbstate_t mbs;
   48.87 -+		  memset (&mbs, 0, sizeof (mbs));
   48.88 -+		  if (__mbrtowc (NULL, (char *) &c, 1, &mbs) == (size_t) -2)
   48.89 -+		    re_set_fastmap (fastmap, false, (int) c);
   48.90 - 		}
   48.91 -+	      while (++c != 0);
   48.92 - 	    }
   48.93 -+
   48.94 -+	  else
   48.95 -+	    {
   48.96 -+	      /* ... Else catch all bytes which can start the mbchars.  */
   48.97 -+	      for (i = 0; i < cset->nmbchars; ++i)
   48.98 -+		{
   48.99 -+		  char buf[256];
  48.100 -+		  mbstate_t state;
  48.101 -+		  memset (&state, '\0', sizeof (state));
  48.102 -+		  if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
  48.103 -+		    re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
  48.104 -+		  if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
  48.105 -+		    {
  48.106 -+		      if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
  48.107 -+			  != (size_t) -1)
  48.108 -+			re_set_fastmap (fastmap, false, *(unsigned char *) buf);
  48.109 -+		    }
  48.110 -+ 		}
  48.111 -+ 	    }
  48.112 - 	}
  48.113 - #endif /* RE_ENABLE_I18N */
  48.114 -       else if (type == OP_PERIOD
    49.1 --- a/patches/glibc/2_9/150-regex-BZ697.patch	Fri Mar 27 23:40:07 2009 +0000
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,28 +0,0 @@
    49.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/0053_all_glibc-2.9-regex-BZ697.patch
    49.5 -
    49.6 --= BEGIN original header =-
    49.7 -http://sourceware.org/ml/libc-alpha/2009-01/msg00006.html
    49.8 -
    49.9 -From 37bdc055ceeb6b1144c07448a7210d9ab3fbb2f5 Mon Sep 17 00:00:00 2001
   49.10 -From: Ulrich Drepper <drepper@redhat.com>
   49.11 -Date: Thu, 8 Jan 2009 00:47:05 +0000
   49.12 -Subject: [PATCH] (prune_impossible_nodes): Handle sifted_states[0] being NULL also if
   49.13 - there are no backreferences.
   49.14 -
   49.15 --= END original header =-
   49.16 -
   49.17 -diff -durN glibc-2_9.orig/posix/regexec.c glibc-2_9/posix/regexec.c
   49.18 ---- glibc-2_9.orig/posix/regexec.c	2007-10-12 19:47:13.000000000 +0200
   49.19 -+++ glibc-2_9/posix/regexec.c	2009-02-02 22:00:43.000000000 +0100
   49.20 -@@ -1004,6 +1004,11 @@
   49.21 -       re_node_set_free (&sctx.limits);
   49.22 -       if (BE (ret != REG_NOERROR, 0))
   49.23 - 	goto free_return;
   49.24 -+      if (sifted_states[0] == NULL)
   49.25 -+	{
   49.26 -+	  ret = REG_NOMATCH;
   49.27 -+	  goto free_return;
   49.28 -+	}
   49.29 -     }
   49.30 -   re_free (mctx->state_log);
   49.31 -   mctx->state_log = sifted_states;
    50.1 --- a/patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch	Fri Mar 27 23:40:07 2009 +0000
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,53 +0,0 @@
    50.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/0070_all_glibc-i386-x86_64-revert-clone-cfi.patch
    50.5 -
    50.6 --= BEGIN original header =-
    50.7 -revert cfi additions to clone on i386/x86_64 to workaround problems in
    50.8 -gcc's unwinder code.  this is not a bug in glibc, it triggers problems
    50.9 -elsewhere.  this cfi code does not gain us a whole lot anyways.
   50.10 -
   50.11 -http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
   50.12 -
   50.13 --= END original header =-
   50.14 -
   50.15 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2_9/sysdeps/unix/sysv/linux/i386/clone.S
   50.16 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/i386/clone.S	2006-12-04 00:12:36.000000000 +0100
   50.17 -+++ glibc-2_9/sysdeps/unix/sysv/linux/i386/clone.S	2009-02-02 22:00:45.000000000 +0100
   50.18 -@@ -120,9 +120,6 @@
   50.19 - 	ret
   50.20 - 
   50.21 - L(thread_start):
   50.22 --	cfi_startproc;
   50.23 --	/* Clearing frame pointer is insufficient, use CFI.  */
   50.24 --	cfi_undefined (eip);
   50.25 - 	/* Note: %esi is zero.  */
   50.26 - 	movl	%esi,%ebp	/* terminate the stack frame */
   50.27 - #ifdef RESET_PID
   50.28 -@@ -155,7 +152,6 @@
   50.29 - 	jmp	L(haspid)
   50.30 - 	.previous
   50.31 - #endif
   50.32 --	cfi_endproc;
   50.33 - 
   50.34 - 	cfi_startproc
   50.35 - PSEUDO_END (BP_SYM (__clone))
   50.36 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2_9/sysdeps/unix/sysv/linux/x86_64/clone.S
   50.37 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/x86_64/clone.S	2006-12-04 00:12:36.000000000 +0100
   50.38 -+++ glibc-2_9/sysdeps/unix/sysv/linux/x86_64/clone.S	2009-02-02 22:00:45.000000000 +0100
   50.39 -@@ -89,9 +89,6 @@
   50.40 - 	ret
   50.41 - 
   50.42 - L(thread_start):
   50.43 --	cfi_startproc;
   50.44 --	/* Clearing frame pointer is insufficient, use CFI.  */
   50.45 --	cfi_undefined (rip);
   50.46 - 	/* Clear the frame pointer.  The ABI suggests this be done, to mark
   50.47 - 	   the outermost frame obviously.  */
   50.48 - 	xorl	%ebp, %ebp
   50.49 -@@ -116,7 +113,6 @@
   50.50 - 	/* Call exit with return value from function call. */
   50.51 - 	movq	%rax, %rdi
   50.52 - 	call	HIDDEN_JUMPTARGET (_exit)
   50.53 --	cfi_endproc;
   50.54 - 
   50.55 - 	cfi_startproc;
   50.56 - PSEUDO_END (BP_SYM (__clone))
    51.1 --- a/patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch	Fri Mar 27 23:40:07 2009 +0000
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,35 +0,0 @@
    51.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/0080_all_glibc-2.10-dns-no-gethostbyname4.patch
    51.5 -
    51.6 --= BEGIN original header =-
    51.7 -http://sourceware.org/bugzilla/show_bug.cgi?id=7060
    51.8 -http://bugs.gentoo.org/250468
    51.9 -
   51.10 -The gethostbyname4() lookup method is problematic since it fires out both
   51.11 -the A and AAAA DNS queries in parallel and over the same socket. This
   51.12 -should work in theory, but it turns out that many cheap DSL modems and
   51.13 -similar devices have buggy DNS servers - if the AAAA query arrives too
   51.14 -quickly after the A query, the server will generate only a single reply
   51.15 -with the A query id but returning an error for the AAAA query; we get
   51.16 -stuck waiting for the second reply.
   51.17 -
   51.18 -For gethostbyname4() users affected, disabling IPv6 in the system might
   51.19 -work around the issue, unfortunately it only helps with applications
   51.20 -using AI_ADDRCONFIG (e.g. Firefox); some (notably e.g. Pidgin) neglect
   51.21 -to do that.
   51.22 -
   51.23 -Real fix should be using separate ports for the A and AAAA queries.
   51.24 -
   51.25 --= END original header =-
   51.26 -
   51.27 -diff -durN glibc-2_9.orig/resolv/Versions glibc-2_9/resolv/Versions
   51.28 ---- glibc-2_9.orig/resolv/Versions	2008-08-01 19:15:34.000000000 +0200
   51.29 -+++ glibc-2_9/resolv/Versions	2009-02-02 22:00:46.000000000 +0100
   51.30 -@@ -102,7 +102,7 @@
   51.31 -     _nss_dns_gethostbyname_r; _nss_dns_getnetbyaddr_r;
   51.32 -     _nss_dns_getnetbyname_r; _nss_dns_getcanonname_r;
   51.33 -     _nss_dns_gethostbyaddr2_r;
   51.34 --    _nss_dns_gethostbyname4_r;
   51.35 -+#    _nss_dns_gethostbyname4_r;
   51.36 -   }
   51.37 - }
   51.38 - 
    52.1 --- a/patches/glibc/2_9/180-math-tests.patch	Fri Mar 27 23:40:07 2009 +0000
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,72 +0,0 @@
    52.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/0090_all_glibc-math-tests.patch
    52.5 -
    52.6 --= BEGIN original header =-
    52.7 -From: "Joseph S. Myers" <joseph at codesourcery dot com>
    52.8 -To: libc-alpha at sourceware dot org
    52.9 -Date: Tue, 15 Jul 2008 14:43:04 +0000 (UTC)
   52.10 -Subject: expm1 ulps
   52.11 -
   52.12 -If you test glibc on i686 with GCC 4.3, you get a test-ildoubl failure:
   52.13 -
   52.14 -Failure: Test: expm1 (1) == M_El - 1.0
   52.15 -Result:
   52.16 - is:          1.71828182845904523532e+00   0xd.bf0a8b14576953500000p-3
   52.17 - should be:   1.71828182845904523543e+00   0xd.bf0a8b14576953600000p-3
   52.18 - difference:  1.08420217248550443401e-19   0x8.00000000000000000000p-66
   52.19 - ulp       :  1.0000
   52.20 - max.ulp   :  0.0000
   52.21 -Maximal error of `expm1'
   52.22 - is      : 1 ulp
   52.23 - accepted: 0 ulp
   52.24 -
   52.25 -What happens is that the inline expansion of expm1l uses __builtin_expm1l,
   52.26 -and GCC 4.3 optimizes calls to __builtin_expm1l with constant argument to
   52.27 -a correctly rounded result using MPFR.  The result returned is thus the
   52.28 -value of e-1 rounded once to long double precision.  However, the test
   52.29 -expects M_El - 1.0, and the result of rounding e to long double precision,
   52.30 -then subtracting 1, differs in the last place from the result of rounding
   52.31 -e-1 to long double precision (the latter has smaller exponent, and the
   52.32 -last bit is 1).
   52.33 -
   52.34 -There are two obvious approaches possible to fixing this.  The first patch
   52.35 -below changes the expectation to a decimal expansion for e-1 (taken from
   52.36 -that of M_El) rather than doing arithmetic in the expected value.  This in
   52.37 -turn requires ulps to be set for the out-of-line version of expm1.  It
   52.38 -might also need ulps to be set for the inline version for older compilers
   52.39 -if they should continue to pass the test, and possibly for other targets.
   52.40 -The second patch below takes the alternative approach of keeping the
   52.41 -existing expectation (which has the wrong bit in the last place) and
   52.42 -setting ulps for the inline expansion of expm1, which avoids the risk of
   52.43 -breaking the test for other targets.
   52.44 -
   52.45 -2008-07-15  Joseph Myers  <joseph@codesourcery.com>
   52.46 -
   52.47 -        * sysdeps/i386/fpu/libm-test-ulps: Add inline long double ulps for
   52.48 -        expm1.
   52.49 -
   52.50 --= END original header =-
   52.51 -
   52.52 -diff -durN glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps glibc-2_9/sysdeps/i386/fpu/libm-test-ulps
   52.53 ---- glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps	2006-01-15 18:59:37.000000000 +0100
   52.54 -+++ glibc-2_9/sysdeps/i386/fpu/libm-test-ulps	2009-02-02 22:00:47.000000000 +0100
   52.55 -@@ -453,6 +453,10 @@
   52.56 - ildouble: 8
   52.57 - ldouble: 8
   52.58 - 
   52.59 -+# expm1
   52.60 -+Test "expm1 (1) == M_El - 1.0":
   52.61 -+ildouble: 1
   52.62 -+
   52.63 - # gamma
   52.64 - Test "gamma (-0.5) == log(2*sqrt(pi))":
   52.65 - double: 1
   52.66 -@@ -1134,6 +1138,9 @@
   52.67 - ildouble: 8
   52.68 - ldouble: 8
   52.69 - 
   52.70 -+Function: "expm1":
   52.71 -+ildouble: 1
   52.72 -+
   52.73 - Function: "gamma":
   52.74 - double: 1
   52.75 - idouble: 1
    53.1 --- a/patches/glibc/2_9/190-queue-header-updates.patch	Fri Mar 27 23:40:07 2009 +0000
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,89 +0,0 @@
    53.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1010_all_glibc-queue-header-updates.patch
    53.5 -
    53.6 --= BEGIN original header =-
    53.7 -grab some updates from FreeBSD
    53.8 -
    53.9 -http://bugs.gentoo.org/201979
   53.10 -
   53.11 --= END original header =-
   53.12 -
   53.13 -diff -durN glibc-2_9.orig/misc/sys/queue.h glibc-2_9/misc/sys/queue.h
   53.14 ---- glibc-2_9.orig/misc/sys/queue.h	2008-03-05 06:50:30.000000000 +0100
   53.15 -+++ glibc-2_9/misc/sys/queue.h	2009-02-02 22:00:48.000000000 +0100
   53.16 -@@ -136,6 +136,11 @@
   53.17 - 		(var);							\
   53.18 - 		(var) = ((var)->field.le_next))
   53.19 - 
   53.20 -+#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
   53.21 -+	for ((var) = LIST_FIRST((head));				\
   53.22 -+	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
   53.23 -+	    (var) = (tvar))
   53.24 -+
   53.25 - /*
   53.26 -  * List access methods.
   53.27 -  */
   53.28 -@@ -197,6 +202,16 @@
   53.29 - #define	SLIST_FOREACH(var, head, field)					\
   53.30 - 	for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
   53.31 - 
   53.32 -+#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
   53.33 -+	for ((var) = SLIST_FIRST((head));				\
   53.34 -+	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
   53.35 -+	    (var) = (tvar))
   53.36 -+
   53.37 -+#define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
   53.38 -+	for ((varp) = &SLIST_FIRST((head));				\
   53.39 -+	    ((var) = *(varp)) != NULL;					\
   53.40 -+	    (varp) = &SLIST_NEXT((var), field))
   53.41 -+
   53.42 - /*
   53.43 -  * Singly-linked List access methods.
   53.44 -  */
   53.45 -@@ -242,6 +257,12 @@
   53.46 - 	(head)->stqh_last = &(elm)->field.stqe_next;			\
   53.47 - } while (/*CONSTCOND*/0)
   53.48 - 
   53.49 -+#define	STAILQ_LAST(head, type, field)					\
   53.50 -+	(STAILQ_EMPTY((head)) ?						\
   53.51 -+		NULL :							\
   53.52 -+	        ((struct type *)(void *)				\
   53.53 -+		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
   53.54 -+
   53.55 - #define	STAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
   53.56 - 	if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
   53.57 - 		(head)->stqh_last = &(elm)->field.stqe_next;		\
   53.58 -@@ -286,6 +307,11 @@
   53.59 - #define	STAILQ_FIRST(head)	((head)->stqh_first)
   53.60 - #define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
   53.61 - 
   53.62 -+#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
   53.63 -+	for ((var) = STAILQ_FIRST((head));				\
   53.64 -+	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
   53.65 -+	    (var) = (tvar))
   53.66 -+
   53.67 - 
   53.68 - /*
   53.69 -  * Simple queue definitions.
   53.70 -@@ -437,11 +463,22 @@
   53.71 - 		(var);							\
   53.72 - 		(var) = ((var)->field.tqe_next))
   53.73 - 
   53.74 -+#define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
   53.75 -+	for ((var) = TAILQ_FIRST((head));				\
   53.76 -+	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\
   53.77 -+	    (var) = (tvar))
   53.78 -+
   53.79 - #define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
   53.80 - 	for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));	\
   53.81 - 		(var);							\
   53.82 - 		(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
   53.83 - 
   53.84 -+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\
   53.85 -+	for ((var) = TAILQ_LAST((head), headname);			\
   53.86 -+	    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\
   53.87 -+	    (var) = (tvar))
   53.88 -+
   53.89 -+
   53.90 - #define	TAILQ_CONCAT(head1, head2, field) do {				\
   53.91 - 	if (!TAILQ_EMPTY(head2)) {					\
   53.92 - 		*(head1)->tqh_last = (head2)->tqh_first;		\
    54.1 --- a/patches/glibc/2_9/200-awk-in-C-locale.patch	Fri Mar 27 23:40:07 2009 +0000
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,23 +0,0 @@
    54.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1018_all_glibc-awk-in-C-locale.patch
    54.5 -
    54.6 --= BEGIN original header =-
    54.7 -http://bugs.gentoo.org/252802
    54.8 -
    54.9 -2008-12-29  Mike Frysinger  <vapier@gentoo.org>
   54.10 -
   54.11 -	* iconvdata/Makefile (iconv-rules): Use LC_ALL=C when running awk script.
   54.12 -
   54.13 --= END original header =-
   54.14 -
   54.15 -diff -durN glibc-2_9.orig/iconvdata/Makefile glibc-2_9/iconvdata/Makefile
   54.16 ---- glibc-2_9.orig/iconvdata/Makefile	2008-05-15 03:54:31.000000000 +0200
   54.17 -+++ glibc-2_9/iconvdata/Makefile	2009-02-02 22:00:50.000000000 +0100
   54.18 -@@ -286,7 +286,7 @@
   54.19 - 	{ echo $(filter-out lib%, $(modules)); \
   54.20 - 	  echo 8bit $(gen-8bit-modules); \
   54.21 - 	  echo 8bit-gap $(gen-8bit-gap-modules); } | \
   54.22 --	$(AWK) 'NR == 1 { \
   54.23 -+	LC_ALL=C $(AWK) 'NR == 1 { \
   54.24 - 		  for (i = 1; i <= NF; i++) { \
   54.25 - 		    printf "%s-routines := %s\n", $$i, tolower($$i); \
   54.26 - 		    printf "%s-map := gconv.map\n", $$i; \
    55.1 --- a/patches/glibc/2_9/210-2.9-strlen-hack.patch	Fri Mar 27 23:40:07 2009 +0000
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,109 +0,0 @@
    55.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1020_all_glibc-2.9-strlen-hack.patch
    55.5 -
    55.6 --= BEGIN original header =-
    55.7 -http://sourceware.org/bugzilla/show_bug.cgi?id=5807
    55.8 -http://www.cl.cam.ac.uk/~am21/progtricks.html
    55.9 -
   55.10 --= END original header =-
   55.11 -
   55.12 -diff -durN glibc-2_9.orig/string/strlen.c glibc-2_9/string/strlen.c
   55.13 ---- glibc-2_9.orig/string/strlen.c	2005-12-14 12:09:07.000000000 +0100
   55.14 -+++ glibc-2_9/string/strlen.c	2009-02-02 22:00:51.000000000 +0100
   55.15 -@@ -32,7 +32,7 @@
   55.16 - {
   55.17 -   const char *char_ptr;
   55.18 -   const unsigned long int *longword_ptr;
   55.19 --  unsigned long int longword, magic_bits, himagic, lomagic;
   55.20 -+  unsigned long int longword, himagic, lomagic;
   55.21 - 
   55.22 -   /* Handle the first few characters by reading one character at a time.
   55.23 -      Do this until CHAR_PTR is aligned on a longword boundary.  */
   55.24 -@@ -42,28 +42,14 @@
   55.25 -     if (*char_ptr == '\0')
   55.26 -       return char_ptr - str;
   55.27 - 
   55.28 --  /* All these elucidatory comments refer to 4-byte longwords,
   55.29 --     but the theory applies equally well to 8-byte longwords.  */
   55.30 --
   55.31 -   longword_ptr = (unsigned long int *) char_ptr;
   55.32 - 
   55.33 --  /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
   55.34 --     the "holes."  Note that there is a hole just to the left of
   55.35 --     each byte, with an extra at the end:
   55.36 --
   55.37 --     bits:  01111110 11111110 11111110 11111111
   55.38 --     bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
   55.39 --
   55.40 --     The 1-bits make sure that carries propagate to the next 0-bit.
   55.41 --     The 0-bits provide holes for carries to fall into.  */
   55.42 --  magic_bits = 0x7efefeffL;
   55.43 -   himagic = 0x80808080L;
   55.44 -   lomagic = 0x01010101L;
   55.45 -   if (sizeof (longword) > 4)
   55.46 -     {
   55.47 -       /* 64-bit version of the magic.  */
   55.48 -       /* Do the shift in two steps to avoid a warning if long has 32 bits.  */
   55.49 --      magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
   55.50 -       himagic = ((himagic << 16) << 16) | himagic;
   55.51 -       lomagic = ((lomagic << 16) << 16) | lomagic;
   55.52 -     }
   55.53 -@@ -75,56 +61,12 @@
   55.54 -      if *any of the four* bytes in the longword in question are zero.  */
   55.55 -   for (;;)
   55.56 -     {
   55.57 --      /* We tentatively exit the loop if adding MAGIC_BITS to
   55.58 --	 LONGWORD fails to change any of the hole bits of LONGWORD.
   55.59 --
   55.60 --	 1) Is this safe?  Will it catch all the zero bytes?
   55.61 --	 Suppose there is a byte with all zeros.  Any carry bits
   55.62 --	 propagating from its left will fall into the hole at its
   55.63 --	 least significant bit and stop.  Since there will be no
   55.64 --	 carry from its most significant bit, the LSB of the
   55.65 --	 byte to the left will be unchanged, and the zero will be
   55.66 --	 detected.
   55.67 --
   55.68 --	 2) Is this worthwhile?  Will it ignore everything except
   55.69 --	 zero bytes?  Suppose every byte of LONGWORD has a bit set
   55.70 --	 somewhere.  There will be a carry into bit 8.  If bit 8
   55.71 --	 is set, this will carry into bit 16.  If bit 8 is clear,
   55.72 --	 one of bits 9-15 must be set, so there will be a carry
   55.73 --	 into bit 16.  Similarly, there will be a carry into bit
   55.74 --	 24.  If one of bits 24-30 is set, there will be a carry
   55.75 --	 into bit 31, so all of the hole bits will be changed.
   55.76 --
   55.77 --	 The one misfire occurs when bits 24-30 are clear and bit
   55.78 --	 31 is set; in this case, the hole at bit 31 is not
   55.79 --	 changed.  If we had access to the processor carry flag,
   55.80 --	 we could close this loophole by putting the fourth hole
   55.81 --	 at bit 32!
   55.82 --
   55.83 --	 So it ignores everything except 128's, when they're aligned
   55.84 --	 properly.  */
   55.85 --
   55.86 -       longword = *longword_ptr++;
   55.87 - 
   55.88 --      if (
   55.89 --#if 0
   55.90 --	  /* Add MAGIC_BITS to LONGWORD.  */
   55.91 --	  (((longword + magic_bits)
   55.92 --
   55.93 --	    /* Set those bits that were unchanged by the addition.  */
   55.94 --	    ^ ~longword)
   55.95 --
   55.96 --	   /* Look at only the hole bits.  If any of the hole bits
   55.97 --	      are unchanged, most likely one of the bytes was a
   55.98 --	      zero.  */
   55.99 --	   & ~magic_bits)
  55.100 --#else
  55.101 --	  ((longword - lomagic) & himagic)
  55.102 --#endif
  55.103 --	  != 0)
  55.104 -+      /* This hack taken from Alan Mycroft's HAKMEMC postings.
  55.105 -+         See: http://www.cl.cam.ac.uk/~am21/progtricks.html */
  55.106 -+      if (((longword - lomagic) & ~longword & himagic) != 0)
  55.107 - 	{
  55.108 --	  /* Which of the bytes was the zero?  If none of them were, it was
  55.109 --	     a misfire; continue the search.  */
  55.110 - 
  55.111 - 	  const char *cp = (const char *) (longword_ptr - 1);
  55.112 - 
    56.1 --- a/patches/glibc/2_9/220-manual-no-perl.patch	Fri Mar 27 23:40:07 2009 +0000
    56.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.3 @@ -1,29 +0,0 @@
    56.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1030_all_glibc-manual-no-perl.patch
    56.5 -
    56.6 --= BEGIN original header =-
    56.7 -If we're using a cvs snapshot which updates the source files, and
    56.8 -perl isn't installed yet, then we can't regen the docs.  Not a big
    56.9 -deal, so just whine a little and continue on our merry way.
   56.10 -
   56.11 -http://bugs.gentoo.org/60132
   56.12 -
   56.13 --= END original header =-
   56.14 -
   56.15 -diff -durN glibc-2_9.orig/manual/Makefile glibc-2_9/manual/Makefile
   56.16 ---- glibc-2_9.orig/manual/Makefile	2006-01-08 07:43:47.000000000 +0100
   56.17 -+++ glibc-2_9/manual/Makefile	2009-02-02 22:00:53.000000000 +0100
   56.18 -@@ -104,9 +104,14 @@
   56.19 - libm-err.texi: stamp-libm-err
   56.20 - stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
   56.21 - 						     $(dir)/libm-test-ulps))
   56.22 -+ifneq ($(PERL),no)
   56.23 - 	pwd=`pwd`; \
   56.24 - 	$(PERL) $< $$pwd/.. > libm-err-tmp
   56.25 - 	$(move-if-change) libm-err-tmp libm-err.texi
   56.26 -+else
   56.27 -+	echo "Unable to rebuild math docs, no perl installed"
   56.28 -+	touch libm-err.texi
   56.29 -+endif
   56.30 - 	touch $@
   56.31 - 
   56.32 - # Generate Texinfo files from the C source for the example programs.
    57.1 --- a/patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch	Fri Mar 27 23:40:07 2009 +0000
    57.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.3 @@ -1,74 +0,0 @@
    57.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1040_all_2.3.3-localedef-fix-trampoline.patch
    57.5 -
    57.6 --= BEGIN original header =-
    57.7 -#! /bin/sh -e
    57.8 -
    57.9 -# DP: Description: Fix localedef segfault when run under exec-shield,
   57.10 -#        PaX or similar. (#231438, #198099)
   57.11 -# DP: Dpatch Author: James Troup <james@nocrew.org>
   57.12 -# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
   57.13 -# DP: Upstream status: Unknown
   57.14 -# DP: Status Details: Unknown
   57.15 -# DP: Date: 2004-03-16
   57.16 -
   57.17 -if [ $# -ne 2 ]; then
   57.18 -    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
   57.19 -    exit 1
   57.20 -fi
   57.21 -case "$1" in
   57.22 -    -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
   57.23 -    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
   57.24 -    *)
   57.25 -	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
   57.26 -	exit 1
   57.27 -esac
   57.28 -exit 0
   57.29 -
   57.30 --= END original header =-
   57.31 -
   57.32 -diff -durN glibc-2_9.orig/locale/programs/3level.h glibc-2_9/locale/programs/3level.h
   57.33 ---- glibc-2_9.orig/locale/programs/3level.h	2007-07-16 02:54:59.000000000 +0200
   57.34 -+++ glibc-2_9/locale/programs/3level.h	2009-02-02 22:00:54.000000000 +0100
   57.35 -@@ -203,6 +203,42 @@
   57.36 - 	}
   57.37 -     }
   57.38 - }
   57.39 -+
   57.40 -+/* GCC ATM seems to do a poor job with pointers to nested functions passed
   57.41 -+   to inlined functions.  Help it a little bit with this hack.  */
   57.42 -+#define wchead_table_iterate(tp, fn) \
   57.43 -+do									      \
   57.44 -+  {									      \
   57.45 -+    struct wchead_table *t = (tp);					      \
   57.46 -+    uint32_t index1;							      \
   57.47 -+    for (index1 = 0; index1 < t->level1_size; index1++)			      \
   57.48 -+      {									      \
   57.49 -+	uint32_t lookup1 = t->level1[index1];				      \
   57.50 -+	if (lookup1 != ((uint32_t) ~0))					      \
   57.51 -+	  {								      \
   57.52 -+	    uint32_t lookup1_shifted = lookup1 << t->q;			      \
   57.53 -+	    uint32_t index2;						      \
   57.54 -+	    for (index2 = 0; index2 < (1 << t->q); index2++)		      \
   57.55 -+	      {								      \
   57.56 -+		uint32_t lookup2 = t->level2[index2 + lookup1_shifted];	      \
   57.57 -+		if (lookup2 != ((uint32_t) ~0))				      \
   57.58 -+		  {							      \
   57.59 -+		    uint32_t lookup2_shifted = lookup2 << t->p;		      \
   57.60 -+		    uint32_t index3;					      \
   57.61 -+		    for (index3 = 0; index3 < (1 << t->p); index3++)	      \
   57.62 -+		      {							      \
   57.63 -+			struct element_t *lookup3			      \
   57.64 -+			  = t->level3[index3 + lookup2_shifted];	      \
   57.65 -+			if (lookup3 != NULL)				      \
   57.66 -+			  fn ((((index1 << t->q) + index2) << t->p) + index3, \
   57.67 -+			      lookup3);					      \
   57.68 -+		      }							      \
   57.69 -+		  }							      \
   57.70 -+	      }								      \
   57.71 -+	  }								      \
   57.72 -+      }									      \
   57.73 -+  } while (0)
   57.74 -+
   57.75 - #endif
   57.76 - 
   57.77 - #ifndef NO_FINALIZE
    58.1 --- a/patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch	Fri Mar 27 23:40:07 2009 +0000
    58.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.3 @@ -1,23 +0,0 @@
    58.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1050_all_glibc-i386-LOAD_PIC_REG.patch
    58.5 -
    58.6 --= BEGIN original header =-
    58.7 -From e41177ea18a77a7f62328293b4fd49ae17482e77 Mon Sep 17 00:00:00 2001
    58.8 -From: Ulrich Drepper <drepper@redhat.com>
    58.9 -Date: Sat, 6 Dec 2008 00:15:17 +0000
   58.10 -Subject: [PATCH] (_dl_tlsdesc_dynamic): Use LOAD_PIC_REG instead of doing things manually.
   58.11 -
   58.12 --= END original header =-
   58.13 -
   58.14 -diff -durN glibc-2_9.orig/sysdeps/i386/dl-tlsdesc.S glibc-2_9/sysdeps/i386/dl-tlsdesc.S
   58.15 ---- glibc-2_9.orig/sysdeps/i386/dl-tlsdesc.S	2008-05-13 07:33:06.000000000 +0200
   58.16 -+++ glibc-2_9/sysdeps/i386/dl-tlsdesc.S	2009-02-02 22:00:56.000000000 +0100
   58.17 -@@ -128,8 +128,7 @@
   58.18 - .Lslow:
   58.19 - 	cfi_adjust_cfa_offset (28)
   58.20 - 	movl	%ebx, 16(%esp)
   58.21 --	call	__i686.get_pc_thunk.bx
   58.22 --	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
   58.23 -+	LOAD_PIC_REG (bx)
   58.24 - 	call	___tls_get_addr@PLT
   58.25 - 	movl	16(%esp), %ebx
   58.26 - 	jmp	.Lret
    59.1 --- a/patches/glibc/2_9/250-resolv-dynamic.patch	Fri Mar 27 23:40:07 2009 +0000
    59.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.3 @@ -1,44 +0,0 @@
    59.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1055_all_glibc-resolv-dynamic.patch
    59.5 -
    59.6 --= BEGIN original header =-
    59.7 -ripped from SuSE
    59.8 -
    59.9 -if /etc/resolv.conf is updated, then make sure applications
   59.10 -already running get the updated information.
   59.11 -
   59.12 -http://bugs.gentoo.org/177416
   59.13 -
   59.14 --= END original header =-
   59.15 -
   59.16 -diff -durN glibc-2_9.orig/resolv/res_libc.c glibc-2_9/resolv/res_libc.c
   59.17 ---- glibc-2_9.orig/resolv/res_libc.c	2006-10-11 10:59:28.000000000 +0200
   59.18 -+++ glibc-2_9/resolv/res_libc.c	2009-02-02 22:00:57.000000000 +0100
   59.19 -@@ -22,6 +22,7 @@
   59.20 - #include <arpa/nameser.h>
   59.21 - #include <resolv.h>
   59.22 - #include <bits/libc-lock.h>
   59.23 -+#include <sys/stat.h>
   59.24 - 
   59.25 - 
   59.26 - /* The following bit is copied from res_data.c (where it is #ifdef'ed
   59.27 -@@ -95,6 +96,20 @@
   59.28 - __res_maybe_init (res_state resp, int preinit)
   59.29 - {
   59.30 - 	if (resp->options & RES_INIT) {
   59.31 -+		static time_t last_mtime, last_check;
   59.32 -+		time_t now;
   59.33 -+		struct stat statbuf;
   59.34 -+		
   59.35 -+		time (&now);
   59.36 -+		if (now != last_check) {
   59.37 -+			last_check = now;
   59.38 -+			if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
   59.39 -+				last_mtime = statbuf.st_mtime;
   59.40 -+				atomicinclock (lock);
   59.41 -+				atomicinc (__res_initstamp);
   59.42 -+				atomicincunlock (lock);
   59.43 -+			}
   59.44 -+		}
   59.45 - 		if (__res_initstamp != resp->_u._ext.initstamp) {
   59.46 - 			if (resp->nscount > 0) {
   59.47 - 				__res_iclose (resp, true);
    60.1 --- a/patches/glibc/2_9/260-fadvise64_64.patch	Fri Mar 27 23:40:07 2009 +0000
    60.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.3 @@ -1,30 +0,0 @@
    60.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1070_all_glibc-fadvise64_64.patch
    60.5 -
    60.6 --= BEGIN original header =-
    60.7 -ripped from Debian
    60.8 -
    60.9 --= END original header =-
   60.10 -
   60.11 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2_9/sysdeps/unix/sysv/linux/posix_fadvise.c
   60.12 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/posix_fadvise.c	2003-08-17 02:36:22.000000000 +0200
   60.13 -+++ glibc-2_9/sysdeps/unix/sysv/linux/posix_fadvise.c	2009-02-02 22:00:58.000000000 +0100
   60.14 -@@ -35,6 +35,19 @@
   60.15 -     return INTERNAL_SYSCALL_ERRNO (ret, err);
   60.16 -   return 0;
   60.17 - #else
   60.18 -+# ifdef __NR_fadvise64_64
   60.19 -+  INTERNAL_SYSCALL_DECL (err);  
   60.20 -+  int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
   60.21 -+			      __LONG_LONG_PAIR ((long) (offset >> 31),
   60.22 -+						(long) offset),
   60.23 -+			      __LONG_LONG_PAIR ((long) (len >> 31),
   60.24 -+						(long) len),
   60.25 -+			      advise);
   60.26 -+  if (INTERNAL_SYSCALL_ERROR_P (ret, err))
   60.27 -+    return INTERNAL_SYSCALL_ERRNO (ret, err);
   60.28 -+  return 0;
   60.29 -+# else
   60.30 -   return ENOSYS;
   60.31 -+# endif
   60.32 - #endif
   60.33 - }
    61.1 --- a/patches/glibc/2_9/270-ldbl-nexttowardf.patch	Fri Mar 27 23:40:07 2009 +0000
    61.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.3 @@ -1,68 +0,0 @@
    61.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1073_all_glibc-ldbl-nexttowardf.patch
    61.5 -
    61.6 --= BEGIN original header =-
    61.7 -ripped from Debian
    61.8 -
    61.9 -this change was made to generic __nexttowardf, but not the long double version
   61.10 -
   61.11 -2008-05-05  Aurelien Jarno  <aurelien@aurel32.net>
   61.12 -
   61.13 -	* sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include float.h.
   61.14 -	(__nexttowardf): Use math_opt_barrier and
   61.15 -	math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
   61.16 -	x to float using asm.
   61.17 -
   61.18 --= END original header =-
   61.19 -
   61.20 -diff -durN glibc-2_9.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c glibc-2_9/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
   61.21 ---- glibc-2_9.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	1999-07-14 02:09:42.000000000 +0200
   61.22 -+++ glibc-2_9/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	2009-02-02 22:00:59.000000000 +0100
   61.23 -@@ -19,7 +19,8 @@
   61.24 - #endif
   61.25 - 
   61.26 - #include "math.h"
   61.27 --#include "math_private.h"
   61.28 -+#include <math_private.h>
   61.29 -+#include <float.h>
   61.30 - 
   61.31 - #ifdef __STDC__
   61.32 - 	float __nexttowardf(float x, long double y)
   61.33 -@@ -44,10 +45,12 @@
   61.34 - 	   return x+y;
   61.35 - 	if((long double) x==y) return y;	/* x=y, return y */
   61.36 - 	if(ix==0) {				/* x == 0 */
   61.37 --	    float x2;
   61.38 -+	    float u;
   61.39 - 	    SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
   61.40 --	    x2 = x*x;
   61.41 --	    if(x2==x) return x2; else return x;	/* raise underflow flag */
   61.42 -+	    u = math_opt_barrier (x);
   61.43 -+	    u = u * u;
   61.44 -+	    math_force_eval (u);		/* raise underflow flag */
   61.45 -+	    return x;
   61.46 - 	}
   61.47 - 	if(hx>=0) {				/* x > 0 */
   61.48 - 	    if(hy<0||(ix>>23)>(iy>>48)-0x3f80
   61.49 -@@ -67,13 +70,16 @@
   61.50 - 	    }
   61.51 - 	}
   61.52 - 	hy = hx&0x7f800000;
   61.53 --	if(hy>=0x7f800000) return x+x;	/* overflow  */
   61.54 -+	if(hy>=0x7f800000) {
   61.55 -+	  x = x+x;	/* overflow  */
   61.56 -+	  if (FLT_EVAL_METHOD != 0)
   61.57 -+	    /* Force conversion to float.  */
   61.58 -+	    asm ("" : "+m"(x));
   61.59 -+	  return x;
   61.60 -+	}
   61.61 - 	if(hy<0x00800000) {		/* underflow */
   61.62 --	    float x2 = x*x;
   61.63 --	    if(x2!=x) {		/* raise underflow flag */
   61.64 --	        SET_FLOAT_WORD(x2,hx);
   61.65 --		return x2;
   61.66 --	    }
   61.67 -+	    float u = x*x;
   61.68 -+	    math_force_eval (u);	/* raise underflow flag */
   61.69 - 	}
   61.70 - 	SET_FLOAT_WORD(x,hx);
   61.71 - 	return x;
    62.1 --- a/patches/glibc/2_9/280-section-comments.patch	Fri Mar 27 23:40:07 2009 +0000
    62.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.3 @@ -1,29 +0,0 @@
    62.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1075_all_glibc-section-comments.patch
    62.5 -
    62.6 --= BEGIN original header =-
    62.7 -http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
    62.8 -
    62.9 -fixes building on some architectures (like m68k/arm/cris/etc...) because
   62.10 -it does the right thing
   62.11 -
   62.12 --= END original header =-
   62.13 -
   62.14 -diff -durN glibc-2_9.orig/include/libc-symbols.h glibc-2_9/include/libc-symbols.h
   62.15 ---- glibc-2_9.orig/include/libc-symbols.h	2006-11-09 16:57:12.000000000 +0100
   62.16 -+++ glibc-2_9/include/libc-symbols.h	2009-02-02 22:01:00.000000000 +0100
   62.17 -@@ -240,12 +240,12 @@
   62.18 - #  define __make_section_unallocated(section_string)
   62.19 - # endif
   62.20 - 
   62.21 --/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
   62.22 -+/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
   62.23 -    section attributes on what looks like a comment to the assembler.  */
   62.24 - # ifdef HAVE_SECTION_QUOTES
   62.25 --#  define __sec_comment "\"\n\t#\""
   62.26 -+#  define __sec_comment "\"\n#APP\n\t#\""
   62.27 - # else
   62.28 --#  define __sec_comment "\n\t#"
   62.29 -+#  define __sec_comment "\n#APP\n\t#"
   62.30 - # endif
   62.31 - # define link_warning(symbol, msg) \
   62.32 -   __make_section_unallocated (".gnu.warning." #symbol) \
    63.1 --- a/patches/glibc/2_9/290-no-inline-gmon.patch	Fri Mar 27 23:40:07 2009 +0000
    63.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.3 @@ -1,38 +0,0 @@
    63.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1080_all_glibc-no-inline-gmon.patch
    63.5 -
    63.6 --= BEGIN original header =-
    63.7 -http://bugs.gentoo.org/196245
    63.8 -http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
    63.9 -
   63.10 -Attached is a patch to add __attribute__ ((noinline)) to
   63.11 -call_gmon_start.
   63.12 -
   63.13 -Without this patch, the sec script that processed initfini.s removes a
   63.14 -part of inlined call_gmon_start, causing undefined label errors.
   63.15 -
   63.16 -This patch solves the problem by forcing gcc not to inline
   63.17 -call_gmon_start with __attribute__ ((noinline)).
   63.18 -
   63.19 -Tested by building for arm-none-lixux-gnueabi.  OK to apply?
   63.20 -
   63.21 -Kazu Hirata
   63.22 -
   63.23 -2006-05-07  Kazu Hirata  &lt;kazu@codesourcery.com&gt;
   63.24 -
   63.25 -	* sysdeps/generic/initfini.c (call_gmon_start): Add
   63.26 -	__attribute__ ((noinline)).
   63.27 -
   63.28 --= END original header =-
   63.29 -
   63.30 -diff -durN glibc-2_9.orig/sysdeps/generic/initfini.c glibc-2_9/sysdeps/generic/initfini.c
   63.31 ---- glibc-2_9.orig/sysdeps/generic/initfini.c	2007-06-17 20:02:40.000000000 +0200
   63.32 -+++ glibc-2_9/sysdeps/generic/initfini.c	2009-02-02 22:01:01.000000000 +0100
   63.33 -@@ -70,7 +70,7 @@
   63.34 - /* The beginning of _init:  */
   63.35 - asm ("\n/*@_init_PROLOG_BEGINS*/");
   63.36 - 
   63.37 --static void
   63.38 -+static void __attribute__ ((noinline))
   63.39 - call_gmon_start(void)
   63.40 - {
   63.41 -   extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
    64.1 --- a/patches/glibc/2_9/300-2.9-check_native-headers.patch	Fri Mar 27 23:40:07 2009 +0000
    64.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.3 @@ -1,22 +0,0 @@
    64.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1085_all_glibc-2.9-check_native-headers.patch
    64.5 -
    64.6 --= BEGIN original header =-
    64.7 -many ports hit this warning:
    64.8 -../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
    64.9 -../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
   64.10 -
   64.11 -snipped from suse
   64.12 -
   64.13 --= END original header =-
   64.14 -
   64.15 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/check_native.c glibc-2_9/sysdeps/unix/sysv/linux/check_native.c
   64.16 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/check_native.c	2007-11-24 04:12:17.000000000 +0100
   64.17 -+++ glibc-2_9/sysdeps/unix/sysv/linux/check_native.c	2009-02-02 22:01:03.000000000 +0100
   64.18 -@@ -23,6 +23,7 @@
   64.19 - #include <stddef.h>
   64.20 - #include <stdint.h>
   64.21 - #include <stdlib.h>
   64.22 -+#include <string.h>
   64.23 - #include <time.h>
   64.24 - #include <unistd.h>
   64.25 - #include <net/if.h>
    65.1 --- a/patches/glibc/2_9/310-2.3.6-fix-pr631.patch	Fri Mar 27 23:40:07 2009 +0000
    65.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.3 @@ -1,50 +0,0 @@
    65.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1090_all_glibc-2.3.6-fix-pr631.patch
    65.5 -
    65.6 --= BEGIN original header =-
    65.7 -From dank@kegel.com
    65.8 -Wed Jun 15 09:12:43 PDT 2005
    65.9 -
   65.10 -Fixes
   65.11 -
   65.12 -build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r'
   65.13 -build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent'
   65.14 -... 53 lines deleted ...
   65.15 -build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r'
   65.16 -collect2: ld returned 1 exit status
   65.17 -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
   65.18 -
   65.19 -when building glibc with --enable-static-nss.
   65.20 -
   65.21 -See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631
   65.22 -
   65.23 --= END original header =-
   65.24 -
   65.25 -diff -durN glibc-2_9.orig/Makeconfig glibc-2_9/Makeconfig
   65.26 ---- glibc-2_9.orig/Makeconfig	2009-02-02 22:00:36.000000000 +0100
   65.27 -+++ glibc-2_9/Makeconfig	2009-02-02 22:01:04.000000000 +0100
   65.28 -@@ -509,7 +509,7 @@
   65.29 - 
   65.30 - # The static libraries.
   65.31 - ifeq (yes,$(build-static))
   65.32 --link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
   65.33 -+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a
   65.34 - else
   65.35 - ifeq (yes,$(build-shared))
   65.36 - # We can try to link the programs with lib*_pic.a...
   65.37 -diff -durN glibc-2_9.orig/elf/Makefile glibc-2_9/elf/Makefile
   65.38 ---- glibc-2_9.orig/elf/Makefile	2008-10-31 21:35:11.000000000 +0100
   65.39 -+++ glibc-2_9/elf/Makefile	2009-02-02 22:01:04.000000000 +0100
   65.40 -@@ -121,6 +121,13 @@
   65.41 - install-bin-script = ldd
   65.42 - endif
   65.43 - 
   65.44 -+ifeq (yes,$(build-static-nss))
   65.45 -+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
   65.46 -+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
   65.47 -+otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
   65.48 -+	     $(resolvobjdir)/libresolv.a
   65.49 -+endif
   65.50 -+
   65.51 - others		= sprof sln
   65.52 - install-bin	= sprof
   65.53 - others-static   = sln
    66.1 --- a/patches/glibc/2_9/320-2.9-assume-pipe2.patch	Fri Mar 27 23:40:07 2009 +0000
    66.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.3 @@ -1,59 +0,0 @@
    66.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1095_all_glibc-2.9-assume-pipe2.patch
    66.5 -
    66.6 --= BEGIN original header =-
    66.7 -http://bugs.gentoo.org/250342
    66.8 -http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
    66.9 -
   66.10 -we cant assume sock_cloexec and pipe2 are bound together as the former defines
   66.11 -are found in glibc only while the latter are a combo of kernel headers and
   66.12 -glibc.  so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
   66.13 -inside of glibc, we hit a problem.  for example:
   66.14 -
   66.15 -#include <grp.h>
   66.16 -#include <stdio.h>
   66.17 -main()
   66.18 -{
   66.19 -	getgrnam("portage");
   66.20 -	if (!popen("ls", "r"))
   66.21 -		perror("popen()");
   66.22 -}
   66.23 -
   66.24 -getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
   66.25 -__have_sock_cloexec and __have_pipe2 to true.  but if glibc was built against
   66.26 -older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
   66.27 -stub for it.  so popen() will always fail as glibc assumes pipe2() works.
   66.28 -
   66.29 --= END original header =-
   66.30 -
   66.31 -diff -durN glibc-2_9.orig/include/unistd.h glibc-2_9/include/unistd.h
   66.32 ---- glibc-2_9.orig/include/unistd.h	2008-07-27 20:23:17.000000000 +0200
   66.33 -+++ glibc-2_9/include/unistd.h	2009-02-02 22:01:05.000000000 +0100
   66.34 -@@ -167,9 +167,6 @@
   66.35 - extern int __pause_nocancel (void) attribute_hidden;
   66.36 - 
   66.37 - extern int __have_sock_cloexec;
   66.38 --/* At lot of other functionality became available at the same time as
   66.39 --   SOCK_CLOEXEC.  Avoid defining separate variables for all of them
   66.40 --   unless it is really necessary.  */
   66.41 --#define __have_pipe2 __have_sock_cloexec
   66.42 -+extern int __have_pipe2;
   66.43 - 
   66.44 - #endif
   66.45 -diff -durN glibc-2_9.orig/socket/have_sock_cloexec.c glibc-2_9/socket/have_sock_cloexec.c
   66.46 ---- glibc-2_9.orig/socket/have_sock_cloexec.c	2008-07-25 18:46:23.000000000 +0200
   66.47 -+++ glibc-2_9/socket/have_sock_cloexec.c	2009-02-02 22:01:05.000000000 +0100
   66.48 -@@ -16,9 +16,14 @@
   66.49 -    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   66.50 -    02111-1307 USA.  */
   66.51 - 
   66.52 -+#include <fcntl.h>
   66.53 - #include <sys/socket.h>
   66.54 - #include <kernel-features.h>
   66.55 - 
   66.56 - #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
   66.57 - int __have_sock_cloexec;
   66.58 - #endif
   66.59 -+
   66.60 -+#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
   66.61 -+int __have_pipe2;
   66.62 -+#endif
    67.1 --- a/patches/glibc/2_9/330-2.3.3-china.patch	Fri Mar 27 23:40:07 2009 +0000
    67.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.3 @@ -1,35 +0,0 @@
    67.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1100_all_glibc-2.3.3-china.patch
    67.5 -
    67.6 --= BEGIN original header =-
    67.7 --= END original header =-
    67.8 -
    67.9 -diff -durN glibc-2_9.orig/localedata/locales/zh_TW glibc-2_9/localedata/locales/zh_TW
   67.10 ---- glibc-2_9.orig/localedata/locales/zh_TW	2004-11-01 00:42:28.000000000 +0100
   67.11 -+++ glibc-2_9/localedata/locales/zh_TW	2009-02-02 22:01:06.000000000 +0100
   67.12 -@@ -1,7 +1,7 @@
   67.13 - comment_char %
   67.14 - escape_char /
   67.15 - %
   67.16 --% Chinese language locale for Taiwan R.O.C.
   67.17 -+% Chinese language locale for Taiwan
   67.18 - % charmap: BIG5-CP950
   67.19 - %
   67.20 - % Original Author:
   67.21 -@@ -17,7 +17,7 @@
   67.22 - % Reference:	http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
   67.23 - 
   67.24 - LC_IDENTIFICATION
   67.25 --title      "Chinese locale for Taiwan R.O.C."
   67.26 -+title      "Chinese locale for Taiwan"
   67.27 - source     ""
   67.28 - address    ""
   67.29 - contact    ""
   67.30 -@@ -25,7 +25,7 @@
   67.31 - tel        ""
   67.32 - fax        ""
   67.33 - language   "Chinese"
   67.34 --territory  "Taiwan R.O.C."
   67.35 -+territory  "Taiwan"
   67.36 - revision   "0.2"
   67.37 - date       "2000-08-02"
   67.38 - %
    68.1 --- a/patches/glibc/2_9/340-new-valencian-locale.patch	Fri Mar 27 23:40:07 2009 +0000
    68.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.3 @@ -1,120 +0,0 @@
    68.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1103_all_glibc-new-valencian-locale.patch
    68.5 -
    68.6 --= BEGIN original header =-
    68.7 -http://bugs.gentoo.org/show_bug.cgi?id=131815
    68.8 -http://sourceware.org/bugzilla/show_bug.cgi?id=2522
    68.9 -
   68.10 --= END original header =-
   68.11 -
   68.12 -diff -durN glibc-2_9.orig/localedata/SUPPORTED glibc-2_9/localedata/SUPPORTED
   68.13 ---- glibc-2_9.orig/localedata/SUPPORTED	2008-09-16 23:24:57.000000000 +0200
   68.14 -+++ glibc-2_9/localedata/SUPPORTED	2009-02-02 22:01:08.000000000 +0100
   68.15 -@@ -72,6 +72,8 @@
   68.16 - ca_ES.UTF-8/UTF-8 \
   68.17 - ca_ES/ISO-8859-1 \
   68.18 - ca_ES@euro/ISO-8859-15 \
   68.19 -+ca_ES.UTF-8@valencia/UTF-8 \
   68.20 -+ca_ES@valencia/ISO-8859-15 \
   68.21 - ca_FR.UTF-8/UTF-8 \
   68.22 - ca_FR/ISO-8859-15 \
   68.23 - ca_IT.UTF-8/UTF-8 \
   68.24 -diff -durN glibc-2_9.orig/localedata/locales/ca_ES@valencia glibc-2_9/localedata/locales/ca_ES@valencia
   68.25 ---- glibc-2_9.orig/localedata/locales/ca_ES@valencia	1970-01-01 01:00:00.000000000 +0100
   68.26 -+++ glibc-2_9/localedata/locales/ca_ES@valencia	2009-02-02 22:01:08.000000000 +0100
   68.27 -@@ -0,0 +1,96 @@
   68.28 -+comment_char %
   68.29 -+escape_char  /
   68.30 -+%
   68.31 -+% Valencian (southern Catalan) locale for Spain with Euro
   68.32 -+%
   68.33 -+% Note that this locale is almost the same as ca_ES@euro.  The point of having
   68.34 -+% a separate locale is only for PO translations, which have a lot of social
   68.35 -+% support and are very appreciated by the Valencian-speaking community.
   68.36 -+%
   68.37 -+% Contact: Jordi Mallach
   68.38 -+% Email: jordi@gnu.org
   68.39 -+% Tel:
   68.40 -+% Fax:
   68.41 -+% Language: ca
   68.42 -+% Territory: ES
   68.43 -+% Option: euro
   68.44 -+% Revision: 1.0
   68.45 -+% Date: 2006-04-06
   68.46 -+% Application: general
   68.47 -+% Users: general
   68.48 -+% Repertoiremap: mnemonic,ds
   68.49 -+% Charset: ISO-8859-15
   68.50 -+% Distribution and use is free, also
   68.51 -+% for commercial purposes.
   68.52 -+
   68.53 -+LC_IDENTIFICATION
   68.54 -+title      "Valencian (southern Catalan) locale for Spain with Euro"
   68.55 -+source     ""
   68.56 -+address    ""
   68.57 -+contact    "Jordi Mallach"
   68.58 -+email      "jordi@gnu.org"
   68.59 -+tel        ""
   68.60 -+fax        ""
   68.61 -+language   "Catalan"
   68.62 -+territory  "Spain"
   68.63 -+revision   "1.0"
   68.64 -+date       "2006-04-06"
   68.65 -+%
   68.66 -+category  "ca_ES@valencia:2006";LC_IDENTIFICATION
   68.67 -+category  "ca_ES@valencia:2006";LC_CTYPE
   68.68 -+category  "ca_ES@valencia:2006";LC_COLLATE
   68.69 -+category  "ca_ES@valencia:2006";LC_MONETARY
   68.70 -+category  "ca_ES@valencia:2006";LC_NUMERIC
   68.71 -+category  "ca_ES@valencia:2006";LC_TIME
   68.72 -+category  "ca_ES@valencia:2006";LC_MESSAGES
   68.73 -+category  "ca_ES@valencia:2006";LC_PAPER
   68.74 -+category  "ca_ES@valencia:2006";LC_NAME
   68.75 -+category  "ca_ES@valencia:2006";LC_ADDRESS
   68.76 -+category  "ca_ES@valencia:2006";LC_TELEPHONE
   68.77 -+category  "ca_ES@valencia:2006";LC_MEASUREMENT
   68.78 -+
   68.79 -+END LC_IDENTIFICATION
   68.80 -+
   68.81 -+LC_CTYPE
   68.82 -+copy "i18n"
   68.83 -+END LC_CTYPE
   68.84 -+
   68.85 -+LC_COLLATE
   68.86 -+copy "ca_ES"
   68.87 -+END LC_COLLATE
   68.88 -+
   68.89 -+LC_MONETARY
   68.90 -+copy "ca_ES"
   68.91 -+END LC_MONETARY
   68.92 -+
   68.93 -+LC_NUMERIC
   68.94 -+copy "ca_ES"
   68.95 -+END LC_NUMERIC
   68.96 -+
   68.97 -+LC_TIME
   68.98 -+copy "ca_ES"
   68.99 -+END LC_TIME
  68.100 -+
  68.101 -+LC_MESSAGES
  68.102 -+copy "ca_ES"
  68.103 -+END LC_MESSAGES
  68.104 -+
  68.105 -+LC_PAPER
  68.106 -+copy "ca_ES"
  68.107 -+END LC_PAPER
  68.108 -+
  68.109 -+LC_NAME
  68.110 -+copy "ca_ES"
  68.111 -+END LC_NAME
  68.112 -+
  68.113 -+LC_ADDRESS
  68.114 -+copy "ca_ES"
  68.115 -+END LC_ADDRESS
  68.116 -+
  68.117 -+LC_TELEPHONE
  68.118 -+copy "ca_ES"
  68.119 -+END LC_TELEPHONE
  68.120 -+
  68.121 -+LC_MEASUREMENT
  68.122 -+copy "ca_ES"
  68.123 -+END LC_MEASUREMENT
    69.1 --- a/patches/glibc/2_9/350-2.4-undefine-__i686.patch	Fri Mar 27 23:40:07 2009 +0000
    69.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.3 @@ -1,47 +0,0 @@
    69.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1130_all_glibc-2.4-undefine-__i686.patch
    69.5 -
    69.6 --= BEGIN original header =-
    69.7 -If gcc is configured to generate i686 code or better by default (like 
    69.8 -when using the --with-arch=pentium3 configure option), then the __i686
    69.9 -macro will always be defined automatically and thus screw up the
   69.10 -compilation of some .S files.
   69.11 -http://bugs.gentoo.org/131108
   69.12 -http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html
   69.13 -
   69.14 -2006-04-25  Mike Frysinger  <vapier@gentoo.org>
   69.15 -
   69.16 -	* sysdeps/i386/sysdep.h (__i686): Undefine.
   69.17 -
   69.18 --= END original header =-
   69.19 -
   69.20 -diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2_9/nptl/sysdeps/pthread/pt-initfini.c
   69.21 ---- glibc-2_9.orig/nptl/sysdeps/pthread/pt-initfini.c	2007-06-17 20:02:01.000000000 +0200
   69.22 -+++ glibc-2_9/nptl/sysdeps/pthread/pt-initfini.c	2009-02-02 22:01:09.000000000 +0100
   69.23 -@@ -45,6 +45,9 @@
   69.24 - /* Embed an #include to pull in the alignment and .end directives. */
   69.25 - asm ("\n#include \"defs.h\"");
   69.26 - 
   69.27 -+/* Embed an #include to pull in asm settings. */
   69.28 -+asm ("\n#ifdef __i686__\n#include <sysdep.h>\n#endif");
   69.29 -+
   69.30 - /* The initial common code ends here. */
   69.31 - asm ("\n/*@HEADER_ENDS*/");
   69.32 - 
   69.33 -diff -durN glibc-2_9.orig/sysdeps/i386/sysdep.h glibc-2_9/sysdeps/i386/sysdep.h
   69.34 ---- glibc-2_9.orig/sysdeps/i386/sysdep.h	2006-10-28 08:44:03.000000000 +0200
   69.35 -+++ glibc-2_9/sysdeps/i386/sysdep.h	2009-02-02 22:01:09.000000000 +0100
   69.36 -@@ -18,6 +18,14 @@
   69.37 -    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   69.38 -    02111-1307 USA.  */
   69.39 - 
   69.40 -+/*
   69.41 -+ * When building for i686 targets or better, gcc automatically defines
   69.42 -+ * '__i686' to '1' for us which causes trouble when using section names
   69.43 -+ * like '__i686.get_pc_thunk.reg'.  Since we check for __i686__ in the
   69.44 -+ * code, killing '__i686' shouldn't be a problem.
   69.45 -+ */
   69.46 -+#undef __i686
   69.47 -+
   69.48 - #include <sysdeps/generic/sysdep.h>
   69.49 - 
   69.50 - #ifdef	__ASSEMBLER__
    70.1 --- a/patches/glibc/2_9/360-2.8-nscd-one-fork.patch	Fri Mar 27 23:40:07 2009 +0000
    70.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.3 @@ -1,45 +0,0 @@
    70.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1160_all_glibc-2.8-nscd-one-fork.patch
    70.5 -
    70.6 --= BEGIN original header =-
    70.7 -only fork one to assist in stop-start-daemon assumptions about daemon behavior
    70.8 -
    70.9 -http://bugs.gentoo.org/190785
   70.10 -
   70.11 --= END original header =-
   70.12 -
   70.13 -diff -durN glibc-2_9.orig/nscd/nscd.c glibc-2_9/nscd/nscd.c
   70.14 ---- glibc-2_9.orig/nscd/nscd.c	2008-03-29 19:08:12.000000000 +0100
   70.15 -+++ glibc-2_9/nscd/nscd.c	2009-02-02 22:01:10.000000000 +0100
   70.16 -@@ -179,6 +179,9 @@
   70.17 -       if (pid != 0)
   70.18 - 	exit (0);
   70.19 - 
   70.20 -+       if (write_pid (_PATH_NSCDPID) < 0)
   70.21 -+	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
   70.22 -+
   70.23 -       int nullfd = open (_PATH_DEVNULL, O_RDWR);
   70.24 -       if (nullfd != -1)
   70.25 - 	{
   70.26 -@@ -228,12 +231,6 @@
   70.27 - 	for (i = min_close_fd; i < getdtablesize (); i++)
   70.28 - 	  close (i);
   70.29 - 
   70.30 --      pid = fork ();
   70.31 --      if (pid == -1)
   70.32 --	error (EXIT_FAILURE, errno, _("cannot fork"));
   70.33 --      if (pid != 0)
   70.34 --	exit (0);
   70.35 --
   70.36 -       setsid ();
   70.37 - 
   70.38 -       if (chdir ("/") != 0)
   70.39 -@@ -242,9 +239,6 @@
   70.40 - 
   70.41 -       openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
   70.42 - 
   70.43 --      if (write_pid (_PATH_NSCDPID) < 0)
   70.44 --        dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
   70.45 --
   70.46 -       if (!init_logfile ())
   70.47 - 	dbg_log (_("Could not create log file"));
   70.48 - 
    71.1 --- a/patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch	Fri Mar 27 23:40:07 2009 +0000
    71.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.3 @@ -1,249 +0,0 @@
    71.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1503_hppa_glibc-2.7-hppa-nptl-carlos.patch
    71.5 -
    71.6 --= BEGIN original header =-
    71.7 --= END original header =-
    71.8 -
    71.9 -diff -durN glibc-2_9.orig/elf/rtld.c glibc-2_9/elf/rtld.c
   71.10 ---- glibc-2_9.orig/elf/rtld.c	2009-02-02 22:00:34.000000000 +0100
   71.11 -+++ glibc-2_9/elf/rtld.c	2009-02-02 22:01:12.000000000 +0100
   71.12 -@@ -386,14 +386,14 @@
   71.13 -      know it is available.  We do not have to clear the memory if we
   71.14 -      do not have to use the temporary bootstrap_map.  Global variables
   71.15 -      are initialized to zero by default.  */
   71.16 --#ifndef DONT_USE_BOOTSTRAP_MAP
   71.17 -+#if !defined DONT_USE_BOOTSTRAP_MAP
   71.18 - # ifdef HAVE_BUILTIN_MEMSET
   71.19 -   __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
   71.20 - # else
   71.21 --  for (size_t cnt = 0;
   71.22 --       cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
   71.23 --       ++cnt)
   71.24 --    bootstrap_map.l_info[cnt] = 0;
   71.25 -+  /* Clear the whole bootstrap_map structure */
   71.26 -+  for (char *cnt = (char *)&(bootstrap_map);
   71.27 -+       cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
   71.28 -+       *cnt++ = '\0');
   71.29 - # endif
   71.30 - # if USE___THREAD
   71.31 -   bootstrap_map.l_tls_modid = 0;
   71.32 -diff -durN glibc-2_9.orig/include/atomic.h glibc-2_9/include/atomic.h
   71.33 ---- glibc-2_9.orig/include/atomic.h	2006-12-21 22:44:00.000000000 +0100
   71.34 -+++ glibc-2_9/include/atomic.h	2009-02-02 22:01:12.000000000 +0100
   71.35 -@@ -174,7 +174,7 @@
   71.36 -      __typeof (*(mem)) __atg5_value = (newvalue);			      \
   71.37 - 									      \
   71.38 -      do									      \
   71.39 --       __atg5_oldval = *__atg5_memp;					      \
   71.40 -+       __atg5_oldval = *(volatile __typeof (mem))__atg5_memp;		      \
   71.41 -      while (__builtin_expect						      \
   71.42 - 	    (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
   71.43 - 						   __atg5_oldval), 0));	      \
   71.44 -@@ -195,7 +195,7 @@
   71.45 -      __typeof (*(mem)) __atg6_value = (value);				      \
   71.46 - 									      \
   71.47 -      do									      \
   71.48 --       __atg6_oldval = *__atg6_memp;					      \
   71.49 -+       __atg6_oldval = *(volatile __typeof (mem))__atg6_memp;		      \
   71.50 -      while (__builtin_expect						      \
   71.51 - 	    (atomic_compare_and_exchange_bool_acq (__atg6_memp,		      \
   71.52 - 						   __atg6_oldval	      \
   71.53 -@@ -213,7 +213,7 @@
   71.54 -      __typeof (*(mem)) __atg7_value = (value);				      \
   71.55 - 									      \
   71.56 -      do									      \
   71.57 --       __atg7_oldv = *__atg7_memp;					      \
   71.58 -+       __atg7_oldv = *(volatile __typeof (mem))__atg7_memp;		      \
   71.59 -      while (__builtin_expect						      \
   71.60 - 	    (catomic_compare_and_exchange_bool_acq (__atg7_memp,	      \
   71.61 - 						    __atg7_oldv		      \
   71.62 -@@ -231,7 +231,7 @@
   71.63 -     __typeof (mem) __atg8_memp = (mem);					      \
   71.64 -     __typeof (*(mem)) __atg8_value = (value);				      \
   71.65 -     do {								      \
   71.66 --      __atg8_oldval = *__atg8_memp;					      \
   71.67 -+      __atg8_oldval = *(volatile __typeof (mem))__atg8_memp;		      \
   71.68 -       if (__atg8_oldval >= __atg8_value)				      \
   71.69 - 	break;								      \
   71.70 -     } while (__builtin_expect						      \
   71.71 -@@ -248,7 +248,7 @@
   71.72 -     __typeof (mem) __atg9_memp = (mem);					      \
   71.73 -     __typeof (*(mem)) __atg9_value = (value);				      \
   71.74 -     do {								      \
   71.75 --      __atg9_oldv = *__atg9_memp;					      \
   71.76 -+      __atg9_oldv = *(volatile __typeof (mem))__atg9_memp;		      \
   71.77 -       if (__atg9_oldv >= __atg9_value)					      \
   71.78 - 	break;								      \
   71.79 -     } while (__builtin_expect						      \
   71.80 -@@ -266,7 +266,7 @@
   71.81 -     __typeof (mem) __atg10_memp = (mem);				      \
   71.82 -     __typeof (*(mem)) __atg10_value = (value);				      \
   71.83 -     do {								      \
   71.84 --      __atg10_oldval = *__atg10_memp;					      \
   71.85 -+      __atg10_oldval = *(volatile __typeof (mem))__atg10_memp;		      \
   71.86 -       if (__atg10_oldval <= __atg10_value)				      \
   71.87 - 	break;								      \
   71.88 -     } while (__builtin_expect						      \
   71.89 -@@ -350,7 +350,7 @@
   71.90 - 									      \
   71.91 -      do									      \
   71.92 -        {								      \
   71.93 --	 __atg11_oldval = *__atg11_memp;				      \
   71.94 -+	 __atg11_oldval = *(volatile __typeof (mem))__atg11_memp;	      \
   71.95 - 	 if (__builtin_expect (__atg11_oldval <= 0, 0))			      \
   71.96 - 	   break;							      \
   71.97 -        }								      \
   71.98 -@@ -389,7 +389,7 @@
   71.99 -      __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit));	      \
  71.100 - 									      \
  71.101 -      do									      \
  71.102 --       __atg14_old = (*__atg14_memp);					      \
  71.103 -+       __atg14_old = (*(volatile __typeof (mem))__atg14_memp);		      \
  71.104 -      while (__builtin_expect						      \
  71.105 - 	    (atomic_compare_and_exchange_bool_acq (__atg14_memp,	      \
  71.106 - 						   __atg14_old | __atg14_mask,\
  71.107 -@@ -407,7 +407,7 @@
  71.108 -     __typeof (*(mem)) __atg15_mask = (mask);				      \
  71.109 - 									      \
  71.110 -     do									      \
  71.111 --      __atg15_old = (*__atg15_memp);					      \
  71.112 -+      __atg15_old = (*(volatile __typeof (mem))__atg15_memp);		      \
  71.113 -     while (__builtin_expect						      \
  71.114 - 	   (atomic_compare_and_exchange_bool_acq (__atg15_memp,		      \
  71.115 - 						  __atg15_old & __atg15_mask, \
  71.116 -@@ -423,7 +423,7 @@
  71.117 -      __typeof (*(mem)) __atg16_mask = (mask);				      \
  71.118 - 									      \
  71.119 -      do									      \
  71.120 --       __atg16_old = (*__atg16_memp);					      \
  71.121 -+       __atg16_old = (*(volatile __typeof (mem))__atg16_memp);		      \
  71.122 -      while (__builtin_expect						      \
  71.123 - 	    (atomic_compare_and_exchange_bool_acq (__atg16_memp,	      \
  71.124 - 						   __atg16_old & __atg16_mask,\
  71.125 -@@ -441,7 +441,7 @@
  71.126 -     __typeof (*(mem)) __atg17_mask = (mask);				      \
  71.127 - 									      \
  71.128 -     do									      \
  71.129 --      __atg17_old = (*__atg17_memp);					      \
  71.130 -+      __atg17_old = (*(volatile __typeof (mem))__atg17_memp);		      \
  71.131 -     while (__builtin_expect						      \
  71.132 - 	   (atomic_compare_and_exchange_bool_acq (__atg17_memp,		      \
  71.133 - 						  __atg17_old | __atg17_mask, \
  71.134 -@@ -457,7 +457,7 @@
  71.135 -     __typeof (*(mem)) __atg18_mask = (mask);				      \
  71.136 - 									      \
  71.137 -     do									      \
  71.138 --      __atg18_old = (*__atg18_memp);					      \
  71.139 -+      __atg18_old = (*(volatile __typeof (mem))__atg18_memp);		      \
  71.140 -     while (__builtin_expect						      \
  71.141 - 	   (catomic_compare_and_exchange_bool_acq (__atg18_memp,	      \
  71.142 - 						   __atg18_old | __atg18_mask,\
  71.143 -@@ -473,7 +473,7 @@
  71.144 -      __typeof (*(mem)) __atg19_mask = (mask);				      \
  71.145 - 									      \
  71.146 -      do									      \
  71.147 --       __atg19_old = (*__atg19_memp);					      \
  71.148 -+       __atg19_old = (*(volatile __typeof (mem))__atg19_memp);		      \
  71.149 -      while (__builtin_expect						      \
  71.150 - 	    (atomic_compare_and_exchange_bool_acq (__atg19_memp,	      \
  71.151 - 						   __atg19_old | __atg19_mask,\
  71.152 -diff -durN glibc-2_9.orig/nptl/Makefile glibc-2_9/nptl/Makefile
  71.153 ---- glibc-2_9.orig/nptl/Makefile	2008-11-12 14:38:23.000000000 +0100
  71.154 -+++ glibc-2_9/nptl/Makefile	2009-02-02 22:01:12.000000000 +0100
  71.155 -@@ -262,9 +262,9 @@
  71.156 - # Files which must not be linked with libpthread.
  71.157 - tests-nolibpthread = tst-unload
  71.158 - 
  71.159 --# This sets the stack resource limit to 1023kb, which is not a multiple
  71.160 --# of the page size since every architecture's page size is > 1k.
  71.161 --tst-oddstacklimit-ENV = ; ulimit -s 1023;
  71.162 -+# This sets the stack resource limit to 8193kb, which is not a multiple
  71.163 -+# of the page size since every architecture's page size is 4096 bytes.
  71.164 -+tst-oddstacklimit-ENV = ; ulimit -s 8193;
  71.165 - 
  71.166 - distribute = eintr.c tst-cleanup4aux.c
  71.167 - 
  71.168 -@@ -423,6 +423,35 @@
  71.169 - CFLAGS-tst-cleanupx4.c += -fexceptions
  71.170 - CFLAGS-tst-oncex3.c += -fexceptions
  71.171 - CFLAGS-tst-oncex4.c += -fexceptions
  71.172 -+
  71.173 -+ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
  71.174 -+LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
  71.175 -+LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
  71.176 -+LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
  71.177 -+LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
  71.178 -+LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
  71.179 -+LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
  71.180 -+LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
  71.181 -+LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
  71.182 -+LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
  71.183 -+LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
  71.184 -+LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
  71.185 -+LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
  71.186 -+LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
  71.187 -+LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
  71.188 -+LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
  71.189 -+LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
  71.190 -+LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
  71.191 -+LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
  71.192 -+LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
  71.193 -+LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
  71.194 -+LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
  71.195 -+LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
  71.196 -+LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
  71.197 -+LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
  71.198 -+LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
  71.199 -+LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
  71.200 -+
  71.201 - CFLAGS-tst-align.c += $(stack-align-test-flags)
  71.202 - CFLAGS-tst-align3.c += $(stack-align-test-flags)
  71.203 - CFLAGS-tst-initializers1.c = -W -Wall -Werror
  71.204 -diff -durN glibc-2_9.orig/nptl/pthread_barrier_wait.c glibc-2_9/nptl/pthread_barrier_wait.c
  71.205 ---- glibc-2_9.orig/nptl/pthread_barrier_wait.c	2007-08-01 06:18:50.000000000 +0200
  71.206 -+++ glibc-2_9/nptl/pthread_barrier_wait.c	2009-02-02 22:01:12.000000000 +0100
  71.207 -@@ -64,7 +64,7 @@
  71.208 -       do
  71.209 - 	lll_futex_wait (&ibarrier->curr_event, event,
  71.210 - 			ibarrier->private ^ FUTEX_PRIVATE_FLAG);
  71.211 --      while (event == ibarrier->curr_event);
  71.212 -+      while (event == *(volatile unsigned int *)&ibarrier->curr_event);
  71.213 -     }
  71.214 - 
  71.215 -   /* Make sure the init_count is stored locally or in a register.  */
  71.216 -diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/Makefile glibc-2_9/nptl/sysdeps/pthread/Makefile
  71.217 ---- glibc-2_9.orig/nptl/sysdeps/pthread/Makefile	2006-02-28 08:09:41.000000000 +0100
  71.218 -+++ glibc-2_9/nptl/sysdeps/pthread/Makefile	2009-02-02 22:01:12.000000000 +0100
  71.219 -@@ -41,7 +41,9 @@
  71.220 - 
  71.221 - ifeq ($(have-forced-unwind),yes)
  71.222 - tests += tst-mqueue8x
  71.223 -+ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
  71.224 - CFLAGS-tst-mqueue8x.c += -fexceptions
  71.225 -+LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s) 
  71.226 - endif
  71.227 - endif
  71.228 - 
  71.229 -diff -durN glibc-2_9.orig/stdio-common/Makefile glibc-2_9/stdio-common/Makefile
  71.230 ---- glibc-2_9.orig/stdio-common/Makefile	2008-07-08 18:32:28.000000000 +0200
  71.231 -+++ glibc-2_9/stdio-common/Makefile	2009-02-02 22:01:12.000000000 +0100
  71.232 -@@ -80,7 +80,7 @@
  71.233 - 	$(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
  71.234 - endif
  71.235 - 
  71.236 --CFLAGS-vfprintf.c = -Wno-uninitialized
  71.237 -+CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
  71.238 - CFLAGS-vfwprintf.c = -Wno-uninitialized
  71.239 - CFLAGS-tst-printf.c = -Wno-format
  71.240 - CFLAGS-tstdiomisc.c = -Wno-format
  71.241 -diff -durN glibc-2_9.orig/sunrpc/clnt_udp.c glibc-2_9/sunrpc/clnt_udp.c
  71.242 ---- glibc-2_9.orig/sunrpc/clnt_udp.c	2008-07-26 10:42:44.000000000 +0200
  71.243 -+++ glibc-2_9/sunrpc/clnt_udp.c	2009-02-02 22:01:12.000000000 +0100
  71.244 -@@ -462,7 +462,7 @@
  71.245 -       while (inlen < 0 && errno == EINTR);
  71.246 -       if (inlen < 0)
  71.247 - 	{
  71.248 --	  if (errno == EWOULDBLOCK)
  71.249 -+	  if (errno == EWOULDBLOCK || errno == EAGAIN)
  71.250 - 	    continue;
  71.251 - 	  cu->cu_error.re_errno = errno;
  71.252 - 	  return (cu->cu_error.re_status = RPC_CANTRECV);
    72.1 --- a/patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch	Fri Mar 27 23:40:07 2009 +0000
    72.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.3 @@ -1,71 +0,0 @@
    72.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/3000_all_2.3.6-dl_execstack-PaX-support.patch
    72.5 -
    72.6 --= BEGIN original header =-
    72.7 -	With latest versions of glibc, a lot of apps failed on a PaX enabled
    72.8 -	system with:
    72.9 -		 cannot enable executable stack as shared object requires: Permission denied
   72.10 -	
   72.11 -	This is due to PaX 'exec-protecting' the stack, and ld.so then trying
   72.12 -	to make the stack executable due to some libraries not containing the
   72.13 -	PT_GNU_STACK section.  Bug #32960.  <azarah@gentoo.org> (12 Nov 2003).
   72.14 -
   72.15 -	Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
   72.16 -
   72.17 --= END original header =-
   72.18 -
   72.19 -diff -durN glibc-2_9.orig/nptl/allocatestack.c glibc-2_9/nptl/allocatestack.c
   72.20 ---- glibc-2_9.orig/nptl/allocatestack.c	2008-08-16 00:35:27.000000000 +0200
   72.21 -+++ glibc-2_9/nptl/allocatestack.c	2009-02-02 22:01:20.000000000 +0100
   72.22 -@@ -299,7 +299,8 @@
   72.23 - # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
   72.24 - #endif
   72.25 -   if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
   72.26 --    return errno;
   72.27 -+    if (errno != EACCES) /* PAX is enabled */
   72.28 -+    	return errno;
   72.29 - 
   72.30 -   return 0;
   72.31 - }
   72.32 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2_9/sysdeps/unix/sysv/linux/dl-execstack.c
   72.33 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/dl-execstack.c	2006-01-08 09:21:15.000000000 +0100
   72.34 -+++ glibc-2_9/sysdeps/unix/sysv/linux/dl-execstack.c	2009-02-02 22:01:20.000000000 +0100
   72.35 -@@ -63,7 +63,10 @@
   72.36 -       else
   72.37 - # endif
   72.38 - 	{
   72.39 --	  result = errno;
   72.40 -+	  if (errno == EACCES)  /* PAX is enabled */
   72.41 -+	    result = 0;
   72.42 -+	  else
   72.43 -+	    result = errno;
   72.44 - 	  goto out;
   72.45 - 	}
   72.46 -     }
   72.47 -@@ -89,7 +92,12 @@
   72.48 - 	page -= size;
   72.49 -       else
   72.50 - 	{
   72.51 --	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
   72.52 -+	  if (errno == EACCES)		/* PAX is enabled */
   72.53 -+	    {
   72.54 -+	      result = 0;
   72.55 -+	      goto out;
   72.56 -+	    }
   72.57 -+	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
   72.58 - 	    {
   72.59 - 	      result = errno;
   72.60 - 	      goto out;
   72.61 -@@ -115,7 +123,12 @@
   72.62 - 	page += size;
   72.63 -       else
   72.64 - 	{
   72.65 --	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
   72.66 -+	  if (errno == EACCES)		/* PAX is enabled */
   72.67 -+	    {
   72.68 -+	      result = 0;
   72.69 -+	      goto out;
   72.70 -+	    }
   72.71 -+	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
   72.72 - 	    {
   72.73 - 	      result = errno;
   72.74 - 	      goto out;
    73.1 --- a/patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch	Fri Mar 27 23:40:07 2009 +0000
    73.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.3 @@ -1,35 +0,0 @@
    73.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/3010_all_2.3.3_pre20040117-pt_pax.patch
    73.5 -
    73.6 --= BEGIN original header =-
    73.7 --= END original header =-
    73.8 -
    73.9 -diff -durN glibc-2_9.orig/elf/elf.h glibc-2_9/elf/elf.h
   73.10 ---- glibc-2_9.orig/elf/elf.h	2008-10-01 21:41:34.000000000 +0200
   73.11 -+++ glibc-2_9/elf/elf.h	2009-02-02 22:01:21.000000000 +0100
   73.12 -@@ -571,6 +571,7 @@
   73.13 - #define PT_GNU_EH_FRAME	0x6474e550	/* GCC .eh_frame_hdr segment */
   73.14 - #define PT_GNU_STACK	0x6474e551	/* Indicates stack executability */
   73.15 - #define PT_GNU_RELRO	0x6474e552	/* Read-only after relocation */
   73.16 -+#define PT_PAX_FLAGS	0x65041580	/* Indicates PaX flag markings */
   73.17 - #define PT_LOSUNW	0x6ffffffa
   73.18 - #define PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
   73.19 - #define PT_SUNWSTACK	0x6ffffffb	/* Stack segment */
   73.20 -@@ -584,6 +585,18 @@
   73.21 - #define PF_X		(1 << 0)	/* Segment is executable */
   73.22 - #define PF_W		(1 << 1)	/* Segment is writable */
   73.23 - #define PF_R		(1 << 2)	/* Segment is readable */
   73.24 -+#define PF_PAGEEXEC	(1 << 4)	/* Enable  PAGEEXEC */
   73.25 -+#define PF_NOPAGEEXEC	(1 << 5)	/* Disable PAGEEXEC */
   73.26 -+#define PF_SEGMEXEC	(1 << 6)	/* Enable  SEGMEXEC */
   73.27 -+#define PF_NOSEGMEXEC	(1 << 7)	/* Disable SEGMEXEC */
   73.28 -+#define PF_MPROTECT	(1 << 8)	/* Enable  MPROTECT */
   73.29 -+#define PF_NOMPROTECT	(1 << 9)	/* Disable MPROTECT */
   73.30 -+#define PF_RANDEXEC	(1 << 10)	/* Enable  RANDEXEC */
   73.31 -+#define PF_NORANDEXEC	(1 << 11)	/* Disable RANDEXEC */
   73.32 -+#define PF_EMUTRAMP	(1 << 12)	/* Enable  EMUTRAMP */
   73.33 -+#define PF_NOEMUTRAMP	(1 << 13)	/* Disable EMUTRAMP */
   73.34 -+#define PF_RANDMMAP	(1 << 14)	/* Enable  RANDMMAP */
   73.35 -+#define PF_NORANDMMAP	(1 << 15)	/* Disable RANDMMAP */
   73.36 - #define PF_MASKOS	0x0ff00000	/* OS-specific */
   73.37 - #define PF_MASKPROC	0xf0000000	/* Processor-specific */
   73.38 - 
    74.1 --- a/patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch	Fri Mar 27 23:40:07 2009 +0000
    74.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.3 @@ -1,198 +0,0 @@
    74.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/3020_all_glibc-tests-sandbox-libdl-paths.patch
    74.5 -
    74.6 --= BEGIN original header =-
    74.7 -when glibc runs its tests, it does so by invoking the local library loader.
    74.8 -in Gentoo, we build/run inside of our "sandbox" which itself is linked against
    74.9 -libdl (so that it can load libraries and pull out symbols).  the trouble
   74.10 -is that when you upgrade from an older glibc to the new one, often times
   74.11 -internal symbols change name or abi.  this is normally OK as you cannot use
   74.12 -libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
   74.13 -we always say "keep all of the glibc libraries from the same build".  but
   74.14 -when glibc runs its tests, it uses dynamic paths to point to its new local
   74.15 -copies of libraries.  if the test doesnt use libdl, then glibc doesnt add
   74.16 -its path, and when sandbox triggers the loading of libdl, glibc does so
   74.17 -from the host system system.  this gets us into the case of all libraries
   74.18 -are from the locally compiled version of glibc except for libdl.so.
   74.19 -
   74.20 -Fix by Wormo
   74.21 -
   74.22 -http://bugs.gentoo.org/56898
   74.23 -
   74.24 --= END original header =-
   74.25 -
   74.26 -diff -durN glibc-2_9.orig/grp/tst_fgetgrent.sh glibc-2_9/grp/tst_fgetgrent.sh
   74.27 ---- glibc-2_9.orig/grp/tst_fgetgrent.sh	2001-07-06 06:54:46.000000000 +0200
   74.28 -+++ glibc-2_9/grp/tst_fgetgrent.sh	2009-02-02 22:01:23.000000000 +0100
   74.29 -@@ -24,7 +24,8 @@
   74.30 - rtld_installed_name=$1; shift
   74.31 - 
   74.32 - testout=${common_objpfx}/grp/tst_fgetgrent.out
   74.33 --library_path=${common_objpfx}
   74.34 -+# make sure libdl is also in path in case sandbox is in use
   74.35 -+library_path=${common_objpfx}:${common_objpfx}/dlfcn
   74.36 - 
   74.37 - result=0
   74.38 - 
   74.39 -diff -durN glibc-2_9.orig/iconvdata/run-iconv-test.sh glibc-2_9/iconvdata/run-iconv-test.sh
   74.40 ---- glibc-2_9.orig/iconvdata/run-iconv-test.sh	2008-05-15 03:59:44.000000000 +0200
   74.41 -+++ glibc-2_9/iconvdata/run-iconv-test.sh	2009-02-02 22:01:23.000000000 +0100
   74.42 -@@ -34,7 +34,7 @@
   74.43 - export GCONV_PATH
   74.44 - 
   74.45 - # We have to have some directories in the library path.
   74.46 --LIBPATH=$codir:$codir/iconvdata
   74.47 -+LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
   74.48 - 
   74.49 - # How the start the iconv(1) program.
   74.50 - ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
   74.51 -diff -durN glibc-2_9.orig/iconvdata/tst-table.sh glibc-2_9/iconvdata/tst-table.sh
   74.52 ---- glibc-2_9.orig/iconvdata/tst-table.sh	2002-04-24 23:39:35.000000000 +0200
   74.53 -+++ glibc-2_9/iconvdata/tst-table.sh	2009-02-02 22:01:23.000000000 +0100
   74.54 -@@ -59,8 +59,11 @@
   74.55 -   irreversible=${charset}.irreversible
   74.56 - fi
   74.57 - 
   74.58 -+# make sure libdl is also in path in case sandbox is in use
   74.59 -+library_path=${common_objpfx}:${common_objpfx}/dlfcn
   74.60 -+
   74.61 - # iconv in one direction.
   74.62 --${common_objpfx}elf/ld.so --library-path $common_objpfx \
   74.63 -+${common_objpfx}elf/ld.so --library-path $library_path \
   74.64 - ${objpfx}tst-table-from ${charset} \
   74.65 -   > ${objpfx}tst-${charset}.table
   74.66 - 
   74.67 -diff -durN glibc-2_9.orig/intl/tst-codeset.sh glibc-2_9/intl/tst-codeset.sh
   74.68 ---- glibc-2_9.orig/intl/tst-codeset.sh	2005-04-06 04:18:35.000000000 +0200
   74.69 -+++ glibc-2_9/intl/tst-codeset.sh	2009-02-02 22:01:23.000000000 +0100
   74.70 -@@ -37,6 +37,9 @@
   74.71 - LOCPATH=${common_objpfx}localedata
   74.72 - export LOCPATH
   74.73 - 
   74.74 -+# make sure libdl is also in path in case sandbox is in use
   74.75 -+library_path=${common_objpfx}:${common_objpfx}/dlfcn
   74.76 -+
   74.77 - ${common_objpfx}elf/ld.so --library-path $common_objpfx \
   74.78 - ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
   74.79 - 
   74.80 -diff -durN glibc-2_9.orig/intl/tst-gettext.sh glibc-2_9/intl/tst-gettext.sh
   74.81 ---- glibc-2_9.orig/intl/tst-gettext.sh	2004-08-15 21:28:18.000000000 +0200
   74.82 -+++ glibc-2_9/intl/tst-gettext.sh	2009-02-02 22:01:23.000000000 +0100
   74.83 -@@ -51,9 +51,12 @@
   74.84 - LOCPATH=${common_objpfx}localedata
   74.85 - export LOCPATH
   74.86 - 
   74.87 -+# make sure libdl is also in path in case sandbox is in use
   74.88 -+library_path=${common_objpfx}:${common_objpfx}/dlfcn
   74.89 -+
   74.90 - # Now run the test.
   74.91 - MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
   74.92 --${common_objpfx}elf/ld.so --library-path $common_objpfx \
   74.93 -+${common_objpfx}elf/ld.so --library-path $library_path \
   74.94 - ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
   74.95 - 
   74.96 - exit $?
   74.97 -diff -durN glibc-2_9.orig/intl/tst-gettext2.sh glibc-2_9/intl/tst-gettext2.sh
   74.98 ---- glibc-2_9.orig/intl/tst-gettext2.sh	2005-05-04 19:54:48.000000000 +0200
   74.99 -+++ glibc-2_9/intl/tst-gettext2.sh	2009-02-02 22:01:23.000000000 +0100
  74.100 -@@ -65,8 +65,11 @@
  74.101 - LOCPATH=${objpfx}domaindir
  74.102 - export LOCPATH
  74.103 - 
  74.104 -+# make sure libdl is also in path in case sandbox is in use
  74.105 -+library_path=${common_objpfx}:${common_objpfx}/dlfcn
  74.106 -+
  74.107 - # Now run the test.
  74.108 --${common_objpfx}elf/ld.so --library-path $common_objpfx \
  74.109 -+${common_objpfx}elf/ld.so --library-path $library_path \
  74.110 - ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
  74.111 - cmp ${objpfx}tst-gettext2.out - <<EOF
  74.112 - String1 - Lang1: 1st string
  74.113 -diff -durN glibc-2_9.orig/intl/tst-translit.sh glibc-2_9/intl/tst-translit.sh
  74.114 ---- glibc-2_9.orig/intl/tst-translit.sh	2005-05-04 19:56:10.000000000 +0200
  74.115 -+++ glibc-2_9/intl/tst-translit.sh	2009-02-02 22:01:23.000000000 +0100
  74.116 -@@ -36,7 +36,10 @@
  74.117 - LOCPATH=${common_objpfx}localedata
  74.118 - export LOCPATH
  74.119 - 
  74.120 --${common_objpfx}elf/ld.so --library-path $common_objpfx \
  74.121 -+# make sure libdl is also in path in case sandbox is in use
  74.122 -+library_path=${common_objpfx}:${common_objpfx}/dlfcn
  74.123 -+
  74.124 -+${common_objpfx}elf/ld.so --library-path $library_path \
  74.125 - ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
  74.126 - 
  74.127 - exit $?
  74.128 -diff -durN glibc-2_9.orig/malloc/tst-mtrace.sh glibc-2_9/malloc/tst-mtrace.sh
  74.129 ---- glibc-2_9.orig/malloc/tst-mtrace.sh	2005-10-15 01:40:35.000000000 +0200
  74.130 -+++ glibc-2_9/malloc/tst-mtrace.sh	2009-02-02 22:01:23.000000000 +0100
  74.131 -@@ -24,9 +24,12 @@
  74.132 - status=0
  74.133 - trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
  74.134 - 
  74.135 -+# make sure libdl is also in path in case sandbox is in use
  74.136 -+library_path=${common_objpfx}:${common_objpfx}/dlfcn
  74.137 -+
  74.138 - MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
  74.139 - LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
  74.140 --${common_objpfx}elf/ld.so --library-path $common_objpfx \
  74.141 -+${common_objpfx}elf/ld.so --library-path $library_path \
  74.142 -   ${common_objpfx}malloc/tst-mtrace || status=1
  74.143 - 
  74.144 - if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
  74.145 -diff -durN glibc-2_9.orig/nptl/tst-tls6.sh glibc-2_9/nptl/tst-tls6.sh
  74.146 ---- glibc-2_9.orig/nptl/tst-tls6.sh	2003-09-03 00:02:59.000000000 +0200
  74.147 -+++ glibc-2_9/nptl/tst-tls6.sh	2009-02-02 22:01:23.000000000 +0100
  74.148 -@@ -5,8 +5,8 @@
  74.149 - rtld_installed_name=$1; shift
  74.150 - logfile=$common_objpfx/nptl/tst-tls6.out
  74.151 - 
  74.152 --# We have to find libc and nptl
  74.153 --library_path=${common_objpfx}:${common_objpfx}nptl
  74.154 -+# We have to find libc and nptl (also libdl in case sandbox is in use)
  74.155 -+library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
  74.156 - tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
  74.157 - 	  ${common_objpfx}/nptl/tst-tls5"
  74.158 - 
  74.159 -diff -durN glibc-2_9.orig/posix/globtest.sh glibc-2_9/posix/globtest.sh
  74.160 ---- glibc-2_9.orig/posix/globtest.sh	2007-02-14 20:52:33.000000000 +0100
  74.161 -+++ glibc-2_9/posix/globtest.sh	2009-02-02 22:01:23.000000000 +0100
  74.162 -@@ -18,7 +18,7 @@
  74.163 - esac
  74.164 - 
  74.165 - # We have to find the libc and the NSS modules.
  74.166 --library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
  74.167 -+library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
  74.168 - 
  74.169 - # Since we use `sort' we must make sure to use the same locale everywhere.
  74.170 - LC_ALL=C
  74.171 -diff -durN glibc-2_9.orig/posix/tst-getconf.sh glibc-2_9/posix/tst-getconf.sh
  74.172 ---- glibc-2_9.orig/posix/tst-getconf.sh	2002-09-01 13:11:25.000000000 +0200
  74.173 -+++ glibc-2_9/posix/tst-getconf.sh	2009-02-02 22:01:23.000000000 +0100
  74.174 -@@ -10,7 +10,10 @@
  74.175 - else
  74.176 -   rtld_installed_name=$1; shift
  74.177 -   runit() {
  74.178 --    ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
  74.179 -+    
  74.180 -+  # make sure libdl is also in path in case sandbox is in use
  74.181 -+  library_path=${common_objpfx}:${common_objpfx}/dlfcn
  74.182 -+    ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
  74.183 -   }
  74.184 - fi
  74.185 - 
  74.186 -diff -durN glibc-2_9.orig/posix/wordexp-tst.sh glibc-2_9/posix/wordexp-tst.sh
  74.187 ---- glibc-2_9.orig/posix/wordexp-tst.sh	2000-10-20 18:23:30.000000000 +0200
  74.188 -+++ glibc-2_9/posix/wordexp-tst.sh	2009-02-02 22:01:23.000000000 +0100
  74.189 -@@ -19,8 +19,11 @@
  74.190 - "
  74.191 - export IFS
  74.192 - 
  74.193 -+# make sure libdl is also in path in case sandbox is in use
  74.194 -+library_path=${common_objpfx}:${common_objpfx}/dlfcn
  74.195 -+
  74.196 - failed=0
  74.197 --${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
  74.198 -+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
  74.199 - ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
  74.200 - cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
  74.201 - wordexp returned 0
    75.1 --- a/patches/glibc/2_9/410-2.9-fnmatch.patch	Fri Mar 27 23:40:07 2009 +0000
    75.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.3 @@ -1,64 +0,0 @@
    75.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/5021_all_2.9-fnmatch.patch
    75.5 -
    75.6 --= BEGIN original header =-
    75.7 -http://sourceware.org/ml/libc-hacker/2002-11/msg00071.html
    75.8 -
    75.9 -When fnmatch detects an invalid multibyte character it should fall back to
   75.10 -single byte matching, so that "*" has a chance to match such a string.
   75.11 -
   75.12 -Andreas.
   75.13 -
   75.14 -2005-04-12  Andreas Schwab  <schwab@suse.de>
   75.15 -
   75.16 -	* posix/fnmatch.c (fnmatch): If conversion to wide character
   75.17 -	fails fall back to single byte matching.
   75.18 -
   75.19 --= END original header =-
   75.20 -
   75.21 -diff -durN glibc-2_9.orig/posix/fnmatch.c glibc-2_9/posix/fnmatch.c
   75.22 ---- glibc-2_9.orig/posix/fnmatch.c	2007-07-28 22:35:00.000000000 +0200
   75.23 -+++ glibc-2_9/posix/fnmatch.c	2009-02-02 22:01:25.000000000 +0100
   75.24 -@@ -327,6 +327,7 @@
   75.25 - # if HANDLE_MULTIBYTE
   75.26 -   if (__builtin_expect (MB_CUR_MAX, 1) != 1)
   75.27 -     {
   75.28 -+      const char *orig_pattern = pattern;
   75.29 -       mbstate_t ps;
   75.30 -       size_t n;
   75.31 -       const char *p;
   75.32 -@@ -382,10 +383,8 @@
   75.33 - 	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
   75.34 - 	  n = mbsrtowcs (wstring, &p, n + 1, &ps);
   75.35 - 	  if (__builtin_expect (n == (size_t) -1, 0))
   75.36 --	    /* Something wrong.
   75.37 --	       XXX Do we have to set `errno' to something which mbsrtows hasn't
   75.38 --	       already done?  */
   75.39 --	    return -1;
   75.40 -+	    /* Something wrong.  Fall back to single byte matching.  */
   75.41 -+	    goto try_singlebyte;
   75.42 - 	  if (p)
   75.43 - 	    {
   75.44 - 	      memset (&ps, '\0', sizeof (ps));
   75.45 -@@ -397,10 +396,8 @@
   75.46 - 	prepare_wstring:
   75.47 - 	  n = mbsrtowcs (NULL, &string, 0, &ps);
   75.48 - 	  if (__builtin_expect (n == (size_t) -1, 0))
   75.49 --	    /* Something wrong.
   75.50 --	       XXX Do we have to set `errno' to something which mbsrtows hasn't
   75.51 --	       already done?  */
   75.52 --	    return -1;
   75.53 -+	    /* Something wrong.  Fall back to single byte matching.  */
   75.54 -+	    goto try_singlebyte;
   75.55 - 	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
   75.56 - 	  assert (mbsinit (&ps));
   75.57 - 	  (void) mbsrtowcs (wstring, &string, n + 1, &ps);
   75.58 -@@ -408,6 +405,9 @@
   75.59 - 
   75.60 -       return internal_fnwmatch (wpattern, wstring, wstring + n,
   75.61 - 				flags & FNM_PERIOD, flags, NULL);
   75.62 -+
   75.63 -+    try_singlebyte:
   75.64 -+      pattern = orig_pattern;
   75.65 -     }
   75.66 - # endif  /* mbstate_t and mbsrtowcs or _LIBC.  */
   75.67 - 
    76.1 --- a/patches/glibc/2_9/420-dont-build-timezone.patch	Fri Mar 27 23:40:07 2009 +0000
    76.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.3 @@ -1,19 +0,0 @@
    76.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/5063_all_glibc-dont-build-timezone.patch
    76.5 -
    76.6 --= BEGIN original header =-
    76.7 -timezone data has been split into the package sys-libs/timezone-data
    76.8 -
    76.9 --= END original header =-
   76.10 -
   76.11 -diff -durN glibc-2_9.orig/Makeconfig glibc-2_9/Makeconfig
   76.12 ---- glibc-2_9.orig/Makeconfig	2009-02-02 22:01:05.000000000 +0100
   76.13 -+++ glibc-2_9/Makeconfig	2009-02-02 22:01:27.000000000 +0100
   76.14 -@@ -919,7 +919,7 @@
   76.15 - 	      stdlib stdio-common libio malloc string wcsmbs time dirent    \
   76.16 - 	      grp pwd posix io termios resource misc socket sysvipc gmon    \
   76.17 - 	      gnulib iconv iconvdata wctype manual shadow po argp	    \
   76.18 --	      crypt nss localedata timezone rt conform debug		    \
   76.19 -+	      crypt nss localedata rt conform debug		    \
   76.20 - 	      $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
   76.21 - 
   76.22 - ifndef avoid-generated
    77.1 --- a/patches/glibc/2_9/430-2.7-cross-compile-nptl.patch	Fri Mar 27 23:40:07 2009 +0000
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,57 +0,0 @@
    77.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/5070_all_glibc-2.7-cross-compile-nptl.patch
    77.5 -
    77.6 --= BEGIN original header =-
    77.7 -A little hack for cross-compiling NPTL
    77.8 -
    77.9 -http://sourceware.org/ml/libc-alpha/2005-02/msg00043.html
   77.10 -
   77.11 --= END original header =-
   77.12 -
   77.13 -diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/configure glibc-2_9/nptl/sysdeps/pthread/configure
   77.14 ---- glibc-2_9.orig/nptl/sysdeps/pthread/configure	2007-10-17 00:24:30.000000000 +0200
   77.15 -+++ glibc-2_9/nptl/sysdeps/pthread/configure	2009-02-02 22:01:28.000000000 +0100
   77.16 -@@ -78,6 +78,10 @@
   77.17 - fi
   77.18 - { echo "$as_me:$LINENO: result: $libc_cv_forced_unwind" >&5
   77.19 - echo "${ECHO_T}$libc_cv_forced_unwind" >&6; }
   77.20 -+if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
   77.21 -+  echo "$as_me:$LINENO: forcing libc_cv_forced_unwind = yes for cross-compile"
   77.22 -+  libc_cv_forced_unwind=yes
   77.23 -+fi
   77.24 - if test $libc_cv_forced_unwind = yes; then
   77.25 -   cat >>confdefs.h <<\_ACEOF
   77.26 - #define HAVE_FORCED_UNWIND 1
   77.27 -@@ -141,6 +145,10 @@
   77.28 - { echo "$as_me:$LINENO: result: $libc_cv_c_cleanup" >&5
   77.29 - echo "${ECHO_T}$libc_cv_c_cleanup" >&6; }
   77.30 -   CFLAGS="$old_CFLAGS"
   77.31 -+  if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
   77.32 -+    echo "$as_me:$LINENO: result: forcing libc_cv_c_cleanup = yes for cross-compile"
   77.33 -+    libc_cv_c_cleanup=yes
   77.34 -+  fi
   77.35 -   if test $libc_cv_c_cleanup = no; then
   77.36 -     { { echo "$as_me:$LINENO: error: the compiler must support C cleanup handling" >&5
   77.37 - echo "$as_me: error: the compiler must support C cleanup handling" >&2;}
   77.38 -diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/configure.in glibc-2_9/nptl/sysdeps/pthread/configure.in
   77.39 ---- glibc-2_9.orig/nptl/sysdeps/pthread/configure.in	2003-12-03 07:50:01.000000000 +0100
   77.40 -+++ glibc-2_9/nptl/sysdeps/pthread/configure.in	2009-02-02 22:01:28.000000000 +0100
   77.41 -@@ -28,6 +28,9 @@
   77.42 - struct _Unwind_Context *context;
   77.43 - _Unwind_GetCFA (context)],
   77.44 - libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)])
   77.45 -+if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
   77.46 -+  libc_cv_forced_unwind=yes
   77.47 -+fi
   77.48 - if test $libc_cv_forced_unwind = yes; then
   77.49 -   AC_DEFINE(HAVE_FORCED_UNWIND)
   77.50 - dnl Check for C cleanup handling.
   77.51 -@@ -41,6 +44,9 @@
   77.52 -   puts ("test")],
   77.53 - libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)])
   77.54 -   CFLAGS="$old_CFLAGS"
   77.55 -+  if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
   77.56 -+    libc_cv_c_cleanup=yes
   77.57 -+  fi
   77.58 -   if test $libc_cv_c_cleanup = no; then
   77.59 -     AC_MSG_ERROR([the compiler must support C cleanup handling])
   77.60 -   fi
    78.1 --- a/patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch	Fri Mar 27 23:40:07 2009 +0000
    78.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.3 @@ -1,249 +0,0 @@
    78.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/6001_all_alpha-glibc-2.4-xstat.patch
    78.5 -
    78.6 --= BEGIN original header =-
    78.7 -http://sources.redhat.com/bugzilla/show_bug.cgi?id=1026
    78.8 -http://sourceware.org/ml/libc-alpha/2005-02/msg00122.html
    78.9 -
   78.10 -2005-02-26  GOTO Masanori  <gotom@debian.or.jp>
   78.11 -
   78.12 -	* sysdeps/unix/sysv/linux/kernel-features.h: Define
   78.13 -	__ASSUME_STAT64_SYSCALL.
   78.14 -	* sysdeps/unix/sysv/linux/alpha/fxstat.c: Check
   78.15 -	__ASSUME_STAT64_SYSCALL.
   78.16 -	* sysdeps/unix/sysv/linux/alpha/fxstatat.c: Likewise.
   78.17 -	* sysdeps/unix/sysv/linux/alpha/lxstat.c: Likewise.
   78.18 -	* sysdeps/unix/sysv/linux/alpha/xstat.c: Likewise.
   78.19 -	* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Don't define
   78.20 -	__libc_missing_axp_stat64 when it's not needed.
   78.21 -	* sysdeps/unix/sysv/linux/alpha/xstatconv.h: Likewise.
   78.22 -
   78.23 --= END original header =-
   78.24 -
   78.25 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstat.c
   78.26 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstat.c	2004-03-11 03:58:44.000000000 +0100
   78.27 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstat.c	2009-02-02 22:01:30.000000000 +0100
   78.28 -@@ -35,27 +35,39 @@
   78.29 - __fxstat (int vers, int fd, struct stat *buf)
   78.30 - {
   78.31 -   INTERNAL_SYSCALL_DECL (err);
   78.32 --  int result, errno_out;
   78.33 -+  int result;
   78.34 -   struct kernel_stat kbuf;
   78.35 - 
   78.36 -+#if __ASSUME_STAT64_SYSCALL > 0
   78.37 -+  if (vers == _STAT_VER_KERNEL64)
   78.38 -+    {
   78.39 -+      result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
   78.40 -+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   78.41 -+	return result;
   78.42 -+      __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
   78.43 -+      return -1;
   78.44 -+    }
   78.45 -+#elif defined __NR_fstat64
   78.46 -   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
   78.47 -     {
   78.48 -+      int errno_out;
   78.49 -       result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
   78.50 -       if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   78.51 - 	return result;
   78.52 -       errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
   78.53 -       if (errno_out != ENOSYS)
   78.54 --	goto fail;
   78.55 -+	{
   78.56 -+	  __set_errno (errno_out);
   78.57 -+	  return -1;
   78.58 -+	}
   78.59 -       __libc_missing_axp_stat64 = 1;
   78.60 -     }
   78.61 -+#endif
   78.62 - 
   78.63 -   result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf);
   78.64 -   if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   78.65 -     return __xstat_conv (vers, &kbuf, buf);
   78.66 --  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
   78.67 --  
   78.68 -- fail:
   78.69 --  __set_errno (errno_out);
   78.70 -+  __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
   78.71 -   return -1;
   78.72 - }
   78.73 - hidden_def (__fxstat)
   78.74 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstatat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstatat.c
   78.75 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstatat.c	2006-02-20 23:51:48.000000000 +0100
   78.76 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstatat.c	2009-02-02 22:01:30.000000000 +0100
   78.77 -@@ -65,6 +65,20 @@
   78.78 -   int result, errno_out;
   78.79 -   struct kernel_stat kst;
   78.80 - 
   78.81 -+#if __ASSUME_STAT64_SYSCALL > 0
   78.82 -+  if (vers == _STAT_VER_KERNEL64)
   78.83 -+    {
   78.84 -+      if (flag & AT_SYMLINK_NOFOLLOW)
   78.85 -+	result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
   78.86 -+      else
   78.87 -+	result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
   78.88 -+
   78.89 -+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
   78.90 -+	return result;
   78.91 -+      errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
   78.92 -+      goto fail;
   78.93 -+    }
   78.94 -+#elif defined __NR_stat64
   78.95 -   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
   78.96 -     {
   78.97 -       if (flag & AT_SYMLINK_NOFOLLOW)
   78.98 -@@ -79,6 +93,7 @@
   78.99 - 	goto fail;
  78.100 -       __libc_missing_axp_stat64 = 1;
  78.101 -     }
  78.102 -+#endif
  78.103 - 
  78.104 -   if (flag & AT_SYMLINK_NOFOLLOW)
  78.105 -     result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst);
  78.106 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/lxstat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/lxstat.c
  78.107 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/lxstat.c	2004-03-11 03:58:44.000000000 +0100
  78.108 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/lxstat.c	2009-02-02 22:01:30.000000000 +0100
  78.109 -@@ -35,27 +35,39 @@
  78.110 - __lxstat (int vers, const char *name, struct stat *buf)
  78.111 - {
  78.112 -   INTERNAL_SYSCALL_DECL (err);
  78.113 --  int result, errno_out;
  78.114 -+  int result;
  78.115 -   struct kernel_stat kbuf;
  78.116 - 
  78.117 -+#if __ASSUME_STAT64_SYSCALL > 0
  78.118 -+  if (vers == _STAT_VER_KERNEL64)
  78.119 -+    {
  78.120 -+      result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
  78.121 -+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  78.122 -+	return result;
  78.123 -+      __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  78.124 -+      return -1;
  78.125 -+    }
  78.126 -+#elif defined __NR_lstat64
  78.127 -   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
  78.128 -     {
  78.129 -+      int errno_out;
  78.130 -       result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
  78.131 -       if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  78.132 - 	return result;
  78.133 -       errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  78.134 -       if (errno_out != ENOSYS)
  78.135 --	goto fail;
  78.136 -+	{
  78.137 -+	  __set_errno (errno_out);
  78.138 -+	  return -1;
  78.139 -+	}
  78.140 -       __libc_missing_axp_stat64 = 1;
  78.141 -     }
  78.142 -+#endif
  78.143 - 
  78.144 -   result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf);
  78.145 -   if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  78.146 -     return __xstat_conv (vers, &kbuf, buf);
  78.147 --  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  78.148 --  
  78.149 -- fail:
  78.150 --  __set_errno (errno_out);
  78.151 -+  __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  78.152 -   return -1;
  78.153 - }
  78.154 - hidden_def (__lxstat)
  78.155 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstat.c
  78.156 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstat.c	2004-03-11 03:58:44.000000000 +0100
  78.157 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstat.c	2009-02-02 22:01:30.000000000 +0100
  78.158 -@@ -35,27 +35,39 @@
  78.159 - __xstat (int vers, const char *name, struct stat *buf)
  78.160 - {
  78.161 -   INTERNAL_SYSCALL_DECL (err);
  78.162 --  int result, errno_out;
  78.163 -+  int result;
  78.164 -   struct kernel_stat kbuf;
  78.165 - 
  78.166 -+#if __ASSUME_STAT64_SYSCALL > 0
  78.167 -+  if (vers == _STAT_VER_KERNEL64)
  78.168 -+    {
  78.169 -+      result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
  78.170 -+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  78.171 -+	return result;
  78.172 -+      __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  78.173 -+      return -1;
  78.174 -+    }
  78.175 -+#elif defined __NR_stat64
  78.176 -   if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
  78.177 -     {
  78.178 -+      int errno_out;
  78.179 -       result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
  78.180 -       if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  78.181 - 	return result;
  78.182 -       errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  78.183 -       if (errno_out != ENOSYS)
  78.184 --	goto fail;
  78.185 -+	{
  78.186 -+	  __set_errno (errno_out);
  78.187 -+	  return -1;
  78.188 -+	}
  78.189 -       __libc_missing_axp_stat64 = 1;
  78.190 -     }
  78.191 -+#endif
  78.192 - 
  78.193 -   result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf);
  78.194 -   if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
  78.195 -     return __xstat_conv (vers, &kbuf, buf);
  78.196 --  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
  78.197 --  
  78.198 -- fail:
  78.199 --  __set_errno (errno_out);
  78.200 -+  __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
  78.201 -   return -1;
  78.202 - }
  78.203 - hidden_def (__xstat)
  78.204 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.c
  78.205 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.c	2004-03-11 03:58:44.000000000 +0100
  78.206 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.c	2009-02-02 22:01:30.000000000 +0100
  78.207 -@@ -22,9 +22,14 @@
  78.208 - #include <sys/stat.h>
  78.209 - #include <kernel_stat.h>
  78.210 - #include <xstatconv.h>
  78.211 -+#include <sys/syscall.h>
  78.212 - 
  78.213 - 
  78.214 -+#ifdef __NR_stat64
  78.215 -+# if __ASSUME_STAT64_SYSCALL == 0
  78.216 - int __libc_missing_axp_stat64;
  78.217 -+# endif
  78.218 -+#endif
  78.219 - 
  78.220 - int
  78.221 - __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
  78.222 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.h
  78.223 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.h	2006-01-08 09:21:16.000000000 +0100
  78.224 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.h	2009-02-02 22:01:30.000000000 +0100
  78.225 -@@ -18,7 +18,12 @@
  78.226 -    02111-1307 USA.  */
  78.227 - 
  78.228 - #include <kernel-features.h>
  78.229 -+#include <sys/syscall.h>
  78.230 - 
  78.231 -+#ifdef __NR_stat64
  78.232 -+# if __ASSUME_STAT64_SYSCALL == 0
  78.233 - extern int __libc_missing_axp_stat64 attribute_hidden;
  78.234 -+# endif
  78.235 -+#endif
  78.236 - extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
  78.237 -   attribute_hidden;
  78.238 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2_9/sysdeps/unix/sysv/linux/kernel-features.h
  78.239 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/kernel-features.h	2008-08-01 23:51:04.000000000 +0200
  78.240 -+++ glibc-2_9/sysdeps/unix/sysv/linux/kernel-features.h	2009-02-02 22:01:30.000000000 +0100
  78.241 -@@ -395,6 +395,11 @@
  78.242 - # define __ASSUME_GETDENTS32_D_TYPE	1
  78.243 - #endif
  78.244 - 
  78.245 -+/* Starting with version 2.6.4, alpha stat64 syscalls are available.  */
  78.246 -+#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
  78.247 -+# define __ASSUME_STAT64_SYSCALL	1
  78.248 -+#endif
  78.249 -+
  78.250 - /* Starting with version 2.5.3, the initial location returned by `brk'
  78.251 -    after exec is always rounded up to the next page.  */
  78.252 - #if __LINUX_KERNEL_VERSION >= 132355
    79.1 --- a/patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch	Fri Mar 27 23:40:07 2009 +0000
    79.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.3 @@ -1,32 +0,0 @@
    79.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/6015_all_alpha-glibc-2.5-no-page-header.patch
    79.5 -
    79.6 --= BEGIN original header =-
    79.7 -2008-06-07  Mike Frysinger  <vapier@gentoo.org>
    79.8 -
    79.9 -	* sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions
   79.10 -	from the kernel header to sys/user.h and remove the #include of
   79.11 -	sys/user.h.
   79.12 -
   79.13 --= END original header =-
   79.14 -
   79.15 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/user.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/user.h
   79.16 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/user.h	2001-07-06 06:56:13.000000000 +0200
   79.17 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/user.h	2009-02-02 22:01:32.000000000 +0100
   79.18 -@@ -23,7 +23,6 @@
   79.19 -    only. Don't read too much into it. Don't use it for anything other
   79.20 -    than gdb/strace unless you know what you are doing. */
   79.21 - 
   79.22 --#include <asm/page.h>
   79.23 - #include <asm/reg.h>
   79.24 - 
   79.25 - struct user
   79.26 -@@ -41,6 +40,9 @@
   79.27 -   char u_comm[32];				/* user command name */
   79.28 - };
   79.29 - 
   79.30 -+#define PAGE_SHIFT		13
   79.31 -+#define PAGE_SIZE		(1 << PAGE_SHIFT)
   79.32 -+#define PAGE_MASK		(~(PAGE_SIZE-1))
   79.33 - #define NBPG			PAGE_SIZE
   79.34 - #define UPAGES			1
   79.35 - #define HOST_TEXT_START_ADDR	(u.start_code)
    80.1 --- a/patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch	Fri Mar 27 23:40:07 2009 +0000
    80.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.3 @@ -1,38 +0,0 @@
    80.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/6016_all_alpha-glibc-2.5-no-asm-elf-header.patch
    80.5 -
    80.6 --= BEGIN original header =-
    80.7 -2007-03-13  Mike Frysinger  <vapier@gentoo.org>
    80.8 -
    80.9 -	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some defines
   80.10 -	from alpha's asm/elf.h
   80.11 -
   80.12 --= END original header =-
   80.13 -
   80.14 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/procfs.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
   80.15 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/procfs.h	2001-07-06 06:56:13.000000000 +0200
   80.16 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/procfs.h	2009-02-02 22:01:33.000000000 +0100
   80.17 -@@ -29,10 +29,23 @@
   80.18 - #include <sys/types.h>
   80.19 - #include <sys/ucontext.h>
   80.20 - #include <sys/user.h>
   80.21 --#include <asm/elf.h>
   80.22 - 
   80.23 - __BEGIN_DECLS
   80.24 - 
   80.25 -+/*
   80.26 -+ * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
   80.27 -+ * I have no idea why that is so.  For now, we just leave it at 33
   80.28 -+ * (32 general regs + processor status word). 
   80.29 -+ */
   80.30 -+#define ELF_NGREG	33
   80.31 -+#define ELF_NFPREG	32
   80.32 -+
   80.33 -+typedef unsigned long elf_greg_t;
   80.34 -+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
   80.35 -+
   80.36 -+typedef double elf_fpreg_t;
   80.37 -+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
   80.38 -+
   80.39 - struct elf_siginfo
   80.40 -   {
   80.41 -     int si_signo;			/* Signal number.  */
    81.1 --- a/patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch	Fri Mar 27 23:40:07 2009 +0000
    81.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.3 @@ -1,19 +0,0 @@
    81.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/6017_all_alpha-glibc-2.8-creat.patch
    81.5 -
    81.6 --= BEGIN original header =-
    81.7 -alpha does not have a __NR_creat
    81.8 -
    81.9 -http://bugs.gentoo.org/227275
   81.10 -http://sourceware.org/bugzilla/show_bug.cgi?id=6650
   81.11 -
   81.12 --= END original header =-
   81.13 -
   81.14 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2_9/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
   81.15 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2007-11-10 20:34:26.000000000 +0100
   81.16 -+++ glibc-2_9/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2009-02-02 22:01:35.000000000 +0100
   81.17 -@@ -1 +1,5 @@
   81.18 - /* Defined as alias for the syscall.  */
   81.19 -+#include <sysdep.h>
   81.20 -+#ifndef __NR_creat
   81.21 -+#include "../../../../../io/creat64.c"
   81.22 -+#endif
    82.1 --- a/patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch	Fri Mar 27 23:40:07 2009 +0000
    82.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.3 @@ -1,18 +0,0 @@
    82.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/6018_all_alpha-glibc-2.8-cache-shape.patch
    82.5 -
    82.6 --= BEGIN original header =-
    82.7 -older verisons of glibc would build dl-sysdep as shared-only and dl-support as
    82.8 -static-only.  alpha hooks in a cache variable via dl-auxv.h.  newer versions of
    82.9 -glibc build dl-sysdep as both shared and static which means we now have symbol
   82.10 -duplication for static builds with dl-sysdep and dl-support.  since dl-sysdep
   82.11 -is both shared/static, there is no point in hooking dl-support anymore, so we
   82.12 -can punt it.
   82.13 -
   82.14 --= END original header =-
   82.15 -
   82.16 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/dl-support.c
   82.17 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/dl-support.c	2007-03-13 22:25:16.000000000 +0100
   82.18 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/dl-support.c	2009-02-02 22:01:37.000000000 +0100
   82.19 -@@ -1,2 +0,0 @@
   82.20 --#include "dl-auxv.h"
   82.21 --#include <elf/dl-support.c>
    83.1 --- a/patches/glibc/2_9/490-ptr-mangling.patch	Fri Mar 27 23:40:07 2009 +0000
    83.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.3 @@ -1,114 +0,0 @@
    83.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/6018_all_glibc-ptr-mangling.patch
    83.5 -
    83.6 --= BEGIN original header =-
    83.7 -http://bugs.gentoo.org/201910
    83.8 -
    83.9 -For every arch, PTR_MANGLE and PTR_DEMANGLE defines are in
   83.10 -sysdeps/unix/sysv/linux/<arch>/sysdep.h. But for alpha this is not true. The
   83.11 -defines are in sysdeps/unix/alpha/sysdep.h and unix/sysv/linux/alpha/sysdep.h
   83.12 -includes the first.
   83.13 -
   83.14 -This is a patch that fixes the issue and let alpha build, at the expense of
   83.15 -disabling MANGLING in the non PIC case, but googling showed that the issue is
   83.16 -known, and that nobody really cares about it. 
   83.17 -
   83.18 -Info from: http://sourceware.org/bugzilla/show_bug.cgi?id=5216
   83.19 -
   83.20 --= END original header =-
   83.21 -
   83.22 -diff -durN glibc-2_9.orig/sysdeps/unix/alpha/sysdep.h glibc-2_9/sysdeps/unix/alpha/sysdep.h
   83.23 ---- glibc-2_9.orig/sysdeps/unix/alpha/sysdep.h	2006-03-03 12:21:28.000000000 +0100
   83.24 -+++ glibc-2_9/sysdeps/unix/alpha/sysdep.h	2009-02-02 22:01:39.000000000 +0100
   83.25 -@@ -397,42 +397,4 @@
   83.26 - 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
   83.27 - }
   83.28 - 
   83.29 --/* Pointer mangling support.  Note that tls access is slow enough that
   83.30 --   we don't deoptimize things by placing the pointer check value there.  */
   83.31 --
   83.32 --#include <stdint.h>
   83.33 --
   83.34 --#if defined NOT_IN_libc && defined IS_IN_rtld
   83.35 --# ifdef __ASSEMBLER__
   83.36 --#  define PTR_MANGLE(dst, src, tmp)				\
   83.37 --	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
   83.38 --	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
   83.39 --	xor	src, tmp, dst
   83.40 --#  define PTR_MANGLE2(dst, src, tmp)				\
   83.41 --	xor	src, tmp, dst
   83.42 --#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   83.43 --#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   83.44 --# else
   83.45 --extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
   83.46 --#  define PTR_MANGLE(var)	\
   83.47 --  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
   83.48 --#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
   83.49 --# endif
   83.50 --#elif defined PIC
   83.51 --# ifdef __ASSEMBLER__
   83.52 --#  define PTR_MANGLE(dst, src, tmp)		\
   83.53 --	ldq	tmp, __pointer_chk_guard;	\
   83.54 --	xor	src, tmp, dst
   83.55 --#  define PTR_MANGLE2(dst, src, tmp)		\
   83.56 --	xor	src, tmp, dst
   83.57 --#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   83.58 --#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   83.59 --# else
   83.60 --extern uintptr_t __pointer_chk_guard attribute_relro;
   83.61 --#  define PTR_MANGLE(var)	\
   83.62 --	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
   83.63 --#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
   83.64 --# endif
   83.65 --#endif
   83.66 --
   83.67 - #endif /* ASSEMBLER */
   83.68 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/sysdep.h
   83.69 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h	2007-08-21 10:07:28.000000000 +0200
   83.70 -+++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sysdep.h	2009-02-02 22:01:39.000000000 +0100
   83.71 -@@ -98,4 +98,46 @@
   83.72 - 	INTERNAL_SYSCALL1(name, err_out, nr, args);			\
   83.73 - })
   83.74 - 
   83.75 -+/* Pointer mangling support.  Note that tls access is slow enough that
   83.76 -+   we don't deoptimize things by placing the pointer check value there.  */
   83.77 -+
   83.78 -+#if defined NOT_IN_libc && defined IS_IN_rtld
   83.79 -+# ifdef __ASSEMBLER__
   83.80 -+#  define PTR_MANGLE(dst, src, tmp)                            \
   83.81 -+       ldah    tmp, __pointer_chk_guard_local($29) !gprelhigh; \
   83.82 -+       ldq     tmp, __pointer_chk_guard_local(tmp) !gprellow;  \
   83.83 -+       xor     src, tmp, dst
   83.84 -+#  define PTR_MANGLE2(dst, src, tmp)                           \
   83.85 -+       xor     src, tmp, dst
   83.86 -+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
   83.87 -+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
   83.88 -+# else
   83.89 -+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
   83.90 -+#  define PTR_MANGLE(var)      \
   83.91 -+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
   83.92 -+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
   83.93 -+# endif
   83.94 -+#elif defined PIC
   83.95 -+# ifdef __ASSEMBLER__
   83.96 -+#  define PTR_MANGLE(dst, src, tmp)            \
   83.97 -+       ldq     tmp, __pointer_chk_guard;       \
   83.98 -+       xor     src, tmp, dst
   83.99 -+#  define PTR_MANGLE2(dst, src, tmp)           \
  83.100 -+       xor     src, tmp, dst
  83.101 -+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
  83.102 -+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
  83.103 -+# else
  83.104 -+extern uintptr_t __pointer_chk_guard attribute_relro;
  83.105 -+#  define PTR_MANGLE(var)      \
  83.106 -+       (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
  83.107 -+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
  83.108 -+# endif
  83.109 -+#else
  83.110 -+/* Pointer mangling is not yet supported for static libc on alpha.  */
  83.111 -+# ifndef __ASSEMBLER__
  83.112 -+#  define PTR_MANGLE(var)   (void) (var)
  83.113 -+#  define PTR_DEMANGLE(var) (void) (var)
  83.114 -+# endif
  83.115 -+#endif
  83.116 -+
  83.117 - #endif /* _LINUX_ALPHA_SYSDEP_H */
    84.1 --- a/patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch	Fri Mar 27 23:40:07 2009 +0000
    84.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.3 @@ -1,414 +0,0 @@
    84.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/6120_all_ppc-glibc-2.9-atomic.patch
    84.5 -
    84.6 --= BEGIN original header =-
    84.7 -sniped from suse
    84.8 -
    84.9 --= END original header =-
   84.10 -
   84.11 -diff -durN glibc-2_9.orig/sysdeps/powerpc/bits/atomic.h glibc-2_9/sysdeps/powerpc/bits/atomic.h
   84.12 ---- glibc-2_9.orig/sysdeps/powerpc/bits/atomic.h	2007-03-26 22:15:28.000000000 +0200
   84.13 -+++ glibc-2_9/sysdeps/powerpc/bits/atomic.h	2009-02-02 22:01:40.000000000 +0100
   84.14 -@@ -85,14 +85,14 @@
   84.15 -       __typeof (*(mem)) __tmp;						      \
   84.16 -       __typeof (mem)  __memp = (mem);					      \
   84.17 -       __asm __volatile (						      \
   84.18 --		        "1:	lwarx	%0,0,%1" MUTEX_HINT_ACQ "\n"	      \
   84.19 -+		        "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
   84.20 - 		        "	cmpw	%0,%2\n"			      \
   84.21 - 		        "	bne	2f\n"				      \
   84.22 --		        "	stwcx.	%3,0,%1\n"			      \
   84.23 -+		        "	stwcx.	%3,%y1\n"			      \
   84.24 - 		        "	bne-	1b\n"				      \
   84.25 - 		        "2:	" __ARCH_ACQ_INSTR			      \
   84.26 --		        : "=&r" (__tmp)					      \
   84.27 --		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
   84.28 -+		        : "=&r" (__tmp), "+Z" (*__memp)			      \
   84.29 -+		        : "r" (oldval), "r" (newval)			      \
   84.30 - 		        : "cr0", "memory");				      \
   84.31 -       __tmp;								      \
   84.32 -   })
   84.33 -@@ -102,14 +102,14 @@
   84.34 -       __typeof (*(mem)) __tmp;						      \
   84.35 -       __typeof (mem)  __memp = (mem);					      \
   84.36 -       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
   84.37 --		        "1:	lwarx	%0,0,%1" MUTEX_HINT_REL "\n"	      \
   84.38 -+		        "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
   84.39 - 		        "	cmpw	%0,%2\n"			      \
   84.40 - 		        "	bne	2f\n"				      \
   84.41 --		        "	stwcx.	%3,0,%1\n"			      \
   84.42 -+		        "	stwcx.	%3,%y1\n"			      \
   84.43 - 		        "	bne-	1b\n"				      \
   84.44 - 		        "2:	"					      \
   84.45 --		        : "=&r" (__tmp)					      \
   84.46 --		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
   84.47 -+		        : "=&r" (__tmp), "+Z" (__memp)			      \
   84.48 -+		        : "r" (oldval), "r" (newval)			      \
   84.49 - 		        : "cr0", "memory");				      \
   84.50 -       __tmp;								      \
   84.51 -   })
   84.52 -@@ -118,12 +118,12 @@
   84.53 -   ({									      \
   84.54 -     __typeof (*mem) __val;						      \
   84.55 -     __asm __volatile (							      \
   84.56 --		      "1:	lwarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	      \
   84.57 --		      "		stwcx.	%3,0,%2\n"			      \
   84.58 -+		      "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
   84.59 -+		      "		stwcx.	%2,%y1\n"			      \
   84.60 - 		      "		bne-	1b\n"				      \
   84.61 - 		      "   " __ARCH_ACQ_INSTR				      \
   84.62 --		      : "=&r" (__val), "=m" (*mem)			      \
   84.63 --		      : "b" (mem), "r" (value), "m" (*mem)		      \
   84.64 -+		      : "=&r" (__val), "+Z" (*mem)			      \
   84.65 -+		      : "r" (value)					      \
   84.66 - 		      : "cr0", "memory");				      \
   84.67 -     __val;								      \
   84.68 -   })
   84.69 -@@ -132,11 +132,11 @@
   84.70 -   ({									      \
   84.71 -     __typeof (*mem) __val;						      \
   84.72 -     __asm __volatile (__ARCH_REL_INSTR "\n"				      \
   84.73 --		      "1:	lwarx	%0,0,%2" MUTEX_HINT_REL "\n"	      \
   84.74 --		      "		stwcx.	%3,0,%2\n"			      \
   84.75 -+		      "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
   84.76 -+		      "		stwcx.	%2,%y1\n"			      \
   84.77 - 		      "		bne-	1b"				      \
   84.78 --		      : "=&r" (__val), "=m" (*mem)			      \
   84.79 --		      : "b" (mem), "r" (value), "m" (*mem)		      \
   84.80 -+		      : "=&r" (__val), "+Z" (*mem)			      \
   84.81 -+		      : "r" (value)					      \
   84.82 - 		      : "cr0", "memory");				      \
   84.83 -     __val;								      \
   84.84 -   })
   84.85 -@@ -144,12 +144,12 @@
   84.86 - #define __arch_atomic_exchange_and_add_32(mem, value) \
   84.87 -   ({									      \
   84.88 -     __typeof (*mem) __val, __tmp;					      \
   84.89 --    __asm __volatile ("1:	lwarx	%0,0,%3\n"			      \
   84.90 --		      "		add	%1,%0,%4\n"			      \
   84.91 --		      "		stwcx.	%1,0,%3\n"			      \
   84.92 -+    __asm __volatile ("1:	lwarx	%0,%y2\n"			      \
   84.93 -+		      "		add	%1,%0,%3\n"			      \
   84.94 -+		      "		stwcx.	%1,%y2\n"			      \
   84.95 - 		      "		bne-	1b"				      \
   84.96 --		      : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
   84.97 --		      : "b" (mem), "r" (value), "m" (*mem)		      \
   84.98 -+		      : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem)	      \
   84.99 -+		      : "r" (value)					      \
  84.100 - 		      : "cr0", "memory");				      \
  84.101 -     __val;								      \
  84.102 -   })
  84.103 -@@ -157,12 +157,12 @@
  84.104 - #define __arch_atomic_increment_val_32(mem) \
  84.105 -   ({									      \
  84.106 -     __typeof (*(mem)) __val;						      \
  84.107 --    __asm __volatile ("1:	lwarx	%0,0,%2\n"			      \
  84.108 -+    __asm __volatile ("1:	lwarx	%0,%y1\n"			      \
  84.109 - 		      "		addi	%0,%0,1\n"			      \
  84.110 --		      "		stwcx.	%0,0,%2\n"			      \
  84.111 -+		      "		stwcx.	%0,%y1\n"			      \
  84.112 - 		      "		bne-	1b"				      \
  84.113 --		      : "=&b" (__val), "=m" (*mem)			      \
  84.114 --		      : "b" (mem), "m" (*mem)				      \
  84.115 -+		      : "=&b" (__val), "+Z" (*mem)			      \
  84.116 -+		      :							      \
  84.117 - 		      : "cr0", "memory");				      \
  84.118 -     __val;								      \
  84.119 -   })
  84.120 -@@ -170,27 +170,27 @@
  84.121 - #define __arch_atomic_decrement_val_32(mem) \
  84.122 -   ({									      \
  84.123 -     __typeof (*(mem)) __val;						      \
  84.124 --    __asm __volatile ("1:	lwarx	%0,0,%2\n"			      \
  84.125 -+    __asm __volatile ("1:	lwarx	%0,%y1\n"			      \
  84.126 - 		      "		subi	%0,%0,1\n"			      \
  84.127 --		      "		stwcx.	%0,0,%2\n"			      \
  84.128 -+		      "		stwcx.	%0,%y1\n"			      \
  84.129 - 		      "		bne-	1b"				      \
  84.130 --		      : "=&b" (__val), "=m" (*mem)			      \
  84.131 --		      : "b" (mem), "m" (*mem)				      \
  84.132 -+		      : "=&b" (__val), "+Z" (*mem)			      \
  84.133 -+		      :							      \
  84.134 - 		      : "cr0", "memory");				      \
  84.135 -     __val;								      \
  84.136 -   })
  84.137 - 
  84.138 - #define __arch_atomic_decrement_if_positive_32(mem) \
  84.139 -   ({ int __val, __tmp;							      \
  84.140 --     __asm __volatile ("1:	lwarx	%0,0,%3\n"			      \
  84.141 -+     __asm __volatile ("1:	lwarx	%0,%y2\n"			      \
  84.142 - 		       "	cmpwi	0,%0,0\n"			      \
  84.143 - 		       "	addi	%1,%0,-1\n"			      \
  84.144 - 		       "	ble	2f\n"				      \
  84.145 --		       "	stwcx.	%1,0,%3\n"			      \
  84.146 -+		       "	stwcx.	%1,%y2\n"			      \
  84.147 - 		       "	bne-	1b\n"				      \
  84.148 - 		       "2:	" __ARCH_ACQ_INSTR			      \
  84.149 --		       : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  84.150 --		       : "b" (mem), "m" (*mem)				      \
  84.151 -+		       : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem)	      \
  84.152 -+		       :						      \
  84.153 - 		       : "cr0", "memory");				      \
  84.154 -      __val;								      \
  84.155 -   })
  84.156 -diff -durN glibc-2_9.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2_9/sysdeps/powerpc/powerpc32/bits/atomic.h
  84.157 ---- glibc-2_9.orig/sysdeps/powerpc/powerpc32/bits/atomic.h	2007-03-26 22:15:45.000000000 +0200
  84.158 -+++ glibc-2_9/sysdeps/powerpc/powerpc32/bits/atomic.h	2009-02-02 22:01:40.000000000 +0100
  84.159 -@@ -44,14 +44,14 @@
  84.160 - ({									      \
  84.161 -   unsigned int __tmp;							      \
  84.162 -   __asm __volatile (							      \
  84.163 --		    "1:	lwarx	%0,0,%1" MUTEX_HINT_ACQ "\n"		      \
  84.164 -+		    "1:	lwarx	%0,%y1" MUTEX_HINT_ACQ "\n"		      \
  84.165 - 		    "	subf.	%0,%2,%0\n"				      \
  84.166 - 		    "	bne	2f\n"					      \
  84.167 --		    "	stwcx.	%3,0,%1\n"				      \
  84.168 -+		    "	stwcx.	%3,%y1\n"				      \
  84.169 - 		    "	bne-	1b\n"					      \
  84.170 - 		    "2:	" __ARCH_ACQ_INSTR				      \
  84.171 --		    : "=&r" (__tmp)					      \
  84.172 --		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  84.173 -+		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  84.174 -+		    : "r" (oldval), "r" (newval)			      \
  84.175 - 		    : "cr0", "memory");					      \
  84.176 -   __tmp != 0;								      \
  84.177 - })
  84.178 -@@ -60,14 +60,14 @@
  84.179 - ({									      \
  84.180 -   unsigned int __tmp;							      \
  84.181 -   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  84.182 --		    "1:	lwarx	%0,0,%1" MUTEX_HINT_REL "\n"		      \
  84.183 -+		    "1:	lwarx	%0,%y1" MUTEX_HINT_REL "\n"		      \
  84.184 - 		    "	subf.	%0,%2,%0\n"				      \
  84.185 - 		    "	bne	2f\n"					      \
  84.186 --		    "	stwcx.	%3,0,%1\n"				      \
  84.187 -+		    "	stwcx.	%3,%y1\n"				      \
  84.188 - 		    "	bne-	1b\n"					      \
  84.189 - 		    "2:	"						      \
  84.190 --		    : "=&r" (__tmp)					      \
  84.191 --		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  84.192 -+		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  84.193 -+		    : "r" (oldval), "r" (newval)			      \
  84.194 - 		    : "cr0", "memory");					      \
  84.195 -   __tmp != 0;								      \
  84.196 - })
  84.197 -diff -durN glibc-2_9.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2_9/sysdeps/powerpc/powerpc64/bits/atomic.h
  84.198 ---- glibc-2_9.orig/sysdeps/powerpc/powerpc64/bits/atomic.h	2007-03-26 22:16:03.000000000 +0200
  84.199 -+++ glibc-2_9/sysdeps/powerpc/powerpc64/bits/atomic.h	2009-02-02 22:01:40.000000000 +0100
  84.200 -@@ -44,14 +44,14 @@
  84.201 - ({									      \
  84.202 -   unsigned int __tmp, __tmp2;						      \
  84.203 -   __asm __volatile ("   clrldi  %1,%1,32\n"				      \
  84.204 --		    "1:	lwarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	 	      \
  84.205 -+		    "1:	lwarx	%0,%y2" MUTEX_HINT_ACQ "\n"	 	      \
  84.206 - 		    "	subf.	%0,%1,%0\n"				      \
  84.207 - 		    "	bne	2f\n"					      \
  84.208 --		    "	stwcx.	%4,0,%2\n"				      \
  84.209 -+		    "	stwcx.	%4,%y2\n"				      \
  84.210 - 		    "	bne-	1b\n"					      \
  84.211 - 		    "2:	" __ARCH_ACQ_INSTR				      \
  84.212 --		    : "=&r" (__tmp), "=r" (__tmp2)			      \
  84.213 --		    : "b" (mem), "1" (oldval), "r" (newval)		      \
  84.214 -+		    : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem))	      \
  84.215 -+		    : "1" (oldval), "r" (newval)			      \
  84.216 - 		    : "cr0", "memory");					      \
  84.217 -   __tmp != 0;								      \
  84.218 - })
  84.219 -@@ -61,14 +61,14 @@
  84.220 -   unsigned int __tmp, __tmp2;						      \
  84.221 -   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  84.222 - 		    "   clrldi  %1,%1,32\n"				      \
  84.223 --		    "1:	lwarx	%0,0,%2" MUTEX_HINT_REL "\n"		      \
  84.224 -+		    "1:	lwarx	%0,%y2" MUTEX_HINT_REL "\n"		      \
  84.225 - 		    "	subf.	%0,%1,%0\n"				      \
  84.226 - 		    "	bne	2f\n"					      \
  84.227 --		    "	stwcx.	%4,0,%2\n"				      \
  84.228 -+		    "	stwcx.	%4,%y2\n"				      \
  84.229 - 		    "	bne-	1b\n"					      \
  84.230 - 		    "2:	"						      \
  84.231 --		    : "=&r" (__tmp), "=r" (__tmp2)			      \
  84.232 --		    : "b" (mem), "1" (oldval), "r" (newval)		      \
  84.233 -+		    : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem))	      \
  84.234 -+		    : "1" (oldval), "r" (newval)			      \
  84.235 - 		    : "cr0", "memory");					      \
  84.236 -   __tmp != 0;								      \
  84.237 - })
  84.238 -@@ -82,14 +82,14 @@
  84.239 - ({									      \
  84.240 -   unsigned long	__tmp;							      \
  84.241 -   __asm __volatile (							      \
  84.242 --		    "1:	ldarx	%0,0,%1" MUTEX_HINT_ACQ "\n"		      \
  84.243 -+		    "1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"		      \
  84.244 - 		    "	subf.	%0,%2,%0\n"				      \
  84.245 - 		    "	bne	2f\n"					      \
  84.246 --		    "	stdcx.	%3,0,%1\n"				      \
  84.247 -+		    "	stdcx.	%3,%y1\n"				      \
  84.248 - 		    "	bne-	1b\n"					      \
  84.249 - 		    "2:	" __ARCH_ACQ_INSTR				      \
  84.250 --		    : "=&r" (__tmp)					      \
  84.251 --		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  84.252 -+		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  84.253 -+		    : "r" (oldval), "r" (newval)			      \
  84.254 - 		    : "cr0", "memory");					      \
  84.255 -   __tmp != 0;								      \
  84.256 - })
  84.257 -@@ -98,14 +98,14 @@
  84.258 - ({									      \
  84.259 -   unsigned long	__tmp;							      \
  84.260 -   __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  84.261 --		    "1:	ldarx	%0,0,%2" MUTEX_HINT_REL "\n"		      \
  84.262 -+		    "1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"		      \
  84.263 - 		    "	subf.	%0,%2,%0\n"				      \
  84.264 - 		    "	bne	2f\n"					      \
  84.265 --		    "	stdcx.	%3,0,%1\n"				      \
  84.266 -+		    "	stdcx.	%3,%y1\n"				      \
  84.267 - 		    "	bne-	1b\n"					      \
  84.268 - 		    "2:	"						      \
  84.269 --		    : "=&r" (__tmp)					      \
  84.270 --		    : "b" (mem), "r" (oldval), "r" (newval)		      \
  84.271 -+		    : "=&r" (__tmp), "+Z" (*(mem))			      \
  84.272 -+		    : "r" (oldval), "r" (newval)			      \
  84.273 - 		    : "cr0", "memory");					      \
  84.274 -   __tmp != 0;								      \
  84.275 - })
  84.276 -@@ -115,14 +115,14 @@
  84.277 -       __typeof (*(mem)) __tmp;						      \
  84.278 -       __typeof (mem)  __memp = (mem);					      \
  84.279 -       __asm __volatile (						      \
  84.280 --		        "1:	ldarx	%0,0,%1" MUTEX_HINT_ACQ "\n"	      \
  84.281 -+		        "1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
  84.282 - 		        "	cmpd	%0,%2\n"			      \
  84.283 - 		        "	bne	2f\n"				      \
  84.284 --		        "	stdcx.	%3,0,%1\n"			      \
  84.285 -+		        "	stdcx.	%3,%y1\n"			      \
  84.286 - 		        "	bne-	1b\n"				      \
  84.287 - 		        "2:	" __ARCH_ACQ_INSTR			      \
  84.288 --		        : "=&r" (__tmp)					      \
  84.289 --		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
  84.290 -+		        : "=&r" (__tmp), "+Z" (*__memp)			      \
  84.291 -+		        : "r" (oldval), "r" (newval)			      \
  84.292 - 		        : "cr0", "memory");				      \
  84.293 -       __tmp;								      \
  84.294 -   })
  84.295 -@@ -132,14 +132,14 @@
  84.296 -       __typeof (*(mem)) __tmp;						      \
  84.297 -       __typeof (mem)  __memp = (mem);					      \
  84.298 -       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  84.299 --		        "1:	ldarx	%0,0,%1" MUTEX_HINT_REL "\n"	      \
  84.300 -+		        "1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
  84.301 - 		        "	cmpd	%0,%2\n"			      \
  84.302 - 		        "	bne	2f\n"				      \
  84.303 --		        "	stdcx.	%3,0,%1\n"			      \
  84.304 -+		        "	stdcx.	%3,%y1\n"			      \
  84.305 - 		        "	bne-	1b\n"				      \
  84.306 - 		        "2:	"					      \
  84.307 --		        : "=&r" (__tmp)					      \
  84.308 --		        : "b" (__memp), "r" (oldval), "r" (newval)	      \
  84.309 -+		        : "=&r" (__tmp), "+Z" (*__memp)			      \
  84.310 -+		        : "r" (oldval), "r" (newval)			      \
  84.311 - 		        : "cr0", "memory");				      \
  84.312 -       __tmp;								      \
  84.313 -   })
  84.314 -@@ -148,12 +148,12 @@
  84.315 -     ({									      \
  84.316 -       __typeof (*mem) __val;						      \
  84.317 -       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  84.318 --			"1:	ldarx	%0,0,%2" MUTEX_HINT_ACQ "\n"	      \
  84.319 --			"	stdcx.	%3,0,%2\n"			      \
  84.320 -+			"1:	ldarx	%0,%y1" MUTEX_HINT_ACQ "\n"	      \
  84.321 -+			"	stdcx.	%2,%y1\n"			      \
  84.322 - 			"	bne-	1b\n"				      \
  84.323 - 		  " " __ARCH_ACQ_INSTR					      \
  84.324 --			: "=&r" (__val), "=m" (*mem)			      \
  84.325 --			: "b" (mem), "r" (value), "m" (*mem)		      \
  84.326 -+			: "=&r" (__val), "+Z" (*(mem))			      \
  84.327 -+			: "r" (value)					      \
  84.328 - 			: "cr0", "memory");				      \
  84.329 -       __val;								      \
  84.330 -     })
  84.331 -@@ -162,11 +162,11 @@
  84.332 -     ({									      \
  84.333 -       __typeof (*mem) __val;						      \
  84.334 -       __asm __volatile (__ARCH_REL_INSTR "\n"				      \
  84.335 --			"1:	ldarx	%0,0,%2" MUTEX_HINT_REL "\n"	      \
  84.336 --			"	stdcx.	%3,0,%2\n"			      \
  84.337 -+			"1:	ldarx	%0,%y1" MUTEX_HINT_REL "\n"	      \
  84.338 -+			"	stdcx.	%2,%y1\n"			      \
  84.339 - 			"	bne-	1b"				      \
  84.340 --			: "=&r" (__val), "=m" (*mem)			      \
  84.341 --			: "b" (mem), "r" (value), "m" (*mem)		      \
  84.342 -+			: "=&r" (__val), "+Z" (*(mem))			      \
  84.343 -+			: "r" (value)					      \
  84.344 - 			: "cr0", "memory");				      \
  84.345 -       __val;								      \
  84.346 -     })
  84.347 -@@ -174,12 +174,12 @@
  84.348 - #define __arch_atomic_exchange_and_add_64(mem, value) \
  84.349 -     ({									      \
  84.350 -       __typeof (*mem) __val, __tmp;					      \
  84.351 --      __asm __volatile ("1:	ldarx	%0,0,%3\n"			      \
  84.352 --			"	add	%1,%0,%4\n"			      \
  84.353 --			"	stdcx.	%1,0,%3\n"			      \
  84.354 -+      __asm __volatile ("1:	ldarx	%0,%y2\n"			      \
  84.355 -+			"	add	%1,%0,%3\n"			      \
  84.356 -+			"	stdcx.	%1,%y2\n"			      \
  84.357 - 			"	bne-	1b"				      \
  84.358 --			: "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  84.359 --			: "b" (mem), "r" (value), "m" (*mem)		      \
  84.360 -+			: "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem))	      \
  84.361 -+			: "r" (value)					      \
  84.362 - 			: "cr0", "memory");				      \
  84.363 -       __val;								      \
  84.364 -     })
  84.365 -@@ -187,12 +187,12 @@
  84.366 - #define __arch_atomic_increment_val_64(mem) \
  84.367 -     ({									      \
  84.368 -       __typeof (*(mem)) __val;						      \
  84.369 --      __asm __volatile ("1:	ldarx	%0,0,%2\n"			      \
  84.370 -+      __asm __volatile ("1:	ldarx	%0,%y1\n"			      \
  84.371 - 			"	addi	%0,%0,1\n"			      \
  84.372 --			"	stdcx.	%0,0,%2\n"			      \
  84.373 -+			"	stdcx.	%0,%y1\n"			      \
  84.374 - 			"	bne-	1b"				      \
  84.375 --			: "=&b" (__val), "=m" (*mem)			      \
  84.376 --			: "b" (mem), "m" (*mem)				      \
  84.377 -+			: "=&b" (__val), "+Z" (*(mem))			      \
  84.378 -+			:						      \
  84.379 - 			: "cr0", "memory");				      \
  84.380 -       __val;								      \
  84.381 -     })
  84.382 -@@ -200,27 +200,27 @@
  84.383 - #define __arch_atomic_decrement_val_64(mem) \
  84.384 -     ({									      \
  84.385 -       __typeof (*(mem)) __val;						      \
  84.386 --      __asm __volatile ("1:	ldarx	%0,0,%2\n"			      \
  84.387 -+      __asm __volatile ("1:	ldarx	%0,%y1\n"			      \
  84.388 - 			"	subi	%0,%0,1\n"			      \
  84.389 --			"	stdcx.	%0,0,%2\n"			      \
  84.390 -+			"	stdcx.	%0,%y1\n"			      \
  84.391 - 			"	bne-	1b"				      \
  84.392 --			: "=&b" (__val), "=m" (*mem)			      \
  84.393 --			: "b" (mem), "m" (*mem)				      \
  84.394 -+			: "=&b" (__val), "+Z" (*(mem))			      \
  84.395 -+			:						      \
  84.396 - 			: "cr0", "memory");				      \
  84.397 -       __val;								      \
  84.398 -     })
  84.399 - 
  84.400 - #define __arch_atomic_decrement_if_positive_64(mem) \
  84.401 -   ({ int __val, __tmp;							      \
  84.402 --     __asm __volatile ("1:	ldarx	%0,0,%3\n"			      \
  84.403 -+     __asm __volatile ("1:	ldarx	%0,%y2\n"			      \
  84.404 - 		       "	cmpdi	0,%0,0\n"			      \
  84.405 - 		       "	addi	%1,%0,-1\n"			      \
  84.406 - 		       "	ble	2f\n"				      \
  84.407 --		       "	stdcx.	%1,0,%3\n"			      \
  84.408 -+		       "	stdcx.	%1,%y2\n"			      \
  84.409 - 		       "	bne-	1b\n"				      \
  84.410 - 		       "2:	" __ARCH_ACQ_INSTR			      \
  84.411 --		       : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)	      \
  84.412 --		       : "b" (mem), "m" (*mem)				      \
  84.413 -+		       : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem))	      \
  84.414 -+		       :						      \
  84.415 - 		       : "cr0", "memory");				      \
  84.416 -      __val;								      \
  84.417 -   })
    85.1 --- a/patches/glibc/2_9/510-sh-no-asm-user-header.patch	Fri Mar 27 23:40:07 2009 +0000
    85.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.3 @@ -1,70 +0,0 @@
    85.4 -2007-03-13  Mike Frysinger  <vapier@gentoo.org>
    85.5 -
    85.6 -	* sysdeps/unix/sysv/linux/sh/sys/user.h: Copy Linux's asm-sh/user.h.
    85.7 -
    85.8 ---- glibc-2_9/sysdeps/unix/sysv/linux/sh/sys/user.h
    85.9 -+++ glibc-2_9/sysdeps/unix/sysv/linux/sh/sys/user.h
   85.10 -@@ -19,10 +19,60 @@
   85.11 - #ifndef _SYS_USER_H
   85.12 - #define _SYS_USER_H	1
   85.13 - 
   85.14 --#include <features.h>
   85.15 -+#include <unistd.h>
   85.16 -+#include <asm/ptrace.h>
   85.17 - 
   85.18 --#include <asm/user.h>
   85.19 -+/*
   85.20 -+ * Core file format: The core file is written in such a way that gdb
   85.21 -+ * can understand it and provide useful information to the user (under
   85.22 -+ * linux we use the `trad-core' bfd).  The file contents are as follows:
   85.23 -+ *
   85.24 -+ *  upage: 1 page consisting of a user struct that tells gdb
   85.25 -+ *	what is present in the file.  Directly after this is a
   85.26 -+ *	copy of the task_struct, which is currently not used by gdb,
   85.27 -+ *	but it may come in handy at some point.  All of the registers
   85.28 -+ *	are stored as part of the upage.  The upage should always be
   85.29 -+ *	only one page long.
   85.30 -+ *  data: The data segment follows next.  We use current->end_text to
   85.31 -+ *	current->brk to pick up all of the user variables, plus any memory
   85.32 -+ *	that may have been sbrk'ed.  No attempt is made to determine if a
   85.33 -+ *	page is demand-zero or if a page is totally unused, we just cover
   85.34 -+ *	the entire range.  All of the addresses are rounded in such a way
   85.35 -+ *	that an integral number of pages is written.
   85.36 -+ *  stack: We need the stack information in order to get a meaningful
   85.37 -+ *	backtrace.  We need to write the data from usp to
   85.38 -+ *	current->start_stack, so we round each of these in order to be able
   85.39 -+ *	to write an integer number of pages.
   85.40 -+ */
   85.41 - 
   85.42 --#undef start_thread
   85.43 -+struct user_fpu_struct {
   85.44 -+	unsigned long fp_regs[16];
   85.45 -+	unsigned long xfp_regs[16];
   85.46 -+	unsigned long fpscr;
   85.47 -+	unsigned long fpul;
   85.48 -+};
   85.49 -+
   85.50 -+struct user {
   85.51 -+	struct pt_regs	regs;			/* entire machine state */
   85.52 -+	struct user_fpu_struct fpu;	/* Math Co-processor registers  */
   85.53 -+	int u_fpvalid;		/* True if math co-processor being used */
   85.54 -+	size_t		u_tsize;		/* text size (pages) */
   85.55 -+	size_t		u_dsize;		/* data size (pages) */
   85.56 -+	size_t		u_ssize;		/* stack size (pages) */
   85.57 -+	unsigned long	start_code;		/* text starting address */
   85.58 -+	unsigned long	start_data;		/* data starting address */
   85.59 -+	unsigned long	start_stack;		/* stack starting address */
   85.60 -+	long int	signal;			/* signal causing core dump */
   85.61 -+	struct regs *	u_ar0;			/* help gdb find registers */
   85.62 -+	struct user_fpu_struct* u_fpstate;	/* Math Co-processor pointer */
   85.63 -+	unsigned long	magic;			/* identifies a core file */
   85.64 -+	char		u_comm[32];		/* user command name */
   85.65 -+};
   85.66 -+
   85.67 -+#define NBPG			getpagesize()
   85.68 -+#define UPAGES			1
   85.69 -+#define HOST_TEXT_START_ADDR	(u.start_code)
   85.70 -+#define HOST_DATA_START_ADDR	(u.start_data)
   85.71 -+#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
   85.72 - 
   85.73 - #endif  /* sys/user.h */
    86.1 --- a/patches/glibc/2_9/520-sh-no-asm-elf-header.patch	Fri Mar 27 23:40:07 2009 +0000
    86.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.3 @@ -1,27 +0,0 @@
    86.4 -2007-03-13  Mike Frysinger  <vapier@gentoo.org>
    86.5 -
    86.6 -	* sysdeps/unix/sysv/linux/sh/sys/procfs.h: Copy Linux's asm-sh/elf.h types.
    86.7 -
    86.8 ---- glibc-2_9/sysdeps/unix/sysv/linux/sh/sys/procfs.h
    86.9 -+++ glibc-2_9/sysdeps/unix/sysv/linux/sh/sys/procfs.h
   86.10 -@@ -29,10 +29,19 @@
   86.11 - #include <sys/types.h>
   86.12 - #include <sys/ucontext.h>
   86.13 - #include <sys/user.h>
   86.14 --#include <asm/elf.h>
   86.15 - 
   86.16 - __BEGIN_DECLS
   86.17 - 
   86.18 -+/*
   86.19 -+ * ELF register definitions...
   86.20 -+ */
   86.21 -+typedef unsigned long elf_greg_t;
   86.22 -+
   86.23 -+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
   86.24 -+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
   86.25 -+
   86.26 -+typedef struct user_fpu_struct elf_fpregset_t;
   86.27 -+
   86.28 - struct elf_siginfo
   86.29 -   {
   86.30 -     int si_signo;			/* Signal number.  */
    87.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.2 +++ b/patches/glibc/ports-2.9/100-arm_linux_tls.patch	Sat Mar 28 13:34:41 2009 +0000
    87.3 @@ -0,0 +1,14 @@
    87.4 +Original patch from http://www.nabble.com/arm-linux-compilation-failure-and-possible-fix-td19229074.html
    87.5 +
    87.6 +diff -durN glibc-2_9.orig/glibc-ports-2_9/sysdeps/unix/sysv/linux/arm/sysdep.h glibc-2_9/glibc-ports-2_9/sysdeps/unix/sysv/linux/arm/sysdep.h
    87.7 +--- glibc-2_9.orig/glibc-ports-2_9/sysdeps/unix/sysv/linux/arm/sysdep.h 25 Nov 2008 16:37:26 -0000 1.33
    87.8 ++++ glibc-2_9/glibc-ports-2_9/sysdeps/unix/sysv/linux/arm/sysdep.h 27 Jan 2009 15:35:38 -0000
    87.9 +@@ -28,6 +28,8 @@
   87.10 + /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
   87.11 + #include <dl-sysdep.h>
   87.12 + 
   87.13 ++#include <tls.h>
   87.14 ++
   87.15 + /* For Linux we can use the system call table in the header file
   87.16 +	/usr/include/asm/unistd.h
   87.17 +    of the kernel.  But these symbols do not follow the SYS_* syntax 
    88.1 --- a/patches/glibc/ports-2_9/100-arm_linux_tls.patch	Fri Mar 27 23:40:07 2009 +0000
    88.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.3 @@ -1,14 +0,0 @@
    88.4 -Original patch from http://www.nabble.com/arm-linux-compilation-failure-and-possible-fix-td19229074.html
    88.5 -
    88.6 -diff -durN glibc-2_9.orig/glibc-ports-2_9/sysdeps/unix/sysv/linux/arm/sysdep.h glibc-2_9/glibc-ports-2_9/sysdeps/unix/sysv/linux/arm/sysdep.h
    88.7 ---- glibc-2_9.orig/glibc-ports-2_9/sysdeps/unix/sysv/linux/arm/sysdep.h 25 Nov 2008 16:37:26 -0000 1.33
    88.8 -+++ glibc-2_9/glibc-ports-2_9/sysdeps/unix/sysv/linux/arm/sysdep.h 27 Jan 2009 15:35:38 -0000
    88.9 -@@ -28,6 +28,8 @@
   88.10 - /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
   88.11 - #include <dl-sysdep.h>
   88.12 - 
   88.13 -+#include <tls.h>
   88.14 -+
   88.15 - /* For Linux we can use the system call table in the header file
   88.16 -	/usr/include/asm/unistd.h
   88.17 -    of the kernel.  But these symbols do not follow the SYS_* syntax