summaryrefslogtreecommitdiff
path: root/view/macho/machoview.cpp
AgeCommit message (Collapse)Author
2026-04-21[MachO] Improve library tracking for imported symbolsMark Rowe
2026-03-23[MachO] Apply the correct calling convention for objc_retain_xN / ↵Mark Rowe
objc_release_xN The type library for the Objective-C runtime does not apply the custom calling conventions these functions use. Detect these functions when creating symbols for imported functions and apply the custom calling convention to them. Fixes https://github.com/Vector35/binaryninja-api/issues/8031.
2026-02-27[MachO] Ensure that weak bound symbols are not resolved to their import addressMark Rowe
Fixes https://github.com/Vector35/binaryninja-api/issues/7989. Also corrects an oversight from d92b3684 in handling of library ordinals >= 128.
2026-02-17Handle Universal binaries through container transform system.Brian Potchik
2026-02-02[MachO] Set segment flags for kernel images based on how XNU initially maps themMark Rowe
This was done for kernel cache in https://github.com/Vector35/binaryninja-api/pull/7519, and is now being extended to Mach-O images that appear to be XNU kernels (that is, they contain `__KLD` segments). This improves the experience when opening kernels from the macOS Kernel Debug Kit.
2026-01-22[Mach-O] Improve how section types are identifiedwanghaiwei
1. A section's `flags` are masked with `SECTION_TYPE` before being compared. This prevents misclassifying a section when its low bits are shared with other section types. 2. `__mod_init_func` and `__init_offsets` are identified by section type flags, rather than by name. There's no documented reason why these were being matched by name. 3. A fallback is added to detect `__got` sections by name. This is necessary as some kext bundles that have their `__got` sections as `S_REGULAR` rather than `S_NON_LAZY_SYMBOL_POINTERS`. This fixes https://github.com/Vector35/binaryninja-api/issues/7891. Thanks to @WHW0x455 for these fixes.
2025-12-20Fix many of the warnings that show up when compiling with GCC 15.2Mark Rowe
2025-12-15[MachO] Fix handling of relocations for self-bound data symbolsMark Rowe
Fixes https://github.com/Vector35/binaryninja-api/issues/7781.
2025-12-08Introduce an RAII type for managing bulk symbol modificationsMark Rowe
Fixes https://github.com/Vector35/binaryninja-api/issues/7666. Correctly managing the state of bulk symbol modifications via `BeginBulkModifySymbols` / `EndBulkModifySymbols` is error-prone in the face of exceptions and early returns. Leaking a bulk symbol modification can leave the view in a state where no further changes to symbols will be applied. All users of the C++ API are encouraged to move from `BeginBulkModifySymbols` / `EndBulkModifySymbols` to the new `BulkSymbolModification` class.
2025-11-17Fix some compiler warningsRusty Wagner
2025-11-04[MachO] Set display name of memory regions to match the segment names they ↵Mark Rowe
correspond to
2025-10-22[Mach-O] Refactor fixup chain parsingMark Rowe
The parsing of fix-up chains is moved out of `MachoView` and into its own class. It deals purely in terms of offsets into the Mach-O slice. `MachoView` translates those offsets to mapped addresses when needed. This is primarily aimed at fixing incorrect handling of pointer formats that use offsets where in some cases the relocations would be applied at incorrect addresses due to confusion between file offsets, Mach-O slice offsets, and VM offsets. It incidentally fixes addends from bind operations not being respected. These show up most frequently in C++ RTTI information.
2025-10-02[MachO] Tweak handling of LC_FUNCTION_STARTSMark Rowe
`LC_FUNCTION_STARTS` includes both functions and jump tables. We want to avoid calling `AddFunctionForAnalysis` on jump tables since it can result in a function being created at the jump table's location with a bogus body. We already skip adding functions for entries in `LC_FUNCTION_STARTS` if the lifting of their first few bytes end up including `LLIL_UNDEF`. However, arm64 intentionally lifts `udf` instructions (i.e., opcodes in the Permanently Undefined range) to `LLIL_TRAP` in order to preserve the immediate portion of the instruction. To address this, `MachoView::IsValidFunctionStart` now returns false if the first lifted instruction is `LLIL_TRAP` in addition to when the lifting contains `LLIL_UNDEF`.
2025-09-17[MachO] Populate external links with library imports for files in projectsMark Rowe
A mapping from imported symbol names to libraries is added to metadata. This is used to populate external links for files within projects, following the lead of `PEView`.
2025-08-27Rewrite Obj-C workflow in RustMark Rowe
This is functionally equivalent to the previous workflow_objc, with the following changes: 1. It mutates the `core.function.metaAnalysis` workflow rather than registering a new named workflow. The activities now all check for the presence of the Objective-C metadata added by `ObjCProcessor` to determine whether they should do work, rather than relying on `MachoView` to override the function workflow when Objective-C metadata is present. This fixes https://github.com/Vector35/binaryninja-api/issues/6779. 2. The auto-inlining of `objc_msgSend` selector stub functions is performed in a separate activity from the processing of `objc_msgSend` call sites. The selector stub inlining activity is configured so that it does not run in `DSCView` as the shared cache needs different behavior for stub functions more generally that `SharedCacheWorkflow` already provides. 3. The way that types like `id` and `SEL` are referenced is fixed so that they show up as `id` rather than `objc_struct*`. This also replaces the Objective-C portion of the shared cache's workflow, and incorporates several bug fixes that had been applied to it but not the standalone Objective-C workflow.
2025-08-01Add LogForException APIs to pass stack trace information separate from the ↵Rusty Wagner
message
2025-07-28Improve and migrate to fmt logging functions in Mach-O/KernelCache/SharedCachekat
2025-07-21Fix MachO loading some settings too earlyGlenn Smith
Fixes #7117
2025-07-16Miscellaneous leak fixes in MachoView and ObjCProcessorMark Rowe
2025-07-16Mach-O/KernelCache warning cleanupkat
2025-07-14Revert "Update Objective-C Workflow to use the meta workflow."Brian Potchik
This reverts commit 5bafe5c7bdb0b56037a0b5c573236f9c6367353a.
2025-07-14Update Objective-C Workflow to use the meta workflow.Brian Potchik
2025-07-14[Mach-O] Handling for special library ordinals used in binding informationkat
2025-07-08[MachO] Avoid leaking MachoObjCProcessorMark Rowe
This would leak if parsing of CFStrings was enabled while parsing of Objective-C metadata was disabled. It would also leak if exceptions were thrown or early returns were taken in the ~500 lines between where the object was allocated and it was deleted.
2025-07-08Parse sections containing Objective-C constantsMark Rowe
This adds support for the `__objc_arrayobj`, `_objc_dictobj`, `__objc_intobj`, `__objc_floatobj`, `__objc_doubleobj` and `__objc_dateobj` sections that contain Objective-C constants. These are emitted by Apple's versions of Clang for `const` literals, amongst other things.
2025-07-02Added no export trie data detection.Hongyu Chen
2025-06-25Fix cxx20 compiler warnings.Alexander Taylor
2025-06-25Remove implicit conversions from Confidence to underlying type, these can ↵Rusty Wagner
cause bugs and also issues with C++20
2025-06-06Objective-C Processor: Remove vestigial code tracking whether view was ↵kat
backed by a database
2025-06-04[MachO] Don't add symbols when processing bind fixupsMark Rowe
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.
2025-06-03[MachoView] Add support of __init_offsetsObriv Mostov
2025-05-30Don't query the template simplifier setting while demangling symbolsPeter LaFosse
2025-05-13Rework Export Trie parser to avoid recursion, improve error checkingkat
2025-04-28[MachO] Handle chained imports with addendsMark Rowe
They show up in some macOS system executables.
2025-04-14Avoid MH_FILESET in Mach-O view during magic check.Alexander Taylor
2025-04-09More gracefully ignore MH_FILESET in MachOView.Alexander Taylor
This avoids the 3 errors on view initialization for all supported kernel caches that aren't "real".
2025-04-09Revert "Disable MH_FILESET parsing in Mach-O view"Alexander Taylor
This reverts commit 9169a13c818fc7f3b09246360c31e200b01bda23.
2025-04-09Fix capitalization of AArch64.Alexander Taylor
2025-04-08Remove notion of image name from objective-c processorMason Reed
This made the macho objective-c processor aware of images and was passed around everywhere, instead we have an overridable section getter that gives the control over the section retrieval to the derived processor. In the case of shared cache this means we can store the image to be processed and then use the header to locate the relevant sections. Fixes: https://github.com/Vector35/binaryninja-api/issues/6594
2025-04-03Implement Kernel64 path for Chained Fixups in Mach-O Viewkat
2025-04-03Fix user platform override between armv7 and thumbBrandon Miller
Only override the default platform based on the entry point architecture in cases where the user didn't explicitly set loader.platform
2025-04-02[ObjC] Create a shared ObjC processor for Macho and DSC viewsWeiN76LQh
Both the Macho and DSC views need to process Objective-C but have separate processor classes. It would appear that the DSC version was largely a copy and paste of the Macho view one, with some modifications. The majority of code overlaps between the 2 so it doesn't make sense to maintain 2 and copy and paste improvements/fixes between them. This commit fixes that by creating a base Objective-C processor that contains the shared code. View specific code is implemented in the respective subclasses for the views. Although there is very little view specific code for each.
2025-03-19Disable MH_FILESET parsing in Mach-O viewkat
2025-02-17[SharedCache] Define BackingCacheTypeWeiN76LQh
Split out from https://github.com/WeiN76LQh/binaryninja-api/tree/process-local-symbols
2025-01-20Allow overriding common loader settings when automatic load file parsing fails.Brian Potchik
2024-11-13Bulk add segments in the binary view to improve performanceXusheng
2024-10-17Demangler plugin APIGlenn Smith
Closes #467
2024-09-26Clean up unused variables in Mach-O/Obj-C codekat
2024-09-13Ultimate.Alexander Taylor
2024-08-20Initial support for per-function settings.Brian Potchik