diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 |
commit | 3a0822f094b578157263e04114075ad7df81db41 (patch) | |
tree | bc48361fe2cd1ca5f93ac01b38b183774468fc79 /lib/DebugInfo/DWARF/DWARFContext.cpp | |
parent | 85d8b2bbe386bcfe669575d05b61482d7be07e5d (diff) |
Notes
Diffstat (limited to 'lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r-- | lib/DebugInfo/DWARF/DWARFContext.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/DebugInfo/DWARF/DWARFContext.cpp b/lib/DebugInfo/DWARF/DWARFContext.cpp index baab3873b915..32654f830f07 100644 --- a/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -674,7 +674,7 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj, uint64_t SymAddr = 0; uint64_t SectionLoadAddress = 0; object::symbol_iterator Sym = Reloc.getSymbol(); - object::section_iterator RSec = Reloc.getSection(); + object::section_iterator RSec = Obj.section_end(); // First calculate the address of the symbol or section as it appears // in the objct file @@ -682,8 +682,13 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj, Sym->getAddress(SymAddr); // Also remember what section this symbol is in for later Sym->getSection(RSec); - } else if (RSec != Obj.section_end()) + } else if (auto *MObj = dyn_cast<MachOObjectFile>(&Obj)) { + // MachO also has relocations that point to sections and + // scattered relocations. + // FIXME: We are not handling scattered relocations, do we have to? + RSec = MObj->getRelocationSection(Reloc.getRawDataRefImpl()); SymAddr = RSec->getAddress(); + } // If we are given load addresses for the sections, we need to adjust: // SymAddr = (Address of Symbol Or Section in File) - |