summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/glibc/2_9/100-ssp-compat.patch193
-rw-r--r--patches/glibc/2_9/110-respect-env-CPPFLAGS.patch30
-rw-r--r--patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch35
-rw-r--r--patches/glibc/2_9/130-add_prio-macros.patch26
-rw-r--r--patches/glibc/2_9/140-regex-BZ9697.patch111
-rw-r--r--patches/glibc/2_9/150-regex-BZ697.patch28
-rw-r--r--patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch53
-rw-r--r--patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch35
-rw-r--r--patches/glibc/2_9/180-math-tests.patch72
-rw-r--r--patches/glibc/2_9/190-queue-header-updates.patch89
-rw-r--r--patches/glibc/2_9/200-awk-in-C-locale.patch23
-rw-r--r--patches/glibc/2_9/210-2.9-strlen-hack.patch109
-rw-r--r--patches/glibc/2_9/220-manual-no-perl.patch29
-rw-r--r--patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch74
-rw-r--r--patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch23
-rw-r--r--patches/glibc/2_9/250-resolv-dynamic.patch44
-rw-r--r--patches/glibc/2_9/260-fadvise64_64.patch30
-rw-r--r--patches/glibc/2_9/270-ldbl-nexttowardf.patch68
-rw-r--r--patches/glibc/2_9/280-section-comments.patch29
-rw-r--r--patches/glibc/2_9/290-no-inline-gmon.patch38
-rw-r--r--patches/glibc/2_9/300-2.9-check_native-headers.patch22
-rw-r--r--patches/glibc/2_9/310-2.3.6-fix-pr631.patch50
-rw-r--r--patches/glibc/2_9/320-2.9-assume-pipe2.patch59
-rw-r--r--patches/glibc/2_9/330-2.3.3-china.patch35
-rw-r--r--patches/glibc/2_9/340-new-valencian-locale.patch120
-rw-r--r--patches/glibc/2_9/350-2.4-undefine-__i686.patch47
-rw-r--r--patches/glibc/2_9/360-2.8-nscd-one-fork.patch45
-rw-r--r--patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch249
-rw-r--r--patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch71
-rw-r--r--patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch35
-rw-r--r--patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch198
-rw-r--r--patches/glibc/2_9/410-2.9-fnmatch.patch64
-rw-r--r--patches/glibc/2_9/420-dont-build-timezone.patch19
-rw-r--r--patches/glibc/2_9/430-2.7-cross-compile-nptl.patch57
-rw-r--r--patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch249
-rw-r--r--patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch32
-rw-r--r--patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch38
-rw-r--r--patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch19
-rw-r--r--patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch18
-rw-r--r--patches/glibc/2_9/490-ptr-mangling.patch114
-rw-r--r--patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch414
41 files changed, 3094 insertions, 0 deletions
diff --git a/patches/glibc/2_9/100-ssp-compat.patch b/patches/glibc/2_9/100-ssp-compat.patch
new file mode 100644
index 0000000..b51bc33
--- /dev/null
+++ b/patches/glibc/2_9/100-ssp-compat.patch
@@ -0,0 +1,193 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/0010_all_glibc-2.7-ssp-compat.patch
+
+-= BEGIN original header =-
+Add backwards compat support for gcc-3.x ssp ... older ssp versions
+used __guard and __stack_smash_handler symbols while gcc-4.1 and newer
+uses __stack_chk_guard and __stack_chk_fail.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/Versions.def glibc-2_9/Versions.def
+--- glibc-2_9.orig/Versions.def 2008-08-01 19:13:40.000000000 +0200
++++ glibc-2_9/Versions.def 2009-02-02 22:00:33.000000000 +0100
+@@ -113,6 +113,9 @@
+ GLIBC_2.0
+ GLIBC_2.1
+ GLIBC_2.3
++%ifdef ENABLE_OLD_SSP_COMPAT
++ GLIBC_2.3.2
++%endif
+ GLIBC_2.4
+ GLIBC_PRIVATE
+ }
+diff -durN glibc-2_9.orig/config.h.in glibc-2_9/config.h.in
+--- glibc-2_9.orig/config.h.in 2007-03-26 22:40:08.000000000 +0200
++++ glibc-2_9/config.h.in 2009-02-02 22:00:32.000000000 +0100
+@@ -42,6 +42,9 @@
+ assembler instructions per line. Default is `;' */
+ #undef ASM_LINE_SEP
+
++/* Define if we want to enable support for old ssp symbols */
++#undef ENABLE_OLD_SSP_COMPAT
++
+ /* Define if not using ELF, but `.init' and `.fini' sections are available. */
+ #undef HAVE_INITFINI
+
+diff -durN glibc-2_9.orig/configure glibc-2_9/configure
+--- glibc-2_9.orig/configure 2008-11-11 10:50:11.000000000 +0100
++++ glibc-2_9/configure 2009-02-02 22:00:32.000000000 +0100
+@@ -1380,6 +1380,9 @@
+ --enable-kernel=VERSION compile for compatibility with kernel not older than
+ VERSION
+ --enable-all-warnings enable all useful warnings gcc can issue
++ --disable-old-ssp-compat
++ enable support for older ssp symbols
++ [default=no]
+
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+@@ -6470,6 +6473,20 @@
+ echo "${ECHO_T}$libc_cv_ssp" >&6; }
+
+
++# Check whether --enable-old-ssp-compat or --disable-old-ssp-compat was given.
++if test "${enable_old_ssp_compat+set}" = set; then
++ enableval="$enable_old_ssp_compat"
++ enable_old_ssp_compat=$enableval
++else
++ enable_old_ssp_compat=no
++fi;
++if test "x$enable_old_ssp_compat" = "xyes"; then
++ cat >>confdefs.h <<\_ACEOF
++#define ENABLE_OLD_SSP_COMPAT 1
++_ACEOF
++
++fi
++
+ { echo "$as_me:$LINENO: checking for -fgnu89-inline" >&5
+ echo $ECHO_N "checking for -fgnu89-inline... $ECHO_C" >&6; }
+ if test "${libc_cv_gnu89_inline+set}" = set; then
+diff -durN glibc-2_9.orig/configure.in glibc-2_9/configure.in
+--- glibc-2_9.orig/configure.in 2008-11-11 10:50:11.000000000 +0100
++++ glibc-2_9/configure.in 2009-02-02 22:00:32.000000000 +0100
+@@ -1647,6 +1647,15 @@
+ rm -f conftest*])
+ AC_SUBST(libc_cv_ssp)
+
++AC_ARG_ENABLE([old-ssp-compat],
++ AC_HELP_STRING([--enable-old-ssp-compat],
++ [enable support for older ssp symbols @<:@default=no@:>@]),
++ [enable_old_ssp_compat=$enableval],
++ [enable_old_ssp_compat=no])
++if test "x$enable_old_ssp_compat" = "xyes"; then
++ AC_DEFINE(ENABLE_OLD_SSP_COMPAT)
++fi
++
+ AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
+ cat > conftest.c <<EOF
+ int foo;
+diff -durN glibc-2_9.orig/csu/Versions glibc-2_9/csu/Versions
+--- glibc-2_9.orig/csu/Versions 2006-10-28 01:11:41.000000000 +0200
++++ glibc-2_9/csu/Versions 2009-02-02 22:00:32.000000000 +0100
+@@ -17,6 +17,12 @@
+ # New special glibc functions.
+ gnu_get_libc_release; gnu_get_libc_version;
+ }
++ GLIBC_2.3.2 {
++%ifdef ENABLE_OLD_SSP_COMPAT
++ # global objects and functions for the old propolice patch in gcc
++ __guard;
++%endif
++ }
+ GLIBC_PRIVATE {
+ %if HAVE___THREAD
+ # This version is for the TLS symbol, GLIBC_2.0 is the old object symbol.
+diff -durN glibc-2_9.orig/csu/libc-start.c glibc-2_9/csu/libc-start.c
+--- glibc-2_9.orig/csu/libc-start.c 2007-08-21 00:27:50.000000000 +0200
++++ glibc-2_9/csu/libc-start.c 2009-02-02 22:00:32.000000000 +0100
+@@ -37,6 +37,9 @@
+ uintptr_t __stack_chk_guard attribute_relro;
+ # endif
+ #endif
++#ifdef ENABLE_OLD_SSP_COMPAT
++uintptr_t __guard attribute_relro;
++#endif
+
+ #ifdef HAVE_PTR_NTHREADS
+ /* We need atomic operations. */
+@@ -141,6 +144,9 @@
+
+ /* Set up the stack checker's canary. */
+ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
++#ifdef ENABLE_OLD_SSP_COMPAT
++ __guard = stack_chk_guard;
++#endif
+ # ifdef THREAD_SET_STACK_GUARD
+ THREAD_SET_STACK_GUARD (stack_chk_guard);
+ # else
+diff -durN glibc-2_9.orig/debug/Versions glibc-2_9/debug/Versions
+--- glibc-2_9.orig/debug/Versions 2008-03-05 07:53:41.000000000 +0100
++++ glibc-2_9/debug/Versions 2009-02-02 22:00:32.000000000 +0100
+@@ -10,6 +10,12 @@
+ # These are to support some gcc features.
+ __cyg_profile_func_enter; __cyg_profile_func_exit;
+ }
++%ifdef ENABLE_OLD_SSP_COMPAT
++ GLIBC_2.3.2 {
++ # backwards ssp compat support; alias to __stack_chk_fail
++ __stack_smash_handler;
++ }
++%endif
+ GLIBC_2.3.4 {
+ __chk_fail;
+ __memcpy_chk; __memmove_chk; __mempcpy_chk; __memset_chk; __stpcpy_chk;
+diff -durN glibc-2_9.orig/debug/stack_chk_fail.c glibc-2_9/debug/stack_chk_fail.c
+--- glibc-2_9.orig/debug/stack_chk_fail.c 2007-05-25 01:47:08.000000000 +0200
++++ glibc-2_9/debug/stack_chk_fail.c 2009-02-02 22:00:32.000000000 +0100
+@@ -28,3 +28,7 @@
+ {
+ __fortify_fail ("stack smashing detected");
+ }
++
++#ifdef ENABLE_OLD_SSP_COMPAT
++strong_alias (__stack_chk_fail, __stack_smash_handler)
++#endif
+diff -durN glibc-2_9.orig/elf/Versions glibc-2_9/elf/Versions
+--- glibc-2_9.orig/elf/Versions 2008-03-08 06:42:26.000000000 +0100
++++ glibc-2_9/elf/Versions 2009-02-02 22:00:33.000000000 +0100
+@@ -43,6 +43,12 @@
+ # runtime interface to TLS
+ __tls_get_addr;
+ }
++%ifdef ENABLE_OLD_SSP_COMPAT
++ GLIBC_2.3.2 {
++ # backwards ssp compat support
++ __guard;
++ }
++%endif
+ GLIBC_2.4 {
+ # stack canary
+ __stack_chk_guard;
+diff -durN glibc-2_9.orig/elf/rtld.c glibc-2_9/elf/rtld.c
+--- glibc-2_9.orig/elf/rtld.c 2008-08-14 19:01:56.000000000 +0200
++++ glibc-2_9/elf/rtld.c 2009-02-02 22:00:32.000000000 +0100
+@@ -89,6 +89,9 @@
+ in thread local area. */
+ uintptr_t __stack_chk_guard attribute_relro;
+ #endif
++#ifdef ENABLE_OLD_SSP_COMPAT
++uintptr_t __guard attribute_relro;
++#endif
+
+ /* Only exported for architectures that don't store the pointer guard
+ value in thread local area. */
+@@ -842,6 +845,9 @@
+ {
+ /* Set up the stack checker's canary. */
+ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
++#ifdef ENABLE_OLD_SSP_COMPAT
++ __guard = stack_chk_guard;
++#endif
+ #ifdef THREAD_SET_STACK_GUARD
+ THREAD_SET_STACK_GUARD (stack_chk_guard);
+ #else
diff --git a/patches/glibc/2_9/110-respect-env-CPPFLAGS.patch b/patches/glibc/2_9/110-respect-env-CPPFLAGS.patch
new file mode 100644
index 0000000..68033b2
--- /dev/null
+++ b/patches/glibc/2_9/110-respect-env-CPPFLAGS.patch
@@ -0,0 +1,30 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/0030_all_glibc-respect-env-CPPFLAGS.patch
+
+-= BEGIN original header =-
+Respect environment CPPFLAGS when we run ./configure so we can inject
+random -D things without having to set CFLAGS/ASFLAGS
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/Makeconfig glibc-2_9/Makeconfig
+--- glibc-2_9.orig/Makeconfig 2008-08-18 11:42:17.000000000 +0200
++++ glibc-2_9/Makeconfig 2009-02-02 22:00:35.000000000 +0100
+@@ -673,6 +673,7 @@
+ $(foreach lib,$(libof-$(basename $(@F))) \
+ $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
++CPPFLAGS += $(CPPFLAGS-config)
+ override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
+ $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
+ $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
+diff -durN glibc-2_9.orig/config.make.in glibc-2_9/config.make.in
+--- glibc-2_9.orig/config.make.in 2008-08-18 11:42:17.000000000 +0200
++++ glibc-2_9/config.make.in 2009-02-02 22:00:35.000000000 +0100
+@@ -97,6 +97,7 @@
+ CXX = @CXX@
+ BUILD_CC = @BUILD_CC@
+ CFLAGS = @CFLAGS@
++CPPFLAGS-config = @CPPFLAGS@
+ ASFLAGS-config = @ASFLAGS_config@
+ AR = @AR@
+ RANLIB = @RANLIB@
diff --git a/patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch b/patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch
new file mode 100644
index 0000000..dedb03f
--- /dev/null
+++ b/patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch
@@ -0,0 +1,35 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/0050_all_glibc-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch
+
+-= BEGIN original header =-
+http://sourceware.org/ml/libc-alpha/2009-01/msg00000.html
+
+From 8ad7030880eaa18dcabf8e284e79026301fd3fa4 Mon Sep 17 00:00:00 2001
+From: Ulrich Drepper <drepper@redhat.com>
+Date: Thu, 8 Jan 2009 00:02:38 +0000
+Subject: [PATCH] (_nss_dns_gethostbyaddr2_r): Check and adjust the buffer alignment.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/resolv/nss_dns/dns-host.c glibc-2_9/resolv/nss_dns/dns-host.c
+--- glibc-2_9.orig/resolv/nss_dns/dns-host.c 2008-11-12 08:52:20.000000000 +0100
++++ glibc-2_9/resolv/nss_dns/dns-host.c 2009-02-02 22:00:36.000000000 +0100
+@@ -364,6 +364,19 @@
+ int n, status;
+ int olderr = errno;
+
++ uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
++ buffer += pad;
++ buflen = buflen > pad ? buflen - pad : 0;
++
++ if (__builtin_expect (buflen < sizeof (struct host_data), 0))
++ {
++ *errnop = ERANGE;
++ *h_errnop = NETDB_INTERNAL;
++ return NSS_STATUS_TRYAGAIN;
++ }
++
++ host_data = (struct host_data *) buffer;
++
+ if (__res_maybe_init (&_res, 0) == -1)
+ return NSS_STATUS_UNAVAIL;
+
diff --git a/patches/glibc/2_9/130-add_prio-macros.patch b/patches/glibc/2_9/130-add_prio-macros.patch
new file mode 100644
index 0000000..ff5bf5b
--- /dev/null
+++ b/patches/glibc/2_9/130-add_prio-macros.patch
@@ -0,0 +1,26 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/0051_all_glibc-2.9-add_prio-macros.patch
+
+-= BEGIN original header =-
+http://sourceware.org/ml/libc-alpha/2009-01/msg00003.html
+
+From a1737958e074e8f990760acc8abeb0c23715a859 Mon Sep 17 00:00:00 2001
+From: Roland McGrath <roland@gnu.org>
+Date: Sat, 3 Jan 2009 21:04:01 +0000
+Subject: [PATCH] 2009-01-03 Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+ * bits/resource.h (PRIO_PROCESS, PRIO_PGRP, PRIO_USER): Add macros.
+-= END original header =-
+
+diff -durN glibc-2_9.orig/bits/resource.h glibc-2_9/bits/resource.h
+--- glibc-2_9.orig/bits/resource.h 2006-03-05 23:48:10.000000000 +0100
++++ glibc-2_9/bits/resource.h 2009-02-02 22:00:38.000000000 +0100
+@@ -185,6 +185,9 @@
+ enum __priority_which
+ {
+ PRIO_PROCESS = 0, /* WHO is a process ID. */
++#define PRIO_PROCESS PRIO_PROCESS
+ PRIO_PGRP = 1, /* WHO is a process group ID. */
++#define PRIO_PGRP PRIO_PGRP
+ PRIO_USER = 2 /* WHO is a user ID. */
++#define PRIO_USER PRIO_USER
+ };
diff --git a/patches/glibc/2_9/140-regex-BZ9697.patch b/patches/glibc/2_9/140-regex-BZ9697.patch
new file mode 100644
index 0000000..73b0c23
--- /dev/null
+++ b/patches/glibc/2_9/140-regex-BZ9697.patch
@@ -0,0 +1,111 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/0052_all_glibc-2.9-regex-BZ9697.patch
+
+-= BEGIN original header =-
+http://sourceware.org/ml/libc-alpha/2009-01/msg00005.html
+
+From ea8ca0dfcbf2721bcf2c08ce3c01d5764b827572 Mon Sep 17 00:00:00 2001
+From: Ulrich Drepper <drepper@redhat.com>
+Date: Thu, 8 Jan 2009 00:42:28 +0000
+Subject: [PATCH] (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET handling.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/posix/regcomp.c glibc-2_9/posix/regcomp.c
+--- glibc-2_9.orig/posix/regcomp.c 2008-05-15 05:07:21.000000000 +0200
++++ glibc-2_9/posix/regcomp.c 2009-02-02 22:00:41.000000000 +0100
+@@ -350,47 +350,67 @@
+ #ifdef RE_ENABLE_I18N
+ else if (type == COMPLEX_BRACKET)
+ {
+- int i;
+ re_charset_t *cset = dfa->nodes[node].opr.mbcset;
+- if (cset->non_match || cset->ncoll_syms || cset->nequiv_classes
+- || cset->nranges || cset->nchar_classes)
+- {
++ int i;
++
+ # ifdef _LIBC
+- if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0)
++ /* See if we have to try all bytes which start multiple collation
++ elements.
++ e.g. In da_DK, we want to catch 'a' since "aa" is a valid
++ collation element, and don't catch 'b' since 'b' is
++ the only collation element which starts from 'b' (and
++ it is caught by SIMPLE_BRACKET). */
++ if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0
++ && (cset->ncoll_syms || cset->nranges))
+ {
+- /* In this case we want to catch the bytes which are
+- the first byte of any collation elements.
+- e.g. In da_DK, we want to catch 'a' since "aa"
+- is a valid collation element, and don't catch
+- 'b' since 'b' is the only collation element
+- which starts from 'b'. */
+ const int32_t *table = (const int32_t *)
+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
+ for (i = 0; i < SBC_MAX; ++i)
+ if (table[i] < 0)
+ re_set_fastmap (fastmap, icase, i);
+ }
+-# else
+- if (dfa->mb_cur_max > 1)
+- for (i = 0; i < SBC_MAX; ++i)
+- if (__btowc (i) == WEOF)
+- re_set_fastmap (fastmap, icase, i);
+-# endif /* not _LIBC */
+- }
+- for (i = 0; i < cset->nmbchars; ++i)
++# endif /* _LIBC */
++
++ /* See if we have to start the match at all multibyte characters,
++ i.e. where we would not find an invalid sequence. This only
++ applies to multibyte character sets; for single byte character
++ sets, the SIMPLE_BRACKET again suffices. */
++ if (dfa->mb_cur_max > 1
++ && (cset->nchar_classes || cset->non_match
++# ifdef _LIBC
++ || cset->nequiv_classes
++# endif /* _LIBC */
++ ))
+ {
+- char buf[256];
+- mbstate_t state;
+- memset (&state, '\0', sizeof (state));
+- if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
+- re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
+- if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
++ unsigned char c = 0;
++ do
+ {
+- if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
+- != (size_t) -1)
+- re_set_fastmap (fastmap, 0, *(unsigned char *) buf);
++ mbstate_t mbs;
++ memset (&mbs, 0, sizeof (mbs));
++ if (__mbrtowc (NULL, (char *) &c, 1, &mbs) == (size_t) -2)
++ re_set_fastmap (fastmap, false, (int) c);
+ }
++ while (++c != 0);
+ }
++
++ else
++ {
++ /* ... Else catch all bytes which can start the mbchars. */
++ for (i = 0; i < cset->nmbchars; ++i)
++ {
++ char buf[256];
++ mbstate_t state;
++ memset (&state, '\0', sizeof (state));
++ if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
++ re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
++ if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
++ {
++ if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
++ != (size_t) -1)
++ re_set_fastmap (fastmap, false, *(unsigned char *) buf);
++ }
++ }
++ }
+ }
+ #endif /* RE_ENABLE_I18N */
+ else if (type == OP_PERIOD
diff --git a/patches/glibc/2_9/150-regex-BZ697.patch b/patches/glibc/2_9/150-regex-BZ697.patch
new file mode 100644
index 0000000..5b70629
--- /dev/null
+++ b/patches/glibc/2_9/150-regex-BZ697.patch
@@ -0,0 +1,28 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/0053_all_glibc-2.9-regex-BZ697.patch
+
+-= BEGIN original header =-
+http://sourceware.org/ml/libc-alpha/2009-01/msg00006.html
+
+From 37bdc055ceeb6b1144c07448a7210d9ab3fbb2f5 Mon Sep 17 00:00:00 2001
+From: Ulrich Drepper <drepper@redhat.com>
+Date: Thu, 8 Jan 2009 00:47:05 +0000
+Subject: [PATCH] (prune_impossible_nodes): Handle sifted_states[0] being NULL also if
+ there are no backreferences.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/posix/regexec.c glibc-2_9/posix/regexec.c
+--- glibc-2_9.orig/posix/regexec.c 2007-10-12 19:47:13.000000000 +0200
++++ glibc-2_9/posix/regexec.c 2009-02-02 22:00:43.000000000 +0100
+@@ -1004,6 +1004,11 @@
+ re_node_set_free (&sctx.limits);
+ if (BE (ret != REG_NOERROR, 0))
+ goto free_return;
++ if (sifted_states[0] == NULL)
++ {
++ ret = REG_NOMATCH;
++ goto free_return;
++ }
+ }
+ re_free (mctx->state_log);
+ mctx->state_log = sifted_states;
diff --git a/patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch b/patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch
new file mode 100644
index 0000000..9ae9a58
--- /dev/null
+++ b/patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch
@@ -0,0 +1,53 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/0070_all_glibc-i386-x86_64-revert-clone-cfi.patch
+
+-= BEGIN original header =-
+revert cfi additions to clone on i386/x86_64 to workaround problems in
+gcc's unwinder code. this is not a bug in glibc, it triggers problems
+elsewhere. this cfi code does not gain us a whole lot anyways.
+
+http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2_9/sysdeps/unix/sysv/linux/i386/clone.S
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/i386/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/i386/clone.S 2009-02-02 22:00:45.000000000 +0100
+@@ -120,9 +120,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (eip);
+ /* Note: %esi is zero. */
+ movl %esi,%ebp /* terminate the stack frame */
+ #ifdef RESET_PID
+@@ -155,7 +152,6 @@
+ jmp L(haspid)
+ .previous
+ #endif
+- cfi_endproc;
+
+ cfi_startproc
+ PSEUDO_END (BP_SYM (__clone))
+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
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/x86_64/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-02-02 22:00:45.000000000 +0100
+@@ -89,9 +89,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (rip);
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+@@ -116,7 +113,6 @@
+ /* Call exit with return value from function call. */
+ movq %rax, %rdi
+ call HIDDEN_JUMPTARGET (_exit)
+- cfi_endproc;
+
+ cfi_startproc;
+ PSEUDO_END (BP_SYM (__clone))
diff --git a/patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch b/patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch
new file mode 100644
index 0000000..7a4f923
--- /dev/null
+++ b/patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch
@@ -0,0 +1,35 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/0080_all_glibc-2.10-dns-no-gethostbyname4.patch
+
+-= BEGIN original header =-
+http://sourceware.org/bugzilla/show_bug.cgi?id=7060
+http://bugs.gentoo.org/250468
+
+The gethostbyname4() lookup method is problematic since it fires out both
+the A and AAAA DNS queries in parallel and over the same socket. This
+should work in theory, but it turns out that many cheap DSL modems and
+similar devices have buggy DNS servers - if the AAAA query arrives too
+quickly after the A query, the server will generate only a single reply
+with the A query id but returning an error for the AAAA query; we get
+stuck waiting for the second reply.
+
+For gethostbyname4() users affected, disabling IPv6 in the system might
+work around the issue, unfortunately it only helps with applications
+using AI_ADDRCONFIG (e.g. Firefox); some (notably e.g. Pidgin) neglect
+to do that.
+
+Real fix should be using separate ports for the A and AAAA queries.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/resolv/Versions glibc-2_9/resolv/Versions
+--- glibc-2_9.orig/resolv/Versions 2008-08-01 19:15:34.000000000 +0200
++++ glibc-2_9/resolv/Versions 2009-02-02 22:00:46.000000000 +0100
+@@ -102,7 +102,7 @@
+ _nss_dns_gethostbyname_r; _nss_dns_getnetbyaddr_r;
+ _nss_dns_getnetbyname_r; _nss_dns_getcanonname_r;
+ _nss_dns_gethostbyaddr2_r;
+- _nss_dns_gethostbyname4_r;
++# _nss_dns_gethostbyname4_r;
+ }
+ }
+
diff --git a/patches/glibc/2_9/180-math-tests.patch b/patches/glibc/2_9/180-math-tests.patch
new file mode 100644
index 0000000..750ed1a
--- /dev/null
+++ b/patches/glibc/2_9/180-math-tests.patch
@@ -0,0 +1,72 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/0090_all_glibc-math-tests.patch
+
+-= BEGIN original header =-
+From: "Joseph S. Myers" <joseph at codesourcery dot com>
+To: libc-alpha at sourceware dot org
+Date: Tue, 15 Jul 2008 14:43:04 +0000 (UTC)
+Subject: expm1 ulps
+
+If you test glibc on i686 with GCC 4.3, you get a test-ildoubl failure:
+
+Failure: Test: expm1 (1) == M_El - 1.0
+Result:
+ is: 1.71828182845904523532e+00 0xd.bf0a8b14576953500000p-3
+ should be: 1.71828182845904523543e+00 0xd.bf0a8b14576953600000p-3
+ difference: 1.08420217248550443401e-19 0x8.00000000000000000000p-66
+ ulp : 1.0000
+ max.ulp : 0.0000
+Maximal error of `expm1'
+ is : 1 ulp
+ accepted: 0 ulp
+
+What happens is that the inline expansion of expm1l uses __builtin_expm1l,
+and GCC 4.3 optimizes calls to __builtin_expm1l with constant argument to
+a correctly rounded result using MPFR. The result returned is thus the
+value of e-1 rounded once to long double precision. However, the test
+expects M_El - 1.0, and the result of rounding e to long double precision,
+then subtracting 1, differs in the last place from the result of rounding
+e-1 to long double precision (the latter has smaller exponent, and the
+last bit is 1).
+
+There are two obvious approaches possible to fixing this. The first patch
+below changes the expectation to a decimal expansion for e-1 (taken from
+that of M_El) rather than doing arithmetic in the expected value. This in
+turn requires ulps to be set for the out-of-line version of expm1. It
+might also need ulps to be set for the inline version for older compilers
+if they should continue to pass the test, and possibly for other targets.
+The second patch below takes the alternative approach of keeping the
+existing expectation (which has the wrong bit in the last place) and
+setting ulps for the inline expansion of expm1, which avoids the risk of
+breaking the test for other targets.
+
+2008-07-15 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/i386/fpu/libm-test-ulps: Add inline long double ulps for
+ expm1.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps glibc-2_9/sysdeps/i386/fpu/libm-test-ulps
+--- glibc-2_9.orig/sysdeps/i386/fpu/libm-test-ulps 2006-01-15 18:59:37.000000000 +0100
++++ glibc-2_9/sysdeps/i386/fpu/libm-test-ulps 2009-02-02 22:00:47.000000000 +0100
+@@ -453,6 +453,10 @@
+ ildouble: 8
+ ldouble: 8
+
++# expm1
++Test "expm1 (1) == M_El - 1.0":
++ildouble: 1
++
+ # gamma
+ Test "gamma (-0.5) == log(2*sqrt(pi))":
+ double: 1
+@@ -1134,6 +1138,9 @@
+ ildouble: 8
+ ldouble: 8
+
++Function: "expm1":
++ildouble: 1
++
+ Function: "gamma":
+ double: 1
+ idouble: 1
diff --git a/patches/glibc/2_9/190-queue-header-updates.patch b/patches/glibc/2_9/190-queue-header-updates.patch
new file mode 100644
index 0000000..446261d
--- /dev/null
+++ b/patches/glibc/2_9/190-queue-header-updates.patch
@@ -0,0 +1,89 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1010_all_glibc-queue-header-updates.patch
+
+-= BEGIN original header =-
+grab some updates from FreeBSD
+
+http://bugs.gentoo.org/201979
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/misc/sys/queue.h glibc-2_9/misc/sys/queue.h
+--- glibc-2_9.orig/misc/sys/queue.h 2008-03-05 06:50:30.000000000 +0100
++++ glibc-2_9/misc/sys/queue.h 2009-02-02 22:00:48.000000000 +0100
+@@ -136,6 +136,11 @@
+ (var); \
+ (var) = ((var)->field.le_next))
+
++#define LIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = LIST_FIRST((head)); \
++ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ /*
+ * List access methods.
+ */
+@@ -197,6 +202,16 @@
+ #define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
++#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = SLIST_FIRST((head)); \
++ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
++#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
++ for ((varp) = &SLIST_FIRST((head)); \
++ ((var) = *(varp)) != NULL; \
++ (varp) = &SLIST_NEXT((var), field))
++
+ /*
+ * Singly-linked List access methods.
+ */
+@@ -242,6 +257,12 @@
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ } while (/*CONSTCOND*/0)
+
++#define STAILQ_LAST(head, type, field) \
++ (STAILQ_EMPTY((head)) ? \
++ NULL : \
++ ((struct type *)(void *) \
++ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
++
+ #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+@@ -286,6 +307,11 @@
+ #define STAILQ_FIRST(head) ((head)->stqh_first)
+ #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
+
++#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = STAILQ_FIRST((head)); \
++ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+
+ /*
+ * Simple queue definitions.
+@@ -437,11 +463,22 @@
+ (var); \
+ (var) = ((var)->field.tqe_next))
+
++#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = TAILQ_FIRST((head)); \
++ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
++ for ((var) = TAILQ_LAST((head), headname); \
++ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
++ (var) = (tvar))
++
++
+ #define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
diff --git a/patches/glibc/2_9/200-awk-in-C-locale.patch b/patches/glibc/2_9/200-awk-in-C-locale.patch
new file mode 100644
index 0000000..9dcb9ae
--- /dev/null
+++ b/patches/glibc/2_9/200-awk-in-C-locale.patch
@@ -0,0 +1,23 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1018_all_glibc-awk-in-C-locale.patch
+
+-= BEGIN original header =-
+http://bugs.gentoo.org/252802
+
+2008-12-29 Mike Frysinger <vapier@gentoo.org>
+
+ * iconvdata/Makefile (iconv-rules): Use LC_ALL=C when running awk script.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/iconvdata/Makefile glibc-2_9/iconvdata/Makefile
+--- glibc-2_9.orig/iconvdata/Makefile 2008-05-15 03:54:31.000000000 +0200
++++ glibc-2_9/iconvdata/Makefile 2009-02-02 22:00:50.000000000 +0100
+@@ -286,7 +286,7 @@
+ { echo $(filter-out lib%, $(modules)); \
+ echo 8bit $(gen-8bit-modules); \
+ echo 8bit-gap $(gen-8bit-gap-modules); } | \
+- $(AWK) 'NR == 1 { \
++ LC_ALL=C $(AWK) 'NR == 1 { \
+ for (i = 1; i <= NF; i++) { \
+ printf "%s-routines := %s\n", $$i, tolower($$i); \
+ printf "%s-map := gconv.map\n", $$i; \
diff --git a/patches/glibc/2_9/210-2.9-strlen-hack.patch b/patches/glibc/2_9/210-2.9-strlen-hack.patch
new file mode 100644
index 0000000..6071724
--- /dev/null
+++ b/patches/glibc/2_9/210-2.9-strlen-hack.patch
@@ -0,0 +1,109 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1020_all_glibc-2.9-strlen-hack.patch
+
+-= BEGIN original header =-
+http://sourceware.org/bugzilla/show_bug.cgi?id=5807
+http://www.cl.cam.ac.uk/~am21/progtricks.html
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/string/strlen.c glibc-2_9/string/strlen.c
+--- glibc-2_9.orig/string/strlen.c 2005-12-14 12:09:07.000000000 +0100
++++ glibc-2_9/string/strlen.c 2009-02-02 22:00:51.000000000 +0100
+@@ -32,7 +32,7 @@
+ {
+ const char *char_ptr;
+ const unsigned long int *longword_ptr;
+- unsigned long int longword, magic_bits, himagic, lomagic;
++ unsigned long int longword, himagic, lomagic;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+@@ -42,28 +42,14 @@
+ if (*char_ptr == '\0')
+ return char_ptr - str;
+
+- /* All these elucidatory comments refer to 4-byte longwords,
+- but the theory applies equally well to 8-byte longwords. */
+-
+ longword_ptr = (unsigned long int *) char_ptr;
+
+- /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+- the "holes." Note that there is a hole just to the left of
+- each byte, with an extra at the end:
+-
+- bits: 01111110 11111110 11111110 11111111
+- bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+-
+- The 1-bits make sure that carries propagate to the next 0-bit.
+- The 0-bits provide holes for carries to fall into. */
+- magic_bits = 0x7efefeffL;
+ himagic = 0x80808080L;
+ lomagic = 0x01010101L;
+ if (sizeof (longword) > 4)
+ {
+ /* 64-bit version of the magic. */
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+- magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
+ himagic = ((himagic << 16) << 16) | himagic;
+ lomagic = ((lomagic << 16) << 16) | lomagic;
+ }
+@@ -75,56 +61,12 @@
+ if *any of the four* bytes in the longword in question are zero. */
+ for (;;)
+ {
+- /* We tentatively exit the loop if adding MAGIC_BITS to
+- LONGWORD fails to change any of the hole bits of LONGWORD.
+-
+- 1) Is this safe? Will it catch all the zero bytes?
+- Suppose there is a byte with all zeros. Any carry bits
+- propagating from its left will fall into the hole at its
+- least significant bit and stop. Since there will be no
+- carry from its most significant bit, the LSB of the
+- byte to the left will be unchanged, and the zero will be
+- detected.
+-
+- 2) Is this worthwhile? Will it ignore everything except
+- zero bytes? Suppose every byte of LONGWORD has a bit set
+- somewhere. There will be a carry into bit 8. If bit 8
+- is set, this will carry into bit 16. If bit 8 is clear,
+- one of bits 9-15 must be set, so there will be a carry
+- into bit 16. Similarly, there will be a carry into bit
+- 24. If one of bits 24-30 is set, there will be a carry
+- into bit 31, so all of the hole bits will be changed.
+-
+- The one misfire occurs when bits 24-30 are clear and bit
+- 31 is set; in this case, the hole at bit 31 is not
+- changed. If we had access to the processor carry flag,
+- we could close this loophole by putting the fourth hole
+- at bit 32!
+-
+- So it ignores everything except 128's, when they're aligned
+- properly. */
+-
+ longword = *longword_ptr++;
+
+- if (
+-#if 0
+- /* Add MAGIC_BITS to LONGWORD. */
+- (((longword + magic_bits)
+-
+- /* Set those bits that were unchanged by the addition. */
+- ^ ~longword)
+-
+- /* Look at only the hole bits. If any of the hole bits
+- are unchanged, most likely one of the bytes was a
+- zero. */
+- & ~magic_bits)
+-#else
+- ((longword - lomagic) & himagic)
+-#endif
+- != 0)
++ /* This hack taken from Alan Mycroft's HAKMEMC postings.
++ See: http://www.cl.cam.ac.uk/~am21/progtricks.html */
++ if (((longword - lomagic) & ~longword & himagic) != 0)
+ {
+- /* Which of the bytes was the zero? If none of them were, it was
+- a misfire; continue the search. */
+
+ const char *cp = (const char *) (longword_ptr - 1);
+
diff --git a/patches/glibc/2_9/220-manual-no-perl.patch b/patches/glibc/2_9/220-manual-no-perl.patch
new file mode 100644
index 0000000..ec13ca9
--- /dev/null
+++ b/patches/glibc/2_9/220-manual-no-perl.patch
@@ -0,0 +1,29 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1030_all_glibc-manual-no-perl.patch
+
+-= BEGIN original header =-
+If we're using a cvs snapshot which updates the source files, and
+perl isn't installed yet, then we can't regen the docs. Not a big
+deal, so just whine a little and continue on our merry way.
+
+http://bugs.gentoo.org/60132
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/manual/Makefile glibc-2_9/manual/Makefile
+--- glibc-2_9.orig/manual/Makefile 2006-01-08 07:43:47.000000000 +0100
++++ glibc-2_9/manual/Makefile 2009-02-02 22:00:53.000000000 +0100
+@@ -104,9 +104,14 @@
+ libm-err.texi: stamp-libm-err
+ stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
+ $(dir)/libm-test-ulps))
++ifneq ($(PERL),no)
+ pwd=`pwd`; \
+ $(PERL) $< $$pwd/.. > libm-err-tmp
+ $(move-if-change) libm-err-tmp libm-err.texi
++else
++ echo "Unable to rebuild math docs, no perl installed"
++ touch libm-err.texi
++endif
+ touch $@
+
+ # Generate Texinfo files from the C source for the example programs.
diff --git a/patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch b/patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch
new file mode 100644
index 0000000..3ae9545
--- /dev/null
+++ b/patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch
@@ -0,0 +1,74 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1040_all_2.3.3-localedef-fix-trampoline.patch
+
+-= BEGIN original header =-
+#! /bin/sh -e
+
+# DP: Description: Fix localedef segfault when run under exec-shield,
+# PaX or similar. (#231438, #198099)
+# DP: Dpatch Author: James Troup <james@nocrew.org>
+# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
+# DP: Upstream status: Unknown
+# DP: Status Details: Unknown
+# DP: Date: 2004-03-16
+
+if [ $# -ne 2 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
+ -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/locale/programs/3level.h glibc-2_9/locale/programs/3level.h
+--- glibc-2_9.orig/locale/programs/3level.h 2007-07-16 02:54:59.000000000 +0200
++++ glibc-2_9/locale/programs/3level.h 2009-02-02 22:00:54.000000000 +0100
+@@ -203,6 +203,42 @@
+ }
+ }
+ }
++
++/* GCC ATM seems to do a poor job with pointers to nested functions passed
++ to inlined functions. Help it a little bit with this hack. */
++#define wchead_table_iterate(tp, fn) \
++do \
++ { \
++ struct wchead_table *t = (tp); \
++ uint32_t index1; \
++ for (index1 = 0; index1 < t->level1_size; index1++) \
++ { \
++ uint32_t lookup1 = t->level1[index1]; \
++ if (lookup1 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup1_shifted = lookup1 << t->q; \
++ uint32_t index2; \
++ for (index2 = 0; index2 < (1 << t->q); index2++) \
++ { \
++ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
++ if (lookup2 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup2_shifted = lookup2 << t->p; \
++ uint32_t index3; \
++ for (index3 = 0; index3 < (1 << t->p); index3++) \
++ { \
++ struct element_t *lookup3 \
++ = t->level3[index3 + lookup2_shifted]; \
++ if (lookup3 != NULL) \
++ fn ((((index1 << t->q) + index2) << t->p) + index3, \
++ lookup3); \
++ } \
++ } \
++ } \
++ } \
++ } \
++ } while (0)
++
+ #endif
+
+ #ifndef NO_FINALIZE
diff --git a/patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch b/patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch
new file mode 100644
index 0000000..1c69691
--- /dev/null
+++ b/patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch
@@ -0,0 +1,23 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1050_all_glibc-i386-LOAD_PIC_REG.patch
+
+-= BEGIN original header =-
+From e41177ea18a77a7f62328293b4fd49ae17482e77 Mon Sep 17 00:00:00 2001
+From: Ulrich Drepper <drepper@redhat.com>
+Date: Sat, 6 Dec 2008 00:15:17 +0000
+Subject: [PATCH] (_dl_tlsdesc_dynamic): Use LOAD_PIC_REG instead of doing things manually.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/i386/dl-tlsdesc.S glibc-2_9/sysdeps/i386/dl-tlsdesc.S
+--- glibc-2_9.orig/sysdeps/i386/dl-tlsdesc.S 2008-05-13 07:33:06.000000000 +0200
++++ glibc-2_9/sysdeps/i386/dl-tlsdesc.S 2009-02-02 22:00:56.000000000 +0100
+@@ -128,8 +128,7 @@
+ .Lslow:
+ cfi_adjust_cfa_offset (28)
+ movl %ebx, 16(%esp)
+- call __i686.get_pc_thunk.bx
+- addl $_GLOBAL_OFFSET_TABLE_, %ebx
++ LOAD_PIC_REG (bx)
+ call ___tls_get_addr@PLT
+ movl 16(%esp), %ebx
+ jmp .Lret
diff --git a/patches/glibc/2_9/250-resolv-dynamic.patch b/patches/glibc/2_9/250-resolv-dynamic.patch
new file mode 100644
index 0000000..66c3370
--- /dev/null
+++ b/patches/glibc/2_9/250-resolv-dynamic.patch
@@ -0,0 +1,44 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1055_all_glibc-resolv-dynamic.patch
+
+-= BEGIN original header =-
+ripped from SuSE
+
+if /etc/resolv.conf is updated, then make sure applications
+already running get the updated information.
+
+http://bugs.gentoo.org/177416
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/resolv/res_libc.c glibc-2_9/resolv/res_libc.c
+--- glibc-2_9.orig/resolv/res_libc.c 2006-10-11 10:59:28.000000000 +0200
++++ glibc-2_9/resolv/res_libc.c 2009-02-02 22:00:57.000000000 +0100
+@@ -22,6 +22,7 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ #include <bits/libc-lock.h>
++#include <sys/stat.h>
+
+
+ /* The following bit is copied from res_data.c (where it is #ifdef'ed
+@@ -95,6 +96,20 @@
+ __res_maybe_init (res_state resp, int preinit)
+ {
+ if (resp->options & RES_INIT) {
++ static time_t last_mtime, last_check;
++ time_t now;
++ struct stat statbuf;
++
++ time (&now);
++ if (now != last_check) {
++ last_check = now;
++ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
++ last_mtime = statbuf.st_mtime;
++ atomicinclock (lock);
++ atomicinc (__res_initstamp);
++ atomicincunlock (lock);
++ }
++ }
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0) {
+ __res_iclose (resp, true);
diff --git a/patches/glibc/2_9/260-fadvise64_64.patch b/patches/glibc/2_9/260-fadvise64_64.patch
new file mode 100644
index 0000000..3cd0020
--- /dev/null
+++ b/patches/glibc/2_9/260-fadvise64_64.patch
@@ -0,0 +1,30 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1070_all_glibc-fadvise64_64.patch
+
+-= BEGIN original header =-
+ripped from Debian
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2_9/sysdeps/unix/sysv/linux/posix_fadvise.c
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/posix_fadvise.c 2003-08-17 02:36:22.000000000 +0200
++++ glibc-2_9/sysdeps/unix/sysv/linux/posix_fadvise.c 2009-02-02 22:00:58.000000000 +0100
+@@ -35,6 +35,19 @@
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+ #else
++# ifdef __NR_fadvise64_64
++ INTERNAL_SYSCALL_DECL (err);
++ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
++ __LONG_LONG_PAIR ((long) (offset >> 31),
++ (long) offset),
++ __LONG_LONG_PAIR ((long) (len >> 31),
++ (long) len),
++ advise);
++ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++# else
+ return ENOSYS;
++# endif
+ #endif
+ }
diff --git a/patches/glibc/2_9/270-ldbl-nexttowardf.patch b/patches/glibc/2_9/270-ldbl-nexttowardf.patch
new file mode 100644
index 0000000..a0ffdf9
--- /dev/null
+++ b/patches/glibc/2_9/270-ldbl-nexttowardf.patch
@@ -0,0 +1,68 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1073_all_glibc-ldbl-nexttowardf.patch
+
+-= BEGIN original header =-
+ripped from Debian
+
+this change was made to generic __nexttowardf, but not the long double version
+
+2008-05-05 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include float.h.
+ (__nexttowardf): Use math_opt_barrier and
+ math_force_eval macros. If FLT_EVAL_METHOD is not 0, force
+ x to float using asm.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c glibc-2_9/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
+--- glibc-2_9.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c 1999-07-14 02:09:42.000000000 +0200
++++ glibc-2_9/sysdeps/ieee754/ldbl-128/s_nexttowardf.c 2009-02-02 22:00:59.000000000 +0100
+@@ -19,7 +19,8 @@
+ #endif
+
+ #include "math.h"
+-#include "math_private.h"
++#include <math_private.h>
++#include <float.h>
+
+ #ifdef __STDC__
+ float __nexttowardf(float x, long double y)
+@@ -44,10 +45,12 @@
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if(ix==0) { /* x == 0 */
+- float x2;
++ float u;
+ SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
+- x2 = x*x;
+- if(x2==x) return x2; else return x; /* raise underflow flag */
++ u = math_opt_barrier (x);
++ u = u * u;
++ math_force_eval (u); /* raise underflow flag */
++ return x;
+ }
+ if(hx>=0) { /* x > 0 */
+ if(hy<0||(ix>>23)>(iy>>48)-0x3f80
+@@ -67,13 +70,16 @@
+ }
+ }
+ hy = hx&0x7f800000;
+- if(hy>=0x7f800000) return x+x; /* overflow */
++ if(hy>=0x7f800000) {
++ x = x+x; /* overflow */
++ if (FLT_EVAL_METHOD != 0)
++ /* Force conversion to float. */
++ asm ("" : "+m"(x));
++ return x;
++ }
+ if(hy<0x00800000) { /* underflow */
+- float x2 = x*x;
+- if(x2!=x) { /* raise underflow flag */
+- SET_FLOAT_WORD(x2,hx);
+- return x2;
+- }
++ float u = x*x;
++ math_force_eval (u); /* raise underflow flag */
+ }
+ SET_FLOAT_WORD(x,hx);
+ return x;
diff --git a/patches/glibc/2_9/280-section-comments.patch b/patches/glibc/2_9/280-section-comments.patch
new file mode 100644
index 0000000..13b309e
--- /dev/null
+++ b/patches/glibc/2_9/280-section-comments.patch
@@ -0,0 +1,29 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1075_all_glibc-section-comments.patch
+
+-= BEGIN original header =-
+http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
+
+fixes building on some architectures (like m68k/arm/cris/etc...) because
+it does the right thing
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/include/libc-symbols.h glibc-2_9/include/libc-symbols.h
+--- glibc-2_9.orig/include/libc-symbols.h 2006-11-09 16:57:12.000000000 +0100
++++ glibc-2_9/include/libc-symbols.h 2009-02-02 22:01:00.000000000 +0100
+@@ -240,12 +240,12 @@
+ # define __make_section_unallocated(section_string)
+ # endif
+
+-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
++/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
+ section attributes on what looks like a comment to the assembler. */
+ # ifdef HAVE_SECTION_QUOTES
+-# define __sec_comment "\"\n\t#\""
++# define __sec_comment "\"\n#APP\n\t#\""
+ # else
+-# define __sec_comment "\n\t#"
++# define __sec_comment "\n#APP\n\t#"
+ # endif
+ # define link_warning(symbol, msg) \
+ __make_section_unallocated (".gnu.warning." #symbol) \
diff --git a/patches/glibc/2_9/290-no-inline-gmon.patch b/patches/glibc/2_9/290-no-inline-gmon.patch
new file mode 100644
index 0000000..e9df564
--- /dev/null
+++ b/patches/glibc/2_9/290-no-inline-gmon.patch
@@ -0,0 +1,38 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1080_all_glibc-no-inline-gmon.patch
+
+-= BEGIN original header =-
+http://bugs.gentoo.org/196245
+http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
+
+Attached is a patch to add __attribute__ ((noinline)) to
+call_gmon_start.
+
+Without this patch, the sec script that processed initfini.s removes a
+part of inlined call_gmon_start, causing undefined label errors.
+
+This patch solves the problem by forcing gcc not to inline
+call_gmon_start with __attribute__ ((noinline)).
+
+Tested by building for arm-none-lixux-gnueabi. OK to apply?
+
+Kazu Hirata
+
+2006-05-07 Kazu Hirata &lt;kazu@codesourcery.com&gt;
+
+ * sysdeps/generic/initfini.c (call_gmon_start): Add
+ __attribute__ ((noinline)).
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/generic/initfini.c glibc-2_9/sysdeps/generic/initfini.c
+--- glibc-2_9.orig/sysdeps/generic/initfini.c 2007-06-17 20:02:40.000000000 +0200
++++ glibc-2_9/sysdeps/generic/initfini.c 2009-02-02 22:01:01.000000000 +0100
+@@ -70,7 +70,7 @@
+ /* The beginning of _init: */
+ asm ("\n/*@_init_PROLOG_BEGINS*/");
+
+-static void
++static void __attribute__ ((noinline))
+ call_gmon_start(void)
+ {
+ extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
diff --git a/patches/glibc/2_9/300-2.9-check_native-headers.patch b/patches/glibc/2_9/300-2.9-check_native-headers.patch
new file mode 100644
index 0000000..c3b648b
--- /dev/null
+++ b/patches/glibc/2_9/300-2.9-check_native-headers.patch
@@ -0,0 +1,22 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1085_all_glibc-2.9-check_native-headers.patch
+
+-= BEGIN original header =-
+many ports hit this warning:
+../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
+../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
+
+snipped from suse
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/check_native.c glibc-2_9/sysdeps/unix/sysv/linux/check_native.c
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/check_native.c 2007-11-24 04:12:17.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/check_native.c 2009-02-02 22:01:03.000000000 +0100
+@@ -23,6 +23,7 @@
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <time.h>
+ #include <unistd.h>
+ #include <net/if.h>
diff --git a/patches/glibc/2_9/310-2.3.6-fix-pr631.patch b/patches/glibc/2_9/310-2.3.6-fix-pr631.patch
new file mode 100644
index 0000000..4147a6d
--- /dev/null
+++ b/patches/glibc/2_9/310-2.3.6-fix-pr631.patch
@@ -0,0 +1,50 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1090_all_glibc-2.3.6-fix-pr631.patch
+
+-= BEGIN original header =-
+From dank@kegel.com
+Wed Jun 15 09:12:43 PDT 2005
+
+Fixes
+
+build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r'
+build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent'
+... 53 lines deleted ...
+build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r'
+collect2: ld returned 1 exit status
+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
+
+when building glibc with --enable-static-nss.
+
+See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/Makeconfig glibc-2_9/Makeconfig
+--- glibc-2_9.orig/Makeconfig 2009-02-02 22:00:36.000000000 +0100
++++ glibc-2_9/Makeconfig 2009-02-02 22:01:04.000000000 +0100
+@@ -509,7 +509,7 @@
+
+ # The static libraries.
+ ifeq (yes,$(build-static))
+-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a
+ else
+ ifeq (yes,$(build-shared))
+ # We can try to link the programs with lib*_pic.a...
+diff -durN glibc-2_9.orig/elf/Makefile glibc-2_9/elf/Makefile
+--- glibc-2_9.orig/elf/Makefile 2008-10-31 21:35:11.000000000 +0100
++++ glibc-2_9/elf/Makefile 2009-02-02 22:01:04.000000000 +0100
+@@ -121,6 +121,13 @@
+ install-bin-script = ldd
+ endif
+
++ifeq (yes,$(build-static-nss))
++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
++ $(resolvobjdir)/libresolv.a
++endif
++
+ others = sprof sln
+ install-bin = sprof
+ others-static = sln
diff --git a/patches/glibc/2_9/320-2.9-assume-pipe2.patch b/patches/glibc/2_9/320-2.9-assume-pipe2.patch
new file mode 100644
index 0000000..e20fa94
--- /dev/null
+++ b/patches/glibc/2_9/320-2.9-assume-pipe2.patch
@@ -0,0 +1,59 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1095_all_glibc-2.9-assume-pipe2.patch
+
+-= BEGIN original header =-
+http://bugs.gentoo.org/250342
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
+
+we cant assume sock_cloexec and pipe2 are bound together as the former defines
+are found in glibc only while the latter are a combo of kernel headers and
+glibc. so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
+inside of glibc, we hit a problem. for example:
+
+#include <grp.h>
+#include <stdio.h>
+main()
+{
+ getgrnam("portage");
+ if (!popen("ls", "r"))
+ perror("popen()");
+}
+
+getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
+__have_sock_cloexec and __have_pipe2 to true. but if glibc was built against
+older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
+stub for it. so popen() will always fail as glibc assumes pipe2() works.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/include/unistd.h glibc-2_9/include/unistd.h
+--- glibc-2_9.orig/include/unistd.h 2008-07-27 20:23:17.000000000 +0200
++++ glibc-2_9/include/unistd.h 2009-02-02 22:01:05.000000000 +0100
+@@ -167,9 +167,6 @@
+ extern int __pause_nocancel (void) attribute_hidden;
+
+ extern int __have_sock_cloexec;
+-/* At lot of other functionality became available at the same time as
+- SOCK_CLOEXEC. Avoid defining separate variables for all of them
+- unless it is really necessary. */
+-#define __have_pipe2 __have_sock_cloexec
++extern int __have_pipe2;
+
+ #endif
+diff -durN glibc-2_9.orig/socket/have_sock_cloexec.c glibc-2_9/socket/have_sock_cloexec.c
+--- glibc-2_9.orig/socket/have_sock_cloexec.c 2008-07-25 18:46:23.000000000 +0200
++++ glibc-2_9/socket/have_sock_cloexec.c 2009-02-02 22:01:05.000000000 +0100
+@@ -16,9 +16,14 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include <fcntl.h>
+ #include <sys/socket.h>
+ #include <kernel-features.h>
+
+ #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+ int __have_sock_cloexec;
+ #endif
++
++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
++int __have_pipe2;
++#endif
diff --git a/patches/glibc/2_9/330-2.3.3-china.patch b/patches/glibc/2_9/330-2.3.3-china.patch
new file mode 100644
index 0000000..be0cc82
--- /dev/null
+++ b/patches/glibc/2_9/330-2.3.3-china.patch
@@ -0,0 +1,35 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1100_all_glibc-2.3.3-china.patch
+
+-= BEGIN original header =-
+-= END original header =-
+
+diff -durN glibc-2_9.orig/localedata/locales/zh_TW glibc-2_9/localedata/locales/zh_TW
+--- glibc-2_9.orig/localedata/locales/zh_TW 2004-11-01 00:42:28.000000000 +0100
++++ glibc-2_9/localedata/locales/zh_TW 2009-02-02 22:01:06.000000000 +0100
+@@ -1,7 +1,7 @@
+ comment_char %
+ escape_char /
+ %
+-% Chinese language locale for Taiwan R.O.C.
++% Chinese language locale for Taiwan
+ % charmap: BIG5-CP950
+ %
+ % Original Author:
+@@ -17,7 +17,7 @@
+ % Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
+
+ LC_IDENTIFICATION
+-title "Chinese locale for Taiwan R.O.C."
++title "Chinese locale for Taiwan"
+ source ""
+ address ""
+ contact ""
+@@ -25,7 +25,7 @@
+ tel ""
+ fax ""
+ language "Chinese"
+-territory "Taiwan R.O.C."
++territory "Taiwan"
+ revision "0.2"
+ date "2000-08-02"
+ %
diff --git a/patches/glibc/2_9/340-new-valencian-locale.patch b/patches/glibc/2_9/340-new-valencian-locale.patch
new file mode 100644
index 0000000..4aa6caa
--- /dev/null
+++ b/patches/glibc/2_9/340-new-valencian-locale.patch
@@ -0,0 +1,120 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1103_all_glibc-new-valencian-locale.patch
+
+-= BEGIN original header =-
+http://bugs.gentoo.org/show_bug.cgi?id=131815
+http://sourceware.org/bugzilla/show_bug.cgi?id=2522
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/localedata/SUPPORTED glibc-2_9/localedata/SUPPORTED
+--- glibc-2_9.orig/localedata/SUPPORTED 2008-09-16 23:24:57.000000000 +0200
++++ glibc-2_9/localedata/SUPPORTED 2009-02-02 22:01:08.000000000 +0100
+@@ -72,6 +72,8 @@
+ ca_ES.UTF-8/UTF-8 \
+ ca_ES/ISO-8859-1 \
+ ca_ES@euro/ISO-8859-15 \
++ca_ES.UTF-8@valencia/UTF-8 \
++ca_ES@valencia/ISO-8859-15 \
+ ca_FR.UTF-8/UTF-8 \
+ ca_FR/ISO-8859-15 \
+ ca_IT.UTF-8/UTF-8 \
+diff -durN glibc-2_9.orig/localedata/locales/ca_ES@valencia glibc-2_9/localedata/locales/ca_ES@valencia
+--- glibc-2_9.orig/localedata/locales/ca_ES@valencia 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2_9/localedata/locales/ca_ES@valencia 2009-02-02 22:01:08.000000000 +0100
+@@ -0,0 +1,96 @@
++comment_char %
++escape_char /
++%
++% Valencian (southern Catalan) locale for Spain with Euro
++%
++% Note that this locale is almost the same as ca_ES@euro. The point of having
++% a separate locale is only for PO translations, which have a lot of social
++% support and are very appreciated by the Valencian-speaking community.
++%
++% Contact: Jordi Mallach
++% Email: jordi@gnu.org
++% Tel:
++% Fax:
++% Language: ca
++% Territory: ES
++% Option: euro
++% Revision: 1.0
++% Date: 2006-04-06
++% Application: general
++% Users: general
++% Repertoiremap: mnemonic,ds
++% Charset: ISO-8859-15
++% Distribution and use is free, also
++% for commercial purposes.
++
++LC_IDENTIFICATION
++title "Valencian (southern Catalan) locale for Spain with Euro"
++source ""
++address ""
++contact "Jordi Mallach"
++email "jordi@gnu.org"
++tel ""
++fax ""
++language "Catalan"
++territory "Spain"
++revision "1.0"
++date "2006-04-06"
++%
++category "ca_ES@valencia:2006";LC_IDENTIFICATION
++category "ca_ES@valencia:2006";LC_CTYPE
++category "ca_ES@valencia:2006";LC_COLLATE
++category "ca_ES@valencia:2006";LC_MONETARY
++category "ca_ES@valencia:2006";LC_NUMERIC
++category "ca_ES@valencia:2006";LC_TIME
++category "ca_ES@valencia:2006";LC_MESSAGES
++category "ca_ES@valencia:2006";LC_PAPER
++category "ca_ES@valencia:2006";LC_NAME
++category "ca_ES@valencia:2006";LC_ADDRESS
++category "ca_ES@valencia:2006";LC_TELEPHONE
++category "ca_ES@valencia:2006";LC_MEASUREMENT
++
++END LC_IDENTIFICATION
++
++LC_CTYPE
++copy "i18n"
++END LC_CTYPE
++
++LC_COLLATE
++copy "ca_ES"
++END LC_COLLATE
++
++LC_MONETARY
++copy "ca_ES"
++END LC_MONETARY
++
++LC_NUMERIC
++copy "ca_ES"
++END LC_NUMERIC
++
++LC_TIME
++copy "ca_ES"
++END LC_TIME
++
++LC_MESSAGES
++copy "ca_ES"
++END LC_MESSAGES
++
++LC_PAPER
++copy "ca_ES"
++END LC_PAPER
++
++LC_NAME
++copy "ca_ES"
++END LC_NAME
++
++LC_ADDRESS
++copy "ca_ES"
++END LC_ADDRESS
++
++LC_TELEPHONE
++copy "ca_ES"
++END LC_TELEPHONE
++
++LC_MEASUREMENT
++copy "ca_ES"
++END LC_MEASUREMENT
diff --git a/patches/glibc/2_9/350-2.4-undefine-__i686.patch b/patches/glibc/2_9/350-2.4-undefine-__i686.patch
new file mode 100644
index 0000000..583a488
--- /dev/null
+++ b/patches/glibc/2_9/350-2.4-undefine-__i686.patch
@@ -0,0 +1,47 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1130_all_glibc-2.4-undefine-__i686.patch
+
+-= BEGIN original header =-
+If gcc is configured to generate i686 code or better by default (like
+when using the --with-arch=pentium3 configure option), then the __i686
+macro will always be defined automatically and thus screw up the
+compilation of some .S files.
+http://bugs.gentoo.org/131108
+http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html
+
+2006-04-25 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/i386/sysdep.h (__i686): Undefine.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2_9/nptl/sysdeps/pthread/pt-initfini.c
+--- glibc-2_9.orig/nptl/sysdeps/pthread/pt-initfini.c 2007-06-17 20:02:01.000000000 +0200
++++ glibc-2_9/nptl/sysdeps/pthread/pt-initfini.c 2009-02-02 22:01:09.000000000 +0100
+@@ -45,6 +45,9 @@
+ /* Embed an #include to pull in the alignment and .end directives. */
+ asm ("\n#include \"defs.h\"");
+
++/* Embed an #include to pull in asm settings. */
++asm ("\n#ifdef __i686__\n#include <sysdep.h>\n#endif");
++
+ /* The initial common code ends here. */
+ asm ("\n/*@HEADER_ENDS*/");
+
+diff -durN glibc-2_9.orig/sysdeps/i386/sysdep.h glibc-2_9/sysdeps/i386/sysdep.h
+--- glibc-2_9.orig/sysdeps/i386/sysdep.h 2006-10-28 08:44:03.000000000 +0200
++++ glibc-2_9/sysdeps/i386/sysdep.h 2009-02-02 22:01:09.000000000 +0100
+@@ -18,6 +18,14 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++/*
++ * When building for i686 targets or better, gcc automatically defines
++ * '__i686' to '1' for us which causes trouble when using section names
++ * like '__i686.get_pc_thunk.reg'. Since we check for __i686__ in the
++ * code, killing '__i686' shouldn't be a problem.
++ */
++#undef __i686
++
+ #include <sysdeps/generic/sysdep.h>
+
+ #ifdef __ASSEMBLER__
diff --git a/patches/glibc/2_9/360-2.8-nscd-one-fork.patch b/patches/glibc/2_9/360-2.8-nscd-one-fork.patch
new file mode 100644
index 0000000..c9bf014
--- /dev/null
+++ b/patches/glibc/2_9/360-2.8-nscd-one-fork.patch
@@ -0,0 +1,45 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1160_all_glibc-2.8-nscd-one-fork.patch
+
+-= BEGIN original header =-
+only fork one to assist in stop-start-daemon assumptions about daemon behavior
+
+http://bugs.gentoo.org/190785
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/nscd/nscd.c glibc-2_9/nscd/nscd.c
+--- glibc-2_9.orig/nscd/nscd.c 2008-03-29 19:08:12.000000000 +0100
++++ glibc-2_9/nscd/nscd.c 2009-02-02 22:01:10.000000000 +0100
+@@ -179,6 +179,9 @@
+ if (pid != 0)
+ exit (0);
+
++ if (write_pid (_PATH_NSCDPID) < 0)
++ dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
++
+ int nullfd = open (_PATH_DEVNULL, O_RDWR);
+ if (nullfd != -1)
+ {
+@@ -228,12 +231,6 @@
+ for (i = min_close_fd; i < getdtablesize (); i++)
+ close (i);
+
+- pid = fork ();
+- if (pid == -1)
+- error (EXIT_FAILURE, errno, _("cannot fork"));
+- if (pid != 0)
+- exit (0);
+-
+ setsid ();
+
+ if (chdir ("/") != 0)
+@@ -242,9 +239,6 @@
+
+ openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
+
+- if (write_pid (_PATH_NSCDPID) < 0)
+- dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+-
+ if (!init_logfile ())
+ dbg_log (_("Could not create log file"));
+
diff --git a/patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch b/patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch
new file mode 100644
index 0000000..46441d2
--- /dev/null
+++ b/patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch
@@ -0,0 +1,249 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/1503_hppa_glibc-2.7-hppa-nptl-carlos.patch
+
+-= BEGIN original header =-
+-= END original header =-
+
+diff -durN glibc-2_9.orig/elf/rtld.c glibc-2_9/elf/rtld.c
+--- glibc-2_9.orig/elf/rtld.c 2009-02-02 22:00:34.000000000 +0100
++++ glibc-2_9/elf/rtld.c 2009-02-02 22:01:12.000000000 +0100
+@@ -386,14 +386,14 @@
+ know it is available. We do not have to clear the memory if we
+ do not have to use the temporary bootstrap_map. Global variables
+ are initialized to zero by default. */
+-#ifndef DONT_USE_BOOTSTRAP_MAP
++#if !defined DONT_USE_BOOTSTRAP_MAP
+ # ifdef HAVE_BUILTIN_MEMSET
+ __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
+ # else
+- for (size_t cnt = 0;
+- cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
+- ++cnt)
+- bootstrap_map.l_info[cnt] = 0;
++ /* Clear the whole bootstrap_map structure */
++ for (char *cnt = (char *)&(bootstrap_map);
++ cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
++ *cnt++ = '\0');
+ # endif
+ # if USE___THREAD
+ bootstrap_map.l_tls_modid = 0;
+diff -durN glibc-2_9.orig/include/atomic.h glibc-2_9/include/atomic.h
+--- glibc-2_9.orig/include/atomic.h 2006-12-21 22:44:00.000000000 +0100
++++ glibc-2_9/include/atomic.h 2009-02-02 22:01:12.000000000 +0100
+@@ -174,7 +174,7 @@
+ __typeof (*(mem)) __atg5_value = (newvalue); \
+ \
+ do \
+- __atg5_oldval = *__atg5_memp; \
++ __atg5_oldval = *(volatile __typeof (mem))__atg5_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
+ __atg5_oldval), 0)); \
+@@ -195,7 +195,7 @@
+ __typeof (*(mem)) __atg6_value = (value); \
+ \
+ do \
+- __atg6_oldval = *__atg6_memp; \
++ __atg6_oldval = *(volatile __typeof (mem))__atg6_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg6_memp, \
+ __atg6_oldval \
+@@ -213,7 +213,7 @@
+ __typeof (*(mem)) __atg7_value = (value); \
+ \
+ do \
+- __atg7_oldv = *__atg7_memp; \
++ __atg7_oldv = *(volatile __typeof (mem))__atg7_memp; \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg7_memp, \
+ __atg7_oldv \
+@@ -231,7 +231,7 @@
+ __typeof (mem) __atg8_memp = (mem); \
+ __typeof (*(mem)) __atg8_value = (value); \
+ do { \
+- __atg8_oldval = *__atg8_memp; \
++ __atg8_oldval = *(volatile __typeof (mem))__atg8_memp; \
+ if (__atg8_oldval >= __atg8_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -248,7 +248,7 @@
+ __typeof (mem) __atg9_memp = (mem); \
+ __typeof (*(mem)) __atg9_value = (value); \
+ do { \
+- __atg9_oldv = *__atg9_memp; \
++ __atg9_oldv = *(volatile __typeof (mem))__atg9_memp; \
+ if (__atg9_oldv >= __atg9_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -266,7 +266,7 @@
+ __typeof (mem) __atg10_memp = (mem); \
+ __typeof (*(mem)) __atg10_value = (value); \
+ do { \
+- __atg10_oldval = *__atg10_memp; \
++ __atg10_oldval = *(volatile __typeof (mem))__atg10_memp; \
+ if (__atg10_oldval <= __atg10_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -350,7 +350,7 @@
+ \
+ do \
+ { \
+- __atg11_oldval = *__atg11_memp; \
++ __atg11_oldval = *(volatile __typeof (mem))__atg11_memp; \
+ if (__builtin_expect (__atg11_oldval <= 0, 0)) \
+ break; \
+ } \
+@@ -389,7 +389,7 @@
+ __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
+ \
+ do \
+- __atg14_old = (*__atg14_memp); \
++ __atg14_old = (*(volatile __typeof (mem))__atg14_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg14_memp, \
+ __atg14_old | __atg14_mask,\
+@@ -407,7 +407,7 @@
+ __typeof (*(mem)) __atg15_mask = (mask); \
+ \
+ do \
+- __atg15_old = (*__atg15_memp); \
++ __atg15_old = (*(volatile __typeof (mem))__atg15_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg15_memp, \
+ __atg15_old & __atg15_mask, \
+@@ -423,7 +423,7 @@
+ __typeof (*(mem)) __atg16_mask = (mask); \
+ \
+ do \
+- __atg16_old = (*__atg16_memp); \
++ __atg16_old = (*(volatile __typeof (mem))__atg16_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg16_memp, \
+ __atg16_old & __atg16_mask,\
+@@ -441,7 +441,7 @@
+ __typeof (*(mem)) __atg17_mask = (mask); \
+ \
+ do \
+- __atg17_old = (*__atg17_memp); \
++ __atg17_old = (*(volatile __typeof (mem))__atg17_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg17_memp, \
+ __atg17_old | __atg17_mask, \
+@@ -457,7 +457,7 @@
+ __typeof (*(mem)) __atg18_mask = (mask); \
+ \
+ do \
+- __atg18_old = (*__atg18_memp); \
++ __atg18_old = (*(volatile __typeof (mem))__atg18_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg18_memp, \
+ __atg18_old | __atg18_mask,\
+@@ -473,7 +473,7 @@
+ __typeof (*(mem)) __atg19_mask = (mask); \
+ \
+ do \
+- __atg19_old = (*__atg19_memp); \
++ __atg19_old = (*(volatile __typeof (mem))__atg19_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg19_memp, \
+ __atg19_old | __atg19_mask,\
+diff -durN glibc-2_9.orig/nptl/Makefile glibc-2_9/nptl/Makefile
+--- glibc-2_9.orig/nptl/Makefile 2008-11-12 14:38:23.000000000 +0100
++++ glibc-2_9/nptl/Makefile 2009-02-02 22:01:12.000000000 +0100
+@@ -262,9 +262,9 @@
+ # Files which must not be linked with libpthread.
+ tests-nolibpthread = tst-unload
+
+-# This sets the stack resource limit to 1023kb, which is not a multiple
+-# of the page size since every architecture's page size is > 1k.
+-tst-oddstacklimit-ENV = ; ulimit -s 1023;
++# This sets the stack resource limit to 8193kb, which is not a multiple
++# of the page size since every architecture's page size is 4096 bytes.
++tst-oddstacklimit-ENV = ; ulimit -s 8193;
+
+ distribute = eintr.c tst-cleanup4aux.c
+
+@@ -423,6 +423,35 @@
+ CFLAGS-tst-cleanupx4.c += -fexceptions
+ CFLAGS-tst-oncex3.c += -fexceptions
+ CFLAGS-tst-oncex4.c += -fexceptions
++
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
++
+ CFLAGS-tst-align.c += $(stack-align-test-flags)
+ CFLAGS-tst-align3.c += $(stack-align-test-flags)
+ CFLAGS-tst-initializers1.c = -W -Wall -Werror
+diff -durN glibc-2_9.orig/nptl/pthread_barrier_wait.c glibc-2_9/nptl/pthread_barrier_wait.c
+--- glibc-2_9.orig/nptl/pthread_barrier_wait.c 2007-08-01 06:18:50.000000000 +0200
++++ glibc-2_9/nptl/pthread_barrier_wait.c 2009-02-02 22:01:12.000000000 +0100
+@@ -64,7 +64,7 @@
+ do
+ lll_futex_wait (&ibarrier->curr_event, event,
+ ibarrier->private ^ FUTEX_PRIVATE_FLAG);
+- while (event == ibarrier->curr_event);
++ while (event == *(volatile unsigned int *)&ibarrier->curr_event);
+ }
+
+ /* Make sure the init_count is stored locally or in a register. */
+diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/Makefile glibc-2_9/nptl/sysdeps/pthread/Makefile
+--- glibc-2_9.orig/nptl/sysdeps/pthread/Makefile 2006-02-28 08:09:41.000000000 +0100
++++ glibc-2_9/nptl/sysdeps/pthread/Makefile 2009-02-02 22:01:12.000000000 +0100
+@@ -41,7 +41,9 @@
+
+ ifeq ($(have-forced-unwind),yes)
+ tests += tst-mqueue8x
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
+ CFLAGS-tst-mqueue8x.c += -fexceptions
++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s)
+ endif
+ endif
+
+diff -durN glibc-2_9.orig/stdio-common/Makefile glibc-2_9/stdio-common/Makefile
+--- glibc-2_9.orig/stdio-common/Makefile 2008-07-08 18:32:28.000000000 +0200
++++ glibc-2_9/stdio-common/Makefile 2009-02-02 22:01:12.000000000 +0100
+@@ -80,7 +80,7 @@
+ $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
+ endif
+
+-CFLAGS-vfprintf.c = -Wno-uninitialized
++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
+ CFLAGS-vfwprintf.c = -Wno-uninitialized
+ CFLAGS-tst-printf.c = -Wno-format
+ CFLAGS-tstdiomisc.c = -Wno-format
+diff -durN glibc-2_9.orig/sunrpc/clnt_udp.c glibc-2_9/sunrpc/clnt_udp.c
+--- glibc-2_9.orig/sunrpc/clnt_udp.c 2008-07-26 10:42:44.000000000 +0200
++++ glibc-2_9/sunrpc/clnt_udp.c 2009-02-02 22:01:12.000000000 +0100
+@@ -462,7 +462,7 @@
+ while (inlen < 0 && errno == EINTR);
+ if (inlen < 0)
+ {
+- if (errno == EWOULDBLOCK)
++ if (errno == EWOULDBLOCK || errno == EAGAIN)
+ continue;
+ cu->cu_error.re_errno = errno;
+ return (cu->cu_error.re_status = RPC_CANTRECV);
diff --git a/patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch b/patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..0529e90
--- /dev/null
+++ b/patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch
@@ -0,0 +1,71 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/3000_all_2.3.6-dl_execstack-PaX-support.patch
+
+-= BEGIN original header =-
+ With latest versions of glibc, a lot of apps failed on a PaX enabled
+ system with:
+ cannot enable executable stack as shared object requires: Permission denied
+
+ This is due to PaX 'exec-protecting' the stack, and ld.so then trying
+ to make the stack executable due to some libraries not containing the
+ PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003).
+
+ Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/nptl/allocatestack.c glibc-2_9/nptl/allocatestack.c
+--- glibc-2_9.orig/nptl/allocatestack.c 2008-08-16 00:35:27.000000000 +0200
++++ glibc-2_9/nptl/allocatestack.c 2009-02-02 22:01:20.000000000 +0100
+@@ -299,7 +299,8 @@
+ # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+ #endif
+ if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+- return errno;
++ if (errno != EACCES) /* PAX is enabled */
++ return errno;
+
+ return 0;
+ }
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2_9/sysdeps/unix/sysv/linux/dl-execstack.c
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/dl-execstack.c 2006-01-08 09:21:15.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/dl-execstack.c 2009-02-02 22:01:20.000000000 +0100
+@@ -63,7 +63,10 @@
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@
+ page -= size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
+@@ -115,7 +123,12 @@
+ page += size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
diff --git a/patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch b/patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch
new file mode 100644
index 0000000..13398b7
--- /dev/null
+++ b/patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch
@@ -0,0 +1,35 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/3010_all_2.3.3_pre20040117-pt_pax.patch
+
+-= BEGIN original header =-
+-= END original header =-
+
+diff -durN glibc-2_9.orig/elf/elf.h glibc-2_9/elf/elf.h
+--- glibc-2_9.orig/elf/elf.h 2008-10-01 21:41:34.000000000 +0200
++++ glibc-2_9/elf/elf.h 2009-02-02 22:01:21.000000000 +0100
+@@ -571,6 +571,7 @@
+ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
+ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
+ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
++#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
+ #define PT_LOSUNW 0x6ffffffa
+ #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
+@@ -584,6 +585,18 @@
+ #define PF_X (1 << 0) /* Segment is executable */
+ #define PF_W (1 << 1) /* Segment is writable */
+ #define PF_R (1 << 2) /* Segment is readable */
++#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
++#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
++#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
++#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
++#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
++#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
++#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
++#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
++#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
++#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
++#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
++#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
+ #define PF_MASKOS 0x0ff00000 /* OS-specific */
+ #define PF_MASKPROC 0xf0000000 /* Processor-specific */
+
diff --git a/patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch b/patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch
new file mode 100644
index 0000000..1d3dda4
--- /dev/null
+++ b/patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch
@@ -0,0 +1,198 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/3020_all_glibc-tests-sandbox-libdl-paths.patch
+
+-= BEGIN original header =-
+when glibc runs its tests, it does so by invoking the local library loader.
+in Gentoo, we build/run inside of our "sandbox" which itself is linked against
+libdl (so that it can load libraries and pull out symbols). the trouble
+is that when you upgrade from an older glibc to the new one, often times
+internal symbols change name or abi. this is normally OK as you cannot use
+libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
+we always say "keep all of the glibc libraries from the same build". but
+when glibc runs its tests, it uses dynamic paths to point to its new local
+copies of libraries. if the test doesnt use libdl, then glibc doesnt add
+its path, and when sandbox triggers the loading of libdl, glibc does so
+from the host system system. this gets us into the case of all libraries
+are from the locally compiled version of glibc except for libdl.so.
+
+Fix by Wormo
+
+http://bugs.gentoo.org/56898
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/grp/tst_fgetgrent.sh glibc-2_9/grp/tst_fgetgrent.sh
+--- glibc-2_9.orig/grp/tst_fgetgrent.sh 2001-07-06 06:54:46.000000000 +0200
++++ glibc-2_9/grp/tst_fgetgrent.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -24,7 +24,8 @@
+ rtld_installed_name=$1; shift
+
+ testout=${common_objpfx}/grp/tst_fgetgrent.out
+-library_path=${common_objpfx}
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
+ result=0
+
+diff -durN glibc-2_9.orig/iconvdata/run-iconv-test.sh glibc-2_9/iconvdata/run-iconv-test.sh
+--- glibc-2_9.orig/iconvdata/run-iconv-test.sh 2008-05-15 03:59:44.000000000 +0200
++++ glibc-2_9/iconvdata/run-iconv-test.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -34,7 +34,7 @@
+ export GCONV_PATH
+
+ # We have to have some directories in the library path.
+-LIBPATH=$codir:$codir/iconvdata
++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
+
+ # How the start the iconv(1) program.
+ ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
+diff -durN glibc-2_9.orig/iconvdata/tst-table.sh glibc-2_9/iconvdata/tst-table.sh
+--- glibc-2_9.orig/iconvdata/tst-table.sh 2002-04-24 23:39:35.000000000 +0200
++++ glibc-2_9/iconvdata/tst-table.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -59,8 +59,11 @@
+ irreversible=${charset}.irreversible
+ fi
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # iconv in one direction.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-table-from ${charset} \
+ > ${objpfx}tst-${charset}.table
+
+diff -durN glibc-2_9.orig/intl/tst-codeset.sh glibc-2_9/intl/tst-codeset.sh
+--- glibc-2_9.orig/intl/tst-codeset.sh 2005-04-06 04:18:35.000000000 +0200
++++ glibc-2_9/intl/tst-codeset.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -37,6 +37,9 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+ ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
+
+diff -durN glibc-2_9.orig/intl/tst-gettext.sh glibc-2_9/intl/tst-gettext.sh
+--- glibc-2_9.orig/intl/tst-gettext.sh 2004-08-15 21:28:18.000000000 +0200
++++ glibc-2_9/intl/tst-gettext.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -51,9 +51,12 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+ MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2_9.orig/intl/tst-gettext2.sh glibc-2_9/intl/tst-gettext2.sh
+--- glibc-2_9.orig/intl/tst-gettext2.sh 2005-05-04 19:54:48.000000000 +0200
++++ glibc-2_9/intl/tst-gettext2.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -65,8 +65,11 @@
+ LOCPATH=${objpfx}domaindir
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
+ cmp ${objpfx}tst-gettext2.out - <<EOF
+ String1 - Lang1: 1st string
+diff -durN glibc-2_9.orig/intl/tst-translit.sh glibc-2_9/intl/tst-translit.sh
+--- glibc-2_9.orig/intl/tst-translit.sh 2005-05-04 19:56:10.000000000 +0200
++++ glibc-2_9/intl/tst-translit.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -36,7 +36,10 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2_9.orig/malloc/tst-mtrace.sh glibc-2_9/malloc/tst-mtrace.sh
+--- glibc-2_9.orig/malloc/tst-mtrace.sh 2005-10-15 01:40:35.000000000 +0200
++++ glibc-2_9/malloc/tst-mtrace.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -24,9 +24,12 @@
+ status=0
+ trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
+ LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${common_objpfx}malloc/tst-mtrace || status=1
+
+ if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
+diff -durN glibc-2_9.orig/nptl/tst-tls6.sh glibc-2_9/nptl/tst-tls6.sh
+--- glibc-2_9.orig/nptl/tst-tls6.sh 2003-09-03 00:02:59.000000000 +0200
++++ glibc-2_9/nptl/tst-tls6.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -5,8 +5,8 @@
+ rtld_installed_name=$1; shift
+ logfile=$common_objpfx/nptl/tst-tls6.out
+
+-# We have to find libc and nptl
+-library_path=${common_objpfx}:${common_objpfx}nptl
++# We have to find libc and nptl (also libdl in case sandbox is in use)
++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
+ tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}/nptl/tst-tls5"
+
+diff -durN glibc-2_9.orig/posix/globtest.sh glibc-2_9/posix/globtest.sh
+--- glibc-2_9.orig/posix/globtest.sh 2007-02-14 20:52:33.000000000 +0100
++++ glibc-2_9/posix/globtest.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -18,7 +18,7 @@
+ esac
+
+ # We have to find the libc and the NSS modules.
+-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
+
+ # Since we use `sort' we must make sure to use the same locale everywhere.
+ LC_ALL=C
+diff -durN glibc-2_9.orig/posix/tst-getconf.sh glibc-2_9/posix/tst-getconf.sh
+--- glibc-2_9.orig/posix/tst-getconf.sh 2002-09-01 13:11:25.000000000 +0200
++++ glibc-2_9/posix/tst-getconf.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -10,7 +10,10 @@
+ else
+ rtld_installed_name=$1; shift
+ runit() {
+- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
++
++ # make sure libdl is also in path in case sandbox is in use
++ library_path=${common_objpfx}:${common_objpfx}/dlfcn
++ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
+ }
+ fi
+
+diff -durN glibc-2_9.orig/posix/wordexp-tst.sh glibc-2_9/posix/wordexp-tst.sh
+--- glibc-2_9.orig/posix/wordexp-tst.sh 2000-10-20 18:23:30.000000000 +0200
++++ glibc-2_9/posix/wordexp-tst.sh 2009-02-02 22:01:23.000000000 +0100
+@@ -19,8 +19,11 @@
+ "
+ export IFS
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ failed=0
+-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
+ cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
+ wordexp returned 0
diff --git a/patches/glibc/2_9/410-2.9-fnmatch.patch b/patches/glibc/2_9/410-2.9-fnmatch.patch
new file mode 100644
index 0000000..9865ed5
--- /dev/null
+++ b/patches/glibc/2_9/410-2.9-fnmatch.patch
@@ -0,0 +1,64 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/5021_all_2.9-fnmatch.patch
+
+-= BEGIN original header =-
+http://sourceware.org/ml/libc-hacker/2002-11/msg00071.html
+
+When fnmatch detects an invalid multibyte character it should fall back to
+single byte matching, so that "*" has a chance to match such a string.
+
+Andreas.
+
+2005-04-12 Andreas Schwab <schwab@suse.de>
+
+ * posix/fnmatch.c (fnmatch): If conversion to wide character
+ fails fall back to single byte matching.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/posix/fnmatch.c glibc-2_9/posix/fnmatch.c
+--- glibc-2_9.orig/posix/fnmatch.c 2007-07-28 22:35:00.000000000 +0200
++++ glibc-2_9/posix/fnmatch.c 2009-02-02 22:01:25.000000000 +0100
+@@ -327,6 +327,7 @@
+ # if HANDLE_MULTIBYTE
+ if (__builtin_expect (MB_CUR_MAX, 1) != 1)
+ {
++ const char *orig_pattern = pattern;
+ mbstate_t ps;
+ size_t n;
+ const char *p;
+@@ -382,10 +383,8 @@
+ wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+ n = mbsrtowcs (wstring, &p, n + 1, &ps);
+ if (__builtin_expect (n == (size_t) -1, 0))
+- /* Something wrong.
+- XXX Do we have to set `errno' to something which mbsrtows hasn't
+- already done? */
+- return -1;
++ /* Something wrong. Fall back to single byte matching. */
++ goto try_singlebyte;
+ if (p)
+ {
+ memset (&ps, '\0', sizeof (ps));
+@@ -397,10 +396,8 @@
+ prepare_wstring:
+ n = mbsrtowcs (NULL, &string, 0, &ps);
+ if (__builtin_expect (n == (size_t) -1, 0))
+- /* Something wrong.
+- XXX Do we have to set `errno' to something which mbsrtows hasn't
+- already done? */
+- return -1;
++ /* Something wrong. Fall back to single byte matching. */
++ goto try_singlebyte;
+ wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+ assert (mbsinit (&ps));
+ (void) mbsrtowcs (wstring, &string, n + 1, &ps);
+@@ -408,6 +405,9 @@
+
+ return internal_fnwmatch (wpattern, wstring, wstring + n,
+ flags & FNM_PERIOD, flags, NULL);
++
++ try_singlebyte:
++ pattern = orig_pattern;
+ }
+ # endif /* mbstate_t and mbsrtowcs or _LIBC. */
+
diff --git a/patches/glibc/2_9/420-dont-build-timezone.patch b/patches/glibc/2_9/420-dont-build-timezone.patch
new file mode 100644
index 0000000..05aeb82
--- /dev/null
+++ b/patches/glibc/2_9/420-dont-build-timezone.patch
@@ -0,0 +1,19 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/5063_all_glibc-dont-build-timezone.patch
+
+-= BEGIN original header =-
+timezone data has been split into the package sys-libs/timezone-data
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/Makeconfig glibc-2_9/Makeconfig
+--- glibc-2_9.orig/Makeconfig 2009-02-02 22:01:05.000000000 +0100
++++ glibc-2_9/Makeconfig 2009-02-02 22:01:27.000000000 +0100
+@@ -919,7 +919,7 @@
+ stdlib stdio-common libio malloc string wcsmbs time dirent \
+ grp pwd posix io termios resource misc socket sysvipc gmon \
+ gnulib iconv iconvdata wctype manual shadow po argp \
+- crypt nss localedata timezone rt conform debug \
++ crypt nss localedata rt conform debug \
+ $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
+
+ ifndef avoid-generated
diff --git a/patches/glibc/2_9/430-2.7-cross-compile-nptl.patch b/patches/glibc/2_9/430-2.7-cross-compile-nptl.patch
new file mode 100644
index 0000000..85c554d
--- /dev/null
+++ b/patches/glibc/2_9/430-2.7-cross-compile-nptl.patch
@@ -0,0 +1,57 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/5070_all_glibc-2.7-cross-compile-nptl.patch
+
+-= BEGIN original header =-
+A little hack for cross-compiling NPTL
+
+http://sourceware.org/ml/libc-alpha/2005-02/msg00043.html
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/configure glibc-2_9/nptl/sysdeps/pthread/configure
+--- glibc-2_9.orig/nptl/sysdeps/pthread/configure 2007-10-17 00:24:30.000000000 +0200
++++ glibc-2_9/nptl/sysdeps/pthread/configure 2009-02-02 22:01:28.000000000 +0100
+@@ -78,6 +78,10 @@
+ fi
+ { echo "$as_me:$LINENO: result: $libc_cv_forced_unwind" >&5
+ echo "${ECHO_T}$libc_cv_forced_unwind" >&6; }
++if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
++ echo "$as_me:$LINENO: forcing libc_cv_forced_unwind = yes for cross-compile"
++ libc_cv_forced_unwind=yes
++fi
+ if test $libc_cv_forced_unwind = yes; then
+ cat >>confdefs.h <<\_ACEOF
+ #define HAVE_FORCED_UNWIND 1
+@@ -141,6 +145,10 @@
+ { echo "$as_me:$LINENO: result: $libc_cv_c_cleanup" >&5
+ echo "${ECHO_T}$libc_cv_c_cleanup" >&6; }
+ CFLAGS="$old_CFLAGS"
++ if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
++ echo "$as_me:$LINENO: result: forcing libc_cv_c_cleanup = yes for cross-compile"
++ libc_cv_c_cleanup=yes
++ fi
+ if test $libc_cv_c_cleanup = no; then
+ { { echo "$as_me:$LINENO: error: the compiler must support C cleanup handling" >&5
+ echo "$as_me: error: the compiler must support C cleanup handling" >&2;}
+diff -durN glibc-2_9.orig/nptl/sysdeps/pthread/configure.in glibc-2_9/nptl/sysdeps/pthread/configure.in
+--- glibc-2_9.orig/nptl/sysdeps/pthread/configure.in 2003-12-03 07:50:01.000000000 +0100
++++ glibc-2_9/nptl/sysdeps/pthread/configure.in 2009-02-02 22:01:28.000000000 +0100
+@@ -28,6 +28,9 @@
+ struct _Unwind_Context *context;
+ _Unwind_GetCFA (context)],
+ libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)])
++if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
++ libc_cv_forced_unwind=yes
++fi
+ if test $libc_cv_forced_unwind = yes; then
+ AC_DEFINE(HAVE_FORCED_UNWIND)
+ dnl Check for C cleanup handling.
+@@ -41,6 +44,9 @@
+ puts ("test")],
+ libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)])
+ CFLAGS="$old_CFLAGS"
++ if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
++ libc_cv_c_cleanup=yes
++ fi
+ if test $libc_cv_c_cleanup = no; then
+ AC_MSG_ERROR([the compiler must support C cleanup handling])
+ fi
diff --git a/patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch b/patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch
new file mode 100644
index 0000000..8b5954c
--- /dev/null
+++ b/patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch
@@ -0,0 +1,249 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/6001_all_alpha-glibc-2.4-xstat.patch
+
+-= BEGIN original header =-
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=1026
+http://sourceware.org/ml/libc-alpha/2005-02/msg00122.html
+
+2005-02-26 GOTO Masanori <gotom@debian.or.jp>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define
+ __ASSUME_STAT64_SYSCALL.
+ * sysdeps/unix/sysv/linux/alpha/fxstat.c: Check
+ __ASSUME_STAT64_SYSCALL.
+ * sysdeps/unix/sysv/linux/alpha/fxstatat.c: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/lxstat.c: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/xstat.c: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/xstatconv.c: Don't define
+ __libc_missing_axp_stat64 when it's not needed.
+ * sysdeps/unix/sysv/linux/alpha/xstatconv.h: Likewise.
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstat.c
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstat.c 2004-03-11 03:58:44.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstat.c 2009-02-02 22:01:30.000000000 +0100
+@@ -35,27 +35,39 @@
+ __fxstat (int vers, int fd, struct stat *buf)
+ {
+ INTERNAL_SYSCALL_DECL (err);
+- int result, errno_out;
++ int result;
+ struct kernel_stat kbuf;
+
++#if __ASSUME_STAT64_SYSCALL > 0
++ if (vers == _STAT_VER_KERNEL64)
++ {
++ result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
++ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
++ return result;
++ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
++ return -1;
++ }
++#elif defined __NR_fstat64
+ if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
+ {
++ int errno_out;
+ result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+ if (errno_out != ENOSYS)
+- goto fail;
++ {
++ __set_errno (errno_out);
++ return -1;
++ }
+ __libc_missing_axp_stat64 = 1;
+ }
++#endif
+
+ result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return __xstat_conv (vers, &kbuf, buf);
+- errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+-
+- fail:
+- __set_errno (errno_out);
++ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+ hidden_def (__fxstat)
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstatat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstatat.c
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/fxstatat.c 2006-02-20 23:51:48.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/fxstatat.c 2009-02-02 22:01:30.000000000 +0100
+@@ -65,6 +65,20 @@
+ int result, errno_out;
+ struct kernel_stat kst;
+
++#if __ASSUME_STAT64_SYSCALL > 0
++ if (vers == _STAT_VER_KERNEL64)
++ {
++ if (flag & AT_SYMLINK_NOFOLLOW)
++ result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
++ else
++ result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
++
++ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
++ return result;
++ errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
++ goto fail;
++ }
++#elif defined __NR_stat64
+ if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
+ {
+ if (flag & AT_SYMLINK_NOFOLLOW)
+@@ -79,6 +93,7 @@
+ goto fail;
+ __libc_missing_axp_stat64 = 1;
+ }
++#endif
+
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst);
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/lxstat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/lxstat.c
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/lxstat.c 2004-03-11 03:58:44.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/lxstat.c 2009-02-02 22:01:30.000000000 +0100
+@@ -35,27 +35,39 @@
+ __lxstat (int vers, const char *name, struct stat *buf)
+ {
+ INTERNAL_SYSCALL_DECL (err);
+- int result, errno_out;
++ int result;
+ struct kernel_stat kbuf;
+
++#if __ASSUME_STAT64_SYSCALL > 0
++ if (vers == _STAT_VER_KERNEL64)
++ {
++ result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
++ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
++ return result;
++ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
++ return -1;
++ }
++#elif defined __NR_lstat64
+ if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
+ {
++ int errno_out;
+ result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+ if (errno_out != ENOSYS)
+- goto fail;
++ {
++ __set_errno (errno_out);
++ return -1;
++ }
+ __libc_missing_axp_stat64 = 1;
+ }
++#endif
+
+ result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return __xstat_conv (vers, &kbuf, buf);
+- errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+-
+- fail:
+- __set_errno (errno_out);
++ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+ hidden_def (__lxstat)
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstat.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstat.c
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstat.c 2004-03-11 03:58:44.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstat.c 2009-02-02 22:01:30.000000000 +0100
+@@ -35,27 +35,39 @@
+ __xstat (int vers, const char *name, struct stat *buf)
+ {
+ INTERNAL_SYSCALL_DECL (err);
+- int result, errno_out;
++ int result;
+ struct kernel_stat kbuf;
+
++#if __ASSUME_STAT64_SYSCALL > 0
++ if (vers == _STAT_VER_KERNEL64)
++ {
++ result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
++ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
++ return result;
++ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
++ return -1;
++ }
++#elif defined __NR_stat64
+ if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
+ {
++ int errno_out;
+ result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+ if (errno_out != ENOSYS)
+- goto fail;
++ {
++ __set_errno (errno_out);
++ return -1;
++ }
+ __libc_missing_axp_stat64 = 1;
+ }
++#endif
+
+ result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return __xstat_conv (vers, &kbuf, buf);
+- errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+-
+- fail:
+- __set_errno (errno_out);
++ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+ hidden_def (__xstat)
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.c glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.c
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.c 2004-03-11 03:58:44.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.c 2009-02-02 22:01:30.000000000 +0100
+@@ -22,9 +22,14 @@
+ #include <sys/stat.h>
+ #include <kernel_stat.h>
+ #include <xstatconv.h>
++#include <sys/syscall.h>
+
+
++#ifdef __NR_stat64
++# if __ASSUME_STAT64_SYSCALL == 0
+ int __libc_missing_axp_stat64;
++# endif
++#endif
+
+ int
+ __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.h
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/xstatconv.h 2006-01-08 09:21:16.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/xstatconv.h 2009-02-02 22:01:30.000000000 +0100
+@@ -18,7 +18,12 @@
+ 02111-1307 USA. */
+
+ #include <kernel-features.h>
++#include <sys/syscall.h>
+
++#ifdef __NR_stat64
++# if __ASSUME_STAT64_SYSCALL == 0
+ extern int __libc_missing_axp_stat64 attribute_hidden;
++# endif
++#endif
+ extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
+ attribute_hidden;
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2_9/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/kernel-features.h 2008-08-01 23:51:04.000000000 +0200
++++ glibc-2_9/sysdeps/unix/sysv/linux/kernel-features.h 2009-02-02 22:01:30.000000000 +0100
+@@ -395,6 +395,11 @@
+ # define __ASSUME_GETDENTS32_D_TYPE 1
+ #endif
+
++/* Starting with version 2.6.4, alpha stat64 syscalls are available. */
++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
++# define __ASSUME_STAT64_SYSCALL 1
++#endif
++
+ /* Starting with version 2.5.3, the initial location returned by `brk'
+ after exec is always rounded up to the next page. */
+ #if __LINUX_KERNEL_VERSION >= 132355
diff --git a/patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch b/patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch
new file mode 100644
index 0000000..401d5f7
--- /dev/null
+++ b/patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch
@@ -0,0 +1,32 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/6015_all_alpha-glibc-2.5-no-page-header.patch
+
+-= BEGIN original header =-
+2008-06-07 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions
+ from the kernel header to sys/user.h and remove the #include of
+ sys/user.h.
+
+-= END original header =-
+
+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
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/user.h 2001-07-06 06:56:13.000000000 +0200
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/user.h 2009-02-02 22:01:32.000000000 +0100
+@@ -23,7 +23,6 @@
+ only. Don't read too much into it. Don't use it for anything other
+ than gdb/strace unless you know what you are doing. */
+
+-#include <asm/page.h>
+ #include <asm/reg.h>
+
+ struct user
+@@ -41,6 +40,9 @@
+ char u_comm[32]; /* user command name */
+ };
+
++#define PAGE_SHIFT 13
++#define PAGE_SIZE (1 << PAGE_SHIFT)
++#define PAGE_MASK (~(PAGE_SIZE-1))
+ #define NBPG PAGE_SIZE
+ #define UPAGES 1
+ #define HOST_TEXT_START_ADDR (u.start_code)
diff --git a/patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch b/patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch
new file mode 100644
index 0000000..872a0de
--- /dev/null
+++ b/patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch
@@ -0,0 +1,38 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/6016_all_alpha-glibc-2.5-no-asm-elf-header.patch
+
+-= BEGIN original header =-
+2007-03-13 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some defines
+ from alpha's asm/elf.h
+
+-= END original header =-
+
+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
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sys/procfs.h 2001-07-06 06:56:13.000000000 +0200
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sys/procfs.h 2009-02-02 22:01:33.000000000 +0100
+@@ -29,10 +29,23 @@
+ #include <sys/types.h>
+ #include <sys/ucontext.h>
+ #include <sys/user.h>
+-#include <asm/elf.h>
+
+ __BEGIN_DECLS
+
++/*
++ * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
++ * I have no idea why that is so. For now, we just leave it at 33
++ * (32 general regs + processor status word).
++ */
++#define ELF_NGREG 33
++#define ELF_NFPREG 32
++
++typedef unsigned long elf_greg_t;
++typedef elf_greg_t elf_gregset_t[ELF_NGREG];
++
++typedef double elf_fpreg_t;
++typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
++
+ struct elf_siginfo
+ {
+ int si_signo; /* Signal number. */
diff --git a/patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch b/patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch
new file mode 100644
index 0000000..31da4d1
--- /dev/null
+++ b/patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch
@@ -0,0 +1,19 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/6017_all_alpha-glibc-2.8-creat.patch
+
+-= BEGIN original header =-
+alpha does not have a __NR_creat
+
+http://bugs.gentoo.org/227275
+http://sourceware.org/bugzilla/show_bug.cgi?id=6650
+
+-= END original header =-
+
+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
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2007-11-10 20:34:26.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2009-02-02 22:01:35.000000000 +0100
+@@ -1 +1,5 @@
+ /* Defined as alias for the syscall. */
++#include <sysdep.h>
++#ifndef __NR_creat
++#include "../../../../../io/creat64.c"
++#endif
diff --git a/patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch b/patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch
new file mode 100644
index 0000000..36f26f2
--- /dev/null
+++ b/patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch
@@ -0,0 +1,18 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/6018_all_alpha-glibc-2.8-cache-shape.patch
+
+-= BEGIN original header =-
+older verisons of glibc would build dl-sysdep as shared-only and dl-support as
+static-only. alpha hooks in a cache variable via dl-auxv.h. newer versions of
+glibc build dl-sysdep as both shared and static which means we now have symbol
+duplication for static builds with dl-sysdep and dl-support. since dl-sysdep
+is both shared/static, there is no point in hooking dl-support anymore, so we
+can punt it.
+
+-= END original header =-
+
+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
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/dl-support.c 2007-03-13 22:25:16.000000000 +0100
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-02-02 22:01:37.000000000 +0100
+@@ -1,2 +0,0 @@
+-#include "dl-auxv.h"
+-#include <elf/dl-support.c>
diff --git a/patches/glibc/2_9/490-ptr-mangling.patch b/patches/glibc/2_9/490-ptr-mangling.patch
new file mode 100644
index 0000000..b86b5d2
--- /dev/null
+++ b/patches/glibc/2_9/490-ptr-mangling.patch
@@ -0,0 +1,114 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/6018_all_glibc-ptr-mangling.patch
+
+-= BEGIN original header =-
+http://bugs.gentoo.org/201910
+
+For every arch, PTR_MANGLE and PTR_DEMANGLE defines are in
+sysdeps/unix/sysv/linux/<arch>/sysdep.h. But for alpha this is not true. The
+defines are in sysdeps/unix/alpha/sysdep.h and unix/sysv/linux/alpha/sysdep.h
+includes the first.
+
+This is a patch that fixes the issue and let alpha build, at the expense of
+disabling MANGLING in the non PIC case, but googling showed that the issue is
+known, and that nobody really cares about it.
+
+Info from: http://sourceware.org/bugzilla/show_bug.cgi?id=5216
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/unix/alpha/sysdep.h glibc-2_9/sysdeps/unix/alpha/sysdep.h
+--- glibc-2_9.orig/sysdeps/unix/alpha/sysdep.h 2006-03-03 12:21:28.000000000 +0100
++++ glibc-2_9/sysdeps/unix/alpha/sysdep.h 2009-02-02 22:01:39.000000000 +0100
+@@ -397,42 +397,4 @@
+ _sc_ret = _sc_0, _sc_err = _sc_19; \
+ }
+
+-/* Pointer mangling support. Note that tls access is slow enough that
+- we don't deoptimize things by placing the pointer check value there. */
+-
+-#include <stdint.h>
+-
+-#if defined NOT_IN_libc && defined IS_IN_rtld
+-# ifdef __ASSEMBLER__
+-# define PTR_MANGLE(dst, src, tmp) \
+- ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
+- ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
+- xor src, tmp, dst
+-# define PTR_MANGLE2(dst, src, tmp) \
+- xor src, tmp, dst
+-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+-# else
+-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+-# define PTR_MANGLE(var) \
+- (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+-# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+-# endif
+-#elif defined PIC
+-# ifdef __ASSEMBLER__
+-# define PTR_MANGLE(dst, src, tmp) \
+- ldq tmp, __pointer_chk_guard; \
+- xor src, tmp, dst
+-# define PTR_MANGLE2(dst, src, tmp) \
+- xor src, tmp, dst
+-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+-# else
+-extern uintptr_t __pointer_chk_guard attribute_relro;
+-# define PTR_MANGLE(var) \
+- (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
+-# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+-# endif
+-#endif
+-
+ #endif /* ASSEMBLER */
+diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2_9/sysdeps/unix/sysv/linux/alpha/sysdep.h
+--- glibc-2_9.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h 2007-08-21 10:07:28.000000000 +0200
++++ glibc-2_9/sysdeps/unix/sysv/linux/alpha/sysdep.h 2009-02-02 22:01:39.000000000 +0100
+@@ -98,4 +98,46 @@
+ INTERNAL_SYSCALL1(name, err_out, nr, args); \
+ })
+
++/* Pointer mangling support. Note that tls access is slow enough that
++ we don't deoptimize things by placing the pointer check value there. */
++
++#if defined NOT_IN_libc && defined IS_IN_rtld
++# ifdef __ASSEMBLER__
++# define PTR_MANGLE(dst, src, tmp) \
++ ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
++ ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
++ xor src, tmp, dst
++# define PTR_MANGLE2(dst, src, tmp) \
++ xor src, tmp, dst
++# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
++# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
++# else
++extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
++# define PTR_MANGLE(var) \
++ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
++# define PTR_DEMANGLE(var) PTR_MANGLE(var)
++# endif
++#elif defined PIC
++# ifdef __ASSEMBLER__
++# define PTR_MANGLE(dst, src, tmp) \
++ ldq tmp, __pointer_chk_guard; \
++ xor src, tmp, dst
++# define PTR_MANGLE2(dst, src, tmp) \
++ xor src, tmp, dst
++# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
++# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
++# else
++extern uintptr_t __pointer_chk_guard attribute_relro;
++# define PTR_MANGLE(var) \
++ (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
++# define PTR_DEMANGLE(var) PTR_MANGLE(var)
++# endif
++#else
++/* Pointer mangling is not yet supported for static libc on alpha. */
++# ifndef __ASSEMBLER__
++# define PTR_MANGLE(var) (void) (var)
++# define PTR_DEMANGLE(var) (void) (var)
++# endif
++#endif
++
+ #endif /* _LINUX_ALPHA_SYSDEP_H */
diff --git a/patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch b/patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch
new file mode 100644
index 0000000..66033aa
--- /dev/null
+++ b/patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch
@@ -0,0 +1,414 @@
+Original patch from: gentoo/src/patchsets/glibc/2.9/6120_all_ppc-glibc-2.9-atomic.patch
+
+-= BEGIN original header =-
+sniped from suse
+
+-= END original header =-
+
+diff -durN glibc-2_9.orig/sysdeps/powerpc/bits/atomic.h glibc-2_9/sysdeps/powerpc/bits/atomic.h
+--- glibc-2_9.orig/sysdeps/powerpc/bits/atomic.h 2007-03-26 22:15:28.000000000 +0200
++++ glibc-2_9/sysdeps/powerpc/bits/atomic.h 2009-02-02 22:01:40.000000000 +0100
+@@ -85,14 +85,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -102,14 +102,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -118,12 +118,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -132,11 +132,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -144,12 +144,12 @@
+ #define __arch_atomic_exchange_and_add_32(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stwcx. %1,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -157,12 +157,12 @@
+ #define __arch_atomic_increment_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -170,27 +170,27 @@
+ #define __arch_atomic_decrement_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_32(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
+ " cmpwi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stwcx. %1,0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+diff -durN glibc-2_9.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2_9/sysdeps/powerpc/powerpc32/bits/atomic.h
+--- glibc-2_9.orig/sysdeps/powerpc/powerpc32/bits/atomic.h 2007-03-26 22:15:45.000000000 +0200
++++ glibc-2_9/sysdeps/powerpc/powerpc32/bits/atomic.h 2009-02-02 22:01:40.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -60,14 +60,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+diff -durN glibc-2_9.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2_9/sysdeps/powerpc/powerpc64/bits/atomic.h
+--- glibc-2_9.orig/sysdeps/powerpc/powerpc64/bits/atomic.h 2007-03-26 22:16:03.000000000 +0200
++++ glibc-2_9/sysdeps/powerpc/powerpc64/bits/atomic.h 2009-02-02 22:01:40.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (" clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -61,14 +61,14 @@
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+ " clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_REL "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -82,14 +82,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -98,14 +98,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -115,14 +115,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -132,14 +132,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -148,12 +148,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -162,11 +162,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -174,12 +174,12 @@
+ #define __arch_atomic_exchange_and_add_64(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stdcx. %1,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -187,12 +187,12 @@
+ #define __arch_atomic_increment_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -200,27 +200,27 @@
+ #define __arch_atomic_decrement_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_64(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
+ " cmpdi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stdcx. %1,0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })