git: c4fde87a3236 - main - rtld: add .cfi_undefined lr to rtld_start.S on powerpc*
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 15 Oct 2026 14:00:44 UTC
The branch main has been updated by pkubaj:
URL: https://cgit.FreeBSD.org/src/commit/?id=c4fde87a3236b500246d4fce76dbca2a3d64f73a
commit c4fde87a3236b500246d4fce76dbca2a3d64f73a
Author: Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-10-15 13:58:04 +0000
Commit: Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-10-15 13:59:57 +0000
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 */