$ra should be restored before $a0, otherwise the baseaddress ($a0) would
be destroyed. See file UnwindRegistersSave.S for reference.
This also makes libcxx and libcxxabi regtest pass for the -DLIBCXXABI_USE_LLVM_UNWINDER=ON build.
Differential D147372
[libunwind][LoongArch] Restore $r1 before $r4 in `jumpto` SixWeining on Apr 1 2023, 2:20 AM. Authored by
Details
$ra should be restored before $a0, otherwise the baseaddress ($a0) would This also makes libcxx and libcxxabi regtest pass for the -DLIBCXXABI_USE_LLVM_UNWINDER=ON build.
Diff Detail
Event Timeline
|
Ah now I know why no one has noticed this before. Someone mixed raw register names ($r1 r4) and ABI names ($ra $a0) so the flaw was not immediately noticeable otherwise.
So, in order to reduce unnecessary mental burden reading this, I'd suggest changing $r1 and $r4 to ABI names while at it. The code change is okay otherwise, thanks for the patch!