scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

elfphdr.h (2596B)


      1 /* See http://www.sco.com/developers/gabi/latest/contents.html */
      2 
      3 /* Segment types - p_type */
      4 #define PT_NULL         0               /* unused */
      5 #define PT_LOAD         1               /* loadable segment */
      6 #define PT_DYNAMIC      2               /* dynamic linking section */
      7 #define PT_INTERP       3               /* the RTLD */
      8 #define PT_NOTE         4               /* auxiliary information */
      9 #define PT_SHLIB        5               /* reserved - purpose undefined */
     10 #define PT_PHDR         6               /* program header */
     11 #define PT_TLS          7               /* thread local storage */
     12 #define PT_LOOS         0x60000000      /* reserved range for OS */
     13 #define PT_HIOS         0x6fffffff      /*  specific segment types */
     14 #define PT_LOPROC       0x70000000      /* reserved range for processor */
     15 #define PT_HIPROC       0x7fffffff      /*  specific segment types */
     16 
     17 #define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550) /* Frame unwind information */
     18 #define PT_GNU_STACK    (PT_LOOS + 0x474e551) /* Stack flags */
     19 #define PT_GNU_RELRO    (PT_LOOS + 0x474e552) /* Read-only after relocation */
     20 #define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) /* GNU property */
     21 
     22 #define PF_X            1               /* Executable */
     23 #define PF_W            2               /* Writable */
     24 #define PF_R            4               /* Readable */
     25 #define PF_MASKOS       0x0ff00000      /* Operating system specific values */
     26 #define PF_MASKPROC     0xf0000000      /* Processor-specific values */
     27 
     28 #define ELFP32SZ        32
     29 #define ELFP64SZ        56
     30 
     31 typedef struct elf32_phdr Elf32_Phdr;
     32 typedef struct elf64_phdr Elf64_Phdr;
     33 
     34 /* Program Header */
     35 struct elf32_phdr {
     36 	Elf32_Word p_type;              /* segment type */
     37 	Elf32_Off p_offset;             /* segment offset */
     38 	Elf32_Addr p_vaddr;             /* virtual address of segment */
     39 	Elf32_Addr p_paddr;             /* physical address - ignored? */
     40 	Elf32_Word p_filesz;            /* number of bytes in file for seg. */
     41 	Elf32_Word p_memsz;             /* number of bytes in mem. for seg. */
     42 	Elf32_Word p_flags;             /* flags */
     43 	Elf32_Word p_align;             /* memory alignment */
     44 };
     45 
     46 struct elf64_phdr {
     47 	Elf64_Word p_type;              /* entry type */
     48 	Elf64_Word p_flags;             /* flags */
     49 	Elf64_Off p_offset;             /* offset */
     50 	Elf64_Addr p_vaddr;             /* virtual address */
     51 	Elf64_Addr p_paddr;             /* physical address */
     52 	Elf64_Xword p_filesz;           /* file size */
     53 	Elf64_Xword p_memsz;            /* memory size */
     54 	Elf64_Xword p_align;            /* memory & file alignment */
     55 };