rtld-elf: Add CFI annotation for .rtld_start on RISC-V

Without this change, unwinders such as LLVM libunwind will attempt to
unwind beyond the start of RTLD and get stuck in an infinite loop or
crash (depending on the current values on the stack).
This fixes an infinite loop in the LLVM libunwind test suite on RISC-V.

See also https://reviews.freebsd.org/D40844 for AArch64

Reviewed By:	#riscv, jhb
MFC After:	2 weeks
Differential Revision: https://reviews.freebsd.org/D46406
This commit is contained in:
Alex Richardson 2024-08-25 21:51:55 -07:00
parent 6e7581236e
commit 04262ed78d

View File

@ -39,6 +39,7 @@
*/
ENTRY(.rtld_start)
.cfi_undefined ra /* Do not attempt to unwind any further. */
mv s0, a0 /* Put ps_strings in a callee-saved register */
mv s1, sp /* And the stack pointer */