diff options
author | George Rimar <grimar@accesssoftek.com> | 2018-09-20 09:17:36 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2018-09-20 09:17:36 +0000 |
commit | 425f75172f0306d319f644565c607777e1839c28 (patch) | |
tree | 400a8e1037a70078c8a7350c58b6304ab5170f40 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | 26ba928214273cba2d1fb951bd395e6fa74896bb (diff) | |
download | bcm5719-llvm-425f75172f0306d319f644565c607777e1839c28.tar.gz bcm5719-llvm-425f75172f0306d319f644565c607777e1839c28.zip |
[DWARF] - Emit the correct value for DW_AT_addr_base.
Currently, we emit DW_AT_addr_base that points to the beginning of
the .debug_addr section. That is not correct for the DWARF5 case because address
table contains the header and the attribute should point to the first entry
following the header.
This is currently the reason why LLDB does not work with such executables correctly.
Patch fixes the issue.
Differential revision: https://reviews.llvm.org/D52168
llvm-svn: 342635
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 78d11fb1252..f6a875f405a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -675,6 +675,10 @@ void DwarfDebug::beginModule() { (useSplitDwarf() ? SkeletonHolder : InfoHolder) .setRnglistsTableBaseSym(Asm->createTempSymbol("rnglists_table_base")); + // Create the symbol that points to the first entry following the debug + // address table (.debug_addr) header. + AddrPool.setLabel(Asm->createTempSymbol("addr_table_base")); + for (DICompileUnit *CUNode : M->debug_compile_units()) { // FIXME: Move local imported entities into a list attached to the // subprogram, then this search won't be needed and a @@ -792,11 +796,9 @@ void DwarfDebug::finalizeModuleInfo() { } // We don't keep track of which addresses are used in which CU so this // is a bit pessimistic under LTO. - if (!AddrPool.isEmpty()) { - const MCSymbol *Sym = TLOF.getDwarfAddrSection()->getBeginSymbol(); - SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_addr_base, - Sym, Sym); - } + if (!AddrPool.isEmpty()) + SkCU->addAddrTableBase(); + if (getDwarfVersion() < 5 && !SkCU->getRangeLists().empty()) { const MCSymbol *Sym = TLOF.getDwarfRangesSection()->getBeginSymbol(); SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_ranges_base, |