diff options
Diffstat (limited to 'llvm/lib/MC/MCObjectStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 3549280..be6c478 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -367,6 +367,13 @@ bool MCObjectStreamer::mayHaveInstructions(MCSection &Sec) const { void MCObjectStreamer::emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) { + const MCSection &Sec = *getCurrentSectionOnly(); + if (Sec.isVirtualSection()) { + getContext().reportError(Inst.getLoc(), Twine(Sec.getVirtualSectionKind()) + + " section '" + Sec.getName() + + "' cannot have instructions"); + return; + } getAssembler().getBackend().emitInstructionBegin(*this, Inst); emitInstructionImpl(Inst, STI); getAssembler().getBackend().emitInstructionEnd(*this, Inst); |