Skip to content

Commit cd3bd93

Browse files
ArcaneNibblestephanosio
authored andcommitted
[RISCV] Allow libunwind to build for rv32e (llvm#98855)
Don't try to save x16-x31 when using rv32e ISA Note that I haven't actually tested yet whether or not unwinding actually works on rv32e, but the code as-is doesn't even build. (cherry picked from commit b33a675)
1 parent cfc3efa commit cd3bd93

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

libunwind/src/UnwindRegistersRestore.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,11 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind15Registers_riscv6jumptoEv)
11831183
ILOAD x\i, (RISCV_ISIZE * \i)(a0)
11841184
.endr
11851185
// skip a0 for now
1186+
#if defined(__riscv_32e)
1187+
.irp i,11,12,13,14,15
1188+
#else
11861189
.irp i,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
1190+
#endif
11871191
ILOAD x\i, (RISCV_ISIZE * \i)(a0)
11881192
.endr
11891193
ILOAD x10, (RISCV_ISIZE * 10)(a0) // restore a0

libunwind/src/UnwindRegistersSave.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,11 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
11081108
#
11091109
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
11101110
ISTORE x1, (RISCV_ISIZE * 0)(a0) // store ra as pc
1111+
#if defined(__riscv_32e)
1112+
.irp i,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
1113+
#else
11111114
.irp i,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
1115+
#endif
11121116
ISTORE x\i, (RISCV_ISIZE * \i)(a0)
11131117
.endr
11141118

0 commit comments

Comments
 (0)