+2017-10-19 Nick Clifton <nickc@redhat.com>
+
+ 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.
+
2017-10-19 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* testsuite/gas/all/fill-1.s: Use normal labels. Change .text to
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. */
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;
(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);
else
bfd_putl16 ((bfd_vma) bin, frag);
- prev = bin;
+ frag_now->tc_frag_data.prev_opcode = bin;
*line = str;
return bin;
}
extern void avr_post_relax_hook (void);
#define HANDLE_ALIGN(fragP) avr_handle_align (fragP)
-extern void avr_handle_align (fragS *fragP);
+extern void avr_handle_align (fragS *);
struct avr_frag_data
{
char fill;
offsetT alignment;
+ unsigned int prev_opcode;
};
#define TC_FRAG_TYPE struct avr_frag_data
+#define TC_FRAG_INIT(frag) avr_frag_init (frag)
+extern void avr_frag_init (fragS *);
--- /dev/null
+#name: PR 21621 (correct generation of skip warnings)
+#as:
+#target: avr-*-*
+#error-output: pr21621.l
--- /dev/null
+[^:]*: Assembler messages:
+[^:]*:15: Warning: skipping two-word instruction
--- /dev/null
+
+.text
+ cpse 0,0
+.subsection 1
+ lds 0,0
+.previous
+ clc
+
+
+.text
+ cpse 1,1
+.subsection 1
+ sec
+.previous
+ lds 1,1