summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Schwebel <r.schwebel@pengutronix.de>2009-04-28 07:17:07 +0000
committerRobert Schwebel <r.schwebel@pengutronix.de>2009-04-28 07:17:07 +0000
commit85540acfc376c5e59e855b9e888c186a21b2f34f (patch)
tree98ce665d423bf4a203427d1fabecbb5a34b041ab
parent05ce830e9cd2d1b9c5fafabb78a0f8a3d932454a (diff)
downloadOSELAS.Toolchain-85540acfc376c5e59e855b9e888c186a21b2f34f.tar.gz
OSELAS.Toolchain-85540acfc376c5e59e855b9e888c186a21b2f34f.tar.xz
* patches: add patches for gcc-4.4.0 / glibc-2.9 / binutils-2.19.1
git-svn-id: https://svn.pengutronix.de/svn/oselas/toolchain/trunks/OSELAS.Toolchain-trunk@10782 f8d472c7-5700-0410-ac5a-87979cec3adf
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/03_all_binutils-2.15.92.0.2-ppc64-pie.patch22
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/04_all_binutils-2.15.92.0.2-place-orphan.patch22
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/07_all_binutils-2.18-windres.patch18
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/08_all_binutils-RPATH_ENVVAR-smack.patch19
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/09_all_binutils-ld-tests-CXXFLAGS.patch33
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/12_all_sh-targets.patch56
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/18_all_binutils-makeinfo-version.patch38
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/25_all_binutils-for-build-flags.patch23
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/30_all_binutils-multitarget-fixup.patch30
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/33_all_binutils-gnu-relro-fixups.patch536
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/42_all_012_check_ldrunpath_length.patch52
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/66_all_binutils-2.17.50.0.2-warn-textrel.patch66
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/76_all_only-use-new-ld-dtags.patch.disabled31
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/91_all_libiberty-pic.patch16
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/no_63_all_binutils-2.18-pt-pax-flags-20070828.patch263
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/no_76_all_use-new-ld-dtags.patch10
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/no_77_all_generate-gnu-hash.patch6
-rw-r--r--patches/binutils-2.19.1/generic/gentoo/no_78_all_use-relro.patch6
-rw-r--r--patches/binutils-2.19.1/generic/oe/binutils-2.16.91.0.6-objcopy-rename-errorcode.patch39
-rw-r--r--patches/binutils-2.19.1/generic/series18
-rw-r--r--patches/binutils-2.19.1/generic/uclibc/110-arm-eabi-conf.patch31
-rw-r--r--patches/gcc-4.4.0/generic/arm-softfloat.diff52
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/00_all_gcc-4.1-alpha-mieee-default.patch40
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/00_all_gcc-trampolinewarn.patch41
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/03_all_gcc43-java-nomulti.patch44
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/11_all_gcc-netbsd-symbolic.patch18
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/14_all_gcc-sparc64-bsd.patch34
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/18_all_904-flatten-switch-stmt-00.patch80
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch16
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/53_all_gcc4-superh-default-multilib.patch29
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/54_all_300-libstdc++-pic.patch62
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/61_all_gcc4-ia64-noteGNUstack.patch112
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/61_all_gcc43-pr24170.patch69
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/62_all_gcc4-noteGNUstack.patch140
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/64_all_gcc43-pr34571.patch27
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/66_all_gcc43-pr25343.patch25
-rw-r--r--patches/gcc-4.4.0/generic/gentoo/74_all_sh-pr24836.patch34
-rw-r--r--patches/gcc-4.4.0/generic/no-host-includes.diff56
-rw-r--r--patches/gcc-4.4.0/generic/series31
-rw-r--r--patches/gcc-4.4.0/generic/uclibc/100-uclibc-conf.patch42
-rw-r--r--patches/gcc-4.4.0/generic/uclibc/104-gnuhurd-uclibc-conf.patch18
-rw-r--r--patches/gcc-4.4.0/generic/uclibc/301-missing-execinfo_h.patch17
-rw-r--r--patches/gcc-4.4.0/generic/uclibc/302-c99-snprintf.patch17
-rw-r--r--patches/gcc-4.4.0/generic/uclibc/305-libmudflap-susv3-legacy.patch53
-rw-r--r--patches/gcc-4.4.0/generic/uclibc/993-arm_insn-opinit-RTX_CODE-fixup.patch41
-rw-r--r--patches/gcc-4.4.0/generic/uclibc/995-short-enums.diff35
-rw-r--r--patches/gcc-4.4.0/generic/uclibc/998-gcc-4.3.0-fix-header.00.patch19
-rw-r--r--patches/glibc-2.9/generic/0001--PRIVATE_FUTEX_OFFSET-Guard-sym-definition-with-i.patch33
-rw-r--r--patches/glibc-2.9/generic/configure-sane_readelf.diff119
-rw-r--r--patches/glibc-2.9/generic/configure_in-sane_readelf.diff35
-rw-r--r--patches/glibc-2.9/generic/gentoo/0030_all_glibc-respect-env-CPPFLAGS.patch32
-rw-r--r--patches/glibc-2.9/generic/gentoo/0040_all_glibc-i586-chk.patch32
-rw-r--r--patches/glibc-2.9/generic/gentoo/0070_all_glibc-i386-x86_64-revert-clone-cfi.patch55
-rw-r--r--patches/glibc-2.9/generic/gentoo/1010_all_glibc-queue-header-updates.patch89
-rw-r--r--patches/glibc-2.9/generic/gentoo/1030_all_glibc-manual-no-perl.patch29
-rw-r--r--patches/glibc-2.9/generic/gentoo/1040_all_2.3.3-localedef-fix-trampoline.patch74
-rw-r--r--patches/glibc-2.9/generic/gentoo/1050_all_glibc-posix-awk.patch23
-rw-r--r--patches/glibc-2.9/generic/gentoo/1055_all_glibc-resolv-dynamic.patch44
-rw-r--r--patches/glibc-2.9/generic/gentoo/1075_all_glibc-section-comments.patch29
-rw-r--r--patches/glibc-2.9/generic/gentoo/1080_all_glibc-no-inline-gmon.patch38
-rw-r--r--patches/glibc-2.9/generic/gentoo/1090_all_glibc-2.3.6-fix-pr631.patch52
-rw-r--r--patches/glibc-2.9/generic/gentoo/1100_all_glibc-2.3.3-china.patch35
-rw-r--r--patches/glibc-2.9/generic/gentoo/1103_all_glibc-new-valencian-locale.patch122
-rw-r--r--patches/glibc-2.9/generic/gentoo/1120_all_glibc-2.5-strict-aliasing.patch91
-rw-r--r--patches/glibc-2.9/generic/gentoo/1130_all_glibc-2.4-undefine-__i686.patch49
-rw-r--r--patches/glibc-2.9/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch73
-rw-r--r--patches/glibc-2.9/generic/gentoo/3010_all_2.3.3_pre20040117-pt_pax.patch35
-rw-r--r--patches/glibc-2.9/generic/gentoo/6400_all_sh-glibc-2.3.2-fpscr_values.patch42
-rw-r--r--patches/glibc-2.9/generic/gentoo/6415_all_sh-glibc-2.5-no-asm-user-header.patch76
-rw-r--r--patches/glibc-2.9/generic/gentoo/6416_all_sh-glibc-2.5-no-asm-elf-header.patch33
-rw-r--r--patches/glibc-2.9/generic/gentoo/6645_all_glibc-mips_shn_undef-hack.patch29
-rw-r--r--patches/glibc-2.9/generic/glibc-2.5_stdlib_longlong.h37
-rw-r--r--patches/glibc-2.9/generic/glibc-configure-apple-as.patch47
-rw-r--r--patches/glibc-2.9/generic/glibc-configure-old-gcc.patch17
-rw-r--r--patches/glibc-2.9/generic/make-install-lib-all.patch45
-rw-r--r--patches/glibc-2.9/generic/series30
-rw-r--r--patches/glibc-ports-2.9/generic/gentoo/6224_all_glibc-2.7-lowlevellock-includes.patch28
-rw-r--r--patches/glibc-ports-2.9/generic/gentoo/6605_all_glibc-2.4-fpu-cw-mips.patch19
-rw-r--r--patches/glibc-ports-2.9/generic/glibc-2.5_ports_sysdeps_arm_mp_clz_tab.c33
-rw-r--r--patches/glibc-ports-2.9/generic/series6
-rw-r--r--patches/glibc-ports-2.9/generic/sysdeps_mips_mips32_Makefile-bootstrap.diff28
81 files changed, 4046 insertions, 0 deletions
diff --git a/patches/binutils-2.19.1/generic/gentoo/03_all_binutils-2.15.92.0.2-ppc64-pie.patch b/patches/binutils-2.19.1/generic/gentoo/03_all_binutils-2.15.92.0.2-ppc64-pie.patch
new file mode 100644
index 0000000..1e16139
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/03_all_binutils-2.15.92.0.2-ppc64-pie.patch
@@ -0,0 +1,22 @@
+---
+ bfd/elf64-ppc.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+Index: binutils-2.19.1/bfd/elf64-ppc.c
+===================================================================
+--- binutils-2.19.1.orig/bfd/elf64-ppc.c
++++ binutils-2.19.1/bfd/elf64-ppc.c
+@@ -11294,7 +11294,12 @@ ppc64_elf_relocate_section (bfd *output_
+ else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
+ && !is_opd
+ && r_type != R_PPC64_TOC)
+- outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
++ {
++ outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
++ if (h->elf.dynindx == -1
++ && h->elf.root.type == bfd_link_hash_undefweak)
++ memset (&outrel, 0, sizeof outrel);
++ }
+ else
+ {
+ /* This symbol is local, or marked to become local,
diff --git a/patches/binutils-2.19.1/generic/gentoo/04_all_binutils-2.15.92.0.2-place-orphan.patch b/patches/binutils-2.19.1/generic/gentoo/04_all_binutils-2.15.92.0.2-place-orphan.patch
new file mode 100644
index 0000000..cfc9b05
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/04_all_binutils-2.15.92.0.2-place-orphan.patch
@@ -0,0 +1,22 @@
+2003-08-05 Jakub Jelinek <jakub@redhat.com>
+
+ * emulparams/elf64ppc.sh (OTHER_GOT_RELOC_SECTIONS): Add .rela.opd.
+
+---
+ ld/emulparams/elf64ppc.sh | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Index: binutils-2.18/ld/emulparams/elf64ppc.sh
+===================================================================
+--- binutils-2.18.orig/ld/emulparams/elf64ppc.sh
++++ binutils-2.18/ld/emulparams/elf64ppc.sh
+@@ -28,7 +28,8 @@ else
+ .toc 0 : { *(.toc) }"
+ fi
+ OTHER_GOT_RELOC_SECTIONS="
+- .rela.toc ${RELOCATING-0} : { *(.rela.toc) }"
++ .rela.toc ${RELOCATING-0} : { *(.rela.toc) }
++ .rela.opd ${RELOCATING-0} : { *(.rela.opd) }"
+ OTHER_READWRITE_SECTIONS="
+ .toc1 ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) }
+ .opd ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { KEEP (*(.opd)) }
diff --git a/patches/binutils-2.19.1/generic/gentoo/07_all_binutils-2.18-windres.patch b/patches/binutils-2.19.1/generic/gentoo/07_all_binutils-2.18-windres.patch
new file mode 100644
index 0000000..659a5a6
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/07_all_binutils-2.18-windres.patch
@@ -0,0 +1,18 @@
+http://sourceware.org/bugzilla/show_bug.cgi?id=4987
+
+---
+ binutils/resrc.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: binutils-2.19.1/binutils/resrc.c
+===================================================================
+--- binutils-2.19.1.orig/binutils/resrc.c
++++ binutils-2.19.1/binutils/resrc.c
+@@ -439,6 +439,7 @@ read_rc_file (const char *filename, cons
+ if (filename == NULL)
+ filename = "-";
+ /* Setup the default resource import path taken from input file. */
+++ if (filename != NULL && (strchr (filename, '/') != NULL || strchr (filename, '\\') != NULL))
+ else if (strchr (filename, '/') != NULL || strchr (filename, '\\') != NULL)
+ {
+ char *edit, *dir;
diff --git a/patches/binutils-2.19.1/generic/gentoo/08_all_binutils-RPATH_ENVVAR-smack.patch b/patches/binutils-2.19.1/generic/gentoo/08_all_binutils-RPATH_ENVVAR-smack.patch
new file mode 100644
index 0000000..ee30e1d
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/08_all_binutils-RPATH_ENVVAR-smack.patch
@@ -0,0 +1,19 @@
+http://sourceware.org/ml/binutils/2007-07/msg00401.html
+http://sourceware.org/bugzilla/show_bug.cgi?id=4970
+
+---
+ configure | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: binutils-2.19.1/configure
+===================================================================
+--- binutils-2.19.1.orig/configure
++++ binutils-2.19.1/configure
+@@ -5430,6 +5430,7 @@ case "${target}" in
+ md_exec_prefix=/usr/ccs/bin
+ ;;
+ esac
++RPATH_ENVVAR="cant_touch_this_nah_nah_nah"
+
+ extra_arflags_for_target=
+ extra_nmflags_for_target=
diff --git a/patches/binutils-2.19.1/generic/gentoo/09_all_binutils-ld-tests-CXXFLAGS.patch b/patches/binutils-2.19.1/generic/gentoo/09_all_binutils-ld-tests-CXXFLAGS.patch
new file mode 100644
index 0000000..3d65169
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/09_all_binutils-ld-tests-CXXFLAGS.patch
@@ -0,0 +1,33 @@
+http://sourceware.org/ml/binutils/2007-08/msg00411.html
+
+forcing CFLAGS against C++ builds causes false failures
+
+---
+ ld/testsuite/lib/ld-lib.exp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+Index: binutils-2.19.1/ld/testsuite/lib/ld-lib.exp
+===================================================================
+--- binutils-2.19.1.orig/ld/testsuite/lib/ld-lib.exp
++++ binutils-2.19.1/ld/testsuite/lib/ld-lib.exp
+@@ -225,7 +225,11 @@ proc default_ld_compile { cc source obje
+ remote_file build delete "$object"
+ remote_file host delete "$object"
+
+- set flags "-I$srcdir/$subdir"
++ if {[string match "*.cc" $source]} then {
++ set flags "-I$srcdir/$subdir $CXXFLAGS"
++ } else {
++ set flags "-I$srcdir/$subdir $CFLAGS"
++ }
+
+ # If we are compiling with gcc, we want to add gcc_gas_flag to
+ # flags. Rather than determine this in some complex way, we guess
+@@ -1111,6 +1115,7 @@ proc run_ld_link_tests { ldtests } {
+ global env
+ global CC
+ global CFLAGS
++ global CXXFLAGS
+
+ foreach testitem $ldtests {
+ set testname [lindex $testitem 0]
diff --git a/patches/binutils-2.19.1/generic/gentoo/12_all_sh-targets.patch b/patches/binutils-2.19.1/generic/gentoo/12_all_sh-targets.patch
new file mode 100644
index 0000000..e79210e
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/12_all_sh-targets.patch
@@ -0,0 +1,56 @@
+r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
+
+Likewise, binutils has no idea about any of these new targets either, so we
+fix that up too.. now we're able to actually build a real toolchain for
+sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
+inept targets than that one, really. Go look, I promise).
+
+---
+ configure | 4 ++--
+ configure.ac | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+Index: binutils-2.19.1/configure
+===================================================================
+--- binutils-2.19.1.orig/configure
++++ binutils-2.19.1/configure
+@@ -2281,7 +2281,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -2606,7 +2606,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[3456789]86-*-vsta) ;; # don't add gprof back in
+ i[3456789]86-*-go32*) ;; # don't add gprof back in
+Index: binutils-2.19.1/configure.ac
+===================================================================
+--- binutils-2.19.1.orig/configure.ac
++++ binutils-2.19.1/configure.ac
+@@ -530,7 +530,7 @@ case "${target}" in
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -855,7 +855,7 @@ case "${target}" in
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[[3456789]]86-*-vsta) ;; # don't add gprof back in
+ i[[3456789]]86-*-go32*) ;; # don't add gprof back in
diff --git a/patches/binutils-2.19.1/generic/gentoo/18_all_binutils-makeinfo-version.patch b/patches/binutils-2.19.1/generic/gentoo/18_all_binutils-makeinfo-version.patch
new file mode 100644
index 0000000..bdbc340
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/18_all_binutils-makeinfo-version.patch
@@ -0,0 +1,38 @@
+http://bugs.gentoo.org/195074
+
+2007-09-15 Alan Modra <amodra@bigpond.net.au>
+
+ * configure.ac: Correct makeinfo version check.
+ * configure: Regenerate.
+
+---
+ configure | 2 +-
+ configure.ac | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: binutils-2.18/configure.ac
+===================================================================
+--- binutils-2.18.orig/configure.ac
++++ binutils-2.18/configure.ac
+@@ -2403,7 +2403,7 @@ changequote(,)
+ # For an installed makeinfo, we require it to be from texinfo 4.4 or
+ # higher, else we use the "missing" dummy.
+ if ${MAKEINFO} --version \
+- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
++ | egrep 'texinfo[^0-9]*(4\.([4-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
+ :
+ else
+ MAKEINFO="$MISSING makeinfo"
+Index: binutils-2.18/configure
+===================================================================
+--- binutils-2.18.orig/configure
++++ binutils-2.18/configure
+@@ -6129,7 +6129,7 @@ case " $build_configdirs " in
+ # For an installed makeinfo, we require it to be from texinfo 4.4 or
+ # higher, else we use the "missing" dummy.
+ if ${MAKEINFO} --version \
+- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
++ | egrep 'texinfo[^0-9]*(4\.([4-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
+ :
+ else
+ MAKEINFO="$MISSING makeinfo"
diff --git a/patches/binutils-2.19.1/generic/gentoo/25_all_binutils-for-build-flags.patch b/patches/binutils-2.19.1/generic/gentoo/25_all_binutils-for-build-flags.patch
new file mode 100644
index 0000000..8c2cf03
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/25_all_binutils-for-build-flags.patch
@@ -0,0 +1,23 @@
+only default CFLAGS_FOR_BUILD to host CFLAGS when build and host are the same
+
+http://bugs.gentoo.org/192959
+
+---
+ configure | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+Index: binutils-2.18/configure
+===================================================================
+--- binutils-2.18.orig/configure
++++ binutils-2.18/configure
+@@ -5778,7 +5778,9 @@ esac
+
+ # Allow the user to override the flags for
+ # our build compiler if desired.
+-CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
++if test x"${build}" = x"${host}" ; then
++ CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
++fi
+
+ # On Canadian crosses, we'll be searching the right directories for
+ # the previously-installed cross compiler, so don't bother to add
diff --git a/patches/binutils-2.19.1/generic/gentoo/30_all_binutils-multitarget-fixup.patch b/patches/binutils-2.19.1/generic/gentoo/30_all_binutils-multitarget-fixup.patch
new file mode 100644
index 0000000..70651c4
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/30_all_binutils-multitarget-fixup.patch
@@ -0,0 +1,30 @@
+Fix from upstream for --enable-targets=all on an x86_64 multilib system.
+
+http://sourceware.org/ml/binutils/2007-09/msg00137.html
+http://sourceware.org/ml/binutils/2007-09/msg00162.html
+
+2007-09-14 Alan Modra <amodra@bigpond.net.au>
+
+ * format.c (bfd_check_format_matches): Record matching targets even
+ when "matching" is NULL to allow bfd_associated_vector matches.
+ Consolidate error return code. Consolidate ok return code. Always
+ restore original target and format on error.
+
+---
+ bfd/format.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+Index: binutils-2.19.1/bfd/format.c
+===================================================================
+--- binutils-2.19.1.orig/bfd/format.c
++++ binutils-2.19.1/bfd/format.c
+@@ -128,6 +128,9 @@ bfd_check_format_matches (bfd *abfd, bfd
+ if (matching != NULL)
+ *matching = NULL;
+
++ if (matching != NULL)
++ *matching = NULL;
++
+ if (!bfd_read_p (abfd)
+ || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
+ {
diff --git a/patches/binutils-2.19.1/generic/gentoo/33_all_binutils-gnu-relro-fixups.patch b/patches/binutils-2.19.1/generic/gentoo/33_all_binutils-gnu-relro-fixups.patch
new file mode 100644
index 0000000..2471163
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/33_all_binutils-gnu-relro-fixups.patch
@@ -0,0 +1,536 @@
+http://bugs.gentoo.org/192584
+http://sourceware.org/bugzilla/show_bug.cgi?id=5037
+http://sourceware.org/ml/binutils/2007-09/msg00208.html
+
+bfd/
+
+2007-09-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3281
+ PR binutils/5037
+ * elf-bfd.h (elf_obj_tdata): Remove relro.
+
+ * elf.c (get_program_header_size): Check info->relro instead
+ of elf_tdata (abfd)->relro.
+ (_bfd_elf_map_sections_to_segments): Likewise.
+ (assign_file_positions_for_load_sections): Don't set
+ PT_GNU_RELRO segment alignment here.
+ (assign_file_positions_for_non_load_sections): Properly set up
+ PT_GNU_RELRO segment for copying executable/shared library.
+ (rewrite_elf_program_header): Remove PT_GNU_RELRO segment.
+ (copy_elf_program_header): Set p_size and p_size_valid fields for
+ PT_GNU_RELRO segment.
+
+include/elf/
+
+2007-09-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3281
+ PR binutils/5037
+ * internal.h (elf_segment_map): Add p_size and p_size_valid.
+ (ELF_IS_SECTION_IN_SEGMENT): Allow SHF_TLS sections in
+ PT_GNU_RELRO segments.
+
+ld/
+
+2007-09-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3281
+ PR binutils/5037
+ * ldexp.h (ldexp_control): Add relro, relro_start_stat and
+ relro_end_stat.
+
+ * ldexp.c (fold_binary): Set expld.dataseg.relro to
+ exp_dataseg_relro_start or exp_dataseg_relro_end when
+ seeing DATA_SEGMENT_ALIGN or DATA_SEGMENT_RELRO_END,
+ respectively.
+
+ * ldlang.c (lang_size_sections_1): Properly set
+ expld.dataseg.relro_start_stat and
+ expld.dataseg.relro_end_stat.
+ (find_relro_section_callback): New function.
+ (lang_find_relro_sections_1): Likewise.
+ (lang_find_relro_sections): Likewise.
+ (lang_process): Call lang_find_relro_sections for
+ non-relocatable link.
+
+ld/testsuite/
+
+2007-09-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3281
+ PR binutils/5037
+ * ld-elf/binutils.exp: Update "-z relro" tests to use relro1.s.
+ Add "-z relro" tests with relro2.s. Add "-z relro" tests with
+ TLS for objcopy.
+
+ * ld-elf/relro1.s: New file.
+ * ld-elf/relro2.s: Likewise.
+
+---
+ bfd/elf-bfd.h | 3 -
+ bfd/elf.c | 77 ++++++++++++++++++++++++-----
+ bfd/elflink.c | 1
+ include/elf/internal.h | 10 +++
+ ld/ldexp.c | 2
+ ld/ldexp.h | 11 ++++
+ ld/ldlang.c | 101 +++++++++++++++++++++++++++++++++++++++
+ ld/testsuite/ld-elf/binutils.exp | 28 ++++++++--
+ ld/testsuite/ld-elf/relro1.s | 14 +++++
+ ld/testsuite/ld-elf/relro2.s | 5 +
+ 10 files changed, 227 insertions(+), 25 deletions(-)
+
+Index: binutils-2.18/bfd/elf-bfd.h
+===================================================================
+--- binutils-2.18.orig/bfd/elf-bfd.h
++++ binutils-2.18/bfd/elf-bfd.h
+@@ -1428,9 +1428,6 @@ struct elf_obj_tdata
+ /* Segment flags for the PT_GNU_STACK segment. */
+ unsigned int stack_flags;
+
+- /* Should the PT_GNU_RELRO segment be emitted? */
+- bfd_boolean relro;
+-
+ /* Symbol version definitions in external objects. */
+ Elf_Internal_Verdef *verdef;
+
+Index: binutils-2.18/bfd/elf.c
+===================================================================
+--- binutils-2.18.orig/bfd/elf.c
++++ binutils-2.18/bfd/elf.c
+@@ -3321,7 +3321,7 @@ get_program_header_size (bfd *abfd, stru
+ /* We need a PT_DYNAMIC segment. */
+ ++segs;
+
+- if (elf_tdata (abfd)->relro)
++ if (info->relro)
+ {
+ /* We need a PT_GNU_RELRO segment only when there is a
+ PT_DYNAMIC segment. */
+@@ -3851,7 +3851,7 @@ _bfd_elf_map_sections_to_segments (bfd *
+ pm = &m->next;
+ }
+
+- if (dynsec != NULL && elf_tdata (abfd)->relro)
++ if (dynsec != NULL && info->relro)
+ {
+ /* We make a PT_GNU_RELRO segment only when there is a
+ PT_DYNAMIC segment. */
+@@ -4326,12 +4326,10 @@ assign_file_positions_for_load_sections
+ p->p_memsz += this_hdr->sh_size;
+ }
+
+- if (p->p_type == PT_GNU_RELRO)
+- p->p_align = 1;
+- else if (align > p->p_align
+- && !m->p_align_valid
+- && (p->p_type != PT_LOAD
+- || (abfd->flags & D_PAGED) == 0))
++ if (align > p->p_align
++ && !m->p_align_valid
++ && (p->p_type != PT_LOAD
++ || (abfd->flags & D_PAGED) == 0))
+ p->p_align = align;
+ }
+
+@@ -4480,18 +4478,53 @@ assign_file_positions_for_non_load_secti
+ if (m->count != 0)
+ {
+ if (p->p_type != PT_LOAD
+- && (p->p_type != PT_NOTE || bfd_get_format (abfd) != bfd_core))
++ && (p->p_type != PT_NOTE
++ || bfd_get_format (abfd) != bfd_core))
+ {
+ Elf_Internal_Shdr *hdr;
++ asection *sect;
++
+ BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs);
+
+- hdr = &elf_section_data (m->sections[m->count - 1])->this_hdr;
+- p->p_filesz = (m->sections[m->count - 1]->filepos
+- - m->sections[0]->filepos);
++ sect = m->sections[m->count - 1];
++ hdr = &elf_section_data (sect)->this_hdr;
++ p->p_filesz = sect->filepos - m->sections[0]->filepos;
+ if (hdr->sh_type != SHT_NOBITS)
+ p->p_filesz += hdr->sh_size;
+
+- p->p_offset = m->sections[0]->filepos;
++ if (p->p_type == PT_GNU_RELRO)
++ {
++ /* When we get here, we are copying executable
++ or shared library. But we need to use the same
++ linker logic. */
++ Elf_Internal_Phdr *lp;
++
++ for (lp = phdrs; lp < phdrs + count; ++lp)
++ {
++ if (lp->p_type == PT_LOAD
++ && lp->p_paddr == p->p_paddr)
++ break;
++ }
++
++ if (lp < phdrs + count)
++ {
++ /* We should use p_size if it is valid since it
++ may contain the first few bytes of the next
++ SEC_ALLOC section. */
++ if (m->p_size_valid)
++ p->p_filesz = m->p_size;
++ else
++ abort ();
++ p->p_vaddr = lp->p_vaddr;
++ p->p_offset = lp->p_offset;
++ p->p_memsz = p->p_filesz;
++ p->p_align = 1;
++ }
++ else
++ abort ();
++ }
++ else
++ p->p_offset = m->sections[0]->filepos;
+ }
+ }
+ else
+@@ -5080,7 +5113,12 @@ rewrite_elf_program_header (bfd *ibfd, b
+ }
+
+ if (segment->p_type != PT_LOAD)
+- continue;
++ {
++ /* Remove PT_GNU_RELRO segment. */
++ if (segment->p_type == PT_GNU_RELRO)
++ segment->p_type = PT_NULL;
++ continue;
++ }
+
+ /* Determine if this segment overlaps any previous segments. */
+ for (j = 0, segment2 = elf_tdata (ibfd)->phdr; j < i; j++, segment2 ++)
+@@ -5604,6 +5642,17 @@ copy_elf_program_header (bfd *ibfd, bfd
+ map->p_align_valid = 1;
+ map->p_vaddr_offset = 0;
+
++ if (map->p_type == PT_GNU_RELRO
++ && segment->p_filesz == segment->p_memsz)
++ {
++ /* The PT_GNU_RELRO segment may contain the first a few
++ bytes in the .got.plt section even if the whole .got.plt
++ section isn't in the PT_GNU_RELRO segment. We won't
++ change the size of the PT_GNU_RELRO segment. */
++ map->p_size = segment->p_filesz;
++ map->p_size_valid = 1;
++ }
++
+ /* Determine if this segment contains the ELF file header
+ and if it contains the program headers themselves. */
+ map->includes_filehdr = (segment->p_offset == 0
+Index: binutils-2.18/bfd/elflink.c
+===================================================================
+--- binutils-2.18.orig/bfd/elflink.c
++++ binutils-2.18/bfd/elflink.c
+@@ -5327,7 +5327,6 @@ bfd_elf_size_dynamic_sections (bfd *outp
+ return TRUE;
+
+ bed = get_elf_backend_data (output_bfd);
+- elf_tdata (output_bfd)->relro = info->relro;
+ if (info->execstack)
+ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
+ else if (info->noexecstack)
+Index: binutils-2.18/include/elf/internal.h
+===================================================================
+--- binutils-2.18.orig/include/elf/internal.h
++++ binutils-2.18/include/elf/internal.h
+@@ -239,6 +239,8 @@ struct elf_segment_map
+ bfd_vma p_vaddr_offset;
+ /* Program segment alignment. */
+ bfd_vma p_align;
++ /* Segment size in file and memory */
++ bfd_vma p_size;
+ /* Whether the p_flags field is valid; if not, the flags are based
+ on the section flags. */
+ unsigned int p_flags_valid : 1;
+@@ -248,6 +250,9 @@ struct elf_segment_map
+ /* Whether the p_align field is valid; if not, PT_LOAD segment
+ alignment is based on the default maximum page size. */
+ unsigned int p_align_valid : 1;
++ /* Whether the p_size field is valid; if not, the size are based
++ on the section sizes. */
++ unsigned int p_size_valid : 1;
+ /* Whether this segment includes the file header. */
+ unsigned int includes_filehdr : 1;
+ /* Whether this segment includes the program headers. */
+@@ -266,11 +271,12 @@ struct elf_segment_map
+ || segment->p_type == PT_TLS) ? sec_hdr->sh_size : 0)
+
+ /* Decide if the given sec_hdr is in the given segment. PT_TLS segment
+- contains only SHF_TLS sections. Only PT_LOAD and PT_TLS segments
+- can contain SHF_TLS sections. */
++ contains only SHF_TLS sections. Only PT_LOAD, PT_GNU_RELRO and
++ and PT_TLS segments can contain SHF_TLS sections. */
+ #define ELF_IS_SECTION_IN_SEGMENT(sec_hdr, segment) \
+ (((((sec_hdr->sh_flags & SHF_TLS) != 0) \
+ && (segment->p_type == PT_TLS \
++ || segment->p_type == PT_GNU_RELRO \
+ || segment->p_type == PT_LOAD)) \
+ || ((sec_hdr->sh_flags & SHF_TLS) == 0 \
+ && segment->p_type != PT_TLS)) \
+Index: binutils-2.18/ld/ldexp.c
+===================================================================
+--- binutils-2.18.orig/ld/ldexp.c
++++ binutils-2.18/ld/ldexp.c
+@@ -390,6 +390,7 @@ fold_binary (etree_type *tree)
+ break;
+
+ case DATA_SEGMENT_ALIGN:
++ expld.dataseg.relro = exp_dataseg_relro_start;
+ if (expld.phase != lang_first_phase_enum
+ && expld.section == bfd_abs_section_ptr
+ && (expld.dataseg.phase == exp_dataseg_none
+@@ -425,6 +426,7 @@ fold_binary (etree_type *tree)
+ break;
+
+ case DATA_SEGMENT_RELRO_END:
++ expld.dataseg.relro = exp_dataseg_relro_end;
+ if (expld.phase != lang_first_phase_enum
+ && (expld.dataseg.phase == exp_dataseg_align_seen
+ || expld.dataseg.phase == exp_dataseg_adjust
+Index: binutils-2.18/ld/ldexp.h
+===================================================================
+--- binutils-2.18.orig/ld/ldexp.h
++++ binutils-2.18/ld/ldexp.h
+@@ -98,6 +98,8 @@ typedef enum {
+ lang_final_phase_enum
+ } lang_phase_type;
+
++union lang_statement_union;
++
+ struct ldexp_control {
+ /* Modify expression evaluation depending on this. */
+ lang_phase_type phase;
+@@ -125,6 +127,15 @@ struct ldexp_control {
+ } phase;
+
+ bfd_vma base, min_base, relro_end, end, pagesize, maxpagesize;
++
++ enum {
++ exp_dataseg_relro_none,
++ exp_dataseg_relro_start,
++ exp_dataseg_relro_end,
++ } relro;
++
++ union lang_statement_union *relro_start_stat;
++ union lang_statement_union *relro_end_stat;
+ } dataseg;
+ };
+
+Index: binutils-2.18/ld/ldlang.c
+===================================================================
+--- binutils-2.18.orig/ld/ldlang.c
++++ binutils-2.18/ld/ldlang.c
+@@ -4631,10 +4631,32 @@ lang_size_sections_1
+ bfd_vma newdot = dot;
+ etree_type *tree = s->assignment_statement.exp;
+
++ expld.dataseg.relro = exp_dataseg_relro_none;
++
+ exp_fold_tree (tree,
+ output_section_statement->bfd_section,
+ &newdot);
+
++ if (expld.dataseg.relro == exp_dataseg_relro_start)
++ {
++ if (!expld.dataseg.relro_start_stat)
++ expld.dataseg.relro_start_stat = s;
++ else
++ {
++ ASSERT (expld.dataseg.relro_start_stat == s);
++ }
++ }
++ else if (expld.dataseg.relro == exp_dataseg_relro_end)
++ {
++ if (!expld.dataseg.relro_end_stat)
++ expld.dataseg.relro_end_stat = s;
++ else
++ {
++ ASSERT (expld.dataseg.relro_end_stat == s);
++ }
++ }
++ expld.dataseg.relro = exp_dataseg_relro_none;
++
+ /* This symbol is relative to this section. */
+ if ((tree->type.node_class == etree_provided
+ || tree->type.node_class == etree_assign)
+@@ -5660,6 +5682,81 @@ lang_gc_sections (void)
+ bfd_gc_sections (output_bfd, &link_info);
+ }
+
++/* Worker for lang_find_relro_sections_1. */
++
++static void
++find_relro_section_callback (lang_wild_statement_type *ptr ATTRIBUTE_UNUSED,
++ struct wildcard_list *sec ATTRIBUTE_UNUSED,
++ asection *section,
++ lang_input_statement_type *file ATTRIBUTE_UNUSED,
++ void *data)
++{
++ /* Discarded, excluded and ignored sections effectively have zero
++ size. */
++ if (section->output_section != NULL
++ && section->output_section->owner == output_bfd
++ && (section->output_section->flags & SEC_EXCLUDE) == 0
++ && !IGNORE_SECTION (section)
++ && section->size != 0)
++ {
++ bfd_boolean *has_relro_section = (bfd_boolean *) data;
++ *has_relro_section = TRUE;
++ }
++}
++
++/* Iterate over sections for relro sections. */
++
++static void
++lang_find_relro_sections_1 (lang_statement_union_type *s,
++ bfd_boolean *has_relro_section)
++{
++ if (*has_relro_section)
++ return;
++
++ for (; s != NULL; s = s->header.next)
++ {
++ if (s == expld.dataseg.relro_end_stat)
++ break;
++
++ switch (s->header.type)
++ {
++ case lang_wild_statement_enum:
++ walk_wild (&s->wild_statement,
++ find_relro_section_callback,
++ has_relro_section);
++ break;
++ case lang_constructors_statement_enum:
++ lang_find_relro_sections_1 (constructor_list.head,
++ has_relro_section);
++ break;
++ case lang_output_section_statement_enum:
++ lang_find_relro_sections_1 (s->output_section_statement.children.head,
++ has_relro_section);
++ break;
++ case lang_group_statement_enum:
++ lang_find_relro_sections_1 (s->group_statement.children.head,
++ has_relro_section);
++ break;
++ default:
++ break;
++ }
++ }
++}
++
++static void
++lang_find_relro_sections (void)
++{
++ bfd_boolean has_relro_section = FALSE;
++
++ /* Check all sections in the link script. */
++
++ lang_find_relro_sections_1 (expld.dataseg.relro_start_stat,
++ &has_relro_section);
++
++ if (!has_relro_section)
++ link_info.relro = FALSE;
++}
++
+ /* Relax all sections until bfd_relax_section gives up. */
+
+ static void
+@@ -5787,6 +5884,10 @@ lang_process (void)
+ section positions, since they will affect SIZEOF_HEADERS. */
+ lang_record_phdrs ();
+
++ /* Check relro sections. */
++ if (link_info.relro && ! link_info.relocatable)
++ lang_find_relro_sections ();
++
+ /* Size up the sections. */
+ lang_size_sections (NULL, !command_line.relax);
+
+Index: binutils-2.18/ld/testsuite/ld-elf/binutils.exp
+===================================================================
+--- binutils-2.18.orig/ld/testsuite/ld-elf/binutils.exp
++++ binutils-2.18/ld/testsuite/ld-elf/binutils.exp
+@@ -104,24 +104,42 @@ binutils_test strip "-shared" maxpage1
+ binutils_test objcopy "" maxpage1
+ binutils_test objcopy "-shared" maxpage1
+
+-binutils_test strip "-z relro" maxpage1
+-binutils_test strip "-z relro -shared" maxpage1
+-binutils_test objcopy "-z relro" maxpage1
+-binutils_test objcopy "-z relro -shared" maxpage1
++binutils_test strip "-z relro" relro1
++binutils_test strip "-z relro -shared" relro1
++binutils_test objcopy "-z relro" relro1
++binutils_test objcopy "-z relro -shared" relro1
++if { ([istarget "i?86-*-elf*"]
++ || ([istarget "i?86-*-linux*"]
++ && ![istarget "*-*-*aout*"]
++ && ![istarget "*-*-*oldld*"])
++ || [istarget "x86_64-*-linux*"]
++ || [istarget "amd64-*-linux*"]) } {
++ binutils_test strip "-z relro -shared" relro2
++ binutils_test objcopy "-z relro -shared" relro2
++}
+
+ binutils_test objcopy "" tbss1
++binutils_test objcopy "-z relro" tbss1
+ binutils_test objcopy "-shared" tbss1
++binutils_test objcopy "-shared -z relro" tbss1
+ binutils_test objcopy "-z max-page-size=0x100000" tbss1
+ binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss1
+ binutils_test objcopy "" tdata1
++binutils_test objcopy "-z relro" tdata1
+ binutils_test objcopy "-shared" tdata1
++binutils_test objcopy "-shared -z relro" tdata1
+ binutils_test objcopy "-z max-page-size=0x100000" tdata1
+ binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata1
+ binutils_test objcopy "" tbss2
++binutils_test objcopy "-z relro" tbss2
+ binutils_test objcopy "-shared" tbss2
++binutils_test objcopy "-shared -z relro" tbss2
+ binutils_test objcopy "-z max-page-size=0x100000" tbss2
+ binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss2
+-binutils_test objcopy "-z max-page-size=0x100000" tdata2
++
+ binutils_test objcopy "" tdata2
++binutils_test objcopy "-z relro" tdata2
+ binutils_test objcopy "-shared" tdata2
++binutils_test objcopy "-shared -z relro" tdata2
++binutils_test objcopy "-z max-page-size=0x100000" tdata2
+ binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata2
+Index: binutils-2.18/ld/testsuite/ld-elf/relro1.s
+===================================================================
+--- /dev/null
++++ binutils-2.18/ld/testsuite/ld-elf/relro1.s
+@@ -0,0 +1,14 @@
++ .globl main
++ .globl start
++ .globl _start
++ .globl __start
++ .text
++main:
++start:
++_start:
++__start:
++ .long 0
++ .data
++ .long 0
++ .section .data.rel.ro,"aw",%progbits
++ .long 0
+Index: binutils-2.18/ld/testsuite/ld-elf/relro2.s
+===================================================================
+--- /dev/null
++++ binutils-2.18/ld/testsuite/ld-elf/relro2.s
+@@ -0,0 +1,5 @@
++ .text
++ .globl x
++ .type x, @function
++x:
++ jmp foo@PLT
diff --git a/patches/binutils-2.19.1/generic/gentoo/42_all_012_check_ldrunpath_length.patch b/patches/binutils-2.19.1/generic/gentoo/42_all_012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..5310741
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/42_all_012_check_ldrunpath_length.patch
@@ -0,0 +1,52 @@
+#!/bin/sh -e
+## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
+## DP: cases where -rpath isn't specified. (#151024)
+
+if [ $# -ne 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+case "$1" in
+ -patch) patch $patch_opts -p1 < $0;;
+ -unpatch) patch $patch_opts -p1 -R < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1;;
+esac
+
+exit 0
+
+@DPATCH@
+---
+ ld/emultempl/elf32.em | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+Index: binutils-2.19.1/ld/emultempl/elf32.em
+===================================================================
+--- binutils-2.19.1.orig/ld/emultempl/elf32.em
++++ binutils-2.19.1/ld/emultempl/elf32.em
+@@ -1219,6 +1219,8 @@ fragment <<EOF
+ && command_line.rpath == NULL)
+ {
+ lib_path = (const char *) getenv ("LD_RUN_PATH");
++ if ((lib_path) && (strlen (lib_path) == 0))
++ lib_path = NULL;
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
+ force))
+ break;
+@@ -1404,6 +1406,8 @@ gld${EMULATION_NAME}_before_allocation (
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (strlen (rpath) == 0))
++ rpath = NULL;
+ if (! (bfd_elf_size_dynamic_sections
+ (link_info.output_bfd, command_line.soname, rpath,
+ command_line.filter_shlib,
diff --git a/patches/binutils-2.19.1/generic/gentoo/66_all_binutils-2.17.50.0.2-warn-textrel.patch b/patches/binutils-2.19.1/generic/gentoo/66_all_binutils-2.17.50.0.2-warn-textrel.patch
new file mode 100644
index 0000000..66708be
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/66_all_binutils-2.17.50.0.2-warn-textrel.patch
@@ -0,0 +1,66 @@
+textrels are bad for forcing copy-on-write (this affects everyone),
+and for security/runtime code generation, this affects security ppl.
+But in either case, it doesn't matter who needs textrels, it's
+the very fact that they're needed at all.
+
+2006-06-10 Ned Ludd <solar@gentoo.org>, Mike Frysinger <vapier@gentoo.org>
+
+ * bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs.
+ * ld/ldmain.c (main): Change textrel warning default to true.
+ * ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL
+ warnings from ld output.
+
+---
+ bfd/elflink.c | 6 ++----
+ ld/ldmain.c | 1 +
+ ld/testsuite/lib/ld-lib.exp | 4 ++++
+ 3 files changed, 7 insertions(+), 4 deletions(-)
+
+Index: binutils-2.19.1/bfd/elflink.c
+===================================================================
+--- binutils-2.19.1.orig/bfd/elflink.c
++++ binutils-2.19.1/bfd/elflink.c
+@@ -10802,14 +10802,12 @@ bfd_elf_final_link (bfd *abfd, struct bf
+ goto error_return;
+
+ /* Check for DT_TEXTREL (late, in case the backend removes it). */
+- if (info->warn_shared_textrel && info->shared)
++ o = bfd_get_section_by_name (dynobj, ".dynamic");
++ if (info->warn_shared_textrel && o != NULL)
+ {
+ bfd_byte *dyncon, *dynconend;
+
+ /* Fix up .dynamic entries. */
+- o = bfd_get_section_by_name (dynobj, ".dynamic");
+- BFD_ASSERT (o != NULL);
+-
+ dyncon = o->contents;
+ dynconend = o->contents + o->size;
+ for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
+Index: binutils-2.19.1/ld/ldmain.c
+===================================================================
+--- binutils-2.19.1.orig/ld/ldmain.c
++++ binutils-2.19.1/ld/ldmain.c
+@@ -280,6 +280,7 @@ main (int argc, char **argv)
+ emulation = get_emulation (argc, argv);
+ ldemul_choose_mode (emulation);
+ default_target = ldemul_choose_target (argc, argv);
++ link_info.warn_shared_textrel = TRUE;
+ lang_init ();
+ ldemul_before_parse ();
+ lang_has_input_file = FALSE;
+Index: binutils-2.19.1/ld/testsuite/lib/ld-lib.exp
+===================================================================
+--- binutils-2.19.1.orig/ld/testsuite/lib/ld-lib.exp
++++ binutils-2.19.1/ld/testsuite/lib/ld-lib.exp
+@@ -196,6 +196,10 @@ proc default_ld_simple_link { ld target
+ # symbol, since the default linker script might use ENTRY.
+ regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
+
++ # Gentoo tweak:
++ # We want to ignore TEXTREL warnings since we force enable them by default
++ regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
++
+ if [string match "" $exec_output] then {
+ return 1
+ } else {
diff --git a/patches/binutils-2.19.1/generic/gentoo/76_all_only-use-new-ld-dtags.patch.disabled b/patches/binutils-2.19.1/generic/gentoo/76_all_only-use-new-ld-dtags.patch.disabled
new file mode 100644
index 0000000..0e7fc2c
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/76_all_only-use-new-ld-dtags.patch.disabled
@@ -0,0 +1,31 @@
+Don't generate RPATH if we're going to be generating RUNPATH.
+
+need to ponder what ramifications this has before enabling it
+
+---
+ bfd/elflink.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+Index: binutils-2.19.1/bfd/elflink.c
+===================================================================
+--- binutils-2.19.1.orig/bfd/elflink.c
++++ binutils-2.19.1/bfd/elflink.c
+@@ -5492,11 +5492,15 @@ bfd_elf_size_dynamic_sections (bfd *outp
+
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
+ TRUE);
+- if (indx == (bfd_size_type) -1
+- || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
++ if (indx == (bfd_size_type) -1)
+ return FALSE;
+
+- if (info->new_dtags)
++ if (!info->new_dtags)
++ {
++ if (!_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
++ return FALSE;
++ }
++ else
+ {
+ _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
+ if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx))
diff --git a/patches/binutils-2.19.1/generic/gentoo/91_all_libiberty-pic.patch b/patches/binutils-2.19.1/generic/gentoo/91_all_libiberty-pic.patch
new file mode 100644
index 0000000..2dedf3e
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/91_all_libiberty-pic.patch
@@ -0,0 +1,16 @@
+---
+ libiberty/Makefile.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: binutils-2.19.1/libiberty/Makefile.in
+===================================================================
+--- binutils-2.19.1.orig/libiberty/Makefile.in
++++ binutils-2.19.1/libiberty/Makefile.in
+@@ -227,6 +227,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA
+ $(AR) $(AR_FLAGS) $(TARGETLIB) \
+ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
+ $(RANLIB) $(TARGETLIB); \
++ cp $(TARGETLIB) ../ ; \
+ cd ..; \
+ else true; fi
+
diff --git a/patches/binutils-2.19.1/generic/gentoo/no_63_all_binutils-2.18-pt-pax-flags-20070828.patch b/patches/binutils-2.19.1/generic/gentoo/no_63_all_binutils-2.18-pt-pax-flags-20070828.patch
new file mode 100644
index 0000000..4c0c1a5
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/no_63_all_binutils-2.18-pt-pax-flags-20070828.patch
@@ -0,0 +1,263 @@
+---
+ bfd/elf-bfd.h | 3 +++
+ bfd/elf.c | 27 ++++++++++++++++++++++++++-
+ bfd/elflink.c | 24 +++++++++++++++++++++---
+ binutils/readelf.c | 1 +
+ include/bfdlink.h | 8 ++++++++
+ include/elf/common.h | 16 ++++++++++++++++
+ ld/emultempl/elf32.em | 12 ++++++++++++
+ ld/ldgram.y | 2 ++
+ 8 files changed, 89 insertions(+), 4 deletions(-)
+
+Index: binutils-2.18/bfd/elf-bfd.h
+===================================================================
+--- binutils-2.18.orig/bfd/elf-bfd.h
++++ binutils-2.18/bfd/elf-bfd.h
+@@ -1428,6 +1428,9 @@ struct elf_obj_tdata
+ /* Segment flags for the PT_GNU_STACK segment. */
+ unsigned int stack_flags;
+
++ /* Segment flags for the PT_PAX_FLAGS segment. */
++ unsigned int pax_flags;
++
+ /* Symbol version definitions in external objects. */
+ Elf_Internal_Verdef *verdef;
+
+Index: binutils-2.18/bfd/elf.c
+===================================================================
+--- binutils-2.18.orig/bfd/elf.c
++++ binutils-2.18/bfd/elf.c
+@@ -1085,6 +1085,7 @@ get_segment_type (unsigned int p_type)
+ case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
+ case PT_GNU_STACK: pt = "STACK"; break;
+ case PT_GNU_RELRO: pt = "RELRO"; break;
++ case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break;
+ default: pt = NULL; break;
+ }
+ return pt;
+@@ -2361,6 +2362,9 @@ bfd_section_from_phdr (bfd *abfd, Elf_In
+ case PT_GNU_RELRO:
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
+
++ case PT_PAX_FLAGS:
++ return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags");
++
+ default:
+ /* Check for any processor-specific program segment types. */
+ bed = get_elf_backend_data (abfd);
+@@ -3341,6 +3345,11 @@ get_program_header_size (bfd *abfd, stru
+ ++segs;
+ }
+
++ {
++ /* We need a PT_PAX_FLAGS segment. */
++ ++segs;
++ }
++
+ for (s = abfd->sections; s != NULL; s = s->next)
+ {
+ if ((s->flags & SEC_LOAD) != 0
+@@ -3868,6 +3877,20 @@ _bfd_elf_map_sections_to_segments (bfd *
+ pm = &m->next;
+ }
+
++ {
++ amt = sizeof (struct elf_segment_map);
++ m = bfd_zalloc (abfd, amt);
++ if (m == NULL)
++ goto error_return;
++ m->next = NULL;
++ m->p_type = PT_PAX_FLAGS;
++ m->p_flags = elf_tdata (abfd)->pax_flags;
++ m->p_flags_valid = 1;
++
++ *pm = m;
++ pm = &m->next;
++ }
++
+ free (sections);
+ elf_tdata (abfd)->segment_map = mfirst;
+ }
+@@ -5043,7 +5066,8 @@ rewrite_elf_program_header (bfd *ibfd, b
+ 6. PT_TLS segment includes only SHF_TLS sections.
+ 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
+ 8. PT_DYNAMIC should not contain empty sections at the beginning
+- (with the possible exception of .dynamic). */
++ (with the possible exception of .dynamic).
++ 9. PT_PAX_FLAGS segments does not include any sections. */
+ #define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \
+ ((((segment->p_paddr \
+ ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
+@@ -5051,6 +5075,7 @@ rewrite_elf_program_header (bfd *ibfd, b
+ && (section->flags & SEC_ALLOC) != 0) \
+ || IS_COREFILE_NOTE (segment, section)) \
+ && segment->p_type != PT_GNU_STACK \
++ && segment->p_type != PT_PAX_FLAGS \
+ && (segment->p_type != PT_TLS \
+ || (section->flags & SEC_THREAD_LOCAL)) \
+ && (segment->p_type == PT_LOAD \
+Index: binutils-2.18/bfd/elflink.c
+===================================================================
+--- binutils-2.18.orig/bfd/elflink.c
++++ binutils-2.18/bfd/elflink.c
+@@ -5327,16 +5327,30 @@ bfd_elf_size_dynamic_sections (bfd *outp
+ return TRUE;
+
+ bed = get_elf_backend_data (output_bfd);
++ elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC;
++
++ if (info->execheap)
++ elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT;
++ else if (info->noexecheap)
++ elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT;
++
+ if (info->execstack)
+- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
++ {
++ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
++ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
++ }
+ else if (info->noexecstack)
+- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
++ {
++ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
++ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
++ }
+ else
+ {
+ bfd *inputobj;
+ asection *notesec = NULL;
+ int exec = 0;
+
++ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
+ for (inputobj = info->input_bfds;
+ inputobj;
+ inputobj = inputobj->link_next)
+@@ -5349,7 +5363,11 @@ bfd_elf_size_dynamic_sections (bfd *outp
+ if (s)
+ {
+ if (s->flags & SEC_CODE)
+- exec = PF_X;
++ {
++ elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP;
++ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
++ exec = PF_X;
++ }
+ notesec = s;
+ }
+ else if (bed->default_execstack)
+Index: binutils-2.18/binutils/readelf.c
+===================================================================
+--- binutils-2.18.orig/binutils/readelf.c
++++ binutils-2.18/binutils/readelf.c
+@@ -2469,6 +2469,7 @@ get_segment_type (unsigned long p_type)
+ return "GNU_EH_FRAME";
+ case PT_GNU_STACK: return "GNU_STACK";
+ case PT_GNU_RELRO: return "GNU_RELRO";
++ case PT_PAX_FLAGS: return "PAX_FLAGS";
+
+ default:
+ if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
+Index: binutils-2.18/include/bfdlink.h
+===================================================================
+--- binutils-2.18.orig/include/bfdlink.h
++++ binutils-2.18/include/bfdlink.h
+@@ -321,6 +321,14 @@ struct bfd_link_info
+ /* TRUE if PT_GNU_RELRO segment should be created. */
+ unsigned int relro: 1;
+
++ /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT
++ flags. */
++ unsigned int execheap: 1;
++
++ /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT
++ flags. */
++ unsigned int noexecheap: 1;
++
+ /* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */
+ unsigned int warn_shared_textrel: 1;
+
+Index: binutils-2.18/include/elf/common.h
+===================================================================
+--- binutils-2.18.orig/include/elf/common.h
++++ binutils-2.18/include/elf/common.h
+@@ -309,6 +309,7 @@
+ #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */
+ #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
+ #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
++#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* PaX flags */
+
+ /* Program segment permissions, in program header p_flags field. */
+
+@@ -319,6 +320,21 @@
+ #define PF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
+ #define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */
+
++/* Flags to control PaX behavior. */
++
++#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 */
++
+ /* Values for section header, sh_type field. */
+
+ #define SHT_NULL 0 /* Section header table entry unused */
+Index: binutils-2.18/ld/emultempl/elf32.em
+===================================================================
+--- binutils-2.18.orig/ld/emultempl/elf32.em
++++ binutils-2.18/ld/emultempl/elf32.em
+@@ -2136,6 +2136,16 @@ fragment <<EOF
+ link_info.noexecstack = TRUE;
+ link_info.execstack = FALSE;
+ }
++ else if (strcmp (optarg, "execheap") == 0)
++ {
++ link_info.execheap = TRUE;
++ link_info.noexecheap = FALSE;
++ }
++ else if (strcmp (optarg, "noexecheap") == 0)
++ {
++ link_info.noexecheap = TRUE;
++ link_info.execheap = FALSE;
++ }
+ EOF
+
+ if test -n "$COMMONPAGESIZE"; then
+@@ -2209,6 +2219,7 @@ fragment <<EOF
+ fprintf (file, _(" -z combreloc\t\tMerge dynamic relocs into one section and sort\n"));
+ fprintf (file, _(" -z defs\t\tReport unresolved symbols in object files.\n"));
+ fprintf (file, _(" -z execstack\t\tMark executable as requiring executable stack\n"));
++ fprintf (file, _(" -z execheap\t\tMark executable as requiring executable heap\n"));
+ fprintf (file, _(" -z initfirst\t\tMark DSO to be initialized first at runtime\n"));
+ fprintf (file, _(" -z interpose\t\tMark object to interpose all DSOs but executable\n"));
+ fprintf (file, _(" -z lazy\t\tMark object lazy runtime binding (default)\n"));
+@@ -2221,6 +2232,7 @@ fragment <<EOF
+ fprintf (file, _(" -z nodlopen\t\tMark DSO not available to dlopen\n"));
+ fprintf (file, _(" -z nodump\t\tMark DSO not available to dldump\n"));
+ fprintf (file, _(" -z noexecstack\tMark executable as not requiring executable stack\n"));
++ fprintf (file, _(" -z noexecheap\tMark executable as not requiring executable heap\n"));
+ EOF
+
+ if test -n "$COMMONPAGESIZE"; then
+Index: binutils-2.18/ld/ldgram.y
+===================================================================
+--- binutils-2.18.orig/ld/ldgram.y
++++ binutils-2.18/ld/ldgram.y
+@@ -1099,6 +1099,8 @@ phdr_type:
+ $$ = exp_intop (0x6474e550);
+ else if (strcmp (s, "PT_GNU_STACK") == 0)
+ $$ = exp_intop (0x6474e551);
++ else if (strcmp (s, "PT_PAX_FLAGS") == 0)
++ $$ = exp_intop (0x65041580);
+ else
+ {
+ einfo (_("\
diff --git a/patches/binutils-2.19.1/generic/gentoo/no_76_all_use-new-ld-dtags.patch b/patches/binutils-2.19.1/generic/gentoo/no_76_all_use-new-ld-dtags.patch
new file mode 100644
index 0000000..84e20f7
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/no_76_all_use-new-ld-dtags.patch
@@ -0,0 +1,10 @@
+--- binutils/ld/ldmain.c
++++ binutils/ld/ldmain.c
+@@ -296,6 +296,7 @@ main (int argc, char **argv)
+
+ link_info.allow_undefined_version = TRUE;
+ link_info.keep_memory = TRUE;
++ link_info.new_dtags = TRUE;
+ link_info.combreloc = TRUE;
+ link_info.strip_discarded = TRUE;
+ link_info.callbacks = &link_callbacks;
diff --git a/patches/binutils-2.19.1/generic/gentoo/no_77_all_generate-gnu-hash.patch b/patches/binutils-2.19.1/generic/gentoo/no_77_all_generate-gnu-hash.patch
new file mode 100644
index 0000000..eb8da88
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/no_77_all_generate-gnu-hash.patch
@@ -0,0 +1,6 @@
+--- binutils/ld/ldmain.c
++++ binutils/ld/ldmain.c
+@@ -273,2 +273,3 @@ main (int argc, char **argv)
+ link_info.emit_hash = TRUE;
++ link_info.emit_gnu_hash = TRUE;
+ link_info.callbacks = &link_callbacks;
diff --git a/patches/binutils-2.19.1/generic/gentoo/no_78_all_use-relro.patch b/patches/binutils-2.19.1/generic/gentoo/no_78_all_use-relro.patch
new file mode 100644
index 0000000..abd5187
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/gentoo/no_78_all_use-relro.patch
@@ -0,0 +1,6 @@
+--- binutils/ld/ldmain.c
++++ binutils/ld/ldmain.c
+@@ -293,2 +293,3 @@ main (int argc, char **argv)
+ link_info.combreloc = TRUE;
++ link_info.relro = TRUE;
+ link_info.strip_discarded = TRUE;
diff --git a/patches/binutils-2.19.1/generic/oe/binutils-2.16.91.0.6-objcopy-rename-errorcode.patch b/patches/binutils-2.19.1/generic/oe/binutils-2.16.91.0.6-objcopy-rename-errorcode.patch
new file mode 100644
index 0000000..81f963b
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/oe/binutils-2.16.91.0.6-objcopy-rename-errorcode.patch
@@ -0,0 +1,39 @@
+# strip (and objcopy) fail to set the error code if there is no
+# output file name and the rename of the stripped (or copied) file
+# fails, yet the command fails to do anything. This fixes both
+# objcopy and strip.
+#
+# modification by bero: Ported to 2.16.91.0.6
+#
+#Signed-off-by: John Bowler <jbowler@acm.org>
+#Signed-off-by: Bernhard Rosenkraenzer <bero@arklinux.org>
+---
+# binutils/objcopy.c | 8 +++++---
+# 1 file changed, 5 insertions(+), 3 deletions(-)
+#
+Index: binutils-2.19.1/binutils/objcopy.c
+===================================================================
+--- binutils-2.19.1.orig/binutils/objcopy.c
++++ binutils-2.19.1/binutils/objcopy.c
+@@ -2857,8 +2857,9 @@ strip_main (int argc, char *argv[])
+ if (preserve_dates)
+ set_times (tmpname, &statbuf);
+ if (output_file != tmpname)
+- smart_rename (tmpname, output_file ? output_file : argv[i],
+- preserve_dates);
++ if (smart_rename (tmpname, output_file ? output_file : argv[i],
++ preserve_dates))
++ hold_status = 1;
+ status = hold_status;
+ }
+ else
+@@ -3481,7 +3482,8 @@ copy_main (int argc, char *argv[])
+ if (preserve_dates)
+ set_times (tmpname, &statbuf);
+ if (tmpname != output_filename)
+- smart_rename (tmpname, input_filename, preserve_dates);
++ if (smart_rename (tmpname, input_filename, preserve_dates))
++ status = 1;
+ }
+ else
+ unlink_if_ordinary (tmpname);
diff --git a/patches/binutils-2.19.1/generic/series b/patches/binutils-2.19.1/generic/series
new file mode 100644
index 0000000..d31c45b
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/series
@@ -0,0 +1,18 @@
+gentoo/03_all_binutils-2.15.92.0.2-ppc64-pie.patch
+gentoo/07_all_binutils-2.18-windres.patch
+gentoo/08_all_binutils-RPATH_ENVVAR-smack.patch
+gentoo/09_all_binutils-ld-tests-CXXFLAGS.patch
+gentoo/12_all_sh-targets.patch
+gentoo/30_all_binutils-multitarget-fixup.patch
+gentoo/42_all_012_check_ldrunpath_length.patch
+gentoo/66_all_binutils-2.17.50.0.2-warn-textrel.patch
+gentoo/76_all_only-use-new-ld-dtags.patch.disabled
+gentoo/91_all_libiberty-pic.patch
+
+#gentoo/no_76_all_use-new-ld-dtags.patch
+#gentoo/no_77_all_generate-gnu-hash.patch
+#gentoo/no_78_all_use-relro.patch
+
+oe/binutils-2.16.91.0.6-objcopy-rename-errorcode.patch
+
+uclibc/110-arm-eabi-conf.patch
diff --git a/patches/binutils-2.19.1/generic/uclibc/110-arm-eabi-conf.patch b/patches/binutils-2.19.1/generic/uclibc/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..9ce7898
--- /dev/null
+++ b/patches/binutils-2.19.1/generic/uclibc/110-arm-eabi-conf.patch
@@ -0,0 +1,31 @@
+---
+ configure | 2 +-
+ configure.ac | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: binutils-2.19.1/configure
+===================================================================
+--- binutils-2.19.1.orig/configure
++++ binutils-2.19.1/configure
+@@ -2313,7 +2313,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ case ${with_newlib} in
+ no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+Index: binutils-2.19.1/configure.ac
+===================================================================
+--- binutils-2.19.1.orig/configure.ac
++++ binutils-2.19.1/configure.ac
+@@ -562,7 +562,7 @@ case "${target}" in
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ libgloss_dir=arm
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
+ noconfigdirs="$noconfigdirs target-qthreads"
+ case ${with_newlib} in
+ no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
diff --git a/patches/gcc-4.4.0/generic/arm-softfloat.diff b/patches/gcc-4.4.0/generic/arm-softfloat.diff
new file mode 100644
index 0000000..48d666f
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/arm-softfloat.diff
@@ -0,0 +1,52 @@
+#
+# Submitted-By: Marc Kleine-Budde
+# Committed-By: Robert Schwebel
+#
+# Error:
+#
+# no error
+#
+# Description:
+#
+# Link assembler softfloat functions into gcc. As the functions are
+# there in that case anyway, don't add switches for float lib.
+#
+# State:
+#
+# upstream will not fix this because oabi is dead
+#
+
+---
+ gcc/config/arm/linux-elf.h | 2 +-
+ gcc/config/arm/t-linux | 5 ++++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+Index: gcc-4.4.0/gcc/config/arm/linux-elf.h
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/arm/linux-elf.h
++++ gcc-4.4.0/gcc/config/arm/linux-elf.h
+@@ -60,7 +60,7 @@
+ %{shared:-lc} \
+ %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
+
+-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
++#define LIBGCC_SPEC "-lgcc"
+
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+
+Index: gcc-4.4.0/gcc/config/arm/t-linux
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/arm/t-linux
++++ gcc-4.4.0/gcc/config/arm/t-linux
+@@ -4,7 +4,10 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi
+
+ LIB1ASMSRC = arm/lib1funcs.asm
+ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
+- _arm_addsubdf3 _arm_addsubsf3
++ _arm_addsubdf3 _arm_addsubsf3 \
++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
++ _fixsfsi _fixunssfsi _floatdidf _floatdisf
+
+ # MULTILIB_OPTIONS = mhard-float/msoft-float
+ # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/patches/gcc-4.4.0/generic/gentoo/00_all_gcc-4.1-alpha-mieee-default.patch b/patches/gcc-4.4.0/generic/gentoo/00_all_gcc-4.1-alpha-mieee-default.patch
new file mode 100644
index 0000000..347614d
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/00_all_gcc-4.1-alpha-mieee-default.patch
@@ -0,0 +1,40 @@
+Set the default behavior on alpha to use -mieee since the large majority of
+time we want this (bad/weird things can happen with packages built without
+-mieee).
+
+To satisfy those people who may not want -mieee forced on them all the time,
+we also provide -mno-ieee.
+
+Patch by Mike Frysinger <vapier@gentoo.org>
+
+---
+ gcc/config/alpha/alpha.h | 2 ++
+ gcc/config/alpha/alpha.opt | 2 +-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+Index: gcc-4.4.0/gcc/config/alpha/alpha.h
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/alpha/alpha.h
++++ gcc-4.4.0/gcc/config/alpha/alpha.h
+@@ -95,6 +95,8 @@ along with GCC; see the file COPYING3.
+ while (0)
+ #endif
+
++#define CPP_SPEC "%{!no-ieee:-mieee}"
++
+ #define WORD_SWITCH_TAKES_ARG(STR) \
+ (!strcmp (STR, "rpath") || DEFAULT_WORD_SWITCH_TAKES_ARG(STR))
+
+Index: gcc-4.4.0/gcc/config/alpha/alpha.opt
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/alpha/alpha.opt
++++ gcc-4.4.0/gcc/config/alpha/alpha.opt
+@@ -39,7 +39,7 @@ Target RejectNegative Mask(IEEE_CONFORMA
+ Request IEEE-conformant math library routines (OSF/1)
+
+ mieee
+-Target Report RejectNegative Mask(IEEE)
++Target Report Mask(IEEE)
+ Emit IEEE-conformant code, without inexact exceptions
+
+ mieee-with-inexact
diff --git a/patches/gcc-4.4.0/generic/gentoo/00_all_gcc-trampolinewarn.patch b/patches/gcc-4.4.0/generic/gentoo/00_all_gcc-trampolinewarn.patch
new file mode 100644
index 0000000..324c756
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/00_all_gcc-trampolinewarn.patch
@@ -0,0 +1,41 @@
+ This trivial patch causes gcc to emit a warning whenever
+ it generates a trampoline. These are otherwise hard to
+ locate. It is rigged to default ON - to have it default
+ to OFF remove the text 'Init(1)' from the common.opt
+ patch, leaving just 'Common Var(warn_trampolines)'.
+ Kevin F. Quinn <kevquinn@gentoo.org> 17 Jan 2006
+
+---
+ gcc/builtins.c | 3 +++
+ gcc/common.opt | 4 ++++
+ 2 files changed, 7 insertions(+)
+
+Index: gcc-4.4.0/gcc/common.opt
+===================================================================
+--- gcc-4.4.0.orig/gcc/common.opt
++++ gcc-4.4.0/gcc/common.opt
+@@ -197,6 +197,10 @@ Wtype-limits
+ Common Var(warn_type_limits) Init(-1) Warning
+ Warn if a comparison is always true or always false due to the limited range of the data type
+
++Wtrampolines
++Common Var(warn_trampolines) Init(1)
++Warn whenever a trampoline is generated
++
+ Wuninitialized
+ Common Var(warn_uninitialized) Warning
+ Warn about uninitialized automatic variables
+Index: gcc-4.4.0/gcc/builtins.c
+===================================================================
+--- gcc-4.4.0.orig/gcc/builtins.c
++++ gcc-4.4.0/gcc/builtins.c
+@@ -5768,6 +5768,9 @@ expand_builtin_init_trampoline (tree exp
+ trampolines_created = 1;
+ INITIALIZE_TRAMPOLINE (r_tramp, r_func, r_chain);
+
++ if (warn_trampolines)
++ warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)");
++
+ return const0_rtx;
+ }
+
diff --git a/patches/gcc-4.4.0/generic/gentoo/03_all_gcc43-java-nomulti.patch b/patches/gcc-4.4.0/generic/gentoo/03_all_gcc43-java-nomulti.patch
new file mode 100644
index 0000000..f07ead8
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/03_all_gcc43-java-nomulti.patch
@@ -0,0 +1,44 @@
+--- libjava/configure.ac.jj 2007-12-07 17:55:50.000000000 +0100
++++ libjava/configure.ac 2007-12-07 18:36:56.000000000 +0100
+@@ -82,6 +82,13 @@ AC_ARG_ENABLE(java-maintainer-mode,
+ [allow rebuilding of .class and .h files]))
+ AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes)
+
++AC_ARG_ENABLE(libjava-multilib,
++ AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib]))
++if test "$enable_libjava_multilib" = no; then
++ multilib=no
++ ac_configure_args="$ac_configure_args --disable-multilib"
++fi
++
+ # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
+ GCC_NO_EXECUTABLES
+
+--- libjava/configure.jj 2007-12-07 17:55:50.000000000 +0100
++++ libjava/configure 2007-12-07 18:39:58.000000000 +0100
+@@ -1018,6 +1018,8 @@ Optional Features:
+ --enable-gconf-peer compile GConf native peers for util.preferences
+ --enable-java-maintainer-mode
+ allow rebuilding of .class and .h files
++ --enable-libjava-multilib
++ build libjava as multilib
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-maintainer-mode enable make rules and dependencies not useful
+@@ -1848,6 +1850,16 @@ else
+ fi
+
+
++# Check whether --enable-libjava-multilib was given.
++if test "${enable_libjava_multilib+set}" = set; then
++ enableval=$enable_libjava_multilib;
++fi
++
++if test "$enable_libjava_multilib" = no; then
++ multilib=no
++ ac_configure_args="$ac_configure_args --disable-multilib"
++fi
++
+ # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
+
+
diff --git a/patches/gcc-4.4.0/generic/gentoo/11_all_gcc-netbsd-symbolic.patch b/patches/gcc-4.4.0/generic/gentoo/11_all_gcc-netbsd-symbolic.patch
new file mode 100644
index 0000000..4d6df44
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/11_all_gcc-netbsd-symbolic.patch
@@ -0,0 +1,18 @@
+http://bugs.gentoo.org/122698
+
+---
+ gcc/config/netbsd-elf.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: gcc-4.4.0/gcc/config/netbsd-elf.h
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/netbsd-elf.h
++++ gcc-4.4.0/gcc/config/netbsd-elf.h
+@@ -82,6 +82,7 @@ along with GCC; see the file COPYING3.
+ #define NETBSD_LINK_SPEC_ELF \
+ "%{assert*} %{R*} %{rpath*} \
+ %{shared:-shared} \
++ %{symbolic:-Bsymbolic} \
+ %{!shared: \
+ -dc -dp \
+ %{!nostdlib: \
diff --git a/patches/gcc-4.4.0/generic/gentoo/14_all_gcc-sparc64-bsd.patch b/patches/gcc-4.4.0/generic/gentoo/14_all_gcc-sparc64-bsd.patch
new file mode 100644
index 0000000..dae2e1c
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/14_all_gcc-sparc64-bsd.patch
@@ -0,0 +1,34 @@
+---
+ gcc/config/sparc/freebsd.h | 19 ++++++++++++++++---
+ 1 file changed, 16 insertions(+), 3 deletions(-)
+
+Index: gcc-4.4.0/gcc/config/sparc/freebsd.h
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/sparc/freebsd.h
++++ gcc-4.4.0/gcc/config/sparc/freebsd.h
+@@ -25,9 +25,22 @@ along with GCC; see the file COPYING3.
+ /* FreeBSD needs the platform name (sparc64) defined.
+ Emacs needs to know if the arch is 64 or 32-bits. */
+
+-#undef CPP_CPU64_DEFAULT_SPEC
+-#define CPP_CPU64_DEFAULT_SPEC \
+- "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__"
++#undef FBSD_TARGET_CPU_CPP_BUILTINS
++#define FBSD_TARGET_CPU_CPP_BUILTINS() \
++ do \
++ { \
++ if (TARGET_ARCH64) \
++ { \
++ builtin_define ("__sparc64__"); \
++ builtin_define ("__sparc_v9__"); \
++ builtin_define ("__sparcv9"); \
++ } \
++ else \
++ builtin_define ("__sparc"); \
++ builtin_define ("__sparc__"); \
++ } \
++ while (0)
++
+
+ #define LINK_SPEC "%(link_arch) \
+ %{!mno-relax:%{!r:-relax}} \
diff --git a/patches/gcc-4.4.0/generic/gentoo/18_all_904-flatten-switch-stmt-00.patch b/patches/gcc-4.4.0/generic/gentoo/18_all_904-flatten-switch-stmt-00.patch
new file mode 100644
index 0000000..c68403e
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/18_all_904-flatten-switch-stmt-00.patch
@@ -0,0 +1,80 @@
+http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00927.html
+
+Hi,
+
+The attached patch makes sure that we create smaller object code for
+simple switch statements. We just make sure to flatten the switch
+statement into an if-else chain, basically.
+
+This fixes a size-regression as compared to gcc-3.4, as can be seen
+below.
+
+2007-04-15 Bernhard Fischer <..>
+
+ * stmt.c (expand_case): Do not create a complex binary tree when
+ optimizing for size but rather use the simple ordered list.
+ (emit_case_nodes): do not emit jumps to the default_label when
+ optimizing for size.
+
+Not regtested so far.
+Comments?
+
+Attached is the test switch.c mentioned below.
+
+$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
+gcc-$i -DCHAIN -Os -o switch-CHAIN-$i.o -c switch.c ;done
+$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
+gcc-$i -UCHAIN -Os -o switch-$i.o -c switch.c ;done
+
+$ size switch-*.o
+ text data bss dec hex filename
+ 169 0 0 169 a9 switch-2.95.o
+ 115 0 0 115 73 switch-3.3.o
+ 103 0 0 103 67 switch-3.4.o
+ 124 0 0 124 7c switch-4.0.o
+ 124 0 0 124 7c switch-4.1.o
+ 124 0 0 124 7c switch-4.2.orig-HEAD.o
+ 95 0 0 95 5f switch-4.3-HEAD.o
+ 124 0 0 124 7c switch-4.3.orig-HEAD.o
+ 166 0 0 166 a6 switch-CHAIN-2.95.o
+ 111 0 0 111 6f switch-CHAIN-3.3.o
+ 95 0 0 95 5f switch-CHAIN-3.4.o
+ 95 0 0 95 5f switch-CHAIN-4.0.o
+ 95 0 0 95 5f switch-CHAIN-4.1.o
+ 95 0 0 95 5f switch-CHAIN-4.2.orig-HEAD.o
+ 95 0 0 95 5f switch-CHAIN-4.3-HEAD.o
+ 95 0 0 95 5f switch-CHAIN-4.3.orig-HEAD.o
+
+
+Content-Type: text/x-diff; charset=us-ascii
+Content-Disposition: attachment; filename="gcc-4.3.gcc-flatten-switch-stmt.00.diff"
+
+---
+ gcc/stmt.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+Index: gcc-4.4.0/gcc/stmt.c
+===================================================================
+--- gcc-4.4.0.orig/gcc/stmt.c
++++ gcc-4.4.0/gcc/stmt.c
+@@ -2376,7 +2376,11 @@ expand_case (tree exp)
+ use_cost_table
+ = (TREE_CODE (orig_type) != ENUMERAL_TYPE
+ && estimate_case_costs (case_list));
+- balance_case_nodes (&case_list, NULL);
++ /* When optimizing for size, we want a straight list to avoid
++ jumps as much as possible. This basically creates an if-else
++ chain. */
++ if (!optimize_size)
++ balance_case_nodes (&case_list, NULL);
+ emit_case_nodes (index, case_list, default_label, index_type);
+ if (default_label)
+ emit_jump (default_label);
+@@ -2942,6 +2946,7 @@ emit_case_nodes (rtx index, case_node_pt
+ {
+ if (!node_has_low_bound (node, index_type))
+ {
++ if (!optimize_size) /* don't jl to the .default_label. */
+ emit_cmp_and_jump_insns (index,
+ convert_modes
+ (mode, imode,
diff --git a/patches/gcc-4.4.0/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch b/patches/gcc-4.4.0/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch
new file mode 100644
index 0000000..29e8bf9
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch
@@ -0,0 +1,16 @@
+---
+ libiberty/Makefile.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: gcc-4.4.0/libiberty/Makefile.in
+===================================================================
+--- gcc-4.4.0.orig/libiberty/Makefile.in
++++ gcc-4.4.0/libiberty/Makefile.in
+@@ -227,6 +227,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA
+ $(AR) $(AR_FLAGS) $(TARGETLIB) \
+ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
+ $(RANLIB) $(TARGETLIB); \
++ cp $(TARGETLIB) ../ ; \
+ cd ..; \
+ else true; fi
+
diff --git a/patches/gcc-4.4.0/generic/gentoo/53_all_gcc4-superh-default-multilib.patch b/patches/gcc-4.4.0/generic/gentoo/53_all_gcc4-superh-default-multilib.patch
new file mode 100644
index 0000000..61f7554
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/53_all_gcc4-superh-default-multilib.patch
@@ -0,0 +1,29 @@
+The gcc-3.x toolchains would contain all the targets by default. With gcc-4,
+you have to actually list out the multilibs you want or you will end up with
+just one when using targets like 'sh4-linux-gnu'.
+
+The resulting toolchain can't even build a kernel as the kernel needs to build
+with the nofpu flag to be sure that no fpu ops are generated.
+
+Here we restore the gcc-3.x behavior; the additional overhead of building all
+of these multilibs by default is negligible.
+
+http://bugs.gentoo.org/140205
+
+---
+ gcc/config.gcc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: gcc-4.4.0/gcc/config.gcc
+===================================================================
+--- gcc-4.4.0.orig/gcc/config.gcc
++++ gcc-4.4.0/gcc/config.gcc
+@@ -2121,7 +2121,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbian
+ if test x${sh_multilibs} = x ; then
+ case ${target} in
+ sh64-superh-linux* | \
+- sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
++ sh[1234]*) sh_multilibs=`cd ${srcdir}/config/sh ; echo t-mlib-sh[1-4]* | sed 's:t-mlib-sh:,m:g;s: ::g'` ;;
+ sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;;
+ sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
+ sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;;
diff --git a/patches/gcc-4.4.0/generic/gentoo/54_all_300-libstdc++-pic.patch b/patches/gcc-4.4.0/generic/gentoo/54_all_300-libstdc++-pic.patch
new file mode 100644
index 0000000..c676be4
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/54_all_300-libstdc++-pic.patch
@@ -0,0 +1,62 @@
+install libstdc++_pic.a if we have pic objs
+
+---
+ libstdc++-v3/src/Makefile.am | 7 +++++++
+ libstdc++-v3/src/Makefile.in | 12 ++++++++++--
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+
+Index: gcc-4.4.0/libstdc++-v3/src/Makefile.am
+===================================================================
+--- gcc-4.4.0.orig/libstdc++-v3/src/Makefile.am
++++ gcc-4.4.0/libstdc++-v3/src/Makefile.am
+@@ -351,6 +351,13 @@ CXXLINK = $(LIBTOOL) --tag CXX --mode=li
+ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+
+
++install-exec-local:
++ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \
++ if [ x"$$pic_objs" != x ]; then \
++ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \
++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \
++ fi
++
+ # Added bits to build debug library.
+ if GLIBCXX_BUILD_DEBUG
+ all-local: build_debug
+Index: gcc-4.4.0/libstdc++-v3/src/Makefile.in
+===================================================================
+--- gcc-4.4.0.orig/libstdc++-v3/src/Makefile.in
++++ gcc-4.4.0/libstdc++-v3/src/Makefile.in
+@@ -726,7 +726,7 @@ info-am:
+
+ install-data-am: install-data-local
+
+-install-exec-am: install-toolexeclibLTLIBRARIES
++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
+
+ install-info: install-info-am
+
+@@ -765,7 +765,7 @@ uninstall-am: uninstall-info-am uninstal
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+- uninstall-toolexeclibLTLIBRARIES
++ uninstall-toolexeclibLTLIBRARIES install-exec-local
+
+
+ # Symbol versioning for shared libraries.
+@@ -942,6 +942,14 @@ build_debug: stamp-debug
+ install_debug:
+ (cd ${debugdir} && $(MAKE) \
+ toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
++
++install-exec-local:
++ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \
++ if [ x"$$pic_objs" != x ]; then \
++ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \
++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \
++ fi
++
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
diff --git a/patches/gcc-4.4.0/generic/gentoo/61_all_gcc4-ia64-noteGNUstack.patch b/patches/gcc-4.4.0/generic/gentoo/61_all_gcc4-ia64-noteGNUstack.patch
new file mode 100644
index 0000000..d05fe98
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/61_all_gcc4-ia64-noteGNUstack.patch
@@ -0,0 +1,112 @@
+2004-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ * config/rs6000/ppc-asm.h: Add .note.GNU-stack section also
+ on ppc64-linux.
+
+ * config/ia64/lib1funcs.asm: Add .note.GNU-stack section on
+ ia64-linux.
+ * config/ia64/crtbegin.asm: Likewise.
+ * config/ia64/crtend.asm: Likewise.
+ * config/ia64/crti.asm: Likewise.
+ * config/ia64/crtn.asm: Likewise.
+
+2004-05-14 Jakub Jelinek <jakub@redhat.com>
+
+ * config/ia64/linux.h (TARGET_ASM_FILE_END): Define.
+
+---
+ gcc/config/ia64/crtbegin.asm | 4 ++++
+ gcc/config/ia64/crtend.asm | 4 ++++
+ gcc/config/ia64/crti.asm | 4 ++++
+ gcc/config/ia64/crtn.asm | 4 ++++
+ gcc/config/ia64/lib1funcs.asm | 4 ++++
+ gcc/config/ia64/linux.h | 2 ++
+ gcc/config/rs6000/ppc-asm.h | 2 +-
+ 7 files changed, 23 insertions(+), 1 deletion(-)
+
+Index: gcc-4.4.0/gcc/config/ia64/crtbegin.asm
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/ia64/crtbegin.asm
++++ gcc-4.4.0/gcc/config/ia64/crtbegin.asm
+@@ -252,3 +252,7 @@ __do_jv_register_classes:
+ .weak __cxa_finalize
+ #endif
+ .weak _Jv_RegisterClasses
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+Index: gcc-4.4.0/gcc/config/ia64/crtend.asm
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/ia64/crtend.asm
++++ gcc-4.4.0/gcc/config/ia64/crtend.asm
+@@ -119,3 +119,7 @@ __do_global_ctors_aux:
+
+ br.ret.sptk.many rp
+ .endp __do_global_ctors_aux
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+Index: gcc-4.4.0/gcc/config/ia64/crti.asm
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/ia64/crti.asm
++++ gcc-4.4.0/gcc/config/ia64/crti.asm
+@@ -51,3 +51,7 @@ _fini:
+ .body
+
+ # end of crti.asm
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+Index: gcc-4.4.0/gcc/config/ia64/crtn.asm
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/ia64/crtn.asm
++++ gcc-4.4.0/gcc/config/ia64/crtn.asm
+@@ -41,3 +41,7 @@
+ br.ret.sptk.many b0
+
+ # end of crtn.asm
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+Index: gcc-4.4.0/gcc/config/ia64/lib1funcs.asm
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/ia64/lib1funcs.asm
++++ gcc-4.4.0/gcc/config/ia64/lib1funcs.asm
+@@ -793,3 +793,7 @@ __floattitf:
+ .endp __floattitf
+ #endif
+ #endif
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+Index: gcc-4.4.0/gcc/config/ia64/linux.h
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/ia64/linux.h
++++ gcc-4.4.0/gcc/config/ia64/linux.h
+@@ -5,6 +5,8 @@
+
+ #define TARGET_VERSION fprintf (stderr, " (IA-64) Linux");
+
++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
++
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #undef CC1_SPEC
+ #define CC1_SPEC "%{profile:-p} %{G*}"
+Index: gcc-4.4.0/gcc/config/rs6000/ppc-asm.h
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/rs6000/ppc-asm.h
++++ gcc-4.4.0/gcc/config/rs6000/ppc-asm.h
+@@ -172,7 +172,7 @@ GLUE(.L,name): \
+ .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name)
+ #endif
+
+-#if defined __linux__ && !defined __powerpc64__
++#if defined __linux__
+ .section .note.GNU-stack
+ .previous
+ #endif
diff --git a/patches/gcc-4.4.0/generic/gentoo/61_all_gcc43-pr24170.patch b/patches/gcc-4.4.0/generic/gentoo/61_all_gcc43-pr24170.patch
new file mode 100644
index 0000000..c9c46f0
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/61_all_gcc43-pr24170.patch
@@ -0,0 +1,69 @@
+http://gcc.gnu.org/PR24170
+
+2008-02-20 Tom Tromey <tromey@redhat.com>
+
+ PR libgcj/24170:
+ * java/io/natFilePosix.cc (File::performList): Don't use
+ readdir_r.
+ * configure, include/config.h.in: Rebuilt.
+ * configure.ac: Don't check for readdir_r.
+
+---
+ libjava/configure.ac | 2 +-
+ libjava/include/config.h.in | 3 ---
+ libjava/java/io/natFilePosix.cc | 8 +-------
+ 3 files changed, 2 insertions(+), 11 deletions(-)
+
+Index: gcc-4.3.1/libjava/configure.ac
+===================================================================
+--- gcc-4.3.1.orig/libjava/configure.ac
++++ gcc-4.3.1/libjava/configure.ac
+@@ -1023,7 +1023,7 @@ if test "x${with_newlib}" = "xyes"; then
+ PLATFORMNET=NoNet
+ else
+ AC_CHECK_FUNCS([strerror_r select fstat open fsync sleep opendir \
+- localtime_r readdir_r getpwuid_r getcwd \
++ localtime_r getpwuid_r getcwd \
+ access stat lstat mkdir rename rmdir unlink utime chmod readlink \
+ nl_langinfo setlocale \
+ inet_pton uname inet_ntoa \
+Index: gcc-4.3.1/libjava/include/config.h.in
+===================================================================
+--- gcc-4.3.1.orig/libjava/include/config.h.in
++++ gcc-4.3.1/libjava/include/config.h.in
+@@ -214,9 +214,6 @@
+ /* Define to 1 if you have the <pwd.h> header file. */
+ #undef HAVE_PWD_H
+
+-/* Define to 1 if you have the `readdir_r' function. */
+-#undef HAVE_READDIR_R
+-
+ /* Define to 1 if you have the `readlink' function. */
+ #undef HAVE_READLINK
+
+Index: gcc-4.3.1/libjava/java/io/natFilePosix.cc
+===================================================================
+--- gcc-4.3.1.orig/libjava/java/io/natFilePosix.cc
++++ gcc-4.3.1/libjava/java/io/natFilePosix.cc
+@@ -1,6 +1,6 @@
+ // natFile.cc - Native part of File class for POSIX.
+
+-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006
++/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2008
+ Free Software Foundation
+
+ This file is part of libgcj.
+@@ -292,13 +292,7 @@ java::io::File::performList (java::io::F
+
+ java::util::ArrayList *list = new java::util::ArrayList ();
+ struct dirent *d;
+-#if defined(HAVE_READDIR_R) && defined(_POSIX_PTHREAD_SEMANTICS)
+- int name_max = pathconf (buf, _PC_NAME_MAX);
+- char dbuf[sizeof (struct dirent) + name_max + 1];
+- while (readdir_r (dir, (struct dirent *) dbuf, &d) == 0 && d != NULL)
+-#else /* HAVE_READDIR_R */
+ while ((d = readdir (dir)) != NULL)
+-#endif /* HAVE_READDIR_R */
+ {
+ // Omit "." and "..".
+ if (d->d_name[0] == '.'
diff --git a/patches/gcc-4.4.0/generic/gentoo/62_all_gcc4-noteGNUstack.patch b/patches/gcc-4.4.0/generic/gentoo/62_all_gcc4-noteGNUstack.patch
new file mode 100644
index 0000000..c036159
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/62_all_gcc4-noteGNUstack.patch
@@ -0,0 +1,140 @@
+2005-02-08 Jakub Jelinek <jakub@redhat.com>
+
+ * src/alpha/osf.S: Add .note.GNU-stack on Linux.
+ * src/s390/sysv.S: Likewise.
+ * src/powerpc/linux64.S: Likewise.
+ * src/powerpc/linux64_closure.S: Likewise.
+ * src/powerpc/ppc_closure.S: Likewise.
+ * src/powerpc/sysv.S: Likewise.
+ * src/x86/unix64.S: Likewise.
+ * src/x86/sysv.S: Likewise.
+ * src/sparc/v8.S: Likewise.
+ * src/sparc/v9.S: Likewise.
+ * src/m68k/sysv.S: Likewise.
+ * src/ia64/unix.S: Likewise.
+ * src/arm/sysv.S: Likewise.
+
+ * ia64_save_regs_in_stack.s: Moved to...
+ * ia64_save_regs_in_stack.S: ... this. Add .note.GNU-stack
+ on Linux.
+
+---
+ boehm-gc/ia64_save_regs_in_stack.S | 15 +++++++++++++++
+ boehm-gc/ia64_save_regs_in_stack.s | 12 ------------
+ libffi/src/ia64/unix.S | 4 ++++
+ libffi/src/powerpc/linux64.S | 4 ++++
+ libffi/src/powerpc/linux64_closure.S | 4 ++++
+ libffi/src/powerpc/ppc_closure.S | 4 ++++
+ libffi/src/powerpc/sysv.S | 4 ++++
+ libffi/src/sparc/v9.S | 4 ++++
+ 8 files changed, 39 insertions(+), 12 deletions(-)
+
+Index: gcc-4.4.0/boehm-gc/ia64_save_regs_in_stack.S
+===================================================================
+--- /dev/null
++++ gcc-4.4.0/boehm-gc/ia64_save_regs_in_stack.S
+@@ -0,0 +1,15 @@
++ .text
++ .align 16
++ .global GC_save_regs_in_stack
++ .proc GC_save_regs_in_stack
++GC_save_regs_in_stack:
++ .bodyfoo.mpg
++ flushrs
++ ;;
++ mov r8=ar.bsp
++ br.ret.sptk.few rp
++ .endp GC_save_regs_in_stack
++
++#ifdef __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.4.0/boehm-gc/ia64_save_regs_in_stack.s
+===================================================================
+--- gcc-4.4.0.orig/boehm-gc/ia64_save_regs_in_stack.s
++++ /dev/null
+@@ -1,12 +0,0 @@
+- .text
+- .align 16
+- .global GC_save_regs_in_stack
+- .proc GC_save_regs_in_stack
+-GC_save_regs_in_stack:
+- .body
+- flushrs
+- ;;
+- mov r8=ar.bsp
+- br.ret.sptk.few rp
+- .endp GC_save_regs_in_stack
+-
+Index: gcc-4.4.0/libffi/src/ia64/unix.S
+===================================================================
+--- gcc-4.4.0.orig/libffi/src/ia64/unix.S
++++ gcc-4.4.0/libffi/src/ia64/unix.S
+@@ -553,3 +553,7 @@ ffi_closure_unix:
+ data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT
+ data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE
+ data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.4.0/libffi/src/powerpc/linux64.S
+===================================================================
+--- gcc-4.4.0.orig/libffi/src/powerpc/linux64.S
++++ gcc-4.4.0/libffi/src/powerpc/linux64.S
+@@ -179,3 +179,7 @@ ffi_call_LINUX64:
+ .align 3
+ .LEFDE1:
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.4.0/libffi/src/powerpc/linux64_closure.S
+===================================================================
+--- gcc-4.4.0.orig/libffi/src/powerpc/linux64_closure.S
++++ gcc-4.4.0/libffi/src/powerpc/linux64_closure.S
+@@ -204,3 +204,7 @@ ffi_closure_LINUX64:
+ .align 3
+ .LEFDE1:
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.4.0/libffi/src/powerpc/ppc_closure.S
+===================================================================
+--- gcc-4.4.0.orig/libffi/src/powerpc/ppc_closure.S
++++ gcc-4.4.0/libffi/src/powerpc/ppc_closure.S
+@@ -299,3 +299,7 @@ END(ffi_closure_SYSV)
+ #if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.4.0/libffi/src/powerpc/sysv.S
+===================================================================
+--- gcc-4.4.0.orig/libffi/src/powerpc/sysv.S
++++ gcc-4.4.0/libffi/src/powerpc/sysv.S
+@@ -227,3 +227,7 @@ END(ffi_call_SYSV)
+ #if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.4.0/libffi/src/sparc/v9.S
+===================================================================
+--- gcc-4.4.0.orig/libffi/src/sparc/v9.S
++++ gcc-4.4.0/libffi/src/sparc/v9.S
+@@ -304,3 +304,7 @@ longdouble1:
+ #ifdef __linux__
+ .section .note.GNU-stack,"",@progbits
+ #endif
++
++#ifdef __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
diff --git a/patches/gcc-4.4.0/generic/gentoo/64_all_gcc43-pr34571.patch b/patches/gcc-4.4.0/generic/gentoo/64_all_gcc43-pr34571.patch
new file mode 100644
index 0000000..f1c42af
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/64_all_gcc43-pr34571.patch
@@ -0,0 +1,27 @@
+http://gcc.gnu.org/PR34571
+
+2007-12-26 Rask Ingemann Lambertsen <rask@sygehus.dk>
+
+ PR target/34571
+ * config/alpha/alpha.c (alpha_cannot_force_const_mem): Use
+ symbolic_operand.
+ * varasm.c (output_constant_pool_1): Fix typo.
+
+---
+ gcc/config/alpha/alpha.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+Index: gcc-4.4.0/gcc/config/alpha/alpha.c
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/alpha/alpha.c
++++ gcc-4.4.0/gcc/config/alpha/alpha.c
+@@ -1119,8 +1119,7 @@ alpha_legitimize_address (rtx x, rtx scr
+ static bool
+ alpha_cannot_force_const_mem (rtx x)
+ {
+- enum rtx_code code = GET_CODE (x);
+- return code == SYMBOL_REF || code == LABEL_REF || code == CONST;
++ return symbolic_operand (x, GET_MODE (x));
+ }
+
+ /* We do not allow indirect calls to be optimized into sibling calls, nor
diff --git a/patches/gcc-4.4.0/generic/gentoo/66_all_gcc43-pr25343.patch b/patches/gcc-4.4.0/generic/gentoo/66_all_gcc43-pr25343.patch
new file mode 100644
index 0000000..15e645d
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/66_all_gcc43-pr25343.patch
@@ -0,0 +1,25 @@
+http://gcc.gnu.org/PR25343
+
+sniped from Debian
+
+2008-04-27 Roman Zippel <zippel@linux-m68k.org>
+
+ * config/host-linux.c (TRY_EMPTY_VM_SPACE): Define for __mc68000__.
+
+---
+ gcc/config/host-linux.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+Index: gcc-4.3.1/gcc/config/host-linux.c
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/host-linux.c
++++ gcc-4.3.1/gcc/config/host-linux.c
+@@ -84,6 +84,8 @@
+ # define TRY_EMPTY_VM_SPACE 0x8000000000
+ #elif defined(__sparc__)
+ # define TRY_EMPTY_VM_SPACE 0x60000000
++#elif defined(__mc68000__)
++# define TRY_EMPTY_VM_SPACE 0x40000000
+ #else
+ # define TRY_EMPTY_VM_SPACE 0
+ #endif
diff --git a/patches/gcc-4.4.0/generic/gentoo/74_all_sh-pr24836.patch b/patches/gcc-4.4.0/generic/gentoo/74_all_sh-pr24836.patch
new file mode 100644
index 0000000..cdf3313
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/gentoo/74_all_sh-pr24836.patch
@@ -0,0 +1,34 @@
+http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
+http://gcc.gnu.org/PR24836
+
+---
+ gcc/configure | 2 +-
+ gcc/configure.ac | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: gcc-4.4.0/gcc/configure.ac
+===================================================================
+--- gcc-4.4.0.orig/gcc/configure.ac
++++ gcc-4.4.0/gcc/configure.ac
+@@ -2673,7 +2673,7 @@ foo: .long 25
+ tls_first_minor=14
+ tls_as_opt="-m64 -Aesame --fatal-warnings"
+ ;;
+- sh-*-* | sh[34]-*-*)
++ sh-*-* | sh[34]*-*-*)
+ conftest_s='
+ .section ".tdata","awT",@progbits
+ foo: .long 25
+Index: gcc-4.4.0/gcc/configure
+===================================================================
+--- gcc-4.4.0.orig/gcc/configure
++++ gcc-4.4.0/gcc/configure
+@@ -22205,7 +22205,7 @@ foo: .long 25
+ tls_first_minor=14
+ tls_as_opt="-m64 -Aesame --fatal-warnings"
+ ;;
+- sh-*-* | sh[34]-*-*)
++ sh-*-* | sh[34]*-*-*)
+ conftest_s='
+ .section ".tdata","awT",@progbits
+ foo: .long 25
diff --git a/patches/gcc-4.4.0/generic/no-host-includes.diff b/patches/gcc-4.4.0/generic/no-host-includes.diff
new file mode 100644
index 0000000..6024b3d
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/no-host-includes.diff
@@ -0,0 +1,56 @@
+#
+# Submitted-By: Marc Kleine-Budde, 2006-11-03
+#
+# Error:
+#
+# No error :)
+# With this patch gcc bails out if you include a host include path into the searchlist (-I)
+#
+# Description:
+#
+# inspired by:
+# http://www.openembedded.org/repo/org.openembedded.dev/packages/gcc/gcc-4.1.1/zecke-no-host-includes.patch
+#
+---
+# gcc/incpath.c | 28 ++++++++++++++++++++++++++++
+# 1 file changed, 28 insertions(+)
+#
+Index: gcc-4.4.0/gcc/incpath.c
+===================================================================
+--- gcc-4.4.0.orig/gcc/incpath.c
++++ gcc-4.4.0/gcc/incpath.c
+@@ -417,6 +417,34 @@ add_path (char *path, int chain, int cxx
+ p->construct = 0;
+ p->user_supplied_p = user_supplied_p;
+
++#ifdef CROSS_COMPILE
++ /* A common error when cross compiling is including
++ host headers. This code below will try to fail fast
++ for cross compiling. Currently we consider /usr/include,
++ /opt/include and /sw/include as harmful. */
++ {
++ unsigned int i;
++ const char *bad_path[] = {
++ "/usr/include",
++ "/usr/local/include",
++ "/sw/include",
++ "/opt/include",
++ };
++
++ for (i = 0; i < sizeof(bad_path)/sizeof(bad_path[0]); i++) {
++ if( strstr(p->name, bad_path[i]) == p->name ) {
++ fprintf(stderr,_("\n"
++ "CROSS COMPILE Badness: %s in INCLUDEPATH: %s\n"
++ "\n"),
++
++ bad_path[i], p->name);
++
++ exit (FATAL_EXIT_CODE);
++ }
++ }
++ }
++#endif
++
+ add_cpp_dir_path (p, chain);
+ }
+
diff --git a/patches/gcc-4.4.0/generic/series b/patches/gcc-4.4.0/generic/series
new file mode 100644
index 0000000..195e66e
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/series
@@ -0,0 +1,31 @@
+# bail out on host includes
+no-host-includes.diff
+
+# ARM big endian and softfloat
+arm-softfloat.diff
+
+# bugfixes
+
+# from uclibc
+uclibc/100-uclibc-conf.patch
+# FIXME: doesn't apply any more
+#uclibc/104-gnuhurd-uclibc-conf.patch
+uclibc/301-missing-execinfo_h.patch
+uclibc/302-c99-snprintf.patch
+uclibc/305-libmudflap-susv3-legacy.patch
+uclibc/993-arm_insn-opinit-RTX_CODE-fixup.patch
+uclibc/995-short-enums.diff
+
+# from gentoo
+gentoo/00_all_gcc-4.1-alpha-mieee-default.patch
+gentoo/00_all_gcc-trampolinewarn.patch
+gentoo/11_all_gcc-netbsd-symbolic.patch
+gentoo/14_all_gcc-sparc64-bsd.patch
+gentoo/18_all_904-flatten-switch-stmt-00.patch
+gentoo/51_all_gcc-3.4-libiberty-pic.patch
+gentoo/53_all_gcc4-superh-default-multilib.patch
+gentoo/54_all_300-libstdc++-pic.patch
+gentoo/61_all_gcc4-ia64-noteGNUstack.patch
+gentoo/62_all_gcc4-noteGNUstack.patch
+gentoo/64_all_gcc43-pr34571.patch
+gentoo/74_all_sh-pr24836.patch
diff --git a/patches/gcc-4.4.0/generic/uclibc/100-uclibc-conf.patch b/patches/gcc-4.4.0/generic/uclibc/100-uclibc-conf.patch
new file mode 100644
index 0000000..0770c7a
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/uclibc/100-uclibc-conf.patch
@@ -0,0 +1,42 @@
+---
+ contrib/regression/objs-gcc.sh | 4 ++++
+ libjava/classpath/ltconfig | 4 ++--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+Index: gcc-4.4.0/contrib/regression/objs-gcc.sh
+===================================================================
+--- gcc-4.4.0.orig/contrib/regression/objs-gcc.sh
++++ gcc-4.4.0/contrib/regression/objs-gcc.sh
+@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
+ then
+ make all-gdb all-dejagnu all-ld || exit 1
+ make install-gdb install-dejagnu install-ld || exit 1
++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
++ then
++ make all-gdb all-dejagnu all-ld || exit 1
++ make install-gdb install-dejagnu install-ld || exit 1
+ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
+ make bootstrap || exit 1
+ make install || exit 1
+Index: gcc-4.4.0/libjava/classpath/ltconfig
+===================================================================
+--- gcc-4.4.0.orig/libjava/classpath/ltconfig
++++ gcc-4.4.0/libjava/classpath/ltconfig
+@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
+@@ -1251,7 +1251,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
diff --git a/patches/gcc-4.4.0/generic/uclibc/104-gnuhurd-uclibc-conf.patch b/patches/gcc-4.4.0/generic/uclibc/104-gnuhurd-uclibc-conf.patch
new file mode 100644
index 0000000..3e7b25a
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/uclibc/104-gnuhurd-uclibc-conf.patch
@@ -0,0 +1,18 @@
+---
+ gcc/config.gcc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+Index: gcc-4.3.1/gcc/config.gcc
+===================================================================
+--- gcc-4.3.1.orig/gcc/config.gcc
++++ gcc-4.3.1/gcc/config.gcc
+@@ -529,6 +529,9 @@ case ${target} in
+ alpha*)
+ tm_file="${cpu_type}/${cpu_type}.h alpha/elf.h alpha/linux.h alpha/linux-elf.h gnu.h ${tm_file}"
+ ;;
++ i[34567]86-*hurd*-*)
++ tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h i386/gnu.h gnu.h ${tm_file}"
++ ;;
+ i[34567]86-*-*)
+ tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h gnu.h ${tm_file}"
+ ;;
diff --git a/patches/gcc-4.4.0/generic/uclibc/301-missing-execinfo_h.patch b/patches/gcc-4.4.0/generic/uclibc/301-missing-execinfo_h.patch
new file mode 100644
index 0000000..90c366e
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/uclibc/301-missing-execinfo_h.patch
@@ -0,0 +1,17 @@
+---
+ boehm-gc/include/gc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: gcc-4.4.0/boehm-gc/include/gc.h
+===================================================================
+--- gcc-4.4.0.orig/boehm-gc/include/gc.h
++++ gcc-4.4.0/boehm-gc/include/gc.h
+@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
+ #if defined(__linux__) || defined(__GLIBC__)
+ # include <features.h>
+ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
+- && !defined(__ia64__)
++ && !defined(__ia64__) && !defined(__UCLIBC__)
+ # ifndef GC_HAVE_BUILTIN_BACKTRACE
+ # define GC_HAVE_BUILTIN_BACKTRACE
+ # endif
diff --git a/patches/gcc-4.4.0/generic/uclibc/302-c99-snprintf.patch b/patches/gcc-4.4.0/generic/uclibc/302-c99-snprintf.patch
new file mode 100644
index 0000000..671a3b7
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/uclibc/302-c99-snprintf.patch
@@ -0,0 +1,17 @@
+---
+ libstdc++-v3/include/c_global/cstdio | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: gcc-4.4.0/libstdc++-v3/include/c_global/cstdio
+===================================================================
+--- gcc-4.4.0.orig/libstdc++-v3/include/c_global/cstdio
++++ gcc-4.4.0/libstdc++-v3/include/c_global/cstdio
+@@ -139,7 +139,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
+
+ _GLIBCXX_END_NAMESPACE
+
+-#if _GLIBCXX_USE_C99
++#if _GLIBCXX_USE_C99 || defined __UCLIBC__
+
+ #undef snprintf
+ #undef vfscanf
diff --git a/patches/gcc-4.4.0/generic/uclibc/305-libmudflap-susv3-legacy.patch b/patches/gcc-4.4.0/generic/uclibc/305-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000..6341435
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/uclibc/305-libmudflap-susv3-legacy.patch
@@ -0,0 +1,53 @@
+---
+ libmudflap/mf-hooks2.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+Index: gcc-4.4.0/libmudflap/mf-hooks2.c
+===================================================================
+--- gcc-4.4.0.orig/libmudflap/mf-hooks2.c
++++ gcc-4.4.0/libmudflap/mf-hooks2.c
+@@ -421,7 +421,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
+ {
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
+- bzero (s, n);
++ memset (s, 0, n);
+ }
+
+
+@@ -431,7 +431,7 @@ WRAPPER2(void, bcopy, const void *src, v
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
+ MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
+- bcopy (src, dest, n);
++ memmove (dest, src, n);
+ }
+
+
+@@ -441,7 +441,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
+ MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
+- return bcmp (s1, s2, n);
++ return n == 0 ? 0 : memcmp (s1, s2, n);
+ }
+
+
+@@ -450,7 +450,7 @@ WRAPPER2(char *, index, const char *s, i
+ size_t n = strlen (s);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
+- return index (s, c);
++ return strchr (s, c);
+ }
+
+
+@@ -459,7 +459,7 @@ WRAPPER2(char *, rindex, const char *s,
+ size_t n = strlen (s);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
+- return rindex (s, c);
++ return strrchr (s, c);
+ }
+
+ /* XXX: stpcpy, memccpy */
diff --git a/patches/gcc-4.4.0/generic/uclibc/993-arm_insn-opinit-RTX_CODE-fixup.patch b/patches/gcc-4.4.0/generic/uclibc/993-arm_insn-opinit-RTX_CODE-fixup.patch
new file mode 100644
index 0000000..d150054
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/uclibc/993-arm_insn-opinit-RTX_CODE-fixup.patch
@@ -0,0 +1,41 @@
+gcc/ChangeLog
+2007-11-27 Bernhard Fischer <>
+
+ * config/arm/arm-protos.h (arm_vector_mode_supported_p,
+ arm_hard_regno_mode_ok, const_ok_for_arm): Do not hide non-rtx related
+ function prototypes in RTX_CODE.
+ * genopinit.c: Include tm_p.h.
+
+---
+ gcc/config/arm/arm-protos.h | 2 +-
+ gcc/genopinit.c | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+Index: gcc-4.4.0/gcc/config/arm/arm-protos.h
+===================================================================
+--- gcc-4.4.0.orig/gcc/config/arm/arm-protos.h
++++ gcc-4.4.0/gcc/config/arm/arm-protos.h
+@@ -43,10 +43,10 @@ extern unsigned int arm_dbx_register_num
+ extern void arm_output_fn_unwind (FILE *, bool);
+
+
+-#ifdef RTX_CODE
+ extern bool arm_vector_mode_supported_p (enum machine_mode);
+ extern int arm_hard_regno_mode_ok (unsigned int, enum machine_mode);
+ extern int const_ok_for_arm (HOST_WIDE_INT);
++#ifdef RTX_CODE
+ extern int arm_split_constant (RTX_CODE, enum machine_mode, rtx,
+ HOST_WIDE_INT, rtx, rtx, int);
+ extern RTX_CODE arm_canonicalize_comparison (RTX_CODE, enum machine_mode,
+Index: gcc-4.4.0/gcc/genopinit.c
+===================================================================
+--- gcc-4.4.0.orig/gcc/genopinit.c
++++ gcc-4.4.0/gcc/genopinit.c
+@@ -493,6 +493,7 @@ from the machine description file `md'.
+ printf ("#include \"expr.h\"\n");
+ printf ("#include \"optabs.h\"\n");
+ printf ("#include \"reload.h\"\n\n");
++ printf ("#include \"tm_p.h\"\n\n");
+
+ printf ("void\ninit_all_optabs (void)\n{\n");
+
diff --git a/patches/gcc-4.4.0/generic/uclibc/995-short-enums.diff b/patches/gcc-4.4.0/generic/uclibc/995-short-enums.diff
new file mode 100644
index 0000000..7f42a23
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/uclibc/995-short-enums.diff
@@ -0,0 +1,35 @@
+see gcc PR34205
+---
+ gcc/c-common.h | 1 +
+ gcc/rtl.h | 4 +++-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+Index: gcc-4.4.0/gcc/rtl.h
+===================================================================
+--- gcc-4.4.0.orig/gcc/rtl.h
++++ gcc-4.4.0/gcc/rtl.h
+@@ -48,9 +48,11 @@ enum rtx_code {
+ #include "rtl.def" /* rtl expressions are documented here */
+ #undef DEF_RTL_EXPR
+
+- LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
++ LAST_AND_UNUSED_RTX_CODE /* A convenient way to get a value for
+ NUM_RTX_CODE.
+ Assumes default enum value assignment. */
++ ,__LAST_AND_UNUSED_RTX_CODE=32767 /* Force 16bit width. */
++};
+
+ #define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
+ /* The cast here, saves many elsewhere. */
+Index: gcc-4.4.0/gcc/c-common.h
+===================================================================
+--- gcc-4.4.0.orig/gcc/c-common.h
++++ gcc-4.4.0/gcc/c-common.h
+@@ -130,6 +130,7 @@ enum rid
+ RID_LAST_AT = RID_AT_IMPLEMENTATION,
+ RID_FIRST_PQ = RID_IN,
+ RID_LAST_PQ = RID_ONEWAY
++ ,__LAST_AND_UNUSED_RID=32767 /* Force 16bit width. */
+ };
+
+ #define OBJC_IS_AT_KEYWORD(rid) \
diff --git a/patches/gcc-4.4.0/generic/uclibc/998-gcc-4.3.0-fix-header.00.patch b/patches/gcc-4.4.0/generic/uclibc/998-gcc-4.3.0-fix-header.00.patch
new file mode 100644
index 0000000..546198c
--- /dev/null
+++ b/patches/gcc-4.4.0/generic/uclibc/998-gcc-4.3.0-fix-header.00.patch
@@ -0,0 +1,19 @@
+\\\\
+\\ gcc PR33200
+---
+ gcc/config.gcc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: gcc-4.3.1/gcc/config.gcc
+===================================================================
+--- gcc-4.3.1.orig/gcc/config.gcc
++++ gcc-4.3.1/gcc/config.gcc
+@@ -2316,7 +2316,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbian
+ if test x${enable_incomplete_targets} = xyes ; then
+ tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SH5_32MEDIA=1 SUPPORT_SH5_32MEDIA_NOFPU=1 SUPPORT_SH5_64MEDIA=1 SUPPORT_SH5_64MEDIA_NOFPU=1"
+ fi
+- use_fixproto=yes
++ # XXX: why? use_fixproto=yes
+ ;;
+ sh-*-rtems*)
+ tmake_file="sh/t-sh sh/t-elf t-rtems sh/t-rtems"
diff --git a/patches/glibc-2.9/generic/0001--PRIVATE_FUTEX_OFFSET-Guard-sym-definition-with-i.patch b/patches/glibc-2.9/generic/0001--PRIVATE_FUTEX_OFFSET-Guard-sym-definition-with-i.patch
new file mode 100644
index 0000000..108fb46
--- /dev/null
+++ b/patches/glibc-2.9/generic/0001--PRIVATE_FUTEX_OFFSET-Guard-sym-definition-with-i.patch
@@ -0,0 +1,33 @@
+From 911474edb03aae49d007e9f238b3134aaa425fe5 Mon Sep 17 00:00:00 2001
+From: Ulrich Drepper <drepper@redhat.com>
+Date: Sat, 26 Jul 2008 16:24:40 +0000
+Subject: [PATCH] (PRIVATE_FUTEX_OFFSET): Guard sym definition with #ifndef __ASSUME_PRIVATE_FUTEX.
+
+The patch fixes this problem on powerpc with --enable-kernel >= 2.6.22
+
+gawk -f ../scripts/gen-as-const.awk ../nptl/sysdeps/powerpc/tcb-offsets.sym \
+ | powerpc-603e-linux-gnu-gcc -S -o /home/mkl/himalia-pengutronix/toolchain/OSELAS.Toolchain-trunk/platform-powerpc-603e-linux-gnu-gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/build-target/glibc-2.8-crt-build/tcb-offsets.hT3 -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -g -mnew-mnemonics -Wstrict-prototypes -mlong-double-128 -I../include -I/home/mkl/himalia-pengutronix/toolchain/OSELAS.Toolchain-trunk/platform-powerpc-603e-linux-gnu-gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/build-target/glibc-2.8-crt-build/csu -I/home/mkl/himalia-pengutronix/toolchain/OSELAS.Toolchain-trunk/platform-powerpc-603e-linux-gnu-gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/build-target/glibc-2.8-crt-build -I../sysdeps/powerpc/powerpc32/elf -I../sysdeps/powerpc/elf -I../sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu -I../sysdeps/powerpc/powerpc32/fpu -I../nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32 -I../sysdeps/unix/sysv/linux/powerpc/powerpc32 -I../nptl/sysdeps/unix/sysv/linux/powerpc -I../sysdeps/unix/sysv/linux/powerpc -I../sysdeps/ieee754/ldbl-128ibm -I../sysdeps/ieee754/ldbl-opt -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/powerpc -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/powerpc/powerpc32 -I../sysdeps/wordsize-32 -I../sysdeps/powerpc/fpu -I../nptl/sysdeps/powerpc -I../sysdeps/powerpc -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I.. -I../libio -I. -nostdinc -isystem /ptx/work/himalia/mkl/toolchain/OSELAS.Toolchain-trunk/inst/opt/OSELAS.Toolchain-trunk/powerpc-603e-linux-gnu/gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/bin/../lib/gcc/powerpc-603e-linux-gnu/4.3.2/include -isystem /ptx/work/himalia/mkl/toolchain/OSELAS.Toolchain-trunk/inst/opt/OSELAS.Toolchain-trunk/powerpc-603e-linux-gnu/gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/bin/../lib/gcc/powerpc-603e-linux-gnu/4.3.2/include-fixed -isystem /home/mkl/himalia-pengutronix/toolchain/OSELAS.Toolchain-trunk/inst/opt/OSELAS.Toolchain-trunk/powerpc-603e-linux-gnu/gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/sysroot-powerpc-603e-linux-gnu/usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DHAVE_INITFINI -x c - \
+ -MD -MP -MF /home/mkl/himalia-pengutronix/toolchain/OSELAS.Toolchain-trunk/platform-powerpc-603e-linux-gnu-gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/build-target/glibc-2.8-crt-build/tcb-offsets.h.dT -MT '/home/mkl/himalia-pengutronix/toolchain/OSELAS.Toolchain-trunk/platform-powerpc-603e-linux-gnu-gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/build-target/glibc-2.8-crt-build/tcb-offsets.h.d /home/mkl/himalia-pengutronix/toolchain/OSELAS.Toolchain-trunk/platform-powerpc-603e-linux-gnu-gcc-4.3.2-glibc-2.8-binutils-2.18-kernel-2.6.27-sanitized/build-target/glibc-2.8-crt-build/tcb-offsets.h'
+<stdin>: In function 'dummy':
+<stdin>:13: error: 'struct <anonymous>' has no member named 'private_futex'
+
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+
+---
+ nptl/sysdeps/powerpc/tcb-offsets.sym | 2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/nptl/sysdeps/powerpc/tcb-offsets.sym b/nptl/sysdeps/powerpc/tcb-offsets.sym
+index eda43dc..8ac133d 100644
+--- a/nptl/sysdeps/powerpc/tcb-offsets.sym
++++ b/nptl/sysdeps/powerpc/tcb-offsets.sym
+@@ -15,4 +15,6 @@ MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
+ PID thread_offsetof (pid)
+ TID thread_offsetof (tid)
+ POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t))
++#ifndef __ASSUME_PRIVATE_FUTEX
+ PRIVATE_FUTEX_OFFSET thread_offsetof (header.private_futex)
++#endif
+--
+1.5.6.5
+
diff --git a/patches/glibc-2.9/generic/configure-sane_readelf.diff b/patches/glibc-2.9/generic/configure-sane_readelf.diff
new file mode 100644
index 0000000..21639fd
--- /dev/null
+++ b/patches/glibc-2.9/generic/configure-sane_readelf.diff
@@ -0,0 +1,119 @@
+---
+ configure | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 88 insertions(+), 2 deletions(-)
+
+Index: glibc-2.9/configure
+===================================================================
+--- glibc-2.9.orig/configure
++++ glibc-2.9/configure
+@@ -5989,6 +5989,92 @@ _ACEOF
+ fi
+ fi
+
++ # Extract the first word of "$target_alias-readelf", so it can be a program name with args.
++set dummy $target_alias-readelf; ac_word=$2
++{ echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
++if test "${ac_cv_prog_READELF+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ if test -n "$READELF"; then
++ ac_cv_prog_READELF="$READELF" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
++ ac_cv_prog_READELF="$target_alias-readelf"
++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++done
++IFS=$as_save_IFS
++
++fi
++fi
++READELF=$ac_cv_prog_READELF
++if test -n "$READELF"; then
++ { echo "$as_me:$LINENO: result: $READELF" >&5
++echo "${ECHO_T}$READELF" >&6; }
++else
++ { echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6; }
++fi
++
++
++if test -z "$ac_cv_prog_READELF"; then
++ if test "$build" = "$target"; then
++ ac_ct_READELF=$READELF
++ # Extract the first word of "readelf", so it can be a program name with args.
++set dummy readelf; ac_word=$2
++{ echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
++if test "${ac_cv_prog_ac_ct_READELF+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ if test -n "$ac_ct_READELF"; then
++ ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
++ ac_cv_prog_ac_ct_READELF="readelf"
++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++done
++IFS=$as_save_IFS
++
++ test -z "$ac_cv_prog_ac_ct_READELF" && ac_cv_prog_ac_ct_READELF="readelf"
++fi
++fi
++ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
++if test -n "$ac_ct_READELF"; then
++ { echo "$as_me:$LINENO: result: $ac_ct_READELF" >&5
++echo "${ECHO_T}$ac_ct_READELF" >&6; }
++else
++ { echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6; }
++fi
++
++ READELF=ac_ct_READELF
++ else
++ READELF="readelf"
++ fi
++else
++ READELF="$ac_cv_prog_READELF"
++fi
++
++
+ { echo "$as_me:$LINENO: checking for .preinit_array/.init_array/.fini_array support" >&5
+ echo $ECHO_N "checking for .preinit_array/.init_array/.fini_array support... $ECHO_C" >&6; }
+ if test "${libc_cv_initfini_array+set}" = set; then
+@@ -6008,7 +6094,7 @@ EOF
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+- if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
++ if ${READELF} -S conftest | fgrep INIT_ARRAY > /dev/null; then
+ libc_cv_initfini_array=yes
+ else
+ libc_cv_initfini_array=no
+@@ -6308,7 +6394,7 @@ EOF
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+- if readelf -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
++ if ${READELF} -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
+ libc_cv_z_combreloc=yes
+ else
+ libc_cv_z_combreloc=no
diff --git a/patches/glibc-2.9/generic/configure_in-sane_readelf.diff b/patches/glibc-2.9/generic/configure_in-sane_readelf.diff
new file mode 100644
index 0000000..cfdd818
--- /dev/null
+++ b/patches/glibc-2.9/generic/configure_in-sane_readelf.diff
@@ -0,0 +1,35 @@
+---
+ configure.in | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+Index: glibc-2.9/configure.in
+===================================================================
+--- glibc-2.9.orig/configure.in
++++ glibc-2.9/configure.in
+@@ -1353,6 +1353,8 @@ EOF
+ fi
+ fi
+
++ AC_CHECK_TARGET_TOOL([READELF],[readelf],[readelf],[$PATH])
++
+ AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
+ libc_cv_initfini_array, [dnl
+ cat > conftest.c <<EOF
+@@ -1364,7 +1366,7 @@ EOF
+ if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
+ -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
+ then
+- if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
++ if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
+ libc_cv_initfini_array=yes
+ else
+ libc_cv_initfini_array=no
+@@ -1549,7 +1551,7 @@ dnl cross-platform since the gcc used ca
+ dnl introducing new options this is not easily doable. Instead use a tool
+ dnl which always is cross-platform: readelf. To detect whether -z combreloc
+ dnl look for a section named .rel.dyn.
+- if readelf -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
++ if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
+ libc_cv_z_combreloc=yes
+ else
+ libc_cv_z_combreloc=no
diff --git a/patches/glibc-2.9/generic/gentoo/0030_all_glibc-respect-env-CPPFLAGS.patch b/patches/glibc-2.9/generic/gentoo/0030_all_glibc-respect-env-CPPFLAGS.patch
new file mode 100644
index 0000000..20f21c2
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/0030_all_glibc-respect-env-CPPFLAGS.patch
@@ -0,0 +1,32 @@
+Respect environment CPPFLAGS when we run ./configure so we can inject
+random -D things without having to set CFLAGS/ASFLAGS
+
+---
+ Makeconfig | 1 +
+ config.make.in | 1 +
+ 2 files changed, 2 insertions(+)
+
+Index: glibc-2.9/Makeconfig
+===================================================================
+--- glibc-2.9.orig/Makeconfig
++++ glibc-2.9/Makeconfig
+@@ -673,6 +673,7 @@ CPPFLAGS = $($(subdir)-CPPFLAGS) $(+incl
+ $(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)) \
+Index: glibc-2.9/config.make.in
+===================================================================
+--- glibc-2.9.orig/config.make.in
++++ glibc-2.9/config.make.in
+@@ -97,6 +97,7 @@ CC = @CC@
+ 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/generic/gentoo/0040_all_glibc-i586-chk.patch b/patches/glibc-2.9/generic/gentoo/0040_all_glibc-i586-chk.patch
new file mode 100644
index 0000000..815bae7
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/0040_all_glibc-i586-chk.patch
@@ -0,0 +1,32 @@
+http://bugs.gentoo.org/199479
+
+2007-09-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/i386/i586/memcpy_chk.S: New file.
+ * sysdeps/i386/i586/mempcpy_chk.S: Likewise.
+ * sysdeps/i386/i586/memset_chk.S: Likewise.
+
+---
+ i386/i586/memcpy_chk.S | 1 +
+ i386/i586/mempcpy_chk.S | 1 +
+ i386/i586/memset_chk.S | 1 +
+ 3 files changed, 3 insertions(+)
+
+Index: glibc-2.9/i386/i586/memcpy_chk.S
+===================================================================
+--- /dev/null
++++ glibc-2.9/i386/i586/memcpy_chk.S
+@@ -0,0 +1 @@
++#include <sysdeps/i386/i686/memcpy_chk.S>
+Index: glibc-2.9/i386/i586/mempcpy_chk.S
+===================================================================
+--- /dev/null
++++ glibc-2.9/i386/i586/mempcpy_chk.S
+@@ -0,0 +1 @@
++#include <sysdeps/i386/i686/mempcpy_chk.S>
+Index: glibc-2.9/i386/i586/memset_chk.S
+===================================================================
+--- /dev/null
++++ glibc-2.9/i386/i586/memset_chk.S
+@@ -0,0 +1 @@
++#include <sysdeps/i386/i686/memset_chk.S>
diff --git a/patches/glibc-2.9/generic/gentoo/0070_all_glibc-i386-x86_64-revert-clone-cfi.patch b/patches/glibc-2.9/generic/gentoo/0070_all_glibc-i386-x86_64-revert-clone-cfi.patch
new file mode 100644
index 0000000..e4eece9
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/0070_all_glibc-i386-x86_64-revert-clone-cfi.patch
@@ -0,0 +1,55 @@
+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
+
+---
+ sysdeps/unix/sysv/linux/i386/clone.S | 4 ----
+ sysdeps/unix/sysv/linux/x86_64/clone.S | 4 ----
+ 2 files changed, 8 deletions(-)
+
+Index: glibc-2.9/sysdeps/unix/sysv/linux/i386/clone.S
+===================================================================
+--- glibc-2.9.orig/sysdeps/unix/sysv/linux/i386/clone.S
++++ glibc-2.9/sysdeps/unix/sysv/linux/i386/clone.S
+@@ -120,9 +120,6 @@ L(pseudo_end):
+ 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 @@ L(nomoregetpid):
+ jmp L(haspid)
+ .previous
+ #endif
+- cfi_endproc;
+
+ cfi_startproc
+ PSEUDO_END (BP_SYM (__clone))
+Index: glibc-2.9/sysdeps/unix/sysv/linux/x86_64/clone.S
+===================================================================
+--- glibc-2.9.orig/sysdeps/unix/sysv/linux/x86_64/clone.S
++++ glibc-2.9/sysdeps/unix/sysv/linux/x86_64/clone.S
+@@ -89,9 +89,6 @@ L(pseudo_end):
+ 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 @@ L(thread_start):
+ /* 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/generic/gentoo/1010_all_glibc-queue-header-updates.patch b/patches/glibc-2.9/generic/gentoo/1010_all_glibc-queue-header-updates.patch
new file mode 100644
index 0000000..31a2dc6
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1010_all_glibc-queue-header-updates.patch
@@ -0,0 +1,89 @@
+grab some updates from FreeBSD
+
+http://bugs.gentoo.org/201979
+
+---
+ misc/sys/queue.h | 37 +++++++++++++++++++++++++++++++++++++
+ 1 file changed, 37 insertions(+)
+
+Index: glibc-2.9/misc/sys/queue.h
+===================================================================
+--- glibc-2.9.orig/misc/sys/queue.h
++++ glibc-2.9/misc/sys/queue.h
+@@ -136,6 +136,11 @@ struct { \
+ (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 @@ struct { \
+ #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 @@ struct { \
+ (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 @@ struct { \
+ #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 @@ struct { \
+ (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/generic/gentoo/1030_all_glibc-manual-no-perl.patch b/patches/glibc-2.9/generic/gentoo/1030_all_glibc-manual-no-perl.patch
new file mode 100644
index 0000000..cec6f1e
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1030_all_glibc-manual-no-perl.patch
@@ -0,0 +1,29 @@
+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
+
+---
+ manual/Makefile | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+Index: glibc-2.9/manual/Makefile
+===================================================================
+--- glibc-2.9.orig/manual/Makefile
++++ glibc-2.9/manual/Makefile
+@@ -104,9 +104,14 @@ dir-add.texi: xtract-typefun.awk $(texis
+ 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/generic/gentoo/1040_all_2.3.3-localedef-fix-trampoline.patch b/patches/glibc-2.9/generic/gentoo/1040_all_2.3.3-localedef-fix-trampoline.patch
new file mode 100644
index 0000000..d5c12c1
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1040_all_2.3.3-localedef-fix-trampoline.patch
@@ -0,0 +1,74 @@
+#! /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
+
+---
+ locale/programs/3level.h | 36 ++++++++++++++++++++++++++++++++++++
+ 1 file changed, 36 insertions(+)
+
+Index: glibc-2.9/locale/programs/3level.h
+===================================================================
+--- glibc-2.9.orig/locale/programs/3level.h
++++ glibc-2.9/locale/programs/3level.h
+@@ -203,6 +203,42 @@ CONCAT(TABLE,_iterate) (struct TABLE *t,
+ }
+ }
+ }
++
++/* 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/generic/gentoo/1050_all_glibc-posix-awk.patch b/patches/glibc-2.9/generic/gentoo/1050_all_glibc-posix-awk.patch
new file mode 100644
index 0000000..1847ac0
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1050_all_glibc-posix-awk.patch
@@ -0,0 +1,23 @@
+http://bugs.gentoo.org/202511
+
+2007-12-24 Mike Frysinger <vapier@gentoo.org>
+
+ * elf/Makefile ($(objpfx)ld.so): Use POSIX (EF)? in awk.
+
+---
+ elf/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: glibc-2.9/elf/Makefile
+===================================================================
+--- glibc-2.9.orig/elf/Makefile
++++ glibc-2.9/elf/Makefile
+@@ -312,7 +312,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld
+ -Wl,-soname=$(rtld-installed-name) -T $@.lds
+ rm -f $@.lds
+ readelf -s $@ \
+- | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
++ | $(AWK) '($$7 ~ /^UND(EF)?$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
+
+ # interp.c exists just to get this string into the libraries.
+ CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
diff --git a/patches/glibc-2.9/generic/gentoo/1055_all_glibc-resolv-dynamic.patch b/patches/glibc-2.9/generic/gentoo/1055_all_glibc-resolv-dynamic.patch
new file mode 100644
index 0000000..b7298a3
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1055_all_glibc-resolv-dynamic.patch
@@ -0,0 +1,44 @@
+ripped from SuSE
+
+if /etc/resolv.conf is updated, then make sure applications
+already running get the updated information.
+
+http://bugs.gentoo.org/177416
+
+---
+ resolv/res_libc.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+Index: glibc-2.9/resolv/res_libc.c
+===================================================================
+--- glibc-2.9.orig/resolv/res_libc.c
++++ glibc-2.9/resolv/res_libc.c
+@@ -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 @@ int
+ __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/generic/gentoo/1075_all_glibc-section-comments.patch b/patches/glibc-2.9/generic/gentoo/1075_all_glibc-section-comments.patch
new file mode 100644
index 0000000..8dee276
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1075_all_glibc-section-comments.patch
@@ -0,0 +1,29 @@
+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
+
+---
+ include/libc-symbols.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+Index: glibc-2.9/include/libc-symbols.h
+===================================================================
+--- glibc-2.9.orig/include/libc-symbols.h
++++ glibc-2.9/include/libc-symbols.h
+@@ -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/generic/gentoo/1080_all_glibc-no-inline-gmon.patch b/patches/glibc-2.9/generic/gentoo/1080_all_glibc-no-inline-gmon.patch
new file mode 100644
index 0000000..5db0cbb
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1080_all_glibc-no-inline-gmon.patch
@@ -0,0 +1,38 @@
+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)).
+
+---
+ sysdeps/generic/initfini.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: glibc-2.9/sysdeps/generic/initfini.c
+===================================================================
+--- glibc-2.9.orig/sysdeps/generic/initfini.c
++++ glibc-2.9/sysdeps/generic/initfini.c
+@@ -70,7 +70,7 @@ asm ("\n/*@TESTS_END*/");
+ /* 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/generic/gentoo/1090_all_glibc-2.3.6-fix-pr631.patch b/patches/glibc-2.9/generic/gentoo/1090_all_glibc-2.3.6-fix-pr631.patch
new file mode 100644
index 0000000..7512b99
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1090_all_glibc-2.3.6-fix-pr631.patch
@@ -0,0 +1,52 @@
+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
+
+---
+ Makeconfig | 2 +-
+ elf/Makefile | 7 +++++++
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+Index: glibc-2.9/Makeconfig
+===================================================================
+--- glibc-2.9.orig/Makeconfig
++++ glibc-2.9/Makeconfig
+@@ -509,7 +509,7 @@ endif
+
+ # 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...
+Index: glibc-2.9/elf/Makefile
+===================================================================
+--- glibc-2.9.orig/elf/Makefile
++++ glibc-2.9/elf/Makefile
+@@ -121,6 +121,13 @@ install-others = $(inst_slibdir)/$(rtld-
+ 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/generic/gentoo/1100_all_glibc-2.3.3-china.patch b/patches/glibc-2.9/generic/gentoo/1100_all_glibc-2.3.3-china.patch
new file mode 100644
index 0000000..25cc8e2
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1100_all_glibc-2.3.3-china.patch
@@ -0,0 +1,35 @@
+---
+ localedata/locales/zh_TW | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+Index: glibc-2.9/localedata/locales/zh_TW
+===================================================================
+--- glibc-2.9.orig/localedata/locales/zh_TW
++++ glibc-2.9/localedata/locales/zh_TW
+@@ -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 @@ escape_char /
+ % 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 @@ email "bug-glibc-locales@gnu.org"
+ 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/generic/gentoo/1103_all_glibc-new-valencian-locale.patch b/patches/glibc-2.9/generic/gentoo/1103_all_glibc-new-valencian-locale.patch
new file mode 100644
index 0000000..c55e656
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1103_all_glibc-new-valencian-locale.patch
@@ -0,0 +1,122 @@
+http://bugs.gentoo.org/show_bug.cgi?id=131815
+http://sourceware.org/bugzilla/show_bug.cgi?id=2522
+
+---
+ localedata/SUPPORTED | 2
+ localedata/locales/ca_ES@valencia | 96 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 98 insertions(+)
+
+Index: glibc-2.9/localedata/SUPPORTED
+===================================================================
+--- glibc-2.9.orig/localedata/SUPPORTED
++++ glibc-2.9/localedata/SUPPORTED
+@@ -72,6 +72,8 @@ ca_AD/ISO-8859-15 \
+ 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 \
+Index: glibc-2.9/localedata/locales/ca_ES@valencia
+===================================================================
+--- /dev/null
++++ glibc-2.9/localedata/locales/ca_ES@valencia
+@@ -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/generic/gentoo/1120_all_glibc-2.5-strict-aliasing.patch b/patches/glibc-2.9/generic/gentoo/1120_all_glibc-2.5-strict-aliasing.patch
new file mode 100644
index 0000000..6a11fc2
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1120_all_glibc-2.5-strict-aliasing.patch
@@ -0,0 +1,91 @@
+workaround strict aliasing warnings on individual files rather than
+forcing the whole build with -fno-strict-aliasing
+
+http://bugs.gentoo.org/155906
+
+note that we leave the logout.c and logwtmp.c warnings alone as the
+code path that invokes the warning should not be executed when the
+warning is applicable.
+
+---
+ libio/Makefile | 4 ++--
+ nis/Makefile | 3 +++
+ nptl/Makefile | 1 +
+ nss/Makefile | 2 ++
+ sunrpc/Makefile | 2 +-
+ 5 files changed, 9 insertions(+), 3 deletions(-)
+
+Index: glibc-2.9/libio/Makefile
+===================================================================
+--- glibc-2.9.orig/libio/Makefile
++++ glibc-2.9/libio/Makefile
+@@ -91,7 +91,7 @@ CFLAGS-fseeko.c = $(exceptions)
+ CFLAGS-ftello64.c = $(exceptions)
+ CFLAGS-ftello.c = $(exceptions)
+ CFLAGS-fwide.c = $(exceptions)
+-CFLAGS-genops.c = $(exceptions)
++CFLAGS-genops.c = $(exceptions) -fno-strict-aliasing
+ CFLAGS-getc.c = $(exceptions)
+ CFLAGS-getchar.c = $(exceptions)
+ CFLAGS-getwc.c = $(exceptions)
+@@ -133,7 +133,7 @@ CFLAGS-putwc.c = $(exceptions)
+ CFLAGS-putwchar.c = $(exceptions)
+ CFLAGS-rewind.c = $(exceptions)
+ CFLAGS-wfileops.c = $(exceptions)
+-CFLAGS-wgenops.c = $(exceptions)
++CFLAGS-wgenops.c = $(exceptions) -fno-strict-aliasing
+ CFLAGS-oldiofopen.c = $(exceptions)
+ CFLAGS-iofopen.c = $(exceptions)
+ CFLAGS-iofopen64.c = $(exceptions)
+Index: glibc-2.9/nis/Makefile
+===================================================================
+--- glibc-2.9.orig/nis/Makefile
++++ glibc-2.9/nis/Makefile
+@@ -67,6 +67,9 @@ libnss_nisplus-routines := $(addprefix n
+ nss-nisplus nisplus-initgroups
+ libnss_nisplus-inhibit-o = $(filter-out .os,$(object-suffixes))
+
++CFLAGS-nis_xdr.c += -fno-strict-aliasing
++CFLAGS-yp_xdr.c += -fno-strict-aliasing
++
+ include ../Rules
+
+
+Index: glibc-2.9/nptl/Makefile
+===================================================================
+--- glibc-2.9.orig/nptl/Makefile
++++ glibc-2.9/nptl/Makefile
+@@ -193,6 +193,7 @@ CFLAGS-tcdrain.c = -fexceptions -fasynch
+
+ CFLAGS-pt-system.c = -fexceptions
+
++CFLAGS-unwind-dw2.c += -fno-strict-aliasing
+
+ tests = tst-typesizes \
+ tst-attr1 tst-attr2 tst-attr3 \
+Index: glibc-2.9/nss/Makefile
+===================================================================
+--- glibc-2.9.orig/nss/Makefile
++++ glibc-2.9/nss/Makefile
+@@ -72,6 +72,8 @@ ifneq ($(build-static-nss),yes)
+ libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
+ endif
+
++CFLAGS-nsswitch.c += -fno-strict-aliasing
++
+ include ../Rules
+
+
+Index: glibc-2.9/sunrpc/Makefile
+===================================================================
+--- glibc-2.9.orig/sunrpc/Makefile
++++ glibc-2.9/sunrpc/Makefile
+@@ -127,7 +127,7 @@ CFLAGS-pmap_rmt.c = -fexceptions
+ CFLAGS-clnt_perr.c = -fexceptions
+ CFLAGS-openchild.c = -fexceptions
+
+-CPPFLAGS += -D_RPC_THREAD_SAFE_
++CPPFLAGS += -D_RPC_THREAD_SAFE_ -fno-strict-aliasing
+
+ include ../Rules
+
diff --git a/patches/glibc-2.9/generic/gentoo/1130_all_glibc-2.4-undefine-__i686.patch b/patches/glibc-2.9/generic/gentoo/1130_all_glibc-2.4-undefine-__i686.patch
new file mode 100644
index 0000000..6384190
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/1130_all_glibc-2.4-undefine-__i686.patch
@@ -0,0 +1,49 @@
+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.
+
+---
+ nptl/sysdeps/pthread/pt-initfini.c | 3 +++
+ sysdeps/i386/sysdep.h | 8 ++++++++
+ 2 files changed, 11 insertions(+)
+
+Index: glibc-2.9/nptl/sysdeps/pthread/pt-initfini.c
+===================================================================
+--- glibc-2.9.orig/nptl/sysdeps/pthread/pt-initfini.c
++++ glibc-2.9/nptl/sysdeps/pthread/pt-initfini.c
+@@ -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*/");
+
+Index: glibc-2.9/sysdeps/i386/sysdep.h
+===================================================================
+--- glibc-2.9.orig/sysdeps/i386/sysdep.h
++++ glibc-2.9/sysdeps/i386/sysdep.h
+@@ -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/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch b/patches/glibc-2.9/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..6ed2098
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch
@@ -0,0 +1,73 @@
+ 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).
+
+---
+ nptl/allocatestack.c | 3 ++-
+ sysdeps/unix/sysv/linux/dl-execstack.c | 19 ++++++++++++++++---
+ 2 files changed, 18 insertions(+), 4 deletions(-)
+
+Index: glibc-2.9/nptl/allocatestack.c
+===================================================================
+--- glibc-2.9.orig/nptl/allocatestack.c
++++ glibc-2.9/nptl/allocatestack.c
+@@ -299,7 +299,8 @@ change_stack_perm (struct pthread *pd
+ # 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;
+ }
+Index: glibc-2.9/sysdeps/unix/sysv/linux/dl-execstack.c
+===================================================================
+--- glibc-2.9.orig/sysdeps/unix/sysv/linux/dl-execstack.c
++++ glibc-2.9/sysdeps/unix/sysv/linux/dl-execstack.c
+@@ -63,7 +63,10 @@ _dl_make_stack_executable (void **stack_
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@ _dl_make_stack_executable (void **stack_
+ 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 @@ _dl_make_stack_executable (void **stack_
+ 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/generic/gentoo/3010_all_2.3.3_pre20040117-pt_pax.patch b/patches/glibc-2.9/generic/gentoo/3010_all_2.3.3_pre20040117-pt_pax.patch
new file mode 100644
index 0000000..69f7bd5
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/3010_all_2.3.3_pre20040117-pt_pax.patch
@@ -0,0 +1,35 @@
+---
+ elf/elf.h | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+Index: glibc-2.9/elf/elf.h
+===================================================================
+--- glibc-2.9.orig/elf/elf.h
++++ glibc-2.9/elf/elf.h
+@@ -571,6 +571,7 @@ typedef struct
+ #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 @@ typedef struct
+ #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/generic/gentoo/6400_all_sh-glibc-2.3.2-fpscr_values.patch b/patches/glibc-2.9/generic/gentoo/6400_all_sh-glibc-2.3.2-fpscr_values.patch
new file mode 100644
index 0000000..435ed87
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/6400_all_sh-glibc-2.3.2-fpscr_values.patch
@@ -0,0 +1,42 @@
+http://sources.redhat.com/ml/libc-alpha/2003-06/msg00027.html
+http://www.m17n.org/linux-sh/ml/linux-sh/2003-05/msg00010.html
+
+http://rpm.sh-linux.org/rpm-2004/target/SRPMS/glibc-2.3.3-27.12.src.rpm
+
+http://bugs.gentoo.org/100696
+
+---
+ sysdeps/unix/sysv/linux/sh/Versions | 1 +
+ sysdeps/unix/sysv/linux/sh/sysdep.S | 10 ++++++++++
+ 2 files changed, 11 insertions(+)
+
+Index: glibc-2.9/sysdeps/unix/sysv/linux/sh/Versions
+===================================================================
+--- glibc-2.9.orig/sysdeps/unix/sysv/linux/sh/Versions
++++ glibc-2.9/sysdeps/unix/sysv/linux/sh/Versions
+@@ -2,6 +2,7 @@ libc {
+ GLIBC_2.2 {
+ # functions used in other libraries
+ __xstat64; __fxstat64; __lxstat64;
++ __fpscr_values;
+
+ # a*
+ alphasort64;
+Index: glibc-2.9/sysdeps/unix/sysv/linux/sh/sysdep.S
+===================================================================
+--- glibc-2.9.orig/sysdeps/unix/sysv/linux/sh/sysdep.S
++++ glibc-2.9/sysdeps/unix/sysv/linux/sh/sysdep.S
+@@ -32,3 +32,13 @@ ENTRY (__syscall_error)
+
+ #define __syscall_error __syscall_error_1
+ #include <sysdeps/unix/sh/sysdep.S>
++
++ .data
++ .align 3
++ .globl ___fpscr_values
++ .type ___fpscr_values, @object
++ .size ___fpscr_values, 8
++___fpscr_values:
++ .long 0
++ .long 0x80000
++weak_alias (___fpscr_values, __fpscr_values)
diff --git a/patches/glibc-2.9/generic/gentoo/6415_all_sh-glibc-2.5-no-asm-user-header.patch b/patches/glibc-2.9/generic/gentoo/6415_all_sh-glibc-2.5-no-asm-user-header.patch
new file mode 100644
index 0000000..19e870f
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/6415_all_sh-glibc-2.5-no-asm-user-header.patch
@@ -0,0 +1,76 @@
+2007-03-13 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/unix/sysv/linux/sh/sys/user.h: Copy Linux's asm-sh/user.h.
+
+---
+ sysdeps/unix/sysv/linux/sh/sys/user.h | 56 ++++++++++++++++++++++++++++++++--
+ 1 file changed, 53 insertions(+), 3 deletions(-)
+
+Index: glibc-2.9/sysdeps/unix/sysv/linux/sh/sys/user.h
+===================================================================
+--- glibc-2.9.orig/sysdeps/unix/sysv/linux/sh/sys/user.h
++++ glibc-2.9/sysdeps/unix/sysv/linux/sh/sys/user.h
+@@ -19,10 +19,60 @@
+ #ifndef _SYS_USER_H
+ #define _SYS_USER_H 1
+
+-#include <features.h>
++#include <unistd.h>
++#include <asm/ptrace.h>
+
+-#include <asm/user.h>
++/*
++ * Core file format: The core file is written in such a way that gdb
++ * can understand it and provide useful information to the user (under
++ * linux we use the `trad-core' bfd). The file contents are as follows:
++ *
++ * upage: 1 page consisting of a user struct that tells gdb
++ * what is present in the file. Directly after this is a
++ * copy of the task_struct, which is currently not used by gdb,
++ * but it may come in handy at some point. All of the registers
++ * are stored as part of the upage. The upage should always be
++ * only one page long.
++ * data: The data segment follows next. We use current->end_text to
++ * current->brk to pick up all of the user variables, plus any memory
++ * that may have been sbrk'ed. No attempt is made to determine if a
++ * page is demand-zero or if a page is totally unused, we just cover
++ * the entire range. All of the addresses are rounded in such a way
++ * that an integral number of pages is written.
++ * stack: We need the stack information in order to get a meaningful
++ * backtrace. We need to write the data from usp to
++ * current->start_stack, so we round each of these in order to be able
++ * to write an integer number of pages.
++ */
+
+-#undef start_thread
++struct user_fpu_struct {
++ unsigned long fp_regs[16];
++ unsigned long xfp_regs[16];
++ unsigned long fpscr;
++ unsigned long fpul;
++};
++
++struct user {
++ struct pt_regs regs; /* entire machine state */
++ struct user_fpu_struct fpu; /* Math Co-processor registers */
++ int u_fpvalid; /* True if math co-processor being used */
++ size_t u_tsize; /* text size (pages) */
++ size_t u_dsize; /* data size (pages) */
++ size_t u_ssize; /* stack size (pages) */
++ unsigned long start_code; /* text starting address */
++ unsigned long start_data; /* data starting address */
++ unsigned long start_stack; /* stack starting address */
++ long int signal; /* signal causing core dump */
++ struct regs * u_ar0; /* help gdb find registers */
++ struct user_fpu_struct* u_fpstate; /* Math Co-processor pointer */
++ unsigned long magic; /* identifies a core file */
++ char u_comm[32]; /* user command name */
++};
++
++#define NBPG getpagesize()
++#define UPAGES 1
++#define HOST_TEXT_START_ADDR (u.start_code)
++#define HOST_DATA_START_ADDR (u.start_data)
++#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+
+ #endif /* sys/user.h */
diff --git a/patches/glibc-2.9/generic/gentoo/6416_all_sh-glibc-2.5-no-asm-elf-header.patch b/patches/glibc-2.9/generic/gentoo/6416_all_sh-glibc-2.5-no-asm-elf-header.patch
new file mode 100644
index 0000000..d1e7356
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/6416_all_sh-glibc-2.5-no-asm-elf-header.patch
@@ -0,0 +1,33 @@
+2007-03-13 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Copy Linux's asm-sh/elf.h types.
+
+---
+ sysdeps/unix/sysv/linux/sh/sys/procfs.h | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+Index: glibc-2.9/sysdeps/unix/sysv/linux/sh/sys/procfs.h
+===================================================================
+--- glibc-2.9.orig/sysdeps/unix/sysv/linux/sh/sys/procfs.h
++++ glibc-2.9/sysdeps/unix/sysv/linux/sh/sys/procfs.h
+@@ -29,10 +29,19 @@
+ #include <sys/types.h>
+ #include <sys/ucontext.h>
+ #include <sys/user.h>
+-#include <asm/elf.h>
+
+ __BEGIN_DECLS
+
++/*
++ * ELF register definitions...
++ */
++typedef unsigned long elf_greg_t;
++
++#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
++typedef elf_greg_t elf_gregset_t[ELF_NGREG];
++
++typedef struct user_fpu_struct elf_fpregset_t;
++
+ struct elf_siginfo
+ {
+ int si_signo; /* Signal number. */
diff --git a/patches/glibc-2.9/generic/gentoo/6645_all_glibc-mips_shn_undef-hack.patch b/patches/glibc-2.9/generic/gentoo/6645_all_glibc-mips_shn_undef-hack.patch
new file mode 100644
index 0000000..f3a503b
--- /dev/null
+++ b/patches/glibc-2.9/generic/gentoo/6645_all_glibc-mips_shn_undef-hack.patch
@@ -0,0 +1,29 @@
+ Hack from Debian to hopefully get sandbox working on mips
+
+<`Kumba> ths: given the SHN_UNDEF thing is a hack, what's the preferred solution?
+<ths> For fakeroot the simplest trigger is "fakeroot file /bin/ls".
+<ths> `Kumba: I haven't found a better one yet.
+<ths> Probably marker symbols around the stub section, and then exclude it from the link map.
+<ths> This needs a ld change.
+
+---
+ elf/do-lookup.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+Index: glibc-2.9/elf/do-lookup.h
+===================================================================
+--- glibc-2.9.orig/elf/do-lookup.h
++++ glibc-2.9/elf/do-lookup.h
+@@ -246,6 +246,12 @@ do_lookup_x (const char *undef_name, uin
+ }
+ /* FALLTHROUGH */
+ case STB_GLOBAL:
++#ifdef __mips__
++ /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
++ symbols, we skip them. */
++ if (sym->st_shndx == SHN_UNDEF)
++ break;
++#endif
+ /* Global definition. Just what we need. */
+ result->s = sym;
+ result->m = (struct link_map *) map;
diff --git a/patches/glibc-2.9/generic/glibc-2.5_stdlib_longlong.h b/patches/glibc-2.9/generic/glibc-2.5_stdlib_longlong.h
new file mode 100644
index 0000000..d4df127
--- /dev/null
+++ b/patches/glibc-2.9/generic/glibc-2.5_stdlib_longlong.h
@@ -0,0 +1,37 @@
+---
+ stdlib/longlong.h | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+Index: glibc-2.9/stdlib/longlong.h
+===================================================================
+--- glibc-2.9.orig/stdlib/longlong.h
++++ glibc-2.9/stdlib/longlong.h
+@@ -205,6 +205,14 @@ UDItype __umulsidi3 (USItype, USItype);
+ "rI" ((USItype) (bh)), \
+ "r" ((USItype) (al)), \
+ "rI" ((USItype) (bl)) __CLOBBER_CC)
++/* v3m and all higher arches have long multiply support. */
++#if !defined(__ARM_ARCH_2__) && !defined(__ARM_ARCH_3__)
++#define umul_ppmm(xh, xl, a, b) \
++ __asm__ ("umull %0,%1,%2,%3" : "=&r" (xl), "=&r" (xh) : "r" (a), "r" (b))
++#define UMUL_TIME 5
++#define smul_ppmm(xh, xl, a, b) \
++ __asm__ ("smull %0,%1,%2,%3" : "=&r" (xl), "=&r" (xh) : "r" (a), "r" (b))
++#else
+ #define umul_ppmm(xh, xl, a, b) \
+ {register USItype __t0, __t1, __t2; \
+ __asm__ ("%@ Inlined umul_ppmm\n" \
+@@ -226,7 +234,13 @@ UDItype __umulsidi3 (USItype, USItype);
+ : "r" ((USItype) (a)), \
+ "r" ((USItype) (b)) __CLOBBER_CC );}
+ #define UMUL_TIME 20
++#endif
+ #define UDIV_TIME 100
++#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__)
++#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
++#define COUNT_LEADING_ZEROS_0 32
++#endif
++
+ #endif /* __arm__ */
+
+ #if defined(__arm__)
diff --git a/patches/glibc-2.9/generic/glibc-configure-apple-as.patch b/patches/glibc-2.9/generic/glibc-configure-apple-as.patch
new file mode 100644
index 0000000..1a8d474
--- /dev/null
+++ b/patches/glibc-2.9/generic/glibc-configure-apple-as.patch
@@ -0,0 +1,47 @@
+http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch
+http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html
+
+The following makes it possible to configure glibc-2.3.2 on Mac OS X,
+where the assembler but doesn't understand the --version flag.
+
+Fixes the symptom
+checking whether ld is GNU ld... no
+checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as
+checking version of /usr/libexec/gcc/darwin/ppc/as...
+<PAUSES HERE AND JUST SITS THERE DOING NOTHING>
+
+---
+ configure | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+Index: glibc-2.9/configure
+===================================================================
+--- glibc-2.9.orig/configure
++++ glibc-2.9/configure
+@@ -4528,7 +4528,7 @@ else
+ # Found it, now check the version.
+ { echo "$as_me:$LINENO: checking version of $AS" >&5
+ echo $ECHO_N "checking version of $AS... $ECHO_C" >&6; }
+- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
++ ac_prog_version=`$AS -v </dev/null 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 2.1[3-9]*)
+@@ -4539,7 +4539,7 @@ echo $ECHO_N "checking version of $AS...
+ { echo "$as_me:$LINENO: result: $ac_prog_version" >&5
+ echo "${ECHO_T}$ac_prog_version" >&6; }
+ fi
+-if test $ac_verc_fail = yes; then
++if test $ac_verc_fail = yes -a -z "$enable_hacker_mode"; then
+ AS=: critic_missing="$critic_missing as"
+ fi
+
+@@ -4602,7 +4602,7 @@ echo $ECHO_N "checking version of $LD...
+ { echo "$as_me:$LINENO: result: $ac_prog_version" >&5
+ echo "${ECHO_T}$ac_prog_version" >&6; }
+ fi
+-if test $ac_verc_fail = yes; then
++if test $ac_verc_fail = yes -a -z "$enable_hacker_mode"; then
+ LD=: critic_missing="$critic_missing ld"
+ fi
+
diff --git a/patches/glibc-2.9/generic/glibc-configure-old-gcc.patch b/patches/glibc-2.9/generic/glibc-configure-old-gcc.patch
new file mode 100644
index 0000000..a3923f2
--- /dev/null
+++ b/patches/glibc-2.9/generic/glibc-configure-old-gcc.patch
@@ -0,0 +1,17 @@
+---
+ configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: glibc-2.9/configure
+===================================================================
+--- glibc-2.9.orig/configure
++++ glibc-2.9/configure
+@@ -4720,7 +4720,7 @@ echo $ECHO_N "checking version of $CC...
+ { echo "$as_me:$LINENO: result: $ac_prog_version" >&5
+ echo "${ECHO_T}$ac_prog_version" >&6; }
+ fi
+-if test $ac_verc_fail = yes; then
++if test $ac_verc_fail = yes -a -z "$enable_hacker_mode"; then
+ critic_missing="$critic_missing gcc"
+ fi
+
diff --git a/patches/glibc-2.9/generic/make-install-lib-all.patch b/patches/glibc-2.9/generic/make-install-lib-all.patch
new file mode 100644
index 0000000..b4c9a44
--- /dev/null
+++ b/patches/glibc-2.9/generic/make-install-lib-all.patch
@@ -0,0 +1,45 @@
+# --- T2-COPYRIGHT-NOTE-BEGIN ---
+# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
+#
+# T2 SDE: package/.../glibc32/make-install-lib-all.patch
+# Copyright (C) 2004 - 2005 The T2 SDE Project
+#
+# More information can be found in the files COPYING and README.
+#
+# This patch file is dual-licensed. It is available under the license the
+# patched project is licensed under, as long as it is an OpenSource license
+# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
+# of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+# --- T2-COPYRIGHT-NOTE-END ---
+---
+# Makerules | 8 ++++++++
+# 1 file changed, 8 insertions(+)
+#
+Index: glibc-2.9/Makerules
+===================================================================
+--- glibc-2.9.orig/Makerules
++++ glibc-2.9/Makerules
+@@ -853,6 +853,13 @@ endef
+ installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
+ $(inst_libdir)/$(patsubst %,$(libtype$o),\
+ $(libprefix)$(libc-name)))
++
++install-lib-all: $(inst_slibdir)/libc.so$(libc.so-version) \
++ $(inst_slibdir)/libc-$(version).so \
++ $(inst_libdir)/libc.so \
++ $(inst_libdir)/libc.a \
++ install-lib
++
+ install: $(installed-libcs)
+ $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
+ $(make-target-directory)
+@@ -876,6 +883,7 @@ endef
+ install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so))
+ install-lib := $(filter-out %.so %_pic.a,$(install-lib))
+
++
+ ifeq (yes,$(build-shared))
+ # Find which .so's have versions.
+ versioned := $(strip $(foreach so,$(install-lib.so),\
diff --git a/patches/glibc-2.9/generic/series b/patches/glibc-2.9/generic/series
new file mode 100644
index 0000000..bd319d5
--- /dev/null
+++ b/patches/glibc-2.9/generic/series
@@ -0,0 +1,30 @@
+make-install-lib-all.patch
+glibc-configure-apple-as.patch
+glibc-configure-old-gcc.patch
+configure_in-sane_readelf.diff
+configure-sane_readelf.diff
+
+glibc-2.5_stdlib_longlong.h
+
+
+gentoo/0030_all_glibc-respect-env-CPPFLAGS.patch
+gentoo/0040_all_glibc-i586-chk.patch
+gentoo/0070_all_glibc-i386-x86_64-revert-clone-cfi.patch
+gentoo/1010_all_glibc-queue-header-updates.patch
+gentoo/1030_all_glibc-manual-no-perl.patch
+gentoo/1040_all_2.3.3-localedef-fix-trampoline.patch
+gentoo/1050_all_glibc-posix-awk.patch
+gentoo/1055_all_glibc-resolv-dynamic.patch
+gentoo/1075_all_glibc-section-comments.patch
+gentoo/1080_all_glibc-no-inline-gmon.patch
+gentoo/1090_all_glibc-2.3.6-fix-pr631.patch
+gentoo/1100_all_glibc-2.3.3-china.patch
+gentoo/1103_all_glibc-new-valencian-locale.patch
+gentoo/1120_all_glibc-2.5-strict-aliasing.patch
+gentoo/1130_all_glibc-2.4-undefine-__i686.patch
+gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch
+gentoo/3010_all_2.3.3_pre20040117-pt_pax.patch
+gentoo/6400_all_sh-glibc-2.3.2-fpscr_values.patch
+gentoo/6415_all_sh-glibc-2.5-no-asm-user-header.patch
+gentoo/6416_all_sh-glibc-2.5-no-asm-elf-header.patch
+gentoo/6645_all_glibc-mips_shn_undef-hack.patch
diff --git a/patches/glibc-ports-2.9/generic/gentoo/6224_all_glibc-2.7-lowlevellock-includes.patch b/patches/glibc-ports-2.9/generic/gentoo/6224_all_glibc-2.7-lowlevellock-includes.patch
new file mode 100644
index 0000000..4a33972
--- /dev/null
+++ b/patches/glibc-ports-2.9/generic/gentoo/6224_all_glibc-2.7-lowlevellock-includes.patch
@@ -0,0 +1,28 @@
+fix building on arm:
+
+armv4l-unknown-linux-gnu-gcc ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c -c -std=gnu99 -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -mcpu=strongarm110 -pipe -Wstrict-prototypes -fPIC -I../include -I/var/tmp/portage/sys-libs/glibc-2.7-r1/work/build-default-armv4l-unknown-linux-gnu-nptl/nptl -I/var/tmp/portage/sys-libs/glibc-2.7-r1/work/build-default-armv4l-unknown-linux-gnu-nptl -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/armv4l-unknown-linux-gnu/4.1.2/include -isystem /usr/lib/gcc/armv4l-unknown-linux-gnu/4.1.2/include-fixed -isystem /usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DSHARED -DNOT_IN_libc=1 -DIS_IN_rtld=1 -o /var/tmp/portage/sys-libs/glibc-2.7-r1/work/build-default-armv4l-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -MD -MP -MF /var/tmp/portage/sys-libs/glibc-2.7-r1/work/build-default-armv4l-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os.dt -MT /var/tmp/portage/sys-libs/glibc-2.7-r1/work/build-default-armv4l-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os
+In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: warning: implicit declaration of function 'THREAD_GETMEM'
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'THREAD_SELF' undeclared (first use in this function)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: (Each undeclared identifier is reported only once
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: for each function it appears in.)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'header' undeclared (first use in this function)
+make[4]: *** [/var/tmp/portage/sys-libs/glibc-2.7-r1/work/build-default-armv4l-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os] Error 1
+
+---
+ sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: glibc-ports-2.7/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+===================================================================
+--- glibc-ports-2.7.orig/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
++++ glibc-ports-2.7/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+@@ -25,6 +25,7 @@
+ #include <atomic.h>
+ #include <sysdep.h>
+ #include <kernel-features.h>
++#include <tls.h>
+
+ #define FUTEX_WAIT 0
+ #define FUTEX_WAKE 1
diff --git a/patches/glibc-ports-2.9/generic/gentoo/6605_all_glibc-2.4-fpu-cw-mips.patch b/patches/glibc-ports-2.9/generic/gentoo/6605_all_glibc-2.4-fpu-cw-mips.patch
new file mode 100644
index 0000000..832e84c
--- /dev/null
+++ b/patches/glibc-ports-2.9/generic/gentoo/6605_all_glibc-2.4-fpu-cw-mips.patch
@@ -0,0 +1,19 @@
+http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
+
+---
+ sysdeps/mips/fpu_control.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: glibc-ports-2.7/sysdeps/mips/fpu_control.h
+===================================================================
+--- glibc-ports-2.7.orig/sysdeps/mips/fpu_control.h
++++ glibc-ports-2.7/sysdeps/mips/fpu_control.h
+@@ -85,7 +85,7 @@ extern fpu_control_t __fpu_control;
+ #define _FPU_RC_UP 0x2
+ #define _FPU_RC_DOWN 0x3
+
+-#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
++#define _FPU_RESERVED 0xfebc0000 /* Reserved bits in cw */
+
+
+ /* The fdlibm code requires strict IEEE double precision arithmetic,
diff --git a/patches/glibc-ports-2.9/generic/glibc-2.5_ports_sysdeps_arm_mp_clz_tab.c b/patches/glibc-ports-2.9/generic/glibc-2.5_ports_sysdeps_arm_mp_clz_tab.c
new file mode 100644
index 0000000..ee2a6bf
--- /dev/null
+++ b/patches/glibc-ports-2.9/generic/glibc-2.5_ports_sysdeps_arm_mp_clz_tab.c
@@ -0,0 +1,33 @@
+---
+ ports/sysdeps/arm/mp_clz_tab.c | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+Index: glibc-ports-2.7/ports/sysdeps/arm/mp_clz_tab.c
+===================================================================
+--- /dev/null
++++ glibc-ports-2.7/ports/sysdeps/arm/mp_clz_tab.c
+@@ -0,0 +1,24 @@
++/* __clz_tab -- support for longlong.h
++ Copyright (C) 2004 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__)
++/* Nothing required. */
++#else
++#include <stdlib/mp_clz_tab.c>
++#endif
diff --git a/patches/glibc-ports-2.9/generic/series b/patches/glibc-ports-2.9/generic/series
new file mode 100644
index 0000000..143a795
--- /dev/null
+++ b/patches/glibc-ports-2.9/generic/series
@@ -0,0 +1,6 @@
+sysdeps_mips_mips32_Makefile-bootstrap.diff
+
+glibc-2.5_ports_sysdeps_arm_mp_clz_tab.c
+
+gentoo/6605_all_glibc-2.4-fpu-cw-mips.patch
+gentoo/6224_all_glibc-2.7-lowlevellock-includes.patch
diff --git a/patches/glibc-ports-2.9/generic/sysdeps_mips_mips32_Makefile-bootstrap.diff b/patches/glibc-ports-2.9/generic/sysdeps_mips_mips32_Makefile-bootstrap.diff
new file mode 100644
index 0000000..a43709f
--- /dev/null
+++ b/patches/glibc-ports-2.9/generic/sysdeps_mips_mips32_Makefile-bootstrap.diff
@@ -0,0 +1,28 @@
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+Subject: Hack around mips args to host-gcc
+
+originally From: "Steven J dot Hill" <sjhill at realitydiluted dot com>
+for Crosstool
+
+In OSELAS.Toolchain we pass -DBOOTSTRAP_GCC in CC. This patch fixes the
+header extraction from the glibc, by not passing mips specific flags to
+the HOST compiler.
+
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+
+---
+ sysdeps/mips/mips32/Makefile | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+Index: glibc-ports-2.7/sysdeps/mips/mips32/Makefile
+===================================================================
+--- glibc-ports-2.7.orig/sysdeps/mips/mips32/Makefile
++++ glibc-ports-2.7/sysdeps/mips/mips32/Makefile
+@@ -1,3 +1,7 @@
++ifeq ($(filter -DBOOTSTRAP_GCC,$(CC)),)
+ ifeq ($(filter -mabi=32,$(CC)),)
+ CC += -mabi=32
+ endif
++else
++CC += -D_MIPS_SZPTR=32
++endif