[llvm] r191225 - Handle gnu pubtypes sections:

Eric Christopher echristo at gmail.com
Mon Sep 23 13:55:35 PDT 2013


Author: echristo
Date: Mon Sep 23 15:55:35 2013
New Revision: 191225

URL: http://llvm.org/viewvc/llvm-project?rev=191225&view=rev
Log:
Handle gnu pubtypes sections:

a) Make sure we are emitting the correct section in our section labels
when we begin the module.
b) Make sure we are emitting the correct pubtypes section in the
presence of gnu pubtypes.
c) For C++ struct, union, class, and enumeration types are default
external.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=191225&r1=191224&r2=191225&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Sep 23 15:55:35 2013
@@ -1966,12 +1966,12 @@ void DwarfDebug::emitSectionLabels() {
   DwarfLineSectionSym =
     emitSectionSym(Asm, TLOF.getDwarfLineSection(), "section_line");
   emitSectionSym(Asm, TLOF.getDwarfLocSection());
-  if (HasDwarfPubSections) {
-    emitSectionSym(Asm, TLOF.getDwarfPubNamesSection());
-    emitSectionSym(Asm, TLOF.getDwarfPubTypesSection());
-  } else if (GenerateGnuPubSections) {
+  if (GenerateGnuPubSections) {
     emitSectionSym(Asm, TLOF.getDwarfGnuPubNamesSection());
     emitSectionSym(Asm, TLOF.getDwarfGnuPubTypesSection());
+  } else if (HasDwarfPubSections) {
+    emitSectionSym(Asm, TLOF.getDwarfPubNamesSection());
+    emitSectionSym(Asm, TLOF.getDwarfPubTypesSection());
   }
 
   DwarfStrSectionSym =
@@ -2358,6 +2358,10 @@ static dwarf::PubIndexEntryDescriptor co
   case dwarf::DW_TAG_structure_type:
   case dwarf::DW_TAG_union_type:
   case dwarf::DW_TAG_enumeration_type:
+    return dwarf::PubIndexEntryDescriptor(
+        dwarf::GIEK_TYPE, CU->getLanguage() != dwarf::DW_LANG_C_plus_plus
+                              ? dwarf::GIEL_STATIC
+                              : dwarf::GIEL_EXTERNAL);
   case dwarf::DW_TAG_typedef:
   case dwarf::DW_TAG_base_type:
   case dwarf::DW_TAG_subrange_type:
@@ -2446,7 +2450,9 @@ void DwarfDebug::emitDebugPubNames(bool
 
 void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
   const MCSection *ISec = Asm->getObjFileLowering().getDwarfInfoSection();
-  const MCSection *PSec = Asm->getObjFileLowering().getDwarfPubTypesSection();
+  const MCSection *PSec =
+      GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
+               : Asm->getObjFileLowering().getDwarfPubTypesSection();
 
   for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
                                                          E = CUMap.end();

Modified: llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll?rev=191225&r1=191224&r2=191225&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll Mon Sep 23 15:55:35 2013
@@ -33,9 +33,12 @@
 ;   int global_namespace_variable = 1;
 ; }
 
-
+; ASM: .section        .debug_gnu_pubnames
 ; ASM: .byte   32                      # Kind: VARIABLE, EXTERNAL
 
+; ASM: .section        .debug_gnu_pubtypes
+; ASM: .byte   16                      # Kind: TYPE, EXTERNAL
+
 ; CHECK: .debug_info contents:
 ; CHECK: 0x00000046: DW_TAG_subprogram
 ; CHECK-NEXT: DW_AT_MIPS_linkage_name





More information about the llvm-commits mailing list