[libunwind] b33a675 - [RISCV] Allow libunwind to build for rv32e (#98855)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 1 23:59:33 PDT 2024
Author: R
Date: 2024-08-02T14:59:29+08:00
New Revision: b33a675e3f5710bd56715e8058b541c21c325de0
URL: https://github.com/llvm/llvm-project/commit/b33a675e3f5710bd56715e8058b541c21c325de0
DIFF: https://github.com/llvm/llvm-project/commit/b33a675e3f5710bd56715e8058b541c21c325de0.diff
LOG: [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.
Added:
Modified:
libunwind/src/UnwindRegistersRestore.S
libunwind/src/UnwindRegistersSave.S
Removed:
################################################################################
diff --git a/libunwind/src/UnwindRegistersRestore.S b/libunwind/src/UnwindRegistersRestore.S
index 67d9e05711898..e18fec0b90d93 100644
--- a/libunwind/src/UnwindRegistersRestore.S
+++ b/libunwind/src/UnwindRegistersRestore.S
@@ -1169,7 +1169,11 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind15Registers_riscv6jumptoEv)
ILOAD x\i, (RISCV_ISIZE * \i)(a0)
.endr
// skip a0 for now
+#if defined(__riscv_32e)
+ .irp i,11,12,13,14,15
+#else
.irp i,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
+#endif
ILOAD x\i, (RISCV_ISIZE * \i)(a0)
.endr
ILOAD x10, (RISCV_ISIZE * 10)(a0) // restore a0
diff --git a/libunwind/src/UnwindRegistersSave.S b/libunwind/src/UnwindRegistersSave.S
index 5bf6055fe4147..fab234fcd6f31 100644
--- a/libunwind/src/UnwindRegistersSave.S
+++ b/libunwind/src/UnwindRegistersSave.S
@@ -1108,7 +1108,11 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
#
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
ISTORE x1, (RISCV_ISIZE * 0)(a0) // store ra as pc
+#if defined(__riscv_32e)
+ .irp i,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+#else
.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
+#endif
ISTORE x\i, (RISCV_ISIZE * \i)(a0)
.endr
More information about the cfe-commits
mailing list