diff options
author | Weining Lu <luweining@loongson.cn> | 2023-04-07 13:38:44 +0800 |
---|---|---|
committer | Weining Lu <luweining@loongson.cn> | 2023-04-07 13:42:23 +0800 |
commit | ff0aabf14dfa0a369c38f6e267c56a83ee48d647 (patch) | |
tree | 180d50cd29266e28dbe8e0ced5d98f3e7867641f /libunwind | |
parent | 366c5474a3002114b8980ab278d93baa96046385 (diff) | |
download | llvm-ff0aabf14dfa0a369c38f6e267c56a83ee48d647.tar.gz |
[libunwind][LoongArch] Restore $r1 before $r4 in `jumpto`
$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.
Reviewed By: MaskRay, xen0n, #libunwind
Differential Revision: https://reviews.llvm.org/D147372
Diffstat (limited to 'libunwind')
-rw-r--r-- | libunwind/src/UnwindRegistersRestore.S | 4 | ||||
-rw-r--r-- | libunwind/test/unw_resume.pass.cpp | 5 |
2 files changed, 2 insertions, 7 deletions
diff --git a/libunwind/src/UnwindRegistersRestore.S b/libunwind/src/UnwindRegistersRestore.S index 543b19f7e72a..951189ea54dd 100644 --- a/libunwind/src/UnwindRegistersRestore.S +++ b/libunwind/src/UnwindRegistersRestore.S @@ -1221,8 +1221,8 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind19Registers_loongarch6jumptoEv) 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 index e652620a4a05..76273e4a8ef0 100644 --- 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 <libunwind.h> void test_unw_resume() { |