summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-12 22:51:27 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-12 22:51:27 +0000
commite73d49eda2cb4fc30b52c4a241acf69c8af98302 (patch)
tree6fd62d995a8f635a61d67a890e312e62e2a18dbb /lib
parent2745f6e920dd8b562ded008e3e34acc873c5a36f (diff)
downloadllvm-e73d49eda2cb4fc30b52c4a241acf69c8af98302.tar.gz
llvm-e73d49eda2cb4fc30b52c4a241acf69c8af98302.tar.bz2
llvm-e73d49eda2cb4fc30b52c4a241acf69c8af98302.tar.xz
MC: Drop support for alignment in ZeroFill fragment, we can just use
MCAlignFragments for this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/MCAssembler.cpp15
-rw-r--r--lib/MC/MCMachOStreamer.cpp7
2 files changed, 10 insertions, 12 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index 7bcce2e7e3..fbda26b4ce 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -421,16 +421,7 @@ void MCAssembler::LayoutFragment(MCAsmLayout &Layout, MCFragment &F) {
}
case MCFragment::FT_ZeroFill: {
- MCZeroFillFragment &ZFF = cast<MCZeroFillFragment>(F);
-
- // Align the fragment offset; it is safe to adjust the offset freely since
- // this is only in virtual sections.
- //
- // FIXME: We shouldn't be doing this here.
- Address = RoundUpToAlignment(Address, ZFF.getAlignment());
- Layout.setFragmentOffset(&F, Address - StartAddress);
-
- EffectiveSize = ZFF.getSize();
+ EffectiveSize = cast<MCZeroFillFragment>(F).getSize();
break;
}
}
@@ -498,6 +489,8 @@ static void WriteFragmentData(const MCAssembler &Asm, const MCAsmLayout &Layout,
MCAlignFragment &AF = cast<MCAlignFragment>(F);
uint64_t Count = FragmentSize / AF.getValueSize();
+ assert(AF.getValueSize() && "Invalid virtual align in concrete fragment!");
+
// FIXME: This error shouldn't actually occur (the front end should emit
// multiple .align directives to enforce the semantics it wants), but is
// severe enough that we want to report it. How to handle this?
@@ -912,7 +905,7 @@ void MCZeroFillFragment::dump() {
OS << "<MCZeroFillFragment ";
this->MCFragment::dump();
OS << "\n ";
- OS << " Size:" << getSize() << " Alignment:" << getAlignment() << ">";
+ OS << " Size:" << getSize() << ">";
}
void MCSectionData::dump() {
diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp
index ad6ce79ff3..eb49a40707 100644
--- a/lib/MC/MCMachOStreamer.cpp
+++ b/lib/MC/MCMachOStreamer.cpp
@@ -321,7 +321,12 @@ void MCMachOStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
MCSymbolData &SD = Assembler.getOrCreateSymbolData(*Symbol);
- MCFragment *F = new MCZeroFillFragment(Size, ByteAlignment, &SectData);
+ // Emit an align fragment if necessary.
+ if (ByteAlignment != 1)
+ new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, /*EmitNops=*/false,
+ &SectData);
+
+ MCFragment *F = new MCZeroFillFragment(Size, &SectData);
SD.setFragment(F);
if (Assembler.isSymbolLinkerVisible(&SD))
F->setAtom(&SD);