Add debug support for X86/ELF targets (Linux). This allows llvm-gcc4
[oota-llvm.git] / lib / Target / X86 / X86AsmPrinter.cpp
index 38dbe57aed0fa45f4f502600c1c7ef082d106dd2..60316517a829e5edd6302b73ea3f5dd2f28463f5 100644 (file)
@@ -114,6 +114,9 @@ bool X86SharedAsmPrinter::doInitialization(Module &M) {
     if (!Subtarget->is64Bit())
       X86PICStyle = PICStyle::Stub;
 
+    // Emit initial debug information.
+    DW.BeginModule(&M);
+  } else if (Subtarget->isTargetELF()) {
     // Emit initial debug information.
     DW.BeginModule(&M);
   }
@@ -278,7 +281,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
       O << "\t.long\t0\n";
     }
 
-    // Emit initial debug information.
+    // Emit final debug information.
     DW.EndModule();
 
     // Funny Darwin hack: This flag tells the linker that no global symbols
@@ -287,6 +290,9 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
     // linker can safely perform dead code stripping.  Since LLVM never
     // generates code that does this, it is always safe to set.
     O << "\t.subsections_via_symbols\n";
+  } else if (Subtarget->isTargetELF()) {
+    // Emit final debug information.
+    DW.EndModule();
   }
 
   AsmPrinter::doFinalization(M);