aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-arm.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-06-30 13:42:46 +0000
committerNick Clifton <nickc@redhat.com>2011-06-30 13:42:46 +0000
commit5f4cb1986d38875f7541b53e41ae7fb1e7460f14 (patch)
treee8a4257e783817c6b4ee9578b7b3d04a3bfdcf9d /gas/config/tc-arm.c
parent68246214dfc90b41caecb381289368dbecfcafbe (diff)
downloadgdb-5f4cb1986d38875f7541b53e41ae7fb1e7460f14.zip
gdb-5f4cb1986d38875f7541b53e41ae7fb1e7460f14.tar.gz
gdb-5f4cb1986d38875f7541b53e41ae7fb1e7460f14.tar.bz2
* gas/arm/addthumb2err.s: New test file.
* gas/arm/addthumb2err.d: Test control file. * gas/arm/addthumb2err.l: Expected error messages. * config/tc-arm.c (do_t_add_sub): Only allow LSL shifts of less than 4 in Thumb mode.
Diffstat (limited to 'gas/config/tc-arm.c')
-rw-r--r--gas/config/tc-arm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index fca5483..1592322 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -9474,6 +9474,9 @@ do_t_add_sub (void)
}
else
{
+ unsigned int value = inst.reloc.exp.X_add_number;
+ unsigned int shift = inst.operands[2].shift_kind;
+
Rn = inst.operands[2].reg;
/* See if we can do this with a 16-bit instruction. */
if (!inst.operands[2].shifted && inst.size_req != 4)
@@ -9524,6 +9527,10 @@ do_t_add_sub (void)
inst.instruction = THUMB_OP32 (inst.instruction);
inst.instruction |= Rd << 8;
inst.instruction |= Rs << 16;
+ constraint (Rd == REG_SP && Rs == REG_SP && value > 3,
+ _("shift value over 3 not allowed in thumb mode"));
+ constraint (Rd == REG_SP && Rs == REG_SP && shift != SHIFT_LSL,
+ _("only LSL shift allowed in thumb mode"));
encode_thumb32_shifted_operand (2);
}
}