diff mbox

[ARM] Fix bogus -fstack-usage warning on naked functions

Message ID 1484861.cdItfTZVga@polaris
State New
Headers show

Commit Message

Eric Botcazou May 16, 2016, 8:40 a.m. UTC
Hi,

-fstack-usage issues the "not supported by this target" warning on naked 
functions because the prologue routines do an early return for them.

Tested on arm-eabi, may I apply it on all active branches?


2016-05-16  Eric Botcazou  <ebotcazou@adacore.com>

	* config/arm/arm.c (arm_expand_prologue): Set the stack usage to 0
	for naked functions.
	(thumb1_expand_prologue): Likewise.

Comments

Kyrill Tkachov May 20, 2016, 2:01 p.m. UTC | #1
Hi Eric,

On 16/05/16 09:40, Eric Botcazou wrote:
> Hi,
>
> -fstack-usage issues the "not supported by this target" warning on naked
> functions because the prologue routines do an early return for them.
>
> Tested on arm-eabi, may I apply it on all active branches?
>
>
> 2016-05-16  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* config/arm/arm.c (arm_expand_prologue): Set the stack usage to 0
> 	for naked functions.
> 	(thumb1_expand_prologue): Likewise.
>

Ok.
Considering the use of current_function_static_stack_size in output_stack_usage
this definitely looks sensible and safe.

Thanks,
Kyrill
diff mbox

Patch

Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c	(revision 236264)
+++ config/arm/arm.c	(working copy)
@@ -21467,7 +21467,11 @@  arm_expand_prologue (void)
 
   /* Naked functions don't have prologues.  */
   if (IS_NAKED (func_type))
-    return;
+    {
+      if (flag_stack_usage_info)
+	current_function_static_stack_size = 0;
+      return;
+    }
 
   /* Make a copy of c_f_p_a_s as we may need to modify it locally.  */
   args_to_push = crtl->args.pretend_args_size;
@@ -24721,7 +24725,11 @@  thumb1_expand_prologue (void)
 
   /* Naked functions don't have prologues.  */
   if (IS_NAKED (func_type))
-    return;
+    {
+      if (flag_stack_usage_info)
+	current_function_static_stack_size = 0;
+      return;
+    }
 
   if (IS_INTERRUPT (func_type))
     {