From: Chris Lattner Date: Sun, 2 Aug 2009 07:24:22 +0000 (+0000) Subject: move dwarf debug info section selection stuff from TAI to X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=18a4c16726db2b8874c7b84d04650dda80746074;p=oota-llvm.git 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/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h index 75b3bdf025b..75a90538618 100644 --- a/include/llvm/Target/TargetAsmInfo.h +++ b/include/llvm/Target/TargetAsmInfo.h @@ -315,58 +315,6 @@ namespace llvm { /// DwarfSectionOffsetDirective - Special section offset directive. const char* DwarfSectionOffsetDirective; // Defaults to NULL - /// DwarfAbbrevSection - Section directive for Dwarf abbrev. - /// - const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev". - - /// DwarfInfoSection - Section directive for Dwarf info. - /// - const char *DwarfInfoSection; // Defaults to ".debug_info". - - /// DwarfLineSection - Section directive for Dwarf info. - /// - const char *DwarfLineSection; // Defaults to ".debug_line". - - /// DwarfFrameSection - Section directive for Dwarf info. - /// - const char *DwarfFrameSection; // Defaults to ".debug_frame". - - /// DwarfPubNamesSection - Section directive for Dwarf info. - /// - const char *DwarfPubNamesSection; // Defaults to ".debug_pubnames". - - /// DwarfPubTypesSection - Section directive for Dwarf info. - /// - const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes". - - /// DwarfDebugInlineSection - Section directive for inline info. - /// - const char *DwarfDebugInlineSection; // Defaults to ".debug_inlined" - - /// DwarfStrSection - Section directive for Dwarf info. - /// - const char *DwarfStrSection; // Defaults to ".debug_str". - - /// DwarfLocSection - Section directive for Dwarf info. - /// - const char *DwarfLocSection; // Defaults to ".debug_loc". - - /// DwarfARangesSection - Section directive for Dwarf info. - /// - const char *DwarfARangesSection; // Defaults to ".debug_aranges". - - /// DwarfRangesSection - Section directive for Dwarf info. - /// - const char *DwarfRangesSection; // Defaults to ".debug_ranges". - - /// DwarfMacroInfoSection - Section directive for DWARF macro info. - /// - const char *DwarfMacroInfoSection; // Defaults to ".debug_macinfo". - - /// DwarfEHFrameSection - Section directive for Exception frames. - /// - const char *DwarfEHFrameSection; // Defaults to ".eh_frame". - //===--- CBE Asm Translation Table -----------------------------------===// const char *const *AsmTransCBE; // Defaults to empty @@ -584,45 +532,6 @@ namespace llvm { const char *getDwarfSectionOffsetDirective() const { return DwarfSectionOffsetDirective; } - const char *getDwarfAbbrevSection() const { - return DwarfAbbrevSection; - } - const char *getDwarfInfoSection() const { - return DwarfInfoSection; - } - const char *getDwarfLineSection() const { - return DwarfLineSection; - } - const char *getDwarfFrameSection() const { - return DwarfFrameSection; - } - const char *getDwarfPubNamesSection() const { - return DwarfPubNamesSection; - } - const char *getDwarfPubTypesSection() const { - return DwarfPubTypesSection; - } - const char *getDwarfDebugInlineSection() const { - return DwarfDebugInlineSection; - } - const char *getDwarfStrSection() const { - return DwarfStrSection; - } - const char *getDwarfLocSection() const { - return DwarfLocSection; - } - const char *getDwarfARangesSection() const { - return DwarfARangesSection; - } - const char *getDwarfRangesSection() const { - return DwarfRangesSection; - } - const char *getDwarfMacroInfoSection() const { - return DwarfMacroInfoSection; - } - const char *getDwarfEHFrameSection() const { - return DwarfEHFrameSection; - } const char *const *getAsmCBE() const { return AsmTransCBE; } diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h index b4d9b59035f..c81cdc46387 100644 --- a/include/llvm/Target/TargetLoweringObjectFile.h +++ b/include/llvm/Target/TargetLoweringObjectFile.h @@ -66,6 +66,20 @@ protected: /// the section the EH Frame is emitted to. const MCSection *EHFrameSection; + // Dwarf sections for debug info. If a target supports debug info, these must + // be set. + const MCSection *DwarfAbbrevSection; + const MCSection *DwarfInfoSection; + const MCSection *DwarfLineSection; + const MCSection *DwarfFrameSection; + const MCSection *DwarfPubNamesSection; + const MCSection *DwarfPubTypesSection; + const MCSection *DwarfDebugInlineSection; + const MCSection *DwarfStrSection; + const MCSection *DwarfLocSection; + const MCSection *DwarfARangesSection; + const MCSection *DwarfRangesSection; + const MCSection *DwarfMacroInfoSection; public: // FIXME: NONPUB. @@ -90,7 +104,23 @@ public: const MCSection *getStaticDtorSection() const { return StaticDtorSection; } const MCSection *getLSDASection() const { return LSDASection; } const MCSection *getEHFrameSection() const { return EHFrameSection; } - + const MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; } + const MCSection *getDwarfInfoSection() const { return DwarfInfoSection; } + const MCSection *getDwarfLineSection() const { return DwarfLineSection; } + const MCSection *getDwarfFrameSection() const { return DwarfFrameSection; } + const MCSection *getDwarfPubNamesSection() const{return DwarfPubNamesSection;} + const MCSection *getDwarfPubTypesSection() const{return DwarfPubTypesSection;} + const MCSection *getDwarfDebugInlineSection() const { + return DwarfDebugInlineSection; + } + const MCSection *getDwarfStrSection() const { return DwarfStrSection; } + const MCSection *getDwarfLocSection() const { return DwarfLocSection; } + const MCSection *getDwarfARangesSection() const { return DwarfARangesSection;} + const MCSection *getDwarfRangesSection() const { return DwarfRangesSection; } + const MCSection *getDwarfMacroInfoSection() const { + return DwarfMacroInfoSection; + } + /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively /// decide not to emit the UsedDirective for some symbols in llvm.used. /// FIXME: REMOVE this (rdar://7071300) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 873cdc2c5cb..3cb273fd582 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1866,31 +1866,32 @@ void DwarfDebug::EmitInitial() { // Dwarf sections base addresses. if (TAI->doesDwarfRequireFrameSection()) { - Asm->SwitchToDataSection(TAI->getDwarfFrameSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfFrameSection()); EmitLabel("section_debug_frame", 0); } - Asm->SwitchToDataSection(TAI->getDwarfInfoSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfInfoSection()); EmitLabel("section_info", 0); - Asm->SwitchToDataSection(TAI->getDwarfAbbrevSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfAbbrevSection()); EmitLabel("section_abbrev", 0); - Asm->SwitchToDataSection(TAI->getDwarfARangesSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfARangesSection()); EmitLabel("section_aranges", 0); - if (const char *LineInfoDirective = TAI->getDwarfMacroInfoSection()) { - Asm->SwitchToDataSection(LineInfoDirective); + if (const MCSection *LineInfoDirective = + Asm->getObjFileLowering().getDwarfMacroInfoSection()) { + Asm->SwitchToSection(LineInfoDirective); EmitLabel("section_macinfo", 0); } - Asm->SwitchToDataSection(TAI->getDwarfLineSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLineSection()); EmitLabel("section_line", 0); - Asm->SwitchToDataSection(TAI->getDwarfLocSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLocSection()); EmitLabel("section_loc", 0); - Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfPubNamesSection()); EmitLabel("section_pubnames", 0); - Asm->SwitchToDataSection(TAI->getDwarfStrSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfStrSection()); EmitLabel("section_str", 0); - Asm->SwitchToDataSection(TAI->getDwarfRangesSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfRangesSection()); EmitLabel("section_ranges", 0); Asm->SwitchToSection(Asm->getObjFileLowering().getTextSection()); @@ -1997,7 +1998,7 @@ void DwarfDebug::EmitDebugInfoPerCU(CompileUnit *Unit) { void DwarfDebug::EmitDebugInfo() { // Start debug info section. - Asm->SwitchToDataSection(TAI->getDwarfInfoSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfInfoSection()); EmitDebugInfoPerCU(ModuleCU); } @@ -2008,7 +2009,7 @@ void DwarfDebug::EmitAbbreviations() const { // Check to see if it is worth the effort. if (!Abbreviations.empty()) { // Start the debug abbrev section. - Asm->SwitchToDataSection(TAI->getDwarfAbbrevSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfAbbrevSection()); EmitLabel("abbrev_begin", 0); @@ -2065,7 +2066,7 @@ void DwarfDebug::EmitDebugLines() { const int MaxLineDelta = 255 + MinLineDelta; // Start the dwarf line section. - Asm->SwitchToDataSection(TAI->getDwarfLineSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLineSection()); // Construct the section header. EmitDifference("line_end", 0, "line_begin", 0, true); @@ -2225,7 +2226,7 @@ void DwarfDebug::EmitCommonDebugFrame() { TD->getPointerSize() : -TD->getPointerSize(); // Start the dwarf frame section. - Asm->SwitchToDataSection(TAI->getDwarfFrameSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfFrameSection()); EmitLabel("debug_frame_common", 0); EmitDifference("debug_frame_common_end", 0, @@ -2265,7 +2266,7 @@ DwarfDebug::EmitFunctionDebugFrame(const FunctionDebugFrameInfo&DebugFrameInfo){ return; // Start the dwarf frame section. - Asm->SwitchToDataSection(TAI->getDwarfFrameSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfFrameSection()); EmitDifference("debug_frame_end", DebugFrameInfo.Number, "debug_frame_begin", DebugFrameInfo.Number, true); @@ -2329,7 +2330,7 @@ void DwarfDebug::EmitDebugPubNamesPerCU(CompileUnit *Unit) { /// void DwarfDebug::EmitDebugPubNames() { // Start the dwarf pubnames section. - Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfPubNamesSection()); EmitDebugPubNamesPerCU(ModuleCU); } @@ -2340,7 +2341,7 @@ void DwarfDebug::EmitDebugStr() { // Check to see if it is worth the effort. if (!StringPool.empty()) { // Start the dwarf str section. - Asm->SwitchToDataSection(TAI->getDwarfStrSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfStrSection()); // For each of strings in the string pool. for (unsigned StringID = 1, N = StringPool.size(); @@ -2361,7 +2362,7 @@ void DwarfDebug::EmitDebugStr() { /// void DwarfDebug::EmitDebugLoc() { // Start the dwarf loc section. - Asm->SwitchToDataSection(TAI->getDwarfLocSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLocSection()); Asm->EOL(); } @@ -2369,7 +2370,7 @@ void DwarfDebug::EmitDebugLoc() { /// void DwarfDebug::EmitDebugARanges() { // Start the dwarf aranges section. - Asm->SwitchToDataSection(TAI->getDwarfARangesSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfARangesSection()); // FIXME - Mock up #if 0 @@ -2405,16 +2406,17 @@ void DwarfDebug::EmitDebugARanges() { /// void DwarfDebug::EmitDebugRanges() { // Start the dwarf ranges section. - Asm->SwitchToDataSection(TAI->getDwarfRangesSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfRangesSection()); Asm->EOL(); } /// EmitDebugMacInfo - Emit visible names into a debug macinfo section. /// void DwarfDebug::EmitDebugMacInfo() { - if (const char *LineInfoDirective = TAI->getDwarfMacroInfoSection()) { + if (const MCSection *LineInfo = + Asm->getObjFileLowering().getDwarfMacroInfoSection()) { // Start the dwarf macinfo section. - Asm->SwitchToDataSection(LineInfoDirective); + Asm->SwitchToSection(LineInfo); Asm->EOL(); } } @@ -2444,7 +2446,7 @@ void DwarfDebug::EmitDebugInlineInfo() { if (!ModuleCU) return; - Asm->SwitchToDataSection(TAI->getDwarfDebugInlineSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfDebugInlineSection()); Asm->EOL(); EmitDifference("debug_inlined_end", 1, "debug_inlined_begin", 1, true); diff --git a/lib/Target/ARM/ARMTargetAsmInfo.cpp b/lib/Target/ARM/ARMTargetAsmInfo.cpp index 3ff777c73d3..e3348a90d45 100644 --- a/lib/Target/ARM/ARMTargetAsmInfo.cpp +++ b/lib/Target/ARM/ARMTargetAsmInfo.cpp @@ -57,17 +57,6 @@ ARMELFTargetAsmInfo::ARMELFTargetAsmInfo() { 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 64f87c0646a..87e85adcb43 100644 --- a/lib/Target/COFFTargetAsmInfo.cpp +++ b/lib/Target/COFFTargetAsmInfo.cpp @@ -33,16 +33,5 @@ COFFTargetAsmInfo::COFFTargetAsmInfo() { 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 66c25a84b4b..2dcb1135c57 100644 --- a/lib/Target/CellSPU/SPUTargetAsmInfo.cpp +++ b/lib/Target/CellSPU/SPUTargetAsmInfo.cpp @@ -34,17 +34,6 @@ SPULinuxTargetAsmInfo::SPULinuxTargetAsmInfo() { 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 041dfa9ece4..ad669f8c035 100644 --- a/lib/Target/DarwinTargetAsmInfo.cpp +++ b/lib/Target/DarwinTargetAsmInfo.cpp @@ -41,17 +41,5 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo() { // 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 e8b1824c3ed..26120175fb9 100644 --- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -41,17 +41,6 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) : // 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 7da3715d266..921bf20064d 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -84,18 +84,7 @@ TargetAsmInfo::TargetAsmInfo() { 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 38ae71e67d6..cb950af82cd 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -38,6 +38,19 @@ TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) { 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 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx, 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 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx, 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 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx, 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 @@ void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx, 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 24136ba3119..761156759f3 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -74,7 +74,6 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM): ProtectedDirective = "\t.globl\t"; SupportsDebugInformation = true; - DwarfDebugInlineSection = ".section __DWARF,__debug_inlined,regular,debug"; DwarfUsesInlineInfoSection = true; // Exceptions handling @@ -98,17 +97,6 @@ X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) : // 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 a5bc6c2fc6b..eebd6c96ed5 100644 --- a/lib/Target/XCore/XCoreTargetAsmInfo.cpp +++ b/lib/Target/XCore/XCoreTargetAsmInfo.cpp @@ -27,17 +27,5 @@ XCoreTargetAsmInfo::XCoreTargetAsmInfo() { // 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"; }