summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-03-25 05:34:24 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-03-25 05:34:24 +0000
commit9d5961d0d89b561be9ef91ea6cca81ef00672d17 (patch)
treef82aae669b29e5776fc4ba772ef22513cc7c194f /lib/CodeGen
parentf50e7090434cf20bada71e7b9271c30fe3ca567c (diff)
downloadllvm-9d5961d0d89b561be9ef91ea6cca81ef00672d17.tar.gz
llvm-9d5961d0d89b561be9ef91ea6cca81ef00672d17.tar.bz2
llvm-9d5961d0d89b561be9ef91ea6cca81ef00672d17.tar.xz
DebugInfo: Add GNU_addr_base and GNU_ranges_base only when there are addresses or ranges
Based on code review feedback from Eric in r204672. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204702 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index a9ed9dbcb5..f4182d0b79 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -956,6 +956,17 @@ void DwarfDebug::finalizeModuleInfo() {
dwarf::DW_FORM_data8, ID);
SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
dwarf::DW_FORM_data8, ID);
+
+ // We don't keep track of which addresses are used in which CU so this
+ // is a bit pessimistic under LTO.
+ if (!InfoHolder.getAddrPool()->empty())
+ addSectionLabel(Asm, SkCU, SkCU->getUnitDie(),
+ dwarf::DW_AT_GNU_addr_base, DwarfAddrSectionSym,
+ DwarfAddrSectionSym);
+ if (!TheU->getRangeLists().empty())
+ addSectionLabel(Asm, SkCU, SkCU->getUnitDie(),
+ dwarf::DW_AT_GNU_ranges_base,
+ DwarfDebugRangeSectionSym, DwarfDebugRangeSectionSym);
}
// If we have code split among multiple sections or non-contiguous
@@ -2660,19 +2671,6 @@ DwarfCompileUnit *DwarfDebug::constructSkeletonCU(const DwarfCompileUnit *CU) {
initSkeletonUnit(CU, Die, NewCU);
- // Relocate to the beginning of the addr_base section, else 0 for the
- // beginning of the one for this compile unit.
- // We could shave off some space if we deferred adding these attributes until
- // the end of the CU to see if we have a non-empty debug_addr and debug_ranges
- // sections so we don't bother with extra attributes and relocations.
- if (Asm->MAI->doesDwarfUseRelocationsAcrossSections()) {
- NewCU->addSectionLabel(Die, dwarf::DW_AT_GNU_addr_base, DwarfAddrSectionSym);
- NewCU->addSectionLabel(Die, dwarf::DW_AT_GNU_ranges_base, DwarfDebugRangeSectionSym);
- } else {
- NewCU->addSectionOffset(Die, dwarf::DW_AT_GNU_addr_base, 0);
- NewCU->addSectionOffset(Die, dwarf::DW_AT_GNU_ranges_base, 0);
- }
-
return NewCU;
}