[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Tue May 8 20:49:39 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/31ffb4589c7c
changeset: 480:31ffb4589c7c
user:      Aleksandr Rybalko <ray at ddteam.net>
date:      Tue May 08 23:49:09 2012 +0300
description:
Fix gcc to not fault on jemalloc build (import from FreeBSD)

diffstat:

 head/contrib/gcc/config/mips/mips.c |  28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diffs (53 lines):

diff -r bd5cc642bb16 -r 31ffb4589c7c head/contrib/gcc/config/mips/mips.c
--- a/head/contrib/gcc/config/mips/mips.c	Tue May 08 23:45:38 2012 +0300
+++ b/head/contrib/gcc/config/mips/mips.c	Tue May 08 23:49:09 2012 +0300
@@ -1297,6 +1297,20 @@
   *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, or to the same object_block.  */
@@ -1534,8 +1548,17 @@
       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);
 
@@ -5671,7 +5694,8 @@
   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.  */


More information about the Zrouter-src-freebsd mailing list