2013-09-25 67 views

回答

26

总结典型段名:

.text: Code 
.data: Initialized data 
.bss: Uninitialized data 
.rdata: Const/read-only (and initialized) data 
.edata: Export descriptors 
.idata: Import descriptors 
.reloc: Relocation table (for code instructions with absolute addressing when 
      the module could not be loaded at its preferred base address) 
.rsrc: Resources (icon, bitmap, dialog, ...) 
.tls: __declspec(thread) data (Fails with dynamically loaded DLLs -> hard to find bugs) 

正如马丁罗西瑙提到,段名是唯一的典型。真正的段类型是在段头中指定的,或者是通过使用存储在段中的数据来定义的。

4

事实上,这些段的名称被Windows忽略。

有一些链接器使用不同的段名称,甚至可以在“.text”段中存储导入描述符,导出描述符,资源等,而不是使用单独的段。

但是,为这样的元数据创建单独的部分似乎更简单,因此大多数链接器将使用单独的部分。包含程序数据(尽管它们的名称以“data”结尾),但它们包含的元信息是:.idata,.rdata,.rsrc,... do 而不是由操作系统使用。例如,“.rsrc”部分保存有关在资源管理器中查看可执行文件时显示的图标的信息。

“.idata”包含有关程序所需的所有DLL文件的信息。