diff options
author | Nick Clifton <nickc@redhat.com> | 2017-10-19 16:21:51 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-10-19 16:21:51 +0100 |
commit | 95e42ad4425f0ab0ebfb90035a891be576f9fca4 (patch) | |
tree | 4f9234a3fcdc5a4c40c49dc8e50a27d09b7edc8c /gas/config/tc-avr.c | |
parent | a75868f50ba72e9aa906702ae038fa29feda7743 (diff) | |
download | gdb-95e42ad4425f0ab0ebfb90035a891be576f9fca4.zip gdb-95e42ad4425f0ab0ebfb90035a891be576f9fca4.tar.gz gdb-95e42ad4425f0ab0ebfb90035a891be576f9fca4.tar.bz2 |
Fix the AVR assembler so that it will correctly issue warnings about skipped instructions even if subsections are used.
PR 21621
* config/tc-avr.h (struct avr_frag_data): Add prev_opcode field.
(TC_FRAG_INIT): Define.
(avr_frag_init): Add prototype.
* config/tc-avr.c (avr_frag_init): New function.
(avr_operands): Replace static local 'prev' variable with
prev_opcode field in current frag.
* testsuite/gas/avr/pr21621.s: New test source file.
* testsuite/gas/avr/pr21621.d: New test driver file.
* testsuite/gas/avr/pr21621.s: New test error output file.
Diffstat (limited to 'gas/config/tc-avr.c')
-rw-r--r-- | gas/config/tc-avr.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index 067657b..51f1b93 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -1326,6 +1326,15 @@ avr_operand (struct avr_opcodes_s *opcode, return op_mask; } +/* TC_FRAG_INIT hook */ + +void +avr_frag_init (fragS *frag) +{ + memset (& frag->tc_frag_data, 0, sizeof frag->tc_frag_data); +} + + /* Parse instruction operands. Return binary opcode. */ @@ -1337,7 +1346,6 @@ avr_operands (struct avr_opcodes_s *opcode, char **line) char *frag = frag_more (opcode->insn_size * 2); char *str = *line; int where = frag - frag_now->fr_literal; - static unsigned int prev = 0; /* Previous opcode. */ int regno1 = -2; int regno2 = -2; @@ -1403,7 +1411,7 @@ avr_operands (struct avr_opcodes_s *opcode, char **line) (AVR core bug, fixed in the newer devices). */ if (!(avr_opt.no_skip_bug || (avr_mcu->isa & (AVR_ISA_MUL | AVR_ISA_MOVW))) - && AVR_SKIP_P (prev)) + && AVR_SKIP_P (frag_now->tc_frag_data.prev_opcode)) as_warn (_("skipping two-word instruction")); bfd_putl32 ((bfd_vma) bin, frag); @@ -1411,7 +1419,7 @@ avr_operands (struct avr_opcodes_s *opcode, char **line) else bfd_putl16 ((bfd_vma) bin, frag); - prev = bin; + frag_now->tc_frag_data.prev_opcode = bin; *line = str; return bin; } |