x86 glue code: keep stack aligned.
The glue code pushed 12 bytes to the stack, breaking the 16-byte stack alignment requirement. This would be fixed by the main() prologue from gcc, but all "init" and "fini" code (static/global constructors/ destructors) would run with a misaligned stack. This was already fixed for x86_64 in hrev49731. Note that the fix here is slightly different, the pointer is realigned after it is saved to EBP and the function epilogue restores it from EBP, so no changes to crtn.S are needed.
This commit is contained in:
parent
9e53d4e91b
commit
6a028821b6
|
@ -23,6 +23,7 @@
|
|||
FUNCTION(_init):
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
sub $4,%esp // Keep stack aligned
|
||||
pushl 8(%ebp) // put image ID on the stack again
|
||||
call __haiku_init_before
|
||||
// crtbegin.o stuff comes here
|
||||
|
@ -31,6 +32,7 @@ FUNCTION(_init):
|
|||
FUNCTION(_fini):
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
sub $4,%esp // Keep stack aligned
|
||||
pushl 8(%ebp)
|
||||
call __haiku_term_before
|
||||
// crtend.o stuff comes here
|
||||
|
|
Loading…
Reference in New Issue