From 2089e4c8f11aeff994c14a85b9de246538c8fd8d Mon Sep 17 00:00:00 2001 From: Hsiangkai Wang Date: Wed, 1 Aug 2018 04:17:41 +0000 Subject: [PATCH] [DebugInfo] Fix build failed in clang-x86_64-linux-selfhost-modules. Only generate symbol difference expression if needed. llvm-svn: 338484 --- llvm/lib/MC/MCAssembler.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index d3a84e26f1b0..1e23b6d816e8 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -954,7 +954,13 @@ bool MCAssembler::relaxDwarfLineAddr(MCAsmLayout &Layout, MCContext &Context = Layout.getAssembler().getContext(); uint64_t OldSize = DF.getContents().size(); int64_t AddrDelta; - bool Abs = DF.getAddrDelta().evaluateAsAbsolute(AddrDelta, Layout); + bool Abs; + if (getBackend().requiresDiffExpressionRelocations()) + Abs = DF.getAddrDelta().evaluateAsAbsolute(AddrDelta, Layout); + else { + Abs = DF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, Layout); + assert(Abs && "We created a line delta with an invalid expression"); + } int64_t LineDelta; LineDelta = DF.getLineDelta(); SmallVectorImpl &Data = DF.getContents();