mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 06:09:05 +00:00
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:
parent
b87c305fa7
commit
8315a357e4
@ -162,6 +162,13 @@ public:
|
||||
/// @name Fixup Access
|
||||
/// @{
|
||||
|
||||
void addFixup(MCAsmFixup Fixup) {
|
||||
// Enforce invariant that fixups are in offset order.
|
||||
assert(Fixups.empty() || Fixup.Offset > Fixups.back().Offset &&
|
||||
"Fixups must be added in order!");
|
||||
Fixups.push_back(Fixup);
|
||||
}
|
||||
|
||||
std::vector<MCAsmFixup> &getFixups() { return Fixups; }
|
||||
const std::vector<MCAsmFixup> &getFixups() const { return Fixups; }
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user