MC: Add MCAssembler::addFixup, which enforces that fixups are added in order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98379 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar
2010-03-12 21:00:38 +00:00
parent b87c305fa7
commit 8315a357e4
2 changed files with 11 additions and 6 deletions

View File

@@ -327,9 +327,8 @@ void MCMachOStreamer::EmitValue(const MCExpr *Value, unsigned Size,
for (unsigned i = 0; i != Size; ++i)
DF->getContents().push_back(uint8_t(AbsValue >> (i * 8)));
} else {
DF->getFixups().push_back(MCAsmFixup(DF->getContents().size(),
*AddValueSymbols(Value),
MCFixup::getKindForSize(Size)));
DF->addFixup(MCAsmFixup(DF->getContents().size(), *AddValueSymbols(Value),
MCFixup::getKindForSize(Size)));
DF->getContents().resize(DF->getContents().size() + Size, 0);
}
}
@@ -388,9 +387,8 @@ void MCMachOStreamer::EmitInstruction(const MCInst &Inst) {
DF = new MCDataFragment(CurSectionData);
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
MCFixup &F = Fixups[i];
DF->getFixups().push_back(MCAsmFixup(DF->getContents().size()+F.getOffset(),
*F.getValue(),
F.getKind()));
DF->addFixup(MCAsmFixup(DF->getContents().size()+F.getOffset(),
*F.getValue(), F.getKind()));
}
DF->getContents().append(Code.begin(), Code.end());
}