csu: Add the prologue and epilogue to the _init and _fini on aarch64

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:
Differential Revision:	https://reviews.freebsd.org/D40842
This commit is contained in:
Dmitry Chagin 2023-07-07 19:54:53 +03:00
parent a2cc93ec7f
commit 43e29d03f4
2 changed files with 6 additions and 8 deletions

View file

@ -35,14 +35,14 @@ __FBSDID("$FreeBSD$");
.globl _init
.type _init,@function
_init:
sub sp, sp, #16
str lr, [sp]
stp x29, x30, [sp, #-16]!
mov x29, sp
.section .fini,"ax",@progbits
.align 4
.globl _fini
.type _fini,@function
_fini:
sub sp, sp, #16
str lr, [sp]
stp x29, x30, [sp, #-16]!
mov x29, sp

View file

@ -31,14 +31,12 @@
__FBSDID("$FreeBSD$");
.section .init,"ax",@progbits
ldr lr, [sp]
add sp, sp, #16
ldp x29, x30, [sp], #16
ret
.section .fini,"ax",@progbits
ldr lr, [sp]
add sp, sp, #16
ldp x29, x30, [sp], #16
ret
.section .note.GNU-stack,"",%progbits