aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain/gcc
diff options
context:
space:
mode:
authorNicolas Thill <nico@openwrt.org>2009-10-11 02:52:08 +0000
committerNicolas Thill <nico@openwrt.org>2009-10-11 02:52:08 +0000
commit57ca4f4f295e7daef8b3cebcba544597b64b2bba (patch)
treedf717ce8b5aaf2829f2f94c3c18ed3bc4c399036 /toolchain/gcc
parentb83fd240a23033695eb441ebe443e1f3ff3ba319 (diff)
downloadupstream-57ca4f4f295e7daef8b3cebcba544597b64b2bba.tar.gz
upstream-57ca4f4f295e7daef8b3cebcba544597b64b2bba.tar.bz2
upstream-57ca4f4f295e7daef8b3cebcba544597b64b2bba.zip
[toolchain] gcc: fix 4.1.2 ICE on mips (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33256)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18029 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'toolchain/gcc')
-rw-r--r--toolchain/gcc/patches/4.1.2/953-bug_33256.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/toolchain/gcc/patches/4.1.2/953-bug_33256.patch b/toolchain/gcc/patches/4.1.2/953-bug_33256.patch
new file mode 100644
index 0000000000..6388e47b0a
--- /dev/null
+++ b/toolchain/gcc/patches/4.1.2/953-bug_33256.patch
@@ -0,0 +1,54 @@
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33256
+
+--- a/gcc/config/mips/mips.c
++++ b/gcc/config/mips/mips.c
+@@ -1252,6 +1252,20 @@ mips_split_const (rtx x, rtx *base, HOST
+ *base = x;
+ }
+
++/* Classify symbolic expression X, given that it appears in context
++ CONTEXT. */
++
++static enum mips_symbol_type
++mips_classify_symbolic_expression (rtx x)
++{
++ HOST_WIDE_INT offset;
++
++ mips_split_const (x, &x, &offset);
++ if (UNSPEC_ADDRESS_P (x))
++ return UNSPEC_ADDRESS_TYPE (x);
++
++ return mips_classify_symbol (x);
++}
+
+ /* Return true if SYMBOL is a SYMBOL_REF and OFFSET + SYMBOL points
+ to the same object as SYMBOL. */
+@@ -1493,8 +1507,17 @@ mips_classify_address (struct mips_addre
+ info->type = ADDRESS_LO_SUM;
+ info->reg = XEXP (x, 0);
+ info->offset = XEXP (x, 1);
++ /* We have to trust the creator of the LO_SUM to do something vaguely
++ sane. Target-independent code that creates a LO_SUM should also
++ create and verify the matching HIGH. Target-independent code that
++ adds an offset to a LO_SUM must prove that the offset will not
++ induce a carry. Failure to do either of these things would be
++ a bug, and we are not required to check for it here. The MIPS
++ backend itself should only create LO_SUMs for valid symbolic
++ constants, with the high part being either a HIGH or a copy
++ of _gp. */
++ info->symbol_type = mips_classify_symbolic_expression (info->offset);
+ return (mips_valid_base_register_p (info->reg, mode, strict)
+- && mips_symbolic_constant_p (info->offset, &info->symbol_type)
+ && mips_symbolic_address_p (info->symbol_type, mode)
+ && mips_lo_relocs[info->symbol_type] != 0);
+
+@@ -5575,7 +5598,8 @@ print_operand_reloc (FILE *file, rtx op,
+ rtx base;
+ HOST_WIDE_INT offset;
+
+- if (!mips_symbolic_constant_p (op, &symbol_type) || relocs[symbol_type] == 0)
++ symbol_type = mips_classify_symbolic_expression (op);
++ if (relocs[symbol_type] == 0)
+ fatal_insn ("PRINT_OPERAND, invalid operand for relocation", op);
+
+ /* If OP uses an UNSPEC address, we want to print the inner symbol. */