Add a patchset for glibc 2_9. Vampirised from the gentoo repository.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Feb 02 22:00:18 2009 +0000 (2009-02-02)
changeset 1201c9967a6e3b25
parent 1200 136731f6f597
child 1202 bb9ac4889cec
Add a patchset for glibc 2_9. Vampirised from the gentoo repository.

/trunk/patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch | 414 414 0 0 ++++++++++
/trunk/patches/glibc/2_9/140-regex-BZ9697.patch | 111 111 0 0 +++
/trunk/patches/glibc/2_9/190-queue-header-updates.patch | 89 89 0 0 ++
/trunk/patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch | 249 249 0 0 ++++++
/trunk/patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch | 32 32 0 0 +
/trunk/patches/glibc/2_9/270-ldbl-nexttowardf.patch | 68 68 0 0 ++
/trunk/patches/glibc/2_9/330-2.3.3-china.patch | 35 35 0 0 +
/trunk/patches/glibc/2_9/340-new-valencian-locale.patch | 120 120 0 0 +++
/trunk/patches/glibc/2_9/410-2.9-fnmatch.patch | 64 64 0 0 ++
/trunk/patches/glibc/2_9/350-2.4-undefine-__i686.patch | 47 47 0 0 +
/trunk/patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch | 53 53 0 0 +
/trunk/patches/glibc/2_9/420-dont-build-timezone.patch | 19 19 0 0 +
/trunk/patches/glibc/2_9/150-regex-BZ697.patch | 28 28 0 0 +
/trunk/patches/glibc/2_9/290-no-inline-gmon.patch | 38 38 0 0 +
/trunk/patches/glibc/2_9/280-section-comments.patch | 29 29 0 0 +
/trunk/patches/glibc/2_9/180-math-tests.patch | 72 72 0 0 ++
/trunk/patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch | 35 35 0 0 +
/trunk/patches/glibc/2_9/250-resolv-dynamic.patch | 44 44 0 0 +
/trunk/patches/glibc/2_9/300-2.9-check_native-headers.patch | 22 22 0 0 +
/trunk/patches/glibc/2_9/310-2.3.6-fix-pr631.patch | 50 50 0 0 +
/trunk/patches/glibc/2_9/130-add_prio-macros.patch | 26 26 0 0 +
/trunk/patches/glibc/2_9/260-fadvise64_64.patch | 30 30 0 0 +
/trunk/patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch | 249 249 0 0 ++++++
/trunk/patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch | 35 35 0 0 +
/trunk/patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch | 74 74 0 0 ++
/trunk/patches/glibc/2_9/360-2.8-nscd-one-fork.patch | 45 45 0 0 +
/trunk/patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch | 18 18 0 0 +
/trunk/patches/glibc/2_9/210-2.9-strlen-hack.patch | 109 109 0 0 +++
/trunk/patches/glibc/2_9/320-2.9-assume-pipe2.patch | 59 59 0 0 +
/trunk/patches/glibc/2_9/100-ssp-compat.patch | 193 193 0 0 +++++
/trunk/patches/glibc/2_9/110-respect-env-CPPFLAGS.patch | 30 30 0 0 +
/trunk/patches/glibc/2_9/220-manual-no-perl.patch | 29 29 0 0 +
/trunk/patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch | 35 35 0 0 +
/trunk/patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch | 38 38 0 0 +
/trunk/patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch | 198 198 0 0 +++++
/trunk/patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch | 23 23 0 0 +
/trunk/patches/glibc/2_9/200-awk-in-C-locale.patch | 23 23 0 0 +
/trunk/patches/glibc/2_9/430-2.7-cross-compile-nptl.patch | 57 57 0 0 +
/trunk/patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch | 71 71 0 0 ++
/trunk/patches/glibc/2_9/490-ptr-mangling.patch | 114 114 0 0 +++
/trunk/patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch | 19 19 0 0 +
41 files changed, 3094 insertions(+)
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
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2_9/100-ssp-compat.patch	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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	Mon Feb 02 22:00:18 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 +   })