VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/7.0/xorg/elf.h@ 18709

Last change on this file since 18709 was 17236, checked in by vboxsync, 16 years ago

Additions/x11/x11include: blast! Reverted r43555 and r43556

  • Property svn:eol-style set to native
File size: 20.9 KB
Line 
1/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.16 2003/06/12 14:12:34 eich Exp $ */
2
3typedef unsigned int Elf32_Addr;
4typedef unsigned short Elf32_Half;
5typedef unsigned int Elf32_Off;
6typedef long Elf32_Sword;
7typedef unsigned int Elf32_Word;
8
9typedef unsigned long Elf64_Addr;
10typedef unsigned short Elf64_Half;
11typedef unsigned long Elf64_Off;
12typedef int Elf64_Sword;
13typedef unsigned int Elf64_Word;
14typedef unsigned long Elf64_Xword;
15typedef long Elf64_Sxword;
16
17/* These constants are for the segment types stored in the image headers */
18#define PT_NULL 0
19#define PT_LOAD 1
20#define PT_DYNAMIC 2
21#define PT_INTERP 3
22#define PT_NOTE 4
23#define PT_SHLIB 5
24#define PT_PHDR 6
25#define PT_LOPROC 0x70000000
26#define PT_HIPROC 0x7fffffff
27
28/* These constants define the different elf file types */
29#define ET_NONE 0
30#define ET_REL 1
31#define ET_EXEC 2
32#define ET_DYN 3
33#define ET_CORE 4
34#define ET_LOPROC 5
35#define ET_HIPROC 6
36
37/* These constants define the various ELF target machines */
38#define EM_NONE 0
39#define EM_M32 1
40#define EM_SPARC 2
41#define EM_386 3
42#define EM_68K 4
43#define EM_88K 5
44#define EM_486 6 /* Perhaps disused */
45#define EM_860 7
46#define EM_MIPS 8
47#define EM_MIPS_RS4_BE 10
48#define EM_PARISC 15
49#define EM_SPARC32PLUS 18
50#define EM_PPC 20
51#define EM_SPARCV9 43
52#define EM_IA_64 50
53#define EM_ALPHA 0x9026
54
55/* This is the info that is needed to parse the dynamic section of the file */
56#define DT_NULL 0
57#define DT_NEEDED 1
58#define DT_PLTRELSZ 2
59#define DT_PLTGOT 3
60#define DT_HASH 4
61#define DT_STRTAB 5
62#define DT_SYMTAB 6
63#define DT_RELA 7
64#define DT_RELASZ 8
65#define DT_RELAENT 9
66#define DT_STRSZ 10
67#define DT_SYMENT 11
68#define DT_INIT 12
69#define DT_FINI 13
70#define DT_SONAME 14
71#define DT_RPATH 15
72#define DT_SYMBOLIC 16
73#define DT_REL 17
74#define DT_RELSZ 18
75#define DT_RELENT 19
76#define DT_PLTREL 20
77#define DT_DEBUG 21
78#define DT_TEXTREL 22
79#define DT_JMPREL 23
80#define DT_LOPROC 0x70000000
81#define DT_HIPROC 0x7fffffff
82
83/* This info is needed when parsing the symbol table */
84#define STB_LOCAL 0
85#define STB_GLOBAL 1
86#define STB_WEAK 2
87
88#define STT_NOTYPE 0
89#define STT_OBJECT 1
90#define STT_FUNC 2
91#define STT_SECTION 3
92#define STT_FILE 4
93#define STT_LOPROC 13
94#define STT_HIPROC 15
95
96#define ELF32_ST_BIND(x) ((x) >> 4)
97#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
98
99#define ELF64_ST_BIND(x) ELF32_ST_BIND (x)
100#define ELF64_ST_TYPE(x) ELF32_ST_TYPE (x)
101
102typedef struct dynamic32 {
103 Elf32_Sword d_tag;
104 union {
105 Elf32_Sword d_val;
106 Elf32_Addr d_ptr;
107 } d_un;
108} Elf32_Dyn;
109
110typedef struct dynamic64 {
111 Elf64_Sxword d_tag;
112 union {
113 Elf64_Xword d_val;
114 Elf64_Addr d_ptr;
115 } d_un;
116} Elf64_Dyn;
117
118#ifdef HAVE_XORG_CONFIG_H
119#include <xorg-config.h>
120#endif
121
122#ifndef QNX4
123extern Elf32_Dyn _DYNAMIC[];
124#endif
125
126/* The following are used with relocations */
127#define ELF32_R_SYM(x) ((x) >> 8)
128#define ELF32_R_TYPE(x) ((x) & 0xff)
129
130#define ELF64_R_SYM(x) ((x) >> 32)
131#define ELF64_R_TYPE(x) ((x) & 0xffffffff)
132
133/* x86 Relocation Types */
134#define R_386_NONE 0
135#define R_386_32 1
136#define R_386_PC32 2
137#define R_386_GOT32 3
138#define R_386_PLT32 4
139#define R_386_COPY 5
140#define R_386_GLOB_DAT 6
141#define R_386_JMP_SLOT 7
142#define R_386_RELATIVE 8
143#define R_386_GOTOFF 9
144#define R_386_GOTPC 10
145#define R_386_NUM 11
146
147/* AMD64 Relocation Types */
148#define R_X86_64_NONE 0
149#define R_X86_64_64 1
150#define R_X86_64_PC32 2
151#define R_X86_64_GOT32 3
152#define R_X86_64_PLT32 4
153#define R_X86_64_COPY 5
154#define R_X86_64_GLOB_DAT 6
155#define R_X86_64_JUMP_SLOT 7
156#define R_X86_64_RELATIVE 8
157#define R_X86_64_GOTPCREL 9
158#define R_X86_64_32 10
159#define R_X86_64_32S 11
160#define R_X86_64_16 12
161#define R_X86_64_PC16 13
162#define R_X86_64_8 14
163#define R_X86_64_PC8 15
164#define R_X86_64_GNU_VTINHERIT 250
165#define R_X86_64_GNU_VTENTRY 251
166
167/* sparc Relocation Types */
168#define R_SPARC_NONE 0
169#define R_SPARC_8 1
170#define R_SPARC_16 2
171#define R_SPARC_32 3
172#define R_SPARC_DISP8 4
173#define R_SPARC_DISP16 5
174#define R_SPARC_DISP32 6
175#define R_SPARC_WDISP30 7
176#define R_SPARC_WDISP22 8
177#define R_SPARC_HI22 9
178#define R_SPARC_22 10
179#define R_SPARC_13 11
180#define R_SPARC_LO10 12
181#define R_SPARC_GOT10 13
182#define R_SPARC_GOT13 14
183#define R_SPARC_GOT22 15
184#define R_SPARC_PC10 16
185#define R_SPARC_PC22 17
186#define R_SPARC_WPLT30 18
187#define R_SPARC_COPY 19
188#define R_SPARC_GLOB_DAT 20
189#define R_SPARC_JMP_SLOT 21
190#define R_SPARC_RELATIVE 22
191#define R_SPARC_UA32 23
192#define R_SPARC_PLT32 24
193#define R_SPARC_HIPLT22 25
194#define R_SPARC_LOPLT10 26
195#define R_SPARC_PCPLT32 27
196#define R_SPARC_PCPLT22 28
197#define R_SPARC_PCPLT10 29
198#define R_SPARC_10 30
199#define R_SPARC_11 31
200#define R_SPARC_64 32
201#define R_SPARC_OLO10 33
202#define R_SPARC_HH22 34
203#define R_SPARC_HM10 35
204#define R_SPARC_LM22 36
205#define R_SPARC_PC_HH22 37
206#define R_SPARC_PC_HM10 38
207#define R_SPARC_PC_LM22 39
208#define R_SPARC_WDISP16 40
209#define R_SPARC_WDISP19 41
210#define R_SPARC_GLOB_JMP 42
211#define R_SPARC_7 43
212#define R_SPARC_5 44
213#define R_SPARC_6 45
214#define R_SPARC_DISP64 46
215#define R_SPARC_PLT64 47
216#define R_SPARC_HIX22 48
217#define R_SPARC_LOX10 49
218#define R_SPARC_H44 50
219#define R_SPARC_M44 51
220#define R_SPARC_L44 52
221#define R_SPARC_REGISTER 53
222#define R_SPARC_UA64 54
223#define R_SPARC_UA16 55
224#define R_SPARC_NUM 56
225
226/* m68k Relocation Types */
227#define R_68K_NONE 0 /* No reloc */
228#define R_68K_32 1 /* Direct 32 bit */
229#define R_68K_16 2 /* Direct 16 bit */
230#define R_68K_8 3 /* Direct 8 bit */
231#define R_68K_PC32 4 /* PC relative 32 bit */
232#define R_68K_PC16 5 /* PC relative 16 bit */
233#define R_68K_PC8 6 /* PC relative 8 bit */
234#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
235#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
236#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
237#define R_68K_GOT32O 10 /* 32 bit GOT offset */
238#define R_68K_GOT16O 11 /* 16 bit GOT offset */
239#define R_68K_GOT8O 12 /* 8 bit GOT offset */
240#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
241#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
242#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
243#define R_68K_PLT32O 16 /* 32 bit PLT offset */
244#define R_68K_PLT16O 17 /* 16 bit PLT offset */
245#define R_68K_PLT8O 18 /* 8 bit PLT offset */
246#define R_68K_COPY 19 /* Copy symbol at runtime */
247#define R_68K_GLOB_DAT 20 /* Create GOT entry */
248#define R_68K_JMP_SLOT 21 /* Create PLT entry */
249#define R_68K_RELATIVE 22 /* Adjust by program base */
250
251/* Alpha Relocation Types */
252#define R_ALPHA_NONE 0 /* No reloc */
253#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
254#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
255#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
256#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
257#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
258#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
259#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
260#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
261#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
262#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
263#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
264#define R_ALPHA_OP_PUSH 12 /* OP stack push */
265#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */
266#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */
267#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */
268#define R_ALPHA_GPVALUE 16
269#define R_ALPHA_GPRELHIGH 17
270#define R_ALPHA_GPRELLOW 18
271#define R_ALPHA_GPREL16 19
272#define R_ALPHA_IMMED_GP_HI32 20
273#define R_ALPHA_IMMED_SCN_HI32 21
274#define R_ALPHA_IMMED_BR_HI32 22
275#define R_ALPHA_IMMED_LO32 23
276#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
277#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
278#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
279#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
280#define R_ALPHA_BRSGP 28 /* Calc displacement for BRS */
281
282/* IA-64 relocations. */
283#define R_IA64_NONE 0x00 /* none */
284#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */
285#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */
286#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */
287#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */
288#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */
289#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */
290#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */
291#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */
292#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */
293#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */
294#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */
295#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */
296#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */
297#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */
298#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */
299#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */
300#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */
301#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */
302#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */
303#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */
304#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */
305#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */
306#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */
307#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */
308#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */
309#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */
310#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */
311#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */
312#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */
313#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */
314#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */
315#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */
316#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */
317#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */
318#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */
319#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */
320#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */
321#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */
322#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */
323#define R_IA64_REL32MSB 0x6c /* data 4 + REL */
324#define R_IA64_REL32LSB 0x6d /* data 4 + REL */
325#define R_IA64_REL64MSB 0x6e /* data 8 + REL */
326#define R_IA64_REL64LSB 0x6f /* data 8 + REL */
327#define R_IA64_LTV32MSB 0x70 /* symbol + addend, data4 MSB */
328#define R_IA64_LTV32LSB 0x71 /* symbol + addend, data4 LSB */
329#define R_IA64_LTV64MSB 0x72 /* symbol + addend, data8 MSB */
330#define R_IA64_LTV64LSB 0x73 /* symbol + addend, data8 LSB */
331#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */
332#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */
333#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */
334#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */
335
336#define R_IA64_TYPE(R) ((R) & -8)
337#define R_IA64_FORMAT(R) ((R) & 7)
338
339/*
340 * Apparantly, Linux and PowerMAXOS use different version of ELF as the
341 * Relocation types are very different.
342 */
343#if defined(PowerMAX_OS)
344/* PPC Relocation Types */
345#define R_PPC_NONE 0
346#define R_PPC_COPY 1
347#define R_PPC_GOTP_ENT 2
348#define R_PPC_8 4
349#define R_PPC_8S 5
350#define R_PPC_16S 7
351#define R_PPC_14 8
352#define R_PPC_DISP14 9
353#define R_PPC_24 10
354#define R_PPC_DISP24 11
355#define R_PPC_PLT_DISP24 14
356#define R_PPC_BBASED_16HU 15
357#define R_PPC_BBASED_32 16
358#define R_PPC_BBASED_32UA 17
359#define R_PPC_BBASED_16H 18
360#define R_PPC_BBASED_16L 19
361#define R_PPC_ABDIFF_16HU 23
362#define R_PPC_ABDIFF_32 24
363#define R_PPC_ABDIFF_32UA 25
364#define R_PPC_ABDIFF_16H 26
365#define R_PPC_ABDIFF_16L 27
366#define R_PPC_ABDIFF_16 28
367#define R_PPC_16HU 31
368#define R_PPC_32 32
369#define R_PPC_32UA 33
370#define R_PPC_16H 34
371#define R_PPC_16L 35
372#define R_PPC_16 36
373#define R_PPC_GOT_16HU 39
374#define R_PPC_GOT_32 40
375#define R_PPC_GOT_32UA 41
376#define R_PPC_GOT_16H 42
377#define R_PPC_GOT_16L 43
378#define R_PPC_GOT_16 44
379#define R_PPC_GOTP_16HU 47
380#define R_PPC_GOTP_32 48
381#define R_PPC_GOTP_32UA 49
382#define R_PPC_GOTP_16H 50
383#define R_PPC_GOTP_16L 51
384#define R_PPC_GOTP_16 52
385#define R_PPC_PLT_16HU 55
386#define R_PPC_PLT_32 56
387#define R_PPC_PLT_32UA 57
388#define R_PPC_PLT_16H 58
389#define R_PPC_PLT_16L 59
390#define R_PPC_PLT_16 60
391#define R_PPC_ABREL_16HU 63
392#define R_PPC_ABREL_32 64
393#define R_PPC_ABREL_32UA 65
394#define R_PPC_ABREL_16H 66
395#define R_PPC_ABREL_16L 67
396#define R_PPC_ABREL_16 68
397#define R_PPC_GOT_ABREL_16HU 71
398#define R_PPC_GOT_ABREL_32 72
399#define R_PPC_GOT_ABREL_32UA 73
400#define R_PPC_GOT_ABREL_16H 74
401#define R_PPC_GOT_ABREL_16L 75
402#define R_PPC_GOT_ABREL_16 76
403#define R_PPC_GOTP_ABREL_16HU 79
404#define R_PPC_GOTP_ABREL_32 80
405#define R_PPC_GOTP_ABREL_32UA 81
406#define R_PPC_GOTP_ABREL_16H 82
407#define R_PPC_GOTP_ABREL_16L 83
408#define R_PPC_GOTP_ABREL_16 84
409#define R_PPC_PLT_ABREL_16HU 87
410#define R_PPC_PLT_ABREL_32 88
411#define R_PPC_PLT_ABREL_32UA 89
412#define R_PPC_PLT_ABREL_16H 90
413#define R_PPC_PLT_ABREL_16L 91
414#define R_PPC_PLT_ABREL_16 92
415#define R_PPC_SREL_16HU 95
416#define R_PPC_SREL_32 96
417#define R_PPC_SREL_32UA 97
418#define R_PPC_SREL_16H 98
419#define R_PPC_SREL_16L 99
420#else
421/*
422 * The Linux version
423 */
424#define R_PPC_NONE 0
425#define R_PPC_ADDR32 1
426#define R_PPC_ADDR24 2
427#define R_PPC_ADDR16 3
428#define R_PPC_ADDR16_LO 4
429#define R_PPC_ADDR16_HI 5
430#define R_PPC_ADDR16_HA 6
431#define R_PPC_ADDR14 7
432#define R_PPC_ADDR14_BRTAKEN 8
433#define R_PPC_ADDR14_BRNTAKEN 9
434#define R_PPC_REL24 10
435#define R_PPC_REL14 11
436#define R_PPC_REL14_BRTAKEN 12
437#define R_PPC_REL14_BRNTAKEN 13
438#define R_PPC_GOT16 14
439#define R_PPC_GOT16_LO 15
440#define R_PPC_GOT16_HI 16
441#define R_PPC_GOT16_HA 17
442#define R_PPC_PLTREL24 18
443#define R_PPC_COPY 19
444#define R_PPC_GLOB_DAT 20
445#define R_PPC_JMP_SLOT 21
446#define R_PPC_RELATIVE 22
447#define R_PPC_LOCAL24PC 23
448#define R_PPC_UADDR32 24
449#define R_PPC_UADDR16 25
450#define R_PPC_REL32 26
451#define R_PPC_PLT32 27
452#define R_PPC_PLTREL32 28
453#define R_PPC_PLT16_LO 29
454#define R_PPC_PLT16_HI 30
455#define R_PPC_PLT16_HA 31
456#define R_PPC_SDAREL16 32
457#define R_PPC_SECTOFF 33
458#define R_PPC_SECTOFF_LO 34
459#define R_PPC_SECTOFF_HI 35
460#define R_PPC_SECTOFF_HA 36
461#endif
462
463/* ARM relocs. */
464#define R_ARM_NONE 0 /* No reloc */
465#define R_ARM_PC24 1 /* PC relative 26 bit branch */
466#define R_ARM_ABS32 2 /* Direct 32 bit */
467#define R_ARM_REL32 3 /* PC relative 32 bit */
468#define R_ARM_PC13 4
469#define R_ARM_ABS16 5 /* Direct 16 bit */
470#define R_ARM_ABS12 6 /* Direct 12 bit */
471#define R_ARM_THM_ABS5 7
472#define R_ARM_ABS8 8 /* Direct 8 bit */
473#define R_ARM_SBREL32 9
474#define R_ARM_THM_PC22 10
475#define R_ARM_THM_PC8 11
476#define R_ARM_AMP_VCALL9 12
477#define R_ARM_SWI24 13
478#define R_ARM_THM_SWI8 14
479#define R_ARM_XPC25 15
480#define R_ARM_THM_XPC22 16
481#define R_ARM_COPY 20 /* Copy symbol at runtime */
482#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
483#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
484#define R_ARM_RELATIVE 23 /* Adjust by program base */
485#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */
486#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */
487#define R_ARM_GOT32 26 /* 32 bit GOT entry */
488#define R_ARM_PLT32 27 /* 32 bit PLT address */
489#define R_ARM_GNU_VTENTRY 100
490#define R_ARM_GNU_VTINHERIT 101
491#define R_ARM_THM_PC11 102 /* thumb unconditional branch */
492#define R_ARM_THM_PC9 103 /* thumb conditional branch */
493#define R_ARM_RXPC25 249
494#define R_ARM_RSBREL32 250
495#define R_ARM_THM_RPC22 251
496#define R_ARM_RREL32 252
497#define R_ARM_RABS22 253
498#define R_ARM_RPC24 254
499#define R_ARM_RBASE 255
500
501typedef struct elf32_rel {
502 Elf32_Addr r_offset;
503 Elf32_Word r_info;
504} Elf32_Rel;
505
506typedef struct elf64_rel {
507 Elf64_Addr r_offset;
508 Elf64_Xword r_info;
509} Elf64_Rel;
510
511typedef struct elf32_rela {
512 Elf32_Addr r_offset;
513 Elf32_Word r_info;
514 Elf32_Sword r_addend;
515} Elf32_Rela;
516
517typedef struct elf64_rela {
518 Elf64_Addr r_offset;
519 Elf64_Xword r_info;
520 Elf64_Sxword r_addend;
521} Elf64_Rela;
522
523typedef struct elf32_sym {
524 Elf32_Word st_name;
525 Elf32_Addr st_value;
526 Elf32_Word st_size;
527 unsigned char st_info;
528 unsigned char st_other;
529 Elf32_Half st_shndx;
530} Elf32_Sym;
531
532typedef struct elf64_sym {
533 Elf64_Word st_name;
534 unsigned char st_info;
535 unsigned char st_other;
536 Elf64_Half st_shndx;
537 Elf64_Addr st_value;
538 Elf64_Xword st_size;
539} Elf64_Sym;
540
541#define EI_NIDENT 16
542
543typedef struct elf32hdr {
544 unsigned char e_ident[EI_NIDENT];
545 Elf32_Half e_type;
546 Elf32_Half e_machine;
547 Elf32_Word e_version;
548 Elf32_Addr e_entry; /* Entry point */
549 Elf32_Off e_phoff;
550 Elf32_Off e_shoff;
551 Elf32_Word e_flags;
552 Elf32_Half e_ehsize;
553 Elf32_Half e_phentsize;
554 Elf32_Half e_phnum;
555 Elf32_Half e_shentsize;
556 Elf32_Half e_shnum;
557 Elf32_Half e_shstrndx;
558} Elf32_Ehdr;
559
560typedef struct elf64hdr {
561 unsigned char e_ident[EI_NIDENT];
562 Elf64_Half e_type;
563 Elf64_Half e_machine;
564 Elf64_Word e_version;
565 Elf64_Addr e_entry;
566 Elf64_Off e_phoff;
567 Elf64_Off e_shoff;
568 Elf64_Word e_flags;
569 Elf64_Half e_ehsize;
570 Elf64_Half e_phentsize;
571 Elf64_Half e_phnum;
572 Elf64_Half e_shentsize;
573 Elf64_Half e_shnum;
574 Elf64_Half e_shstrndx;
575} Elf64_Ehdr;
576
577/* These constants define the permissions on sections in the program
578 header, p_flags. */
579#define PF_R 0x4
580#define PF_W 0x2
581#define PF_X 0x1
582
583typedef struct elf_phdr {
584 Elf32_Word p_type;
585 Elf32_Off p_offset;
586 Elf32_Addr p_vaddr;
587 Elf32_Addr p_paddr;
588 Elf32_Word p_filesz;
589 Elf32_Word p_memsz;
590 Elf32_Word p_flags;
591 Elf32_Word p_align;
592} Elf32_Phdr;
593
594typedef struct {
595 Elf64_Word p_type;
596 Elf64_Word p_flags;
597 Elf64_Off p_offset;
598 Elf64_Addr p_vaddr;
599 Elf64_Addr p_paddr;
600 Elf64_Xword p_filesz;
601 Elf64_Xword p_memsz;
602 Elf64_Xword p_align;
603} Elf64_Phdr;
604
605/* sh_type */
606#define SHT_NULL 0
607#define SHT_PROGBITS 1
608#define SHT_SYMTAB 2
609#define SHT_STRTAB 3
610#define SHT_RELA 4
611#define SHT_HASH 5
612#define SHT_DYNAMIC 6
613#define SHT_NOTE 7
614#define SHT_NOBITS 8
615#define SHT_REL 9
616#define SHT_SHLIB 10
617#define SHT_DYNSYM 11
618#define SHT_NUM 12
619#define SHT_LOPROC 0x70000000
620#define SHT_HIPROC 0x7fffffff
621#define SHT_LOUSER 0x80000000
622#define SHT_HIUSER 0xffffffff
623
624#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */
625
626/* sh_flags */
627#define SHF_WRITE 0x1
628#define SHF_ALLOC 0x2
629#define SHF_EXECINSTR 0x4
630#define SHF_MASKPROC 0xf0000000
631
632/* special section indexes */
633#define SHN_UNDEF 0
634#define SHN_LORESERVE 0xff00
635#define SHN_LOPROC 0xff00
636#define SHN_HIPROC 0xff1f
637#define SHN_ABS 0xfff1
638#define SHN_COMMON 0xfff2
639#define SHN_HIRESERVE 0xffff
640
641typedef struct {
642 Elf32_Word sh_name;
643 Elf32_Word sh_type;
644 Elf32_Word sh_flags;
645 Elf32_Addr sh_addr;
646 Elf32_Off sh_offset;
647 Elf32_Word sh_size;
648 Elf32_Word sh_link;
649 Elf32_Word sh_info;
650 Elf32_Word sh_addralign;
651 Elf32_Word sh_entsize;
652} Elf32_Shdr;
653
654typedef struct {
655 Elf64_Word sh_name;
656 Elf64_Word sh_type;
657 Elf64_Xword sh_flags;
658 Elf64_Addr sh_addr;
659 Elf64_Off sh_offset;
660 Elf64_Xword sh_size;
661 Elf64_Word sh_link;
662 Elf64_Word sh_info;
663 Elf64_Xword sh_addralign;
664 Elf64_Xword sh_entsize;
665} Elf64_Shdr;
666
667#define EI_MAG0 0 /* e_ident[] indexes */
668#define EI_MAG1 1
669#define EI_MAG2 2
670#define EI_MAG3 3
671#define EI_CLASS 4
672#define EI_DATA 5
673#define EI_VERSION 6
674#define EI_PAD 7
675
676#define ELFMAG0 0x7f /* EI_MAG */
677#define ELFMAG1 'E'
678#define ELFMAG2 'L'
679#define ELFMAG3 'F'
680#define ELFMAG "\177ELF"
681#define SELFMAG 4
682
683#define ELFDLMAG 3
684#define ELFDLOFF 16
685
686#define ELFCLASSNONE 0 /* EI_CLASS */
687#define ELFCLASS32 1
688#define ELFCLASS64 2
689#define ELFCLASSNUM 3
690
691#define ELFDATANONE 0 /* e_ident[EI_DATA] */
692#define ELFDATA2LSB 1
693#define ELFDATA2MSB 2
694
695#define EV_NONE 0 /* e_version, EI_VERSION */
696#define EV_CURRENT 1
697#define EV_NUM 2
698
699/* Notes used in ET_CORE */
700#define NT_PRSTATUS 1
701#define NT_PRFPREG 2
702#define NT_PRPSINFO 3
703#define NT_TASKSTRUCT 4
704
705/* Note header in a PT_NOTE section */
706typedef struct elf_note {
707 Elf32_Word n_namesz; /* Name size */
708 Elf32_Word n_descsz; /* Content size */
709 Elf32_Word n_type; /* Content type */
710} Elf32_Nhdr;
711
712#define ELF_START_MMAP 0x80000000
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette