栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

可执行C程序中的段

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

可执行C程序中的段

了解

readelf
它的输出将帮助您了解
ELF
文件的格式。请参考本文件。

就了解如何解释

readelf
此链接的输出而言可能会有帮助。

关于您的问题2,此链接描述了细分。在该文档中搜索“各种节包含程序和控制信息:”以找到描述段名的区域。

该文档描述了以下部分:

各个部分包含程序和控制信息:

   .bss      This section holds uninitialized data that contributes to the  program's memory image.  By definition, the system initializes the  data with zeros when the program begins to run.  This section is of  type SHT_NOBITS.  The attribute types are SHF_ALLOC and SHF_WRITE.   .comment  This section holds version control information.  This section is of  type SHT_PROGBITS.  No attribute types are used.   .ctors    This section holds initialized pointers to the C++ constructor  functions.  This section is of type SHT_PROGBITS.  The attribute  types are SHF_ALLOC and SHF_WRITE.   .data     This section holds initialized data that contribute to the program's  memory image.  This section is of type SHT_PROGBITS.  The attribute  types are SHF_ALLOC and SHF_WRITE.   .data1    This section holds initialized data that contribute to the program's  memory image.  This section is of type SHT_PROGBITS.  The attribute  types are SHF_ALLOC and SHF_WRITE.   .debug    This section holds information for symbolic debugging.  The contents  are unspecified.  This section is of type SHT_PROGBITS.  No  attribute types are used.   .dtors    This section holds initialized pointers to the C++ destructor  functions.  This section is of type SHT_PROGBITS.  The attribute  types are SHF_ALLOC and SHF_WRITE.   .dynamic  This section holds dynamic linking information.  The section's  attributes will include the SHF_ALLOC bit.  Whether the SHF_WRITE  bit is set is processor-specific.  This section is of type  SHT_DYNAMIC.  See the attributes above.   .dynstr   This section holds strings needed for dynamic linking, most commonly  the strings that represent the names associated with symbol table  entries.  This section is of type SHT_STRTAB.  The attribute type  used is SHF_ALLOC.   .dynsym   This section holds the dynamic linking symbol table.  This section  is of type SHT_DYNSYM.  The attribute used is SHF_ALLOC.   .fini     This section holds executable instructions that contribute to the  process termination pre.  When a program exits normally the system  arranges to execute the pre in this section.  This section is of  type SHT_PROGBITS.  The attributes used are SHF_ALLOC and  SHF_EXECINSTR.   .gnu.version  This section holds the version symbol table, an array of ElfN_Half  elements.  This section is of type SHT_GNU_versym.  The attribute  type used is SHF_ALLOC.   .gnu.version_d  This section holds the version symbol definitions, a table of  ElfN_Verdef structures.  This section is of type SHT_GNU_verdef.  The attribute type used is SHF_ALLOC.   .gnu.version_r  This section holds the version symbol needed elements, a table of  ElfN_Verneed structures.  This section is of type SHT_GNU_versym.  The attribute type used is SHF_ALLOC.   .got      This section holds the global offset table.  This section is of type  SHT_PROGBITS.  The attributes are processor specific.   .hash     This section holds a symbol hash table.  This section is of type  SHT_HASH.  The attribute used is SHF_ALLOC.   .init     This section holds executable instructions that contribute to the  process initialization pre.  When a program starts to run the  system arranges to execute the pre in this section before calling  the main program entry point.  This section is of type SHT_PROGBITS.  The attributes used are SHF_ALLOC and SHF_EXECINSTR.   .interp   This section holds the pathname of a program interpreter.  If the  file has a loadable segment that includes the section, the section's  attributes will include the SHF_ALLOC bit.  Otherwise, that bit will  be off.  This section is of type SHT_PROGBITS.   .line     This section holds line number information for symbolic debugging,  which describes the correspondence between the program source and  the machine pre.  The contents are unspecified.  This section is of  type SHT_PROGBITS.  No attribute types are used.   .note     This section holds information in the "Note Section" format.  This  section is of type SHT_NOTE.  No attribute types are used.  OpenBSD  native executables usually contain a .note.openbsd.ident section to  identify themselves, for the kernel to bypass any compatibility ELF  binary emulation tests when loading the file.   .note.GNU-stack  This section is used in Linux object files for declaring stack  attributes.  This section is of type SHT_PROGBITS.  The only  attribute used is SHF_EXECINSTR.  This indicates to the GNU linker  that the object file requires an executable stack.   .plt      This section holds the procedure linkage table.  This section is of  type SHT_PROGBITS.  The attributes are processor specific.   .relNAME  This section holds relocation information as described below.  If  the file has a loadable segment that includes relocation, the  section's attributes will include the SHF_ALLOC bit.  Otherwise the  bit will be off.  By convention, "NAME" is supplied by the section  to which the relocations apply.  Thus a relocation section for .text  normally would have the name .rel.text.  This section is of type  SHT_REL.   .relaNAME This section holds relocation information as described below.  If  the file has a loadable segment that includes relocation, the  section's attributes will include the SHF_ALLOC bit.  Otherwise the  bit will be off.  By convention, "NAME" is supplied by the section  to which the relocations apply.  Thus a relocation section for .text  normally would have the name .rela.text.  This section is of type  SHT_RELA.   .rodata   This section holds read-only data that typically contributes to a  nonwritable segment in the process image.  This section is of type  SHT_PROGBITS.  The attribute used is SHF_ALLOC.   .rodata1  This section holds read-only data that typically contributes to a  nonwritable segment in the process image.  This section is of type  SHT_PROGBITS.  The attribute used is SHF_ALLOC.   .shstrtab This section holds section names.  This section is of type  SHT_STRTAB.  No attribute types are used.   .strtab   This section holds strings, most commonly the strings that represent  the names associated with symbol table entries.  If the file has a  loadable segment that includes the symbol string table, the  section's attributes will include the SHF_ALLOC bit.  Otherwise the  bit will be off.  This section is of type SHT_STRTAB.   .symtab   This section holds a symbol table.  If the file has a loadable  segment that includes the symbol table, the section's attributes  will include the SHF_ALLOC bit.  Otherwise the bit will be off.  This section is of type SHT_SYMTAB.   .text     This section holds the "text", or executable instructions, of a  program.  This section is of type SHT_PROGBITS.  The attributes used  are SHF_ALLOC and SHF_EXECINSTR.


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/397583.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号