move dwarf debug info section selection stuff from TAI to
TLOF, unifying all the dwarf targets at the same time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77889 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMTargetAsmInfo.cpp b/lib/Target/ARM/ARMTargetAsmInfo.cpp
index 3ff777c..e3348a9 100644
--- a/lib/Target/ARM/ARMTargetAsmInfo.cpp
+++ b/lib/Target/ARM/ARMTargetAsmInfo.cpp
@@ -57,17 +57,6 @@
   WeakRefDirective = "\t.weak\t";
   SetDirective = "\t.set\t";
   DwarfRequiresFrameSection = false;
-  DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"\",%progbits";
-  DwarfInfoSection =    "\t.section\t.debug_info,\"\",%progbits";
-  DwarfLineSection =    "\t.section\t.debug_line,\"\",%progbits";
-  DwarfFrameSection =   "\t.section\t.debug_frame,\"\",%progbits";
-  DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",%progbits";
-  DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",%progbits";
-  DwarfStrSection =     "\t.section\t.debug_str,\"\",%progbits";
-  DwarfLocSection =     "\t.section\t.debug_loc,\"\",%progbits";
-  DwarfARangesSection = "\t.section\t.debug_aranges,\"\",%progbits";
-  DwarfRangesSection =  "\t.section\t.debug_ranges,\"\",%progbits";
-  DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",%progbits";
 
   SupportsDebugInformation = true;
 }
diff --git a/lib/Target/COFFTargetAsmInfo.cpp b/lib/Target/COFFTargetAsmInfo.cpp
index 64f87c0..87e85ad 100644
--- a/lib/Target/COFFTargetAsmInfo.cpp
+++ b/lib/Target/COFFTargetAsmInfo.cpp
@@ -33,16 +33,5 @@
   AbsoluteEHSectionOffsets = false;
   SupportsDebugInformation = true;
   DwarfSectionOffsetDirective = "\t.secrel32\t";
-  DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"dr\"";
-  DwarfInfoSection =    "\t.section\t.debug_info,\"dr\"";
-  DwarfLineSection =    "\t.section\t.debug_line,\"dr\"";
-  DwarfFrameSection =   "\t.section\t.debug_frame,\"dr\"";
-  DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\"";
-  DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\"";
-  DwarfStrSection =     "\t.section\t.debug_str,\"dr\"";
-  DwarfLocSection =     "\t.section\t.debug_loc,\"dr\"";
-  DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\"";
-  DwarfRangesSection =  "\t.section\t.debug_ranges,\"dr\"";
-  DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\"";
 }
 
diff --git a/lib/Target/CellSPU/SPUTargetAsmInfo.cpp b/lib/Target/CellSPU/SPUTargetAsmInfo.cpp
index 66c25a8..2dcb113 100644
--- a/lib/Target/CellSPU/SPUTargetAsmInfo.cpp
+++ b/lib/Target/CellSPU/SPUTargetAsmInfo.cpp
@@ -34,17 +34,6 @@
 
   SupportsDebugInformation = true;
   NeedsSet = true;
-  DwarfAbbrevSection =  "\t.section        .debug_abbrev,\"\",@progbits";
-  DwarfInfoSection =    "\t.section        .debug_info,\"\",@progbits";
-  DwarfLineSection =    "\t.section        .debug_line,\"\",@progbits";
-  DwarfFrameSection =   "\t.section        .debug_frame,\"\",@progbits";
-  DwarfPubNamesSection = "\t.section        .debug_pubnames,\"\",@progbits";
-  DwarfPubTypesSection = "\t.section        .debug_pubtypes,\"\",progbits";
-  DwarfStrSection =     "\t.section        .debug_str,\"MS\",@progbits,1";
-  DwarfLocSection =     "\t.section        .debug_loc,\"\",@progbits";
-  DwarfARangesSection = "\t.section        .debug_aranges,\"\",@progbits";
-  DwarfRangesSection =  "\t.section        .debug_ranges,\"\",@progbits";
-  DwarfMacroInfoSection = 0;  // macro info not supported.
 
   // Exception handling is not supported on CellSPU (think about it: you only
   // have 256K for code+data. Would you support exception handling?)
diff --git a/lib/Target/DarwinTargetAsmInfo.cpp b/lib/Target/DarwinTargetAsmInfo.cpp
index 041dfa9..ad669f8 100644
--- a/lib/Target/DarwinTargetAsmInfo.cpp
+++ b/lib/Target/DarwinTargetAsmInfo.cpp
@@ -41,17 +41,5 @@
   // doesn't hurt anything.
   // FIXME: I need to get this from Triple.
   Is_EHSymbolPrivate = false;
-    
-  DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
-  DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
-  DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
-  DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
-  DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
-  DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
-  DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
-  DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
-  DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
-  DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
-  DwarfMacroInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
 }
 
diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index e8b1824..2612017 100644
--- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -41,17 +41,6 @@
   // Debug Information
   AbsoluteDebugSectionOffsets = true;
   SupportsDebugInformation = true;
