DebugInfo: Don't emit relocations to abbreviations in debug_info.dwo
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfUnit.cpp
index 4a2b62421dd60bdec41d06f55925cd40c703a810..86005cd3d809b419bacec885ca392c55acd3c230 100644 (file)
@@ -2037,7 +2037,11 @@ void DwarfUnit::emitHeader(const MCSymbol *ASectionSym) const {
   // We share one abbreviations table across all units so it's always at the
   // start of the section. Use a relocatable offset where needed to ensure
   // linking doesn't invalidate that offset.
-  Asm->EmitSectionOffset(ASectionSym, ASectionSym);
+  if (ASectionSym)
+    Asm->EmitSectionOffset(ASectionSym, ASectionSym);
+  else
+    // Use a constant value in the dwo file, to avoid relocations
+    Asm->EmitInt32(0);
   Asm->OutStreamer.AddComment("Address Size (in bytes)");
   Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
 }