diff --git a/libunwind/src/UnwindRegistersRestore.S b/libunwind/src/UnwindRegistersRestore.S --- a/libunwind/src/UnwindRegistersRestore.S +++ b/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 $ra, $a0, (8 * 32) // load new pc into $ra + ld.d $a0, $a0, (8 * 4) // restore $a0 last jr $ra diff --git a/libunwind/test/unw_resume.pass.cpp b/libunwind/test/unw_resume.pass.cpp --- a/libunwind/test/unw_resume.pass.cpp +++ b/libunwind/test/unw_resume.pass.cpp @@ -16,11 +16,6 @@ // TODO: Figure out why this fails with Memory Sanitizer. // XFAIL: msan -// 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 void test_unw_resume() {