Skip to content

Commit b33a675

Browse files
authored
[RISCV] Allow libunwind to build for rv32e (#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.
1 parent 54a940b commit b33a675

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
@@ -1169,7 +1169,11 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind15Registers_riscv6jumptoEv)
11691169
ILOAD x\i, (RISCV_ISIZE * \i)(a0)
11701170
.endr
11711171
// skip a0 for now
1172+
#if defined(__riscv_32e)
1173+
.irp i,11,12,13,14,15
1174+
#else
11721175
.irp i,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
1176+
#endif
11731177
ILOAD x\i, (RISCV_ISIZE * \i)(a0)
11741178
.endr
11751179
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)