Пример #1
0
void RuntimeDyldImpl::resolveRelocationList(const RelocationList &Relocs,
                                            uint64_t Value) {
  for (unsigned i = 0, e = Relocs.size(); i != e; ++i) {
    const RelocationEntry &RE = Relocs[i];
    // Ignore relocations for sections that were not loaded
    if (Sections[RE.SectionID].Address == 0)
      continue;
    resolveRelocation(RE, Value);
  }
}
Пример #2
0
void RuntimeDyldImpl::resolveRelocationEntry(const RelocationEntry &RE,
                                             uint64_t Value) {
    // Ignore relocations for sections that were not loaded
    if (Sections[RE.SectionID].Address != 0) {
      uint8_t *Target = Sections[RE.SectionID].Address + RE.Offset;
      DEBUG(dbgs() << "\tSectionID: " << RE.SectionID
            << " + " << RE.Offset << " (" << format("%p", Target) << ")"
            << " Data: " << RE.Data
            << " Addend: " << RE.Addend
            << "\n");

      resolveRelocation(Target, Sections[RE.SectionID].LoadAddress + RE.Offset,
                        Value, RE.Data, RE.Addend);
  }
}
Пример #3
0
void RuntimeDyldImpl::resolveRelocationEntry(const RelocationEntry &RE,
                                             uint64_t Value) {
  // Ignore relocations for sections that were not loaded
  if (Sections[RE.SectionID].Address != 0) {
    DEBUG(dbgs() << "\tSectionID: " << RE.SectionID
          << " + " << RE.Offset << " ("
          << format("%p", Sections[RE.SectionID].Address + RE.Offset) << ")"
          << " RelType: " << RE.RelType
          << " Addend: " << RE.Addend
          << "\n");

    resolveRelocation(Sections[RE.SectionID], RE.Offset,
                      Value, RE.RelType, RE.Addend);
  }
}
Пример #4
0
void Dumper::printRuntimeFunction(const Context &Ctx,
                                  const coff_section *Section,
                                  uint64_t SectionOffset,
                                  const RuntimeFunction &RF) {
  DictScope RFS(SW, "RuntimeFunction");
  printRuntimeFunctionEntry(Ctx, Section, SectionOffset, RF);

  const coff_section *XData;
  uint64_t Offset;
  resolveRelocation(Ctx, Section, SectionOffset + 8, XData, Offset);

  ArrayRef<uint8_t> Contents;
  error(Ctx.COFF.getSectionContents(XData, Contents));
  if (Contents.empty())
    return;

  Offset = Offset + RF.UnwindInfoOffset;
  if (Offset > Contents.size())
    return;

  const auto UI = reinterpret_cast<const UnwindInfo*>(Contents.data() + Offset);
  printUnwindInfo(Ctx, XData, Offset, *UI);
}