The branch main has been updated by pkubaj:

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

commit ea1af5727c59a50646b928e690f581a8180e7ac6
Author:     Piotr Kubaj <[email protected]>
AuthorDate: 2026-12-03 16:40:30 +0000
Commit:     Piotr Kubaj <[email protected]>
CommitDate: 2026-12-04 12:15:19 +0000

    rtld: add unwind info to the powerpc64 trampolines
    
    _rtld_bind_start and _rtld_tls_get_addr_slow set up a stack frame but
    don't tell the unwinder about it, so a backtrace taken in the binder or
    in the slow path of __tls_get_addr() stops at the trampoline.
    
    Reported by:    llm-postcr
    Reviewed by:    jhibbits
    Fixes:          78599c32efed ("Add CFI start/end proc directives to arm64, 
i386, and ppc")
    Fixes:          365638b0d498 ("rtld: preserve the FP and vector registers 
in __tls_get_addr() on powerpc64")
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D62383
---
 libexec/rtld-elf/powerpc64/rtld_start.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libexec/rtld-elf/powerpc64/rtld_start.S 
b/libexec/rtld-elf/powerpc64/rtld_start.S
index f59999f9225e..e8b0fcb84baf 100644
--- a/libexec/rtld-elf/powerpc64/rtld_start.S
+++ b/libexec/rtld-elf/powerpc64/rtld_start.S
@@ -130,11 +130,13 @@ _ENTRY(_rtld_bind_start)
        mr      %r12,%r0                # save r0 (index) immediately to r12
        mflr    %r0
        std     %r0,16(%r1)             # save lr
+       .cfi_offset lr,16
        mfcr    %r0
        std     %r0,8(%r1)              # save cr
 
        stdu    %r1,-48-12*8(%r1)       # stack space for 8 regs + header
                                        #   + 2 save regs
+       .cfi_def_cfa_offset 48+12*8
        std     %r3,64+0*8(%r1)         # save r3-r10 (arguments)
        std     %r4,64+1*8(%r1)
        std     %r5,64+2*8(%r1)
@@ -169,6 +171,7 @@ _ENTRY(_rtld_bind_start)
        ld      %r10,64+7*8(%r1)
 
        ld      %r1,0(%r1)              # restore stack
+       .cfi_def_cfa_offset 0
        ld      %r0,8(%r1)              # restore cr
        mtcr    %r0
        ld      %r0,16(%r1)             # restore lr
@@ -197,7 +200,9 @@ _END(_rtld_bind_start)
 _ENTRY(_rtld_tls_get_addr_slow)
        mflr    %r0
        std     %r0,16(%r1)
+       .cfi_offset lr,16
        stdu    %r1,-TLS_SLOW_FRAME(%r1)
+       .cfi_def_cfa_offset TLS_SLOW_FRAME
        std     %r6,TLS_SLOW_MODE(%r1)
        addi    %r11,%r1,TLS_SLOW_SAVE
        cmpldi  %r6,2                   # RTLD_TLS_SAVE_VSX
@@ -244,6 +249,7 @@ _ENTRY(_rtld_tls_get_addr_slow)
        .endr
 4:
        addi    %r1,%r1,TLS_SLOW_FRAME
+       .cfi_def_cfa_offset 0
        ld      %r0,16(%r1)
        mtlr    %r0
        blr

Reply via email to