diff --git a/lib/csu/i386/crti.S b/lib/csu/i386/crti.S --- a/lib/csu/i386/crti.S +++ b/lib/csu/i386/crti.S @@ -31,13 +31,17 @@ .globl _init .type _init,@function _init: - sub $12,%esp /* re-align stack pointer */ + pushl %ebp + movl %esp,%ebp + subl $8,%esp /* re-align stack pointer */ .section .fini,"ax",@progbits .align 4 .globl _fini .type _fini,@function _fini: - sub $12,%esp /* re-align stack pointer */ + pushl %ebp + movl %esp,%ebp + subl $8,%esp /* re-align stack pointer */ .section .note.GNU-stack,"",%progbits diff --git a/lib/csu/i386/crtn.S b/lib/csu/i386/crtn.S --- a/lib/csu/i386/crtn.S +++ b/lib/csu/i386/crtn.S @@ -27,11 +27,13 @@ __FBSDID("$FreeBSD$"); .section .init,"ax",@progbits - add $12,%esp + addl $8,%esp + popl %ebp ret .section .fini,"ax",@progbits - add $12,%esp + addl $8,%esp + popl %ebp ret .section .note.GNU-stack,"",%progbits