diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2018-02-28 15:02:59 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-02-28 15:02:59 +0000 |
commit | 9de940b93bdbb0cf032b8337c5390630ba5e1acd (patch) | |
tree | 8d1b1b2e490b59d6f17b380ac3b0d14f89e6491e /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | |
parent | a1a29336340080d33893f82d5bf369df11615d58 (diff) | |
download | bcm5719-llvm-9de940b93bdbb0cf032b8337c5390630ba5e1acd.tar.gz bcm5719-llvm-9de940b93bdbb0cf032b8337c5390630ba5e1acd.zip |
[DEBUGINFO] Add flag for DWARF2 or less to use sections as references.
Summary:
Some targets does not support labels inside debug sections, but support
references in form `section +|- offset`. Patch adds initial support
for this. Also, this patch disables emission of all additional debug
sections that may have labels inside of it (like pub sections and
string tables).
Reviewers: probinson, echristo
Subscribers: JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D43627
llvm-svn: 326328
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 0b2a0469f8c..1dc9d5e2345 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -270,15 +270,20 @@ void DwarfCompileUnit::addRange(RangeSpan Range) { void DwarfCompileUnit::initStmtList() { // Define start line table label for each Compile Unit. - MCSymbol *LineTableStartSym = - Asm->OutStreamer->getDwarfLineTableSymbol(getUniqueID()); + MCSymbol *LineTableStartSym; + const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); + if (DD->useSectionsAsReferences()) { + LineTableStartSym = TLOF.getDwarfLineSection()->getBeginSymbol(); + } else { + LineTableStartSym = + Asm->OutStreamer->getDwarfLineTableSymbol(getUniqueID()); + } // DW_AT_stmt_list is a offset of line number information for this // compile unit in debug_line section. For split dwarf this is // left in the skeleton CU and so not included. // The line table entries are not always emitted in assembly, so it // is not okay to use line_table_start here. - const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); StmtListValue = addSectionLabel(getUnitDie(), dwarf::DW_AT_stmt_list, LineTableStartSym, TLOF.getDwarfLineSection()->getBeginSymbol()); @@ -410,9 +415,10 @@ void DwarfCompileUnit::addScopeRangeList(DIE &ScopeDIE, void DwarfCompileUnit::attachRangesOrLowHighPC( DIE &Die, SmallVector<RangeSpan, 2> Ranges) { - if (Ranges.size() == 1) { - const auto &single = Ranges.front(); - attachLowHighPC(Die, single.getStart(), single.getEnd()); + if (Ranges.size() == 1 || DD->useSectionsAsReferences()) { + const auto &front = Ranges.front(); + const auto &back = Ranges.back(); + attachLowHighPC(Die, front.getStart(), back.getEnd()); } else addScopeRangeList(Die, std::move(Ranges)); } @@ -834,7 +840,7 @@ void DwarfCompileUnit::createAbstractVariable(const DILocalVariable *Var, void DwarfCompileUnit::emitHeader(bool UseOffsets) { // Don't bother labeling the .dwo unit, as its offset isn't used. - if (!Skeleton) { + if (!Skeleton && !DD->useSectionsAsReferences()) { LabelBegin = Asm->createTempSymbol("cu_begin"); Asm->OutStreamer->EmitLabel(LabelBegin); } @@ -851,7 +857,8 @@ bool DwarfCompileUnit::hasDwarfPubSections() const { if (CUNode->getGnuPubnames()) return true; - return DD->tuneForGDB() && !includeMinimalInlineScopes(); + return DD->tuneForGDB() && !includeMinimalInlineScopes() && + !DD->useSectionsAsReferences(); } /// addGlobalName - Add a new global name to the compile unit. |