summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-19 17:54:28 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-19 17:54:28 +0000
commit63a88ce5d42f28ce6f38d9f7aa45f8ad63052b8e (patch)
treec11ddfd15294f472cdc6e98c8845f64bed546828 /llvm/lib/DebugInfo
parent3ea39f9e7871ae2628f6737834a74b62518e6d95 (diff)
downloadbcm5719-llvm-63a88ce5d42f28ce6f38d9f7aa45f8ad63052b8e.tar.gz
bcm5719-llvm-63a88ce5d42f28ce6f38d9f7aa45f8ad63052b8e.zip
Make getRelocationSection MachO only.
There are 3 types of relocations on MachO * Scattered * Section based * Symbol based On ELF and COFF relocations are symbol based. We were in the strange situation that we abstracted over two of them. This makes section based relocations MachO only. llvm-svn: 240149
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index baab3873b91..32654f830f0 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/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) -
OpenPOWER on IntegriCloud