chiark / gitweb /
[PATCH] sync with latest version of klibc (0.107)
[elogind.git] / klibc / klibc / include / sys / elfcommon.h
1 /*
2  * sys/elfcommon.h
3  */
4
5 #ifndef _SYS_ELFCOMMON_H
6 #define _SYS_ELFCOMMON_H
7
8 /* Segment types */
9 #define PT_NULL         0
10 #define PT_LOAD         1
11 #define PT_DYNAMIC      2
12 #define PT_INTERP       3
13 #define PT_NOTE         4
14 #define PT_SHLIB        5
15 #define PT_PHDR         6
16 #define PT_LOOS         0x60000000
17 #define PT_HIOS         0x6fffffff
18 #define PT_LOPROC       0x70000000
19 #define PT_HIPROC       0x7fffffff
20 #define PT_GNU_EH_FRAME 0x6474e550 /* Extension, eh? */
21
22 /* ELF file types */
23 #define ET_NONE         0
24 #define ET_REL          1
25 #define ET_EXEC         2
26 #define ET_DYN          3
27 #define ET_CORE         4
28 #define ET_LOPROC       0xff00
29 #define ET_HIPROC       0xffff
30
31 /* ELF machine types */
32 #define EM_NONE         0
33 #define EM_M32          1
34 #define EM_SPARC        2
35 #define EM_386          3
36 #define EM_68K          4
37 #define EM_88K          5
38 #define EM_486          6       /* Not used in Linux at least */
39 #define EM_860          7
40 #define EM_MIPS         8       /* R3k, bigendian(?) */
41 #define EM_MIPS_RS4_BE  10      /* R4k BE */
42 #define EM_PARISC       15
43 #define EM_SPARC32PLUS  18
44 #define EM_PPC          20
45 #define EM_PPC64        21
46 #define EM_S390         22
47 #define EM_SH           42
48 #define EM_SPARCV9      43      /* v9 = SPARC64 */
49 #define EM_H8_300H      47
50 #define EM_H8S          48
51 #define EM_IA_64        50      /* Itanic */
52 #define EM_X86_64       62
53 #define EM_CRIS         76
54 #define EM_V850         87
55 #define EM_ALPHA        0x9026  /* Interrim Alpha that stuck around */
56 #define EM_CYGNUS_V850  0x9080  /* Old v850 ID used by Cygnus */
57 #define EM_S390_OLD     0xA390  /* Obsolete interrim value for S/390 */
58
59 /* Dynamic type values */
60 #define DT_NULL         0
61 #define DT_NEEDED       1
62 #define DT_PLTRELSZ     2
63 #define DT_PLTGOT       3
64 #define DT_HASH         4
65 #define DT_STRTAB       5
66 #define DT_SYMTAB       6
67 #define DT_RELA         7
68 #define DT_RELASZ       8
69 #define DT_RELAENT      9
70 #define DT_STRSZ        10
71 #define DT_SYMENT       11
72 #define DT_INIT         12
73 #define DT_FINI         13
74 #define DT_SONAME       14
75 #define DT_RPATH        15
76 #define DT_SYMBOLIC     16
77 #define DT_REL          17
78 #define DT_RELSZ        18
79 #define DT_RELENT       19
80 #define DT_PLTREL       20
81 #define DT_DEBUG        21
82 #define DT_TEXTREL      22
83 #define DT_JMPREL       23
84 #define DT_LOPROC       0x70000000
85 #define DT_HIPROC       0x7fffffff
86
87 /* Auxilliary table entries */
88 #define AT_NULL         0       /* end of vector */
89 #define AT_IGNORE       1       /* entry should be ignored */
90 #define AT_EXECFD       2       /* file descriptor of program */
91 #define AT_PHDR         3       /* program headers for program */
92 #define AT_PHENT        4       /* size of program header entry */
93 #define AT_PHNUM        5       /* number of program headers */
94 #define AT_PAGESZ       6       /* system page size */
95 #define AT_BASE         7       /* base address of interpreter */
96 #define AT_FLAGS        8       /* flags */
97 #define AT_ENTRY        9       /* entry point of program */
98 #define AT_NOTELF       10      /* program is not ELF */
99 #define AT_UID          11      /* real uid */
100 #define AT_EUID         12      /* effective uid */
101 #define AT_GID          13      /* real gid */
102 #define AT_EGID         14      /* effective gid */
103 #define AT_PLATFORM     15      /* string identifying CPU for optimizations */
104 #define AT_HWCAP        16      /* arch dependent hints at CPU capabilities */
105 #define AT_CLKTCK       17      /* frequency at which times() increments */
106 /* 18..22 = ? */
107 #define AT_SECURE       23      /* secure mode boolean */
108
109 /* Program header permission flags */
110 #define PF_X            0x1
111 #define PF_W            0x2
112 #define PF_R            0x4
113
114 /* Section header types */
115 #define SHT_NULL        0
116 #define SHT_PROGBITS    1
117 #define SHT_SYMTAB      2
118 #define SHT_STRTAB      3
119 #define SHT_RELA        4
120 #define SHT_HASH        5
121 #define SHT_DYNAMIC     6
122 #define SHT_NOTE        7
123 #define SHT_NOBITS      8
124 #define SHT_REL         9
125 #define SHT_SHLIB       10
126 #define SHT_DYNSYM      11
127 #define SHT_NUM         12
128 #define SHT_LOPROC      0x70000000
129 #define SHT_HIPROC      0x7fffffff
130 #define SHT_LOUSER      0x80000000
131 #define SHT_HIUSER      0xffffffff
132
133 /* Section header flags */
134 #define SHF_WRITE       0x1
135 #define SHF_ALLOC       0x2
136 #define SHF_EXECINSTR   0x4
137 #define SHF_MASKPROC    0xf0000000
138
139 /* Special section numbers */
140 #define SHN_UNDEF       0
141 #define SHN_LORESERVE   0xff00
142 #define SHN_LOPROC      0xff00
143 #define SHN_HIPROC      0xff1f
144 #define SHN_ABS         0xfff1
145 #define SHN_COMMON      0xfff2
146 #define SHN_HIRESERVE   0xffff
147
148 /* Lenght of magic at the start of a file */
149 #define EI_NIDENT       16
150
151 /* Magic number constants... */
152 #define EI_MAG0         0       /* e_ident[] indexes */
153 #define EI_MAG1         1
154 #define EI_MAG2         2
155 #define EI_MAG3         3
156 #define EI_CLASS        4
157 #define EI_DATA         5
158 #define EI_VERSION      6
159 #define EI_OSABI        7
160 #define EI_PAD          8
161
162 #define ELFMAG0         0x7f    /* EI_MAG */
163 #define ELFMAG1         'E'
164 #define ELFMAG2         'L'
165 #define ELFMAG3         'F'
166 #define ELFMAG          "\177ELF"
167 #define SELFMAG         4
168
169 #define ELFCLASSNONE    0       /* EI_CLASS */
170 #define ELFCLASS32      1
171 #define ELFCLASS64      2
172 #define ELFCLASSNUM     3
173
174 #define ELFDATANONE     0       /* e_ident[EI_DATA] */
175 #define ELFDATA2LSB     1
176 #define ELFDATA2MSB     2
177
178 #define EV_NONE         0       /* e_version, EI_VERSION */
179 #define EV_CURRENT      1
180 #define EV_NUM          2
181
182 #define ELFOSABI_NONE   0
183 #define ELFOSABI_LINUX  3
184
185 #endif /* _SYS_ELFCOMMON_H */
186