This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
About "STARTING_FRAME_OFFSET" definition
- From: redriver jiang <jiang dot redriver at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 23 Mar 2010 20:55:23 +0800
- Subject: About "STARTING_FRAME_OFFSET" definition
Hi all,
Can this "STARTING_FRAME_OFFSET" macro be defined to be a non-constant
value ( changes with the "current_function_args_size")?
As the target process has "FP+offset" with postive "offset"( stack
grows upward, and parameters in stack grows downward), for example,
call foo( arg1, arg2, arg3,arg4), after foo's prologue, the stack is like this:
<---- low address
|--------------------------------|
| Incoming arg4 | <-------------FP
|--------------------------------|
| Incoming arg3 |
|--------------------------------|
| Incoming arg2 |
|--------------------------------|
| Incoming arg1 | <---------------ARG
|--------------------------------|
| return PC of foo |
|--------------------------------|
| saved regs |
|--------------------------------|
| old FP |
|--------------------------------|
| local var0 |
|--------------------------------|
<---- high address
"STARTING_FRAME_OFFSET" means the offset between FP and the first
local variable, in this situation,
STARTING_FRAME_OFFSE = current_function_args_size+ size(PC in stack) +
size(saved regs) + size(old FP).
so, "STARTING_FRAME_OFFSET" depends on the
"current_function_args_size", which is a GCC internal variable.
Is this stack layout suitable?
Thanks!
redriver