This is an archive of the discontinued LLVM Phabricator instance.

[xray] Preserve x8 in trampoline on AArch64
ClosedPublic

Authored by ianlevesque on Apr 21 2020, 3:46 PM.

Details

Summary

Fixes an ABI violation in the trampoline code for AArch64 that causes the indirect result register to get overwritten if the XRay handler function is complex enough to use it.

Diff Detail

Event Timeline

ianlevesque created this revision.Apr 21 2020, 3:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2020, 3:46 PM
Herald added subscribers: Restricted Project, danielkiss, kristof.beyls. · View Herald Transcript

I'm not well versed in AArch64 assembler here, so I'll defer to @MaskRay who has more knowledge in this area.

MaskRay accepted this revision.Apr 25 2020, 3:00 PM

I am also trying to make myself more familiar with AArch64.... I think this is correct. From Procedure Call Standard for the Arm 64-bit Architecture, Result Return

Otherwise, the caller shall reserve a block of memory of sufficient size and alignment to hold the result. The address of the memory block shall be passed as an additional argument to the function in x8. The callee may modify the result memory block at any point during the execution of the subroutine (there is no requirement for the callee to preserve the value stored in x8).

This revision is now accepted and ready to land.Apr 25 2020, 3:00 PM
This revision was automatically updated to reflect the committed changes.