MachO: Improve Sections accuracy

This commit is contained in:
Katy Coe
2020-12-05 20:38:25 +01:00
parent bdf43a642d
commit 804f1680c4

View File

@@ -119,8 +119,7 @@ namespace Il2CppInspector
case MachO cmd when cmd == lc_Segment:
var segment = ReadObject<MachOSegmentCommand<TWord>>();
// Code and data
if (segment.Name == "__TEXT" || segment.Name == "__DATA") {
// Sections in each segment
for (int s = 0; s < segment.NumSections; s++) {
var section = ReadObject<MachOSection<TWord>>();
machoSections.Add(section);
@@ -132,9 +131,9 @@ namespace Il2CppInspector
ImageStart = section.ImageOffset,
ImageEnd = section.ImageOffset + (uint) conv.Int(section.Size) - 1,
IsData = segment.Name == "__DATA" && section.Name != "__bss",
IsData = segment.Name == "__TEXT" || segment.Name == "__DATA",
IsExec = segment.Name == "__TEXT",
IsBSS = segment.Name == "__DATA" && section.Name == "__bss",
IsBSS = segment.Name == "__DATA" && (section.Name == "__bss" || section.Name == "__common"),
Name = section.Name
});
@@ -149,7 +148,6 @@ namespace Il2CppInspector
funcTab = section;
}
}
}
break;
// Location of static symbol table