[PATCH] D147372: [libunwind][LoongArch] Restore $r1 before $r4 in `jumpto`
Lu Weining via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 1 02:20:08 PDT 2023
SixWeining created this revision.
SixWeining added reviewers: MaskRay, xen0n, wangleiat.
Herald added projects: libunwind, All.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libunwind.
SixWeining requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
$r1 should be restored before $r4, otherwise the baseaddress ($r4) 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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147372
Files:
libunwind/src/UnwindRegistersRestore.S
libunwind/test/unw_resume.pass.cpp
Index: libunwind/test/unw_resume.pass.cpp
===================================================================
--- libunwind/test/unw_resume.pass.cpp
+++ libunwind/test/unw_resume.pass.cpp
@@ -10,11 +10,6 @@
// Ensure that unw_resume() resumes execution at the stack frame identified by
// cursor.
-// FIXME: The return address register($ra/$r1) is restored with a destroyed base
-// address register($a0/$r4) in the assembly file `UnwindRegistersRestore.S` on
-// LoongArch. And we will fix this issue in the next commit.
-// XFAIL: target={{loongarch64-.+}}
-
#include <libunwind.h>
void test_unw_resume() {
Index: libunwind/src/UnwindRegistersRestore.S
===================================================================
--- libunwind/src/UnwindRegistersRestore.S
+++ libunwind/src/UnwindRegistersRestore.S
@@ -1221,8 +1221,8 @@
ld.d $r\i, $a0, (8 * \i)
.endr
- ld.d $r4, $a0, (8 * 4) // restore $a0 last
ld.d $r1, $a0, (8 * 32) // load new pc into $ra
+ ld.d $r4, $a0, (8 * 4) // restore $a0 last
jr $ra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147372.510198.patch
Type: text/x-patch
Size: 1059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230401/08a1c3ac/attachment.bin>
More information about the llvm-commits
mailing list