summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-01-29 22:22:56 +0000
committerEric Christopher <echristo@gmail.com>2014-01-29 22:22:56 +0000
commitc55cb498c9d312438610eda59ecb8c531a12ee2e (patch)
treecdb8f8e24a95a27bdf2bf89ac63eed697ee62f98 /lib
parentc879504978f4bb2aebe9189ed7a3866e3003c961 (diff)
downloadllvm-c55cb498c9d312438610eda59ecb8c531a12ee2e.tar.gz
llvm-c55cb498c9d312438610eda59ecb8c531a12ee2e.tar.bz2
llvm-c55cb498c9d312438610eda59ecb8c531a12ee2e.tar.xz
If we use DW_AT_ranges we need to specify a base address that ranges
are relative to in the compile unit. Currently let's just use 0... Thanks to Greg Clayton for the catch! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index d557f40348..326c4482d2 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1054,11 +1054,17 @@ void DwarfDebug::finalizeModuleInfo() {
// FIXME: We should use ranges if we have multiple compile units or
// allow reordering of code ala .subsections_via_symbols in mach-o.
DwarfCompileUnit *U = SkCU ? SkCU : static_cast<DwarfCompileUnit *>(TheU);
- if (useCURanges() && TheU->getRanges().size())
+ if (useCURanges() && TheU->getRanges().size()) {
addSectionLabel(Asm, U, U->getUnitDie(), dwarf::DW_AT_ranges,
Asm->GetTempSymbol("cu_ranges", U->getUniqueID()),
DwarfDebugRangeSectionSym);
- else
+
+ // A DW_AT_low_pc attribute may also be specified in combination with
+ // DW_AT_ranges to specify the default base address for use in location
+ // lists (see Section 2.6.2) and range lists (see Section 2.17.3).
+ U->addUInt(U->getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
+ 0);
+ } else
U->addUInt(U->getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
0);
}