Chapter 4 Structure of hosted executable objects in expert. NET 2.0 il explorer 4.3 Summary

Source: Internet
Author: User

Returned directory

 

Summary

Discussed the structure andIlHow the compiler generates these filesIlThe compiler creates a managedPEFile steps.PEThe file is created as follows:4Steps:

 

Procedure1: Initialization

1.Initialize internal buffer

2.CreatePEEmpty file template, includingMS-DOSHeader andStub,PESignature,CoffHeader andPEHeader.

3.Input address table andCLRHeader is allocated in. TextSection.

Procedure2:Source codeSyntax analysis

1.Metadata is collected in the internal buffer.

2.Method body (IlCodeAnd managed exception handling tables) are collected in the internal buffer.

3.The data constant is released. SdataAnd. TLSCIDR block.

Procedure3: Image Generation

1.For strong signatures on. TextArea.

2.Metadata is analyzed and reorganized.

3.Reference of internal (to module) inIlCode.

4.Method body released. TextCIDR block.

5.TLSThe directory table is published. SdataCIDR block.

6.The DEBUG directory is released. TextCIDR block.

7.For metadata in. TextArea.

8.For Embedded managed resources in. TextArea.

9.Unmanaged ExportStubReleased. TextCIDR block.

10.VtfixupThe tag is released. TextCIDR block.

11.V-The table is published. SdataCIDR block.

12.An unmanaged export table is published. SdataCIDR block.

13.The latest change in metadata-RVARepaired.

14.Metadata is published in. TextThe pre-allocated space of the CIDR block.

15.Managed resources are released on. TextThe pre-allocated space of the CIDR block.

16.Start of RunningStubReleased on. TextSection

17.Unmanaged resources are. ResFiles are read and published in. RsrcSection

18.The required basic redirection is published in. RelocSection

Procedure4: Complete

1.The image file is written as a disk file.

2.The strong signature process is applied to the file by calling the strong name tool.

 

IlThe compiler allows you to set a value explicitly in the header of the image file, depending on source code instructions and compiler command line options, as shown in the table4-7. In all the situations discussed in this chapter, the command line option takes precedence over the corresponding source code commands.

Header

Field

Command

Command line options

Coff

Machine

 

/Itanium,/x64 (default is i386)

PE

Header type

 

/Pe64 (default is pe32)

PE

Imagebase

. Imagebase <integer value>

/Base = <integer value>

PE

Sizeofstackreserve

. Stackreserve <integer value>

/Stack = <integer value>

PE

Filealignment

. File alignment <integer value>

/Alignment = <integer value>

PE

Subsystem

. Subsystem <integer value>

/Subsystem = <integer value>

CLR

Flags

. Corflags <integer value>

/Flags = <integer value>

 

CommitTranslation -- submit?

Preferred-- Preferred

Take precedence-- Takes precedence over

Make nontrivial use of =Need to use

As SushThe same

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.