]> granicus.if.org Git - llvm/commitdiff
[DebugInfo] Fix build failed in clang-x86_64-linux-selfhost-modules.
authorHsiangkai Wang <hsiangkai@gmail.com>
Wed, 1 Aug 2018 04:17:41 +0000 (04:17 +0000)
committerHsiangkai Wang <hsiangkai@gmail.com>
Wed, 1 Aug 2018 04:17:41 +0000 (04:17 +0000)
Only generate symbol difference expression if needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338484 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCAssembler.cpp

index d3a84e26f1b000e5dc6c67f78727998441c6422c..1e23b6d816e8a083d946cc0a351515a2316746a8 100644 (file)
@@ -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<char> &Data = DF.getContents();