Re: [PATCH] loongarch: Only select HAVE_OBJTOOL and allow ORC unwinder if the inline assembler supports R_LARCH_{32,64}_PCREL
From: Xi Ruoyao
Date: Fri Jun 07 2024 - 01:43:19 EST
On Thu, 2024-06-06 at 10:10 +0800, Jinyang He wrote:
> What I just confused is that there is no ".cfi_*"
> in the eplogue by clang, which may cause wrong backtrace if gdb set
>
> breakpoint there and backtrace. (But this is out of this topic.)
I don't think it'll cause wrong backtrace. The real assemble code has
restored the registers and missing .cfi_restore will just make unwinder
restore them again. There are redundant works but not breakages.
For objtool the main difference seems a thing explained in
https://maskray.me/blog/2020-11-08-stack-unwinding by Fangrui:
Note: on RISC-V and LoongArch, the stack slot for the previous frame
pointer is stored at fp[-2] instead of fp[0]. See [Consider
standardising which stack slot fp points
to](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/18)
for the RISC-V discussion.
So perhaps we just need to code a constant named "PREV_BP_OFFSET" or
something in arch/ and use it in update_cfi_state() instead of fully re-
implement the entire function?
--
Xi Ruoyao <xry111@xxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University