This is an archive of the discontinued LLVM Phabricator instance.

[RFC] [COFF] [AArch64] Avoid crashing on .seh directives in assembly
ClosedPublic

Authored by mstorsjo on Dec 13 2018, 2:02 PM.

Details

Summary

Not sure if this really does the right thing, but it kind of matches a similar if directive in the corresponding x86_64 code:

if (info->PrologEnd)
  EmitAbsDifference(streamer, info->PrologEnd, info->Begin);
else
  streamer.EmitIntValue(0, 1);

This at least avoids crashing on cases of a few .seh_* directives in (inline) assembly (which is present in a few places in mingw-w64).

Diff Detail

Event Timeline

mstorsjo created this revision.Dec 13 2018, 2:02 PM
rnk accepted this revision.Dec 18 2018, 9:18 AM

lgtm

test/MC/AArch64/seh.s
75

This is the one that misbehaves, because it has no end prologue, right?

This revision is now accepted and ready to land.Dec 18 2018, 9:18 AM
mstorsjo marked an inline comment as done.Dec 18 2018, 10:28 AM
mstorsjo added inline comments.
test/MC/AArch64/seh.s
75

Not entirely sure, or if there's sonething else that isn't properly hooked up wrt SEH in the MC layer for aarch64. I noticed that there's lots of .seh_* directives for x86_64 that aren't available for aarch64 yet (although I guess some of them are arch specific).

Adding .seh_endprologue here isn't enough to make it not crash before this patch at least.

The real case where I ran into it was https://github.com/mirror/mingw-w64/blob/master/mingw-w64-crt/crt/crtexe.c#L185 though.

This revision was automatically updated to reflect the committed changes.