diff options
author | Eric Christopher <echristo@gmail.com> | 2014-01-15 00:04:29 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2014-01-15 00:04:29 +0000 |
commit | cd94a7676a7f3a8b1c2ed42809b28d3319c671c1 (patch) | |
tree | f29aec58c027150ad293d1647fbaa51507333e27 /lib/CodeGen | |
parent | 1dc66089e6e1e5d226ec1f5e98a0612f68def89d (diff) | |
download | llvm-cd94a7676a7f3a8b1c2ed42809b28d3319c671c1.tar.gz llvm-cd94a7676a7f3a8b1c2ed42809b28d3319c671c1.tar.bz2 llvm-cd94a7676a7f3a8b1c2ed42809b28d3319c671c1.tar.xz |
Make sure we emit a relocation to the debug_ranges section in the
presence of CU ranges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199276 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 9 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.h | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index c895f17931..f76e898cfb 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -209,6 +209,10 @@ 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()); @@ -1057,8 +1061,7 @@ 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 ((DwarfCURanges || TargetMachine::getFunctionSections()) && - TheU->getRanges().size()) + if (useCURanges() && TheU->getRanges().size()) addSectionLabel(Asm, U, U->getUnitDie(), dwarf::DW_AT_ranges, Asm->GetTempSymbol("cu_ranges", U->getUniqueID()), DwarfDebugRangeSectionSym); @@ -2910,7 +2913,7 @@ void DwarfDebug::emitDebugRanges() { } // Now emit a range for the CU itself. - if (DwarfCURanges) { + if (useCURanges()) { Asm->OutStreamer.EmitLabel( Asm->GetTempSymbol("cu_ranges", TheCU->getUniqueID())); const SmallVectorImpl<RangeSpan> &Ranges = TheCU->getRanges(); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index 5a21106055..516def804d 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -458,6 +458,9 @@ class DwarfDebug : public AsmPrinterHandler { // Whether to emit the pubnames/pubtypes sections. bool HasDwarfPubSections; + // Whether or not to use AT_ranges for compilation units. + bool HasCURanges; + // Version of dwarf we're emitting. unsigned DwarfVersion; @@ -733,6 +736,9 @@ public: /// split dwarf proposal support. bool useSplitDwarf() { return HasSplitDwarf; } + /// \brief Returns whether or not to use AT_ranges for compilation units. + bool useCURanges() { return HasCURanges; } + /// Returns the Dwarf Version. unsigned getDwarfVersion() const { return DwarfVersion; } |