rtld: Add a stop indicator to rtld_start to satisfy unwinders on x86_64
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/D40794
This commit is contained in:
parent
f85b82daf1
commit
3bdf68086d
@ -30,14 +30,18 @@
|
||||
.globl .rtld_start
|
||||
.type .rtld_start,@function
|
||||
.rtld_start:
|
||||
.cfi_startproc
|
||||
.cfi_undefined %rip
|
||||
xorq %rbp,%rbp # Clear frame pointer for good form
|
||||
subq $24,%rsp # A place to store exit procedure addr
|
||||
.cfi_def_cfa_offset 32
|
||||
movq %rdi,%r12
|
||||
movq %rsp,%rsi # save address of exit proc
|
||||
movq %rsp,%rdx # construct address of obj_main
|
||||
addq $8,%rdx
|
||||
call _rtld # Call rtld(sp); returns entry point
|
||||
popq %rsi # Get exit procedure address
|
||||
.cfi_def_cfa_offset 24
|
||||
movq %r12,%rdi # *ap
|
||||
/*
|
||||
* At this point, %rax contains the entry point of the main program, and
|
||||
@ -47,6 +51,7 @@
|
||||
.globl .rtld_goto_main
|
||||
.rtld_goto_main: # This symbol exists just to make debugging easier.
|
||||
jmp *%rax # Enter main program
|
||||
.cfi_endproc
|
||||
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user