This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: show size of stack needed by functions
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>
- Cc: gcc at gcc dot gnu dot org, Sebastian <sebastianspublicaddress at googlemail dot com>, Richard Guenther <richard dot guenther at gmail dot com>, Ian Lance Taylor <iant at google dot com>
- Date: Tue, 10 May 2016 09:40:42 +0200
- Subject: Re: show size of stack needed by functions
- Authentication-results: sourceware.org; auth=none
- References: <1287000338 dot 3466 dot 9 dot camel at svetz> <4381869 dot lFxcenRLCY at polaris> <87inymo2y8 dot fsf at atmel dot com>
> I'll take a look.
Thanks. The stack usage reported through current_function_static_stack_size
by the back-end must comprise the amount of stack from just before the call to
after the stack is established. For example on i386:
eric@polaris:> cat t.c
int main (void)
{
return 0;
}
eric@polaris:> gcc/xgcc -Bgcc -S t.c -m32 -fstack-usage -fomit-frame-pointer
eric@polaris:> cat t.s
.file "t.c"
.text
.align 2
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
movl $0, %eax
nop
ret
.cfi_endproc
.LFE0:
.size main, .-main
eric@polaris:> cat t.su
t.c:1:5:main 4 static
--
Eric Botcazou