Stack implementation
Aaron
anp1@cec.wustl.edu
Mon Jul 2 06:22:00 GMT 2001
> > > Where can I find the details of the stack implementation in gcc?
> >>
> >> (I'm interested in finding out the different components of each stack
> >> frame and how big they are.)
> >>
> >> Aaron
> >gcc/gcc/reg-stack.c
> >
> >Toshi
> I suspect not. I think he's asking about the call stack.
>
> The stack-frame is target-dependent and as such is primarily documented by the code in the target.h
> and target.c files. These parameterize the call-return, argument passing and automatic storage
> mechanisms on a per-target basis.
Aren't the target.h and target.c part of the g77 Fortran compiler and not
the C compiler?
> Typically, this would be documented by the machine/os ABI (if one exists).
>
> reg-stack.c implements the register-stack model used in x86 (or should I say x87?) floating
> point accelerator chips.
>
> If the port has a FUNCTION_PROLOGUE and FUNCTION_EPILOGUE macro, they will typically
> provide much information, as they are usually responsible for establishing the stack
> frame and allocating automatic storage. (Unless you're target is a CISC machine, and I don't
> think that there are any currently active ports that use complex function-call instructions
> any more. [Doesn't the VAX port use bsb instead of call instructions?]
>
> Al Lehotsky
I'm using a PentiumIII running Red Hat 7.1. (gcc 2.96-81). I'm looking to
understand how the memory is allocated on the call stack when a function
is called. I am specifically interested in finding the purpose, size, and
location of all the fields stored in each frame (parameters, stack
pointer?, return address, variables).
Aaron
More information about the Gcc-bugs
mailing list