This is an archive of the discontinued LLVM Phabricator instance.

[LangRef] update according to unwinding support in inline asm
ClosedPublic

Authored by cynecx on May 17 2021, 11:13 AM.

Details

Summary

https://reviews.llvm.org/D95745 introduced a new unwind keyword for inline assembler expressions. Inline asms marked with the unwind keyword allows stack unwinding from inline assembly because the compiler emits unwinding information ("around" the inline asm) as it would for calls/invokes. Unwinding the stack from within non-unwind inline asm may cause UB.

Diff Detail

Event Timeline

cynecx created this revision.May 17 2021, 11:13 AM
cynecx requested review of this revision.May 17 2021, 11:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 17 2021, 11:13 AM

I think more commit message text is necessary here.

Would this mean asm w/o unwind cannot unwind?

I think more commit message text is necessary here.

I agree.

Would this mean asm w/o unwind cannot unwind?

The unwind keyword causes llvm to treat the inline assembly as "unwindable", so appropriate unwind information/tables are emitted by codegen. By omitting the unwind keyword, llvm doesn't emit these information and therefore unwinding from inline assembly might not be sound or even UB.

cynecx updated this revision to Diff 345971.May 17 2021, 12:41 PM
cynecx edited the summary of this revision. (Show Details)

UB when "non-unwindable" inline asm unwinds.

OK, assuming we can make it UB that would help nounwind deduction. Nice.

This revision is now accepted and ready to land.May 31 2021, 12:57 AM
This revision was automatically updated to reflect the committed changes.