The branch main has been updated by dchagin:

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

commit e541cf8316bb787df0f19c43132c517482cf24a6
Author:     Dmitry Chagin <[email protected]>
AuthorDate: 2023-07-11 12:10:32 +0000
Commit:     Dmitry Chagin <[email protected]>
CommitDate: 2023-07-11 12:10:32 +0000

    rtld: Annotate .rtld_start on i386
    
    Add a stop indicator to rtld_start to satisfy unwinders:
    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.
    
    That is allows gdb and libunwind successfully stop when unwinding stack
    from global constructors and destructors.
    
    Reviewed by:            kib
    Differential Revision:  https://reviews.freebsd.org/D40949
---
 libexec/rtld-elf/i386/rtld_start.S | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libexec/rtld-elf/i386/rtld_start.S 
b/libexec/rtld-elf/i386/rtld_start.S
index 6dbae220d89c..656ebb13864f 100644
--- a/libexec/rtld-elf/i386/rtld_start.S
+++ b/libexec/rtld-elf/i386/rtld_start.S
@@ -30,8 +30,15 @@
        .globl  .rtld_start
        .type   .rtld_start,@function
 .rtld_start:
+       .cfi_startproc
+       .cfi_undefined %eip
        xorl    %ebp,%ebp               # Clear frame pointer for good form
        movl    %esp,%esi               # Save initial stack pointer
+       pushl   %ebp
+       .cfi_def_cfa_offset 4
+       movl    %esp,%ebp
+       .cfi_offset %ebp,-4
+       .cfi_def_cfa_register %ebp
        andl    $0xfffffff0,%esp        # Align stack pointer
        subl    $16,%esp                # A place to store exit procedure addr
        movl    %esp,%ebx               # save address of exit proc
@@ -53,6 +60,7 @@
 .globl .rtld_goto_main
 .rtld_goto_main:       # This symbol exists just to make debugging easier.
        jmp     *%eax                   # Enter main program
+       .cfi_endproc
 
 
 /*

Reply via email to