You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We used RISC-V code as a reference implementing psm for LoongArch.
During the review of LoongArch code we found that the .cfi directives in
RISC-V was incorrect [1].
The GNU assembler defines .cfi_def_cfa [2]:
computing CFA as: take address from register and add offset to it.
So ".cfi_def_cfa x2, 16" will compute the CFA correctly, but we used
"-16". I tested the code on an StarFive VisionFive v1 board (access
provided by The GCC Compile Farm project [3]) with a C caller and GDB.
GDB indeed reported "corrupt stack" for backtrace.
Fix the symbol of offset to make the backtrace working. And, clean up
the .cfi directives as Simonas suggested [4].
[1]: #68 (comment)
[2]: https://sourceware.org/binutils/docs/as/CFI-directives.html
[3]: https://cfarm.tetaneutral.net/
[4]: #68 (comment)
0 commit comments