diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index bff883672d3..3fd0c53c5ca 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -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(); diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp index cbc66f1cf9b..af102ecf78a 100644 --- a/lib/MC/MCObjectStreamer.cpp +++ b/lib/MC/MCObjectStreamer.cpp @@ -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()); }