aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2023-07-07 16:55:28 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2023-07-07 16:55:28 +0000
commitac7759f54574ceb9da48829fd09ea6545404bdc0 (patch)
treeed8ce7dafec22f527cb03b2fbac87e335041d677
parent5645dfb41ae0d5ca0acdee8a2a6646787b33e03f (diff)
downloadsrc-ac7759f54574ceb9da48829fd09ea6545404bdc0.tar.gz
src-ac7759f54574ceb9da48829fd09ea6545404bdc0.zip
rtld: Annotate .rtld_start on aarch64
1. Add a stop indicator to rtld_start to satisfy unwinders on aarch64: The right unwinding stop indicator should be CFI-undefined PC. https://dwarfstd.org/doc/Dwarf3.pdf - page 118: If a Return Address register is defined in the virtual unwind table, and its rule is undefined (for example, by DW_CFA_undefined), then there is no return address and no call address, and the virtual unwind of stack activations is complete. 2. Add a proper annotations for CFA. That is allows gdb and libunwind successfully stop when unwinding stack from global constructors and destructors. Reviewed by: Differential Revision: https://reviews.freebsd.org/D40844
-rw-r--r--libexec/rtld-elf/aarch64/rtld_start.S3
1 files changed, 3 insertions, 0 deletions
diff --git a/libexec/rtld-elf/aarch64/rtld_start.S b/libexec/rtld-elf/aarch64/rtld_start.S
index 4f0bef0233b0..107920548432 100644
--- a/libexec/rtld-elf/aarch64/rtld_start.S
+++ b/libexec/rtld-elf/aarch64/rtld_start.S
@@ -31,15 +31,18 @@
__FBSDID("$FreeBSD$");
ENTRY(.rtld_start)
+ .cfi_undefined x30
mov x19, x0 /* Put ps_strings in a callee-saved register */
sub sp, sp, #16 /* Make room for obj_main & exit proc */
+ .cfi_adjust_cfa_offset 16
mov x1, sp /* exit_proc */
add x2, x1, #8 /* obj_main */
bl _rtld /* Call the loader */
mov x8, x0 /* Backup the entry point */
ldp x2, x1, [sp], #16 /* Load cleanup, obj_main */
+ .cfi_adjust_cfa_offset 0
mov x0, x19 /* Restore ps_strings */
br x8 /* Jump to the entry point */