-  DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"\",@progbits";
-  DwarfInfoSection =    "\t.section\t.debug_info,\"\",@progbits";
-  DwarfLineSection =    "\t.section\t.debug_line,\"\",@progbits";
-  DwarfFrameSection =   "\t.section\t.debug_frame,\"\",@progbits";
-  DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
-  DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
-  DwarfStrSection =     "\t.section\t.debug_str,\"\",@progbits";
-  DwarfLocSection =     "\t.section\t.debug_loc,\"\",@progbits";
-  DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
-  DwarfRangesSection =  "\t.section\t.debug_ranges,\"\",@progbits";
-  DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
 
   PCSymbol = ".";
 
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 7da3715..921bf20 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -84,18 +84,7 @@
   GlobalEHDirective = 0;
   SupportsWeakOmittedEHFrame = true;
   DwarfSectionOffsetDirective = 0;
-  DwarfAbbrevSection = ".debug_abbrev";
-  DwarfInfoSection = ".debug_info";
-  DwarfLineSection = ".debug_line";
-  DwarfFrameSection = ".debug_frame";
-  DwarfPubNamesSection = ".debug_pubnames";
-  DwarfPubTypesSection = ".debug_pubtypes";
-  DwarfDebugInlineSection = ".debug_inlined";
-  DwarfStrSection = ".debug_str";
-  DwarfLocSection = ".debug_loc";
-  DwarfARangesSection = ".debug_aranges";
-  DwarfRangesSection = ".debug_ranges";
-  DwarfMacroInfoSection = ".debug_macinfo";
+
   AsmTransCBE = 0;
 }
 
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 38ae71e..cb950af 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -38,6 +38,19 @@
   StaticDtorSection = 0;
   LSDASection = 0;
   EHFrameSection = 0;
+
+  DwarfAbbrevSection = 0;
+  DwarfInfoSection = 0;
+  DwarfLineSection = 0;
+  DwarfFrameSection = 0;
+  DwarfPubNamesSection = 0;
+  DwarfPubTypesSection = 0;
+  DwarfDebugInlineSection = 0;
+  DwarfStrSection = 0;
+  DwarfLocSection = 0;
+  DwarfARangesSection = 0;
+  DwarfRangesSection = 0;
+  DwarfMacroInfoSection = 0;
 }
 
 TargetLoweringObjectFile::~TargetLoweringObjectFile() {
@@ -305,6 +318,7 @@
   StaticDtorSection =
     getOrCreateSection(".dtors", false, SectionKind::getDataRel());
   
+  // Exception Handling Sections.
   
   // FIXME: We're emitting LSDA info into a readonly section on ELF, even though
   // it contains relocatable pointers.  In PIC mode, this is probably a big
@@ -314,6 +328,30 @@
     getOrCreateSection(".gcc_except_table", false, SectionKind::getReadOnly());
   EHFrameSection =
     getOrCreateSection(".eh_frame", false, SectionKind::getDataRel());
+  
+  // Debug Info Sections.
+  DwarfAbbrevSection = 
+    getOrCreateSection(".debug_abbrev", false, SectionKind::getMetadata());
+  DwarfInfoSection = 
+    getOrCreateSection(".debug_info", false, SectionKind::getMetadata());
+  DwarfLineSection = 
+    getOrCreateSection(".debug_line", false, SectionKind::getMetadata());
+  DwarfFrameSection = 
+    getOrCreateSection(".debug_frame", false, SectionKind::getMetadata());
+  DwarfPubNamesSection = 
+    getOrCreateSection(".debug_pubnames", false, SectionKind::getMetadata());
+  DwarfPubTypesSection = 
+    getOrCreateSection(".debug_pubtypes", false, SectionKind::getMetadata());
+  DwarfStrSection = 
+    getOrCreateSection(".debug_str", false, SectionKind::getMetadata());
+  DwarfLocSection = 
+    getOrCreateSection(".debug_loc", false, SectionKind::getMetadata());
+  DwarfARangesSection = 
+    getOrCreateSection(".debug_aranges", false, SectionKind::getMetadata());
+  DwarfRangesSection = 
+    getOrCreateSection(".debug_ranges", false, SectionKind::getMetadata());
+  DwarfMacroInfoSection = 
+    getOrCreateSection(".debug_macinfo", false, SectionKind::getMetadata());
 }
 
 
@@ -549,11 +587,52 @@
       getOrCreateSection(".mod_term_func", true, SectionKind::getDataRel());
   }
   
+  // Exception Handling.
   LSDASection = getOrCreateSection("__DATA,__gcc_except_tab", false,
                                    SectionKind::getDataRel());
   EHFrameSection =
     getOrCreateSection("__TEXT,__eh_frame,coalesced,no_toc+strip_static_syms"
                        "+live_support", false, SectionKind::getReadOnly());
