PE(Portable Executable),即可移植的执行体。所有Windows下可执行文件,均使用PE文件结构。
PE文件通常包括以下节(Section)
.textbss/BSS
BSS段(bss segment)通常是指用来存放程序中未初始化的全局变量的一块内存区域。BSS是英文Block Started by Symbol的简称。BSS段属于静态内存分配。
.text/CODE
代码段(text segment)通常是指用来存放程序执行代码的一块内存区域。这部分区域的大小在程序运行前就已经确定,并且内存区域属于只读。在代码段中,也有可能包含一些只读的常数变量,例如字符串常量等。需要注意的是,borland这里叫做code,而不是text 。
.rdata
只读数据段。
The .rdata section is used for at least two things. First, in Microsoft linker-produced EXEs, the .rdata section holds the debug directory, which is only present in EXE files.
The other useful portion of an .rdata section is the description string. If you specified a DESCRIPTION entry in your program’s DEF file, the specified description string appears in the .rdata section.
.data
数据段(data segment)通常是指用来存放程序中已初始化的全局变量的一块内存区域。数据段属于静态内存分配。
.idata
The .idata section contains information about functions (and data) that the module imports from other DLLs.
导入段。包含程序需要的所有DLL文件信息。
.edata
The .edata section is a list of the functions and data that the PE file exports for other modules.
导出段。包含所有提供给其他程序使用的函数和数据。
.rsrc
The .rsrc section contains all the resources for the module.
资源数据段,程序用到什么资源数据都在这里。
.reloc
The .reloc section holds a table of base relocations. A base relocation is an adjustment to an instruction or initialized variable value that’s needed if the loader couldn’t load the file where the linker assumed it would. If the loader is able to load the image at the linker’s preferred base address, the loader completely ignores the relocation information in this section.
重定位段。如果加载PE文件失败,将基于此段进行重新调整。
参考文献
1.https://msdn.microsoft.com/en-us/library/ms809762.aspx
————————————————
版权声明:本文为CSDN博主「Eric_Fan0」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/fw72fw72/article/details/68486917