[M108 Migration][HBBTV] Implement ewk_context_register_jsplugin_mime_types API
[platform/framework/web/chromium-efl.git] / courgette / types_elf.h
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.
4
5 #ifndef COURGETTE_TYPES_ELF_H_
6 #define COURGETTE_TYPES_ELF_H_
7
8 #include <stdint.h>
9
10 //
11 // This header defines various types from the ELF file spec, but no code
12 // related to using them.
13 //
14
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
20
21 // The header at the top of the file
22 struct Elf32_Ehdr {
23   unsigned char  e_ident[16];
24   Elf32_Half     e_type;
25   Elf32_Half     e_machine;
26   Elf32_Word     e_version;
27   Elf32_Addr     e_entry;
28   Elf32_Off      e_phoff;
29   Elf32_Off      e_shoff;
30   Elf32_Word     e_flags;
31   Elf32_Half     e_ehsize;
32   Elf32_Half     e_phentsize;
33   Elf32_Half     e_phnum;
34   Elf32_Half     e_shentsize;
35   Elf32_Half     e_shnum;
36   Elf32_Half     e_shstrndx;
37 };
38
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[].
52 };
53
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.
59 };
60
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.
66 };
67
68 // values for header->e_type
69 enum e_type_values {
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
77 };
78
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
86 };
87
88 enum { SHN_UNDEF = 0 };
89
90 // A section header in the section header table
91 struct Elf32_Shdr {
92   Elf32_Word   sh_name;
93   Elf32_Word   sh_type;
94   Elf32_Word   sh_flags;
95   Elf32_Addr   sh_addr;
96   Elf32_Off    sh_offset;
97   Elf32_Word   sh_size;
98   Elf32_Word   sh_link;
99   Elf32_Word   sh_info;
100   Elf32_Word   sh_addralign;
101   Elf32_Word   sh_entsize;
102 };
103
104 // Values for the section type field in a section header
105 enum sh_type_values {
106   SHT_NULL = 0,
107   SHT_PROGBITS = 1,
108   SHT_SYMTAB = 2,
109   SHT_STRTAB = 3,
110   SHT_RELA = 4,
111   SHT_HASH = 5,
112   SHT_DYNAMIC = 6,
113   SHT_NOTE = 7,
114   SHT_NOBITS = 8,
115   SHT_REL = 9,
116   SHT_SHLIB = 10,
117   SHT_DYNSYM = 11,
118   SHT_INIT_ARRAY = 14,
119   SHT_FINI_ARRAY = 15,
120   SHT_LOPROC = 0x70000000,
121   SHT_HIPROC = 0x7fffffff,
122   SHT_LOUSER = 0x80000000,
123   SHT_HIUSER = 0xffffffff,
124 };
125
126 struct Elf32_Phdr {
127   Elf32_Word    p_type;
128   Elf32_Off     p_offset;
129   Elf32_Addr    p_vaddr;
130   Elf32_Addr    p_paddr;
131   Elf32_Word    p_filesz;
132   Elf32_Word    p_memsz;
133   Elf32_Word    p_flags;
134   Elf32_Word    p_align;
135 };
136
137 // Values for the segment type field in a program segment header
138 enum ph_type_values {
139   PT_NULL = 0,
140   PT_LOAD = 1,
141   PT_DYNAMIC = 2,
142   PT_INTERP = 3,
143   PT_NOTE = 4,
144   PT_SHLIB = 5,
145   PT_PHDR = 6,
146   PT_LOPROC = 0x70000000,
147   PT_HIPROC = 0x7fffffff
148 };
149
150 struct Elf32_Rel {
151   Elf32_Addr    r_offset;
152   Elf32_Word    r_info;
153 };
154
155 struct Elf32_Rela {
156   Elf32_Addr    r_offset;
157   Elf32_Word    r_info;
158   Elf32_Sword   r_addend;
159 };
160
161 enum elf32_rel_386_type_values {
162   R_386_NONE = 0,
163   R_386_32 = 1,
164   R_386_PC32 = 2,
165   R_386_GOT32 = 3,
166   R_386_PLT32 = 4,
167   R_386_COPY = 5,
168   R_386_GLOB_DAT = 6,
169   R_386_JMP_SLOT = 7,
170   R_386_RELATIVE = 8,
171   R_386_GOTOFF = 9,
172   R_386_GOTPC = 10,
173   R_386_TLS_TPOFF = 14,
174 };
175
176 #endif  // COURGETTE_TYPES_ELF_H_