This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] [ARC] Fix stack usage info for naked functions.
- From: Alexey Brodkin <Alexey dot Brodkin at synopsys dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Claudiu Zissulescu <Claudiu dot Zissulescu at synopsys dot com>, Alexey Brodkin <Alexey dot Brodkin at synopsys dot com>
- Date: Fri, 6 Apr 2018 19:02:29 +0300
- Subject: [PATCH] [ARC] Fix stack usage info for naked functions.
When code containing "naked" function gets compiled with '-fstack-usage'
compiler prints the following warning:
---------------------------------->8-----------------------------
board/synopsys/hsdk/hsdk.c: In function 'hsdk_core_init_f':
board/synopsys/hsdk/hsdk.c:345:1: warning: stack usage computation not supported for this target
}
^
---------------------------------->8-----------------------------
Even though stack calculation makes no sense for "naked" function
we still need to correctly report stack size back to make compiler
happy.
This problem was caught in U-Boot here:
https://lists.denx.de/pipermail/u-boot/2018-March/324325.html
The same fix was done earlier for ARM, see:
"config/arm/arm.c (arm_expand_prologue): Set the stack usage to 0 "
https://github.com/gcc-mirror/gcc/commit/023a7c5dd37
gcc/
2018-04-06 Alexey Brodkin <abrodkin@synopsys.com>
* config/arc/arc.c (arc_expand_prologue): Set stack usage info
also for naked functions.
---
gcc/config/arc/arc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 32fcb81880a2..3cb4ba5b4dd7 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -3149,7 +3149,11 @@ arc_expand_prologue (void)
/* Naked functions don't have prologue. */
if (ARC_NAKED_P (fn_type))
- return;
+ {
+ if (flag_stack_usage_info)
+ current_function_static_stack_size = 0;
+ return;
+ }
/* Compute total frame size. */
size = arc_compute_frame_size ();
--
2.14.3