aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-04-06 15:57:19 +0100
committerNick Clifton <nickc@redhat.com>2016-04-06 15:58:30 +0100
commit927f2d25ef9d9dc35d6a4061d5504b0fc928f057 (patch)
tree73575d0b8a7c5fa9646b4670ecd066c2fa10069c /gas/config
parent052d2eb2545db0e052b45dd2e0ece82ebbe8a68c (diff)
downloadgdb-927f2d25ef9d9dc35d6a4061d5504b0fc928f057.zip
gdb-927f2d25ef9d9dc35d6a4061d5504b0fc928f057.tar.gz
gdb-927f2d25ef9d9dc35d6a4061d5504b0fc928f057.tar.bz2
Fix MSP430 assembler's detection of NOP and EINT.
* config/tc-msp430.c (msp430_operands): Check for a NOP preceding an EINT instruction. Warn/fix as necessary. * testsuite/gas/msp430/bad.s: Add test of EINT without preceding NOP. * testsuite/gas/msp430/bad.l: Update expected messages.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-msp430.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c
index 817ab45..f9df729 100644
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -2471,6 +2471,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
bfd_boolean addr_op;
const char * error_message;
static signed int repeat_count = 0;
+ static bfd_boolean prev_insn_is_nop = FALSE;
bfd_boolean fix_emitted;
/* Opcode is the one from opcodes table
@@ -2670,7 +2671,24 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
switch (opcode->insn_opnumb)
{
case 0:
- if (is_opcode ("eint") || is_opcode ("dint"))
+ if (is_opcode ("eint"))
+ {
+ if (! prev_insn_is_nop)
+ {
+ if (gen_interrupt_nops)
+ {
+ frag = frag_more (2);
+ bfd_putl16 ((bfd_vma) 0x4303 /* NOP */, frag);
+ dwarf2_emit_insn (2);
+
+ if (warn_interrupt_nops)
+ as_warn (_("inserting a NOP before EINT"));
+ }
+ else if (warn_interrupt_nops)
+ as_warn (_("a NOP might be needed before the EINT"));
+ }
+ }
+ else if (is_opcode ("dint"))
check_for_nop |= NOP_CHECK_INTERRUPT;
/* Set/clear bits instructions. */
@@ -3857,6 +3875,11 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
as_bad (_("Illegal instruction or not implemented opcode."));
}
+ if (is_opcode ("nop"))
+ prev_insn_is_nop = TRUE;
+ else
+ prev_insn_is_nop = FALSE;
+
input_line_pointer = line;
return 0;
}