From 11dc8b216d0852c83ff5c9bfd7d3ca146a93fe84 Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Fri, 12 Sep 2025 10:01:37 -0700 Subject: [DSC] Support relative direct selectors in older shared cache versions Prior to macOS 13 / iOS 16, the base offset to use for relative direct selector references within Objective-C message lists was stored within the `__TEXT,__objc_opt_ro` section of /usr/lib/libobjc.A.dylib. --- view/sharedcache/core/ObjC.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'view/sharedcache/core/ObjC.h') diff --git a/view/sharedcache/core/ObjC.h b/view/sharedcache/core/ObjC.h index a30b9de4..e8c47e70 100644 --- a/view/sharedcache/core/ObjC.h +++ b/view/sharedcache/core/ObjC.h @@ -16,6 +16,22 @@ struct ObjCOptimizationHeader uint64_t relativeMethodSelectorBaseAddressOffset; }; +// `objc_opt_t` from dyld/include/objc-shared-cache.h +struct LegacyObjCOptimizationHeader +{ + uint32_t version; + uint32_t flags; + int32_t selopt_offset; + int32_t headeropt_ro_offset; + int32_t unused_clsopt_offset; + int32_t unused_protocolopt_offset; + int32_t headeropt_rw_offset; + int32_t unused_protocolopt2_offset; + int32_t largeSharedCachesClassOffset; + int32_t largeSharedCachesProtocolOffset; + int64_t relativeMethodSelectorBaseAddressOffset; +}; + namespace DSCObjC { class SharedCacheObjCReader : public BinaryNinja::ObjCReader { -- cgit v1.3.1