From d7445e232501ba60fb780f2c18500c0b509fc97e Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Mon, 17 Feb 2025 11:04:35 -0800 Subject: Parse sections containing Objective-C constants 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. --- objectivec/objc.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'objectivec/objc.h') diff --git a/objectivec/objc.h b/objectivec/objc.h index a8769ba6..61df2b0d 100644 --- a/objectivec/objc.h +++ b/objectivec/objc.h @@ -274,6 +274,13 @@ namespace BinaryNinja { QualifiedName protocolList; QualifiedName ivar; QualifiedName ivarList; + QualifiedName nsConstantArray; + QualifiedName nsConstantDictionary; + QualifiedName nsConstantDoubleNumber; + QualifiedName nsConstantFloatNumber; + QualifiedName nsConstantIntegerNumber; + QualifiedName nsConstantDate; + QualifiedName nsConstantData; } m_typeNames; // TODO(WeiN76LQh): this is to avoid a bug with defining a classes protocol list in the DSC plugin. Remove once fixed @@ -314,6 +321,13 @@ namespace BinaryNinja { std::optional ClassNameForTargetOfPointerAt(ObjCReader* reader, uint64_t offset); + void ProcessCFStrings(); + void ProcessNSConstantArrays(); + void ProcessNSConstantDictionaries(); + void ProcessNSConstantIntegerNumbers(); + void ProcessNSConstantFloatingPointNumbers(); + void ProcessNSConstantDatas(); + void PostProcessObjCSections(ObjCReader* reader); protected: @@ -333,7 +347,7 @@ namespace BinaryNinja { ObjCProcessor(BinaryView* data, const char* loggerName, bool skipClassBaseProtocols = false); void ProcessObjCData(); - void ProcessCFStrings(); + void ProcessObjCLiterals(); void AddRelocatedPointer(uint64_t location, uint64_t rewrite); }; } -- cgit v1.3.1