Personal Original, reprint please indicate source:Cnblogs.com/jailbreaker
After an article read Mach-o (1), this article continues with the Mach-o header file load command loading commands, look at the following 2 images, respectively, the first load command area shown in Hopper and Segment_ The definition of command:
The first graph captures the first load command, as you know from the first diagram, that the cmd type is Segment_command, which is the 2nd graph, which is analyzed in turn:
1.cmd is the type of load command, the value =1 in this article is the meaning of lc_segment,,lc_segment (the segment in the file is mapped to the process address space)
2.cmdsize represents the size of the load command (38 bytes, from 401c-4053).
3.segname 16-byte segment name, currently __pagezero, has the following segments:
#defineSEG_PAGEZERO "__pagezero"/* The Pagezero segment which has no * *
/* Protections and catches NULL */
/* References for mh_execute files */
#defineSEG_TEXT "__text"/* The Tradition UNIX TEXT segment */
#defineSEG_DATA "__data"/* The Tradition UNIX DATA segment */
#defineSEG_OBJC "__OBJC"/* OBJECTIVE-C Runtime Segment */
#defineSEG_ICON "__icon"/* The ICON segment */
#defineSEG_LINKEDIT "__linkedit"/* The segment containing all structs */
/* created and maintained by the link */
/* Editor. Created With-seglinkedit */
/* Option to LD (1) for Mh_execute and * *
/* Fvmlib File types only */
#define Seg_import "__import"/* The segment for the self (dyld) */
/* modifing code stubs that have read, */
/* Write and Execute permissions */
Virtual memory start address for 4.VMADDR segment
Virtual memory size for 5.vmsize segments
Offset of 6.fileoff segment in file
The size of the 7.filesize segment in the file
Maximum memory protection required for 8.maxprot segment pages (4=r,2=w,1=x)
9.initprot section of the page Initial memory protection
The number of sections in the 10.nsects segment
11.flags other miscellaneous flag bits
This paper mainly discusses the types of segment and its structure, the next __data and __text below the sections.
[iOS Reverse combat seven] read Mach-o (2)