[llvm] r188869 - DebugInfo: Do not use the DWARF Version for the .debug_pubnames or .debug_pubtypes version field

David Majnemer david.majnemer at gmail.com
Tue Aug 20 23:13:34 PDT 2013


Author: majnemer
Date: Wed Aug 21 01:13:34 2013
New Revision: 188869

URL: http://llvm.org/viewvc/llvm-project?rev=188869&view=rev
Log:
DebugInfo: Do not use the DWARF Version for the .debug_pubnames or .debug_pubtypes version field

Summary:
LLVM would generate DWARF with version 3 in the .debug_pubname and
.debug_pubtypes version fields.  This would lead SGI dwarfdump to fail
parsing the DWARF with (in the instance of .debug_pubnames) would exit
with:
dwarfdump ERROR:  dwarf_get_globals: DW_DLE_PUBNAMES_VERSION_ERROR (123)

This fixes PR16950.

Reviewers: echristo, dblaikie

Reviewed By: echristo

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1454

Modified:
    llvm/trunk/include/llvm/Support/Dwarf.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/test/DebugInfo/dwarf-public-names.ll

Modified: llvm/trunk/include/llvm/Support/Dwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=188869&r1=188868&r2=188869&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.h (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.h Wed Aug 21 01:13:34 2013
@@ -56,7 +56,9 @@ enum llvm_dwarf_constants {
 
   DW_TAG_user_base = 0x1000,            // Recommended base for user tags.
 
-  DW_CIE_VERSION = 1                    // Common frame information version.
+  DW_CIE_VERSION = 1,                   // Common frame information version.
+  DW_PUBTYPES_VERSION = 2,              // Section version number for .debug_pubtypes.
+  DW_PUBNAMES_VERSION = 2               // Section version number for .debug_pubnames.
 };
 
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=188869&r1=188868&r2=188869&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Aug 21 01:13:34 2013
@@ -35,6 +35,7 @@
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/Dwarf.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/MD5.h"
@@ -2321,7 +2322,7 @@ void DwarfDebug::emitDebugPubnames() {
     Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubnames_begin", ID));
 
     Asm->OutStreamer.AddComment("DWARF Version");
-    Asm->EmitInt16(DwarfVersion);
+    Asm->EmitInt16(dwarf::DW_PUBNAMES_VERSION);
 
     Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
     Asm->EmitSectionOffset(Asm->GetTempSymbol(ISec->getLabelBeginName(), ID),
@@ -2368,7 +2369,7 @@ void DwarfDebug::emitDebugPubTypes() {
                                                   TheCU->getUniqueID()));
 
     if (Asm->isVerbose()) Asm->OutStreamer.AddComment("DWARF Version");
-    Asm->EmitInt16(DwarfVersion);
+    Asm->EmitInt16(dwarf::DW_PUBTYPES_VERSION);
 
     Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
     const MCSection *ISec = Asm->getObjFileLowering().getDwarfInfoSection();

Modified: llvm/trunk/test/DebugInfo/dwarf-public-names.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarf-public-names.ll?rev=188869&r1=188868&r2=188869&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarf-public-names.ll (original)
+++ llvm/trunk/test/DebugInfo/dwarf-public-names.ll Wed Aug 21 01:13:34 2013
@@ -37,6 +37,7 @@
 
 ; Skip the output to the header of the pubnames section.
 ; CHECK: debug_pubnames
+; CHECK: Version:               2
 
 ; Check for each name in the output.
 ; CHECK: global_namespace_variable





More information about the llvm-commits mailing list