summaryrefslogtreecommitdiffstats
path: root/patches
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2008-08-22 21:27:51 +0000
committerMarc Kleine-Budde <mkl@pengutronix.de>2008-08-22 21:27:51 +0000
commit11c15fd77ffd77dc613db1df02bcb6d1c41db3a1 (patch)
treeab2a34e8750a7057bc53c35a5f778c2bfc6ba1ca /patches
parent778ba04f1aaf763011acd33a9fe0de6421b513aa (diff)
downloadOSELAS.Toolchain-11c15fd77ffd77dc613db1df02bcb6d1c41db3a1.tar.gz
OSELAS.Toolchain-11c15fd77ffd77dc613db1df02bcb6d1c41db3a1.tar.xz
* gcc-4.3.1, uClibc-0.9.29:
new git-svn-id: https://svn.pengutronix.de/svn/oselas/toolchain/trunks/OSELAS.Toolchain-trunk@7264 f8d472c7-5700-0410-ac5a-87979cec3adf
Diffstat (limited to 'patches')
-rw-r--r--patches/gcc-4.3.1/generic/arm-softfloat.diff52
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/00_all_gcc-4.1-alpha-mieee-default.patch40
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/00_all_gcc-trampolinewarn.patch41
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/03_all_gcc43-java-nomulti.patch44
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/11_all_gcc-netbsd-symbolic.patch18
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/14_all_gcc-sparc64-bsd.patch34
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/18_all_904-flatten-switch-stmt-00.patch80
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch16
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/53_all_gcc4-superh-default-multilib.patch29
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/54_all_300-libstdc++-pic.patch62
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/61_all_gcc4-ia64-noteGNUstack.patch112
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/61_all_gcc43-pr24170.patch69
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/62_all_gcc4-noteGNUstack.patch230
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/64_all_gcc43-pr34571.patch41
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/66_all_gcc43-pr25343.patch25
-rw-r--r--patches/gcc-4.3.1/generic/gentoo/74_all_sh-pr24836.patch34
-rw-r--r--patches/gcc-4.3.1/generic/no-host-includes.diff56
-rw-r--r--patches/gcc-4.3.1/generic/series31
-rw-r--r--patches/gcc-4.3.1/generic/uclibc/100-uclibc-conf.patch42
-rw-r--r--patches/gcc-4.3.1/generic/uclibc/104-gnuhurd-uclibc-conf.patch18
-rw-r--r--patches/gcc-4.3.1/generic/uclibc/301-missing-execinfo_h.patch17
-rw-r--r--patches/gcc-4.3.1/generic/uclibc/302-c99-snprintf.patch17
-rw-r--r--patches/gcc-4.3.1/generic/uclibc/305-libmudflap-susv3-legacy.patch53
-rw-r--r--patches/gcc-4.3.1/generic/uclibc/993-arm_insn-opinit-RTX_CODE-fixup.patch46
-rw-r--r--patches/gcc-4.3.1/generic/uclibc/995-short-enums.diff48
-rw-r--r--patches/gcc-4.3.1/generic/uclibc/998-gcc-4.3.0-fix-header.00.patch19
-rw-r--r--patches/uClibc-0.9.29/generic/check-lxdialog-fix-comparison.diff17
-rw-r--r--patches/uClibc-0.9.29/generic/series10
-rw-r--r--patches/uClibc-0.9.29/generic/uClibc-0.9.29-001-fix-mmap.patch91
-rw-r--r--patches/uClibc-0.9.29/generic/uClibc-0.9.29-conditional-sched_affinity.patch53
-rw-r--r--patches/uClibc-0.9.29/generic/uClibc-0.9.29-filter-gnu99-from-assembly-flags.patch12
-rw-r--r--patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-fget_putc.diff396
-rw-r--r--patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-gethostent_r-failure-retval.patch12
-rw-r--r--patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-internal_function-definition.patch51
-rw-r--r--patches/uClibc-0.9.29/generic/uClibc-0.9.29-linuxthreads.patch145
-rw-r--r--patches/uClibc-0.9.29/generic/uClibc-0.9.29-rm-whitespace.patch86
36 files changed, 2147 insertions, 0 deletions
diff --git a/patches/gcc-4.3.1/generic/arm-softfloat.diff b/patches/gcc-4.3.1/generic/arm-softfloat.diff
new file mode 100644
index 0000000..ef4b432
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/gcc/config/arm/linux-elf.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/arm/linux-elf.h
++++ gcc-4.3.1/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.3.1/gcc/config/arm/t-linux
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/arm/t-linux
++++ gcc-4.3.1/gcc/config/arm/t-linux
+@@ -3,7 +3,10 @@
+ TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
+
+ LIB1ASMSRC = arm/lib1funcs.asm
+-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
++ _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.3.1/generic/gentoo/00_all_gcc-4.1-alpha-mieee-default.patch b/patches/gcc-4.3.1/generic/gentoo/00_all_gcc-4.1-alpha-mieee-default.patch
new file mode 100644
index 0000000..0ccb875
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/gcc/config/alpha/alpha.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/alpha/alpha.h
++++ gcc-4.3.1/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.3.1/gcc/config/alpha/alpha.opt
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/alpha/alpha.opt
++++ gcc-4.3.1/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.3.1/generic/gentoo/00_all_gcc-trampolinewarn.patch b/patches/gcc-4.3.1/generic/gentoo/00_all_gcc-trampolinewarn.patch
new file mode 100644
index 0000000..6b95f70
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/gcc/common.opt
+===================================================================
+--- gcc-4.3.1.orig/gcc/common.opt
++++ gcc-4.3.1/gcc/common.opt
+@@ -182,6 +182,10 @@ Wsystem-headers
+ Common Var(warn_system_headers) Warning
+ Do not suppress warnings from system headers
+
++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.3.1/gcc/builtins.c
+===================================================================
+--- gcc-4.3.1.orig/gcc/builtins.c
++++ gcc-4.3.1/gcc/builtins.c
+@@ -5662,6 +5662,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.3.1/generic/gentoo/03_all_gcc43-java-nomulti.patch b/patches/gcc-4.3.1/generic/gentoo/03_all_gcc43-java-nomulti.patch
new file mode 100644
index 0000000..f07ead8
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/generic/gentoo/11_all_gcc-netbsd-symbolic.patch b/patches/gcc-4.3.1/generic/gentoo/11_all_gcc-netbsd-symbolic.patch
new file mode 100644
index 0000000..f924ff8
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/gcc/config/netbsd-elf.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/netbsd-elf.h
++++ gcc-4.3.1/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.3.1/generic/gentoo/14_all_gcc-sparc64-bsd.patch b/patches/gcc-4.3.1/generic/gentoo/14_all_gcc-sparc64-bsd.patch
new file mode 100644
index 0000000..e2d0ee1
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/gcc/config/sparc/freebsd.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/sparc/freebsd.h
++++ gcc-4.3.1/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.3.1/generic/gentoo/18_all_904-flatten-switch-stmt-00.patch b/patches/gcc-4.3.1/generic/gentoo/18_all_904-flatten-switch-stmt-00.patch
new file mode 100644
index 0000000..ce785d9
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/gcc/stmt.c
+===================================================================
+--- gcc-4.3.1.orig/gcc/stmt.c
++++ gcc-4.3.1/gcc/stmt.c
+@@ -2509,7 +2509,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);
+ emit_jump (default_label);
+ }
+@@ -3067,6 +3071,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.3.1/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch b/patches/gcc-4.3.1/generic/gentoo/51_all_gcc-3.4-libiberty-pic.patch
new file mode 100644
index 0000000..c690322
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/libiberty/Makefile.in
+===================================================================
+--- gcc-4.3.1.orig/libiberty/Makefile.in
++++ gcc-4.3.1/libiberty/Makefile.in
+@@ -225,6 +225,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.3.1/generic/gentoo/53_all_gcc4-superh-default-multilib.patch b/patches/gcc-4.3.1/generic/gentoo/53_all_gcc4-superh-default-multilib.patch
new file mode 100644
index 0000000..8fc0743
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/gcc/config.gcc
+===================================================================
+--- gcc-4.3.1.orig/gcc/config.gcc
++++ gcc-4.3.1/gcc/config.gcc
+@@ -2281,7 +2281,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.3.1/generic/gentoo/54_all_300-libstdc++-pic.patch b/patches/gcc-4.3.1/generic/gentoo/54_all_300-libstdc++-pic.patch
new file mode 100644
index 0000000..3cc3c54
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/libstdc++-v3/src/Makefile.am
+===================================================================
+--- gcc-4.3.1.orig/libstdc++-v3/src/Makefile.am
++++ gcc-4.3.1/libstdc++-v3/src/Makefile.am
+@@ -289,6 +289,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.3.1/libstdc++-v3/src/Makefile.in
+===================================================================
+--- gcc-4.3.1.orig/libstdc++-v3/src/Makefile.in
++++ gcc-4.3.1/libstdc++-v3/src/Makefile.in
+@@ -693,7 +693,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
+
+@@ -732,7 +732,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.
+@@ -858,6 +858,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.3.1/generic/gentoo/61_all_gcc4-ia64-noteGNUstack.patch b/patches/gcc-4.3.1/generic/gentoo/61_all_gcc4-ia64-noteGNUstack.patch
new file mode 100644
index 0000000..e03325d
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/gcc/config/ia64/crtbegin.asm
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/ia64/crtbegin.asm
++++ gcc-4.3.1/gcc/config/ia64/crtbegin.asm
+@@ -255,3 +255,7 @@ __do_jv_register_classes:
+ .weak __cxa_finalize
+ #endif
+ .weak _Jv_RegisterClasses
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+Index: gcc-4.3.1/gcc/config/ia64/crtend.asm
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/ia64/crtend.asm
++++ gcc-4.3.1/gcc/config/ia64/crtend.asm
+@@ -122,3 +122,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.3.1/gcc/config/ia64/crti.asm
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/ia64/crti.asm
++++ gcc-4.3.1/gcc/config/ia64/crti.asm
+@@ -64,3 +64,7 @@ _fini:
+ .body
+
+ # end of crti.asm
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+Index: gcc-4.3.1/gcc/config/ia64/crtn.asm
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/ia64/crtn.asm
++++ gcc-4.3.1/gcc/config/ia64/crtn.asm
+@@ -54,3 +54,7 @@
+ br.ret.sptk.many b0
+
+ # end of crtn.asm
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+Index: gcc-4.3.1/gcc/config/ia64/lib1funcs.asm
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/ia64/lib1funcs.asm
++++ gcc-4.3.1/gcc/config/ia64/lib1funcs.asm
+@@ -792,3 +792,7 @@ __floattitf:
+ }
+ .endp __floattitf
+ #endif
++
++#ifdef __linux__
++.section .note.GNU-stack; .previous
++#endif
+Index: gcc-4.3.1/gcc/config/ia64/linux.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/ia64/linux.h
++++ gcc-4.3.1/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.3.1/gcc/config/rs6000/ppc-asm.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/rs6000/ppc-asm.h
++++ gcc-4.3.1/gcc/config/rs6000/ppc-asm.h
+@@ -158,7 +158,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.3.1/generic/gentoo/61_all_gcc43-pr24170.patch b/patches/gcc-4.3.1/generic/gentoo/61_all_gcc43-pr24170.patch
new file mode 100644
index 0000000..c9c46f0
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/generic/gentoo/62_all_gcc4-noteGNUstack.patch b/patches/gcc-4.3.1/generic/gentoo/62_all_gcc4-noteGNUstack.patch
new file mode 100644
index 0000000..04a5178
--- /dev/null
+++ b/patches/gcc-4.3.1/generic/gentoo/62_all_gcc4-noteGNUstack.patch
@@ -0,0 +1,230 @@
+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/alpha/osf.S | 4 ++++
+ libffi/src/arm/sysv.S | 3 +++
+ libffi/src/ia64/unix.S | 4 ++++
+ libffi/src/m68k/sysv.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/s390/sysv.S | 3 +++
+ libffi/src/sparc/v8.S | 4 ++++
+ libffi/src/sparc/v9.S | 4 ++++
+ libffi/src/x86/sysv.S | 4 ++++
+ libffi/src/x86/unix64.S | 4 ++++
+ 15 files changed, 65 insertions(+), 12 deletions(-)
+
+Index: gcc-4.3.1/boehm-gc/ia64_save_regs_in_stack.S
+===================================================================
+--- /dev/null
++++ gcc-4.3.1/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.3.1/boehm-gc/ia64_save_regs_in_stack.s
+===================================================================
+--- gcc-4.3.1.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.3.1/libffi/src/alpha/osf.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/alpha/osf.S
++++ gcc-4.3.1/libffi/src/alpha/osf.S
+@@ -358,4 +358,8 @@ $LASFDE3:
+ .byte 16 # uleb128 offset 16*-8
+ .align 3
+ $LEFDE3:
++
++#ifdef __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+ #endif
+Index: gcc-4.3.1/libffi/src/arm/sysv.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/arm/sysv.S
++++ gcc-4.3.1/libffi/src/arm/sysv.S
+@@ -293,3 +293,6 @@ ARM_FUNC_START ffi_closure_SYSV
+ UNWIND .fnend
+ .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV)
+
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",%progbits
++#endif
+Index: gcc-4.3.1/libffi/src/ia64/unix.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/ia64/unix.S
++++ gcc-4.3.1/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.3.1/libffi/src/m68k/sysv.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/m68k/sysv.S
++++ gcc-4.3.1/libffi/src/m68k/sysv.S
+@@ -207,3 +207,7 @@ ffi_closure_struct_SYSV:
+ rts
+ CFI_ENDPROC()
+ .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.3.1/libffi/src/powerpc/linux64.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/powerpc/linux64.S
++++ gcc-4.3.1/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.3.1/libffi/src/powerpc/linux64_closure.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/powerpc/linux64_closure.S
++++ gcc-4.3.1/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.3.1/libffi/src/powerpc/ppc_closure.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/powerpc/ppc_closure.S
++++ gcc-4.3.1/libffi/src/powerpc/ppc_closure.S
+@@ -295,3 +295,7 @@ END(ffi_closure_SYSV)
+ .LEFDE1:
+
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.3.1/libffi/src/powerpc/sysv.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/powerpc/sysv.S
++++ gcc-4.3.1/libffi/src/powerpc/sysv.S
+@@ -223,3 +223,7 @@ END(ffi_call_SYSV)
+ .align 2
+ .LEFDE1:
+ #endif
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.3.1/libffi/src/s390/sysv.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/s390/sysv.S
++++ gcc-4.3.1/libffi/src/s390/sysv.S
+@@ -427,3 +427,6 @@ ffi_closure_SYSV:
+
+ #endif
+
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.3.1/libffi/src/sparc/v8.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/sparc/v8.S
++++ gcc-4.3.1/libffi/src/sparc/v8.S
+@@ -265,3 +265,7 @@ done2:
+ .byte 0x1f ! uleb128 0x1f
+ .align WS
+ .LLEFDE2:
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.3.1/libffi/src/sparc/v9.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/sparc/v9.S
++++ gcc-4.3.1/libffi/src/sparc/v9.S
+@@ -300,3 +300,7 @@ longdouble1:
+ .align 8
+ .LLEFDE2:
+ #endif
++
++#ifdef __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.3.1/libffi/src/x86/sysv.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/x86/sysv.S
++++ gcc-4.3.1/libffi/src/x86/sysv.S
+@@ -430,3 +430,7 @@ ffi_closure_raw_SYSV:
+ #endif
+
+ #endif /* ifndef __x86_64__ */
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
+Index: gcc-4.3.1/libffi/src/x86/unix64.S
+===================================================================
+--- gcc-4.3.1.orig/libffi/src/x86/unix64.S
++++ gcc-4.3.1/libffi/src/x86/unix64.S
+@@ -410,3 +410,7 @@ ffi_closure_unix64:
+ .LEFDE3:
+
+ #endif /* __x86_64__ */
++
++#if defined __ELF__ && defined __linux__
++ .section .note.GNU-stack,"",@progbits
++#endif
diff --git a/patches/gcc-4.3.1/generic/gentoo/64_all_gcc43-pr34571.patch b/patches/gcc-4.3.1/generic/gentoo/64_all_gcc43-pr34571.patch
new file mode 100644
index 0000000..5b3a85a
--- /dev/null
+++ b/patches/gcc-4.3.1/generic/gentoo/64_all_gcc43-pr34571.patch
@@ -0,0 +1,41 @@
+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 +--
+ gcc/varasm.c | 2 +-
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+Index: gcc-4.3.1/gcc/config/alpha/alpha.c
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/alpha/alpha.c
++++ gcc-4.3.1/gcc/config/alpha/alpha.c
+@@ -1113,8 +1113,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
+Index: gcc-4.3.1/gcc/varasm.c
+===================================================================
+--- gcc-4.3.1.orig/gcc/varasm.c
++++ gcc-4.3.1/gcc/varasm.c
+@@ -3710,7 +3710,7 @@ output_constant_pool_1 (struct constant_
+ /* FALLTHRU */
+
+ case LABEL_REF:
+- tmp = XEXP (x, 0);
++ tmp = XEXP (tmp, 0);
+ gcc_assert (!INSN_DELETED_P (tmp));
+ gcc_assert (!NOTE_P (tmp)
+ || NOTE_KIND (tmp) != NOTE_INSN_DELETED);
diff --git a/patches/gcc-4.3.1/generic/gentoo/66_all_gcc43-pr25343.patch b/patches/gcc-4.3.1/generic/gentoo/66_all_gcc43-pr25343.patch
new file mode 100644
index 0000000..15e645d
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/generic/gentoo/74_all_sh-pr24836.patch b/patches/gcc-4.3.1/generic/gentoo/74_all_sh-pr24836.patch
new file mode 100644
index 0000000..436802b
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/gcc/configure.ac
+===================================================================
+--- gcc-4.3.1.orig/gcc/configure.ac
++++ gcc-4.3.1/gcc/configure.ac
+@@ -2537,7 +2537,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.3.1/gcc/configure
+===================================================================
+--- gcc-4.3.1.orig/gcc/configure
++++ gcc-4.3.1/gcc/configure
+@@ -14709,7 +14709,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.3.1/generic/no-host-includes.diff b/patches/gcc-4.3.1/generic/no-host-includes.diff
new file mode 100644
index 0000000..586baed
--- /dev/null
+++ b/patches/gcc-4.3.1/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/c-incpath.c | 28 ++++++++++++++++++++++++++++
+# 1 file changed, 28 insertions(+)
+#
+Index: gcc-4.3.1/gcc/c-incpath.c
+===================================================================
+--- gcc-4.3.1.orig/gcc/c-incpath.c
++++ gcc-4.3.1/gcc/c-incpath.c
+@@ -413,6 +413,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.3.1/generic/series b/patches/gcc-4.3.1/generic/series
new file mode 100644
index 0000000..9e564cf
--- /dev/null
+++ b/patches/gcc-4.3.1/generic/series
@@ -0,0 +1,31 @@
+# bail out on host includes
+no-host-includes.diff
+
+# ARM big endian and softfloat
+arm-softfloat.diff
+
+# from uclibc
+uclibc/100-uclibc-conf.patch
+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
+uclibc/998-gcc-4.3.0-fix-header.00.patch
+
+# 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_gcc43-pr24170.patch
+gentoo/61_all_gcc4-ia64-noteGNUstack.patch
+gentoo/62_all_gcc4-noteGNUstack.patch
+gentoo/64_all_gcc43-pr34571.patch
+gentoo/66_all_gcc43-pr25343.patch
+gentoo/74_all_sh-pr24836.patch
diff --git a/patches/gcc-4.3.1/generic/uclibc/100-uclibc-conf.patch b/patches/gcc-4.3.1/generic/uclibc/100-uclibc-conf.patch
new file mode 100644
index 0000000..ee4e26a
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/contrib/regression/objs-gcc.sh
+===================================================================
+--- gcc-4.3.1.orig/contrib/regression/objs-gcc.sh
++++ gcc-4.3.1/contrib/regression/objs-gcc.sh
+@@ -105,6 +105,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.3.1/libjava/classpath/ltconfig
+===================================================================
+--- gcc-4.3.1.orig/libjava/classpath/ltconfig
++++ gcc-4.3.1/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.3.1/generic/uclibc/104-gnuhurd-uclibc-conf.patch b/patches/gcc-4.3.1/generic/uclibc/104-gnuhurd-uclibc-conf.patch
new file mode 100644
index 0000000..3e7b25a
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/generic/uclibc/301-missing-execinfo_h.patch b/patches/gcc-4.3.1/generic/uclibc/301-missing-execinfo_h.patch
new file mode 100644
index 0000000..3a7853e
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/boehm-gc/include/gc.h
+===================================================================
+--- gcc-4.3.1.orig/boehm-gc/include/gc.h
++++ gcc-4.3.1/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.3.1/generic/uclibc/302-c99-snprintf.patch b/patches/gcc-4.3.1/generic/uclibc/302-c99-snprintf.patch
new file mode 100644
index 0000000..4ead184
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/libstdc++-v3/include/c_global/cstdio
+===================================================================
+--- gcc-4.3.1.orig/libstdc++-v3/include/c_global/cstdio
++++ gcc-4.3.1/libstdc++-v3/include/c_global/cstdio
+@@ -144,7 +144,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.3.1/generic/uclibc/305-libmudflap-susv3-legacy.patch b/patches/gcc-4.3.1/generic/uclibc/305-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000..69f50fa
--- /dev/null
+++ b/patches/gcc-4.3.1/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.3.1/libmudflap/mf-hooks2.c
+===================================================================
+--- gcc-4.3.1.orig/libmudflap/mf-hooks2.c
++++ gcc-4.3.1/libmudflap/mf-hooks2.c
+@@ -427,7 +427,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);
+ }
+
+
+@@ -437,7 +437,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);
+ }
+
+
+@@ -447,7 +447,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);
+ }
+
+
+@@ -456,7 +456,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);
+ }
+
+
+@@ -465,7 +465,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.3.1/generic/uclibc/993-arm_insn-opinit-RTX_CODE-fixup.patch b/patches/gcc-4.3.1/generic/uclibc/993-arm_insn-opinit-RTX_CODE-fixup.patch
new file mode 100644
index 0000000..209aece
--- /dev/null
+++ b/patches/gcc-4.3.1/generic/uclibc/993-arm_insn-opinit-RTX_CODE-fixup.patch
@@ -0,0 +1,46 @@
+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 | 3 +--
+ gcc/genopinit.c | 1 +
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: gcc-4.3.1/gcc/config/arm/arm-protos.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/config/arm/arm-protos.h
++++ gcc-4.3.1/gcc/config/arm/arm-protos.h
+@@ -40,15 +40,14 @@ extern HOST_WIDE_INT thumb_compute_initi
+ unsigned int);
+ extern unsigned int arm_dbx_register_number (unsigned int);
+ extern void arm_output_fn_unwind (FILE *, bool);
+-
+
+ #ifdef TREE_CODE
+ extern int arm_return_in_memory (const_tree);
+ #endif
+-#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.3.1/gcc/genopinit.c
+===================================================================
+--- gcc-4.3.1.orig/gcc/genopinit.c
++++ gcc-4.3.1/gcc/genopinit.c
+@@ -487,6 +487,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.3.1/generic/uclibc/995-short-enums.diff b/patches/gcc-4.3.1/generic/uclibc/995-short-enums.diff
new file mode 100644
index 0000000..3be84a4
--- /dev/null
+++ b/patches/gcc-4.3.1/generic/uclibc/995-short-enums.diff
@@ -0,0 +1,48 @@
+see gcc PR34205
+---
+ gcc/c-common.h | 1 +
+ gcc/rtl.h | 4 +++-
+ gcc/tree.h | 1 +
+ 3 files changed, 5 insertions(+), 1 deletion(-)
+
+Index: gcc-4.3.1/gcc/tree.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/tree.h
++++ gcc-4.3.1/gcc/tree.h
+@@ -39,6 +39,7 @@ enum tree_code {
+
+ LAST_AND_UNUSED_TREE_CODE /* A convenient way to get a value for
+ NUM_TREE_CODES. */
++ ,__LAST_AND_UNUSED_TREE_CODE=32767 /* Force 16bit width. */
+ };
+
+ #undef DEFTREECODE
+Index: gcc-4.3.1/gcc/rtl.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/rtl.h
++++ gcc-4.3.1/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.3.1/gcc/c-common.h
+===================================================================
+--- gcc-4.3.1.orig/gcc/c-common.h
++++ gcc-4.3.1/gcc/c-common.h
+@@ -125,6 +125,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.3.1/generic/uclibc/998-gcc-4.3.0-fix-header.00.patch b/patches/gcc-4.3.1/generic/uclibc/998-gcc-4.3.0-fix-header.00.patch
new file mode 100644
index 0000000..546198c
--- /dev/null
+++ b/patches/gcc-4.3.1/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/uClibc-0.9.29/generic/check-lxdialog-fix-comparison.diff b/patches/uClibc-0.9.29/generic/check-lxdialog-fix-comparison.diff
new file mode 100644
index 0000000..eeae01c
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/check-lxdialog-fix-comparison.diff
@@ -0,0 +1,17 @@
+---
+ extra/config/lxdialog/check-lxdialog.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: uClibc-0.9.29/extra/config/lxdialog/check-lxdialog.sh
+===================================================================
+--- uClibc-0.9.29.orig/extra/config/lxdialog/check-lxdialog.sh
++++ uClibc-0.9.29/extra/config/lxdialog/check-lxdialog.sh
+@@ -57,7 +57,7 @@ usage() {
+ printf "Usage: $0 [-check compiler options|-header|-library]\n"
+ }
+
+-if [ $# == 0 ]; then
++if [ $# -eq 0 ]; then
+ usage
+ exit 1
+ fi
diff --git a/patches/uClibc-0.9.29/generic/series b/patches/uClibc-0.9.29/generic/series
new file mode 100644
index 0000000..08e8b3c
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/series
@@ -0,0 +1,10 @@
+check-lxdialog-fix-comparison.diff
+
+uClibc-0.9.29-001-fix-mmap.patch
+uClibc-0.9.29-conditional-sched_affinity.patch
+uClibc-0.9.29-filter-gnu99-from-assembly-flags.patch
+uClibc-0.9.29-fix-fget_putc.diff
+uClibc-0.9.29-fix-gethostent_r-failure-retval.patch
+uClibc-0.9.29-fix-internal_function-definition.patch
+uClibc-0.9.29-linuxthreads.patch
+uClibc-0.9.29-rm-whitespace.patch
diff --git a/patches/uClibc-0.9.29/generic/uClibc-0.9.29-001-fix-mmap.patch b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-001-fix-mmap.patch
new file mode 100644
index 0000000..4775e8c
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-001-fix-mmap.patch
@@ -0,0 +1,91 @@
+--- uClibc-0.9.29.oorig/test/mmap/mmap2.c (revision 0)
++++ uClibc-0.9.29/test/mmap/mmap2.c (revision 18616)
+@@ -0,0 +1,41 @@
++/* When trying to map /dev/mem with offset 0xFFFFF000 on the ARM platform, mmap
++ * returns -EOVERFLOW.
++ *
++ * Since off_t is defined as a long int and the sign bit is set in the address,
++ * the shift operation shifts in ones instead of zeroes
++ * from the left. This results the offset sent to the kernel function becomes
++ * 0xFFFFFFFF instead of 0x000FFFFF with MMAP2_PAGE_SHIFT set to 12.
++ */
++
++#include <unistd.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <sys/mman.h>
++
++#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \
++ __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0)
++
++#define MAP_SIZE 4096UL
++#define MAP_MASK (MAP_SIZE - 1)
++
++int main(int argc, char **argv) {
++ void* map_base = 0;
++ int fd;
++ off_t target = 0xfffff000;
++ if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL;
++ printf("/dev/mem opened.\n");
++ fflush(stdout);
++
++ /* Map one page */
++ map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
++ fd, target & ~MAP_MASK);
++ if(map_base == (void *) -1) FATAL;
++ printf("Memory mapped at address %p.\n", map_base);
++ fflush(stdout);
++ if(munmap(map_base, MAP_SIZE) == -1) FATAL;
++ close(fd);
++ return 0;
++}
+--- uClibc-0.9.29.oorig/libc/sysdeps/linux/arm/mmap.c (revision 18615)
++++ uClibc-0.9.29/libc/sysdeps/linux/arm/mmap.c (revision 18616)
+@@ -27,7 +27,6 @@ __ptr_t mmap(__ptr_t addr, size_t len, i
+
+ #elif defined (__NR_mmap2)
+ #define __NR__mmap __NR_mmap2
+-
+ #ifndef MMAP2_PAGE_SHIFT
+ # define MMAP2_PAGE_SHIFT 12
+ #endif
+@@ -39,9 +38,17 @@ __ptr_t mmap(__ptr_t addr, size_t len, i
+ {
+ /* check if offset is page aligned */
+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
++ {
++ __set_errno(EINVAL);
+ return MAP_FAILED;
++ }
++#ifdef __USE_FILE_OFFSET64
++ return (__ptr_t) _mmap (addr, len, prot, flags,
++ fd,((__u_quad_t) offset >> MMAP2_PAGE_SHIFT));
++#else
+ return (__ptr_t) _mmap (addr, len, prot, flags,
+- fd,(off_t) (offset >> MMAP2_PAGE_SHIFT));
++ fd,((__u_long) offset >> MMAP2_PAGE_SHIFT));
++#endif
+ }
+ #elif defined (__NR_mmap)
+ # define __NR__mmap __NR_mmap
+--- uClibc-0.9.29.oorig/libc/sysdeps/linux/common/mmap64.c (revision 18615)
++++ uClibc-0.9.29/libc/sysdeps/linux/common/mmap64.c (revision 18616)
+@@ -58,8 +58,13 @@ __ptr_t mmap64(__ptr_t addr, size_t len,
+ __set_errno(EINVAL);
+ return MAP_FAILED;
+ }
+-
+- return __syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT));
++#ifdef __USE_FILE_OFFSET64
++ return __syscall_mmap2(addr, len, prot, flags,
++ fd,((__u_quad_t)offset >> MMAP2_PAGE_SHIFT));
++#else
++ return __syscall_mmap2(addr, len, prot, flags,
++ fd,((__u_long)offset >> MMAP2_PAGE_SHIFT));
++#endif
+ }
+
+ # endif
diff --git a/patches/uClibc-0.9.29/generic/uClibc-0.9.29-conditional-sched_affinity.patch b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-conditional-sched_affinity.patch
new file mode 100644
index 0000000..509c42a
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-conditional-sched_affinity.patch
@@ -0,0 +1,53 @@
+diff -ur uClibc-0.9.29/libc/sysdeps/linux/common/sched_getaffinity.c uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_getaffinity.c
+--- uClibc-0.9.29/libc/sysdeps/linux/common/sched_getaffinity.c 2007-02-12 16:52:32.000000000 -0600
++++ uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_getaffinity.c 2007-05-09 18:05:09.397411811 -0500
+@@ -29,6 +29,7 @@
+ #include <sys/param.h>
+ #include <sys/types.h>
+
++#ifdef __NR_sched_getaffinity
+ libc_hidden_proto(memset)
+
+ #define __NR___syscall_sched_getaffinity __NR_sched_getaffinity
+@@ -48,5 +49,15 @@
+ }
+ return res;
+ }
++#else
++/*
++int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
++{
++ __set_errno(ENOSYS);
++ return -1;
++}
++*/
+ #endif
+ #endif
++
++#endif
+diff -ur uClibc-0.9.29/libc/sysdeps/linux/common/sched_setaffinity.c uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_setaffinity.c
+--- uClibc-0.9.29/libc/sysdeps/linux/common/sched_setaffinity.c 2007-02-12 16:52:32.000000000 -0600
++++ uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_setaffinity.c 2007-05-09 18:05:09.397411811 -0500
+@@ -31,6 +31,7 @@
+ #include <sys/types.h>
+ #include <alloca.h>
+
++#ifdef __NR_sched_setaffinity
+ libc_hidden_proto(getpid)
+
+ #define __NR___syscall_sched_setaffinity __NR_sched_setaffinity
+@@ -74,5 +75,14 @@
+
+ return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset);
+ }
++#else
++/*
++int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
++{
++ __set_errno(ENOSYS);
++ return -1;
++}
++*/
++#endif
+ #endif
+ #endif
diff --git a/patches/uClibc-0.9.29/generic/uClibc-0.9.29-filter-gnu99-from-assembly-flags.patch b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-filter-gnu99-from-assembly-flags.patch
new file mode 100644
index 0000000..d1a7e3a
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-filter-gnu99-from-assembly-flags.patch
@@ -0,0 +1,12 @@
+diff -ur uClibc-0.9.29/Makerules uClibc-0.9.29-patched/Makerules
+--- uClibc-0.9.29/Makerules 2006-12-10 18:25:23.000000000 -0600
++++ uClibc-0.9.29-patched/Makerules 2008-01-26 17:04:50.965699518 -0600
+@@ -96,7 +96,7 @@
+ disp_ld = $($(DISP)_disp_ld)
+
+ cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(filter-out $(CFLAGS-OMIT-$(notdir $<)),$(CFLAGS-$(notdir $(^D)))) $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) $(CFLAGS-$(notdir $<)) $(CFLAGS-$(notdir $@))
+-cmd_compile.S = $(cmd_compile.c) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
++cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
+ cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
+ cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@))
+ cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^
diff --git a/patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-fget_putc.diff b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-fget_putc.diff
new file mode 100644
index 0000000..15d6149
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-fget_putc.diff
@@ -0,0 +1,396 @@
+diff -ur uClibc-0.9.29/libc/inet/rpc/rcmd.c uClibc-0.9.29-patched/libc/inet/rpc/rcmd.c
+--- uClibc-0.9.29/libc/inet/rpc/rcmd.c 2007-01-10 11:46:19.000000000 -0600
++++ uClibc-0.9.29-patched/libc/inet/rpc/rcmd.c 2007-05-09 18:05:21.638421151 -0500
+@@ -126,7 +126,7 @@
+ libc_hidden_proto(listen)
+ libc_hidden_proto(sigsetmask)
+ libc_hidden_proto(getc_unlocked)
+-libc_hidden_proto(__fgetc_unlocked)
++//libc_hidden_proto(fgetc_unlocked)
+ libc_hidden_proto(fopen)
+ libc_hidden_proto(fclose)
+ libc_hidden_proto(fprintf)
+diff -ur uClibc-0.9.29/libc/inet/rpc/ruserpass.c uClibc-0.9.29-patched/libc/inet/rpc/ruserpass.c
+--- uClibc-0.9.29/libc/inet/rpc/ruserpass.c 2006-03-23 05:14:16.000000000 -0600
++++ uClibc-0.9.29-patched/libc/inet/rpc/ruserpass.c 2007-05-09 18:05:21.638421151 -0500
+@@ -63,7 +63,7 @@
+ libc_hidden_proto(fopen)
+ libc_hidden_proto(fclose)
+ libc_hidden_proto(getc_unlocked)
+-libc_hidden_proto(__fgetc_unlocked)
++//libc_hidden_proto(__fgetc_unlocked)
+
+ #define _(X) (X)
+ /* #include "ftp_var.h" */
+diff -ur uClibc-0.9.29/libc/misc/error/error.c uClibc-0.9.29-patched/libc/misc/error/error.c
+--- uClibc-0.9.29/libc/misc/error/error.c 2006-05-04 09:44:13.000000000 -0500
++++ uClibc-0.9.29-patched/libc/misc/error/error.c 2007-05-09 18:05:21.646421810 -0500
+@@ -30,11 +30,14 @@
+ libc_hidden_proto(strerror)
+ libc_hidden_proto(fprintf)
+ libc_hidden_proto(exit)
++//#undef putc
+ libc_hidden_proto(putc)
++libc_hidden_proto(fputc)
+ libc_hidden_proto(vfprintf)
+ libc_hidden_proto(fflush)
+-libc_hidden_proto(fputc)
+-libc_hidden_proto(__fputc_unlocked)
++//#ifdef __UCLIBC_HAS_STDIO_PUTC_MACRO__
++libc_hidden_proto(fputc_unlocked)
++//#endif
+
+ /* This variable is incremented each time `error' is called. */
+ unsigned int error_message_count = 0;
+diff -ur uClibc-0.9.29/libc/misc/ttyent/getttyent.c uClibc-0.9.29-patched/libc/misc/ttyent/getttyent.c
+--- uClibc-0.9.29/libc/misc/ttyent/getttyent.c 2006-12-07 17:24:02.000000000 -0600
++++ uClibc-0.9.29-patched/libc/misc/ttyent/getttyent.c 2007-05-09 18:05:21.646421810 -0500
+@@ -44,8 +44,10 @@
+ libc_hidden_proto(__fsetlocking)
+ libc_hidden_proto(rewind)
+ libc_hidden_proto(fgets_unlocked)
++//#undef getc_unlocked
+ libc_hidden_proto(getc_unlocked)
+-libc_hidden_proto(__fgetc_unlocked)
++//#undef fgetc_unlocked
++libc_hidden_proto(fgetc_unlocked)
+ libc_hidden_proto(fopen)
+ libc_hidden_proto(fclose)
+ libc_hidden_proto(abort)
+diff -ur uClibc-0.9.29/libc/pwd_grp/pwd_grp.c uClibc-0.9.29-patched/libc/pwd_grp/pwd_grp.c
+--- uClibc-0.9.29/libc/pwd_grp/pwd_grp.c 2007-04-13 03:32:18.000000000 -0500
++++ uClibc-0.9.29-patched/libc/pwd_grp/pwd_grp.c 2007-05-09 18:05:21.638421151 -0500
+@@ -43,11 +43,12 @@
+ libc_hidden_proto(strtoul)
+ libc_hidden_proto(rewind)
+ libc_hidden_proto(fgets_unlocked)
+-libc_hidden_proto(__fputc_unlocked)
+ libc_hidden_proto(sprintf)
+ libc_hidden_proto(fopen)
+ libc_hidden_proto(fclose)
+ libc_hidden_proto(fprintf)
++//#undef fputc_unlocked
++libc_hidden_proto(fputc_unlocked)
+ #ifdef __UCLIBC_HAS_XLOCALE__
+ libc_hidden_proto(__ctype_b_loc)
+ #elif __UCLIBC_HAS_CTYPE_TABLES__
+@@ -801,7 +802,7 @@
+
+ do {
+ if (!*m) {
+- if (__fputc_unlocked('\n', f) >= 0) {
++ if (fputc_unlocked('\n', f) >= 0) {
+ rv = 0;
+ }
+ break;
+@@ -867,7 +868,7 @@
+ goto DO_UNLOCK;
+ }
+
+- if (__fputc_unlocked('\n', stream) > 0) {
++ if (fputc_unlocked('\n', stream) > 0) {
+ rv = 0;
+ }
+
+diff -ur uClibc-0.9.29/libc/stdio/_scanf.c uClibc-0.9.29-patched/libc/stdio/_scanf.c
+--- uClibc-0.9.29/libc/stdio/_scanf.c 2007-01-20 12:32:10.000000000 -0600
++++ uClibc-0.9.29-patched/libc/stdio/_scanf.c 2007-05-09 18:05:21.642421481 -0500
+@@ -86,7 +86,8 @@
+ libc_hidden_proto(vsscanf)
+ libc_hidden_proto(fclose)
+ libc_hidden_proto(getc_unlocked)
+-libc_hidden_proto(__fgetc_unlocked)
++//#undef fgetc_unlocked
++libc_hidden_proto(fgetc_unlocked)
+ #ifdef __UCLIBC_HAS_WCHAR__
+ libc_hidden_proto(wcslen)
+ libc_hidden_proto(vfwscanf)
+diff -ur uClibc-0.9.29/libc/stdio/fgetc.c uClibc-0.9.29-patched/libc/stdio/fgetc.c
+--- uClibc-0.9.29/libc/stdio/fgetc.c 2006-01-15 16:41:03.000000000 -0600
++++ uClibc-0.9.29-patched/libc/stdio/fgetc.c 2007-05-09 18:05:21.642421481 -0500
+@@ -13,13 +13,13 @@
+ #undef getc
+ #undef getc_unlocked
+
+-libc_hidden_proto(__fgetc_unlocked)
++libc_hidden_proto(fgetc_unlocked)
+
+ #ifdef __DO_UNLOCKED
+
+ libc_hidden_proto(fflush_unlocked)
+
+-int __fgetc_unlocked(FILE *stream)
++int fgetc_unlocked(FILE *stream)
+ {
+ __STDIO_STREAM_VALIDATE(stream);
+
+@@ -73,26 +73,22 @@
+
+ return EOF;
+ }
+-libc_hidden_def(__fgetc_unlocked)
+-
+-libc_hidden_proto(fgetc_unlocked)
+-strong_alias(__fgetc_unlocked,fgetc_unlocked)
+ libc_hidden_def(fgetc_unlocked)
+
+ //libc_hidden_proto(__getc_unlocked)
+-//strong_alias(__fgetc_unlocked,__getc_unlocked)
++//strong_alias(fgetc_unlocked,__getc_unlocked)
+ //libc_hidden_def(__getc_unlocked)
+
+ libc_hidden_proto(getc_unlocked)
+-strong_alias(__fgetc_unlocked,getc_unlocked)
++strong_alias(fgetc_unlocked,getc_unlocked)
+ libc_hidden_def(getc_unlocked)
+
+ #ifndef __UCLIBC_HAS_THREADS__
+ libc_hidden_proto(fgetc)
+-strong_alias(__fgetc_unlocked,fgetc)
++strong_alias(fgetc_unlocked,fgetc)
+ libc_hidden_def(fgetc)
+
+-strong_alias(__fgetc_unlocked,getc)
++strong_alias(fgetc_unlocked,getc)
+ #endif
+
+ #elif defined __UCLIBC_HAS_THREADS__
+diff -ur uClibc-0.9.29/libc/stdio/fgets.c uClibc-0.9.29-patched/libc/stdio/fgets.c
+--- uClibc-0.9.29/libc/stdio/fgets.c 2006-01-15 16:41:03.000000000 -0600
++++ uClibc-0.9.29-patched/libc/stdio/fgets.c 2007-05-09 18:05:21.638421151 -0500
+@@ -10,8 +10,7 @@
+ libc_hidden_proto(fgets_unlocked)
+
+ #ifdef __DO_UNLOCKED
+-
+-libc_hidden_proto(__fgetc_unlocked)
++libc_hidden_proto(fgetc_unlocked)
+
+ char *fgets_unlocked(char *__restrict s, int n,
+ register FILE * __restrict stream)
+@@ -38,7 +37,7 @@
+ break;
+ }
+ } else {
+- if ((c = __fgetc_unlocked(stream)) == EOF) {
++ if ((c = fgetc_unlocked(stream)) == EOF) {
+ if (__FERROR_UNLOCKED(stream)) {
+ goto ERROR;
+ }
+diff -ur uClibc-0.9.29/libc/stdio/fputc.c uClibc-0.9.29-patched/libc/stdio/fputc.c
+--- uClibc-0.9.29/libc/stdio/fputc.c 2007-04-14 12:03:18.000000000 -0500
++++ uClibc-0.9.29-patched/libc/stdio/fputc.c 2007-05-09 20:50:51.350629927 -0500
+@@ -16,7 +16,7 @@
+
+ #ifdef __DO_UNLOCKED
+
+-int __fputc_unlocked(int c, register FILE *stream)
++int fputc_unlocked(int c, register FILE *stream)
+ {
+ __STDIO_STREAM_VALIDATE(stream);
+
+@@ -70,22 +70,22 @@
+ BAD:
+ return EOF;
+ }
+-libc_hidden_def(__fputc_unlocked)
++libc_hidden_def(fputc_unlocked)
+
+ /* exposing these would be fundamentally *wrong*! fix you, instead! */
+ /* libc_hidden_proto(fputc_unlocked) */
+-strong_alias(__fputc_unlocked,fputc_unlocked)
++/* strong_alias(__fputc_unlocked,fputc_unlocked) */
+ /* exposing these would be fundamentally *wrong*! fix you, instead! */
+ /* libc_hidden_def(fputc_unlocked) */
+
+ libc_hidden_proto(putc_unlocked)
+-strong_alias(__fputc_unlocked,putc_unlocked)
++strong_alias(fputc_unlocked,putc_unlocked)
+ libc_hidden_def(putc_unlocked)
+ #ifndef __UCLIBC_HAS_THREADS__
+-strong_alias(__fputc_unlocked,fputc)
++strong_alias(fputc_unlocked,fputc)
+
+ libc_hidden_proto(putc)
+-strong_alias(__fputc_unlocked,putc)
++strong_alias(fputc_unlocked,putc)
+ libc_hidden_def(putc)
+ #endif
+
+diff -ur uClibc-0.9.29/libc/stdio/getchar.c uClibc-0.9.29-patched/libc/stdio/getchar.c
+--- uClibc-0.9.29/libc/stdio/getchar.c 2006-12-19 22:30:25.000000000 -0600
++++ uClibc-0.9.29-patched/libc/stdio/getchar.c 2007-05-09 18:05:21.642421481 -0500
+@@ -7,7 +7,8 @@
+
+ #include "_stdio.h"
+
+-libc_hidden_proto(__fgetc_unlocked)
++//#undef fgetc_unlocked
++libc_hidden_proto(fgetc_unlocked)
+
+ #undef getchar
+ #ifdef __DO_UNLOCKED
+diff -ur uClibc-0.9.29/libc/stdio/getdelim.c uClibc-0.9.29-patched/libc/stdio/getdelim.c
+--- uClibc-0.9.29/libc/stdio/getdelim.c 2006-02-13 02:52:46.000000000 -0600
++++ uClibc-0.9.29-patched/libc/stdio/getdelim.c 2007-05-09 18:05:21.642421481 -0500
+@@ -11,8 +11,8 @@
+ #include "_stdio.h"
+
+ libc_hidden_proto(getdelim)
+-
+-libc_hidden_proto(__fgetc_unlocked)
++//#undef fgetc_unlocked
++libc_hidden_proto(fgetc_unlocked)
+
+ /* Note: There is a defect in this function. (size_t vs ssize_t). */
+
+diff -ur uClibc-0.9.29/libc/stdio/old_vfprintf.c uClibc-0.9.29-patched/libc/stdio/old_vfprintf.c
+--- uClibc-0.9.29/libc/stdio/old_vfprintf.c 2006-01-22 13:35:08.000000000 -0600
++++ uClibc-0.9.29-patched/libc/stdio/old_vfprintf.c 2007-05-09 18:05:21.642421481 -0500
+@@ -149,7 +149,8 @@
+ libc_hidden_proto(strnlen)
+ libc_hidden_proto(memcpy)
+ libc_hidden_proto(putc_unlocked)
+-libc_hidden_proto(__fputc_unlocked)
++//#undef fputc_unlocked
++libc_hidden_proto(fputc_unlocked)
+ libc_hidden_proto(__glibc_strerror_r)
+
+ /* #undef __UCLIBC_HAS_FLOATS__ */
+diff -ur uClibc-0.9.29/libc/stdio/putchar.c uClibc-0.9.29-patched/libc/stdio/putchar.c
+--- uClibc-0.9.29/libc/stdio/putchar.c 2006-01-13 18:58:03.000000000 -0600
++++ uClibc-0.9.29-patched/libc/stdio/putchar.c 2007-05-09 18:05:21.642421481 -0500
+@@ -7,7 +7,8 @@
+
+ #include "_stdio.h"
+
+-libc_hidden_proto(__fputc_unlocked)
++//#undef fputc_unlocked
++libc_hidden_proto(fputc_unlocked)
+
+ #undef putchar
+ #ifdef __DO_UNLOCKED
+diff -ur uClibc-0.9.29/libc/stdio/puts.c uClibc-0.9.29-patched/libc/stdio/puts.c
+--- uClibc-0.9.29/libc/stdio/puts.c 2006-01-13 18:58:03.000000000 -0600
++++ uClibc-0.9.29-patched/libc/stdio/puts.c 2007-05-09 18:05:21.642421481 -0500
+@@ -7,7 +7,8 @@
+
+ #include "_stdio.h"
+
+-libc_hidden_proto(__fputc_unlocked)
++//#undef fputc_unlocked
++libc_hidden_proto(fputc_unlocked)
+ libc_hidden_proto(fputs_unlocked)
+
+ int puts(register const char * __restrict s)
+@@ -25,7 +26,7 @@
+ /* Note: Nonportable as fputs need only return nonnegative on success. */
+ if ((n = fputs_unlocked(s, stream)) != EOF) {
+ ++n;
+- if (__fputc_unlocked('\n', stream) == EOF) {
++ if (fputc_unlocked('\n', stream) == EOF) {
+ n = EOF;
+ }
+ }
+diff -ur uClibc-0.9.29/libc/stdio/putwchar.c uClibc-0.9.29-patched/libc/stdio/putwchar.c
+--- uClibc-0.9.29/libc/stdio/putwchar.c 2006-01-14 14:16:19.000000000 -0600
++++ uClibc-0.9.29-patched/libc/stdio/putwchar.c 2007-05-09 18:05:21.642421481 -0500
+@@ -22,7 +22,8 @@
+
+ #elif defined __UCLIBC_HAS_THREADS__
+
+-libc_hidden_proto(__fputc_unlocked)
++//#undef fputc_unlocked
++libc_hidden_proto(fputc_unlocked)
+ /* psm: should this be fputwc? */
+ libc_hidden_proto(fputc)
+
+diff -ur uClibc-0.9.29/libc/sysdeps/linux/common/bits/uClibc_stdio.h uClibc-0.9.29-patched/libc/sysdeps/linux/common/bits/uClibc_stdio.h
+--- uClibc-0.9.29/libc/sysdeps/linux/common/bits/uClibc_stdio.h 2007-01-28 07:16:58.000000000 -0600
++++ uClibc-0.9.29-patched/libc/sysdeps/linux/common/bits/uClibc_stdio.h 2007-05-09 20:56:02.408110608 -0500
+@@ -381,33 +381,29 @@
+ # define __FEOF(__stream) __FEOF_UNLOCKED(__stream)
+ #endif
+
+-extern int __fgetc_unlocked(FILE *__stream);
+-extern int __fputc_unlocked(int __c, FILE *__stream);
+-
+ /* First define the default definitions.
+ They are overridden below as necessary. */
+-#define __FGETC_UNLOCKED(__stream) (__fgetc_unlocked)((__stream))
++#define __FGETC_UNLOCKED(__stream) (fgetc_unlocked)((__stream))
+ #define __FGETC(__stream) (fgetc)((__stream))
+-#define __GETC_UNLOCKED_MACRO(__stream) (__fgetc_unlocked)((__stream))
+-#define __GETC_UNLOCKED(__stream) (__fgetc_unlocked)((__stream))
++#define __GETC_UNLOCKED_MACRO(__stream) (fgetc_unlocked)((__stream))
++#define __GETC_UNLOCKED(__stream) (fgetc_unlocked)((__stream))
+ #define __GETC(__stream) (fgetc)((__stream))
+
+-#define __FPUTC_UNLOCKED(__c, __stream) (__fputc_unlocked)((__c),(__stream))
++#define __FPUTC_UNLOCKED(__c, __stream) (fputc_unlocked)((__c),(__stream))
+ #define __FPUTC(__c, __stream) (fputc)((__c),(__stream))
+-#define __PUTC_UNLOCKED_MACRO(__c, __stream) (__fputc_unlocked)((__c),(__stream))
+-#define __PUTC_UNLOCKED(__c, __stream) (__fputc_unlocked)((__c),(__stream))
++#define __PUTC_UNLOCKED_MACRO(__c, __stream) (fputc_unlocked)((__c),(__stream))
++#define __PUTC_UNLOCKED(__c, __stream) (fputc_unlocked)((__c),(__stream))
+ #define __PUTC(__c, __stream) (fputc)((__c),(__stream))
+
+
+ #ifdef __STDIO_GETC_MACRO
+-
+ extern FILE *__stdin; /* For getchar() macro. */
+
+ # undef __GETC_UNLOCKED_MACRO
+ # define __GETC_UNLOCKED_MACRO(__stream) \
+ ( ((__stream)->__bufpos < (__stream)->__bufgetc_u) \
+ ? (*(__stream)->__bufpos++) \
+- : __fgetc_unlocked(__stream) )
++ : fgetc_unlocked(__stream) )
+
+ # if 0
+ /* Classic macro approach. getc{_unlocked} can have side effects. */
+@@ -453,20 +449,17 @@
+ # endif
+ # endif
+
+-#else
+-
+ #endif /* __STDIO_GETC_MACRO */
+
+
+ #ifdef __STDIO_PUTC_MACRO
+-
+ extern FILE *__stdout; /* For putchar() macro. */
+
+ # undef __PUTC_UNLOCKED_MACRO
+ # define __PUTC_UNLOCKED_MACRO(__c, __stream) \
+ ( ((__stream)->__bufpos < (__stream)->__bufputc_u) \
+ ? (*(__stream)->__bufpos++) = (__c) \
+- : __fputc_unlocked((__c),(__stream)) )
++ : (fputc_unlocked((__c),(__stream)) )
+
+ # if 0
+ /* Classic macro approach. putc{_unlocked} can have side effects.*/
+@@ -489,7 +482,8 @@
+ }) )
+
+ # undef __PUTC_UNLOCKED
+-# define __PUTC_UNLOCKED(__c, __stream) __FPUTC_UNLOCKED((__c), (__stream))
++# define __PUTC_UNLOCKED(__c, __stream) \
++ __FPUTC_UNLOCKED((__c), (__stream))
+
+ # ifdef __UCLIBC_HAS_THREADS__
+ # undef __FPUTC
+diff -ur uClibc-0.9.29/libc/unistd/getpass.c uClibc-0.9.29-patched/libc/unistd/getpass.c
+--- uClibc-0.9.29/libc/unistd/getpass.c 2006-07-05 05:58:38.000000000 -0500
++++ uClibc-0.9.29-patched/libc/unistd/getpass.c 2007-05-09 18:05:21.642421481 -0500
+@@ -36,7 +36,8 @@
+ libc_hidden_proto(fputs)
+ libc_hidden_proto(fputc)
+ libc_hidden_proto(putc)
+-libc_hidden_proto(__fputc_unlocked)
++//#undef fputc_unlocked
++libc_hidden_proto(fputc_unlocked)
+
+ /* It is desirable to use this bit on systems that have it.
+ The only bit of terminal state we want to twiddle is echoing, which is
diff --git a/patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-gethostent_r-failure-retval.patch b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-gethostent_r-failure-retval.patch
new file mode 100644
index 0000000..7b246c1
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-gethostent_r-failure-retval.patch
@@ -0,0 +1,12 @@
+diff -ur uClibc-0.9.29/libc/inet/resolv.c uClibc-0.9.29-patched/libc/inet/resolv.c
+--- uClibc-0.9.29/libc/inet/resolv.c 2007-04-23 12:01:05.000000000 -0500
++++ uClibc-0.9.29-patched/libc/inet/resolv.c 2007-05-09 18:05:33.563404419 -0500
+@@ -1700,7 +1700,7 @@
+ int gethostent_r(struct hostent *result_buf, char *buf, size_t buflen,
+ struct hostent **result, int *h_errnop)
+ {
+- int ret;
++ int ret = HOST_NOT_FOUND;
+
+ __UCLIBC_MUTEX_LOCK(mylock);
+ if (__gethostent_fp == NULL) {
diff --git a/patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-internal_function-definition.patch b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-internal_function-definition.patch
new file mode 100644
index 0000000..9b88d82
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-fix-internal_function-definition.patch
@@ -0,0 +1,51 @@
+Index: uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h
+===================================================================
+--- uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h (revision 18898)
++++ uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h (working copy)
+@@ -42,6 +42,8 @@
+ /* define if target supports IEEE signed zero floats */
+ #define __UCLIBC_HAVE_SIGNED_ZERO__
+
++#if defined _LIBC
+ #define internal_function __attribute__ ((regparm (3), stdcall))
++#endif
+
+ #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
+Index: uClibc/include/libc-symbols.h
+===================================================================
+--- uClibc/include/libc-symbols.h (revision 18898)
++++ uClibc/include/libc-symbols.h (working copy)
+@@ -22,6 +22,16 @@
+ #ifndef _LIBC_SYMBOLS_H
+ #define _LIBC_SYMBOLS_H 1
+
++/* This is defined for the compilation of all C library code. features.h
++ tests this to avoid inclusion of stubs.h while compiling the library,
++ before stubs.h has been generated. Some library code that is shared
++ with other packages also tests this symbol to see if it is being
++ compiled as part of the C library. We must define this before including
++ config.h, because it makes some definitions conditional on whether libc
++ itself is being compiled, or just some generator program. */
++#define _LIBC 1
++
++
+ /* This file's macros are included implicitly in the compilation of every
+ file in the C library by -imacros.
+
+@@ -40,16 +50,6 @@
+
+ #include <bits/uClibc_arch_features.h>
+
+-
+-/* This is defined for the compilation of all C library code. features.h
+- tests this to avoid inclusion of stubs.h while compiling the library,
+- before stubs.h has been generated. Some library code that is shared
+- with other packages also tests this symbol to see if it is being
+- compiled as part of the C library. We must define this before including
+- config.h, because it makes some definitions conditional on whether libc
+- itself is being compiled, or just some generator program. */
+-#define _LIBC 1
+-
+ /* Enable declarations of GNU extensions, since we are compiling them. */
+ #define _GNU_SOURCE 1
+
diff --git a/patches/uClibc-0.9.29/generic/uClibc-0.9.29-linuxthreads.patch b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-linuxthreads.patch
new file mode 100644
index 0000000..8ce2439
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-linuxthreads.patch
@@ -0,0 +1,145 @@
+--- a/libpthread/linuxthreads.old/attr.c 2006-01-24 12:41:01.000000000 -0500
++++ b/libpthread/linuxthreads.old/attr.c 2008-02-10 11:35:32.000000000 -0500
+@@ -25,6 +25,14 @@
+ #include "pthread.h"
+ #include "internals.h"
+
++#include <sys/resource.h>
++#include <inttypes.h>
++#include <stdio.h>
++#include <stdio_ext.h>
++#include <stdlib.h>
++#include <sys/resource.h>
++
++
+ /* NOTE: With uClibc I don't think we need this versioning stuff.
+ * Therefore, define the function pthread_attr_init() here using
+ * a strong symbol. */
+@@ -209,4 +217,94 @@ int __pthread_attr_getstacksize(const pt
+ *stacksize = attr->__stacksize;
+ return 0;
+ }
++
++
++extern int *__libc_stack_end;
++
+ weak_alias (__pthread_attr_getstacksize, pthread_attr_getstacksize)
++void* pthread_getattr_np(pthread_t thread, pthread_attr_t *attr)
++{
++ static void *stackBase = 0;
++ static size_t stackSize = 0;
++ int ret = 0;
++ /* Stack size limit. */
++ struct rlimit rl;
++
++ /* The safest way to get the top of the stack is to read
++ /proc/self/maps and locate the line into which
++ __libc_stack_end falls. */
++ FILE *fp = fopen("/proc/self/maps", "rc");
++ if (fp == NULL)
++ ret = errno;
++ /* We need the limit of the stack in any case. */
++ else if (getrlimit (RLIMIT_STACK, &rl) != 0)
++ ret = errno;
++ else {
++ /* We need no locking. */
++ __fsetlocking (fp, FSETLOCKING_BYCALLER);
++
++ /* Until we found an entry (which should always be the case)
++ mark the result as a failure. */
++ ret = ENOENT;
++
++ char *line = NULL;
++ size_t linelen = 0;
++ uintptr_t last_to = 0;
++
++ while (! feof_unlocked (fp)) {
++ if (getdelim (&line, &linelen, '\n', fp) <= 0)
++ break;
++
++ uintptr_t from;
++ uintptr_t to;
++ if (sscanf (line, "%x-%x", &from, &to) != 2)
++ continue;
++ if (from <= (uintptr_t) __libc_stack_end
++ && (uintptr_t) __libc_stack_end < to) {
++ /* Found the entry. Now we have the info we need. */
++ attr->__stacksize = rl.rlim_cur;
++#ifdef _STACK_GROWS_UP
++ /* Don't check to enforce a limit on the __stacksize */
++ attr->__stackaddr = (void *) from;
++#else
++ attr->__stackaddr = (void *) to;
++
++ /* The limit might be too high. */
++ if ((size_t) attr->__stacksize > (size_t) attr->__stackaddr - last_to)
++ attr->__stacksize = (size_t) attr->__stackaddr - last_to;
++#endif
++
++ /* We succeed and no need to look further. */
++ ret = 0;
++ break;
++ }
++ last_to = to;
++ }
++
++ fclose (fp);
++ free (line);
++ }
++#ifndef _STACK_GROWS_UP
++ stackBase = (char *) attr->__stackaddr - attr->__stacksize;
++#else
++ stackBase = attr->__stackaddr;
++#endif
++ stackSize = attr->__stacksize;
++ return (void*)(stackBase + stackSize);
++}
++
++int __pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr,
++ size_t *stacksize)
++{
++ /* XXX This function has a stupid definition. The standard specifies
++ no error value but what is if no stack address was set? We simply
++ return the value we have in the member. */
++#ifndef _STACK_GROWS_UP
++ *stackaddr = (char *) attr->__stackaddr - attr->__stacksize;
++#else
++ *stackaddr = attr->__stackaddr;
++#endif
++ *stacksize = attr->__stacksize;
++ return 0;
++}
++weak_alias (__pthread_attr_getstack, pthread_attr_getstack)
+
+--- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h 2006-12-07 22:19:36.000000000 -0500
++++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h 2008-02-10 11:42:35.000000000 -0500
+@@ -288,15 +288,11 @@ extern int pthread_attr_getstacksize (__
+ __attr, size_t *__restrict __stacksize)
+ __THROW;
+
+-#if 0
+-/* Not yet implemented in uClibc! */
+-
+ #ifdef __USE_GNU
+ /* Initialize thread attribute *ATTR with attributes corresponding to the
+ already running thread TH. It shall be called on unitialized ATTR
+ and destroyed with pthread_attr_destroy when no longer needed. */
+-extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW;
+-#endif
++extern void* pthread_getattr_np(pthread_t thread, pthread_attr_t *attr);
+ #endif
+
+ /* Functions for scheduling control. */
+@@ -599,6 +595,11 @@ extern int pthread_cancel (pthread_t __c
+ cancelled. */
+ extern void pthread_testcancel (void);
+
++/* Return the previously set address for the stack. */
++extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr,
++ void **__restrict __stackaddr,
++ size_t *__restrict __stacksize) __THROW;
++
+
+ /* Install a cleanup handler: ROUTINE will be called with arguments ARG
+ when the thread is cancelled or calls pthread_exit. ROUTINE will also
+
diff --git a/patches/uClibc-0.9.29/generic/uClibc-0.9.29-rm-whitespace.patch b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-rm-whitespace.patch
new file mode 100644
index 0000000..6004f91
--- /dev/null
+++ b/patches/uClibc-0.9.29/generic/uClibc-0.9.29-rm-whitespace.patch
@@ -0,0 +1,86 @@
+diff -urN uClibc-0.9.29-0rig/include/assert.h uClibc-0.9.29/include/assert.h
+--- uClibc-0.9.29-0rig/include/assert.h 2005-11-03 23:42:46.000000000 +0100
++++ uClibc-0.9.29/include/assert.h 2007-08-13 19:10:57.000000000 +0200
+@@ -31,7 +31,7 @@
+ #define _ASSERT_H 1
+ #include <features.h>
+
+-#if defined __cplusplus && __GNUC_PREREQ (2,95)
++#if defined __cplusplus && __GNUC_PREREQ(2,95)
+ # define __ASSERT_VOID_CAST static_cast<void>
+ #else
+ # define __ASSERT_VOID_CAST (void)
+@@ -59,13 +59,17 @@
+ (__ASSERT_VOID_CAST ((expr) ? 0 : \
+ (__assert (__STRING(expr), __FILE__, __LINE__, \
+ __ASSERT_FUNCTION), 0)))
+-
++
++/* Define some temporaries to workaround tinyx makedepend bug */
++#define __GNUC_PREREQ_2_6 __GNUC_PREREQ(2, 6)
++#define __GNUC_PREREQ_2_4 __GNUC_PREREQ(2, 4)
+ /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
+ which contains the name of the function currently being defined.
+ This is broken in G++ before version 2.6.
+ C9x has a similar variable called __func__, but prefer the GCC one since
+ it demangles C++ function names. */
+-# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
++
++# if defined __cplusplus ? __GNUC_PREREQ_2_6 : __GNUC_PREREQ_2_4
+ # define __ASSERT_FUNCTION __PRETTY_FUNCTION__
+ # else
+ # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+diff -urN uClibc-0.9.29-0rig/include/complex.h uClibc-0.9.29/include/complex.h
+--- uClibc-0.9.29-0rig/include/complex.h 2002-05-09 10:15:21.000000000 +0200
++++ uClibc-0.9.29/include/complex.h 2007-08-13 17:55:29.000000000 +0200
+@@ -33,7 +33,7 @@
+ /* We might need to add support for more compilers here. But since ISO
+ C99 is out hopefully all maintained compilers will soon provide the data
+ types `float complex' and `double complex'. */
+-#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97)
++#if __GNUC_PREREQ(2, 7) && !__GNUC_PREREQ(2, 97)
+ # define _Complex __complex__
+ #endif
+
+diff -urN uClibc-0.9.29-0rig/include/features.h uClibc-0.9.29/include/features.h
+--- uClibc-0.9.29-0rig/include/features.h 2006-11-29 22:10:04.000000000 +0100
++++ uClibc-0.9.29/include/features.h 2007-08-13 17:55:51.000000000 +0200
+@@ -143,7 +143,7 @@
+
+ /* Convenience macros to test the versions of glibc and gcc.
+ Use them like this:
+- #if __GNUC_PREREQ (2,8)
++ #if __GNUC_PREREQ(2,8)
+ ... code requiring gcc 2.8 or later ...
+ #endif
+ Note - they won't work for gcc1 or glibc1, since the _MINOR macros
+@@ -297,7 +297,7 @@
+ /* uClibc does not support _FORTIFY_SOURCE */
+ #undef _FORTIFY_SOURCE
+ #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
+- && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
++ && __GNUC_PREREQ(4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
+ # if _FORTIFY_SOURCE > 1
+ # define __USE_FORTIFY_LEVEL 2
+ # else
+@@ -366,7 +366,7 @@
+ #endif /* !ASSEMBLER */
+
+ /* Decide whether we can define 'extern inline' functions in headers. */
+-#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
++#if __GNUC_PREREQ(2, 7) && defined __OPTIMIZE__ \
+ && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
+ # define __USE_EXTERN_INLINES 1
+ #endif
+diff -urN uClibc-0.9.29-0rig/include/tgmath.h uClibc-0.9.29/include/tgmath.h
+--- uClibc-0.9.29-0rig/include/tgmath.h 2002-05-09 10:15:21.000000000 +0200
++++ uClibc-0.9.29/include/tgmath.h 2007-08-13 17:56:17.000000000 +0200
+@@ -34,7 +34,7 @@
+ do not try this for now and instead concentrate only on GNU CC. Once
+ we have more information support for other compilers might follow. */
+
+-#if __GNUC_PREREQ (2, 7)
++#if __GNUC_PREREQ(2, 7)
+
+ # ifdef __NO_LONG_DOUBLE_MATH
+ # define __tgml(fct) fct