This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
dummy frame on stack and SPARC
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb at sources dot redhat dot com
- Date: Wed, 05 Mar 2003 14:47:14 -0500
- Subject: dummy frame on stack and SPARC
(thinking out loud)
The sparc architecture, when calling a struct return function has a
sequence like:
call struct_return_function, return address = pc + 8
nop
.word sizeof returned object
return_address:
... next instruction ....
That is, the return address is several instructions beyond the call
instruction and, more importantly, one of those "instructions" is an a
word to inform the callee of additional ABI information (from memory,
how much space the return structure needs).
When correctly implemeting sparc dummy calls, this behavior needs to be
implemented. Hence the call needs 2 words (the struct return size and
the breakpoint)instead of just one (the breakpoint) and the code dummy
no longer fits in _start. Conseqently, the SPARC, by default, pushes
the code dummy on the stack.
Problem is, this assumes that the target has an executable stack
(security?). As a consequence, the SPARC either:
- writes a two word code dummy onto the stack and correctly handls
struct return
- writes a one word code dummy into _start and fails when given a struct
return function
Instead of doing this, would it be possible to always write the code
dummy onto the stack and, when the stack isn't executable, recognize the
sigseg (?) as an attempt to return to the call dummy?
The only thing I'm not sure about is exactly when a SPARC will recognize
the segmentation violation and abort. It, thanks to the delayed branch
code, could be a cycle too early :-(
Andrew