• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPI_LINUX_ELF_H
20 #define _UAPI_LINUX_ELF_H
21 #include <linux/types.h>
22 #include <linux/elf-em.h>
23 typedef __u32 Elf32_Addr;
24 typedef __u16 Elf32_Half;
25 typedef __u32 Elf32_Off;
26 typedef __s32 Elf32_Sword;
27 typedef __u32 Elf32_Word;
28 typedef __u64 Elf64_Addr;
29 typedef __u16 Elf64_Half;
30 typedef __s16 Elf64_SHalf;
31 typedef __u64 Elf64_Off;
32 typedef __s32 Elf64_Sword;
33 typedef __u32 Elf64_Word;
34 typedef __u64 Elf64_Xword;
35 typedef __s64 Elf64_Sxword;
36 #define PT_NULL 0
37 #define PT_LOAD 1
38 #define PT_DYNAMIC 2
39 #define PT_INTERP 3
40 #define PT_NOTE 4
41 #define PT_SHLIB 5
42 #define PT_PHDR 6
43 #define PT_TLS 7
44 #define PT_LOOS 0x60000000
45 #define PT_HIOS 0x6fffffff
46 #define PT_LOPROC 0x70000000
47 #define PT_HIPROC 0x7fffffff
48 #define PT_GNU_EH_FRAME 0x6474e550
49 #define PT_GNU_STACK (PT_LOOS + 0x474e551)
50 #define PN_XNUM 0xffff
51 #define ET_NONE 0
52 #define ET_REL 1
53 #define ET_EXEC 2
54 #define ET_DYN 3
55 #define ET_CORE 4
56 #define ET_LOPROC 0xff00
57 #define ET_HIPROC 0xffff
58 #define DT_NULL 0
59 #define DT_NEEDED 1
60 #define DT_PLTRELSZ 2
61 #define DT_PLTGOT 3
62 #define DT_HASH 4
63 #define DT_STRTAB 5
64 #define DT_SYMTAB 6
65 #define DT_RELA 7
66 #define DT_RELASZ 8
67 #define DT_RELAENT 9
68 #define DT_STRSZ 10
69 #define DT_SYMENT 11
70 #define DT_INIT 12
71 #define DT_FINI 13
72 #define DT_SONAME 14
73 #define DT_RPATH 15
74 #define DT_SYMBOLIC 16
75 #define DT_REL 17
76 #define DT_RELSZ 18
77 #define DT_RELENT 19
78 #define DT_PLTREL 20
79 #define DT_DEBUG 21
80 #define DT_TEXTREL 22
81 #define DT_JMPREL 23
82 #define DT_ENCODING 32
83 #define OLD_DT_LOOS 0x60000000
84 #define DT_LOOS 0x6000000d
85 #define DT_HIOS 0x6ffff000
86 #define DT_VALRNGLO 0x6ffffd00
87 #define DT_VALRNGHI 0x6ffffdff
88 #define DT_ADDRRNGLO 0x6ffffe00
89 #define DT_ADDRRNGHI 0x6ffffeff
90 #define DT_VERSYM 0x6ffffff0
91 #define DT_RELACOUNT 0x6ffffff9
92 #define DT_RELCOUNT 0x6ffffffa
93 #define DT_FLAGS_1 0x6ffffffb
94 #define DT_VERDEF 0x6ffffffc
95 #define DT_VERDEFNUM 0x6ffffffd
96 #define DT_VERNEED 0x6ffffffe
97 #define DT_VERNEEDNUM 0x6fffffff
98 #define OLD_DT_HIOS 0x6fffffff
99 #define DT_LOPROC 0x70000000
100 #define DT_HIPROC 0x7fffffff
101 #define STB_LOCAL 0
102 #define STB_GLOBAL 1
103 #define STB_WEAK 2
104 #define STT_NOTYPE 0
105 #define STT_OBJECT 1
106 #define STT_FUNC 2
107 #define STT_SECTION 3
108 #define STT_FILE 4
109 #define STT_COMMON 5
110 #define STT_TLS 6
111 #define ELF_ST_BIND(x) ((x) >> 4)
112 #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
113 #define ELF32_ST_BIND(x) ELF_ST_BIND(x)
114 #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
115 #define ELF64_ST_BIND(x) ELF_ST_BIND(x)
116 #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
117 typedef struct dynamic {
118   Elf32_Sword d_tag;
119   union {
120     Elf32_Sword d_val;
121     Elf32_Addr d_ptr;
122   } d_un;
123 } Elf32_Dyn;
124 typedef struct {
125   Elf64_Sxword d_tag;
126   union {
127     Elf64_Xword d_val;
128     Elf64_Addr d_ptr;
129   } d_un;
130 } Elf64_Dyn;
131 #define ELF32_R_SYM(x) ((x) >> 8)
132 #define ELF32_R_TYPE(x) ((x) & 0xff)
133 #define ELF64_R_SYM(i) ((i) >> 32)
134 #define ELF64_R_TYPE(i) ((i) & 0xffffffff)
135 typedef struct elf32_rel {
136   Elf32_Addr r_offset;
137   Elf32_Word r_info;
138 } Elf32_Rel;
139 typedef struct elf64_rel {
140   Elf64_Addr r_offset;
141   Elf64_Xword r_info;
142 } Elf64_Rel;
143 typedef struct elf32_rela {
144   Elf32_Addr r_offset;
145   Elf32_Word r_info;
146   Elf32_Sword r_addend;
147 } Elf32_Rela;
148 typedef struct elf64_rela {
149   Elf64_Addr r_offset;
150   Elf64_Xword r_info;
151   Elf64_Sxword r_addend;
152 } Elf64_Rela;
153 typedef struct elf32_sym {
154   Elf32_Word st_name;
155   Elf32_Addr st_value;
156   Elf32_Word st_size;
157   unsigned char st_info;
158   unsigned char st_other;
159   Elf32_Half st_shndx;
160 } Elf32_Sym;
161 typedef struct elf64_sym {
162   Elf64_Word st_name;
163   unsigned char st_info;
164   unsigned char st_other;
165   Elf64_Half st_shndx;
166   Elf64_Addr st_value;
167   Elf64_Xword st_size;
168 } Elf64_Sym;
169 #define EI_NIDENT 16
170 typedef struct elf32_hdr {
171   unsigned char e_ident[EI_NIDENT];
172   Elf32_Half e_type;
173   Elf32_Half e_machine;
174   Elf32_Word e_version;
175   Elf32_Addr e_entry;
176   Elf32_Off e_phoff;
177   Elf32_Off e_shoff;
178   Elf32_Word e_flags;
179   Elf32_Half e_ehsize;
180   Elf32_Half e_phentsize;
181   Elf32_Half e_phnum;
182   Elf32_Half e_shentsize;
183   Elf32_Half e_shnum;
184   Elf32_Half e_shstrndx;
185 } Elf32_Ehdr;
186 typedef struct elf64_hdr {
187   unsigned char e_ident[EI_NIDENT];
188   Elf64_Half e_type;
189   Elf64_Half e_machine;
190   Elf64_Word e_version;
191   Elf64_Addr e_entry;
192   Elf64_Off e_phoff;
193   Elf64_Off e_shoff;
194   Elf64_Word e_flags;
195   Elf64_Half e_ehsize;
196   Elf64_Half e_phentsize;
197   Elf64_Half e_phnum;
198   Elf64_Half e_shentsize;
199   Elf64_Half e_shnum;
200   Elf64_Half e_shstrndx;
201 } Elf64_Ehdr;
202 #define PF_R 0x4
203 #define PF_W 0x2
204 #define PF_X 0x1
205 typedef struct elf32_phdr {
206   Elf32_Word p_type;
207   Elf32_Off p_offset;
208   Elf32_Addr p_vaddr;
209   Elf32_Addr p_paddr;
210   Elf32_Word p_filesz;
211   Elf32_Word p_memsz;
212   Elf32_Word p_flags;
213   Elf32_Word p_align;
214 } Elf32_Phdr;
215 typedef struct elf64_phdr {
216   Elf64_Word p_type;
217   Elf64_Word p_flags;
218   Elf64_Off p_offset;
219   Elf64_Addr p_vaddr;
220   Elf64_Addr p_paddr;
221   Elf64_Xword p_filesz;
222   Elf64_Xword p_memsz;
223   Elf64_Xword p_align;
224 } Elf64_Phdr;
225 #define SHT_NULL 0
226 #define SHT_PROGBITS 1
227 #define SHT_SYMTAB 2
228 #define SHT_STRTAB 3
229 #define SHT_RELA 4
230 #define SHT_HASH 5
231 #define SHT_DYNAMIC 6
232 #define SHT_NOTE 7
233 #define SHT_NOBITS 8
234 #define SHT_REL 9
235 #define SHT_SHLIB 10
236 #define SHT_DYNSYM 11
237 #define SHT_NUM 12
238 #define SHT_LOPROC 0x70000000
239 #define SHT_HIPROC 0x7fffffff
240 #define SHT_LOUSER 0x80000000
241 #define SHT_HIUSER 0xffffffff
242 #define SHF_WRITE 0x1
243 #define SHF_ALLOC 0x2
244 #define SHF_EXECINSTR 0x4
245 #define SHF_RELA_LIVEPATCH 0x00100000
246 #define SHF_RO_AFTER_INIT 0x00200000
247 #define SHF_MASKPROC 0xf0000000
248 #define SHN_UNDEF 0
249 #define SHN_LORESERVE 0xff00
250 #define SHN_LOPROC 0xff00
251 #define SHN_HIPROC 0xff1f
252 #define SHN_LIVEPATCH 0xff20
253 #define SHN_ABS 0xfff1
254 #define SHN_COMMON 0xfff2
255 #define SHN_HIRESERVE 0xffff
256 typedef struct elf32_shdr {
257   Elf32_Word sh_name;
258   Elf32_Word sh_type;
259   Elf32_Word sh_flags;
260   Elf32_Addr sh_addr;
261   Elf32_Off sh_offset;
262   Elf32_Word sh_size;
263   Elf32_Word sh_link;
264   Elf32_Word sh_info;
265   Elf32_Word sh_addralign;
266   Elf32_Word sh_entsize;
267 } Elf32_Shdr;
268 typedef struct elf64_shdr {
269   Elf64_Word sh_name;
270   Elf64_Word sh_type;
271   Elf64_Xword sh_flags;
272   Elf64_Addr sh_addr;
273   Elf64_Off sh_offset;
274   Elf64_Xword sh_size;
275   Elf64_Word sh_link;
276   Elf64_Word sh_info;
277   Elf64_Xword sh_addralign;
278   Elf64_Xword sh_entsize;
279 } Elf64_Shdr;
280 #define EI_MAG0 0
281 #define EI_MAG1 1
282 #define EI_MAG2 2
283 #define EI_MAG3 3
284 #define EI_CLASS 4
285 #define EI_DATA 5
286 #define EI_VERSION 6
287 #define EI_OSABI 7
288 #define EI_PAD 8
289 #define ELFMAG0 0x7f
290 #define ELFMAG1 'E'
291 #define ELFMAG2 'L'
292 #define ELFMAG3 'F'
293 #define ELFMAG "\177ELF"
294 #define SELFMAG 4
295 #define ELFCLASSNONE 0
296 #define ELFCLASS32 1
297 #define ELFCLASS64 2
298 #define ELFCLASSNUM 3
299 #define ELFDATANONE 0
300 #define ELFDATA2LSB 1
301 #define ELFDATA2MSB 2
302 #define EV_NONE 0
303 #define EV_CURRENT 1
304 #define EV_NUM 2
305 #define ELFOSABI_NONE 0
306 #define ELFOSABI_LINUX 3
307 #ifndef ELF_OSABI
308 #define ELF_OSABI ELFOSABI_NONE
309 #endif
310 #define NT_PRSTATUS 1
311 #define NT_PRFPREG 2
312 #define NT_PRPSINFO 3
313 #define NT_TASKSTRUCT 4
314 #define NT_AUXV 6
315 #define NT_SIGINFO 0x53494749
316 #define NT_FILE 0x46494c45
317 #define NT_PRXFPREG 0x46e62b7f
318 #define NT_PPC_VMX 0x100
319 #define NT_PPC_SPE 0x101
320 #define NT_PPC_VSX 0x102
321 #define NT_PPC_TAR 0x103
322 #define NT_PPC_PPR 0x104
323 #define NT_PPC_DSCR 0x105
324 #define NT_PPC_EBB 0x106
325 #define NT_PPC_PMU 0x107
326 #define NT_PPC_TM_CGPR 0x108
327 #define NT_PPC_TM_CFPR 0x109
328 #define NT_PPC_TM_CVMX 0x10a
329 #define NT_PPC_TM_CVSX 0x10b
330 #define NT_PPC_TM_SPR 0x10c
331 #define NT_PPC_TM_CTAR 0x10d
332 #define NT_PPC_TM_CPPR 0x10e
333 #define NT_PPC_TM_CDSCR 0x10f
334 #define NT_PPC_PKEY 0x110
335 #define NT_386_TLS 0x200
336 #define NT_386_IOPERM 0x201
337 #define NT_X86_XSTATE 0x202
338 #define NT_S390_HIGH_GPRS 0x300
339 #define NT_S390_TIMER 0x301
340 #define NT_S390_TODCMP 0x302
341 #define NT_S390_TODPREG 0x303
342 #define NT_S390_CTRS 0x304
343 #define NT_S390_PREFIX 0x305
344 #define NT_S390_LAST_BREAK 0x306
345 #define NT_S390_SYSTEM_CALL 0x307
346 #define NT_S390_TDB 0x308
347 #define NT_S390_VXRS_LOW 0x309
348 #define NT_S390_VXRS_HIGH 0x30a
349 #define NT_S390_GS_CB 0x30b
350 #define NT_S390_GS_BC 0x30c
351 #define NT_S390_RI_CB 0x30d
352 #define NT_ARM_VFP 0x400
353 #define NT_ARM_TLS 0x401
354 #define NT_ARM_HW_BREAK 0x402
355 #define NT_ARM_HW_WATCH 0x403
356 #define NT_ARM_SYSTEM_CALL 0x404
357 #define NT_ARM_SVE 0x405
358 #define NT_ARM_PAC_MASK 0x406
359 #define NT_ARC_V2 0x600
360 #define NT_VMCOREDD 0x700
361 #define NT_MIPS_DSP 0x800
362 #define NT_MIPS_FP_MODE 0x801
363 #define NT_MIPS_MSA 0x802
364 typedef struct elf32_note {
365   Elf32_Word n_namesz;
366   Elf32_Word n_descsz;
367   Elf32_Word n_type;
368 } Elf32_Nhdr;
369 typedef struct elf64_note {
370   Elf64_Word n_namesz;
371   Elf64_Word n_descsz;
372   Elf64_Word n_type;
373 } Elf64_Nhdr;
374 #endif
375