This patch enhances the MSP430 port of GAS so that, if requested, it will

generate warning messages about an instruction that changes the interrupt
state not being followed by a NOP instruction.

	* config/msp430/msp430.c: Replace known mcu array with known
	msp430 ISA mcu name array.
	Accept any name for -mmcu option.
	Add -mz option to warn about missing NOP following an interrupt
	status change.
	(check_for_nop): New.
	(msp430_operands): Emit a warning, if requested, when an interrupt
	changing instruction is not followed by a NOP.
	* doc/c-msp430.c: Document -mz option.

	* gas/msp430/bad.d: Add -mz option.
	* gas/msp430/bad.s: Add more cases where warnings should be
	generated.
	* gas/msp430/bad.l: Add expected warning messages.
This commit is contained in:
Nick Clifton 2014-03-03 17:27:55 +00:00
parent c1a3e85c37
commit 65d7bab591
8 changed files with 295 additions and 582 deletions

View File

@ -1,3 +1,15 @@
2014-03-03 Nick Clifton <nickc@redhat.com>
* config/msp430/msp430.c: Replace known mcu array with known
msp430 ISA mcu name array.
Accept any name for -mmcu option.
Add -mz option to warn about missing NOP following an interrupt
status change.
(check_for_nop): New.
(msp430_operands): Emit a warning, if requested, when an interrupt
changing instruction is not followed by a NOP.
* doc/c-msp430.c: Document -mz option.
2014-03-03 Alan Modra <amodra@gmail.com>
* config/bfin-lex-wrapper.c: Correct copyright date.

File diff suppressed because it is too large Load Diff

View File

@ -124,7 +124,6 @@ extern int msp430_force_relocation_local (struct fix *);
#define tc_frob_section(sec) msp430_frob_section (sec)
extern void msp430_frob_section (asection *);
extern int msp430_enable_relax;
extern int msp430_enable_polys;

View File

@ -1,4 +1,4 @@
@c Copyright 2002-2013 Free Software Foundation, Inc.
@c Copyright 2002-2014 Free Software Foundation, Inc.
@c This is part of the GAS manual.
@c For copying conditions, see the file as.texinfo.
@ifset GENERIC
@ -29,13 +29,12 @@
@table @code
@item -mmcu
selects the mpu arch. If the architecture is 430Xv2 then this also
enables NOP generation unless the @option{-mN} is also specified.
selects the mcu architecture. If the architecture is 430Xv2 then this
also enables NOP generation unless the @option{-mN} is also specified.
@item -mcpu
selects the cpu architecture. If the architecture is 430Xv2 then this
also enables NOP generation unless the @option{-mN} is also
specified.
also enables NOP generation unless the @option{-mN} is also specified.
@item -mP
enables polymorph instructions handler.
@ -55,17 +54,25 @@ SR}, @code{BIS #8, SR} or @code{MOV.W <>, SR}) must be
followed by a NOP instruction in order to ensure the correct
processing of interrupts. By default it is up to the programmer to
supply these NOP instructions, but this command line option enables
the automatic insertion by the assembler. Note - the assembler does
not peek ahead to the next instruction so it will insert a NOP even
one is already present.
the automatic insertion by the assembler, if they are missing.
@c end-sanitize-msp430
@c %redact note changed text for mN option
@item -mN
disables the generation of a NOP instruction following any instruction
that might change the interrupts enabled/disabled state. This is the
default behaviour.
@item -mz
tells the assembler to generate a warning message if a NOP does not
immediately forllow an instruction that enables or disables
interrupts. This is the default.
Note that this option can be stacked with the @option{-mn} option so
that the assembler will both warn about missing NOP instructions and
then insert them automatically.
@item -mZ
disables warnings about missing NOP instructions.
@item -md
mark the object file as one that requires data to copied from ROM to
RAM at execution startup. Disabled by default.

View File

@ -1,3 +1,10 @@
2014-03-03 Nick Clifton <nickc@redhat.com>
* gas/msp430/bad.d: Add -mz option.
* gas/msp430/bad.s: Add more cases where warnings should be
generated.
* gas/msp430/bad.l: Add expected warning messages.
2014-02-27 Jiong Wang <jiong.wang@arm.com>
* gas/aarch64/fp-const0-parsing.s: New test.

View File

@ -1,3 +1,4 @@
#name: Diagnostics Quality
#source: bad.s
#as: -mz
#error-output: bad.l

View File

@ -5,3 +5,10 @@
[^:]*:9: Error: junk found after instruction: mov.cd r1,r2
[^:]*:10: Warning: no size modifier after period, .w assumed
[^:]*:11: Error: instruction bis.a does not exist
[^:]*:19: Warning: a NOP might be needed here because of successive changes in interrupt state
[^:]*:20: Warning: a NOP might be needed here because of successive changes in interrupt state
[^:]*:25: Warning: a NOP might be needed here because of successive changes in interrupt state
[^:]*:26: Warning: a NOP might be needed here because of successive changes in interrupt state
[^:]*:27: Warning: a NOP might be needed here because of successive changes in interrupt state
[^:]*:28: Warning: a NOP might be needed here because of successive changes in interrupt state
[^:]*: Warning: assembly finished with the last instruction changing interrupt state - a NOP might be needed

View File

@ -11,3 +11,21 @@
bis.a #8, r2
;;; FIXME: Add more tests of assembler error detection here.
;; Changing interrupt states in two successive instructions
;; might cause an interrupt to be missed. The assembler
;; should warn about this, if the -mz command line option
;; is used.
eint
dint
nop ;; No warning needed here.
dint
and #1, r11 ;; Any instruction will do, not just NOPs.
clr r2 ;; Aliases should trigger the warning too.
mov #1, r2
BIC #8, SR
BIS #8, SR
MOV.W #1, SR
;; We will also get a warning if the last instruction in the file
;; changes the interrupt state, since this file could be linked
;; with another that starts with an interrupt change.