diff options
Diffstat (limited to 'llvm/lib/DebugInfo/DWARFContext.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFContext.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/llvm/lib/DebugInfo/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARFContext.cpp index 9f521330c34..7e4132f059b 100644 --- a/llvm/lib/DebugInfo/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARFContext.cpp @@ -19,6 +19,7 @@ #include <algorithm> using namespace llvm; using namespace dwarf; +using namespace object; typedef DWARFDebugLine::LineTable DWARFLineTable; @@ -554,17 +555,26 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : .Case("debug_addr", &AddrSection) // Any more debug info sections go here. .Default(0); - if (!Section) - continue; - *Section = data; - if (name == "debug_ranges") { - // FIXME: Use the other dwo range section when we emit it. - RangeDWOSection = data; + if (Section) { + *Section = data; + if (name == "debug_ranges") { + // FIXME: Use the other dwo range section when we emit it. + RangeDWOSection = data; + } } + section_iterator RelocatedSection = i->getRelocatedSection(); + if (RelocatedSection == Obj->end_sections()) + continue; + + StringRef RelSecName; + RelocatedSection->getName(RelSecName); + RelSecName = RelSecName.substr( + RelSecName.find_first_not_of("._")); // Skip . and _ prefixes. + // TODO: Add support for relocations in other sections as needed. // Record relocations for the debug_info and debug_line sections. - RelocAddrMap *Map = StringSwitch<RelocAddrMap*>(name) + RelocAddrMap *Map = StringSwitch<RelocAddrMap*>(RelSecName) .Case("debug_info", &InfoRelocMap) .Case("debug_info.dwo", &InfoDWORelocMap) .Case("debug_line", &LineRelocMap) @@ -574,7 +584,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : if (i->begin_relocations() != i->end_relocations()) { uint64_t SectionSize; - i->getSize(SectionSize); + RelocatedSection->getSize(SectionSize); for (object::relocation_iterator reloc_i = i->begin_relocations(), reloc_e = i->end_relocations(); reloc_i != reloc_e; reloc_i.increment(ec)) { |