Unwinding CFI gcc practice of assumed `same value' regs
Ian Lance Taylor
iant@google.com
Tue Dec 12 16:55:00 GMT 2006
Andrew Haley <aph@redhat.com> writes:
> In practice, %ebp either points to a call frame -- not necessarily the
> most recent one -- or is null. I don't think that having an optional
> frame pointer mees you can use %ebp for anything random at all, but we
> need to make a clarification request of the ABI.
I don't see that as feasible. If %ebp/%rbp may be used as a general
callee-saved register, then it can hold any value. And permitting
%ebp/%rbp to hold any value is a very useful optimization in a
function which does not require a frame pointer, since it gives the
compiler an extra register to use.
If you want to require %ebp/%rbp to hold a non-zero value, then you
are effectively saying that this optimization is forbidden. There is
no meaningful way to tell gcc "this is a general register, but you may
not store zero in it." It would be a poor tradeoff to forbid that
optimization in order to provide better support for exception
handling: exception handling is supposed to be unusual.
Ian
More information about the Gdb
mailing list