1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COURGETTE_TYPES_ELF_H_
6 #define COURGETTE_TYPES_ELF_H_
11 // This header defines various types from the ELF file spec, but no code
12 // related to using them.
15 typedef uint32_t Elf32_Addr; // Unsigned program address
16 typedef uint16_t Elf32_Half; // Unsigned medium integer
17 typedef uint32_t Elf32_Off; // Unsigned file offset
18 typedef int32_t Elf32_Sword; // Signed large integer
19 typedef uint32_t Elf32_Word; // Unsigned large integer
21 // The header at the top of the file
23 unsigned char e_ident[16];
32 Elf32_Half e_phentsize;
34 Elf32_Half e_shentsize;
36 Elf32_Half e_shstrndx;
39 // Indexes for header->e_ident[].
40 enum e_ident_indexes {
41 EI_MAG0 = 0, // File identification.
42 EI_MAG1 = 1, // File identification.
43 EI_MAG2 = 2, // File identification.
44 EI_MAG3 = 3, // File identification.
45 EI_CLASS = 4, // File class.
46 EI_DATA = 5, // Data encoding.
47 EI_VERSION = 6, // File version.
48 EI_OSABI = 7, // Operating system/ABI identification.
49 EI_ABIVERSION = 8, // ABI version.
50 EI_PAD = 9, // Start of padding bytes.
51 EI_NIDENT = 16 // Size of e_ident[].
54 // Values for header->e_ident[EI_CLASS].
55 enum e_ident_class_values {
56 ELFCLASSNONE = 0, // Invalid class.
57 ELFCLASS32 = 1, // 32-bit objects.
58 ELFCLASS64 = 2 // 64-bit objects.
61 // Values for header->e_ident[EI_DATA].
62 enum e_ident_data_values {
63 ELFDATANONE = 0, // Unknown data format.
64 ELFDATA2LSB = 1, // Two's complement, little-endian.
65 ELFDATA2MSB = 2, // Two's complement, big-endian.
68 // values for header->e_type
70 ET_NONE = 0, // No file type
71 ET_REL = 1, // Relocatable file
72 ET_EXEC = 2, // Executable file
73 ET_DYN = 3, // Shared object file
74 ET_CORE = 4, // Core file
75 ET_LOPROC = 0xff00, // Processor-specific
76 ET_HIPROC = 0xfff // Processor-specific
79 // values for header->e_machine
80 enum e_machine_values {
81 EM_NONE = 0, // No machine
82 EM_386 = 3, // Intel Architecture
83 EM_ARM = 40, // ARM Architecture
84 EM_x86_64 = 62, // Intel x86-64 Architecture
85 // Other values skipped
88 enum { SHN_UNDEF = 0 };
90 // A section header in the section header table
100 Elf32_Word sh_addralign;
101 Elf32_Word sh_entsize;
104 // Values for the section type field in a section header
105 enum sh_type_values {
120 SHT_LOPROC = 0x70000000,
121 SHT_HIPROC = 0x7fffffff,
122 SHT_LOUSER = 0x80000000,
123 SHT_HIUSER = 0xffffffff,
137 // Values for the segment type field in a program segment header
138 enum ph_type_values {
146 PT_LOPROC = 0x70000000,
147 PT_HIPROC = 0x7fffffff
158 Elf32_Sword r_addend;
161 enum elf32_rel_386_type_values {
173 R_386_TLS_TPOFF = 14,
176 #endif // COURGETTE_TYPES_ELF_H_