This is an archive of the discontinued LLVM Phabricator instance.

[libunwind][LoongArch] Restore $r1 before $r4 in `jumpto`
ClosedPublic

Authored by SixWeining on Apr 1 2023, 2:20 AM.

Details

Summary

$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.

Diff Detail

Event Timeline

SixWeining created this revision.Apr 1 2023, 2:20 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 1 2023, 2:20 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
SixWeining requested review of this revision.Apr 1 2023, 2:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2023, 2:20 AM
xen0n added inline comments.Apr 2 2023, 12:49 AM
libunwind/src/UnwindRegistersRestore.S
1225

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!

SixWeining updated this revision to Diff 510384.Apr 2 2023, 8:09 PM

use register ABI names rather raw names

SixWeining edited the summary of this revision. (Show Details)Apr 2 2023, 8:09 PM
SixWeining marked an inline comment as done.
SixWeining added inline comments.
libunwind/src/UnwindRegistersRestore.S
1225

Thanks for your suggestion. I have changed them.

MaskRay accepted this revision.Apr 3 2023, 7:40 PM
This revision is now accepted and ready to land.Apr 3 2023, 7:40 PM
xen0n accepted this revision.Apr 3 2023, 7:47 PM
This revision was landed with ongoing or failed builds.Apr 6 2023, 10:44 PM
This revision was automatically updated to reflect the committed changes.
SixWeining marked an inline comment as done.