diff options
author | Dmitry Chagin <dchagin@FreeBSD.org> | 2023-07-07 16:54:53 +0000 |
---|---|---|
committer | Dmitry Chagin <dchagin@FreeBSD.org> | 2023-07-07 16:54:53 +0000 |
commit | 43e29d03f416d7dda52112a29600a7c82ee1a91e (patch) | |
tree | 7a7f2b38f6f3c6aef4748f8ee023395142f5696e /lib | |
parent | a2cc93ec7fa15eed4d3a39998adff641c15dca4f (diff) | |
download | src-43e29d03f416d7dda52112a29600a7c82ee1a91e.tar.gz src-43e29d03f416d7dda52112a29600a7c82ee1a91e.zip |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/csu/aarch64/crti.S | 8 | ||||
-rw-r--r-- | lib/csu/aarch64/crtn.S | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/csu/aarch64/crti.S b/lib/csu/aarch64/crti.S index 13e3b74642d8..af10c0f00d7d 100644 --- a/lib/csu/aarch64/crti.S +++ b/lib/csu/aarch64/crti.S @@ -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 diff --git a/lib/csu/aarch64/crtn.S b/lib/csu/aarch64/crtn.S index ebb59b710412..c62433537f36 100644 --- a/lib/csu/aarch64/crtn.S +++ b/lib/csu/aarch64/crtn.S @@ -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 |