From c4fde87a3236b500246d4fce76dbca2a3d64f73a Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Thu, 15 Oct 2026 15:58:04 +0200 Subject: [PATCH] rtld: add .cfi_undefined lr to rtld_start.S on powerpc* Without it, LLVM libunwind doesn't know where to stop when unwinding the main thread, so it uses a stale LR as the return address and crashes. Our libunwind doesn't do that since 5866c369e4fd reverted it, but programs that bundle their own copy, like ClickHouse, are hit by it. amd64, arm64, i386 and riscv already have the same annotation. Approved by: jhibbits MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D60740 --- libexec/rtld-elf/powerpc/rtld_start.S | 1 + libexec/rtld-elf/powerpc64/rtld_start.S | 1 + 2 files changed, 2 insertions(+) diff --git a/libexec/rtld-elf/powerpc/rtld_start.S b/libexec/rtld-elf/powerpc/rtld_start.S index d36649caa9be..f06f14b1a563 100644 --- a/libexec/rtld-elf/powerpc/rtld_start.S +++ b/libexec/rtld-elf/powerpc/rtld_start.S @@ -34,6 +34,7 @@ .extern _DYNAMIC _ENTRY(.rtld_start) + .cfi_undefined lr stwu %r1,-48(%r1) /* 16-byte aligned stack for reg saves + exit_proc & obj _rtld args + backchain & lrsave stack frame */ diff --git a/libexec/rtld-elf/powerpc64/rtld_start.S b/libexec/rtld-elf/powerpc64/rtld_start.S index 796a41e34601..a5c6cfac8931 100644 --- a/libexec/rtld-elf/powerpc64/rtld_start.S +++ b/libexec/rtld-elf/powerpc64/rtld_start.S @@ -33,6 +33,7 @@ .extern _DYNAMIC _ENTRY(_rtld_start) + .cfi_undefined lr stdu %r1,-144(%r1) /* 16-byte aligned stack for reg saves + exit_proc & obj _rtld args + backchain & lrsave stack frame */