summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp1
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp9
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h5
-rw-r--r--llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll6
4 files changed, 18 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 1d9c1d38a24..a32cd8bc904 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -277,6 +277,7 @@ void DwarfCompileUnit::addRange(RangeSpan Range) {
(&CURanges.back().getEnd()->getSection() !=
&Range.getEnd()->getSection())) {
CURanges.push_back(Range);
+ DD->addSectionLabel(Range.getStart());
return;
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 5f91674d9f0..7f9ef3eba90 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2171,6 +2171,7 @@ static void emitRangeList(DwarfDebug &DD, AsmPrinter *Asm,
// the lowest address/range in this object.
Base = P.second.front()->getStart();
if (DwarfVersion >= 5) {
+ Base = DD.getSectionLabel(&Base->getSection());
Asm->OutStreamer->AddComment("DW_RLE_base_addressx");
Asm->OutStreamer->EmitIntValue(dwarf::DW_RLE_base_addressx, 1);
Asm->OutStreamer->AddComment(" base address index");
@@ -2623,3 +2624,11 @@ void DwarfDebug::addAccelType(const DICompileUnit &CU, StringRef Name,
uint16_t DwarfDebug::getDwarfVersion() const {
return Asm->OutStreamer->getContext().getDwarfVersion();
}
+
+void DwarfDebug::addSectionLabel(const MCSymbol *Sym) {
+ SectionLabels.insert(std::make_pair(&Sym->getSection(), Sym));
+}
+
+const MCSymbol *DwarfDebug::getSectionLabel(const MCSection *S) {
+ return SectionLabels.find(S)->second;
+}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index b98d9267455..c73d442af2f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -327,6 +327,8 @@ class DwarfDebug : public DebugHandlerBase {
/// used to keep track of which types we have emitted type units for.
DenseMap<const MDNode *, uint64_t> TypeSignatures;
+ DenseMap<const MCSection *, const MCSymbol *> SectionLabels;
+
SmallVector<
std::pair<std::unique_ptr<DwarfTypeUnit>, const DICompositeType *>, 1>
TypeUnitsUnderConstruction;
@@ -721,6 +723,9 @@ public:
bool tuneForLLDB() const { return DebuggerTuning == DebuggerKind::LLDB; }
bool tuneForSCE() const { return DebuggerTuning == DebuggerKind::SCE; }
/// @}
+
+ void addSectionLabel(const MCSymbol *Sym);
+ const MCSymbol *getSectionLabel(const MCSection *S);
};
} // end namespace llvm
diff --git a/llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll b/llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll
index 295bbc41ad3..74e94643b9c 100644
--- a/llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll
+++ b/llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll
@@ -13,9 +13,9 @@
; CHECK: 0x00000004 => 0x00000010
; CHECK: ]
; CHECK: ranges:
-; CHECK: 0x00000010: [DW_RLE_base_addressx]: 0x0000000000000002
-; CHECK: 0x00000012: [DW_RLE_offset_pair ]: 0x0000000000000000, 0x000000000000000b => [0x0000000000000001, 0x000000000000000c)
-; CHECK: 0x00000015: [DW_RLE_offset_pair ]: 0x000000000000000d, 0x0000000000000012 => [0x000000000000000e, 0x0000000000000013)
+; CHECK: 0x00000010: [DW_RLE_base_addressx]: 0x0000000000000000
+; CHECK: 0x00000012: [DW_RLE_offset_pair ]: 0x0000000000000001, 0x000000000000000c => [0x0000000000000001, 0x000000000000000c)
+; CHECK: 0x00000015: [DW_RLE_offset_pair ]: 0x000000000000000e, 0x0000000000000013 => [0x000000000000000e, 0x0000000000000013)
; CHECK: 0x00000018: [DW_RLE_end_of_list ]
; Function Attrs: noinline optnone uwtable
OpenPOWER on IntegriCloud