mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
csu: Add the prologue and epilogue to the _init and _fini on i386
Normally, modern unwinders uses Dwarf information to unwind stack, however in case when the code is not annotated by Dwarf instructions, unwinders fallbacks to a frame-pointer based algorithm. That is allows libunwind to unwind stack from global constructors and destructors. Also it makes gdb happy as it printed nonexistent frame before. Reviewed by: kib, imp Differential Revision: https://reviews.freebsd.org/D40948
This commit is contained in:
parent
e541cf8316
commit
d7e2580a14
|
@ -31,13 +31,17 @@ __FBSDID("$FreeBSD$");
|
|||
.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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue