summaryrefslogtreecommitdiff
path: root/patches/gcc/3.3.3
diff options
context:
space:
mode:
Diffstat (limited to 'patches/gcc/3.3.3')
-rw-r--r--patches/gcc/3.3.3/config.sub.patch72
-rw-r--r--patches/gcc/3.3.3/empty6.patch21
-rw-r--r--patches/gcc/3.3.3/gcc-3.3.2-arm-bigendian.patch65
-rw-r--r--patches/gcc/3.3.3/gcc-3.3.3-trap-posix.patch44
-rw-r--r--patches/gcc/3.3.3/pr10392-1-test.patch65
-rw-r--r--patches/gcc/3.3.3/pr10412-1-test.patch46
-rw-r--r--patches/gcc/3.3.3/pr10589-1-test.patch17
-rw-r--r--patches/gcc/3.3.3/pr11162-1-test.patch25
-rw-r--r--patches/gcc/3.3.3/pr11587-1-test.patch39
-rw-r--r--patches/gcc/3.3.3/pr11608.patch26
-rw-r--r--patches/gcc/3.3.3/pr11736-1-test.patch48
-rw-r--r--patches/gcc/3.3.3/pr11864-1-test.patch45
-rw-r--r--patches/gcc/3.3.3/pr12009.patch85
-rw-r--r--patches/gcc/3.3.3/pr12010.patch81
-rw-r--r--patches/gcc/3.3.3/pr13250-fix.patch19
-rw-r--r--patches/gcc/3.3.3/pr13260-fix-3.3.3.patch246
-rw-r--r--patches/gcc/3.3.3/pr13260-test.patch56
-rw-r--r--patches/gcc/3.3.3/pr15089-fix.patch25
-rw-r--r--patches/gcc/3.3.3/pr9365-1-test.patch43
-rw-r--r--patches/gcc/3.3.3/sh-lib1funcs_sizeAndType.patch610
-rw-r--r--patches/gcc/3.3.3/sh-pic-set_fpscr-gcc-3.3.2.patch67
-rw-r--r--patches/gcc/3.3.3/thunk3.patch23
22 files changed, 1768 insertions, 0 deletions
diff --git a/patches/gcc/3.3.3/config.sub.patch b/patches/gcc/3.3.3/config.sub.patch
new file mode 100644
index 0000000..928f911
--- /dev/null
+++ b/patches/gcc/3.3.3/config.sub.patch
@@ -0,0 +1,72 @@
+When configuring a s390->s390 or cris->cris crosscompiler
+(ok, I haven't hit this yet, but one of these days I'll get me an account
+on an s390, and then I'll need this patch :-), you'll get the
+following error:
+
++ /build/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/gcc-3.3/configure
+--target=s390-unknown-linux-gnu --host=s390-host_unknown-linux-gnu
+--prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2
+--enable-languages=c
+--with-local-prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/s390-
+unknown-linux-gnu --enable-threads=no --without-headers --with-newlib
+--disable-shared
+...
+*** --with-headers is only supported when cross compiling
+
+This error pops up only when you're using Daniel Jacobowitz's technique
+of slightly changing the target and host tuples to make them different
+enough to force gcc's build system to not try to pull in system libraries
+or headers. This technique is needed e.g. to build an x86 -> x86
+cross-compiler.
+(The LFS developers ran into the same bug that prompted me to use
+this technique; they point people who run into it to
+http://linuxfromscratch.org/~greg/pure_lfs.txt, which is a different
+way of avoiding this problem. I think the tuple tweak is the way to go, though.)
+
+config-patches@gnu.org rejected this patch, on the grounds that there
+is only one vendor of each of those two architectures, so the
+canonicalization is by definition correct. When I pointed out the
+difficulty this causes for people building s390 -> s390 or
+cris -> cris compilers that are incompatible with the system
+libraries and thus must be built like cross-compilers, he grumped and said
+"autoconf should let you specify a cross-compiler in some other way than
+comparing tuple strings".
+
+
+
+--- gcc-3.3/config.sub.old Sun Jun 8 20:38:47 2003
++++ gcc-3.3/config.sub Sun Jun 8 20:40:34 2003
+@@ -433,9 +433,12 @@
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+- cris | cris-* | etrax*)
++ cris | etrax*)
+ basic_machine=cris-axis
+ ;;
++ cris-*)
++ basic_machine=cris-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+@@ -820,11 +823,17 @@
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+- s390 | s390-*)
++ s390)
+ basic_machine=s390-ibm
+ ;;
+- s390x | s390x-*)
++ s390-*)
++ basic_machine=s390-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
++ s390x)
+ basic_machine=s390x-ibm
++ ;;
++ s390x-*)
++ basic_machine=s390x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
diff --git a/patches/gcc/3.3.3/empty6.patch b/patches/gcc/3.3.3/empty6.patch
new file mode 100644
index 0000000..1b0715c
--- /dev/null
+++ b/patches/gcc/3.3.3/empty6.patch
@@ -0,0 +1,21 @@
+From 3.4 branch. Fixes test failure
+FAIL: g++.dg/abi/empty6.C (test for warnings, line 6)
+
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/abi/empty6.C,v
+retrieving revision 1.1
+retrieving revision 1.2
+diff -u -r1.1 -r1.2
+--- gcc/gcc/testsuite/g++.dg/abi/empty6.C 2002/09/25 19:07:35 1.1
++++ gcc/gcc/testsuite/g++.dg/abi/empty6.C 2003/06/03 19:10:09 1.2
+@@ -5,4 +5,9 @@
+ struct B {
+ A a; // { dg-warning "empty" }
+ virtual void f () {}
+-};
++} __attribute__((aligned(8)));
++/* The preceding attribute is necessary on targets with
++ BIGGEST_ALIGNMENT <= 32 to trigger the warning, as otherwise a 32 bit
++ offset is split into DECL_FIELD_OFFSET 4 and DECL_FIELD_BIT_OFFSET 0,
++ and then there is no discrepancy between DECL_FIELD_OFFSET and
++ byte_position to warn about. */
diff --git a/patches/gcc/3.3.3/gcc-3.3.2-arm-bigendian.patch b/patches/gcc/3.3.3/gcc-3.3.2-arm-bigendian.patch
new file mode 100644
index 0000000..9ec6c53
--- /dev/null
+++ b/patches/gcc/3.3.3/gcc-3.3.2-arm-bigendian.patch
@@ -0,0 +1,65 @@
+By Lennert Buytenhek <buytenh@wantstofly.org>
+Adds support for arm*b-linux* big-endian ARM targets
+
+See http://gcc.gnu.org/PR16350
+
+diff -urN gcc-3.3.2.orig/gcc/config/arm/linux-elf.h gcc-3.3.2/gcc/config/arm/linux-elf.h
+--- gcc-3.3.2.orig/gcc/config/arm/linux-elf.h 2003-09-16 17:39:23.000000000 +0200
++++ gcc-3.3.2/gcc/config/arm/linux-elf.h 2004-07-07 14:03:54.329839922 +0200
+@@ -30,15 +30,29 @@
+ /* Do not assume anything about header files. */
+ #define NO_IMPLICIT_EXTERN_C
+
++/*
++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
++ * (big endian) configurations.
++ */
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
++#define TARGET_ENDIAN_OPTION "mbig-endian"
++#define TARGET_LINKER_EMULATION "armelfb_linux"
++#else
++#define TARGET_ENDIAN_DEFAULT 0
++#define TARGET_ENDIAN_OPTION "mlittle-endian"
++#define TARGET_LINKER_EMULATION "armelf_linux"
++#endif
++
+ /* Default is to use APCS-32 mode. */
+ #undef TARGET_DEFAULT
+-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
++#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | TARGET_ENDIAN_DEFAULT)
+
+-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
+
+ #undef MULTILIB_DEFAULTS
+ #define MULTILIB_DEFAULTS \
+- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
+
+ #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
+
+@@ -86,7 +100,7 @@
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
+ -X \
+- %{mbig-endian:-EB}" \
++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
+ SUBTARGET_EXTRA_LINK_SPEC
+
+ #define TARGET_OS_CPP_BUILTINS() \
+diff -urN gcc-3.3.2.orig/gcc/config.gcc gcc-3.3.2/gcc/config.gcc
+--- gcc-3.3.2.orig/gcc/config.gcc 2003-10-01 21:07:01.000000000 +0200
++++ gcc-3.3.2/gcc/config.gcc 2004-07-07 14:04:59.046716638 +0200
+@@ -699,6 +699,11 @@
+ ;;
+ arm*-*-linux*) # ARM GNU/Linux with ELF
+ tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h"
++ case $machine in
++ arm*b-*)
++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
++ ;;
++ esac
+ tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ gnu_ld=yes
diff --git a/patches/gcc/3.3.3/gcc-3.3.3-trap-posix.patch b/patches/gcc/3.3.3/gcc-3.3.3-trap-posix.patch
new file mode 100644
index 0000000..437c2a1
--- /dev/null
+++ b/patches/gcc/3.3.3/gcc-3.3.3-trap-posix.patch
@@ -0,0 +1,44 @@
+#
+# Submitted-By: Marc Kleine-Budde <mkl@pengutronix.de>, 2005-04-20
+#
+# Error:
+#
+# creating libintl.h
+# Configuring etc...
+# loading cache ../config.cache
+# checking for a BSD compatible install... (cached) /usr/bin/install -c
+# creating ./config.status
+# creating Makefile
+# trap: usage: trap [-lp] [[arg] signal_spec ...]
+#
+# Description:
+#
+# non-posix conform usage of trap causes bash >= 3.0 to fail
+# e.g.: http://sourceware.org/ml/crossgcc/2004-12/msg00132.html
+#
+# Status:
+#
+# fixed in gcc >= 3.3.5
+# backport of gcc-3.3.5 fix
+#
+diff -ruN gcc-3.3.3-orig/configure gcc-3.3.3/configure
+--- gcc-3.3.3-orig/configure 2002-09-29 18:11:24.000000000 +0200
++++ gcc-3.3.3/configure 2005-04-20 21:03:51.000000000 +0200
+@@ -697,7 +697,7 @@
+ if test -f skip-this-dir; then
+ # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
+ # and reset the trap handler.
+- trap 0
++ trap '' 0
+ rm -rf Makefile* ${tmpdir}
+ # Execute the final clean-up actions
+ ${config_shell} skip-this-dir
+@@ -1596,7 +1596,7 @@
+ # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
+ # and reset the trap handler.
+ rm -rf ${tmpdir}
+-trap 0
++trap '' 0
+
+ exit 0
+
diff --git a/patches/gcc/3.3.3/pr10392-1-test.patch b/patches/gcc/3.3.3/pr10392-1-test.patch
new file mode 100644
index 0000000..e94c8b9
--- /dev/null
+++ b/patches/gcc/3.3.3/pr10392-1-test.patch
@@ -0,0 +1,65 @@
+--- /dev/null Sat Dec 14 13:56:51 2002
++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10392-1.c Sun Sep 14 14:28:24 2003
+@@ -0,0 +1,62 @@
++/* PR optimization/10392
++ * Reporter: marcus@mc.pp.se
++ * Summary: [3.3/3.4 regression] [SH] optimizer generates faulty array indexing
++ * Description:
++ * The address calculation of an index operation on an array on the stack
++ * can _under some conditions_ get messed up completely
++ *
++ * Testcase tweaked by dank@kegel.com
++ * Problem only happens with -O2 -m4, so it should only happen on sh4,
++ * but what the heck, let's test other architectures, too.
++ * Not marked as xfail since it's a regression.
++*/
++/* { dg-do run } */
++/* { dg-options "-O2" } */
++/* { dg-options "-O2 -m4" { target sh4-*-* } } */
++const char *dont_optimize_function_away;
++
++const char *use(const char *str)
++{
++ dont_optimize_function_away = str;
++ if (str[0] != 'v')
++ abort();
++ if (str[1] < '1' || str[1] > '6')
++ abort();
++ if (str[2])
++ abort();
++ return str[2] ? "notused" : "v6";
++}
++
++const char *func(char *a, char *b)
++{
++ char buf[128];
++ unsigned char i;
++ const char *result;
++
++ char *item[] = {
++ "v1",
++ "v2",
++ };
++
++ buf[0] = 'v';
++ buf[1] = '3';
++ buf[2] = 0;
++
++ for (i = 0; i < 2; i++) {
++ /* bug is: following line passes wild pointer to use() on sh4 -O2 */
++ result = use(item[i]);
++
++ use(buf);
++ use(a);
++ use(b);
++ result = use(result);
++ }
++ return result;
++}
++
++int main()
++{
++ func("v4", "v5");
++ return 0;
++}
++
diff --git a/patches/gcc/3.3.3/pr10412-1-test.patch b/patches/gcc/3.3.3/pr10412-1-test.patch
new file mode 100644
index 0000000..6ca0525
--- /dev/null
+++ b/patches/gcc/3.3.3/pr10412-1-test.patch
@@ -0,0 +1,46 @@
+--- /dev/null Sat Dec 14 13:56:51 2002
++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10412-1.c Sun Sep 14 16:15:21 2003
+@@ -0,0 +1,43 @@
++/* PR target/10412
++ * Reporter: shrinivasa@kpitcummins.com
++ * Summary: Renesas SH - Incorrect code generation
++ * Description:
++ * When following code is compiled with
++ * sh-elf-gcc -S -mhitachi -m2 -O2 bug1.c
++ * generates an incorrect code.
++ *
++ * Testcase tweaked by dank@kegel.com
++ * Problem only happens with -mhitachi -m2. Not sure if I can give those
++ * options for all sh targets. They work on sh4, though.
++ * Not marked as xfail as it's a regression relative to hardhat 2.0 gcc-2.97.
++*/
++/* { dg-do run } */
++/* { dg-options "-O2" } */
++int global_val;
++
++int func0(int x)
++{
++ global_val += x;
++ return (x != 99);
++}
++
++int func1(unsigned long addr)
++{
++ int err;
++
++ err = func0(addr);
++ if (err)
++ return (err);
++
++ err = func0(addr * 7); /* address of func0 is lost during multiplication -> probable SIGSEGV */
++ return (err);
++}
++
++int main(int argc, char **argv)
++{
++ global_val = 0;
++ global_val += func1(99);
++ if (global_val != 99 * 8 + 1)
++ abort();
++ return 0;
++}
diff --git a/patches/gcc/3.3.3/pr10589-1-test.patch b/patches/gcc/3.3.3/pr10589-1-test.patch
new file mode 100644
index 0000000..04882e5
--- /dev/null
+++ b/patches/gcc/3.3.3/pr10589-1-test.patch
@@ -0,0 +1,17 @@
+--- /dev/null Sat Dec 14 13:56:51 2002
++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10589-1.c Mon Sep 15 08:57:58 2003
+@@ -0,0 +1,14 @@
++/* PR target/10589
++ * Reporter: mathieu@thenesis.com
++ * Summary: For Hitachi SH target, GCC crashes when both -fomit-frame-pointer and -mdalign options are specified
++ * Keywords: ice-on-valid-code
++ * Testcase by Kazu Hirata, tweaked by dank@kegel.com
++ * Did not fail in Hard Hat 2.0 gcc-2.97, nor in dodes gcc-3.0.2, so this is a regression, so I'm not marking it xfail
++ */
++/* { dg-do compile { target sh*-*-* } } */
++/* { dg-options "-fomit-frame-pointer -mdalign" } */
++
++int foo(int a, int b)
++{
++ return a / b;
++}
diff --git a/patches/gcc/3.3.3/pr11162-1-test.patch b/patches/gcc/3.3.3/pr11162-1-test.patch
new file mode 100644
index 0000000..9ab0d32
--- /dev/null
+++ b/patches/gcc/3.3.3/pr11162-1-test.patch
@@ -0,0 +1,25 @@
+--- /dev/null Sat Dec 14 13:56:51 2002
++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11162-1.c Sun Sep 14 16:24:41 2003
+@@ -0,0 +1,22 @@
++/*
++ * PR optimization/11162
++ * Reporter: Toshiyasu Morita <tm@kloo.net>
++ * Summary: [3.4 Regression] [-fnew-ra] ICE compiling channel.i on sh
++ * Keywords: ice-on-valid-code
++ * Description:
++ * [ICE] when channel.i from stress-1.17 is compiled with options:
++ * -O2 -m4 -fnew-ra
++ * ...
++ * The CFG code gets confused by the addition of a USE insn after a sibcall.
++ * Sibcalls are supposed to end the block (and the function!), so the fact
++ * that we have an instruction following one (even if its fake) is confusing.
++ *
++ * testcase tweaked by dank@kegel.com
++ */
++/* { dg-do compile } */
++/* { dg-options "-O2 -fnew-ra" } */
++
++int foo(char *p1)
++{
++ return bar(p1);
++}
diff --git a/patches/gcc/3.3.3/pr11587-1-test.patch b/patches/gcc/3.3.3/pr11587-1-test.patch
new file mode 100644
index 0000000..f6dedde
--- /dev/null
+++ b/patches/gcc/3.3.3/pr11587-1-test.patch
@@ -0,0 +1,39 @@
+--- /dev/null Sat Dec 14 13:56:51 2002
++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11587-1.c Mon Sep 15 08:46:00 2003
+@@ -0,0 +1,36 @@
++/* PR optimization/11587
++ * Reporter: Michael Eager <eager@mvista.com>
++ * Summary: [3.3/3.4 Regression] SH ICE in reload_cse_simplify_operand, postreload.c
++ * Keywords: ice-on-valid-code
++ *
++ * Note: a fix exists; see bugzilla
++ *
++ * Testcase tweaked by dank@kegel.com
++ * Not marked as xfail since it's a regression.
++ */
++
++/* { dg-do compile } */
++/* { dg-options "-O1" } */
++int foo1(void);
++int foo2();
++int foo3();
++
++static int goo()
++{
++ int i;
++
++ if (i <= 0)
++ return i;
++
++ if (foo1() > 1) {
++ i = foo2();
++ if (i < 0)
++ return i;
++ if (i) {
++ if (foo3())
++ return 1;
++ return 0;
++ }
++ }
++
++}
diff --git a/patches/gcc/3.3.3/pr11608.patch b/patches/gcc/3.3.3/pr11608.patch
new file mode 100644
index 0000000..b45959c
--- /dev/null
+++ b/patches/gcc/3.3.3/pr11608.patch
@@ -0,0 +1,26 @@
+# See http://gcc.gnu.org/PR11608
+# Fixes following error when testing sh4 toolchain:
+#
+# Testing debug/20020327-1.c, -gstabs1
+# ...
+# FAIL: gcc.dg/debug/20020327-1.c (test for excess errors)
+# Excess errors:
+# /tmp/cc8dFF7Y.s: Assembler messages:
+# /tmp/cc8dFF7Y.s:66: Error: symbol `Letext' is already defined
+
+Index: elf.h
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/config/sh/elf.h,v
+retrieving revision 1.32
+diff -u -p -r1.32 elf.h
+--- gcc/gcc/config/sh/elf.h.old 27 Sep 2003 04:48:28 -0000 1.32
++++ gcc/gcc/config/sh/elf.h 2 Jan 2004 07:23:23 -0000
+@@ -95,7 +95,7 @@ while (0)
+ #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
+ do { \
+ text_section (); \
+- fprintf ((FILE), "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \
++ asm_fprintf ((FILE), "\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", N_SO); \
+ } while (0)
+
+ #undef STARTFILE_SPEC
diff --git a/patches/gcc/3.3.3/pr11736-1-test.patch b/patches/gcc/3.3.3/pr11736-1-test.patch
new file mode 100644
index 0000000..ea544b1
--- /dev/null
+++ b/patches/gcc/3.3.3/pr11736-1-test.patch
@@ -0,0 +1,48 @@
+--- /dev/null Sat Dec 14 13:56:51 2002
++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11736-1.c Sun Sep 14 14:26:33 2003
+@@ -0,0 +1,45 @@
++/* PR optimization/11736
++ * Reporter: marcus@mc.pp.se
++ * Summary: Stackpointer messed up on SuperH
++ * Keywords: wrong-code
++ * Description:
++ * When a function with 5 arguments is called in both branches of a
++ * conditional, and only the last argument differs, the code to push that
++ * last argument on the stack gets confused.
++ * Space for the fifth argument is reserved on the stack by the
++ * instruction I have marked as "A". However, if the else-branch is
++ * taken the stackpointer is decremented _again_ at "B". This
++ * decrementation is never restored, and it is only due to the
++ * restoration of r15 from r14 that the function works at all. With
++ * -fomit-frame-pointer it will crash.
++ *
++ * Testcase tweaked by dank@kegel.com
++ * Not marked as xfail since it's a regression from hardhat 2.0 gcc-2.97
++ * and dodes gcc-3.0.2
++ */
++
++/* { dg-do run } */
++/* { dg-options "-O1 -fomit-frame-pointer" } */
++
++int expected_e;
++
++void bar(int a, int b, int c, int d, int e)
++{
++ if (e != expected_e)
++ abort();
++}
++
++void foo(int a)
++{
++ if (a)
++ bar(0, 0, 0, 0, 1);
++ else
++ bar(0, 0, 0, 0, 0); /* stack pointer decremented extra time here, causing segfault */
++}
++
++int main(int argc, char **argv)
++{
++ for (expected_e = 0; expected_e < 2; expected_e++)
++ foo(expected_e);
++ return 0;
++}
diff --git a/patches/gcc/3.3.3/pr11864-1-test.patch b/patches/gcc/3.3.3/pr11864-1-test.patch
new file mode 100644
index 0000000..f5b0d17
--- /dev/null
+++ b/patches/gcc/3.3.3/pr11864-1-test.patch
@@ -0,0 +1,45 @@
+--- /dev/null Sat Dec 14 13:56:51 2002
++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11864-1.c Sun Sep 14 14:32:24 2003
+@@ -0,0 +1,42 @@
++/* PR optimization/11864
++ * Reporter: Kazumoto Kojima <kkojima@gcc.gnu.org>
++ * Summary: [3.3/3.4 regression] miscompiles zero extension and test
++ * Description:
++ * gcc-3.3/3.4 -O2 for sh target may miscompile the combination of zero extension
++ * and test if it's zero.
++ *
++ * Testcase tweaked by dank@kegel.com. Not marked as xfail because it's a regression.
++ */
++/* { dg-do run } */
++/* { dg-options "-O2" } */
++
++extern void abort(void);
++
++int val = 0xff00;
++
++int f(void)
++{
++ return val;
++}
++
++unsigned char a[1];
++
++void foo(void)
++{
++ a[0] = f() & 255;
++
++ if (!a[0])
++ a[0] = f() & 255;
++
++ if (!a[0])
++ a[0] = 1 + (f() & 127);
++}
++
++int main(int argc, char **argv)
++{
++ foo();
++ if (!a[0])
++ abort();
++
++ return 0;
++}
diff --git a/patches/gcc/3.3.3/pr12009.patch b/patches/gcc/3.3.3/pr12009.patch
new file mode 100644
index 0000000..cb294d5
--- /dev/null
+++ b/patches/gcc/3.3.3/pr12009.patch
@@ -0,0 +1,85 @@
+See http://gcc.gnu.org/PR12009
+
+Fixes the following problems when testing a cross-compiler:
+
+============================================
+Testing g++.dg/compat/abi/bitfield1,
+...
+Invoking the compiler as /crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-gli
+bc-2.2.5/build-gcc/gcc/testsuite/../g++ ...
+/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/gcc/test
+suite/g++.dg/compat/abi/bitfield1_main.C
+pid is 16028 -16028
+compiler exited with status 1
+output is:
+sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-750-linux-gnu/gc
+c-3.3-glibc-2.2.5/powerpc-750-linux-gnu/./lib/libdl.so.2: ELF file data encoding
+ not little-endian
+/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/build-gcc/gcc/te
+stsuite/../g++: error while loading shared libraries: /opt/cegl-2.0/powerpc-750-
+linux-gnu/gcc-3.3-glibc-2.2.5/powerpc-750-linux-gnu/./lib/libc.so.6: ELF file da
+ta encoding not little-endian
+
+FAIL: g++.dg/compat/abi/bitfield1 main_tst.o compile
+============================================
+
+and
+
+sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-405-linux-gnu/gcc-3.2.3-glibc-2.2.5/powerpc-405-linux-gnu/./lib/libdl.so.2: ELF file data encoding not little-endian
+
+
+
+--- gcc-3.3/gcc/testsuite/g++.dg/compat/compat.exp.old Thu Oct 17 17:22:57 2002
++++ gcc-3.3/gcc/testsuite/g++.dg/compat/compat.exp Mon Jul 14 10:59:19 2003
+@@ -42,11 +42,13 @@
+ proc compat-fix-library-path { } {
+ global ld_library_path
+
+- # See comments in lib/g++.exp for why this is needed.
+- setenv LD_LIBRARY_PATH $ld_library_path
+- setenv SHLIB_PATH $ld_library_path
+- setenv LD_LIBRARYN32_PATH $ld_library_path
+- setenv LD_LIBRARY64_PATH $ld_library_path
++ if {![is_remote target]} {
++ # See comments in lib/g++.exp for why this is needed.
++ setenv LD_LIBRARY_PATH $ld_library_path
++ setenv SHLIB_PATH $ld_library_path
++ setenv LD_LIBRARYN32_PATH $ld_library_path
++ setenv LD_LIBRARY64_PATH $ld_library_path
++ }
+ }
+
+ #
+--- gcc-3.4-20030813/gcc/testsuite/lib/g++.exp.orig Tue Jun 17 18:56:45 2003
++++ gcc-3.4-20030813/gcc/testsuite/lib/g++.exp Sun Aug 17 18:35:38 2003
+@@ -166,16 +182,20 @@
+ }
+ }
+
+- # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
+- # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
+- # (for the 64-bit ABI). The right way to do this would be to modify
+- # unix.exp -- but that's not an option since it's part of DejaGNU
+- # proper, so we do it here. We really only need to do
+- # this on IRIX, but it shouldn't hurt to do it anywhere else.
+- setenv LD_LIBRARY_PATH $ld_library_path
+- setenv SHLIB_PATH $ld_library_path
+- setenv LD_LIBRARYN32_PATH $ld_library_path
+- setenv LD_LIBRARY64_PATH $ld_library_path
++ if {![is_remote target]} {
++ # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
++ # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
++ # (for the 64-bit ABI). The right way to do this would be to modify
++ # unix.exp -- but that's not an option since it's part of DejaGNU
++ # proper, so we do it here. We really only need to do
++ # this on IRIX, but it shouldn't hurt to do it anywhere else.
++
++ # Doing this causes us to be unable to run cross-compilers.
++ setenv LD_LIBRARY_PATH $ld_library_path
++ setenv SHLIB_PATH $ld_library_path
++ setenv LD_LIBRARYN32_PATH $ld_library_path
++ setenv LD_LIBRARY64_PATH $ld_library_path
++ }
+
+ return "$flags"
+ }
diff --git a/patches/gcc/3.3.3/pr12010.patch b/patches/gcc/3.3.3/pr12010.patch
new file mode 100644
index 0000000..bb7f171
--- /dev/null
+++ b/patches/gcc/3.3.3/pr12010.patch
@@ -0,0 +1,81 @@
+Adjusted for gcc-3.3-20040119
+
+See http://gcc.gnu.org/PR12010
+
+Without this patch, one gets both compile and link time errors in
+'make check' when configured for cross-compiling.
+
+In particular, 'make check' on a cross-compiler fails with
+
+/testsuite_flags: /testsuite_flags: No such file or directory
+ while executing
+"exec sh ${odir_v3}/testsuite_flags --build-includes"
+ (procedure "g++_include_flags" line 21)
+ invoked from within
+"g++_include_flags [get_multilibs] "
+ (procedure "g++_init" line 63)
+ invoked from within
+"${tool}_init $test_file_name"
+ (procedure "runtest" line 19)
+...
+make[1]: [check-g++] Error 1 (ignored)
+
+--- gcc-3.3-20040119/gcc/testsuite/lib/g++.exp.orig 2004-01-25 17:56:24.000000000 -0800
++++ gcc-3.3-20040119/gcc/testsuite/lib/g++.exp 2004-01-25 18:29:44.000000000 -0800
+@@ -72,6 +72,8 @@ proc g++_version { } {
+ #
+ proc g++_include_flags { paths } {
+ global srcdir
++ global objdir
++ global target_triplet
+ global HAVE_LIBSTDCXX_V3
+ global TESTING_IN_BUILD_TREE
+
+@@ -90,6 +92,20 @@ proc g++_include_flags { paths } {
+
+ if { ${HAVE_LIBSTDCXX_V3} } {
+ set odir_v3 [lookfor_file ${gccpath} libstdc++-v3]
++ if { $odir_v3 == "" } {
++ verbose "g++_include_flags: couldn't find libstdc++-v3 on first try, now looking in build directory $objdir"
++ # first assume no multilibs
++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"]
++ }
++ if { $odir_v3 == "" } {
++ verbose "g++_include_flags: couldn't find libstdc++-v3 on second try, trying multilib"
++ # assume multilib only one level deep
++ set multisub [file tail $gccpath]
++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"]
++ }
++ if { $odir_v3 == "" } {
++ error "Can't find libstdc++-v3"
++ }
+ append flags [exec sh ${odir_v3}/testsuite_flags --build-includes]
+ } else {
+ set odir_v2 [lookfor_file ${gccpath} libstdc++]
+
+--- gcc-3.3-20040119/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp.old Sun Jul 13 10:42:01 2003
++++ gcc-3.3-20040119/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp Sun Jul 13 11:39:54 2003
+@@ -48,8 +48,23 @@
+ global ld_library_path
+ global original_ld_library_path
+ global tool_root_dir
++ global target_triplet
+
+ set blddir [lookfor_file [get_multilibs] libstdc++-v3]
++ if { $blddir == "" } {
++ set multilibs [get_multilibs]
++ # FIXME: assume multilib only one level deep
++ set multisub [file tail $multilibs]
++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3 in $multilibs, trying $objdir"
++ set blddir [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"]
++ }
++ if { $blddir == "" } {
++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3, trying $objdir without multilibs"
++ set blddir [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"]
++ }
++ if { $blddir == "" } {
++ error "Can't find libstdc++-v3"
++ }
+
+ # By default, we assume we want to run program images.
+ global dg-do-what-default
diff --git a/patches/gcc/3.3.3/pr13250-fix.patch b/patches/gcc/3.3.3/pr13250-fix.patch
new file mode 100644
index 0000000..ce68bb1
--- /dev/null
+++ b/patches/gcc/3.3.3/pr13250-fix.patch
@@ -0,0 +1,19 @@
+See http://gcc.gnu.org/PR13250
+Fixes bad code generated when compiling SHA256 for SH processor
+
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v
+retrieving revision 1.171
+retrieving revision 1.172
+diff -u -r1.171 -r1.172
+--- gcc/gcc/config/sh/sh.md 2004/05/10 23:25:13 1.171
++++ gcc/gcc/config/sh/sh.md 2004/05/28 05:47:36 1.172
+@@ -2194,7 +2194,7 @@
+ parts[0] = gen_reg_rtx (SImode);
+ parts[1] = gen_reg_rtx (SImode);
+ emit_insn (gen_rotlsi3_16 (parts[2-choice], operands[1]));
+- parts[choice-1] = operands[1];
++ emit_move_insn (parts[choice-1], operands[1]);
+ emit_insn (gen_ashlsi3 (parts[0], parts[0], GEN_INT (8)));
+ emit_insn (gen_lshrsi3 (parts[1], parts[1], GEN_INT (8)));
+ emit_insn (gen_iorsi3 (operands[0], parts[0], parts[1]));
diff --git a/patches/gcc/3.3.3/pr13260-fix-3.3.3.patch b/patches/gcc/3.3.3/pr13260-fix-3.3.3.patch
new file mode 100644
index 0000000..7587ad8
--- /dev/null
+++ b/patches/gcc/3.3.3/pr13260-fix-3.3.3.patch
@@ -0,0 +1,246 @@
+Date: Fri, 06 Feb 2004 12:35:58 +0900
+From: SUGIOKA Toshinobu <sugioka@itonet.co.jp>
+Subject: [linux-sh:03150] Re: gcc 3.3 optimisation problem
+To: linux-sh@m17n.org
+Message-Id: <4.2.0.58.J.20040206122503.04fe3058@router.itonet.co.jp>
+List-Help: <mailto:linux-sh-ctl@m17n.org?body=help>
+List-Id: linux-sh.m17n.org
+
+At 19:40 03/12/01 +0000, Stuart Menefy <stuart.menefy@st.com> wrote:
+>On Sat, 29 Nov 2003 20:19:08 +0900 kkojima@rr.iij4u.or.jp wrote:
+>
+>> Dan Kegel <dank@kegel.com> wrote:
+>> > Stuart Menefy wrote:
+>> >> I've just been trying to put together a gcc 3.3.2 based toolchain, and
+>> >> appear to be hitting a gcc optimisation bug. I was just wondering if
+>> >> anyone else had seen anything similar.
+>> >>
+>> >> The problem is seen when building the kernel, in the function
+>> >> root_nfs_parse_addr(). I've extracted this into a small stand alone
+>> >> program which demonstrates the problem.
+>> >
+>> > Excellent work. I haven't seen anything like this (doesn't mean much)
+>> > and the sh-specific optimization bugs in the gcc bug database don't look
+>> > similar. I think you should submit this as a bug report at
+>> > http://gcc.gnu.org/bugzilla/
+>> > It would be good if you could make your test case call abort() if
+>> > the problem is present, so the test case can be automated.
+>>
+>> Indeed. It'd be very nice to create a gcc PR for this issue.
+>
+>OK, I've done that. PR 13260.
+
+PR 13260 was fixed by amylaar@gcc.gnu.org at 2003-12-04 20:10:29 on mainline(gcc-3.4).
+I have back-ported that patch to gcc-3.3.3 and seems fine for me.
+
+ * sh-protos.h (sh_expand_t_scc): Declare.
+ * sh.h (PREDICATE_CODES): Add cmpsi_operand.
+ * sh.c (cmpsi_operand, sh_expand_t_scc): New functions.
+ * sh.md (cmpsi): Use cmpsi_operand. If T_REG is compared to
+ something that is not a CONST_INT, copy it into a pseudo register.
+ (subc): Fix description of new T value.
+ (slt, sgt, sge, sgtu): Don't clobber T after rtl generation is over.
+ (sltu, sleu, sgeu): Likewise.
+ (seq, sne): Likewise. Use sh_expand_t_scc.
+
+diff -ru gcc-3.3-20040126-1/gcc/config/sh/sh-protos.h gcc-3.3-20040126/gcc/config/sh/sh-protos.h
+--- gcc-3.3-20040126-1/gcc/config/sh/sh-protos.h Tue Jan 13 02:03:24 2004
++++ gcc-3.3-20040126/gcc/config/sh/sh-protos.h Fri Jan 30 17:54:04 2004
+@@ -102,6 +102,7 @@
+ extern int sh_can_redirect_branch PARAMS ((rtx, rtx));
+ extern void sh_expand_unop_v2sf PARAMS ((enum rtx_code, rtx, rtx));
+ extern void sh_expand_binop_v2sf PARAMS ((enum rtx_code, rtx, rtx, rtx));
++extern int sh_expand_t_scc (enum rtx_code code, rtx target);
+ #ifdef TREE_CODE
+ extern void sh_va_start PARAMS ((tree, rtx));
+ extern rtx sh_va_arg PARAMS ((tree, tree));
+diff -ru gcc-3.3-20040126-1/gcc/config/sh/sh.c gcc-3.3-20040126/gcc/config/sh/sh.c
+--- gcc-3.3-20040126-1/gcc/config/sh/sh.c Thu Jan 15 03:11:36 2004
++++ gcc-3.3-20040126/gcc/config/sh/sh.c Fri Jan 30 17:53:58 2004
+@@ -7870,6 +7870,15 @@
+ return register_operand (op, mode);
+ }
+
++int
++cmpsi_operand (rtx op, enum machine_mode mode)
++{
++ if (GET_CODE (op) == REG && REGNO (op) == T_REG
++ && GET_MODE (op) == SImode)
++ return 1;
++ return arith_operand (op, mode);
++}
++
+ /* INSN is an sfunc; return the rtx that describes the address used. */
+ static rtx
+ extract_sfunc_addr (rtx insn)
+@@ -7917,4 +7926,33 @@
+ abort ();
+ }
+
++int
++sh_expand_t_scc (enum rtx_code code, rtx target)
++{
++ rtx result = target;
++ HOST_WIDE_INT val;
++
++ if (GET_CODE (sh_compare_op0) != REG || REGNO (sh_compare_op0) != T_REG
++ || GET_CODE (sh_compare_op1) != CONST_INT)
++ return 0;
++ if (GET_CODE (result) != REG)
++ result = gen_reg_rtx (SImode);
++ val = INTVAL (sh_compare_op1);
++ if ((code == EQ && val == 1) || (code == NE && val == 0))
++ emit_insn (gen_movt (result));
++ else if ((code == EQ && val == 0) || (code == NE && val == 1))
++ {
++ emit_insn (gen_rtx_CLOBBER (VOIDmode, result));
++ emit_insn (gen_subc (result, result, result));
++ emit_insn (gen_addsi3 (result, result, GEN_INT (1)));
++ }
++ else if (code == EQ || code == NE)
++ emit_insn (gen_move_insn (result, GEN_INT (code == NE)));
++ else
++ return 0;
++ if (result != target)
++ emit_move_insn (target, result);
++ return 1;
++}
++
+ #include "gt-sh.h"
+diff -ru gcc-3.3-20040126-1/gcc/config/sh/sh.h gcc-3.3-20040126/gcc/config/sh/sh.h
+--- gcc-3.3-20040126-1/gcc/config/sh/sh.h Wed Apr 16 02:06:09 2003
++++ gcc-3.3-20040126/gcc/config/sh/sh.h Fri Jan 30 17:53:51 2004
+@@ -3231,6 +3231,7 @@
+ {"arith_reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_VECTOR}}, \
+ {"binary_float_operator", {PLUS, MINUS, MULT, DIV}}, \
+ {"binary_logical_operator", {AND, IOR, XOR}}, \
++ {"cmpsi_operand", {SUBREG, REG, CONST_INT}}, \
+ {"commutative_float_operator", {PLUS, MULT}}, \
+ {"equality_comparison_operator", {EQ,NE}}, \
+ {"extend_reg_operand", {SUBREG, REG, TRUNCATE}}, \
+diff -ru gcc-3.3-20040126-1/gcc/config/sh/sh.md gcc-3.3-20040126/gcc/config/sh/sh.md
+--- gcc-3.3-20040126-1/gcc/config/sh/sh.md Tue Jan 13 02:03:25 2004
++++ gcc-3.3-20040126/gcc/config/sh/sh.md Fri Jan 30 17:54:20 2004
+@@ -685,11 +685,14 @@
+
+ (define_expand "cmpsi"
+ [(set (reg:SI T_REG)
+- (compare (match_operand:SI 0 "arith_operand" "")
++ (compare (match_operand:SI 0 "cmpsi_operand" "")
+ (match_operand:SI 1 "arith_operand" "")))]
+ "TARGET_SH1"
+ "
+ {
++ if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == T_REG
++ && GET_CODE (operands[1]) != CONST_INT)
++ operands[0] = copy_to_mode_reg (SImode, operands[0]);
+ sh_compare_op0 = operands[0];
+ sh_compare_op1 = operands[1];
+ DONE;
+@@ -1147,7 +1150,9 @@
+ (match_operand:SI 2 "arith_reg_operand" "r"))
+ (reg:SI T_REG)))
+ (set (reg:SI T_REG)
+- (gtu:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 1)))]
++ (gtu:SI (minus:SI (minus:SI (match_dup 1) (match_dup 2))
++ (reg:SI T_REG))
++ (match_dup 1)))]
+ "TARGET_SH1"
+ "subc %2,%0"
+ [(set_attr "type" "arith")])
+@@ -7223,6 +7228,10 @@
+ }
+ DONE;
+ }
++ if (sh_expand_t_scc (EQ, operands[0]))
++ DONE;
++ if (! rtx_equal_function_value_matters)
++ FAIL;
+ operands[1] = prepare_scc_operands (EQ);
+ }")
+
+@@ -7269,6 +7278,8 @@
+ }
+ DONE;
+ }
++ if (! rtx_equal_function_value_matters)
++ FAIL;
+ operands[1] = prepare_scc_operands (LT);
+ }")
+
+@@ -7371,6 +7382,8 @@
+ }
+ DONE;
+ }
++ if (! rtx_equal_function_value_matters)
++ FAIL;
+ operands[1] = prepare_scc_operands (GT);
+ }")
+
+@@ -7423,6 +7436,8 @@
+ DONE;
+ }
+
++ if (! rtx_equal_function_value_matters)
++ FAIL;
+ if (GET_MODE_CLASS (GET_MODE (sh_compare_op0)) == MODE_FLOAT)
+ {
+ if (TARGET_IEEE)
+@@ -7462,6 +7477,8 @@
+ sh_compare_op0, sh_compare_op1));
+ DONE;
+ }
++ if (! rtx_equal_function_value_matters)
++ FAIL;
+ operands[1] = prepare_scc_operands (GTU);
+ }")
+
+@@ -7486,6 +7503,8 @@
+ sh_compare_op1, sh_compare_op0));
+ DONE;
+ }
++ if (! rtx_equal_function_value_matters)
++ FAIL;
+ operands[1] = prepare_scc_operands (LTU);
+ }")
+
+@@ -7515,6 +7534,8 @@
+
+ DONE;
+ }
++ if (! rtx_equal_function_value_matters)
++ FAIL;
+ operands[1] = prepare_scc_operands (LEU);
+ }")
+
+@@ -7545,6 +7566,8 @@
+ DONE;
+ }
+
++ if (! rtx_equal_function_value_matters)
++ FAIL;
+ operands[1] = prepare_scc_operands (GEU);
+ }")
+
+@@ -7592,8 +7615,12 @@
+ DONE;
+ }
+
+- operands[1] = prepare_scc_operands (EQ);
+- operands[2] = gen_reg_rtx (SImode);
++ if (sh_expand_t_scc (NE, operands[0]))
++ DONE;
++ if (! rtx_equal_function_value_matters)
++ FAIL;
++ operands[1] = prepare_scc_operands (EQ);
++ operands[2] = gen_reg_rtx (SImode);
+ }")
+
+ (define_expand "sunordered"
+
+----
+SUGIOKA Toshinobu
+
+
+
+
diff --git a/patches/gcc/3.3.3/pr13260-test.patch b/patches/gcc/3.3.3/pr13260-test.patch
new file mode 100644
index 0000000..d9cc3e4
--- /dev/null
+++ b/patches/gcc/3.3.3/pr13260-test.patch
@@ -0,0 +1,56 @@
+See http://gcc.gnu.org/PR13260
+
+/cvs/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/20031204-1.c,v --> standard output
+revision 1.1
+--- - 1970-01-01 00:00:00.000000000 +0000
++++ gcc/gcc/testsuite/gcc.c-torture/execute/20031204-1.c
+@@ -0,0 +1,49 @@
++/* PR optimization/13260 */
++
++#include <string.h>
++
++typedef unsigned long u32;
++
++u32 in_aton(const char* x)
++{
++ return 0x0a0b0c0d;
++}
++
++u32 root_nfs_parse_addr(char *name)
++{
++ u32 addr;
++ int octets = 0;
++ char *cp, *cq;
++
++ cp = cq = name;
++ while (octets < 4) {
++ while (*cp >= '0' && *cp <= '9')
++ cp++;
++ if (cp == cq || cp - cq > 3)
++ break;
++ if (*cp == '.' || octets == 3)
++ octets++;
++ if (octets < 4)
++ cp++;
++ cq = cp;
++ }
++
++ if (octets == 4 && (*cp == ':' || *cp == '\0')) {
++ if (*cp == ':')
++ *cp++ = '\0';
++ addr = in_aton(name);
++ strcpy(name, cp);
++ } else
++ addr = (-1);
++
++ return addr;
++}
++
++int
++main()
++{
++ static char addr[] = "10.11.12.13:/hello";
++ u32 result = root_nfs_parse_addr(addr);
++ if (result != 0x0a0b0c0d) { abort(); }
++ return 0;
++}
diff --git a/patches/gcc/3.3.3/pr15089-fix.patch b/patches/gcc/3.3.3/pr15089-fix.patch
new file mode 100644
index 0000000..ceaf957
--- /dev/null
+++ b/patches/gcc/3.3.3/pr15089-fix.patch
@@ -0,0 +1,25 @@
+See http://gcc.gnu.org/PR15089
+"In some cases the specified register for a local variable meant to be
+used with inline assembly code is not respected. This breaks code
+relying on this feature to implement non-standard calling convension."
+
+This fix is probably needed to properly implement linux syscalls in some architectures.
+
+First added to crosstool by Jamie Hicks, see
+http://www.handhelds.org/hypermail/kernel-discuss/current/0066.html
+
+Index: gcc/loop.c
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/loop.c,v
+retrieving revision 1.488.2.3
+diff -u -r1.488.2.3 loop.c
+--- gcc-old/gcc/loop.c 14 Feb 2004 14:46:03 -0000 1.488.2.3
++++ gcc-new/gcc/loop.c 28 Apr 2004 22:02:53 -0000
+@@ -929,6 +929,7 @@
+ || (! (GET_CODE (SET_SRC (set)) == REG
+ && (REGNO (SET_SRC (set))
+ < FIRST_PSEUDO_REGISTER))))
++ && regno >= FIRST_PSEUDO_REGISTER
+ /* This test is not redundant; SET_SRC (set) might be
+ a call-clobbered register and the life of REGNO
+ might span a call. */
diff --git a/patches/gcc/3.3.3/pr9365-1-test.patch b/patches/gcc/3.3.3/pr9365-1-test.patch
new file mode 100644
index 0000000..ee7dfa7
--- /dev/null
+++ b/patches/gcc/3.3.3/pr9365-1-test.patch
@@ -0,0 +1,43 @@
+--- /dev/null Sat Dec 14 13:56:51 2002
++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr9365-1.c Sun Sep 14 09:34:37 2003
+@@ -0,0 +1,40 @@
++/* PR target/9365
++ * Origin: marcus@mc.pp.se
++ * Testcase tweaked by dank@kegel.com
++ * [3.3 regression] [SH] segfault in gen_far_branch (config/sh/sh.c)
++ * ice-on-valid-code
++ * Not marked as xfail since it's a regression
++*/
++/* { dg-do compile } */
++/* { dg-options "-O2 -fomit-frame-pointer" } */
++
++
++void foo(int n, int *p)
++{
++ switch(n) {
++ case 100: case 110: case 120: case 130: case 140:
++ case 200: case 210: case 220: case 230: case 240:
++ case 300: case 310: case 320: case 330: case 340:
++ case 400: case 410: case 420: case 430: case 440:
++ case 500: case 510: case 520: case 530: case 540:
++ case 600: case 610: case 620: case 630: case 640:
++ case 700: case 710: case 720: case 730: case 740:
++ case 800: case 810: case 820: case 830: case 840:
++ case 900: case 910: case 920: case 930: case 940:
++ break;
++ default:
++ *p = n;
++ break;
++ }
++}
++
++int main(int argc, char **argv)
++{
++ int p;
++
++ (void) argv;
++
++ foo(argc, &p);
++
++ return p;
++}
diff --git a/patches/gcc/3.3.3/sh-lib1funcs_sizeAndType.patch b/patches/gcc/3.3.3/sh-lib1funcs_sizeAndType.patch
new file mode 100644
index 0000000..64d4fc4
--- /dev/null
+++ b/patches/gcc/3.3.3/sh-lib1funcs_sizeAndType.patch
@@ -0,0 +1,610 @@
+Fixes the problem
+ [ libdemo.so and main.o both use assignment on structures ]
+ $ sh4-unknown-linux-gnu-gcc libdemo.so main.o
+ sh4-unknown-linux-gnu/bin/ld: warning: type and size of dynamic symbol `__movstr_i4_even' are not defined
+ [ resulting app links, but crashes at runtime ]
+See testcase at http://tsukuba.m17n.org/linux-sh/ml/linux-sh/2003-11/msg00016.html
+
+Patch was posted as http://gcc.gnu.org/ml/gcc-patches/2002-11/msg01641.html
+and is in cvs as http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/lib1funcs.asm.diff?r1=1.29.4.1&r2=1.29.4.2
+
+but see also sh-libgcc-hidden.patch (part of gcc-3.3.3 as of 20040119 or so)
+
+===================================================================
+
+--- gcc/gcc/config/sh/lib1funcs.asm 2002/09/20 01:29:21 1.29.4.1
++++ gcc/gcc/config/sh/lib1funcs.asm 2003/11/18 12:27:31
+@@ -38,9 +38,14 @@
+ amylaar@cygnus.com */
+
+ #ifdef __ELF__
+-#define LOCAL(X) .L_##X
+-#else
+-#define LOCAL(X) L_##X
++#define LOCAL(X) .L_##X
++#define FUNC(X) .type X,@function
++#define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X
++#define ENDFUNC(X) ENDFUNC0(X)
++#else
++#define LOCAL(X) L_##X
++#define FUNC(X)
++#define ENDFUNC(X)
+ #endif
+
+ #define CONCAT(A,B) A##B
+@@ -87,6 +92,40 @@
+ .global GLOBAL(ashiftrt_r4_31)
+ .global GLOBAL(ashiftrt_r4_32)
+
++ FUNC(GLOBAL(ashiftrt_r4_0))
++ FUNC(GLOBAL(ashiftrt_r4_1))
++ FUNC(GLOBAL(ashiftrt_r4_2))
++ FUNC(GLOBAL(ashiftrt_r4_3))
++ FUNC(GLOBAL(ashiftrt_r4_4))
++ FUNC(GLOBAL(ashiftrt_r4_5))
++ FUNC(GLOBAL(ashiftrt_r4_6))
++ FUNC(GLOBAL(ashiftrt_r4_7))
++ FUNC(GLOBAL(ashiftrt_r4_8))
++ FUNC(GLOBAL(ashiftrt_r4_9))
++ FUNC(GLOBAL(ashiftrt_r4_10))
++ FUNC(GLOBAL(ashiftrt_r4_11))
++ FUNC(GLOBAL(ashiftrt_r4_12))
++ FUNC(GLOBAL(ashiftrt_r4_13))
++ FUNC(GLOBAL(ashiftrt_r4_14))
++ FUNC(GLOBAL(ashiftrt_r4_15))
++ FUNC(GLOBAL(ashiftrt_r4_16))
++ FUNC(GLOBAL(ashiftrt_r4_17))
++ FUNC(GLOBAL(ashiftrt_r4_18))
++ FUNC(GLOBAL(ashiftrt_r4_19))
++ FUNC(GLOBAL(ashiftrt_r4_20))
++ FUNC(GLOBAL(ashiftrt_r4_21))
++ FUNC(GLOBAL(ashiftrt_r4_22))
++ FUNC(GLOBAL(ashiftrt_r4_23))
++ FUNC(GLOBAL(ashiftrt_r4_24))
++ FUNC(GLOBAL(ashiftrt_r4_25))
++ FUNC(GLOBAL(ashiftrt_r4_26))
++ FUNC(GLOBAL(ashiftrt_r4_27))
++ FUNC(GLOBAL(ashiftrt_r4_28))
++ FUNC(GLOBAL(ashiftrt_r4_29))
++ FUNC(GLOBAL(ashiftrt_r4_30))
++ FUNC(GLOBAL(ashiftrt_r4_31))
++ FUNC(GLOBAL(ashiftrt_r4_32))
++
+ .align 1
+ GLOBAL(ashiftrt_r4_32):
+ GLOBAL(ashiftrt_r4_31):
+@@ -166,6 +205,40 @@
+ GLOBAL(ashiftrt_r4_0):
+ rts
+ nop
++
++ ENDFUNC(GLOBAL(ashiftrt_r4_0))
++ ENDFUNC(GLOBAL(ashiftrt_r4_1))
++ ENDFUNC(GLOBAL(ashiftrt_r4_2))
++ ENDFUNC(GLOBAL(ashiftrt_r4_3))
++ ENDFUNC(GLOBAL(ashiftrt_r4_4))
++ ENDFUNC(GLOBAL(ashiftrt_r4_5))
++ ENDFUNC(GLOBAL(ashiftrt_r4_6))
++ ENDFUNC(GLOBAL(ashiftrt_r4_7))
++ ENDFUNC(GLOBAL(ashiftrt_r4_8))
++ ENDFUNC(GLOBAL(ashiftrt_r4_9))
++ ENDFUNC(GLOBAL(ashiftrt_r4_10))
++ ENDFUNC(GLOBAL(ashiftrt_r4_11))
++ ENDFUNC(GLOBAL(ashiftrt_r4_12))
++ ENDFUNC(GLOBAL(ashiftrt_r4_13))
++ ENDFUNC(GLOBAL(ashiftrt_r4_14))
++ ENDFUNC(GLOBAL(ashiftrt_r4_15))
++ ENDFUNC(GLOBAL(ashiftrt_r4_16))
++ ENDFUNC(GLOBAL(ashiftrt_r4_17))
++ ENDFUNC(GLOBAL(ashiftrt_r4_18))
++ ENDFUNC(GLOBAL(ashiftrt_r4_19))
++ ENDFUNC(GLOBAL(ashiftrt_r4_20))
++ ENDFUNC(GLOBAL(ashiftrt_r4_21))
++ ENDFUNC(GLOBAL(ashiftrt_r4_22))
++ ENDFUNC(GLOBAL(ashiftrt_r4_23))
++ ENDFUNC(GLOBAL(ashiftrt_r4_24))
++ ENDFUNC(GLOBAL(ashiftrt_r4_25))
++ ENDFUNC(GLOBAL(ashiftrt_r4_26))
++ ENDFUNC(GLOBAL(ashiftrt_r4_27))
++ ENDFUNC(GLOBAL(ashiftrt_r4_28))
++ ENDFUNC(GLOBAL(ashiftrt_r4_29))
++ ENDFUNC(GLOBAL(ashiftrt_r4_30))
++ ENDFUNC(GLOBAL(ashiftrt_r4_31))
++ ENDFUNC(GLOBAL(ashiftrt_r4_32))
+ #endif
+
+ #ifdef L_ashiftrt_n
+@@ -188,6 +261,7 @@
+ !
+
+ .global GLOBAL(ashrsi3)
++ FUNC(GLOBAL(ashrsi3))
+ .align 2
+ GLOBAL(ashrsi3):
+ mov #31,r0
+@@ -315,6 +389,7 @@
+ rts
+ nop
+
++ ENDFUNC(GLOBAL(ashrsi3))
+ #endif
+
+ #ifdef L_ashiftlt
+@@ -336,6 +411,7 @@
+ ! (none)
+ !
+ .global GLOBAL(ashlsi3)
++ FUNC(GLOBAL(ashlsi3))
+ .align 2
+ GLOBAL(ashlsi3):
+ mov #31,r0
+@@ -472,6 +548,7 @@
+ rts
+ nop
+
++ ENDFUNC(GLOBAL(ashlsi3))
+ #endif
+
+ #ifdef L_lshiftrt
+@@ -493,6 +570,7 @@
+ ! (none)
+ !
+ .global GLOBAL(lshrsi3)
++ FUNC(GLOBAL(lshrsi3))
+ .align 2
+ GLOBAL(lshrsi3):
+ mov #31,r0
+@@ -629,6 +707,7 @@
+ rts
+ nop
+
++ ENDFUNC(GLOBAL(lshrsi3))
+ #endif
+
+ #ifdef L_movstr
+@@ -645,76 +724,113 @@
+ add #64,r4
+ .align 4
+ .global GLOBAL(movstrSI64)
++ FUNC(GLOBAL(movstrSI64))
+ GLOBAL(movstrSI64):
+ mov.l @(60,r5),r0
+ mov.l r0,@(60,r4)
+ .global GLOBAL(movstrSI60)
++ FUNC(GLOBAL(movstrSI60))
+ GLOBAL(movstrSI60):
+ mov.l @(56,r5),r0
+ mov.l r0,@(56,r4)
+ .global GLOBAL(movstrSI56)
++ FUNC(GLOBAL(movstrSI56))
+ GLOBAL(movstrSI56):
+ mov.l @(52,r5),r0
+ mov.l r0,@(52,r4)
+ .global GLOBAL(movstrSI52)
++ FUNC(GLOBAL(movstrSI52))
+ GLOBAL(movstrSI52):
+ mov.l @(48,r5),r0
+ mov.l r0,@(48,r4)
+ .global GLOBAL(movstrSI48)
++ FUNC(GLOBAL(movstrSI48))
+ GLOBAL(movstrSI48):
+ mov.l @(44,r5),r0
+ mov.l r0,@(44,r4)
+ .global GLOBAL(movstrSI44)
++ FUNC(GLOBAL(movstrSI44))
+ GLOBAL(movstrSI44):
+ mov.l @(40,r5),r0
+ mov.l r0,@(40,r4)
+ .global GLOBAL(movstrSI40)
++ FUNC(GLOBAL(movstrSI40))
+ GLOBAL(movstrSI40):
+ mov.l @(36,r5),r0
+ mov.l r0,@(36,r4)
+ .global GLOBAL(movstrSI36)
++ FUNC(GLOBAL(movstrSI36))
+ GLOBAL(movstrSI36):
+ mov.l @(32,r5),r0
+ mov.l r0,@(32,r4)
+ .global GLOBAL(movstrSI32)
++ FUNC(GLOBAL(movstrSI32))
+ GLOBAL(movstrSI32):
+ mov.l @(28,r5),r0
+ mov.l r0,@(28,r4)
+ .global GLOBAL(movstrSI28)
++ FUNC(GLOBAL(movstrSI28))
+ GLOBAL(movstrSI28):
+ mov.l @(24,r5),r0
+ mov.l r0,@(24,r4)
+ .global GLOBAL(movstrSI24)
++ FUNC(GLOBAL(movstrSI24))
+ GLOBAL(movstrSI24):
+ mov.l @(20,r5),r0
+ mov.l r0,@(20,r4)
+ .global GLOBAL(movstrSI20)
++ FUNC(GLOBAL(movstrSI20))
+ GLOBAL(movstrSI20):
+ mov.l @(16,r5),r0
+ mov.l r0,@(16,r4)
+ .global GLOBAL(movstrSI16)
++ FUNC(GLOBAL(movstrSI16))
+ GLOBAL(movstrSI16):
+ mov.l @(12,r5),r0
+ mov.l r0,@(12,r4)
+ .global GLOBAL(movstrSI12)
++ FUNC(GLOBAL(movstrSI12))
+ GLOBAL(movstrSI12):
+ mov.l @(8,r5),r0
+ mov.l r0,@(8,r4)
+ .global GLOBAL(movstrSI8)
++ FUNC(GLOBAL(movstrSI8))
+ GLOBAL(movstrSI8):
+ mov.l @(4,r5),r0
+ mov.l r0,@(4,r4)
+ .global GLOBAL(movstrSI4)
++ FUNC(GLOBAL(movstrSI4))
+ GLOBAL(movstrSI4):
+ mov.l @(0,r5),r0
+ mov.l r0,@(0,r4)
++ .global GLOBAL(movstrSI0)
++ FUNC(GLOBAL(movstrSI0))
+ GLOBAL(movstrSI0):
+ rts
+ nop
+
++ ENDFUNC(GLOBAL(movstrSI64))
++ ENDFUNC(GLOBAL(movstrSI60))
++ ENDFUNC(GLOBAL(movstrSI56))
++ ENDFUNC(GLOBAL(movstrSI52))
++ ENDFUNC(GLOBAL(movstrSI48))
++ ENDFUNC(GLOBAL(movstrSI44))
++ ENDFUNC(GLOBAL(movstrSI40))
++ ENDFUNC(GLOBAL(movstrSI36))
++ ENDFUNC(GLOBAL(movstrSI32))
++ ENDFUNC(GLOBAL(movstrSI28))
++ ENDFUNC(GLOBAL(movstrSI24))
++ ENDFUNC(GLOBAL(movstrSI20))
++ ENDFUNC(GLOBAL(movstrSI16))
++ ENDFUNC(GLOBAL(movstrSI12))
++ ENDFUNC(GLOBAL(movstrSI8))
++ ENDFUNC(GLOBAL(movstrSI4))
++ ENDFUNC(GLOBAL(movstrSI0))
++
+ .align 4
+
+ .global GLOBAL(movstr)
++ FUNC(GLOBAL(movstr))
+ GLOBAL(movstr):
+ mov.l @(60,r5),r0
+ mov.l r0,@(60,r4)
+@@ -771,6 +887,8 @@
+ add #64,r5
+ bra GLOBAL(movstr)
+ add #64,r4
++
++ FUNC(GLOBAL(movstr))
+ #endif
+
+ #ifdef L_movstr_i4
+@@ -779,6 +897,10 @@
+ .global GLOBAL(movstr_i4_odd)
+ .global GLOBAL(movstrSI12_i4)
+
++ FUNC(GLOBAL(movstr_i4_even))
++ FUNC(GLOBAL(movstr_i4_odd))
++ FUNC(GLOBAL(movstrSI12_i4))
++
+ .p2align 5
+ L_movstr_2mod4_end:
+ mov.l r0,@(16,r4)
+@@ -787,6 +909,11 @@
+
+ .p2align 2
+
++GLOBAL(movstr_i4_even):
++ mov.l @r5+,r0
++ bra L_movstr_start_even
++ mov.l @r5+,r1
++
+ GLOBAL(movstr_i4_odd):
+ mov.l @r5+,r1
+ add #-4,r4
+@@ -813,10 +940,8 @@
+ rts
+ mov.l r3,@(12,r4)
+
+-GLOBAL(movstr_i4_even):
+- mov.l @r5+,r0
+- bra L_movstr_start_even
+- mov.l @r5+,r1
++ ENDFUNC(GLOBAL(movstr_i4_even))
++ ENDFUNC(GLOBAL(movstr_i4_odd))
+
+ .p2align 4
+ GLOBAL(movstrSI12_i4):
+@@ -827,12 +952,15 @@
+ mov.l r1,@(4,r4)
+ rts
+ mov.l r2,@(8,r4)
++
++ ENDFUNC(GLOBAL(movstrSI12_i4))
+ #endif
+
+ #ifdef L_mulsi3
+
+
+ .global GLOBAL(mulsi3)
++ FUNC(GLOBAL(mulsi3))
+
+ ! r4 = aabb
+ ! r5 = ccdd
+@@ -865,7 +993,7 @@
+ rts
+ add r2,r0
+
+-
++ FUNC(GLOBAL(mulsi3))
+ #endif
+ #endif /* ! __SH5__ */
+ #ifdef L_sdivsi3_i4
+@@ -875,6 +1003,7 @@
+ !! args in r4 and r5, result in fpul, clobber dr0, dr2
+
+ .global GLOBAL(sdivsi3_i4)
++ FUNC(GLOBAL(sdivsi3_i4))
+ GLOBAL(sdivsi3_i4):
+ lds r4,fpul
+ float fpul,dr0
+@@ -884,6 +1013,7 @@
+ rts
+ ftrc dr0,fpul
+
++ ENDFUNC(GLOBAL(sdivsi3_i4))
+ #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__)
+ !! args in r4 and r5, result in fpul, clobber r2, dr0, dr2
+
+@@ -892,6 +1022,7 @@
+ .mode SHcompact
+ #endif
+ .global GLOBAL(sdivsi3_i4)
++ FUNC(GLOBAL(sdivsi3_i4))
+ GLOBAL(sdivsi3_i4):
+ sts.l fpscr,@-r15
+ mov #8,r2
+@@ -906,6 +1037,7 @@
+ rts
+ lds.l @r15+,fpscr
+
++ ENDFUNC(GLOBAL(sdivsi3_i4))
+ #endif /* ! __SH5__ || __SH5__ == 32 */
+ #endif /* ! __SH4__ */
+ #endif
+@@ -920,9 +1052,10 @@
+ !!
+ !!
+
+-!! args in r4 and r5, result in r0 clobber r1,r2,r3
++!! args in r4 and r5, result in r0 clobber r1, r2, r3, and t bit
+
+ .global GLOBAL(sdivsi3)
++ FUNC(GLOBAL(sdivsi3))
+ #if __SHMEDIA__
+ #if __SH5__ == 32
+ .section .text..SHmedia32,"ax"
+@@ -1166,6 +1299,7 @@
+ div0: rts
+ mov #0,r0
+
++ ENDFUNC(GLOBAL(sdivsi3))
+ #endif /* ! __SHMEDIA__ */
+ #endif /* ! __SH4__ */
+ #endif
+@@ -1174,9 +1308,11 @@
+ .title "SH DIVIDE"
+ !! 4 byte integer Divide code for the Hitachi SH
+ #ifdef __SH4__
+-!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
++!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4,
++!! and t bit
+
+ .global GLOBAL(udivsi3_i4)
++ FUNC(GLOBAL(udivsi3_i4))
+ GLOBAL(udivsi3_i4):
+ mov #1,r1
+ cmp/hi r1,r5
+@@ -1217,11 +1353,13 @@
+ L1:
+ .double 2147483648
+
++ ENDFUNC(GLOBAL(udivsi3_i4))
+ #elif defined (__SH5__) && ! defined (__SH4_NOFPU__)
+ #if ! __SH5__ || __SH5__ == 32
+ !! args in r4 and r5, result in fpul, clobber r20, r21, dr0, fr33
+ .mode SHmedia
+ .global GLOBAL(udivsi3_i4)
++ FUNC(GLOBAL(udivsi3_i4))
+ GLOBAL(udivsi3_i4):
+ addz.l r4,r63,r20
+ addz.l r5,r63,r21
+@@ -1234,6 +1372,8 @@
+ ftrc.dq dr0,dr32
+ fmov.s fr33,fr32
+ blink tr0,r63
++
++ ENDFUNC(GLOBAL(udivsi3_i4))
+ #endif /* ! __SH5__ || __SH5__ == 32 */
+ #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__)
+ !! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
+@@ -1287,6 +1427,7 @@
+ #endif
+ .double 2147483648
+
++ ENDFUNC(GLOBAL(udivsi3_i4))
+ #endif /* ! __SH4__ */
+ #endif
+
+@@ -1297,6 +1438,7 @@
+
+ !! args in r4 and r5, result in r0, clobbers r4, pr, and t bit
+ .global GLOBAL(udivsi3)
++ FUNC(GLOBAL(udivsi3))
+
+ #if __SHMEDIA__
+ #if __SH5__ == 32
+@@ -1485,6 +1627,7 @@
+ rts
+ rotcl r0
+
++ ENDFUNC(GLOBAL(udivsi3))
+ #endif /* ! __SHMEDIA__ */
+ #endif /* __SH4__ */
+ #endif /* L_udivsi3 */
+@@ -1790,6 +1933,7 @@
+ .mode SHcompact
+ #endif
+ .global GLOBAL(set_fpscr)
++ FUNC(GLOBAL(set_fpscr))
+ GLOBAL(set_fpscr):
+ lds r4,fpscr
+ mov.l LOCAL(set_fpscr_L1),r1
+@@ -1822,6 +1966,8 @@
+ .align 2
+ LOCAL(set_fpscr_L1):
+ .long GLOBAL(fpscr_values)
++
++ ENDFUNC(GLOBAL(set_fpscr))
+ #ifdef __ELF__
+ .comm GLOBAL(fpscr_values),8,4
+ #else
+@@ -1860,6 +2006,7 @@
+ blink tr0, r63
+ #elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
+ .global GLOBAL(ic_invalidate)
++ FUNC(GLOBAL(ic_invalidate))
+ GLOBAL(ic_invalidate):
+ ocbwb @r4
+ mova 0f,r0
+@@ -1882,6 +2029,8 @@
+ nop
+ .endr
+ .endr
++
++ ENDFUNC(GLOBAL(ic_invalidate))
+ #endif /* SH4 */
+ #endif /* L_ic_invalidate */
+
+@@ -1940,6 +2089,7 @@
+ will be expanded into r2/r3 upon return. */
+
+ .global GLOBAL(GCC_shcompact_call_trampoline)
++ FUNC(GLOBAL(GCC_shcompact_call_trampoline))
+ GLOBAL(GCC_shcompact_call_trampoline):
+ ptabs/l r0, tr0 /* Prepare to call the actual function. */
+ movi ((datalabel LOCAL(ct_main_table) - 31 * 2) >> 16) & 65535, r0
+@@ -2290,6 +2440,8 @@
+ shari r2, 32, r2
+ #endif
+ blink tr0, r63
++
++ ENDFUNC(GLOBAL(GCC_shcompact_call_trampoline))
+ #endif /* L_shcompact_call_trampoline */
+
+ #ifdef L_shcompact_return_trampoline
+@@ -2302,6 +2454,7 @@
+ .section .text..SHmedia32, "ax"
+ .align 2
+ .global GLOBAL(GCC_shcompact_return_trampoline)
++ FUNC(GLOBAL(GCC_shcompact_return_trampoline))
+ GLOBAL(GCC_shcompact_return_trampoline):
+ ptabs/l r18, tr0
+ #if __LITTLE_ENDIAN__
+@@ -2313,6 +2466,8 @@
+ #endif
+ or r3, r2, r2
+ blink tr0, r63
++
++ ENDFUNC(GLOBAL(GCC_shcompact_return_trampoline))
+ #endif /* L_shcompact_return_trampoline */
+
+ #ifdef L_shcompact_incoming_args
+@@ -2367,6 +2522,7 @@
+ actual bit pattern. */
+
+ .global GLOBAL(GCC_shcompact_incoming_args)
++ FUNC(GLOBAL(GCC_shcompact_incoming_args))
+ GLOBAL(GCC_shcompact_incoming_args):
+ ptabs/l r18, tr0 /* Prepare to return. */
+ shlri r17, 32, r0 /* Load the cookie. */
+@@ -2519,6 +2675,7 @@
+ LOCAL(ia_return): /* Return. */
+ blink tr0, r63
+ LOCAL(ia_end_of_push_seq): /* Label used to compute the first push instruction. */
++ ENDFUNC(GLOBAL(GCC_shcompact_incoming_args))
+ #endif /* L_shcompact_incoming_args */
+ #endif
+ #if __SH5__
+@@ -2530,6 +2687,7 @@
+ #endif
+ .align 3 /* It is copied in units of 8 bytes in SHmedia mode. */
+ .global GLOBAL(GCC_nested_trampoline)
++ FUNC(GLOBAL(GCC_nested_trampoline))
+ GLOBAL(GCC_nested_trampoline):
+ .mode SHmedia
+ ptrel/u r63, tr0
+@@ -2546,6 +2704,8 @@
+ ld.l r0, 28, r1
+ #endif
+ blink tr1, r63
++
++ ENDFUNC(GLOBAL(GCC_nested_trampoline))
+ #endif /* L_nested_trampoline */
+ #endif /* __SH5__ */
+ #if __SH5__ == 32
+@@ -2555,6 +2715,7 @@
+ .align 2
+ #ifndef __SH4_NOFPU__
+ .global GLOBAL(GCC_push_shmedia_regs)
++ FUNC(GLOBAL(GCC_push_shmedia_regs))
+ GLOBAL(GCC_push_shmedia_regs):
+ addi.l r15, -14*8, r15
+ fst.d r15, 13*8, dr62
+@@ -2573,6 +2734,7 @@
+ fst.d r15, 0*8, dr36
+ #endif
+ .global GLOBAL(GCC_push_shmedia_regs_nofpu)
++ FUNC(GLOBAL(GCC_push_shmedia_regs_nofpu))
+ GLOBAL(GCC_push_shmedia_regs_nofpu):
+ ptabs/l r18, tr0
+ addi.l r15, -27*8, r15
+@@ -2608,8 +2770,13 @@
+ st.q r15, 0*8, r28
+ blink tr0, r63
+
++#ifndef __SH4_NOFPU__
++ ENDFUNC(GLOBAL(GCC_push_shmedia_regs))
++#endif
++ ENDFUNC(GLOBAL(GCC_push_shmedia_regs_nofpu))
+ #ifndef __SH4_NOFPU__
+ .global GLOBAL(GCC_pop_shmedia_regs)
++ FUNC(GLOBAL(GCC_pop_shmedia_regs))
+ GLOBAL(GCC_pop_shmedia_regs):
+ pt .L0, tr1
+ movi 41*8, r0
+@@ -2630,6 +2797,7 @@
+ blink tr1, r63
+ #endif
+ .global GLOBAL(GCC_pop_shmedia_regs_nofpu)
++ FUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu))
+ GLOBAL(GCC_pop_shmedia_regs_nofpu):
+ movi 27*8, r0
+ .L0:
+@@ -2666,5 +2834,10 @@
+ ld.q r15, 0*8, r28
+ add.l r15, r0, r15
+ blink tr0, r63
++
++#ifndef __SH4_NOFPU__
++ ENDFUNC(GLOBAL(GCC_pop_shmedia_regs))
++#endif
++ ENDFUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu))
+ #endif /* __SH5__ == 32 */
+ #endif /* L_push_pop_shmedia_regs */
diff --git a/patches/gcc/3.3.3/sh-pic-set_fpscr-gcc-3.3.2.patch b/patches/gcc/3.3.3/sh-pic-set_fpscr-gcc-3.3.2.patch
new file mode 100644
index 0000000..2a9d592
--- /dev/null
+++ b/patches/gcc/3.3.3/sh-pic-set_fpscr-gcc-3.3.2.patch
@@ -0,0 +1,67 @@
+See http://gcc.gnu.org/PR11901
+Should fix
+make[2]: *** [/gcc-3.3-glibc-2.3.2/build-glibc/elf/check-textrel.out] Error 1
+in glibc's "make tests".
+
+Note: this patch is named
+sh-pic-set_fpscr-gcc-3.3.2.patch
+and must be applied after
+sh-lib1funcs_sizeAndType.patch
+but that'll happen naturally if you apply them in alphabetical order.
+
+-------------
+
+Date: Wed, 30 Jul 2003 12:03:01 +0900
+From: kaz Kojima <kkojima@rr.iij4u.or.jp>
+Subject: [linux-sh:02916] Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails
+ with "libc.so: text relocations used" in glibc-2.3.2 for sh4)
+To: dank@kegel.com
+Cc: linux-sh@m17n.org
+Message-Id: <200307300255.h6U2tB906928@r-rr.iij4u.or.jp>
+
+> I'll try to write the PIC version of it,
+
+Dan, does the attached patch work for you?
+
+Regards,
+ kaz
+--
+diff -u3prN ORIG/gcc/gcc/config/sh/lib1funcs.asm LOCAL/gcc/gcc/config/sh/lib1funcs.asm
+--- ORIG/gcc/gcc/config/sh/lib1funcs.asm Thu Jun 19 07:38:59 2003
++++ gcc-3.3.2/gcc/config/sh/lib1funcs.asm Wed Jul 30 11:08:49 2003
+@@ -1936,7 +1944,17 @@ GLOBAL(moddi3):
+ FUNC(GLOBAL(set_fpscr))
+ GLOBAL(set_fpscr):
+ lds r4,fpscr
++#ifdef __PIC__
++ mov.l r12,@-r15
++ mova LOCAL(set_fpscr_L0),r0
++ mov.l LOCAL(set_fpscr_L0),r12
++ add r0,r12
++ mov.l LOCAL(set_fpscr_L1),r0
++ mov.l @(r0,r12),r1
++ mov.l @r15+,r12
++#else
+ mov.l LOCAL(set_fpscr_L1),r1
++#endif
+ swap.w r4,r0
+ or #24,r0
+ #ifndef FMOVD_WORKS
+@@ -1964,8 +1982,15 @@ GLOBAL(set_fpscr):
+ mov.l r3,@(4,r1)
+ #endif
+ .align 2
++#ifdef __PIC__
++LOCAL(set_fpscr_L0):
++ .long _GLOBAL_OFFSET_TABLE_
++LOCAL(set_fpscr_L1):
++ .long GLOBAL(fpscr_values@GOT)
++#else
+ LOCAL(set_fpscr_L1):
+ .long GLOBAL(fpscr_values)
++#endif
+
+ ENDFUNC(GLOBAL(set_fpscr))
+ #ifndef NO_FPSCR_VALUES
+
+
diff --git a/patches/gcc/3.3.3/thunk3.patch b/patches/gcc/3.3.3/thunk3.patch
new file mode 100644
index 0000000..7974a0c
--- /dev/null
+++ b/patches/gcc/3.3.3/thunk3.patch
@@ -0,0 +1,23 @@
+Fixes
+FAIL: g++.jason/thunk3.C (test for excess errors)
+on sh4-unknown-linux-gnu.
+
+Does any sh variant *not* use the generic thunk support? If so, the patch should be
+more cautious. As it is, it excludes all sh processors from this test.
+
+Index: thunk3.C
+===================================================================
+RCS file: /cvsroot/gcc/gcc/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C,v
+retrieving revision 1.13
+diff -u -d -u -r1.13 thunk3.C
+--- gcc-ss-3_3-20030714/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C.old 25 Mar 2002 17:57:03 -0000 1.13
++++ gcc-ss-3_3-20030714/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C 20 Jul 2003 16:57:38 -0000
+@@ -2,7 +2,7 @@
+ // Note that this will break on any target that uses the generic thunk
+ // support, because it doesn't support variadic functions.
+
+-// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa-*-*
++// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh*-*-* h8*-*-* xtensa-*-*
+
+ #include <stdarg.h>
+