From 04031a6c2266c32b658e412147334d553990cfd5 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 4 Sep 2013 01:38:30 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189902 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index b1a75fba6ca..ce684ffe80a 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -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(Val)->getZExtValue(); }