GCC option to control function call epilogue
Chaoran Yang
chaoran@rice.edu
Mon Dec 8 20:08:00 GMT 2014
Hi all,
Currently GCC may generate two kinds of function call epilogue when -fno-omit-frame-pointer is used. When no optimization is turned on, GCC generate epilogue like this:
mov bp, sp (or lea 0x10(bp), sp, 0x10 is space for callee saved registers)
pop bp
ret
When optimization is turned on, like -O2, and stack frame size is known at compile time, GCC generates epilogue like this:
add 0x80, sp (0x80 is the size of space for local variables)
pop bp
ret
For some reason (details omitted for brevity), I need GCC to always generate the first kind of epilogue for some functions, where the sp is updated through bp, rather than through an offset to itself. (basically, I need to modify sp, so add 0x80, sp is no longer valid, but mov bp, sp still is).
I’d like to know whether GCC has an option to control this behavior, even with optimization such as -O2 is used.
Thanks,
Chaoran
More information about the Gcc-help
mailing list