summaryrefslogtreecommitdiff
path: root/patches/gcc/3.3.1
diff options
context:
space:
mode:
Diffstat (limited to 'patches/gcc/3.3.1')
-rw-r--r--patches/gcc/3.3.1/compat.exp.patch37
-rw-r--r--patches/gcc/3.3.1/config.sub.patch72
-rw-r--r--patches/gcc/3.3.1/empty6.patch21
-rw-r--r--patches/gcc/3.3.1/gcc-3.2.3-g++.exp.patch100
-rw-r--r--patches/gcc/3.3.1/gcc-3.3-libstdc++-v3-dg.exp.patch54
-rw-r--r--patches/gcc/3.3.1/gcc-3.3.1-trap-posix.patch44
-rw-r--r--patches/gcc/3.3.1/pr10392-1-test.patch65
-rw-r--r--patches/gcc/3.3.1/pr10412-1-test.patch46
-rw-r--r--patches/gcc/3.3.1/pr10589-1-test.patch17
-rw-r--r--patches/gcc/3.3.1/pr11162-1-test.patch25
-rw-r--r--patches/gcc/3.3.1/pr11587-1-test.patch39
-rw-r--r--patches/gcc/3.3.1/pr11736-1-test.patch48
-rw-r--r--patches/gcc/3.3.1/pr11864-1-test.patch45
-rw-r--r--patches/gcc/3.3.1/pr11949-fix.patch61
-rw-r--r--patches/gcc/3.3.1/pr9365-1-test.patch43
-rw-r--r--patches/gcc/3.3.1/sh-pic-set_fpscr.patch61
-rw-r--r--patches/gcc/3.3.1/sh-spec.patch52
-rw-r--r--patches/gcc/3.3.1/sh4-pthread.patch44
-rw-r--r--patches/gcc/3.3.1/thunk3.patch23
19 files changed, 897 insertions, 0 deletions
diff --git a/patches/gcc/3.3.1/compat.exp.patch b/patches/gcc/3.3.1/compat.exp.patch
new file mode 100644
index 0000000..763b8a1
--- /dev/null
+++ b/patches/gcc/3.3.1/compat.exp.patch
@@ -0,0 +1,37 @@
+Fixes the following problem 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-glibc-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/testsuite/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/gcc-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/testsuite/../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 data encoding not little-endian
+
+FAIL: g++.dg/compat/abi/bitfield1 main_tst.o compile
+============================================
+
+--- 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
++ }
+ }
+
+ #
diff --git a/patches/gcc/3.3.1/config.sub.patch b/patches/gcc/3.3.1/config.sub.patch
new file mode 100644
index 0000000..928f911
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/empty6.patch b/patches/gcc/3.3.1/empty6.patch
new file mode 100644
index 0000000..1b0715c
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/gcc-3.2.3-g++.exp.patch b/patches/gcc/3.3.1/gcc-3.2.3-g++.exp.patch
new file mode 100644
index 0000000..fb8e4f0
--- /dev/null
+++ b/patches/gcc/3.3.1/gcc-3.2.3-g++.exp.patch
@@ -0,0 +1,100 @@
+See http://gcc.gnu.org/PR12010
+
+g++ testsuite fixes for cross-compilers, Dan Kegel, Ixia Communications, 12 July 2003
+
+The first hunk fixes the error
+
+/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)
+ invoked from within
+"runtest $test_name"
+ ("foreach" body line 42)
+ invoked from within
+...
+make[1]: [check-g++] Error 1 (ignored)
+
+The fix isn't especially pretty, but it worked for me, and can't hurt the
+more common native compiler case. Maybe someone who knows the code better
+can come up with a better fix.
+
+The second hunk fixes the error
+
+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
+
+when trying to compile g++ testcases (!); setting up
+the shared library environment when running crosstests of g++
+should either be done by a special board file, or by
+setting up a remote chroot environment (see http://kegel.com/crosstool),
+not by blithely setting LD_LIBRARY_PATH on the local system.
+
+--- gcc-3.2.3/gcc/testsuite/lib/g++.exp.old Fri Jul 11 15:42:47 2003
++++ gcc-3.2.3/gcc/testsuite/lib/g++.exp Sat Jul 12 12:57:07 2003
+@@ -72,6 +72,8 @@
+ #
+ 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 @@
+
+ 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++]
+@@ -192,16 +192,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.1/gcc-3.3-libstdc++-v3-dg.exp.patch b/patches/gcc/3.3.1/gcc-3.3-libstdc++-v3-dg.exp.patch
new file mode 100644
index 0000000..aafc130
--- /dev/null
+++ b/patches/gcc/3.3.1/gcc-3.3-libstdc++-v3-dg.exp.patch
@@ -0,0 +1,54 @@
+Without this patch, the command
+
+RUNTESTFLAGS=--target=powerpc-750-linux-gnu -v -v -v -v make check-target-libstdc++-v3
+
+fails in two ways:
+1. the -L option meant to locate the testsuite directory is incorrect, and
+2. the wrong compiler is invoked, causing all sorts of havoc, not least of which
+is the native compiler is invoked when we really wanted to invoke the cross-compiler
+we just built.
+
+Here's an example log of the problem in action. Every testcase fails, this shows just one:
+-------------
+Invoking the compiler as g++ -ggdb3 -DDEBUG_ASSERT -I/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite /home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc -g -O2 -DDEBUG_ASSERT -L/testsuite -lv3test -lm -o ./binders.exe
+compiler exited with status 1
+output is:
+/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h: In method `void binder2nd<mem_fun1_ref_t<void,Elem,int> >::operator ()(const Elem &) const':^M
+/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_algo.h:83: instantiated from `for_each<Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> > >(Elem *, Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> >)'^M
+/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc:43: instantiated from here^M
+/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:224: conversion from `const Elem' to `Elem &' discards qualifiers^M
+/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:622: in passing argument 1 of `mem_fun1_ref_t<void,Elem,int>::operator ()(Elem &, int) const'^M
+...
+FAIL: 20_util/binders.cc (test for excess errors)
+WARNING: 20_util/binders.cc compilation failed to produce executable
+-------------
+
+And here's the patch. I'm not happy with it, and it probably gets some cases wrong,
+but it seems to work for the common native case and for my cross-compiler case.
+
+--- gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp.old Sun Jul 13 10:42:01 2003
++++ gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp Sun Jul 13 11:39:54 2003
+@@ -46,8 +46,23 @@
+ global gluefile wrap_flags
+ global 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.1/gcc-3.3.1-trap-posix.patch b/patches/gcc/3.3.1/gcc-3.3.1-trap-posix.patch
new file mode 100644
index 0000000..ce2baf3
--- /dev/null
+++ b/patches/gcc/3.3.1/gcc-3.3.1-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.1-orig/configure gcc-3.3.1/configure
+--- gcc-3.3.1-orig/configure 2002-09-29 18:11:24.000000000 +0200
++++ gcc-3.3.1/configure 2005-04-20 18:49:20.223220401 +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.1/pr10392-1-test.patch b/patches/gcc/3.3.1/pr10392-1-test.patch
new file mode 100644
index 0000000..e94c8b9
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/pr10412-1-test.patch b/patches/gcc/3.3.1/pr10412-1-test.patch
new file mode 100644
index 0000000..6ca0525
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/pr10589-1-test.patch b/patches/gcc/3.3.1/pr10589-1-test.patch
new file mode 100644
index 0000000..04882e5
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/pr11162-1-test.patch b/patches/gcc/3.3.1/pr11162-1-test.patch
new file mode 100644
index 0000000..9ab0d32
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/pr11587-1-test.patch b/patches/gcc/3.3.1/pr11587-1-test.patch
new file mode 100644
index 0000000..f6dedde
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/pr11736-1-test.patch b/patches/gcc/3.3.1/pr11736-1-test.patch
new file mode 100644
index 0000000..ea544b1
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/pr11864-1-test.patch b/patches/gcc/3.3.1/pr11864-1-test.patch
new file mode 100644
index 0000000..f5b0d17
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/pr11949-fix.patch b/patches/gcc/3.3.1/pr11949-fix.patch
new file mode 100644
index 0000000..7f60b95
--- /dev/null
+++ b/patches/gcc/3.3.1/pr11949-fix.patch
@@ -0,0 +1,61 @@
+Message-Id: 20030822160024.GA305@ftbfs.org
+From: Matt Kraai kraai at alumni dot cmu dot edu
+To: gcc-patches at gcc dot gnu dot org
+Date: Fri, 22 Aug 2003 09:00:24 -0700
+Subject: PR 11949
+
+Howdy,
+
+I've backported the following patch from the mainline to the 3.3
+branch to fix PR 11949.
+
+Bootstrapped and regression tested on powerpc-unknown-linux-gnu.
+
+OK to commit?
+
+ PR c/11949
+ Backport from mainline:
+
+ 2003-05-05 Aldy Hernandez aldyh@redhat.com
+
+ * testsuite/gcc.c-torture/compile/simd-6.c: New.
+
+ * c-typeck.c (digest_init): Handle arrays of vector constants.
+
+Index: gcc/c-typeck.c
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
+retrieving revision 1.213.2.8
+diff -3 -c -p -r1.213.2.8 c-typeck.c
+*** gcc/gcc/c-typeck.c 19 Aug 2003 01:42:35 -0000 1.213.2.8
+--- gcc/gcc/c-typeck.c 22 Aug 2003 09:24:03 -0000
+*************** digest_init (type, init, require_constan
+*** 4765,4772 ****
+ if (code == VECTOR_TYPE
+ && comptypes (TREE_TYPE (inside_init), type)
+ && TREE_CONSTANT (inside_init))
+! return build_vector (type, TREE_OPERAND (inside_init, 1));
+!
+
+ /* Any type can be initialized
+ from an expression of the same type, optionally with braces. */
+--- 4765,4778 ----
+ if (code == VECTOR_TYPE
+ && comptypes (TREE_TYPE (inside_init), type)
+ && TREE_CONSTANT (inside_init))
+! {
+! if (TREE_CODE (inside_init) == VECTOR_CST
+! && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
+! TYPE_MAIN_VARIANT (type)))
+! return inside_init;
+! else
+! return build_vector (type, CONSTRUCTOR_ELTS (inside_init));
+! }
+
+ /* Any type can be initialized
+ from an expression of the same type, optionally with braces. */
+
+typedef int __attribute__((mode(V2SI))) vec;
+
+vec a[] = {(vec) {1, 2}, {3, 4}};
+
diff --git a/patches/gcc/3.3.1/pr9365-1-test.patch b/patches/gcc/3.3.1/pr9365-1-test.patch
new file mode 100644
index 0000000..ee7dfa7
--- /dev/null
+++ b/patches/gcc/3.3.1/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.1/sh-pic-set_fpscr.patch b/patches/gcc/3.3.1/sh-pic-set_fpscr.patch
new file mode 100644
index 0000000..e83f728
--- /dev/null
+++ b/patches/gcc/3.3.1/sh-pic-set_fpscr.patch
@@ -0,0 +1,61 @@
+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".
+
+-------------
+
+Message-Id: <200307300255.h6U2tB906928@r-rr.iij4u.or.jp>
+To: dank@kegel.com
+Cc: linux-sh@m17n.org
+Subject: 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)
+In-Reply-To: Your message of "Wed, 30 Jul 2003 11:20:49 +0900"
+ <200307300212.h6U2CH901209@r-rr.iij4u.or.jp>
+References: <200307300212.h6U2CH901209@r-rr.iij4u.or.jp>
+Date: Wed, 30 Jul 2003 12:03:01 +0900
+From: kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+> I'll try to write the PIC version of it,
+
+Dan, does the attached patch work for you?
+
+[dank: original patch deleted; here's same thing rediffed against gcc-3.3 instead of HEAD]
+
+--- gcc-3.3/gcc/config/sh/lib1funcs.asm.old Tue Jul 29 21:37:29 2003
++++ gcc-3.3/gcc/config/sh/lib1funcs.asm Tue Jul 29 21:40:58 2003
+@@ -1792,7 +1792,17 @@
+ .global 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
+@@ -1820,8 +1830,16 @@
+ 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
++
+ #ifdef __ELF__
+ .comm GLOBAL(fpscr_values),8,4
+ #else
diff --git a/patches/gcc/3.3.1/sh-spec.patch b/patches/gcc/3.3.1/sh-spec.patch
new file mode 100644
index 0000000..efd4243
--- /dev/null
+++ b/patches/gcc/3.3.1/sh-spec.patch
@@ -0,0 +1,52 @@
+See http://gcc.gnu.org/PR11902
+
+Part of fix for abort on line
+ assert (info[DT_RPATH] == NULL);
+in glibc-2.3.2's ld.so, which makes all dynamically-linked
+programs crash.
+
+Message-Id: <200308020452.h724q0n01509@r-rr.iij4u.or.jp>
+To: dank@kegel.com
+Cc: kkojima@rr.iij4u.or.jp
+Subject: Re: Writing PIC version of __udivsi3_i4?
+In-Reply-To: Your message of "Fri, 01 Aug 2003 21:15:27 -0700"
+ <3F2B3ADF.6030206@kegel.com>
+References: <3F2B3ADF.6030206@kegel.com>
+Date: Sat, 02 Aug 2003 13:58:05 +0900
+From: kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+Dan Kegel <dank@kegel.com> wrote:
+> It seems it might be from gcc's spec file:
+>
+> *subtarget_link_spec:
+> %{shared:-shared} %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} %{!rpath:-rpath /lib}} %{static:-static}
+>
+> as the only place -rpath showed up was in the output of gcc -v as it
+> was linking libc.so.
+>
+> Well, that's a clue, anyway! Guess I'll dig through the spec files
+> tomorrow to see if I can figure it out some more.
+
+I've grepped gcc/config/*/*.h and found only SH and old libc1 stuffs
+of i386/alpha include %{!rpath:-rpath ... in 3.3 release and the
+current CVS. And my sh-gcc's specs doesn't have this :-(
+It would be the Right Thing to remove this stuff simply. How about
+the gcc patch below?
+
+Regards,
+ kaz
+--
+--- gcc-3.3/gcc/config/sh/linux.h.orig Sat Aug 2 13:20:57 2003
++++ gcc-3.3/gcc/config/sh/linux.h Sat Aug 2 13:22:42 2003
+@@ -48,8 +48,7 @@ do { \
+ "%{shared:-shared} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
+- %{!rpath:-rpath /lib}} \
++ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
+ %{static:-static}"
+
+ /* The GNU C++ standard library requires that these macros be defined. */
+
+
diff --git a/patches/gcc/3.3.1/sh4-pthread.patch b/patches/gcc/3.3.1/sh4-pthread.patch
new file mode 100644
index 0000000..95e1057
--- /dev/null
+++ b/patches/gcc/3.3.1/sh4-pthread.patch
@@ -0,0 +1,44 @@
+See http://gcc.gnu.org/PR11903
+
+Patch to fix following test case failure:
+
+ === libstdc++-v3 tests ===
+FAIL: thread/pthread1.cc (test for excess errors)
+Excess errors:
+/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/sh4-unknown-linux-gnu/bin/ld: cannot find -lthread
+collect2: ld returned 1 exit status
+
+Note that *any* program compiled with -pthread fails:
+
+/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/bin/sh4-unknown-linux-gnu-gcc hello.c -pthread
+/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/lib/gcc-lib/sh4-unknown-linux-gnu/3.3.1/../../../../sh4-unknown-linux-gnu/bin/ld: cannot find -lthread
+collect2: ld returned 1 exit status
+
+Compiling with -lpthread on the other hand works fine:
+/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/bin/sh4-unknown-linux-gnu-gcc hello.c -lpthread
+
+So -pthread is broken in some trivial way; it should invoke -lpthread, not -lthread,
+at least when targeting Linux.
+
+http://www.sh-linux.org/rpm-2003/SRPMS/gcc-3.2.3-3.src.rpm contains a jumbo patch,
+gcc-20030210-sh-linux-1.patch, that includes a fix for this. Here's the
+appropriate hunk (brings in a fix for the documented -mieee option).
+No idea if this fix is completely right, but it works for me...
+- dank@kegel.com 20 Jul 2003
+
+Index: linux.h
+===================================================================
+RCS file: /cvsroot/gcc/gcc/gcc/config/sh/linux.h,v
+retrieving revision 1.9.20.1
+diff -u -d -u -r1.9.20.1 linux.h
+--- gcc-ss-3_3-20030714/gcc/config/sh/linux.h.old 6 Jun 2003 02:30:59 -0000 1.9.20.1
++++ gcc-ss-3_3-20030714/gcc/config/sh/linux.h 20 Jul 2003 23:36:50 -0000
+@@ -59,7 +59,7 @@
+ #undef LIB_SPEC
+ #define LIB_SPEC \
+ "%{shared: -lc} \
+- %{!shared: %{pthread:-lthread} \
++ %{!shared: %{mieee:-lieee} %{pthread:-lpthread} \
+ %{profile:-lc_p} %{!profile: -lc}}"
+
+ #undef STARTFILE_SPEC
diff --git a/patches/gcc/3.3.1/thunk3.patch b/patches/gcc/3.3.1/thunk3.patch
new file mode 100644
index 0000000..7974a0c
--- /dev/null
+++ b/patches/gcc/3.3.1/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>
+