Make the use of DW_AT_ranges in the compile unit depend also upon

the existence of comdat/special sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199954 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2014-01-23 22:55:47 +00:00
parent e0fd567df0
commit 2f9fe10f6f
2 changed files with 104 additions and 5 deletions

View File

@ -179,7 +179,7 @@ static unsigned getDwarfVersionFromModule(const Module *M) {
DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
: Asm(A), MMI(Asm->MMI), FirstCU(0), SourceIdMap(DIEValueAllocator),
PrevLabel(NULL), GlobalRangeCount(0),
InfoHolder(A, "info_string", DIEValueAllocator),
InfoHolder(A, "info_string", DIEValueAllocator), HasCURanges(false),
SkeletonHolder(A, "skel_string", DIEValueAllocator) {
DwarfInfoSectionSym = DwarfAbbrevSectionSym = DwarfStrSectionSym = 0;
@ -209,10 +209,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
else
HasDwarfPubSections = DwarfPubSections == Enable;
// For now only turn on CU ranges if we've explicitly asked for it
// or we have -ffunction-sections enabled.
HasCURanges = DwarfCURanges || TargetMachine::getFunctionSections();
DwarfVersion = DwarfVersionNumber
? DwarfVersionNumber
: getDwarfVersionFromModule(MMI->getModule());
@ -1126,6 +1122,13 @@ void DwarfDebug::endSections() {
// Insert a final terminator.
SectionMap[Section].push_back(SymbolCU(NULL, Sym));
}
// For now only turn on CU ranges if we've explicitly asked for it,
// we have -ffunction-sections enabled, or we've emitted a function
// into a unique section. At this point all sections should be finalized
// except for dwarf sections.
HasCURanges = DwarfCURanges || Asm->TM.debugUseUniqueSections() ||
TargetMachine::getFunctionSections();
}
// Emit all Dwarf sections that should come after the content.