This is the mail archive of the
mailing list for the GCC project.
builtin_frame_address for stack pointer
- From: skaller <skaller at users dot sourceforge dot net>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 23 Oct 2007 12:28:07 +1000
- Subject: builtin_frame_address for stack pointer
hi, I have some code using __builtin_frame_address(0) to get
the current stack pointer in a 'portable' way.
Unfortunately, this appears not to work if -fomit-frame-pointer
is used on an x86. My system sets that automatically, since
the x86 is a bit short on registers and this is reputed
to help with optimisation.
This leaves one having to do processor dependent register
hackery to find the stack pointer. [I need a stack pointer
approximation to find roots for a garbage collector]
Is there another way? If not, I think to submit a bug report
with 'feature request' status, to have a way to get the stack
pointer that works even if -fomit-frame-pointer is specified.
Any comments? Is it a reasonable request?
BTW: what happens on ia64 which has two? stacks?
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net