summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2011-11-03 12:50:10 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2011-11-23 16:50:26 +0100
commit81291f683e7d4dfaacbd41af665dac732b3860a8 (patch)
treeac1347bc3b13642d5e065e466b8d38a4b26763b9
parentdb7117cbd0c2942a4b72243ddd131f97b786a4d5 (diff)
downloadOSELAS.Toolchain-81291f683e7d4dfaacbd41af665dac732b3860a8.tar.gz
OSELAS.Toolchain-81291f683e7d4dfaacbd41af665dac732b3860a8.tar.xz
add patches for gcc-4.6.2
* copied from gcc-4.5.2. * Obsolete patches removed. * Patch headers cleaned up. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--patches/gcc-4.6.2/0001-Volatile-bitfields-vs.-inline-asm-memory-constraints.patch36
-rw-r--r--patches/gcc-4.6.2/0100-no-host-includes.patch55
-rw-r--r--patches/gcc-4.6.2/0101-arm-softfloat.patch45
-rw-r--r--patches/gcc-4.6.2/0102-fix-arith_adjacentmem-LDM-splitting-code.patch39
-rw-r--r--patches/gcc-4.6.2/0200-also-match-uclibc-when-checking-host-os.patch49
-rw-r--r--patches/gcc-4.6.2/0201-missing-execinfo.h.patch24
-rw-r--r--patches/gcc-4.6.2/0202-c99-snprintf.patch24
-rw-r--r--patches/gcc-4.6.2/0203-libmudflap-susv3-legacy.patch62
-rw-r--r--patches/gcc-4.6.2/0300-gcc-trampolinewarn.patch46
-rw-r--r--patches/gcc-4.6.2/0301-flatten-switch-stmt-into-if-else-chain-for-Os.patch83
-rw-r--r--patches/gcc-4.6.2/0302-libiberty-pic.patch24
-rw-r--r--patches/gcc-4.6.2/0303-libstdc-pic.patch58
-rw-r--r--patches/gcc-4.6.2/series19
13 files changed, 564 insertions, 0 deletions
diff --git a/patches/gcc-4.6.2/0001-Volatile-bitfields-vs.-inline-asm-memory-constraints.patch b/patches/gcc-4.6.2/0001-Volatile-bitfields-vs.-inline-asm-memory-constraints.patch
new file mode 100644
index 0000000..7850236
--- /dev/null
+++ b/patches/gcc-4.6.2/0001-Volatile-bitfields-vs.-inline-asm-memory-constraints.patch
@@ -0,0 +1,36 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Wed, 23 Nov 2011 15:43:22 +0100
+Subject: [PATCH] Volatile bitfields vs. inline asm memory constraints
+
+taken from trunk.
+http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01477.html
+
+gcc/
+* expr.c (expand_expr_real_1): Only use BLKmode for volatile
+accesses which are not naturally aligned.
+
+Patch taken from Debian
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ gcc/expr.c | 7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/expr.c b/gcc/expr.c
+index c4a00aa..03f51f4 100644
+--- a/gcc/expr.c
++++ b/gcc/expr.c
+@@ -9189,8 +9189,11 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
+ && modifier != EXPAND_CONST_ADDRESS
+ && modifier != EXPAND_INITIALIZER)
+ /* If the field is volatile, we always want an aligned
+- access. */
+- || (volatilep && flag_strict_volatile_bitfields > 0)
++ access. Only do this if the access is not already naturally
++ aligned, otherwise "normal" (non-bitfield) volatile fields
++ become non-addressable. */
++ || (volatilep && flag_strict_volatile_bitfields > 0
++ && (bitpos % GET_MODE_ALIGNMENT (mode) != 0))
+ /* If the field isn't aligned enough to fetch as a memref,
+ fetch it as a bit field. */
+ || (mode1 != BLKmode
diff --git a/patches/gcc-4.6.2/0100-no-host-includes.patch b/patches/gcc-4.6.2/0100-no-host-includes.patch
new file mode 100644
index 0000000..c17e446
--- /dev/null
+++ b/patches/gcc-4.6.2/0100-no-host-includes.patch
@@ -0,0 +1,55 @@
+From: Marc Kleine-Budde <m.kleine-budde@pengutronix.de>
+Date: Tue, 1 Nov 2011 18:25:06 +0100
+Subject: [PATCH] no host includes
+
+With this patch gcc bails out if you include a host include path into
+the searchlist (-I). This patch is not intended for upstream and was
+inspired by
+
+http://www.openembedded.org/repo/org.openembedded.dev/packages/gcc/gcc-4.1.1/zecke-no-host-includes.patch
+
+Signed-off-by: Marc Kleine-Budde <m.kleine-budde@pengutronix.de>
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ gcc/incpath.c | 28 ++++++++++++++++++++++++++++
+ 1 files changed, 28 insertions(+), 0 deletions(-)
+
+diff --git a/gcc/incpath.c b/gcc/incpath.c
+index baf904f..65397e2 100644
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -417,6 +417,34 @@ add_path (char *path, int chain, int cxx_aware, bool user_supplied_p)
+ 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.6.2/0101-arm-softfloat.patch b/patches/gcc-4.6.2/0101-arm-softfloat.patch
new file mode 100644
index 0000000..bc639db
--- /dev/null
+++ b/patches/gcc-4.6.2/0101-arm-softfloat.patch
@@ -0,0 +1,45 @@
+From: Marc Kleine-Budde <m.kleine-budde@pengutronix.de>
+Date: Tue, 1 Nov 2011 18:25:06 +0100
+Subject: [PATCH] arm softfloat
+
+Link assembler softfloat functions into gcc. As the functions are there
+in that case anyway, don't add switches for float lib.
+
+Upstream will not fix this because oabi is dead.
+
+Signed-off-by: Marc Kleine-Budde <m.kleine-budde@pengutronix.de>
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ gcc/config/arm/linux-elf.h | 2 +-
+ gcc/config/arm/t-linux | 5 ++++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
+index 81d27bb..77bd193 100644
+--- a/gcc/config/arm/linux-elf.h
++++ b/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"
+
+diff --git a/gcc/config/arm/t-linux b/gcc/config/arm/t-linux
+index a6fddad..4191a29 100644
+--- a/gcc/config/arm/t-linux
++++ b/gcc/config/arm/t-linux
+@@ -23,7 +23,10 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
+
+ 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.6.2/0102-fix-arith_adjacentmem-LDM-splitting-code.patch b/patches/gcc-4.6.2/0102-fix-arith_adjacentmem-LDM-splitting-code.patch
new file mode 100644
index 0000000..3b845c4
--- /dev/null
+++ b/patches/gcc-4.6.2/0102-fix-arith_adjacentmem-LDM-splitting-code.patch
@@ -0,0 +1,39 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Tue, 1 Nov 2011 18:25:07 +0100
+Subject: [PATCH] fix arith_adjacentmem LDM splitting code
+
+This is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39429
+
+This is the patch fromt the gcc bugzilla.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ gcc/config/arm/arm.md | 15 +++++++++++++++
+ 1 files changed, 15 insertions(+), 0 deletions(-)
+
+diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
+index cc6d34b..b5d0d05 100644
+--- a/gcc/config/arm/arm.md
++++ b/gcc/config/arm/arm.md
+@@ -9869,6 +9869,21 @@
+ else
+ {
+ /* Offset is out of range for a single add, so use two ldr. */
++
++ /* Swap the ldrs if the first ldr would clobber the shared base_reg. */
++ if (REGNO (ldm[1]) == REGNO (base_reg))
++ {
++ rtx tmp_reg;
++ HOST_WIDE_INT tmp_val;
++
++ tmp_reg = ldm[1];
++ ldm[1] = ldm[2];
++ ldm[2] = tmp_reg;
++ tmp_val = val1;
++ val1 = val2;
++ val2 = tmp_val;
++ }
++
+ ops[0] = ldm[1];
+ ops[1] = base_reg;
+ ops[2] = GEN_INT (val1);
diff --git a/patches/gcc-4.6.2/0200-also-match-uclibc-when-checking-host-os.patch b/patches/gcc-4.6.2/0200-also-match-uclibc-when-checking-host-os.patch
new file mode 100644
index 0000000..d6eb3bc
--- /dev/null
+++ b/patches/gcc-4.6.2/0200-also-match-uclibc-when-checking-host-os.patch
@@ -0,0 +1,49 @@
+From: unknown author <unknown.author@example.com>
+Date: Tue, 1 Nov 2011 18:25:07 +0100
+Subject: [PATCH] also match uclibc when checking host os
+
+This patch was taken from uclibc.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ contrib/regression/objs-gcc.sh | 4 ++++
+ libjava/classpath/ltconfig | 4 ++--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/contrib/regression/objs-gcc.sh b/contrib/regression/objs-gcc.sh
+index 60b0497..6dc7ead 100755
+--- a/contrib/regression/objs-gcc.sh
++++ b/contrib/regression/objs-gcc.sh
+@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-gnu ]
+ 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
+diff --git a/libjava/classpath/ltconfig b/libjava/classpath/ltconfig
+index 743d951..ae4ea60 100755
+--- a/libjava/classpath/ltconfig
++++ b/libjava/classpath/ltconfig
+@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+ # 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
+
+@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
diff --git a/patches/gcc-4.6.2/0201-missing-execinfo.h.patch b/patches/gcc-4.6.2/0201-missing-execinfo.h.patch
new file mode 100644
index 0000000..3374522
--- /dev/null
+++ b/patches/gcc-4.6.2/0201-missing-execinfo.h.patch
@@ -0,0 +1,24 @@
+From: unknown author <unknown.author@example.com>
+Date: Tue, 1 Nov 2011 18:25:07 +0100
+Subject: [PATCH] missing execinfo.h
+
+This patch was taken from uclibc.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ boehm-gc/include/gc.h | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
+index c51e017..a7ba8dc 100644
+--- a/boehm-gc/include/gc.h
++++ b/boehm-gc/include/gc.h
+@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
+ #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.6.2/0202-c99-snprintf.patch b/patches/gcc-4.6.2/0202-c99-snprintf.patch
new file mode 100644
index 0000000..75f5e36
--- /dev/null
+++ b/patches/gcc-4.6.2/0202-c99-snprintf.patch
@@ -0,0 +1,24 @@
+From: unknown author <unknown.author@example.com>
+Date: Tue, 1 Nov 2011 18:25:07 +0100
+Subject: [PATCH] c99 snprintf
+
+This patch was taken from uclibc.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ libstdc++-v3/include/c_global/cstdio | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio
+index 049704d..407bd2d 100644
+--- a/libstdc++-v3/include/c_global/cstdio
++++ b/libstdc++-v3/include/c_global/cstdio
+@@ -137,7 +137,7 @@ namespace std
+ using ::vsprintf;
+ } // namespace
+
+-#if _GLIBCXX_USE_C99
++#if _GLIBCXX_USE_C99 || defined __UCLIBC__
+
+ #undef snprintf
+ #undef vfscanf
diff --git a/patches/gcc-4.6.2/0203-libmudflap-susv3-legacy.patch b/patches/gcc-4.6.2/0203-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000..295d19c
--- /dev/null
+++ b/patches/gcc-4.6.2/0203-libmudflap-susv3-legacy.patch
@@ -0,0 +1,62 @@
+From: unknown author <unknown.author@example.com>
+Date: Tue, 1 Nov 2011 18:25:07 +0100
+Subject: [PATCH] libmudflap susv3 legacy
+
+uclibc does not provide bzero, bcopy, index ...
+
+This patch was taken from uclibc.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ libmudflap/mf-hooks2.c | 10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/libmudflap/mf-hooks2.c b/libmudflap/mf-hooks2.c
+index 5649e1c..65000c6 100644
+--- a/libmudflap/mf-hooks2.c
++++ b/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, void *dest, size_t n)
+ 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, const void *s2, size_t n)
+ 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, int c)
+ 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, int c)
+ 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.6.2/0300-gcc-trampolinewarn.patch b/patches/gcc-4.6.2/0300-gcc-trampolinewarn.patch
new file mode 100644
index 0000000..5817b06
--- /dev/null
+++ b/patches/gcc-4.6.2/0300-gcc-trampolinewarn.patch
@@ -0,0 +1,46 @@
+From: "Kevin F. Quinn" <kevquinn@gentoo.org>
+Date: Tue, 1 Nov 2011 18:25:08 +0100
+Subject: [PATCH] gcc trampolinewarn
+
+Taken from gentoo, original description:
+
+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)'.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ gcc/builtins.c | 3 +++
+ gcc/common.opt | 4 ++++
+ 2 files changed, 7 insertions(+), 0 deletions(-)
+
+diff --git a/gcc/builtins.c b/gcc/builtins.c
+index fd99611..bc91aa8 100644
+--- a/gcc/builtins.c
++++ b/gcc/builtins.c
+@@ -4947,6 +4947,9 @@ expand_builtin_va_copy (tree exp)
+ emit_block_move (dstb, srcb, size, BLOCK_OP_NORMAL);
+ }
+
++ if (warn_trampolines)
++ warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)");
++
+ return const0_rtx;
+ }
+
+diff --git a/gcc/common.opt b/gcc/common.opt
+index 6056551..dde2546 100644
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -627,6 +627,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) Init(-1) Warning
+ Warn about uninitialized automatic variables
diff --git a/patches/gcc-4.6.2/0301-flatten-switch-stmt-into-if-else-chain-for-Os.patch b/patches/gcc-4.6.2/0301-flatten-switch-stmt-into-if-else-chain-for-Os.patch
new file mode 100644
index 0000000..13a7f65
--- /dev/null
+++ b/patches/gcc-4.6.2/0301-flatten-switch-stmt-into-if-else-chain-for-Os.patch
@@ -0,0 +1,83 @@
+From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
+Date: Tue, 1 Nov 2011 18:25:08 +0100
+Subject: [PATCH] flatten switch-stmt into if-else chain for -Os
+
+This is 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
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ gcc/stmt.c | 9 ++++++++-
+ 1 files changed, 8 insertions(+), 1 deletions(-)
+
+diff --git a/gcc/stmt.c b/gcc/stmt.c
+index b65c6db..0315d80 100644
+--- a/gcc/stmt.c
++++ b/gcc/stmt.c
+@@ -2478,7 +2478,13 @@ expand_case (gimple stmt)
+ default code is emitted. */
+
+ use_cost_table = 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);
+@@ -3046,6 +3052,7 @@ emit_case_nodes (rtx index, case_node_ptr node, rtx default_label,
+ {
+ 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.6.2/0302-libiberty-pic.patch b/patches/gcc-4.6.2/0302-libiberty-pic.patch
new file mode 100644
index 0000000..4d13b41
--- /dev/null
+++ b/patches/gcc-4.6.2/0302-libiberty-pic.patch
@@ -0,0 +1,24 @@
+From: Marc Kleine-Budde <m.kleine-budde@pengutronix.de>
+Date: Tue, 1 Nov 2011 18:25:08 +0100
+Subject: [PATCH] libiberty pic
+
+Taken from gentoo.
+
+Signed-off-by: Marc Kleine-Budde <m.kleine-budde@pengutronix.de>
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ libiberty/Makefile.in | 1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
+index ef35453..1c57edb 100644
+--- a/libiberty/Makefile.in
++++ b/libiberty/Makefile.in
+@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
+ $(AR) $(AR_FLAGS) $(TARGETLIB) \
+ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
+ $(RANLIB) $(TARGETLIB); \
++ cp $(TARGETLIB) ../ ; \
+ cd ..; \
+ else true; fi
+
diff --git a/patches/gcc-4.6.2/0303-libstdc-pic.patch b/patches/gcc-4.6.2/0303-libstdc-pic.patch
new file mode 100644
index 0000000..cd33067
--- /dev/null
+++ b/patches/gcc-4.6.2/0303-libstdc-pic.patch
@@ -0,0 +1,58 @@
+From: Marc Kleine-Budde <m.kleine-budde@pengutronix.de>
+Date: Tue, 1 Nov 2011 18:25:08 +0100
+Subject: [PATCH] libstdc++ pic
+
+Install libstdc++_pic.a if we have pic objs. Taken from gentoo.
+
+Signed-off-by: Marc Kleine-Budde <m.kleine-budde@pengutronix.de>
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ libstdc++-v3/src/Makefile.am | 7 +++++++
+ libstdc++-v3/src/Makefile.in | 9 ++++++++-
+ 2 files changed, 15 insertions(+), 1 deletions(-)
+
+diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
+index 9a35685..dd0c8a3 100644
+--- a/libstdc++-v3/src/Makefile.am
++++ b/libstdc++-v3/src/Makefile.am
+@@ -445,6 +445,13 @@ CXXLINK = $(LIBTOOL) --tag CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+ $(CXX) $(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
+diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
+index b454f66..1231363 100644
+--- a/libstdc++-v3/src/Makefile.in
++++ b/libstdc++-v3/src/Makefile.in
+@@ -725,7 +725,7 @@ install-dvi: install-dvi-am
+
+ install-dvi-am:
+
+-install-exec-am: install-toolexeclibLTLIBRARIES
++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
+
+ install-html: install-html-am
+
+@@ -1021,6 +1021,13 @@ 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.6.2/series b/patches/gcc-4.6.2/series
new file mode 100644
index 0000000..e4ed42c
--- /dev/null
+++ b/patches/gcc-4.6.2/series
@@ -0,0 +1,19 @@
+# generated by git-ptx-patches
+#tag:base
+#tag:upstream --start-number 1
+0001-Volatile-bitfields-vs.-inline-asm-memory-constraints.patch
+#tag:OSELAS.toolchain --start-number 100
+0100-no-host-includes.patch
+0101-arm-softfloat.patch
+0102-fix-arith_adjacentmem-LDM-splitting-code.patch
+#tag:uclibc --start-number 200
+0200-also-match-uclibc-when-checking-host-os.patch
+0201-missing-execinfo.h.patch
+0202-c99-snprintf.patch
+0203-libmudflap-susv3-legacy.patch
+#tag:gentoo --start-number 300
+0300-gcc-trampolinewarn.patch
+0301-flatten-switch-stmt-into-if-else-chain-for-Os.patch
+0302-libiberty-pic.patch
+0303-libstdc-pic.patch
+# 19cc4f8bfbc9cbec87de32579a9f88fd - git-ptx-patches magic