1/*
2 * Copyright 2002-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _ELF_H
6#define _ELF_H
7
8
9#include <SupportDefs.h>
10
11
12// types
13typedef uint32		Elf32_Addr;
14typedef uint32		Elf32_Off;
15typedef uint16		Elf32_Half;
16typedef int32		Elf32_Sword;
17typedef uint32		Elf32_Word;
18typedef uint32		Elf32_Xword;
19typedef int32		Elf32_Sxword;
20
21typedef uint64		Elf64_Addr;
22typedef uint64		Elf64_Off;
23typedef uint16		Elf64_Half;
24typedef int32		Elf64_Sword;
25typedef uint32		Elf64_Word;
26typedef uint64		Elf64_Xword;
27typedef int64		Elf64_Sxword;
28
29// e_ident indices
30#define EI_MAG0		0
31#define EI_MAG1		1
32#define EI_MAG2		2
33#define EI_MAG3		3
34#define EI_CLASS	4
35#define EI_DATA		5
36#define EI_VERSION	6
37#define EI_PAD		7
38#define EI_NIDENT	16
39
40// e_ident EI_VERSION values
41#define EV_NONE 	0
42#define EV_CURRENT 	1
43
44// e_ident EI_CLASS and EI_DATA values
45#define ELFCLASSNONE	0
46#define ELFCLASS32		1
47#define ELFCLASS64		2
48#define ELFDATANONE		0
49#define ELFDATA2LSB		1
50#define ELFDATA2MSB		2
51
52// p_type
53#define PT_NULL		0
54#define PT_LOAD		1
55#define PT_DYNAMIC	2
56#define PT_INTERP	3
57#define PT_NOTE		4
58#define PT_SHLIB	5
59#define PT_PHDIR	6
60#define PT_LOPROC	0x70000000
61#define PT_HIPROC	0x7fffffff
62
63// sh_type values
64#define SHT_NULL		0
65#define SHT_PROGBITS	1
66#define SHT_SYMTAB		2
67#define SHT_STRTAB		3
68#define SHT_RELA		4
69#define SHT_HASH		5
70#define SHT_DYNAMIC		6
71#define SHT_NOTE		7
72#define SHT_NOBITS		8
73#define SHT_REL			9
74#define SHT_SHLIB		10
75#define SHT_DYNSYM		11
76#define SHT_LOPROC		0x70000000
77#define SHT_HIPROC		0x7fffffff
78#define SHT_LOUSER		0x80000000
79#define SHT_HIUSER		0xffffffff
80
81// 32 bit definitions
82#undef _ELFX_BITS
83#define _ELFX_BITS	32
84#include <ElfX.h>
85
86// 64 bit definitions
87#undef _ELFX_BITS
88#define _ELFX_BITS	64
89#include <ElfX.h>
90
91#undef _ELFX_BITS
92
93
94#endif	// _ELF_H
95