Hi Guys, I am checking in the patch below to fix three small problems with the MSP430 backend:
Firstly interrupt handlers for the MSP430 cannot be static. Static interrupt handlers can be optimized away since no control flow path can be found to use them. Secondly there no longer is a default linker script called msp430.md provided by libgloss. Instead the default script built in to the linker should be used. (Or better, a MCU specific linker script). Finally a failure in the gcc testsuite - gcc.dg/pr47201.c - was being caused because gcc could not find a way to extract the low 16 bits of a 20 bit pointer. Adding a simple pattern to the machine description file fixes this. Cheers Nick gcc/ChangeLog 2016-05-25 Nick Clifton <ni...@redhat.com> * config/msp430/msp430.c (msp430_attr): Produce an error if a static interrupt handler is detected. * config/msp430/msp430.h (LIB_SPEC): Do not use msp430.ld as the default linker script. * config/msp430/msp430.md (movpsihi2_lo): New pattern for loading the low part of a symbolic pointer. Index: config/msp430/msp430.c =================================================================== --- config/msp430/msp430.c (revision 236703) +++ config/msp430/msp430.c (working copy) @@ -1832,6 +1832,7 @@ if (args != NULL) { + /* Only the interrupt attribute takes an argument. */ gcc_assert (TREE_NAME_EQ (name, ATTR_INTR)); tree value = TREE_VALUE (args); @@ -1878,6 +1879,9 @@ if (TREE_CODE (TREE_TYPE (* node)) == FUNCTION_TYPE && ! VOID_TYPE_P (TREE_TYPE (TREE_TYPE (* node)))) message = "interrupt handlers must be void"; + + if (! TREE_PUBLIC (* node)) + message = "interrupt handlers cannot be static"; } else if (TREE_NAME_EQ (name, ATTR_REENT)) { Index: config/msp430/msp430.h =================================================================== --- config/msp430/msp430.h (revision 236703) +++ config/msp430/msp430.h (working copy) @@ -98,7 +98,6 @@ %{!msim:-lnosys} \ --end-group \ %{!T*:%{!msim:%{mmcu=*:--script=%*.ld}}} \ -%{!T*:%{!msim:%{!mmcu=*:%Tmsp430.ld}}} \ %{!T*:%{msim:%{mlarge:%Tmsp430xl-sim.ld}%{!mlarge:%Tmsp430-sim.ld}}} \ " Index: config/msp430/msp430.md =================================================================== --- config/msp430/msp430.md (revision 236703) +++ config/msp430/msp430.md (working copy) @@ -267,6 +267,14 @@ "PUSH.W\t%H1 { PUSH.W\t%L1 { POPM.A #1, %0 ; Move reg-pair %L1:%H1 into pointer %0" ) +;; Produced when converting a pointer to an integer via a union, eg gcc.dg/pr47201.c. +(define_insn "*movpsihi2_lo" + [(set (match_operand:HI 0 "register_operand" "=r") + (subreg:HI (match_operand:PSI 1 "msp430_symbol_operand" "i") 0))] + "msp430x" + "MOVA\t%1, %0" +) + ;;------------------------------------------------------------ ;; Math