diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCAssembler.cpp | 7 | ||||
-rw-r--r-- | lib/MC/MCObjectStreamer.cpp | 7 | ||||
-rw-r--r-- | lib/MC/MCStreamer.cpp | 6 |
3 files changed, 17 insertions, 3 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index 97f675a1ff..24f4b8e635 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -708,12 +708,13 @@ void MCAssembler::writeSectionData(const MCSectionData *SD, case MCFragment::FT_Align: // Check that we aren't trying to write a non-zero value into a virtual // section. - assert((!cast<MCAlignFragment>(it)->getValueSize() || - !cast<MCAlignFragment>(it)->getValue()) && + assert((cast<MCAlignFragment>(it)->getValueSize() == 0 || + cast<MCAlignFragment>(it)->getValue() == 0) && "Invalid align in virtual section!"); break; case MCFragment::FT_Fill: - assert(!cast<MCFillFragment>(it)->getValueSize() && + assert((cast<MCFillFragment>(it)->getValueSize() == 0 || + cast<MCFillFragment>(it)->getValue() == 0) && "Invalid fill in virtual section!"); break; } diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp index a1ed01cebc..b2c9c5d045 100644 --- a/lib/MC/MCObjectStreamer.cpp +++ b/lib/MC/MCObjectStreamer.cpp @@ -18,6 +18,7 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCSection.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -374,6 +375,12 @@ void MCObjectStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue, getOrCreateDataFragment()->getContents().append(NumBytes, FillValue); } +void MCObjectStreamer::EmitZeros(uint64_t NumBytes, unsigned AddrSpace) { + assert(AddrSpace == 0 && "Address space must be 0!"); + unsigned ItemSize = getCurrentSection().first->isVirtualSection() ? 0 : 1; + insert(new MCFillFragment(0, ItemSize, NumBytes)); +} + void MCObjectStreamer::FinishImpl() { // Dump out the dwarf file & directory tables and line tables. const MCSymbol *LineSectionSymbol = NULL; diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 96dcf5c715..e4c6ce35ce 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -154,6 +154,12 @@ void MCStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue, EmitValue(E, 1, AddrSpace); } +/// EmitZeros - Emit NumBytes worth of zeros. Implementation in this class +/// just redirects to EmitFill. +void MCStreamer::EmitZeros(uint64_t NumBytes, unsigned AddrSpace) { + EmitFill(NumBytes, 0, AddrSpace); +} + bool MCStreamer::EmitDwarfFileDirective(unsigned FileNo, StringRef Directory, StringRef Filename, unsigned CUID) { |