This is an archive of the discontinued LLVM Phabricator instance.

[MC] [Win64EH] Don't produce packed ARM64 unwind info with homed parameters
ClosedPublic

Authored by mstorsjo on May 18 2022, 5:05 AM.

Details

Summary

There's an inconsistency regarding the epilogs of packed ARM64
unwind info with homed parameters; according to the documentation
(and according to common sense), the epilog wouldn't have a series
of nop instructions matching the stp x0-x7 in the prolog - however
in practice, RtlVirtualUnwind still seems to behave as if the epilog
does have the mirrored nops from the prolog.

In practice, MSVC doesn't seem to produce packed unwind info with
homed parameters, which might be why this inconsistency hasn't
been noticed.

Thus, to play it safe, avoid creating such packed unwind info with
homed parameters. (LLVM's current behaviour matches the current
runtime behaviour of RtlVirtualUnwind, but if it later is bug fixed
to match the documentation, such unwind information would be
incorrect.)

See https://github.com/llvm/llvm-project/issues/54879 for further
discussion on the matter.

Diff Detail

Event Timeline

mstorsjo created this revision.May 18 2022, 5:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 5:05 AM
mstorsjo requested review of this revision.May 18 2022, 5:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 5:05 AM
This revision is now accepted and ready to land.May 18 2022, 9:33 AM

Thus, to play it safe, avoid creating such packed unwind info with homed parameters.

I agree. Thanks for the patch.