]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/42240 (wrong epilogue on naked function)
authorDenis Chertykov <chertykov@gmail.com>
Thu, 3 Mar 2011 16:58:26 +0000 (19:58 +0300)
committerDenis Chertykov <denisc@gcc.gnu.org>
Thu, 3 Mar 2011 16:58:26 +0000 (19:58 +0300)
Backport from mainline
2011-02-22  Georg-Johann Lay  <avr@gjlay.de>

PR target/42240
* config/avr/avr.c (avr_cannot_modify_jumps_p): New function.
(TARGET_CANNOT_MODIFY_JUMPS_P): Define.

From-SVN: r170657

gcc/ChangeLog
gcc/config/avr/avr.c

index 7c82dbade2edd2492cf638706f25721a9ae329d2..2013cf352e0fe840a51a32b326023d3d63e4cd7d 100644 (file)
@@ -1,3 +1,12 @@
+2011-03-03  Denis Chertykov <chertykov@gmail.com>
+
+       Backport from mainline
+       2011-02-22  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR target/42240
+       * config/avr/avr.c (avr_cannot_modify_jumps_p): New function.
+       (TARGET_CANNOT_MODIFY_JUMPS_P): Define.
+
 2011-03-03  Richard Guenther  <rguenther@suse.de>
 
        * tree-vect-stmt.c (vectorizable_operation): Remove unused vars.
index 1e22f15c1fb41c65cb9a8e4df4a13b1876bb5d7a..639c770e8a8a0a09ab7bc2d0065d3393869f300e 100644 (file)
@@ -73,6 +73,7 @@ static void avr_file_end (void);
 static bool avr_legitimate_address_p (enum machine_mode, rtx, bool);
 static void avr_asm_function_end_prologue (FILE *);
 static void avr_asm_function_begin_epilogue (FILE *);
+static bool avr_cannot_modify_jumps_p (void);
 static rtx avr_function_value (const_tree, const_tree, bool);
 static void avr_insert_attributes (tree, tree *);
 static void avr_asm_init_sections (void);
@@ -196,6 +197,9 @@ static const struct attribute_spec avr_attribute_table[] =
 #undef TARGET_HELP
 #define TARGET_HELP avr_help
 
+#undef TARGET_CANNOT_MODIFY_JUMPS_P
+#define TARGET_CANNOT_MODIFY_JUMPS_P avr_cannot_modify_jumps_p
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 void
@@ -991,6 +995,27 @@ avr_asm_function_begin_epilogue (FILE *file)
   fprintf (file, "/* epilogue start */\n");
 }
 
+
+/* Implement TARGET_CANNOT_MODITY_JUMPS_P */
+
+static bool
+avr_cannot_modify_jumps_p (void)
+{
+
+  /* Naked Functions must not have any instructions after
+     their epilogue, see PR42240 */
+     
+  if (reload_completed
+      && cfun->machine
+      && cfun->machine->is_naked)
+    {
+      return true;
+    }
+
+  return false;
+}
+
+
 /* Return nonzero if X (an RTX) is a legitimate memory address on the target
    machine for a memory operand of mode MODE.  */