This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Fix the EH_SjLj_Setup pseudo.
ClosedPublic

Authored by koriakin on Apr 28 2016, 1:52 PM.

Details

Reviewers
kbarton
hfinkel
Summary

This instruction is just a control flow marker - it should not
actually exist in the object file. Unfortunately, nothing catches
it before it gets to AsmPrinter. If integrated assembler is used,
it's considered to be a normal 4-byte instruction, and emitted as
an all-0 word, crashing the program. With external assembler,
a comment is emitted.

Fixed by setting Size to 0 and handling it in MCCodeEmitter - this
means the comment will still be emitted if integrated assembler
is not used.

This broke an ASan test, which has been disabled for a long time
as a result (see the discussion on D19657). We can reenable it
once this lands.

Diff Detail

Repository
rL LLVM

Event Timeline

koriakin retitled this revision from to [PowerPC] Fix the EH_SjLj_Setup pseudo..
koriakin updated this object.
koriakin added reviewers: hfinkel, kbarton.
koriakin set the repository for this revision to rL LLVM.
koriakin added a subscriber: llvm-commits.
hfinkel edited edge metadata.Apr 28 2016, 2:07 PM

Can you construct a test case by running llc with -filetype=obj, and then llvm-objdump (or llvm-mc --disassemble or whatever works)?

lib/Target/PowerPC/PPCInstrInfo.td
1406

Please add a comment explaining that this pseudo instruction is never removed from the function because it serves as a terminator, and we set size to 0 to prevent the builtin assembler from emitting it.

koriakin edited edge metadata.

Added comment and test.

hfinkel accepted this revision.Apr 28 2016, 2:29 PM
hfinkel edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Apr 28 2016, 2:29 PM
koriakin closed this revision.Apr 28 2016, 2:33 PM

Closed by rL267943 (forgot to add phab link).