This is an archive of the discontinued LLVM Phabricator instance.

[COFF] [X86] Don't use llvm_unreachable for unsupported relocation types
ClosedPublic

Authored by mstorsjo on Oct 4 2018, 12:32 PM.

Details

Summary

This can happen if assembling a reference to _GLOBAL_OFFSET_TABLE_.

While it doesn't make sense to try to assemble that for COFF, the fact that we previously used llvm_unreachable meant that the code had undefined behaviour if something tried to assemble that.

The configure script of libgmp would try to assemble such a snippet (which should signal a failure). If llvm is built without assertions, the undefined behaviour meant a (near) infinite loop.

Diff Detail

Event Timeline

mstorsjo created this revision.Oct 4 2018, 12:32 PM
rnk accepted this revision.Oct 4 2018, 1:07 PM

lgtm, thanks for improving the error handling. MC needs a lot of work in that area.

This revision is now accepted and ready to land.Oct 4 2018, 1:07 PM
This revision was automatically updated to reflect the committed changes.