summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-10-01 00:43:36 +0000
committerEric Christopher <echristo@gmail.com>2013-10-01 00:43:36 +0000
commit451c71d67b1dd324dcd76d771cf05bf7721bdc59 (patch)
treebb7953087189b8a1b428e245aeda809690743ba9 /lib/CodeGen
parent08bd923be85d27d396c82fda7ef417c6d357bf9e (diff)
downloadllvm-451c71d67b1dd324dcd76d771cf05bf7721bdc59.tar.gz
llvm-451c71d67b1dd324dcd76d771cf05bf7721bdc59.tar.bz2
llvm-451c71d67b1dd324dcd76d771cf05bf7721bdc59.tar.xz
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
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 7dfd1dc083..3826255697 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -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);