-fstack-usage raises a "stack usage computation not supported for this target" warning when it encounters a naked function because the prologue returns early for naked function on i386. This patch sets the stack usage to zero for naked function, following the fix done for Arm by Eric Botcazou:
https://gcc.gnu.org/pipermail/gcc-patches/2016-May/448258.html Bootstrapped and tested on x86_64-linux. If approved, I'll need a maintainer to commit on my behalf. Thanks, Pat Bernardi Senior Software Engineer, AdaCore 2020-10-29 Pat Bernardi <berna...@adacore.com> gcc/ChangeLog * config/i386/i386.c (ix86_expand_prologue): Set the stack usage to 0 for naked functions. --- gcc/config/i386/i386.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 0268d87f198..129fe6fa1eb 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -13197,7 +13197,11 @@ ix86_expand_prologue (void) rtx static_chain = NULL_RTX; if (ix86_function_naked (current_function_decl)) - return; + { + if (flag_stack_usage_info) + current_function_static_stack_size = 0; + return; + } ix86_finalize_stack_frame_flags ();