summaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorThiemo Seufer <ths@networkno.de>2003-10-19 21:50:43 +0000
committerThiemo Seufer <ths@networkno.de>2003-10-19 21:50:43 +0000
commit221d0e194808cee44ffc0c7d81f7e18cd132d4db (patch)
treee382721258ce211fd664547293faae1bf581c370 /gas/config
parent03a756af01765664b91c85739345349858185c73 (diff)
downloadbinutils-redhat-221d0e194808cee44ffc0c7d81f7e18cd132d4db.tar.gz
* config/tc-mips.c (normalize_constant_expr): New function to fix sign
extensions broken by gas' expression evaluation of constants. (check_absolute_expr): Use it. (mips_ip): Likewise.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-mips.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index a7767659e4..c34197223e 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -3329,6 +3329,14 @@ set_at (int *counter, int reg, int unsignedp)
}
}
+static void
+normalize_constant_expr (expressionS *ex)
+{
+ if (ex->X_op == O_constant && HAVE_32BIT_GPRS)
+ ex->X_add_number = (((ex->X_add_number & 0xffffffff) ^ 0x80000000)
+ - 0x80000000);
+}
+
/* Warn if an expression is not a constant. */
static void
@@ -3338,6 +3346,8 @@ check_absolute_expr (struct mips_cl_insn *ip, expressionS *ex)
as_bad (_("unsupported large constant"));
else if (ex->X_op != O_constant)
as_bad (_("Instruction %s requires absolute expression"), ip->insn_mo->name);
+
+ normalize_constant_expr (ex);
}
/* Count the leading zeroes by performing a binary chop. This is a
@@ -8562,6 +8572,7 @@ do_msbd:
if (imm2_expr.X_op != O_big
&& imm2_expr.X_op != O_constant)
insn_error = _("absolute expression required");
+ normalize_constant_expr (&imm2_expr);
s = expr_end;
continue;
@@ -9050,6 +9061,7 @@ do_msbd:
if (imm_expr.X_op != O_big
&& imm_expr.X_op != O_constant)
insn_error = _("absolute expression required");
+ normalize_constant_expr (&imm_expr);
s = expr_end;
continue;