Assert that the AddrDelta expression is really constant and wrap it in a set

if we have a lame assembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122446 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2010-12-22 22:04:28 +00:00
parent 770d42de3b
commit 835439a397
2 changed files with 10 additions and 2 deletions

View File

@ -687,7 +687,9 @@ bool MCAssembler::RelaxDwarfLineAddr(MCAsmLayout &Layout,
MCDwarfLineAddrFragment &DF) {
int64_t AddrDelta = 0;
uint64_t OldSize = DF.getContents().size();
DF.getAddrDelta().EvaluateAsAbsolute(AddrDelta, Layout);
bool IsAbs = DF.getAddrDelta().EvaluateAsAbsolute(AddrDelta, Layout);
(void)IsAbs;
assert(IsAbs);
int64_t LineDelta;
LineDelta = DF.getLineDelta();
SmallString<8> &Data = DF.getContents();

View File

@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/Support/ErrorHandling.h"
@ -90,7 +91,7 @@ void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
return;
}
DF->addFixup(MCFixup::Create(DF->getContents().size(),
AddValueSymbols(Value),
Value,
MCFixup::getKindForSize(Size, isPCRel)));
DF->getContents().resize(DF->getContents().size() + Size, 0);
}
@ -210,6 +211,11 @@ void MCObjectStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
MCDwarfLineAddr::Emit(this, LineDelta, Res);
return;
}
if (!getContext().getAsmInfo().hasAggressiveSymbolFolding()) {
MCSymbol *ABS = getContext().CreateTempSymbol();
EmitAssignment(ABS, AddrDelta);
AddrDelta = MCSymbolRefExpr::Create(ABS, getContext());
}
new MCDwarfLineAddrFragment(LineDelta, *AddrDelta, getCurrentSectionData());
}