diff options
| author | Mark Rowe <mrowe@bdash.net.nz> | 2025-05-15 22:04:58 -0700 |
|---|---|---|
| committer | kat <kat@vector35.com> | 2025-06-04 14:52:48 -0400 |
| commit | 3e7c1b6a41c666f227237d5751b29d3538aa68b3 (patch) | |
| tree | d21cfd70a5f92364d5e86e8569dcf50b89cd387f | |
| parent | 368407b09eba7c5d09689ac81eaadd1645820edd (diff) | |
[MachO] Don't add symbols when processing bind fixups
The target of the bind opcode has its symbol applied when the dynamic
symbol table is parsed.
This was previously adding a symbol at the fixed-up address with the
name of the symbol being bound. This was resulting in dozens of
`_OBJC_CLASS_$_NSObject`, `_OBJC_METACLASS_$_NSObject`, and
`__objc_empty_cache` symbols being created: one for each `objc_class`
that referenced those symbols.
| -rw-r--r-- | view/macho/machoview.cpp | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/view/macho/machoview.cpp b/view/macho/machoview.cpp index cb38826c..dde5fa86 100644 --- a/view/macho/machoview.cpp +++ b/view/macho/machoview.cpp @@ -2900,8 +2900,6 @@ void MachoView::ParseDynamicTable(BinaryReader& reader, MachOHeader& header, BNS if (name == NULL) throw MachoFormatException(); - DefineMachoSymbol(symtype, string(name), address, binding, true); - memset(&externReloc, 0, sizeof(externReloc)); externReloc.nativeType = BINARYNINJA_MANUAL_RELOCATION; externReloc.address = address; @@ -2916,8 +2914,6 @@ void MachoView::ParseDynamicTable(BinaryReader& reader, MachOHeader& header, BNS if (name == NULL) throw MachoFormatException(); - DefineMachoSymbol(symtype, string(name), address, binding, true); - memset(&externReloc, 0, sizeof(externReloc)); externReloc.nativeType = BINARYNINJA_MANUAL_RELOCATION; externReloc.address = address; @@ -2933,8 +2929,6 @@ void MachoView::ParseDynamicTable(BinaryReader& reader, MachOHeader& header, BNS if (name == NULL) throw MachoFormatException(); - DefineMachoSymbol(symtype, string(name), address, binding, true); - memset(&externReloc, 0, sizeof(externReloc)); externReloc.nativeType = BINARYNINJA_MANUAL_RELOCATION; externReloc.address = address; @@ -2954,8 +2948,6 @@ void MachoView::ParseDynamicTable(BinaryReader& reader, MachOHeader& header, BNS uint64_t skip = readLEB128(table, tableSize, i); for (; count > 0; count--) { - DefineMachoSymbol(symtype, string(name), address, binding, true); - memset(&externReloc, 0, sizeof(externReloc)); externReloc.nativeType = BINARYNINJA_MANUAL_RELOCATION; externReloc.address = address; @@ -3540,9 +3532,6 @@ void MachoView::ParseChainedFixups(MachOHeader& header, linkedit_data_command ch if (!entry.name.empty()) { reloc.address = targetAddress; - DefineMachoSymbol(ImportAddressSymbol, entry.name, - targetAddress, - entry.weak ? WeakBinding : GlobalBinding, true); BNRelocationInfo externReloc; memset(&externReloc, 0, sizeof(externReloc)); |
