summaryrefslogtreecommitdiff
path: root/patches/gcc/3.3.6
diff options
context:
space:
mode:
Diffstat (limited to 'patches/gcc/3.3.6')
-rw-r--r--patches/gcc/3.3.6/fix-fixincl.patch70
-rw-r--r--patches/gcc/3.3.6/gcc-3.3.4-arm-bigendian.patch62
-rw-r--r--patches/gcc/3.3.6/gcc-3.3.4-arm-pr22528.patch71
3 files changed, 203 insertions, 0 deletions
diff --git a/patches/gcc/3.3.6/fix-fixincl.patch b/patches/gcc/3.3.6/fix-fixincl.patch
new file mode 100644
index 0000000..7936b19
--- /dev/null
+++ b/patches/gcc/3.3.6/fix-fixincl.patch
@@ -0,0 +1,70 @@
+See http://gcc.gnu.org/PR22541
+
+From: Dan Kegel
+
+When building gcc-3.4.3 or gcc-4.0.0 as a cross into a clean $PREFIX
+(the only two I've tried like this), the configure script happily copies
+the glibc include files from include to sys-include; here's the line
+from the log file (with $PREFIX instead of the real prefix):
+
+Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include
+
+But later, when running fixincludes, it gives the error message
+ The directory that should contain system headers does not exist:
+ $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include
+
+Nevertheless, it continues building; the header files it installs in
+ $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include
+do not include the boilerplate that would cause it to #include_next the
+glibc headers in the system header directory.
+Thus the resulting toolchain can't compile the following program:
+#include <limits.h>
+int x = PATH_MAX;
+because its limits.h doesn't include the glibc header.
+
+That's not nice. I suspect the problem is that gcc/Makefile.in assumes that
+it can refer to $PREFIX/i686-unknown-linux-gnu with the path
+ $PREFIX/lib/../i686-unknown-linux-gnu, but
+that fails because the directory $PREFIX/lib doesn't exist during 'make all';
+it is only created later, during 'make install'. (Which makes this problem
+confusing, since one only notices the breakage well after 'make install',
+at which point the path configure complained about does exist, and has the
+right stuff in it.)
+
+A possible fix is to replace the line in gcc/Makefile.in that says
+ SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
+with a version that gets rid of extra ..'s, e.g.
+ SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"`
+(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq
+for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.)
+
+
+--- gcc-3.4.3/gcc/Makefile.in.foo 2005-05-20 11:41:39.000000000 -0700
++++ gcc-3.4.3/gcc/Makefile.in 2005-05-20 12:08:46.000000000 -0700
+@@ -350,7 +350,10 @@
+ CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+
+ # autoconf sets SYSTEM_HEADER_DIR to one of the above.
+-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
++# Purge it of unneccessary internal relative paths
++# to directories that might not exist yet.
++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta.
++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`
+
+ # Control whether to run fixproto and fixincludes.
+ STMP_FIXPROTO = @STMP_FIXPROTO@
+@@ -2532,11 +2535,13 @@
+ $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir)
+
+ # Build fixed copies of system files.
++# Abort if no system headers available, unless building a crosscompiler.
++# FIXME: abort unless building --without-headers would be more accurate and less ugly
+ stmp-fixinc: fixinc.sh gsyslimits.h
+ @if test ! -d ${SYSTEM_HEADER_DIR}; then \
+ echo The directory that should contain system headers does not exist: >&2 ; \
+ echo " ${SYSTEM_HEADER_DIR}" >&2 ; \
+- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \
++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \
+ then sleep 1; else exit 1; fi; \
+ fi
+ rm -rf include; mkdir include
diff --git a/patches/gcc/3.3.6/gcc-3.3.4-arm-bigendian.patch b/patches/gcc/3.3.6/gcc-3.3.4-arm-bigendian.patch
new file mode 100644
index 0000000..0816b83
--- /dev/null
+++ b/patches/gcc/3.3.6/gcc-3.3.4-arm-bigendian.patch
@@ -0,0 +1,62 @@
+diff -urN gcc-3.3.4.orig/gcc/config/arm/linux-elf.h gcc-3.3.4/gcc/config/arm/linux-elf.h
+--- gcc-3.3.4.orig/gcc/config/arm/linux-elf.h 2004-03-30 22:43:45.000000000 +0200
++++ gcc-3.3.4/gcc/config/arm/linux-elf.h 2004-08-20 02:13:02.969084177 +0200
+@@ -30,17 +30,31 @@
+ /* 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_CPU_DEFAULT TARGET_CPU_arm6
+
+-#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__"
+
+@@ -88,7 +102,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.4.orig/gcc/config.gcc gcc-3.3.4/gcc/config.gcc
+--- gcc-3.3.4.orig/gcc/config.gcc 2004-04-29 06:42:47.000000000 +0200
++++ gcc-3.3.4/gcc/config.gcc 2004-08-20 02:11:04.326143343 +0200
+@@ -699,6 +699,11 @@
+ ;;
+ arm*-*-linux*) # ARM GNU/Linux with ELF
+ tm_file="dbxelf.h elfos.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.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.6/gcc-3.3.4-arm-pr22528.patch b/patches/gcc/3.3.6/gcc-3.3.4-arm-pr22528.patch
new file mode 100644
index 0000000..0611e2c
--- /dev/null
+++ b/patches/gcc/3.3.6/gcc-3.3.4-arm-pr22528.patch
@@ -0,0 +1,71 @@
+From http://gcc.gnu.org/ml/gcc-patches/2003-11/msg00832.html, by
+Richard Earnshaw. Fixes http://gcc.gnu.org/PR22528
+
+--- gcc-3.3.4/gcc/config/arm/arm.md.orig 2004-03-30 22:43:44.000000000 +0200
++++ gcc-3.3.4/gcc/config/arm/arm.md 2005-08-15 12:21:55.000000000 +0200
+@@ -4275,7 +4275,7 @@
+ (set (match_dup 2)
+ (ashiftrt:SI (match_operand 0 "" "") (const_int 8)))
+ ;; store the high byte
+- (set (match_dup 4) (subreg:QI (match_dup 2) 0))] ;explicit subreg safe
++ (set (match_dup 4) (match_dup 5))]
+ "TARGET_ARM"
+ "
+ {
+@@ -4291,7 +4291,8 @@
+ operands[1] = adjust_address (operands[1], QImode, 0);
+ operands[3] = gen_lowpart (QImode, operands[0]);
+ operands[0] = gen_lowpart (SImode, operands[0]);
+- operands[2] = gen_reg_rtx (SImode);
++ operands[2] = gen_reg_rtx (SImode);
++ operands[5] = gen_lowpart (QImode, operands[2]);
+ }"
+ )
+
+@@ -4299,7 +4300,7 @@
+ [(set (match_dup 4) (match_dup 3))
+ (set (match_dup 2)
+ (ashiftrt:SI (match_operand 0 "" "") (const_int 8)))
+- (set (match_operand 1 "" "") (subreg:QI (match_dup 2) 3))]
++ (set (match_operand 1 "" "") (match_dup 5))]
+ "TARGET_ARM"
+ "
+ {
+@@ -4316,13 +4317,14 @@
+ operands[3] = gen_lowpart (QImode, operands[0]);
+ operands[0] = gen_lowpart (SImode, operands[0]);
+ operands[2] = gen_reg_rtx (SImode);
++ operands[5] = gen_lowpart (QImode, operands[2]);
+ }"
+ )
+
+ ;; Subroutine to store a half word integer constant into memory.
+ (define_expand "storeinthi"
+ [(set (match_operand 0 "" "")
+- (subreg:QI (match_operand 1 "" "") 0))
++ (match_operand 1 "" ""))
+ (set (match_dup 3) (match_dup 2))]
+ "TARGET_ARM"
+ "
+@@ -4363,6 +4365,7 @@
+ operands[3] = adjust_address (op0, QImode, 1);
+ operands[0] = adjust_address (operands[0], QImode, 0);
+ operands[2] = gen_lowpart (QImode, operands[2]);
++ operands[1] = gen_lowpart (QImode, operands[1]);
+ }"
+ )
+
+@@ -4682,11 +4685,12 @@
+ (set (match_dup 3)
+ (ashiftrt:SI (match_dup 2) (const_int 16)))
+ (set (match_operand:HI 0 "s_register_operand" "")
+- (subreg:HI (match_dup 3) 0))]
++ (match_dup 4))]
+ "TARGET_ARM"
+ "
+ operands[2] = gen_reg_rtx (SImode);
+ operands[3] = gen_reg_rtx (SImode);
++ operands[4] = gen_lowpart (HImode, operands[3]);
+ "
+ )
+