root/include/linux/elf.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _ELF_H
   2 #define _ELF_H
   3 
   4 /* THese constants are for the segment types stored in the image headers */
   5 #define PT_NULL    0
   6 #define PT_LOAD    1
   7 #define PT_DYNAMIC 2
   8 #define PT_INTERP  3
   9 #define PT_NOTE    4
  10 #define PT_SHLIB   5
  11 #define PT_PHDR    6
  12 #define PT_LOPROC  0x70000000
  13 #define PT_HIPROC  0x7fffffff
  14 
  15 /* These constants define the different elf file types */
  16 #define ET_NONE   0
  17 #define ET_REL    1
  18 #define ET_EXEC   2
  19 #define ET_DYN    3
  20 #define ET_CORE   4
  21 #define ET_LOPROC 5
  22 #define ET_HIPROC 6
  23 
  24 /* These constants define the various ELF target machines */
  25 #define EM_NONE  0
  26 #define EM_M32   1
  27 #define EM_SPARC 2
  28 #define EM_386   3
  29 #define EM_68K   4
  30 #define EM_88K   5
  31 #define EM_486   6   /* Perhaps disused */
  32 #define EM_860   7
  33 
  34 /* This is the info that is needed to parse the dynamic section of the file */
  35 #define DT_NULL         0
  36 #define DT_NEEDED       1
  37 #define DT_PLTRELSZ     2
  38 #define DT_PLTGOT       3
  39 #define DT_HASH         4
  40 #define DT_STRTAB       5
  41 #define DT_SYMTAB       6
  42 #define DT_RELA         7
  43 #define DT_RELASZ       8
  44 #define DT_RELAENT      9
  45 #define DT_STRSZ        10
  46 #define DT_SYMENT       11
  47 #define DT_INIT         12
  48 #define DT_FINI         13
  49 #define DT_SONAME       14
  50 #define DT_RPATH        15
  51 #define DT_SYMBOLIC     16
  52 #define DT_REL          17
  53 #define DT_RELSZ        18
  54 #define DT_RELENT       19
  55 #define DT_PLTREL       20
  56 #define DT_DEBUG        21
  57 #define DT_TEXTREL      22
  58 #define DT_JMPREL       23
  59 #define DT_LOPROC       0x70000000
  60 #define DT_HIPROC       0x7fffffff
  61 
  62 /* This info is needed when parsing the symbol table */
  63 #define STB_LOCAL  0
  64 #define STB_GLOBAL 1
  65 #define STB_WEAK   2
  66 
  67 #define STT_NOTYPE  0
  68 #define STT_OBJECT  1
  69 #define STT_FUNC    2
  70 #define STT_SECTION 3
  71 #define STT_FILE    4
  72 
  73 #define ELF32_ST_BIND(x) ((x) >> 4)
  74 #define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
  75 
  76 
  77 
  78 struct dynamic{
  79   int d_tag;
  80   union{
  81     int d_val;
  82     char * d_ptr;
  83   } d_un;
  84 };
  85 
  86 /* THe following are used with relocations */
  87 #define ELF32_R_SYM(x) ((x) >> 8)
  88 #define ELF32_R_TYPE(x) ((x) & 0xff)
  89 
  90 #define R_386_NONE      0
  91 #define R_386_32        1
  92 #define R_386_PC32      2
  93 #define R_386_GOT32     3
  94 #define R_386_PLT32     4
  95 #define R_386_COPY      5
  96 #define R_386_GLOB_DAT  6
  97 #define R_386_JMP_SLOT  7
  98 #define R_386_RELATIVE  8
  99 #define R_386_GOTOFF    9
 100 #define R_386_GOTPC     10
 101 #define R_386_NUM       11
 102 
 103 struct Elf32_Rel{
 104   unsigned int * offset;
 105   int info;
 106 };
 107 
 108 struct Elf32_Rela{
 109   unsigned int * offset;
 110   int info;
 111   int addend;
 112 };
 113 
 114 struct Elf32_Sym{
 115   int st_name;
 116   unsigned int st_value;
 117   int st_size;
 118   unsigned char st_info;
 119   unsigned char st_other;
 120   short int st_shndx;
 121 };
 122 
 123 struct elfhdr{
 124   char  e_ident[16];
 125   short int e_type;
 126   short int e_machine;
 127   int   e_version;
 128   char *e_entry;  /* Entry point */
 129   int   e_phoff;
 130   int   e_shoff;
 131   int   e_flags;
 132   short int e_ehsize;
 133   short int e_phentsize;
 134   short int e_phnum;
 135   short int e_shentsize;
 136   short int e_shnum;
 137   short int e_shstrndx;
 138 };
 139 
 140 struct elf_phdr{
 141   int p_type;
 142   int p_offset;
 143   int p_vaddr;
 144   int p_paddr;
 145   int p_filesz;
 146   int p_memsz;
 147   int p_flags;
 148   int p_align;
 149 };
 150 
 151 #define ELF_START_MMAP 0x80000000
 152 
 153 #endif

/* [previous][next][first][last][top][bottom][index][help] */