SYM File

Structure

  •  Programme header
  • Section
  • Symbol table

Programme header

  • An executable or shared object file's program header table is an array of structures.
  • each describing a segment or other information the system needs to prepare the program for execution.
  • An object file segment contains one or more sections.
  • Program headers are meaningful only for executable and shared object files.
  • A file specifies its own program header size with the ELF header's e_phentsize and e_phnum members.
  • typedef struct {
    • Elf32_Word p_type;//tells what kind of segment this array element describes or how to interpret the array element's information.
    • Elf32_Off p_offset;//gives the offset from the beginning of the file at which the first byte of the segment resides.
    • Elf32_Addr p_vaddr;//gives the virtual address at which the first byte of the segment resides in memory.
    • Elf32_Addr p_paddr; //On systems for which physical addressing is relevant, this member is reserved for the segment's physical address.
    • Elf32_Word p_filesz; //This member gives the number of bytes in the file image of the segment; it may be zero.
    • Elf32_Word p_memsz; //This member gives the number of bytes in the memory image of the segment; it may be zero.
    • Elf32_Word p_flags; //This member gives flags relevant to the segment.
    • Elf32_Word p_align; //This member gives the value to which the segments are aligned in memory and in the file.
  • } Elf32_Phdr;
  • p_type
      • Name             Value             meaning
      • PT_NULL        0                          The array element is unused
      • PT_LOAD        1                           The array element specifies a loadable segment
      • PT_DYNAMIC      2                           The array element specifies dynamic linking information
      • PT_INTERP       3                           The array element specifies the location and size of a null- terminated path name to invoke as an interpreter
      • PT_NOTE       4                      The array element specifies the location and size of auxiliary information
      • PT_SHLIB         5                             This segment type is reserved, has unspecified semantics
      • PT_PHDR         6                             specifies the location and size of the program header table itself
      • PT_LOPROC         0x70000000         reserved for processor-specific semantics
      • PT_HIPROC       0x7fffffff
原文地址:https://www.cnblogs.com/zhizhi25/p/9762791.html