OSDN Git Service

[COFF] [X86] Don't use llvm_unreachable for unsupported relocation types
authorMartin Storsjo <martin@martin.st>
Thu, 4 Oct 2018 20:43:38 +0000 (20:43 +0000)
committerMartin Storsjo <martin@martin.st>
Thu, 4 Oct 2018 20:43:38 +0000 (20:43 +0000)
commit67b5d05d6d73b69d92d74cf8b2e5d11d195b5c71
tree5131e84f3c56ee4064c2895d8015c7cfb78a820b
parent9e29af39fd95d8d5af6009f298d04bbbfaf458b9
[COFF] [X86] Don't use llvm_unreachable for unsupported relocation types

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.

Differential Revision: https://reviews.llvm.org/D52903

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343811 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
test/MC/COFF/unsupported-relocations.s [new file with mode: 0644]