Page MenuHomePhabricator

[ARM] __cxa_end_cleanup: avoid clobbering r4
ClosedPublic

Authored by rprichard on Mar 10 2022, 6:04 PM.

Details

Summary

The fix for D111703 clobbered r4 both to:

  • Save/restore the original lr.
  • Load the address of _Unwind_Resume for LIBCXXABI_BAREMETAL.

This patch saves and restores lr without clobbering any extra
registers.

For LIBCXXABI_BAREMETAL, it is still necessary to clobber one extra
register to hold the address of _Unwind_Resume, but it seems better to
use ip/r12 (intended for linker veneers/trampolines) than r4 for this
purpose.

The function also clobbers r0 for the _Unwind_Resume function's
parameter, but that is unavoidable.

Diff Detail

Event Timeline

rprichard created this revision.Mar 10 2022, 6:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2022, 6:04 PM
rprichard requested review of this revision.Mar 10 2022, 6:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2022, 6:04 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
logan accepted this revision.Mar 10 2022, 10:35 PM
danielkiss accepted this revision.Mar 11 2022, 1:57 AM

LGTM, thanks for the patch.

MaskRay accepted this revision.Mar 11 2022, 4:58 PM
This revision was not accepted when it landed; it landed in state Needs Review.Mar 14 2022, 3:45 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.