summaryrefslogtreecommitdiff
path: root/objectivec/objc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'objectivec/objc.cpp')
-rw-r--r--objectivec/objc.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/objectivec/objc.cpp b/objectivec/objc.cpp
index f0a6a8f3..0d82fb4f 100644
--- a/objectivec/objc.cpp
+++ b/objectivec/objc.cpp
@@ -1342,10 +1342,13 @@ void ObjCProcessor::PostProcessObjCSections(ObjCReader* reader)
{
auto start = ivars->GetStart();
auto end = ivars->GetEnd();
- auto ivarSectionEntryTypeBuilder = new TypeBuilder(Type::IntegerType(8, false));
+ // The ivar section contains entries of type `long` for for all architectures
+ // except arm64, which uses `int` for the ivar offset.
+ size_t ivarOffsetSize = m_data->GetDefaultArchitecture()->GetName() == "aarch64" ? 4 : ptrSize;
+ auto ivarSectionEntryTypeBuilder = new TypeBuilder(Type::IntegerType(ivarOffsetSize, false));
ivarSectionEntryTypeBuilder->SetConst(true);
auto type = ivarSectionEntryTypeBuilder->Finalize();
- for (view_ptr_t i = start; i < end; i += ptrSize)
+ for (view_ptr_t i = start; i < end; i += ivarOffsetSize)
{
m_data->DefineDataVariable(i, type);
}