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