diff options
Diffstat (limited to 'view/macho/objc.cpp')
| -rw-r--r-- | view/macho/objc.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/view/macho/objc.cpp b/view/macho/objc.cpp index 3daaf61e..b2e82fd7 100644 --- a/view/macho/objc.cpp +++ b/view/macho/objc.cpp @@ -967,7 +967,15 @@ void ObjCProcessor::PostProcessObjCSections(BinaryReader* reader) auto type = Type::PointerType(ptrSize, Type::NamedType(m_data, m_typeNames.cls)); for (view_ptr_t i = start; i < end; i += ptrSize) { - m_data->DefineDataVariable(i, type); + reader->Seek(i); + auto clsLoc = ReadPointerAccountingForRelocations(reader); + if (const auto& it = m_classes.find(clsLoc); it != m_classes.end()) + { + auto& cls = it->second; + std::string name = cls.name; + if (!name.empty()) + DefineObjCSymbol(DataSymbol, type, "clsRef_" + name, i, true); + } } } if (auto superRefs = m_data->GetSectionByName("__objc_superrefs")) @@ -977,6 +985,26 @@ void ObjCProcessor::PostProcessObjCSections(BinaryReader* reader) auto type = Type::PointerType(ptrSize, Type::NamedType(m_data, m_typeNames.cls)); for (view_ptr_t i = start; i < end; i += ptrSize) { + reader->Seek(i); + auto clsLoc = ReadPointerAccountingForRelocations(reader); + if (const auto& it = m_classes.find(clsLoc); it != m_classes.end()) + { + auto& cls = it->second; + std::string name = cls.name; + if (!name.empty()) + DefineObjCSymbol(DataSymbol, type, "superRef_" + name, i, true); + } + } + } + if (auto ivars = m_data->GetSectionByName("__objc_ivar")) + { + auto start = ivars->GetStart(); + auto end = ivars->GetEnd(); + auto ivarSectionEntryTypeBuilder = new TypeBuilder(Type::IntegerType(8, false)); + ivarSectionEntryTypeBuilder->SetConst(true); + auto type = ivarSectionEntryTypeBuilder->Finalize(); + for (view_ptr_t i = start; i < end; i += ptrSize) + { m_data->DefineDataVariable(i, type); } } |
