Fixed a crash in llvm-mc for Mach-O when a symbol difference expression uses a
[oota-llvm.git] / lib / MC / MCObjectWriter.cpp
index 1888739..030f247 100644 (file)
@@ -68,6 +68,8 @@ MCObjectWriter::IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
 
   const MCSymbolData &DataA = Asm.getSymbolData(SA);
   const MCSymbolData &DataB = Asm.getSymbolData(SB);
+  if(!DataA.getFragment() || !DataB.getFragment())
+    return false;
 
   return IsSymbolRefDifferenceFullyResolvedImpl(Asm, DataA,
                                                 *DataB.getFragment(),