diff options
| author | Devang Patel <dpatel@apple.com> | 2010-04-22 20:52:00 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2010-04-22 20:52:00 +0000 |
| commit | bbf90b91a1424e74b007b78316ebc3f5d8a2838b (patch) | |
| tree | 031359d53612890889ffc5dcb50b02cc5a83c21f /lib | |
| parent | 93087ff33f473fcad0240c603197688481fa0c00 (diff) | |
| download | external_llvm-bbf90b91a1424e74b007b78316ebc3f5d8a2838b.zip external_llvm-bbf90b91a1424e74b007b78316ebc3f5d8a2838b.tar.gz external_llvm-bbf90b91a1424e74b007b78316ebc3f5d8a2838b.tar.bz2 | |
Adjust debug range offsets for isWeakForLinker() functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 34 | ||||
| -rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.h | 1 |
2 files changed, 29 insertions, 6 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index dc6b998..0678242 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1384,6 +1384,11 @@ DIE *DwarfDebug::constructLexicalScopeDIE(DbgScope *Scope) { if (Ranges.empty()) return 0; + bool MarkFunctionBegin = false; + if (FunctionBeginSym && + Asm->MF->getFunction()->isWeakForLinker()) + MarkFunctionBegin = true; + SmallVector<DbgRange, 4>::const_iterator RI = Ranges.begin(); if (Ranges.size() > 1) { // .debug_range section has not been laid out yet. Emit offset in @@ -1393,8 +1398,15 @@ DIE *DwarfDebug::constructLexicalScopeDIE(DbgScope *Scope) { DebugRangeSymbols.size() * Asm->getTargetData().getPointerSize()); for (SmallVector<DbgRange, 4>::const_iterator RI = Ranges.begin(), RE = Ranges.end(); RI != RE; ++RI) { - DebugRangeSymbols.push_back(LabelsBeforeInsn.lookup(RI->first)); - DebugRangeSymbols.push_back(LabelsAfterInsn.lookup(RI->second)); + MCSymbol *Sym = LabelsBeforeInsn.lookup(RI->first); + if (MarkFunctionBegin) + WeakDebugRangeSymbols.insert(std::make_pair(Sym, FunctionBeginSym)); + DebugRangeSymbols.push_back(Sym); + + Sym = LabelsAfterInsn.lookup(RI->second); + if (MarkFunctionBegin) + WeakDebugRangeSymbols.insert(std::make_pair(Sym, FunctionBeginSym)); + DebugRangeSymbols.push_back(Sym); } DebugRangeSymbols.push_back(NULL); DebugRangeSymbols.push_back(NULL); @@ -3228,11 +3240,21 @@ void DwarfDebug::emitDebugRanges() { // Start the dwarf ranges section. Asm->OutStreamer.SwitchSection( Asm->getObjFileLowering().getDwarfRangesSection()); - for (SmallVector<const MCSymbol *, 8>::const_iterator I = DebugRangeSymbols.begin(), - E = DebugRangeSymbols.end(); I != E; ++I) { - if (*I) - Asm->EmitLabelDifference(*I, TextSectionSym, + for (SmallVector<const MCSymbol *, 8>::const_iterator + I = DebugRangeSymbols.begin(), E = DebugRangeSymbols.end(); + I != E; ++I) { + if (*I) { + const MCSymbol *Begin = TextSectionSym; + // If this symbol is inside linkonce section then use appropriate begin + // marker; + DenseMap<const MCSymbol *, const MCSymbol *>::iterator WI + = WeakDebugRangeSymbols.find(*I); + if (WI != WeakDebugRangeSymbols.end()) + Begin = WI->second; + + Asm->EmitLabelDifference(*I, Begin, Asm->getTargetData().getPointerSize()); + } else Asm->OutStreamer.EmitIntValue(0, Asm->getTargetData().getPointerSize(), /*addrspace*/0); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index 698f710..b3f9745 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -197,6 +197,7 @@ class DwarfDebug { DenseMap<const MachineInstr *, MCSymbol *> LabelsAfterInsn; SmallVector<const MCSymbol *, 8> DebugRangeSymbols; + DenseMap<const MCSymbol *, const MCSymbol *> WeakDebugRangeSymbols; /// Previous instruction's location information. This is used to determine /// label location to indicate scope boundries in dwarf debug info. |
