From 2b3ce702bdaa825af2dbff45f7899b9ffd82a257 Mon Sep 17 00:00:00 2001 From: kat Date: Fri, 11 Jul 2025 09:44:37 -0400 Subject: [Mach-O] Handling for special library ordinals used in binding information --- view/macho/machoview.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'view/macho/machoview.h') diff --git a/view/macho/machoview.h b/view/macho/machoview.h index 253af9d1..c05d03a8 100644 --- a/view/macho/machoview.h +++ b/view/macho/machoview.h @@ -818,6 +818,13 @@ namespace BinaryNinja RebaseOpcodeDoRebaseUlebTimesSkippingUleb = 0x80u, // REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB }; + enum BindSpecial { + BindSpecialDylibSelf = 0, // BIND_SPECIAL_DYLIB_SELF + BindSpecialDylibMainExecutable = -1, // BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE + BindSpecialDylibFlatLookup = -2, // BIND_SPECIAL_DYLIB_FLAT_LOOKUP + BindSpecialDylibWeakLookup = -3 // BIND_SPECIAL_DYLIB_WEAK_LOOKUP + }; + enum BindOpcode { BindOpcodeMask = 0xF0u, // BIND_OPCODE_MASK BindImmediateMask = 0x0Fu, // BIND_IMMEDIATE_MASK @@ -1375,6 +1382,13 @@ namespace BinaryNinja uint32_t reserved; }; + struct BoundRelocation + { + BNRelocationInfo info; + std::string name; + int64_t ordinal; + }; + struct MachOHeader { bool isMainHeader = false; @@ -1386,7 +1400,7 @@ namespace BinaryNinja std::vector> entryPoints; std::vector m_entryPoints; //list of entrypoints - std::vector> externalRelocations; + std::vector bindingRelocations; std::vector rebaseRelocations; symtab_command symtab; -- cgit v1.3.1