Personal Original, reprint please indicate source:Cnblogs.com/jailbreaker
The previous two posts, respectively, Mach-o the header area and the load command area of segment, continue today segment setcion, generally in __text and __data section. Note here that the naming convention, uppercase for segment, and lowercase for sections, such as __text.__text, refer to the __text section of the __text segment.
First look at the section structure definition:
Then look at the __text.__text description in Hopper:
Analysis according to the structure definition:
1. Thesectname example is __text, which is the main program code
2.segname the segment name to which the section belongs, in the example __text
3.addr The section in the starting position of the memory, the example value is 0xb268, jump to that position to see, hopper comments are very good, see:
4. size of the section
5. offset the file offsets of the section, according to the context in the example, the file starts at the 0x4000 position, the offset size is 0x7268, so that the absolute position is 0x4000+0x7268, and the value of the previous addr is the same.
6.Align byte size alignment
7. File offset for Reloff Relocation Entry
8.nreloc number of portals requiring relocation
9. Theflags contain the type and attributes of the section, depending on the loader.h.
The last 2 items in the structure are reserved.
Below is the section of __text
__text Main program code
__stubs and __stub_helper stubs for dynamic-link libraries
__cstring C language string
__const Const-Modified constants
__objc_methname OBJC method name
__objc_methtype ObjC method type
__objc_classname ObjC class method
Below is the section of __data
__objc_classlist OBJC class list
__objc_protolist OBJC prototype list
__objc_imageinfo OBJC image Information
__objc_const OBJC Constants
__objc_selfrefs OBJC Self-reference (this)
__objc_protorefs OBJC prototype reference
__objc_superrefs OBJC Super class reference
__cfstring using the Core Foundation string
__BSS Bss
At this point, a total of 3 "read Mach-o", let us understand the layout of Mach-o, finally see the hopper in the analysis of the Segment and section list.
[iOS reverse combat eight] read Mach-o (3)