[libunwind] [RISCV] Allow libunwind to build for rv32e (PR #98855)

Sam Elliott via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 1 11:41:14 PDT 2024


================
@@ -1169,7 +1169,11 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind15Registers_riscv6jumptoEv)
     ILOAD x\i, (RISCV_ISIZE * \i)(a0)
   .endr
   // skip a0 for now
+#if defined(__riscv_abi_rve)
----------------
lenary wrote:

> Okay, I apparently did not realize that you can explicitly force `-march=rv32i -mabi=ilp32e` in which case clang will indeed start using x16-x31 as temporaries. This means that `__riscv_32e` is probably the correct define to be checking. I will update the PR.

Yeah, the intention here is that you should be able to use an E-abi library on the I architecture, without modification. If you compile your app for the I architecture to get additional temporaries, then you need to make sure you use a libunwind that knows about the additional temporaries it might need to restore.

> Incidentally, does this mean that MIPS soft-float-ABI-but-FPU-enabled might be buggy?

Sounds like it could be, but I'm no MIPS expert.

https://github.com/llvm/llvm-project/pull/98855


More information about the cfe-commits mailing list