[llvm] r189902 - Make the default dwarf version 3 for darwin when we can't find one

Eric Christopher echristo at gmail.com
Tue Sep 3 18:38:30 PDT 2013


Author: echristo
Date: Tue Sep  3 20:38:30 2013
New Revision: 189902

URL: http://llvm.org/viewvc/llvm-project?rev=189902&view=rev
Log:
Make the default dwarf version 3 for darwin when we can't find one
in the module. Add a FIXME with a comment about darwin's ld.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=189902&r1=189901&r2=189902&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Sep  3 20:38:30 2013
@@ -174,8 +174,12 @@ DIType DbgVariable::getType() const {
 /// Return Dwarf Version by checking module flags.
 static unsigned getDwarfVersionFromModule(const Module *M) {
   Value *Val = M->getModuleFlag("Dwarf Version");
+  // If we don't have a value in the module go ahead and use the default in
+  // dwarf::DWARF_VERSION.
+  // FIXME: Apple ld has a problem parsing compilation units that specify a
+  // dwarf version of greater than 3.
   if (!Val)
-    return dwarf::DWARF_VERSION;
+    return Triple(M->getTargetTriple()).isOSDarwin() ? 3 : dwarf::DWARF_VERSION;
   return cast<ConstantInt>(Val)->getZExtValue();
 }
 





More information about the llvm-commits mailing list