diff options
author | David Howells <dhowells@redhat.com> | 2012-10-13 05:46:48 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2012-10-13 05:46:48 -0400 |
commit | 607ca46e97a1b6594b29647d98a32d545c24bdff (patch) | |
tree | 30f4c0784bfddb57332cdc0678bd06d1e77fa185 /include/linux/elf.h | |
parent | 08cce05c5a91f5017f4edc9866cf026908c73f9f (diff) |
UAPI: (Scripted) Disintegrate include/linux
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'include/linux/elf.h')
-rw-r--r-- | include/linux/elf.h | 414 |
1 files changed, 1 insertions, 413 deletions
diff --git a/include/linux/elf.h b/include/linux/elf.h index 59ef40650e1e..8c9048e33463 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h | |||
@@ -1,420 +1,9 @@ | |||
1 | #ifndef _LINUX_ELF_H | 1 | #ifndef _LINUX_ELF_H |
2 | #define _LINUX_ELF_H | 2 | #define _LINUX_ELF_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | #include <linux/elf-em.h> | ||
6 | #ifdef __KERNEL__ | ||
7 | #include <asm/elf.h> | 4 | #include <asm/elf.h> |
8 | #endif | 5 | #include <uapi/linux/elf.h> |
9 | |||
10 | /* 32-bit ELF base types. */ | ||
11 | typedef __u32 Elf32_Addr; | ||
12 | typedef __u16 Elf32_Half; | ||
13 | typedef __u32 Elf32_Off; | ||
14 | typedef __s32 Elf32_Sword; | ||
15 | typedef __u32 Elf32_Word; | ||
16 | |||
17 | /* 64-bit ELF base types. */ | ||
18 | typedef __u64 Elf64_Addr; | ||
19 | typedef __u16 Elf64_Half; | ||
20 | typedef __s16 Elf64_SHalf; | ||
21 | typedef __u64 Elf64_Off; | ||
22 | typedef __s32 Elf64_Sword; | ||
23 | typedef __u32 Elf64_Word; | ||
24 | typedef __u64 Elf64_Xword; | ||
25 | typedef __s64 Elf64_Sxword; | ||
26 | |||
27 | /* These constants are for the segment types stored in the image headers */ | ||
28 | #define PT_NULL 0 | ||
29 | #define PT_LOAD 1 | ||
30 | #define PT_DYNAMIC 2 | ||
31 | #define PT_INTERP 3 | ||
32 | #define PT_NOTE 4 | ||
33 | #define PT_SHLIB 5 | ||
34 | #define PT_PHDR 6 | ||
35 | #define PT_TLS 7 /* Thread local storage segment */ | ||
36 | #define PT_LOOS 0x60000000 /* OS-specific */ | ||
37 | #define PT_HIOS 0x6fffffff /* OS-specific */ | ||
38 | #define PT_LOPROC 0x70000000 | ||
39 | #define PT_HIPROC 0x7fffffff | ||
40 | #define PT_GNU_EH_FRAME 0x6474e550 | ||
41 | |||
42 | #define PT_GNU_STACK (PT_LOOS + 0x474e551) | ||
43 | |||
44 | /* | ||
45 | * Extended Numbering | ||
46 | * | ||
47 | * If the real number of program header table entries is larger than | ||
48 | * or equal to PN_XNUM(0xffff), it is set to sh_info field of the | ||
49 | * section header at index 0, and PN_XNUM is set to e_phnum | ||
50 | * field. Otherwise, the section header at index 0 is zero | ||
51 | * initialized, if it exists. | ||
52 | * | ||
53 | * Specifications are available in: | ||
54 | * | ||
55 | * - Sun microsystems: Linker and Libraries. | ||
56 | * Part No: 817-1984-17, September 2008. | ||
57 | * URL: http://docs.sun.com/app/docs/doc/817-1984 | ||
58 | * | ||
59 | * - System V ABI AMD64 Architecture Processor Supplement | ||
60 | * Draft Version 0.99., | ||
61 | * May 11, 2009. | ||
62 | * URL: http://www.x86-64.org/ | ||
63 | */ | ||
64 | #define PN_XNUM 0xffff | ||
65 | |||
66 | /* These constants define the different elf file types */ | ||
67 | #define ET_NONE 0 | ||
68 | #define ET_REL 1 | ||
69 | #define ET_EXEC 2 | ||
70 | #define ET_DYN 3 | ||
71 | #define ET_CORE 4 | ||
72 | #define ET_LOPROC 0xff00 | ||
73 | #define ET_HIPROC 0xffff | ||
74 | |||
75 | /* This is the info that is needed to parse the dynamic section of the file */ | ||
76 | #define DT_NULL 0 | ||
77 | #define DT_NEEDED 1 | ||
78 | #define DT_PLTRELSZ 2 | ||
79 | #define DT_PLTGOT 3 | ||
80 | #define DT_HASH 4 | ||
81 | #define DT_STRTAB 5 | ||
82 | #define DT_SYMTAB 6 | ||
83 | #define DT_RELA 7 | ||
84 | #define DT_RELASZ 8 | ||
85 | #define DT_RELAENT 9 | ||
86 | #define DT_STRSZ 10 | ||
87 | #define DT_SYMENT 11 | ||
88 | #define DT_INIT 12 | ||
89 | #define DT_FINI 13 | ||
90 | #define DT_SONAME 14 | ||
91 | #define DT_RPATH 15 | ||
92 | #define DT_SYMBOLIC 16 | ||
93 | #define DT_REL 17 | ||
94 | #define DT_RELSZ 18 | ||
95 | #define DT_RELENT 19 | ||
96 | #define DT_PLTREL 20 | ||
97 | #define DT_DEBUG 21 | ||
98 | #define DT_TEXTREL 22 | ||
99 | #define DT_JMPREL 23 | ||
100 | #define DT_ENCODING 32 | ||
101 | #define OLD_DT_LOOS 0x60000000 | ||
102 | #define DT_LOOS 0x6000000d | ||
103 | #define DT_HIOS 0x6ffff000 | ||
104 | #define DT_VALRNGLO 0x6ffffd00 | ||
105 | #define DT_VALRNGHI 0x6ffffdff | ||
106 | #define DT_ADDRRNGLO 0x6ffffe00 | ||
107 | #define DT_ADDRRNGHI 0x6ffffeff | ||
108 | #define DT_VERSYM 0x6ffffff0 | ||
109 | #define DT_RELACOUNT 0x6ffffff9 | ||
110 | #define DT_RELCOUNT 0x6ffffffa | ||
111 | #define DT_FLAGS_1 0x6ffffffb | ||
112 | #define DT_VERDEF 0x6ffffffc | ||
113 | #define DT_VERDEFNUM 0x6ffffffd | ||
114 | #define DT_VERNEED 0x6ffffffe | ||
115 | #define DT_VERNEEDNUM 0x6fffffff | ||
116 | #define OLD_DT_HIOS 0x6fffffff | ||
117 | #define DT_LOPROC 0x70000000 | ||
118 | #define DT_HIPROC 0x7fffffff | ||
119 | |||
120 | /* This info is needed when parsing the symbol table */ | ||
121 | #define STB_LOCAL 0 | ||
122 | #define STB_GLOBAL 1 | ||
123 | #define STB_WEAK 2 | ||
124 | |||
125 | #define STT_NOTYPE 0 | ||
126 | #define STT_OBJECT 1 | ||
127 | #define STT_FUNC 2 | ||
128 | #define STT_SECTION 3 | ||
129 | #define STT_FILE 4 | ||
130 | #define STT_COMMON 5 | ||
131 | #define STT_TLS 6 | ||
132 | |||
133 | #define ELF_ST_BIND(x) ((x) >> 4) | ||
134 | #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) | ||
135 | #define ELF32_ST_BIND(x) ELF_ST_BIND(x) | ||
136 | #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) | ||
137 | #define ELF64_ST_BIND(x) ELF_ST_BIND(x) | ||
138 | #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) | ||
139 | |||
140 | typedef struct dynamic{ | ||
141 | Elf32_Sword d_tag; | ||
142 | union{ | ||
143 | Elf32_Sword d_val; | ||
144 | Elf32_Addr d_ptr; | ||
145 | } d_un; | ||
146 | } Elf32_Dyn; | ||
147 | |||
148 | typedef struct { | ||
149 | Elf64_Sxword d_tag; /* entry tag value */ | ||
150 | union { | ||
151 | Elf64_Xword d_val; | ||
152 | Elf64_Addr d_ptr; | ||
153 | } d_un; | ||
154 | } Elf64_Dyn; | ||
155 | |||
156 | /* The following are used with relocations */ | ||
157 | #define ELF32_R_SYM(x) ((x) >> 8) | ||
158 | #define ELF32_R_TYPE(x) ((x) & 0xff) | ||
159 | |||
160 | #define ELF64_R_SYM(i) ((i) >> 32) | ||
161 | #define ELF64_R_TYPE(i) ((i) & 0xffffffff) | ||
162 | |||
163 | typedef struct elf32_rel { | ||
164 | Elf32_Addr r_offset; | ||
165 | Elf32_Word r_info; | ||
166 | } Elf32_Rel; | ||
167 | |||
168 | typedef struct elf64_rel { | ||
169 | Elf64_Addr r_offset; /* Location at which to apply the action */ | ||
170 | Elf64_Xword r_info; /* index and type of relocation */ | ||
171 | } Elf64_Rel; | ||
172 | |||
173 | typedef struct elf32_rela{ | ||
174 | Elf32_Addr r_offset; | ||
175 | Elf32_Word r_info; | ||
176 | Elf32_Sword r_addend; | ||
177 | } Elf32_Rela; | ||
178 | |||
179 | typedef struct elf64_rela { | ||
180 | Elf64_Addr r_offset; /* Location at which to apply the action */ | ||
181 | Elf64_Xword r_info; /* index and type of relocation */ | ||
182 | Elf64_Sxword r_addend; /* Constant addend used to compute value */ | ||
183 | } Elf64_Rela; | ||
184 | |||
185 | typedef struct elf32_sym{ | ||
186 | Elf32_Word st_name; | ||
187 | Elf32_Addr st_value; | ||
188 | Elf32_Word st_size; | ||
189 | unsigned char st_info; | ||
190 | unsigned char st_other; | ||
191 | Elf32_Half st_shndx; | ||
192 | } Elf32_Sym; | ||
193 | |||
194 | typedef struct elf64_sym { | ||
195 | Elf64_Word st_name; /* Symbol name, index in string tbl */ | ||
196 | unsigned char st_info; /* Type and binding attributes */ | ||
197 | unsigned char st_other; /* No defined meaning, 0 */ | ||
198 | Elf64_Half st_shndx; /* Associated section index */ | ||
199 | Elf64_Addr st_value; /* Value of the symbol */ | ||
200 | Elf64_Xword st_size; /* Associated symbol size */ | ||
201 | } Elf64_Sym; | ||
202 | |||
203 | |||
204 | #define EI_NIDENT 16 | ||
205 | |||
206 | typedef struct elf32_hdr{ | ||
207 | unsigned char e_ident[EI_NIDENT]; | ||
208 | Elf32_Half e_type; | ||
209 | Elf32_Half e_machine; | ||
210 | Elf32_Word e_version; | ||
211 | Elf32_Addr e_entry; /* Entry point */ | ||
212 | Elf32_Off e_phoff; | ||
213 | Elf32_Off e_shoff; | ||
214 | Elf32_Word e_flags; | ||
215 | Elf32_Half e_ehsize; | ||
216 | Elf32_Half e_phentsize; | ||
217 | Elf32_Half e_phnum; | ||
218 | Elf32_Half e_shentsize; | ||
219 | Elf32_Half e_shnum; | ||
220 | Elf32_Half e_shstrndx; | ||
221 | } Elf32_Ehdr; | ||
222 | |||
223 | typedef struct elf64_hdr { | ||
224 | unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ | ||
225 | Elf64_Half e_type; | ||
226 | Elf64_Half e_machine; | ||
227 | Elf64_Word e_version; | ||
228 | Elf64_Addr e_entry; /* Entry point virtual address */ | ||
229 | Elf64_Off e_phoff; /* Program header table file offset */ | ||
230 | Elf64_Off e_shoff; /* Section header table file offset */ | ||
231 | Elf64_Word e_flags; | ||
232 | Elf64_Half e_ehsize; | ||
233 | Elf64_Half e_phentsize; | ||
234 | Elf64_Half e_phnum; | ||
235 | Elf64_Half e_shentsize; | ||
236 | Elf64_Half e_shnum; | ||
237 | Elf64_Half e_shstrndx; | ||
238 | } Elf64_Ehdr; | ||
239 | |||
240 | /* These constants define the permissions on sections in the program | ||
241 | header, p_flags. */ | ||
242 | #define PF_R 0x4 | ||
243 | #define PF_W 0x2 | ||
244 | #define PF_X 0x1 | ||
245 | |||
246 | typedef struct elf32_phdr{ | ||
247 | Elf32_Word p_type; | ||
248 | Elf32_Off p_offset; | ||
249 | Elf32_Addr p_vaddr; | ||
250 | Elf32_Addr p_paddr; | ||
251 | Elf32_Word p_filesz; | ||
252 | Elf32_Word p_memsz; | ||
253 | Elf32_Word p_flags; | ||
254 | Elf32_Word p_align; | ||
255 | } Elf32_Phdr; | ||
256 | |||
257 | typedef struct elf64_phdr { | ||
258 | Elf64_Word p_type; | ||
259 | Elf64_Word p_flags; | ||
260 | Elf64_Off p_offset; /* Segment file offset */ | ||
261 | Elf64_Addr p_vaddr; /* Segment virtual address */ | ||
262 | Elf64_Addr p_paddr; /* Segment physical address */ | ||
263 | Elf64_Xword p_filesz; /* Segment size in file */ | ||
264 | Elf64_Xword p_memsz; /* Segment size in memory */ | ||
265 | Elf64_Xword p_align; /* Segment alignment, file & memory */ | ||
266 | } Elf64_Phdr; | ||
267 | |||
268 | /* sh_type */ | ||
269 | #define SHT_NULL 0 | ||
270 | #define SHT_PROGBITS 1 | ||
271 | #define SHT_SYMTAB 2 | ||
272 | #define SHT_STRTAB 3 | ||
273 | #define SHT_RELA 4 | ||
274 | #define SHT_HASH 5 | ||
275 | #define SHT_DYNAMIC 6 | ||
276 | #define SHT_NOTE 7 | ||
277 | #define SHT_NOBITS 8 | ||
278 | #define SHT_REL 9 | ||
279 | #define SHT_SHLIB 10 | ||
280 | #define SHT_DYNSYM 11 | ||
281 | #define SHT_NUM 12 | ||
282 | #define SHT_LOPROC 0x70000000 | ||
283 | #define SHT_HIPROC 0x7fffffff | ||
284 | #define SHT_LOUSER 0x80000000 | ||
285 | #define SHT_HIUSER 0xffffffff | ||
286 | |||
287 | /* sh_flags */ | ||
288 | #define SHF_WRITE 0x1 | ||
289 | #define SHF_ALLOC 0x2 | ||
290 | #define SHF_EXECINSTR 0x4 | ||
291 | #define SHF_MASKPROC 0xf0000000 | ||
292 | |||
293 | /* special section indexes */ | ||
294 | #define SHN_UNDEF 0 | ||
295 | #define SHN_LORESERVE 0xff00 | ||
296 | #define SHN_LOPROC 0xff00 | ||
297 | #define SHN_HIPROC 0xff1f | ||
298 | #define SHN_ABS 0xfff1 | ||
299 | #define SHN_COMMON 0xfff2 | ||
300 | #define SHN_HIRESERVE 0xffff | ||
301 | |||
302 | typedef struct elf32_shdr { | ||
303 | Elf32_Word sh_name; | ||
304 | Elf32_Word sh_type; | ||
305 | Elf32_Word sh_flags; | ||
306 | Elf32_Addr sh_addr; | ||
307 | Elf32_Off sh_offset; | ||
308 | Elf32_Word sh_size; | ||
309 | Elf32_Word sh_link; | ||
310 | Elf32_Word sh_info; | ||
311 | Elf32_Word sh_addralign; | ||
312 | Elf32_Word sh_entsize; | ||
313 | } Elf32_Shdr; | ||
314 | |||
315 | typedef struct elf64_shdr { | ||
316 | Elf64_Word sh_name; /* Section name, index in string tbl */ | ||
317 | Elf64_Word sh_type; /* Type of section */ | ||
318 | Elf64_Xword sh_flags; /* Miscellaneous section attributes */ | ||
319 | Elf64_Addr sh_addr; /* Section virtual addr at execution */ | ||
320 | Elf64_Off sh_offset; /* Section file offset */ | ||
321 | Elf64_Xword sh_size; /* Size of section in bytes */ | ||
322 | Elf64_Word sh_link; /* Index of another section */ | ||
323 | Elf64_Word sh_info; /* Additional section information */ | ||
324 | Elf64_Xword sh_addralign; /* Section alignment */ | ||
325 | Elf64_Xword sh_entsize; /* Entry size if section holds table */ | ||
326 | } Elf64_Shdr; | ||
327 | |||
328 | #define EI_MAG0 0 /* e_ident[] indexes */ | ||
329 | #define EI_MAG1 1 | ||
330 | #define EI_MAG2 2 | ||
331 | #define EI_MAG3 3 | ||
332 | #define EI_CLASS 4 | ||
333 | #define EI_DATA 5 | ||
334 | #define EI_VERSION 6 | ||
335 | #define EI_OSABI 7 | ||
336 | #define EI_PAD 8 | ||
337 | |||
338 | #define ELFMAG0 0x7f /* EI_MAG */ | ||
339 | #define ELFMAG1 'E' | ||
340 | #define ELFMAG2 'L' | ||
341 | #define ELFMAG3 'F' | ||
342 | #define ELFMAG "\177ELF" | ||
343 | #define SELFMAG 4 | ||
344 | |||
345 | #define ELFCLASSNONE 0 /* EI_CLASS */ | ||
346 | #define ELFCLASS32 1 | ||
347 | #define ELFCLASS64 2 | ||
348 | #define ELFCLASSNUM 3 | ||
349 | |||
350 | #define ELFDATANONE 0 /* e_ident[EI_DATA] */ | ||
351 | #define ELFDATA2LSB 1 | ||
352 | #define ELFDATA2MSB 2 | ||
353 | |||
354 | #define EV_NONE 0 /* e_version, EI_VERSION */ | ||
355 | #define EV_CURRENT 1 | ||
356 | #define EV_NUM 2 | ||
357 | |||
358 | #define ELFOSABI_NONE 0 | ||
359 | #define ELFOSABI_LINUX 3 | ||
360 | |||
361 | #ifndef ELF_OSABI | ||
362 | #define ELF_OSABI ELFOSABI_NONE | ||
363 | #endif | ||
364 | |||
365 | /* | ||
366 | * Notes used in ET_CORE. Architectures export some of the arch register sets | ||
367 | * using the corresponding note types via the PTRACE_GETREGSET and | ||
368 | * PTRACE_SETREGSET requests. | ||
369 | */ | ||
370 | #define NT_PRSTATUS 1 | ||
371 | #define NT_PRFPREG 2 | ||
372 | #define NT_PRPSINFO 3 | ||
373 | #define NT_TASKSTRUCT 4 | ||
374 | #define NT_AUXV 6 | ||
375 | /* | ||
376 | * Note to userspace developers: size of NT_SIGINFO note may increase | ||
377 | * in the future to accomodate more fields, don't assume it is fixed! | ||
378 | */ | ||
379 | #define NT_SIGINFO 0x53494749 | ||
380 | #define NT_FILE 0x46494c45 | ||
381 | #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ | ||
382 | #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ | ||
383 | #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ | ||
384 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ | ||
385 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ | ||
386 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ | ||
387 | #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ | ||
388 | #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ | ||
389 | #define NT_S390_TIMER 0x301 /* s390 timer register */ | ||
390 | #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ | ||
391 | #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ | ||
392 | #define NT_S390_CTRS 0x304 /* s390 control registers */ | ||
393 | #define NT_S390_PREFIX 0x305 /* s390 prefix register */ | ||
394 | #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ | ||
395 | #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ | ||
396 | #define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ | ||
397 | #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ | ||
398 | #define NT_ARM_TLS 0x401 /* ARM TLS register */ | ||
399 | #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ | ||
400 | #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ | ||
401 | |||
402 | |||
403 | /* Note header in a PT_NOTE section */ | ||
404 | typedef struct elf32_note { | ||
405 | Elf32_Word n_namesz; /* Name size */ | ||
406 | Elf32_Word n_descsz; /* Content size */ | ||
407 | Elf32_Word n_type; /* Content type */ | ||
408 | } Elf32_Nhdr; | ||
409 | |||
410 | /* Note header in a PT_NOTE section */ | ||
411 | typedef struct elf64_note { | ||
412 | Elf64_Word n_namesz; /* Name size */ | ||
413 | Elf64_Word n_descsz; /* Content size */ | ||
414 | Elf64_Word n_type; /* Content type */ | ||
415 | } Elf64_Nhdr; | ||
416 | 6 | ||
417 | #ifdef __KERNEL__ | ||
418 | #ifndef elf_read_implies_exec | 7 | #ifndef elf_read_implies_exec |
419 | /* Executables for which elf_read_implies_exec() returns TRUE will | 8 | /* Executables for which elf_read_implies_exec() returns TRUE will |
420 | have the READ_IMPLIES_EXEC personality flag set automatically. | 9 | have the READ_IMPLIES_EXEC personality flag set automatically. |
@@ -455,5 +44,4 @@ static inline int elf_coredump_extra_notes_write(struct file *file, | |||
455 | extern int elf_coredump_extra_notes_size(void); | 44 | extern int elf_coredump_extra_notes_size(void); |
456 | extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset); | 45 | extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset); |
457 | #endif | 46 | #endif |
458 | #endif /* __KERNEL__ */ | ||
459 | #endif /* _LINUX_ELF_H */ | 47 | #endif /* _LINUX_ELF_H */ |