direct-io.hg

view xen/include/xen/elf.h @ 4349:baa05afd394f

bitkeeper revision 1.1236.1.138 (4244ed89pK9JAW8qk2zpDrj3rXVcow)

Add PPC64 to the Elf architecture enumeration.
author kaf24@firebug.cl.cam.ac.uk
date Fri Mar 25 23:44:15 2005 +0000 (2005-03-25)
parents 0a4b76b6b5a0
children ccf5f154c35d
line source
1 /*
2 * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
27 #ifndef __XEN_ELF_H__
28 #define __XEN_ELF_H__
30 typedef u8 Elf_Byte;
32 typedef u32 Elf32_Addr; /* Unsigned program address */
33 typedef u32 Elf32_Off; /* Unsigned file offset */
34 typedef s32 Elf32_Sword; /* Signed large integer */
35 typedef u32 Elf32_Word; /* Unsigned large integer */
36 typedef u16 Elf32_Half; /* Unsigned medium integer */
38 typedef u64 Elf64_Addr;
39 typedef u64 Elf64_Off;
40 typedef s32 Elf64_Shalf;
42 typedef s32 Elf64_Sword;
43 typedef u32 Elf64_Word;
45 typedef s64 Elf64_Sxword;
46 typedef u64 Elf64_Xword;
48 typedef u32 Elf64_Half;
49 typedef u16 Elf64_Quarter;
51 /*
52 * e_ident[] identification indexes
53 * See http://www.caldera.com/developers/gabi/2000-07-17/ch4.eheader.html
54 */
55 #define EI_MAG0 0 /* file ID */
56 #define EI_MAG1 1 /* file ID */
57 #define EI_MAG2 2 /* file ID */
58 #define EI_MAG3 3 /* file ID */
59 #define EI_CLASS 4 /* file class */
60 #define EI_DATA 5 /* data encoding */
61 #define EI_VERSION 6 /* ELF header version */
62 #define EI_OSABI 7 /* OS/ABI ID */
63 #define EI_ABIVERSION 8 /* ABI version */
64 #define EI_PAD 9 /* start of pad bytes */
65 #define EI_NIDENT 16 /* Size of e_ident[] */
67 /* e_ident[] magic number */
68 #define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
69 #define ELFMAG1 'E' /* e_ident[EI_MAG1] */
70 #define ELFMAG2 'L' /* e_ident[EI_MAG2] */
71 #define ELFMAG3 'F' /* e_ident[EI_MAG3] */
72 #define ELFMAG "\177ELF" /* magic */
73 #define SELFMAG 4 /* size of magic */
75 /* e_ident[] file class */
76 #define ELFCLASSNONE 0 /* invalid */
77 #define ELFCLASS32 1 /* 32-bit objs */
78 #define ELFCLASS64 2 /* 64-bit objs */
79 #define ELFCLASSNUM 3 /* number of classes */
81 /* e_ident[] data encoding */
82 #define ELFDATANONE 0 /* invalid */
83 #define ELFDATA2LSB 1 /* Little-Endian */
84 #define ELFDATA2MSB 2 /* Big-Endian */
85 #define ELFDATANUM 3 /* number of data encode defines */
87 /* e_ident[] Operating System/ABI */
88 #define ELFOSABI_SYSV 0 /* UNIX System V ABI */
89 #define ELFOSABI_HPUX 1 /* HP-UX operating system */
90 #define ELFOSABI_NETBSD 2 /* NetBSD */
91 #define ELFOSABI_LINUX 3 /* GNU/Linux */
92 #define ELFOSABI_HURD 4 /* GNU/Hurd */
93 #define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */
94 #define ELFOSABI_SOLARIS 6 /* Solaris */
95 #define ELFOSABI_MONTEREY 7 /* Monterey */
96 #define ELFOSABI_IRIX 8 /* IRIX */
97 #define ELFOSABI_FREEBSD 9 /* FreeBSD */
98 #define ELFOSABI_TRU64 10 /* TRU64 UNIX */
99 #define ELFOSABI_MODESTO 11 /* Novell Modesto */
100 #define ELFOSABI_OPENBSD 12 /* OpenBSD */
101 #define ELFOSABI_ARM 97 /* ARM */
102 #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
104 /* e_ident */
105 #define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
106 (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
107 (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
108 (ehdr).e_ident[EI_MAG3] == ELFMAG3)
110 /* ELF Header */
111 typedef struct elfhdr {
112 unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
113 Elf32_Half e_type; /* object file type */
114 Elf32_Half e_machine; /* machine */
115 Elf32_Word e_version; /* object file version */
116 Elf32_Addr e_entry; /* virtual entry point */
117 Elf32_Off e_phoff; /* program header table offset */
118 Elf32_Off e_shoff; /* section header table offset */
119 Elf32_Word e_flags; /* processor-specific flags */
120 Elf32_Half e_ehsize; /* ELF header size */
121 Elf32_Half e_phentsize; /* program header entry size */
122 Elf32_Half e_phnum; /* number of program header entries */
123 Elf32_Half e_shentsize; /* section header entry size */
124 Elf32_Half e_shnum; /* number of section header entries */
125 Elf32_Half e_shstrndx; /* section header table's "section
126 header string table" entry offset */
127 } Elf32_Ehdr;
129 typedef struct {
130 unsigned char e_ident[EI_NIDENT]; /* Id bytes */
131 Elf64_Quarter e_type; /* file type */
132 Elf64_Quarter e_machine; /* machine type */
133 Elf64_Half e_version; /* version number */
134 Elf64_Addr e_entry; /* entry point */
135 Elf64_Off e_phoff; /* Program hdr offset */
136 Elf64_Off e_shoff; /* Section hdr offset */
137 Elf64_Half e_flags; /* Processor flags */
138 Elf64_Quarter e_ehsize; /* sizeof ehdr */
139 Elf64_Quarter e_phentsize; /* Program header entry size */
140 Elf64_Quarter e_phnum; /* Number of program headers */
141 Elf64_Quarter e_shentsize; /* Section header entry size */
142 Elf64_Quarter e_shnum; /* Number of section headers */
143 Elf64_Quarter e_shstrndx; /* String table index */
144 } Elf64_Ehdr;
146 /* e_type */
147 #define ET_NONE 0 /* No file type */
148 #define ET_REL 1 /* relocatable file */
149 #define ET_EXEC 2 /* executable file */
150 #define ET_DYN 3 /* shared object file */
151 #define ET_CORE 4 /* core file */
152 #define ET_NUM 5 /* number of types */
153 #define ET_LOPROC 0xff00 /* reserved range for processor */
154 #define ET_HIPROC 0xffff /* specific e_type */
156 /* e_machine */
157 #define EM_NONE 0 /* No Machine */
158 #define EM_M32 1 /* AT&T WE 32100 */
159 #define EM_SPARC 2 /* SPARC */
160 #define EM_386 3 /* Intel 80386 */
161 #define EM_68K 4 /* Motorola 68000 */
162 #define EM_88K 5 /* Motorola 88000 */
163 #define EM_486 6 /* Intel 80486 - unused? */
164 #define EM_860 7 /* Intel 80860 */
165 #define EM_MIPS 8 /* MIPS R3000 Big-Endian only */
166 /*
167 * Don't know if EM_MIPS_RS4_BE,
168 * EM_SPARC64, EM_PARISC,
169 * or EM_PPC are ABI compliant
170 */
171 #define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
172 #define EM_SPARC64 11 /* SPARC v9 64-bit unoffical */
173 #define EM_PARISC 15 /* HPPA */
174 #define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
175 #define EM_PPC 20 /* PowerPC */
176 #define EM_PPC64 21 /* PowerPC 64-bit */
177 #define EM_ARM 40 /* Advanced RISC Machines ARM */
178 #define EM_ALPHA 41 /* DEC ALPHA */
179 #define EM_SPARCV9 43 /* SPARC version 9 */
180 #define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */
181 #define EM_X86_64 62 /* AMD x86-64 architecture */
182 #define EM_VAX 75 /* DEC VAX */
183 #define EM_NUM 15 /* number of machine types */
185 /* Version */
186 #define EV_NONE 0 /* Invalid */
187 #define EV_CURRENT 1 /* Current */
188 #define EV_NUM 2 /* number of versions */
190 /* Section Header */
191 typedef struct {
192 Elf32_Word sh_name; /* name - index into section header
193 string table section */
194 Elf32_Word sh_type; /* type */
195 Elf32_Word sh_flags; /* flags */
196 Elf32_Addr sh_addr; /* address */
197 Elf32_Off sh_offset; /* file offset */
198 Elf32_Word sh_size; /* section size */
199 Elf32_Word sh_link; /* section header table index link */
200 Elf32_Word sh_info; /* extra information */
201 Elf32_Word sh_addralign; /* address alignment */
202 Elf32_Word sh_entsize; /* section entry size */
203 } Elf32_Shdr;
205 typedef struct {
206 Elf64_Half sh_name; /* section name */
207 Elf64_Half sh_type; /* section type */
208 Elf64_Xword sh_flags; /* section flags */
209 Elf64_Addr sh_addr; /* virtual address */
210 Elf64_Off sh_offset; /* file offset */
211 Elf64_Xword sh_size; /* section size */
212 Elf64_Half sh_link; /* link to another */
213 Elf64_Half sh_info; /* misc info */
214 Elf64_Xword sh_addralign; /* memory alignment */
215 Elf64_Xword sh_entsize; /* table entry size */
216 } Elf64_Shdr;
218 /* Special Section Indexes */
219 #define SHN_UNDEF 0 /* undefined */
220 #define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
221 #define SHN_LOPROC 0xff00 /* reserved range for processor */
222 #define SHN_HIPROC 0xff1f /* specific section indexes */
223 #define SHN_ABS 0xfff1 /* absolute value */
224 #define SHN_COMMON 0xfff2 /* common symbol */
225 #define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */
227 /* sh_type */
228 #define SHT_NULL 0 /* inactive */
229 #define SHT_PROGBITS 1 /* program defined information */
230 #define SHT_SYMTAB 2 /* symbol table section */
231 #define SHT_STRTAB 3 /* string table section */
232 #define SHT_RELA 4 /* relocation section with addends*/
233 #define SHT_HASH 5 /* symbol hash table section */
234 #define SHT_DYNAMIC 6 /* dynamic section */
235 #define SHT_NOTE 7 /* note section */
236 #define SHT_NOBITS 8 /* no space section */
237 #define SHT_REL 9 /* relation section without addends */
238 #define SHT_SHLIB 10 /* reserved - purpose unknown */
239 #define SHT_DYNSYM 11 /* dynamic symbol table section */
240 #define SHT_NUM 12 /* number of section types */
241 #define SHT_LOPROC 0x70000000 /* reserved range for processor */
242 #define SHT_HIPROC 0x7fffffff /* specific section header types */
243 #define SHT_LOUSER 0x80000000 /* reserved range for application */
244 #define SHT_HIUSER 0xffffffff /* specific indexes */
246 /* Section names */
247 #define ELF_BSS ".bss" /* uninitialized data */
248 #define ELF_DATA ".data" /* initialized data */
249 #define ELF_DEBUG ".debug" /* debug */
250 #define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
251 #define ELF_DYNSTR ".dynstr" /* dynamic string table */
252 #define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
253 #define ELF_FINI ".fini" /* termination code */
254 #define ELF_GOT ".got" /* global offset table */
255 #define ELF_HASH ".hash" /* symbol hash table */
256 #define ELF_INIT ".init" /* initialization code */
257 #define ELF_REL_DATA ".rel.data" /* relocation data */
258 #define ELF_REL_FINI ".rel.fini" /* relocation termination code */
259 #define ELF_REL_INIT ".rel.init" /* relocation initialization code */
260 #define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
261 #define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
262 #define ELF_REL_TEXT ".rel.text" /* relocation code */
263 #define ELF_RODATA ".rodata" /* read-only data */
264 #define ELF_SHSTRTAB ".shstrtab" /* section header string table */
265 #define ELF_STRTAB ".strtab" /* string table */
266 #define ELF_SYMTAB ".symtab" /* symbol table */
267 #define ELF_TEXT ".text" /* code */
270 /* Section Attribute Flags - sh_flags */
271 #define SHF_WRITE 0x1 /* Writable */
272 #define SHF_ALLOC 0x2 /* occupies memory */
273 #define SHF_EXECINSTR 0x4 /* executable */
274 #define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
275 /* specific section attributes */
277 /* Symbol Table Entry */
278 typedef struct elf32_sym {
279 Elf32_Word st_name; /* name - index into string table */
280 Elf32_Addr st_value; /* symbol value */
281 Elf32_Word st_size; /* symbol size */
282 unsigned char st_info; /* type and binding */
283 unsigned char st_other; /* 0 - no defined meaning */
284 Elf32_Half st_shndx; /* section header index */
285 } Elf32_Sym;
287 typedef struct {
288 Elf64_Half st_name; /* Symbol name index in str table */
289 Elf_Byte st_info; /* type / binding attrs */
290 Elf_Byte st_other; /* unused */
291 Elf64_Quarter st_shndx; /* section index of symbol */
292 Elf64_Xword st_value; /* value of symbol */
293 Elf64_Xword st_size; /* size of symbol */
294 } Elf64_Sym;
296 /* Symbol table index */
297 #define STN_UNDEF 0 /* undefined */
299 /* Extract symbol info - st_info */
300 #define ELF32_ST_BIND(x) ((x) >> 4)
301 #define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
302 #define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
304 #define ELF64_ST_BIND(x) ((x) >> 4)
305 #define ELF64_ST_TYPE(x) (((unsigned int) x) & 0xf)
306 #define ELF64_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
308 /* Symbol Binding - ELF32_ST_BIND - st_info */
309 #define STB_LOCAL 0 /* Local symbol */
310 #define STB_GLOBAL 1 /* Global symbol */
311 #define STB_WEAK 2 /* like global - lower precedence */
312 #define STB_NUM 3 /* number of symbol bindings */
313 #define STB_LOPROC 13 /* reserved range for processor */
314 #define STB_HIPROC 15 /* specific symbol bindings */
316 /* Symbol type - ELF32_ST_TYPE - st_info */
317 #define STT_NOTYPE 0 /* not specified */
318 #define STT_OBJECT 1 /* data object */
319 #define STT_FUNC 2 /* function */
320 #define STT_SECTION 3 /* section */
321 #define STT_FILE 4 /* file */
322 #define STT_NUM 5 /* number of symbol types */
323 #define STT_LOPROC 13 /* reserved range for processor */
324 #define STT_HIPROC 15 /* specific symbol types */
326 /* Relocation entry with implicit addend */
327 typedef struct {
328 Elf32_Addr r_offset; /* offset of relocation */
329 Elf32_Word r_info; /* symbol table index and type */
330 } Elf32_Rel;
332 /* Relocation entry with explicit addend */
333 typedef struct {
334 Elf32_Addr r_offset; /* offset of relocation */
335 Elf32_Word r_info; /* symbol table index and type */
336 Elf32_Sword r_addend;
337 } Elf32_Rela;
339 /* Extract relocation info - r_info */
340 #define ELF32_R_SYM(i) ((i) >> 8)
341 #define ELF32_R_TYPE(i) ((unsigned char) (i))
342 #define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
344 typedef struct {
345 Elf64_Xword r_offset; /* where to do it */
346 Elf64_Xword r_info; /* index & type of relocation */
347 } Elf64_Rel;
349 typedef struct {
350 Elf64_Xword r_offset; /* where to do it */
351 Elf64_Xword r_info; /* index & type of relocation */
352 Elf64_Sxword r_addend; /* adjustment value */
353 } Elf64_Rela;
355 #define ELF64_R_SYM(info) ((info) >> 32)
356 #define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF)
357 #define ELF64_R_INFO(s,t) (((s) << 32) + (u32)(t))
359 /* Program Header */
360 typedef struct {
361 Elf32_Word p_type; /* segment type */
362 Elf32_Off p_offset; /* segment offset */
363 Elf32_Addr p_vaddr; /* virtual address of segment */
364 Elf32_Addr p_paddr; /* physical address - ignored? */
365 Elf32_Word p_filesz; /* number of bytes in file for seg. */
366 Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
367 Elf32_Word p_flags; /* flags */
368 Elf32_Word p_align; /* memory alignment */
369 } Elf32_Phdr;
371 typedef struct {
372 Elf64_Half p_type; /* entry type */
373 Elf64_Half p_flags; /* flags */
374 Elf64_Off p_offset; /* offset */
375 Elf64_Addr p_vaddr; /* virtual address */
376 Elf64_Addr p_paddr; /* physical address */
377 Elf64_Xword p_filesz; /* file size */
378 Elf64_Xword p_memsz; /* memory size */
379 Elf64_Xword p_align; /* memory & file alignment */
380 } Elf64_Phdr;
382 /* Segment types - p_type */
383 #define PT_NULL 0 /* unused */
384 #define PT_LOAD 1 /* loadable segment */
385 #define PT_DYNAMIC 2 /* dynamic linking section */
386 #define PT_INTERP 3 /* the RTLD */
387 #define PT_NOTE 4 /* auxiliary information */
388 #define PT_SHLIB 5 /* reserved - purpose undefined */
389 #define PT_PHDR 6 /* program header */
390 #define PT_NUM 7 /* Number of segment types */
391 #define PT_LOPROC 0x70000000 /* reserved range for processor */
392 #define PT_HIPROC 0x7fffffff /* specific segment types */
394 /* Segment flags - p_flags */
395 #define PF_X 0x1 /* Executable */
396 #define PF_W 0x2 /* Writable */
397 #define PF_R 0x4 /* Readable */
398 #define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
399 /* specific segment flags */
401 /* Dynamic structure */
402 typedef struct {
403 Elf32_Sword d_tag; /* controls meaning of d_val */
404 union {
405 Elf32_Word d_val; /* Multiple meanings - see d_tag */
406 Elf32_Addr d_ptr; /* program virtual address */
407 } d_un;
408 } Elf32_Dyn;
410 typedef struct {
411 Elf64_Xword d_tag; /* controls meaning of d_val */
412 union {
413 Elf64_Addr d_ptr;
414 Elf64_Xword d_val;
415 } d_un;
416 } Elf64_Dyn;
418 /* Dynamic Array Tags - d_tag */
419 #define DT_NULL 0 /* marks end of _DYNAMIC array */
420 #define DT_NEEDED 1 /* string table offset of needed lib */
421 #define DT_PLTRELSZ 2 /* size of relocation entries in PLT */
422 #define DT_PLTGOT 3 /* address PLT/GOT */
423 #define DT_HASH 4 /* address of symbol hash table */
424 #define DT_STRTAB 5 /* address of string table */
425 #define DT_SYMTAB 6 /* address of symbol table */
426 #define DT_RELA 7 /* address of relocation table */
427 #define DT_RELASZ 8 /* size of relocation table */
428 #define DT_RELAENT 9 /* size of relocation entry */
429 #define DT_STRSZ 10 /* size of string table */
430 #define DT_SYMENT 11 /* size of symbol table entry */
431 #define DT_INIT 12 /* address of initialization func. */
432 #define DT_FINI 13 /* address of termination function */
433 #define DT_SONAME 14 /* string table offset of shared obj */
434 #define DT_RPATH 15 /* string table offset of library
435 search path */
436 #define DT_SYMBOLIC 16 /* start sym search in shared obj. */
437 #define DT_REL 17 /* address of rel. tbl. w addends */
438 #define DT_RELSZ 18 /* size of DT_REL relocation table */
439 #define DT_RELENT 19 /* size of DT_REL relocation entry */
440 #define DT_PLTREL 20 /* PLT referenced relocation entry */
441 #define DT_DEBUG 21 /* bugger */
442 #define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */
443 #define DT_JMPREL 23 /* add. of PLT's relocation entries */
444 #define DT_BIND_NOW 24 /* Bind now regardless of env setting */
445 #define DT_NUM 25 /* Number used. */
446 #define DT_LOPROC 0x70000000 /* reserved range for processor */
447 #define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
449 /* Standard ELF hashing function */
450 unsigned int elf_hash(const unsigned char *name);
452 /*
453 * Note Definitions
454 */
455 typedef struct {
456 Elf32_Word namesz;
457 Elf32_Word descsz;
458 Elf32_Word type;
459 } Elf32_Note;
461 typedef struct {
462 Elf64_Half namesz;
463 Elf64_Half descsz;
464 Elf64_Half type;
465 } Elf64_Note;
468 #if defined(ELFSIZE)
469 #define CONCAT(x,y) __CONCAT(x,y)
470 #define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
471 #define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
472 #define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE))
473 #define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
474 #endif
476 #if defined(ELFSIZE) && (ELFSIZE == 32)
477 #define Elf_Ehdr Elf32_Ehdr
478 #define Elf_Phdr Elf32_Phdr
479 #define Elf_Shdr Elf32_Shdr
480 #define Elf_Sym Elf32_Sym
481 #define Elf_Rel Elf32_Rel
482 #define Elf_RelA Elf32_Rela
483 #define Elf_Dyn Elf32_Dyn
484 #define Elf_Word Elf32_Word
485 #define Elf_Sword Elf32_Sword
486 #define Elf_Addr Elf32_Addr
487 #define Elf_Off Elf32_Off
488 #define Elf_Nhdr Elf32_Nhdr
489 #define Elf_Note Elf32_Note
491 #define ELF_R_SYM ELF32_R_SYM
492 #define ELF_R_TYPE ELF32_R_TYPE
493 #define ELF_R_INFO ELF32_R_INFO
494 #define ELFCLASS ELFCLASS32
496 #define ELF_ST_BIND ELF32_ST_BIND
497 #define ELF_ST_TYPE ELF32_ST_TYPE
498 #define ELF_ST_INFO ELF32_ST_INFO
500 #define AuxInfo Aux32Info
501 #elif defined(ELFSIZE) && (ELFSIZE == 64)
502 #define Elf_Ehdr Elf64_Ehdr
503 #define Elf_Phdr Elf64_Phdr
504 #define Elf_Shdr Elf64_Shdr
505 #define Elf_Sym Elf64_Sym
506 #define Elf_Rel Elf64_Rel
507 #define Elf_RelA Elf64_Rela
508 #define Elf_Dyn Elf64_Dyn
509 #define Elf_Word Elf64_Word
510 #define Elf_Sword Elf64_Sword
511 #define Elf_Addr Elf64_Addr
512 #define Elf_Off Elf64_Off
513 #define Elf_Nhdr Elf64_Nhdr
514 #define Elf_Note Elf64_Note
516 #define ELF_R_SYM ELF64_R_SYM
517 #define ELF_R_TYPE ELF64_R_TYPE
518 #define ELF_R_INFO ELF64_R_INFO
519 #define ELFCLASS ELFCLASS64
521 #define ELF_ST_BIND ELF64_ST_BIND
522 #define ELF_ST_TYPE ELF64_ST_TYPE
523 #define ELF_ST_INFO ELF64_ST_INFO
525 #define AuxInfo Aux64Info
526 #endif
528 struct domain_setup_info;
529 extern int loadelfimage(char *);
530 extern int parseelfimage(char *, unsigned long, struct domain_setup_info *);
532 #ifdef Elf_Ehdr
533 extern int elf_sanity_check(Elf_Ehdr *ehdr);
534 #endif
536 #endif /* __XEN_ELF_H__ */