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