summaryrefslogtreecommitdiff
path: root/view
diff options
context:
space:
mode:
Diffstat (limited to 'view')
-rw-r--r--view/macho/machoview.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/view/macho/machoview.cpp b/view/macho/machoview.cpp
index 1c65629a..52315485 100644
--- a/view/macho/machoview.cpp
+++ b/view/macho/machoview.cpp
@@ -790,6 +790,9 @@ MachOHeader MachoView::HeaderForAddress(BinaryView* data, uint64_t address, bool
}
break;
case LC_LOAD_DYLIB:
+ case LC_LOAD_WEAK_DYLIB:
+ case LC_REEXPORT_DYLIB:
+ case LC_LOAD_UPWARD_DYLIB:
{
uint32_t offset = reader.Read32();
reader.Read32(); // timestamp
@@ -2087,6 +2090,8 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
if (objcProcessor)
objcProcessor->AddRelocatedPointer(relocationLocation, slidTarget);
}
+
+ Ref<Metadata> symbolToLibraryMapping = new Metadata(KeyValueDataType);
for (auto& [relocation, name, ordinal] : header.bindingRelocations)
{
bool handled = false;
@@ -2149,6 +2154,8 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
DefineRelocation(m_arch, relocation, symbol, relocation.address);
handled = true;
}
+ if (ordinal - 1 < header.dylibs.size())
+ symbolToLibraryMapping->SetValueForKey(name, new Metadata(header.dylibs[ordinal - 1].first));
}
break;
}
@@ -2157,6 +2164,8 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
m_logger->LogErrorF("Failed to find external symbol {:?}, couldn't bind symbol at {:#x}", name, relocation.address);
}
+ StoreMetadata("SymbolExternalLibraryMapping", std::move(symbolToLibraryMapping), true);
+
auto relocationHandler = m_arch->GetRelocationHandler("Mach-O");
if (relocationHandler)
{