Changeset a8bb38c in mainline
- Timestamp:
- 2011-08-05T16:57:12Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e8067c0
- Parents:
- 12bcae0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/lib/elf.h
r12bcae0 ra8bb38c 42 42 * current ELF version 43 43 */ 44 #define EV_CURRENT 44 #define EV_CURRENT 1 45 45 46 46 /** 47 47 * ELF types 48 48 */ 49 #define ET_NONE 0/* No type */50 #define ET_REL 1/* Relocatable file */51 #define ET_EXEC 2/* Executable */52 #define ET_DYN 3/* Shared object */53 #define ET_CORE 4/* Core */54 #define ET_LOPROC 0xff00/* Processor specific */55 #define ET_HIPROC 0xffff/* Processor specific */49 #define ET_NONE 0 /* No type */ 50 #define ET_REL 1 /* Relocatable file */ 51 #define ET_EXEC 2 /* Executable */ 52 #define ET_DYN 3 /* Shared object */ 53 #define ET_CORE 4 /* Core */ 54 #define ET_LOPROC 0xff00 /* Processor specific */ 55 #define ET_HIPROC 0xffff /* Processor specific */ 56 56 57 57 /** 58 58 * ELF machine types 59 59 */ 60 #define EM_NO 0/* No machine */61 #define EM_SPARC 2/* SPARC */62 #define EM_386 3/* i386 */63 #define EM_MIPS 8/* MIPS RS3000 */64 #define EM_MIPS_RS3_LE 10/* MIPS RS3000 LE */65 #define EM_PPC 20/* PPC32 */66 #define EM_PPC64 21/* PPC64 */67 #define EM_ARM 40/* ARM */68 #define EM_SPARCV9 43/* SPARC64 */69 #define EM_IA_64 50/* IA-64 */70 #define EM_X86_64 62/* AMD64/EMT64 */60 #define EM_NO 0 /* No machine */ 61 #define EM_SPARC 2 /* SPARC */ 62 #define EM_386 3 /* i386 */ 63 #define EM_MIPS 8 /* MIPS RS3000 */ 64 #define EM_MIPS_RS3_LE 10 /* MIPS RS3000 LE */ 65 #define EM_PPC 20 /* PPC32 */ 66 #define EM_PPC64 21 /* PPC64 */ 67 #define EM_ARM 40 /* ARM */ 68 #define EM_SPARCV9 43 /* SPARC64 */ 69 #define EM_IA_64 50 /* IA-64 */ 70 #define EM_X86_64 62 /* AMD64/EMT64 */ 71 71 72 72 /** 73 73 * ELF identification indexes 74 74 */ 75 #define EI_MAG0 76 #define EI_MAG1 77 #define EI_MAG2 78 #define EI_MAG3 79 #define EI_CLASS 4/* File class */80 #define EI_DATA 5/* Data encoding */81 #define EI_VERSION 6/* File version */82 #define EI_OSABI 83 #define EI_ABIVERSION 84 #define EI_PAD 9/* Start of padding bytes */85 #define EI_NIDENT 16/* ELF identification table size */75 #define EI_MAG0 0 76 #define EI_MAG1 1 77 #define EI_MAG2 2 78 #define EI_MAG3 3 79 #define EI_CLASS 4 /* File class */ 80 #define EI_DATA 5 /* Data encoding */ 81 #define EI_VERSION 6 /* File version */ 82 #define EI_OSABI 7 83 #define EI_ABIVERSION 8 84 #define EI_PAD 9 /* Start of padding bytes */ 85 #define EI_NIDENT 16 /* ELF identification table size */ 86 86 87 87 /** 88 88 * ELF magic number 89 89 */ 90 #define ELFMAG0 91 #define ELFMAG1 92 #define ELFMAG2 93 #define ELFMAG3 90 #define ELFMAG0 0x7f 91 #define ELFMAG1 'E' 92 #define ELFMAG2 'L' 93 #define ELFMAG3 'F' 94 94 95 95 /** 96 96 * ELF file classes 97 97 */ 98 #define ELFCLASSNONE 99 #define ELFCLASS32 100 #define ELFCLASS64 98 #define ELFCLASSNONE 0 99 #define ELFCLASS32 1 100 #define ELFCLASS64 2 101 101 102 102 /** 103 103 * ELF data encoding types 104 104 */ 105 #define ELFDATANONE 106 #define ELFDATA2LSB 1/* Least significant byte first (little endian) */107 #define ELFDATA2MSB 2/* Most signigicant byte first (big endian) */105 #define ELFDATANONE 0 106 #define ELFDATA2LSB 1 /* Least significant byte first (little endian) */ 107 #define ELFDATA2MSB 2 /* Most signigicant byte first (big endian) */ 108 108 109 109 /** 110 110 * ELF section types 111 111 */ 112 #define SHT_NULL 113 #define SHT_PROGBITS 114 #define SHT_SYMTAB 115 #define SHT_STRTAB 116 #define SHT_RELA 117 #define SHT_HASH 118 #define SHT_DYNAMIC 119 #define SHT_NOTE 120 #define SHT_NOBITS 121 #define SHT_REL 122 #define SHT_SHLIB 123 #define SHT_DYNSYM 124 #define SHT_LOOS 125 #define SHT_HIOS 126 #define SHT_LOPROC 127 #define SHT_HIPROC 128 #define SHT_LOUSER 129 #define SHT_HIUSER 112 #define SHT_NULL 0 113 #define SHT_PROGBITS 1 114 #define SHT_SYMTAB 2 115 #define SHT_STRTAB 3 116 #define SHT_RELA 4 117 #define SHT_HASH 5 118 #define SHT_DYNAMIC 6 119 #define SHT_NOTE 7 120 #define SHT_NOBITS 8 121 #define SHT_REL 9 122 #define SHT_SHLIB 10 123 #define SHT_DYNSYM 11 124 #define SHT_LOOS 0x60000000 125 #define SHT_HIOS 0x6fffffff 126 #define SHT_LOPROC 0x70000000 127 #define SHT_HIPROC 0x7fffffff 128 #define SHT_LOUSER 0x80000000 129 #define SHT_HIUSER 0xffffffff 130 130 131 131 /** 132 132 * ELF section flags 133 133 */ 134 #define SHF_WRITE 0x1135 #define SHF_ALLOC 136 #define SHF_EXECINSTR 137 #define SHF_TLS 138 #define SHF_MASKPROC 134 #define SHF_WRITE 0x1 135 #define SHF_ALLOC 0x2 136 #define SHF_EXECINSTR 0x4 137 #define SHF_TLS 0x400 138 #define SHF_MASKPROC 0xf0000000 139 139 140 140 /** Macros for decomposing elf_symbol.st_info into binging and type */ 141 #define ELF_ST_BIND(i) 142 #define ELF_ST_TYPE(i) 143 #define ELF_ST_INFO(b, t) 141 #define ELF_ST_BIND(i) ((i) >> 4) 142 #define ELF_ST_TYPE(i) ((i) & 0x0f) 143 #define ELF_ST_INFO(b, t) (((b) << 4) + ((t) & 0x0f)) 144 144 145 145 /** 146 146 * Symbol binding 147 147 */ 148 #define STB_LOCAL 149 #define STB_GLOBAL 150 #define STB_WEAK 151 #define STB_LOPROC 152 #define STB_HIPROC 148 #define STB_LOCAL 0 149 #define STB_GLOBAL 1 150 #define STB_WEAK 2 151 #define STB_LOPROC 13 152 #define STB_HIPROC 15 153 153 154 154 /** 155 155 * Symbol types 156 156 */ 157 #define STT_NOTYPE 158 #define STT_OBJECT 159 #define STT_FUNC 160 #define STT_SECTION 161 #define STT_FILE 162 #define STT_LOPROC 163 #define STT_HIPROC 157 #define STT_NOTYPE 0 158 #define STT_OBJECT 1 159 #define STT_FUNC 2 160 #define STT_SECTION 3 161 #define STT_FILE 4 162 #define STT_LOPROC 13 163 #define STT_HIPROC 15 164 164 165 165 /** 166 166 * Program segment types 167 167 */ 168 #define PT_NULL 169 #define PT_LOAD 170 #define PT_DYNAMIC 171 #define PT_INTERP 172 #define PT_NOTE 173 #define PT_SHLIB 174 #define PT_PHDR 175 #define PT_LOPROC 176 #define PT_HIPROC 168 #define PT_NULL 0 169 #define PT_LOAD 1 170 #define PT_DYNAMIC 2 171 #define PT_INTERP 3 172 #define PT_NOTE 4 173 #define PT_SHLIB 5 174 #define PT_PHDR 6 175 #define PT_LOPROC 0x70000000 176 #define PT_HIPROC 0x7fffffff 177 177 178 178 /** 179 179 * Program segment attributes. 180 180 */ 181 #define PF_X 182 #define PF_W 183 #define PF_R 181 #define PF_X 1 182 #define PF_W 2 183 #define PF_R 4 184 184 185 185 /** … … 229 229 elf_half e_shstrndx; 230 230 }; 231 231 232 struct elf64_header { 232 233 uint8_t e_ident[EI_NIDENT]; … … 246 247 }; 247 248 248 /* 249 /** 249 250 * ELF segment header. 250 251 * Segments headers are also known as program headers. … … 260 261 elf_word p_align; 261 262 }; 263 262 264 struct elf64_segment_header { 263 265 elf_word p_type; … … 271 273 }; 272 274 273 /* 275 /** 274 276 * ELF section header 275 277 */ … … 286 288 elf_word sh_entsize; 287 289 }; 290 288 291 struct elf64_section_header { 289 292 elf_word sh_name; … … 299 302 }; 300 303 301 /* 304 /** 302 305 * ELF symbol table entry 303 306 */ … … 310 313 elf_half st_shndx; 311 314 }; 315 312 316 struct elf64_symbol { 313 317 elf_word st_name; … … 327 331 elf_word type; 328 332 }; 333 329 334 /* 330 335 * NOTE: namesz, descsz and type should be 64-bits wide (elf_xword) … … 347 352 typedef struct elf32_note elf_note_t; 348 353 #endif 354 349 355 #ifdef __64_BITS__ 350 356 typedef struct elf64_header elf_header_t;
Note:
See TracChangeset
for help on using the changeset viewer.