+
+  // Debug Information.
+  // FIXME: Don't use 'directive' syntax: need flags for debug/regular??
+  // FIXME: Need __DWARF segment.
+  DwarfAbbrevSection = 
+    getOrCreateSection(".section __DWARF,__debug_abbrev,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfInfoSection =  
+    getOrCreateSection(".section __DWARF,__debug_info,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfLineSection =  
+    getOrCreateSection(".section __DWARF,__debug_line,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfFrameSection =  
+    getOrCreateSection(".section __DWARF,__debug_frame,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfPubNamesSection =  
+    getOrCreateSection(".section __DWARF,__debug_pubnames,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfPubTypesSection =  
+    getOrCreateSection(".section __DWARF,__debug_pubtypes,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfStrSection =  
+    getOrCreateSection(".section __DWARF,__debug_str,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfLocSection =  
+    getOrCreateSection(".section __DWARF,__debug_loc,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfARangesSection =  
+    getOrCreateSection(".section __DWARF,__debug_aranges,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfRangesSection =  
+    getOrCreateSection(".section __DWARF,__debug_ranges,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfMacroInfoSection =  
+    getOrCreateSection(".section __DWARF,__debug_macinfo,regular,debug", true,
+                       SectionKind::getMetadata());
+  DwarfDebugInlineSection = 
+    getOrCreateSection(".section __DWARF,__debug_inlined,regular,debug", true,
+                       SectionKind::getMetadata());
 }
 
 const MCSection *TargetLoweringObjectFileMachO::
@@ -665,6 +744,43 @@
     getOrCreateSection(".ctors", false, SectionKind::getDataRel());
   StaticDtorSection =
     getOrCreateSection(".dtors", false, SectionKind::getDataRel());
+  
+  
+  // Debug info.
+  // FIXME: Don't use 'directive' mode here.
+  DwarfAbbrevSection =  
+    getOrCreateSection("\t.section\t.debug_abbrev,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfInfoSection =    
+    getOrCreateSection("\t.section\t.debug_info,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfLineSection =    
+    getOrCreateSection("\t.section\t.debug_line,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfFrameSection =   
+    getOrCreateSection("\t.section\t.debug_frame,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfPubNamesSection =
+    getOrCreateSection("\t.section\t.debug_pubnames,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfPubTypesSection =
+    getOrCreateSection("\t.section\t.debug_pubtypes,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfStrSection =     
+    getOrCreateSection("\t.section\t.debug_str,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfLocSection =     
+    getOrCreateSection("\t.section\t.debug_loc,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfARangesSection = 
+    getOrCreateSection("\t.section\t.debug_aranges,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfRangesSection =  
+    getOrCreateSection("\t.section\t.debug_ranges,\"dr\"",
+                       true, SectionKind::getMetadata());
+  DwarfMacroInfoSection = 
+    getOrCreateSection("\t.section\t.debug_macinfo,\"dr\"",
+                       true, SectionKind::getMetadata());
 }
 
 void TargetLoweringObjectFileCOFF::
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index 24136ba..7611567 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -74,7 +74,6 @@
   ProtectedDirective = "\t.globl\t";
 
   SupportsDebugInformation = true;
-  DwarfDebugInlineSection = ".section __DWARF,__debug_inlined,regular,debug";
   DwarfUsesInlineInfoSection = true;
 
   // Exceptions handling
@@ -98,17 +97,6 @@
   // Debug Information
   AbsoluteDebugSectionOffsets = true;
   SupportsDebugInformation = true;
-  DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"\",@progbits";
-  DwarfInfoSection =    "\t.section\t.debug_info,\"\",@progbits";
-  DwarfLineSection =    "\t.section\t.debug_line,\"\",@progbits";
-  DwarfFrameSection =   "\t.section\t.debug_frame,\"\",@progbits";
-  DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
-  DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
-  DwarfStrSection =     "\t.section\t.debug_str,\"\",@progbits";
-  DwarfLocSection =     "\t.section\t.debug_loc,\"\",@progbits";
-  DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
-  DwarfRangesSection =  "\t.section\t.debug_ranges,\"\",@progbits";
-  DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
 
   // Exceptions handling
   SupportsExceptionHandling = true;
diff --git a/lib/Target/XCore/XCoreTargetAsmInfo.cpp b/lib/Target/XCore/XCoreTargetAsmInfo.cpp
index a5bc6c2..eebd6c9 100644
--- a/lib/Target/XCore/XCoreTargetAsmInfo.cpp
+++ b/lib/Target/XCore/XCoreTargetAsmInfo.cpp
@@ -27,17 +27,5 @@
   // Debug
   HasLEB128 = true;
   AbsoluteDebugSectionOffsets = true;
-  
-  DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
-  DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
-  DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
-  DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
-  DwarfPubNamesSection = "\t.section\t.debug_pubnames,\"\",@progbits";
-  DwarfPubTypesSection = "\t.section\t.debug_pubtypes,\"\",@progbits";
-  DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
-  DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
-  DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
-  DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
-  DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
 }