diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-08-18 18:22:37 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-08-18 18:22:37 +0000 |
commit | c983b20661d574b7adb2675478210c03ad1d0a33 (patch) | |
tree | 1ba01a0301b18aeeb59128ba90c15e350d99f839 /lib/MC/MCAssembler.cpp | |
parent | 6b63037306c5c3dc9bf719a34243de5045a949da (diff) |
MC/ELF: Allow null values in virtual sections, ELF doesn't use special
directives for putting contents in .bss, for example.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111376 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAssembler.cpp')
-rw-r--r-- | lib/MC/MCAssembler.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index 35f39564cd..f0e1d7fbc2 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -628,8 +628,23 @@ void MCAssembler::WriteSectionData(const MCSectionData *SD, switch (it->getKind()) { default: assert(0 && "Invalid fragment in virtual section!"); + case MCFragment::FT_Data: { + // Check that we aren't trying to write a non-zero contents (or fixups) + // into a virtual section. This is to support clients which use standard + // directives to fill the contents of virtual sections. + MCDataFragment &DF = cast<MCDataFragment>(*it); + assert(DF.fixup_begin() == DF.fixup_end() && + "Cannot have fixups in virtual section!"); + for (unsigned i = 0, e = DF.getContents().size(); i != e; ++i) + assert(DF.getContents()[i] == 0 && + "Invalid data value for virtual section!"); + break; + } case MCFragment::FT_Align: - assert(!cast<MCAlignFragment>(it)->getValueSize() && + // 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()) && "Invalid align in virtual section!"); break; case MCFragment::FT_Fill: |