[iOS reverse combat seven] read Mach-o (2)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.