Add the DW_AT_GNU_ranges_base attribute if we've emitted any ranges

into the debug_ranges section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191721 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2013-10-01 00:43:36 +00:00
parent 08bd923be8
commit 451c71d67b
2 changed files with 161 additions and 2 deletions

View File

@@ -2928,8 +2928,7 @@ void DwarfDebug::emitDebugMacInfo() {
// This DIE has the following attributes: DW_AT_comp_dir, DW_AT_stmt_list,
// DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges, DW_AT_dwo_name, DW_AT_dwo_id,
// DW_AT_ranges_base, DW_AT_addr_base. If DW_AT_ranges is present,
// DW_AT_low_pc and DW_AT_high_pc are not used, and vice versa.
// DW_AT_ranges_base, DW_AT_addr_base.
CompileUnit *DwarfDebug::constructSkeletonCU(const CompileUnit *CU) {
DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);
@@ -2983,6 +2982,16 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const CompileUnit *CU) {
DwarfGnuPubTypesSectionSym);
}
// Flag if we've emitted any ranges and their location for the compile unit.
if (DebugRangeSymbols.size()) {
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
NewCU->addLabel(Die, dwarf::DW_AT_GNU_ranges_base,
dwarf::DW_FORM_sec_offset, DwarfDebugRangeSectionSym);
else
NewCU->addUInt(Die, dwarf::DW_AT_GNU_ranges_base, dwarf::DW_FORM_data4,
0);
}
SkeletonHolder.addUnit(NewCU);
SkeletonCUs.push_back(NewCU);