Changeset 8ff0bd2 in mainline for abi/include/elf.h
- Timestamp:
- 2011-09-04T11:30:58Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 03bc76a
- Parents:
- d2c67e7 (diff), deac215e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 moved
-
abi/include/elf.h (moved) (moved from uspace/app/taskdump/include/elf.h ) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
abi/include/elf.h
rd2c67e7 r8ff0bd2 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef ELF_H_ 36 #define ELF_H_ 37 38 #include <arch/elf.h> 39 #include <sys/types.h> 40 41 /** 42 * current ELF version 43 */ 44 #define EV_CURRENT 1 45 46 /** 47 * ELF types 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 */ 56 57 /** 35 #ifndef ABI_ELF_H_ 36 #define ABI_ELF_H_ 37 38 /** 39 * Current ELF version 40 */ 41 #define EV_CURRENT 1 42 43 /** 44 * ELF types 45 */ 46 #define ET_NONE 0 /* No type */ 47 #define ET_REL 1 /* Relocatable file */ 48 #define ET_EXEC 2 /* Executable */ 49 #define ET_DYN 3 /* Shared object */ 50 #define ET_CORE 4 /* Core */ 51 #define ET_LOPROC 0xff00 /* Processor specific */ 52 #define ET_HIPROC 0xffff /* Processor specific */ 53 54 /** 58 55 * ELF machine types 59 56 */ 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 */57 #define EM_NO 0 /* No machine */ 58 #define EM_SPARC 2 /* SPARC */ 59 #define EM_386 3 /* i386 */ 60 #define EM_MIPS 8 /* MIPS RS3000 */ 61 #define EM_MIPS_RS3_LE 10 /* MIPS RS3000 LE */ 62 #define EM_PPC 20 /* PPC32 */ 63 #define EM_PPC64 21 /* PPC64 */ 64 #define EM_ARM 40 /* ARM */ 65 #define EM_SPARCV9 43 /* SPARC64 */ 66 #define EM_IA_64 50 /* IA-64 */ 67 #define EM_X86_64 62 /* AMD64/EMT64 */ 71 68 72 69 /** 73 70 * ELF identification indexes 74 71 */ 75 #define EI_MAG0 076 #define EI_MAG1 177 #define EI_MAG2 278 #define EI_MAG3 379 #define EI_CLASS 4/* File class */80 #define EI_DATA 5/* Data encoding */81 #define EI_VERSION 6/* File version */82 #define EI_OSABI 783 #define EI_ABIVERSION 884 #define EI_PAD 9/* Start of padding bytes */85 #define EI_NIDENT 16/* ELF identification table size */72 #define EI_MAG0 0 73 #define EI_MAG1 1 74 #define EI_MAG2 2 75 #define EI_MAG3 3 76 #define EI_CLASS 4 /* File class */ 77 #define EI_DATA 5 /* Data encoding */ 78 #define EI_VERSION 6 /* File version */ 79 #define EI_OSABI 7 80 #define EI_ABIVERSION 8 81 #define EI_PAD 9 /* Start of padding bytes */ 82 #define EI_NIDENT 16 /* ELF identification table size */ 86 83 87 84 /** 88 85 * ELF magic number 89 86 */ 90 #define ELFMAG0 0x7f91 #define ELFMAG1 'E'92 #define ELFMAG2 'L'93 #define ELFMAG3 'F'87 #define ELFMAG0 0x7f 88 #define ELFMAG1 'E' 89 #define ELFMAG2 'L' 90 #define ELFMAG3 'F' 94 91 95 92 /** 96 93 * ELF file classes 97 94 */ 98 #define ELFCLASSNONE 099 #define ELFCLASS32 1100 #define ELFCLASS64 295 #define ELFCLASSNONE 0 96 #define ELFCLASS32 1 97 #define ELFCLASS64 2 101 98 102 99 /** 103 100 * ELF data encoding types 104 101 */ 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 109 /** 110 * ELF error return codes 111 */ 112 #define EE_OK 0 /* No error */ 113 #define EE_INVALID 1 /* Invalid ELF image */ 114 #define EE_MEMORY 2 /* Cannot allocate address space */ 115 #define EE_INCOMPATIBLE 3 /* ELF image is not compatible with current architecture */ 116 #define EE_UNSUPPORTED 4 /* Non-supported ELF (e.g. dynamic ELFs) */ 117 #define EE_IRRECOVERABLE 5 102 #define ELFDATANONE 0 103 #define ELFDATA2LSB 1 /* Least significant byte first (little endian) */ 104 #define ELFDATA2MSB 2 /* Most signigicant byte first (big endian) */ 118 105 119 106 /** 120 107 * ELF section types 121 108 */ 122 #define SHT_NULL 0123 #define SHT_PROGBITS 1124 #define SHT_SYMTAB 2125 #define SHT_STRTAB 3126 #define SHT_RELA 4127 #define SHT_HASH 5128 #define SHT_DYNAMIC 6129 #define SHT_NOTE 7130 #define SHT_NOBITS 8131 #define SHT_REL 9132 #define SHT_SHLIB 10133 #define SHT_DYNSYM 11134 #define SHT_LOOS 0x60000000135 #define SHT_HIOS 0x6fffffff136 #define SHT_LOPROC 0x70000000137 #define SHT_HIPROC 0x7fffffff138 #define SHT_LOUSER 0x80000000139 #define SHT_HIUSER 0xffffffff109 #define SHT_NULL 0 110 #define SHT_PROGBITS 1 111 #define SHT_SYMTAB 2 112 #define SHT_STRTAB 3 113 #define SHT_RELA 4 114 #define SHT_HASH 5 115 #define SHT_DYNAMIC 6 116 #define SHT_NOTE 7 117 #define SHT_NOBITS 8 118 #define SHT_REL 9 119 #define SHT_SHLIB 10 120 #define SHT_DYNSYM 11 121 #define SHT_LOOS 0x60000000 122 #define SHT_HIOS 0x6fffffff 123 #define SHT_LOPROC 0x70000000 124 #define SHT_HIPROC 0x7fffffff 125 #define SHT_LOUSER 0x80000000 126 #define SHT_HIUSER 0xffffffff 140 127 141 128 /** 142 129 * ELF section flags 143 130 */ 144 #define SHF_WRITE 0x1145 #define SHF_ALLOC 0x2146 #define SHF_EXECINSTR 0x4147 #define SHF_TLS 0x400148 #define SHF_MASKPROC 0xf0000000131 #define SHF_WRITE 0x1 132 #define SHF_ALLOC 0x2 133 #define SHF_EXECINSTR 0x4 134 #define SHF_TLS 0x400 135 #define SHF_MASKPROC 0xf0000000 149 136 150 137 /** Macros for decomposing elf_symbol.st_info into binging and type */ 151 #define ELF_ST_BIND(i) ((i) >> 4)152 #define ELF_ST_TYPE(i) ((i) & 0x0f)153 #define ELF_ST_INFO(b, t) (((b) << 4) + ((t) & 0x0f))138 #define ELF_ST_BIND(i) ((i) >> 4) 139 #define ELF_ST_TYPE(i) ((i) & 0x0f) 140 #define ELF_ST_INFO(b, t) (((b) << 4) + ((t) & 0x0f)) 154 141 155 142 /** 156 143 * Symbol binding 157 144 */ 158 #define STB_LOCAL 0159 #define STB_GLOBAL 1160 #define STB_WEAK 2161 #define STB_LOPROC 13162 #define STB_HIPROC 15145 #define STB_LOCAL 0 146 #define STB_GLOBAL 1 147 #define STB_WEAK 2 148 #define STB_LOPROC 13 149 #define STB_HIPROC 15 163 150 164 151 /** 165 152 * Symbol types 166 153 */ 167 #define STT_NOTYPE 0168 #define STT_OBJECT 1169 #define STT_FUNC 2170 #define STT_SECTION 3171 #define STT_FILE 4172 #define STT_LOPROC 13173 #define STT_HIPROC 15154 #define STT_NOTYPE 0 155 #define STT_OBJECT 1 156 #define STT_FUNC 2 157 #define STT_SECTION 3 158 #define STT_FILE 4 159 #define STT_LOPROC 13 160 #define STT_HIPROC 15 174 161 175 162 /** 176 163 * Program segment types 177 164 */ 178 #define PT_NULL 0179 #define PT_LOAD 1180 #define PT_DYNAMIC 2181 #define PT_INTERP 3182 #define PT_NOTE 4183 #define PT_SHLIB 5184 #define PT_PHDR 6185 #define PT_LOPROC 0x70000000186 #define PT_HIPROC 0x7fffffff165 #define PT_NULL 0 166 #define PT_LOAD 1 167 #define PT_DYNAMIC 2 168 #define PT_INTERP 3 169 #define PT_NOTE 4 170 #define PT_SHLIB 5 171 #define PT_PHDR 6 172 #define PT_LOPROC 0x70000000 173 #define PT_HIPROC 0x7fffffff 187 174 188 175 /** 189 176 * Program segment attributes. 190 177 */ 191 #define PF_X 1192 #define PF_W 2193 #define PF_R 4178 #define PF_X 1 179 #define PF_W 2 180 #define PF_R 4 194 181 195 182 /** … … 239 226 elf_half e_shstrndx; 240 227 }; 228 241 229 struct elf64_header { 242 230 uint8_t e_ident[EI_NIDENT]; … … 256 244 }; 257 245 258 /* 246 /** 259 247 * ELF segment header. 260 248 * Segments headers are also known as program headers. … … 270 258 elf_word p_align; 271 259 }; 260 272 261 struct elf64_segment_header { 273 262 elf_word p_type; … … 281 270 }; 282 271 283 /* 272 /** 284 273 * ELF section header 285 274 */ … … 296 285 elf_word sh_entsize; 297 286 }; 287 298 288 struct elf64_section_header { 299 289 elf_word sh_name; … … 309 299 }; 310 300 311 /* 301 /** 312 302 * ELF symbol table entry 313 303 */ … … 320 310 elf_half st_shndx; 321 311 }; 312 322 313 struct elf64_symbol { 323 314 elf_word st_name; … … 329 320 }; 330 321 331 #ifdef __32_BITS__ 322 /* 323 * ELF note segment entry 324 */ 325 struct elf32_note { 326 elf_word namesz; 327 elf_word descsz; 328 elf_word type; 329 }; 330 331 /* 332 * NOTE: namesz, descsz and type should be 64-bits wide (elf_xword) 333 * per the 64-bit ELF spec. The Linux kernel however screws up and 334 * defines them as Elf64_Word, which is 32-bits wide(!). We are trying 335 * to make our core files compatible with Linux GDB target so we copy 336 * the blunder here. 337 */ 338 struct elf64_note { 339 elf_word namesz; 340 elf_word descsz; 341 elf_word type; 342 }; 343 344 #ifdef __32_BITS__ 332 345 typedef struct elf32_header elf_header_t; 333 346 typedef struct elf32_segment_header elf_segment_header_t; 334 347 typedef struct elf32_section_header elf_section_header_t; 335 348 typedef struct elf32_symbol elf_symbol_t; 349 typedef struct elf32_note elf_note_t; 336 350 #endif 351 337 352 #ifdef __64_BITS__ 338 353 typedef struct elf64_header elf_header_t; … … 340 355 typedef struct elf64_section_header elf_section_header_t; 341 356 typedef struct elf64_symbol elf_symbol_t; 357 typedef struct elf64_note elf_note_t; 342 358 #endif 343 359 344 extern char *elf_error(unsigned int rc);345 346 360 #endif 347 361
Note:
See TracChangeset
for help on using the changeset viewer.
