The branch main has been updated by dchagin:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ac7759f54574ceb9da48829fd09ea6545404bdc0

commit ac7759f54574ceb9da48829fd09ea6545404bdc0
Author:     Dmitry Chagin <[email protected]>
AuthorDate: 2023-07-07 16:55:28 +0000
Commit:     Dmitry Chagin <[email protected]>
CommitDate: 2023-07-07 16:55:28 +0000

    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
---
 libexec/rtld-elf/aarch64/rtld_start.S | 3 +++
 1 file changed, 3 insertions(+)

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 */

Reply via email to