We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
test_c_stack_unwind
1 parent 9751e1d commit 1b0c05fCopy full SHA for 1b0c05f
1 file changed
Modules/_testinternalcapi.c
@@ -98,6 +98,11 @@ static const uintptr_t min_frame_pointer_addr = 0x1000;
98
// https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#STACK
99
# define FRAME_POINTER_NEXT_OFFSET 0
100
# define FRAME_POINTER_RETURN_OFFSET 2
101
+#elif defined(__riscv)
102
+// RISC-V saves the return address at fp[-1], and the previous frame pointer at fp[-2].
103
+// See: https://riscv-non-isa.github.io/riscv-elf-psabi-doc/#_frame_pointer_convention
104
+# define FRAME_POINTER_NEXT_OFFSET -2
105
+# define FRAME_POINTER_RETURN_OFFSET -1
106
#elif defined(__loongarch__)
107
// On LoongArch, the frame pointer is the caller's stack pointer.
108
// The saved frame pointer is stored at fp[-2], and the return
0 commit comments