re PR target/70713 (msp430 interrupt attribute prevents overriding weak symbols)
authorJoe Seymour <joe.s@somniumtech.com>
Tue, 13 Sep 2016 20:06:47 +0000 (20:06 +0000)
committerDJ Delorie <dj@gcc.gnu.org>
Tue, 13 Sep 2016 20:06:47 +0000 (16:06 -0400)
2016-09-13  Joe Seymour  <joe.s@somniumtech.com>

gcc/
PR target/70713
* config/msp430/msp430.c (msp430_start_function): Emit an error
if a function is both weak and specifies an interrupt number.

gcc/testsuite/
PR target/70713
* gcc.target/msp430/function-attributes-1.c: New test.
* gcc.target/msp430/function-attributes-2.c: New test.
* gcc.target/msp430/function-attributes-3.c: New test.

From-SVN: r240123

gcc/ChangeLog
gcc/config/msp430/msp430.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/msp430/function-attributes-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/msp430/function-attributes-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/msp430/function-attributes-3.c [new file with mode: 0644]

index 82034a9..ef690e4 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-13  Joe Seymour  <joe.s@somniumtech.com>
+
+       PR target/70713
+       * config/msp430/msp430.c (msp430_start_function): Emit an error
+       if a function is both weak and specifies an interrupt number.
+
 2016-09-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/77454
index dba4d19..c40d2da 100644 (file)
@@ -2108,6 +2108,13 @@ msp430_start_function (FILE *file, const char *name, tree decl)
        {
          char buf[101];
 
+         /* Interrupt vector sections should be unique, but use of weak
+            functions implies multiple definitions.  */
+         if (DECL_WEAK (decl))
+           {
+             error ("argument to interrupt attribute is unsupported for weak functions");
+           }
+
          intr_vector = TREE_VALUE (intr_vector);
 
          /* The interrupt attribute has a vector value.  Turn this into a
index 779145a..39de996 100644 (file)
@@ -1,3 +1,10 @@
+2016-09-13  Joe Seymour  <joe.s@somniumtech.com>
+
+       PR target/70713
+       * gcc.target/msp430/function-attributes-1.c: New test.
+       * gcc.target/msp430/function-attributes-2.c: New test.
+       * gcc.target/msp430/function-attributes-3.c: New test.
+
 2016-09-13  Jakub Jelinek  <jakub@redhat.com>
 
        * g++.dg/cpp0x/gen-attrs-61.C: New test.
diff --git a/gcc/testsuite/gcc.target/msp430/function-attributes-1.c b/gcc/testsuite/gcc.target/msp430/function-attributes-1.c
new file mode 100644 (file)
index 0000000..7a3b7be
--- /dev/null
@@ -0,0 +1,9 @@
+void __attribute__((weak, interrupt))
+weak_interrupt (void) {
+}
+
+void __attribute__((interrupt(11)))
+interrupt_number (void) {
+}
+
+/* { dg-final { scan-assembler-times "__interrupt_vector_" 1 } } */
diff --git a/gcc/testsuite/gcc.target/msp430/function-attributes-2.c b/gcc/testsuite/gcc.target/msp430/function-attributes-2.c
new file mode 100644 (file)
index 0000000..fcb2fb2
--- /dev/null
@@ -0,0 +1,3 @@
+void __attribute__((weak, interrupt(10)))
+weak_interrupt_number (void) {
+} /* { dg-error "argument to interrupt attribute is unsupported for weak functions" } */
diff --git a/gcc/testsuite/gcc.target/msp430/function-attributes-3.c b/gcc/testsuite/gcc.target/msp430/function-attributes-3.c
new file mode 100644 (file)
index 0000000..b0acf4a
--- /dev/null
@@ -0,0 +1,3 @@
+void __attribute__((interrupt("nmi"))) __attribute__((weak))
+interrupt_name_weak (void) {
+} /* { dg-error "argument to interrupt attribute is unsupported for weak functions" } */