1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_LINUX_ELF_H
3 #define _UAPI_LINUX_ELF_H
4 
5 #include <linux/types.h>
6 #include <linux/elf-em.h>
7 
8 /* 32-bit ELF base types. */
9 typedef __u32	Elf32_Addr;
10 typedef __u16	Elf32_Half;
11 typedef __u32	Elf32_Off;
12 typedef __s32	Elf32_Sword;
13 typedef __u32	Elf32_Word;
14 typedef __u16	Elf32_Versym;
15 
16 /* 64-bit ELF base types. */
17 typedef __u64	Elf64_Addr;
18 typedef __u16	Elf64_Half;
19 typedef __s16	Elf64_SHalf;
20 typedef __u64	Elf64_Off;
21 typedef __s32	Elf64_Sword;
22 typedef __u32	Elf64_Word;
23 typedef __u64	Elf64_Xword;
24 typedef __s64	Elf64_Sxword;
25 typedef __u16	Elf64_Versym;
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	(PT_LOOS + 0x474e550)
41 #define PT_GNU_STACK	(PT_LOOS + 0x474e551)
42 #define PT_GNU_RELRO	(PT_LOOS + 0x474e552)
43 #define PT_GNU_PROPERTY	(PT_LOOS + 0x474e553)
44 
45 
46 /* ARM MTE memory tag segment type */
47 #define PT_AARCH64_MEMTAG_MTE	(PT_LOPROC + 0x2)
48 
49 /*
50  * Extended Numbering
51  *
52  * If the real number of program header table entries is larger than
53  * or equal to PN_XNUM(0xffff), it is set to sh_info field of the
54  * section header at index 0, and PN_XNUM is set to e_phnum
55  * field. Otherwise, the section header at index 0 is zero
56  * initialized, if it exists.
57  *
58  * Specifications are available in:
59  *
60  * - Oracle: Linker and Libraries.
61  *   Part No: 817–1984–19, August 2011.
62  *   https://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf
63  *
64  * - System V ABI AMD64 Architecture Processor Supplement
65  *   Draft Version 0.99.4,
66  *   January 13, 2010.
67  *   http://www.cs.washington.edu/education/courses/cse351/12wi/supp-docs/abi.pdf
68  */
69 #define PN_XNUM 0xffff
70 
71 /* These constants define the different elf file types */
72 #define ET_NONE   0
73 #define ET_REL    1
74 #define ET_EXEC   2
75 #define ET_DYN    3
76 #define ET_CORE   4
77 #define ET_LOPROC 0xff00
78 #define ET_HIPROC 0xffff
79 
80 /* This is the info that is needed to parse the dynamic section of the file */
81 #define DT_NULL		0
82 #define DT_NEEDED	1
83 #define DT_PLTRELSZ	2
84 #define DT_PLTGOT	3
85 #define DT_HASH		4
86 #define DT_STRTAB	5
87 #define DT_SYMTAB	6
88 #define DT_RELA		7
89 #define DT_RELASZ	8
90 #define DT_RELAENT	9
91 #define DT_STRSZ	10
92 #define DT_SYMENT	11
93 #define DT_INIT		12
94 #define DT_FINI		13
95 #define DT_SONAME	14
96 #define DT_RPATH	15
97 #define DT_SYMBOLIC	16
98 #define DT_REL	        17
99 #define DT_RELSZ	18
100 #define DT_RELENT	19
101 #define DT_PLTREL	20
102 #define DT_DEBUG	21
103 #define DT_TEXTREL	22
104 #define DT_JMPREL	23
105 #define DT_ENCODING	32
106 #define OLD_DT_LOOS	0x60000000
107 #define DT_LOOS		0x6000000d
108 #define DT_HIOS		0x6ffff000
109 #define DT_VALRNGLO	0x6ffffd00
110 #define DT_VALRNGHI	0x6ffffdff
111 #define DT_ADDRRNGLO	0x6ffffe00
112 #define DT_GNU_HASH	0x6ffffef5
113 #define DT_ADDRRNGHI	0x6ffffeff
114 #define DT_VERSYM	0x6ffffff0
115 #define DT_RELACOUNT	0x6ffffff9
116 #define DT_RELCOUNT	0x6ffffffa
117 #define DT_FLAGS_1	0x6ffffffb
118 #define DT_VERDEF	0x6ffffffc
119 #define	DT_VERDEFNUM	0x6ffffffd
120 #define DT_VERNEED	0x6ffffffe
121 #define	DT_VERNEEDNUM	0x6fffffff
122 #define OLD_DT_HIOS     0x6fffffff
123 #define DT_LOPROC	0x70000000
124 #define DT_HIPROC	0x7fffffff
125 
126 /* This info is needed when parsing the symbol table */
127 #define STB_LOCAL  0
128 #define STB_GLOBAL 1
129 #define STB_WEAK   2
130 
131 #define STN_UNDEF 0
132 
133 #define STT_NOTYPE  0
134 #define STT_OBJECT  1
135 #define STT_FUNC    2
136 #define STT_SECTION 3
137 #define STT_FILE    4
138 #define STT_COMMON  5
139 #define STT_TLS     6
140 
141 #define VER_FLG_BASE 0x1
142 #define VER_FLG_WEAK 0x2
143 
144 #define ELF_ST_BIND(x)		((x) >> 4)
145 #define ELF_ST_TYPE(x)		((x) & 0xf)
146 #define ELF32_ST_BIND(x)	ELF_ST_BIND(x)
147 #define ELF32_ST_TYPE(x)	ELF_ST_TYPE(x)
148 #define ELF64_ST_BIND(x)	ELF_ST_BIND(x)
149 #define ELF64_ST_TYPE(x)	ELF_ST_TYPE(x)
150 
151 typedef struct {
152   Elf32_Sword d_tag;
153   union {
154     Elf32_Sword	d_val;
155     Elf32_Addr	d_ptr;
156   } d_un;
157 } Elf32_Dyn;
158 
159 typedef struct {
160   Elf64_Sxword d_tag;		/* entry tag value */
161   union {
162     Elf64_Xword d_val;
163     Elf64_Addr d_ptr;
164   } d_un;
165 } Elf64_Dyn;
166 
167 /* The following are used with relocations */
168 #define ELF32_R_SYM(x) ((x) >> 8)
169 #define ELF32_R_TYPE(x) ((x) & 0xff)
170 
171 #define ELF64_R_SYM(i)			((i) >> 32)
172 #define ELF64_R_TYPE(i)			((i) & 0xffffffff)
173 
174 typedef struct elf32_rel {
175   Elf32_Addr	r_offset;
176   Elf32_Word	r_info;
177 } Elf32_Rel;
178 
179 typedef struct elf64_rel {
180   Elf64_Addr r_offset;	/* Location at which to apply the action */
181   Elf64_Xword r_info;	/* index and type of relocation */
182 } Elf64_Rel;
183 
184 typedef struct elf32_rela {
185   Elf32_Addr	r_offset;
186   Elf32_Word	r_info;
187   Elf32_Sword	r_addend;
188 } Elf32_Rela;
189 
190 typedef struct elf64_rela {
191   Elf64_Addr r_offset;	/* Location at which to apply the action */
192   Elf64_Xword r_info;	/* index and type of relocation */
193   Elf64_Sxword r_addend;	/* Constant addend used to compute value */
194 } Elf64_Rela;
195 
196 typedef struct elf32_sym {
197   Elf32_Word	st_name;
198   Elf32_Addr	st_value;
199   Elf32_Word	st_size;
200   unsigned char	st_info;
201   unsigned char	st_other;
202   Elf32_Half	st_shndx;
203 } Elf32_Sym;
204 
205 typedef struct elf64_sym {
206   Elf64_Word st_name;		/* Symbol name, index in string tbl */
207   unsigned char	st_info;	/* Type and binding attributes */
208   unsigned char	st_other;	/* No defined meaning, 0 */
209   Elf64_Half st_shndx;		/* Associated section index */
210   Elf64_Addr st_value;		/* Value of the symbol */
211   Elf64_Xword st_size;		/* Associated symbol size */
212 } Elf64_Sym;
213 
214 
215 #define EI_NIDENT	16
216 
217 typedef struct elf32_hdr {
218   unsigned char	e_ident[EI_NIDENT];
219   Elf32_Half	e_type;
220   Elf32_Half	e_machine;
221   Elf32_Word	e_version;
222   Elf32_Addr	e_entry;  /* Entry point */
223   Elf32_Off	e_phoff;
224   Elf32_Off	e_shoff;
225   Elf32_Word	e_flags;
226   Elf32_Half	e_ehsize;
227   Elf32_Half	e_phentsize;
228   Elf32_Half	e_phnum;
229   Elf32_Half	e_shentsize;
230   Elf32_Half	e_shnum;
231   Elf32_Half	e_shstrndx;
232 } Elf32_Ehdr;
233 
234 typedef struct elf64_hdr {
235   unsigned char	e_ident[EI_NIDENT];	/* ELF "magic number" */
236   Elf64_Half e_type;
237   Elf64_Half e_machine;
238   Elf64_Word e_version;
239   Elf64_Addr e_entry;		/* Entry point virtual address */
240   Elf64_Off e_phoff;		/* Program header table file offset */
241   Elf64_Off e_shoff;		/* Section header table file offset */
242   Elf64_Word e_flags;
243   Elf64_Half e_ehsize;
244   Elf64_Half e_phentsize;
245   Elf64_Half e_phnum;
246   Elf64_Half e_shentsize;
247   Elf64_Half e_shnum;
248   Elf64_Half e_shstrndx;
249 } Elf64_Ehdr;
250 
251 /* These constants define the permissions on sections in the program
252    header, p_flags. */
253 #define PF_R		0x4
254 #define PF_W		0x2
255 #define PF_X		0x1
256 
257 typedef struct elf32_phdr {
258   Elf32_Word	p_type;
259   Elf32_Off	p_offset;
260   Elf32_Addr	p_vaddr;
261   Elf32_Addr	p_paddr;
262   Elf32_Word	p_filesz;
263   Elf32_Word	p_memsz;
264   Elf32_Word	p_flags;
265   Elf32_Word	p_align;
266 } Elf32_Phdr;
267 
268 typedef struct elf64_phdr {
269   Elf64_Word p_type;
270   Elf64_Word p_flags;
271   Elf64_Off p_offset;		/* Segment file offset */
272   Elf64_Addr p_vaddr;		/* Segment virtual address */
273   Elf64_Addr p_paddr;		/* Segment physical address */
274   Elf64_Xword p_filesz;		/* Segment size in file */
275   Elf64_Xword p_memsz;		/* Segment size in memory */
276   Elf64_Xword p_align;		/* Segment alignment, file & memory */
277 } Elf64_Phdr;
278 
279 /* sh_type */
280 #define SHT_NULL	0
281 #define SHT_PROGBITS	1
282 #define SHT_SYMTAB	2
283 #define SHT_STRTAB	3
284 #define SHT_RELA	4
285 #define SHT_HASH	5
286 #define SHT_DYNAMIC	6
287 #define SHT_NOTE	7
288 #define SHT_NOBITS	8
289 #define SHT_REL		9
290 #define SHT_SHLIB	10
291 #define SHT_DYNSYM	11
292 #define SHT_NUM		12
293 #define SHT_LOPROC	0x70000000
294 #define SHT_HIPROC	0x7fffffff
295 #define SHT_LOUSER	0x80000000
296 #define SHT_HIUSER	0xffffffff
297 
298 /* sh_flags */
299 #define SHF_WRITE		0x1
300 #define SHF_ALLOC		0x2
301 #define SHF_EXECINSTR		0x4
302 #define SHF_MERGE		0x10
303 #define SHF_STRINGS		0x20
304 #define SHF_INFO_LINK		0x40
305 #define SHF_LINK_ORDER		0x80
306 #define SHF_OS_NONCONFORMING	0x100
307 #define SHF_GROUP		0x200
308 #define SHF_TLS			0x400
309 #define SHF_RELA_LIVEPATCH	0x00100000
310 #define SHF_RO_AFTER_INIT	0x00200000
311 #define SHF_ORDERED		0x04000000
312 #define SHF_EXCLUDE		0x08000000
313 #define SHF_MASKOS		0x0ff00000
314 #define SHF_MASKPROC		0xf0000000
315 
316 /* special section indexes */
317 #define SHN_UNDEF	0
318 #define SHN_LORESERVE	0xff00
319 #define SHN_LOPROC	0xff00
320 #define SHN_HIPROC	0xff1f
321 #define SHN_LIVEPATCH	0xff20
322 #define SHN_ABS		0xfff1
323 #define SHN_COMMON	0xfff2
324 #define SHN_HIRESERVE	0xffff
325 
326 typedef struct elf32_shdr {
327   Elf32_Word	sh_name;
328   Elf32_Word	sh_type;
329   Elf32_Word	sh_flags;
330   Elf32_Addr	sh_addr;
331   Elf32_Off	sh_offset;
332   Elf32_Word	sh_size;
333   Elf32_Word	sh_link;
334   Elf32_Word	sh_info;
335   Elf32_Word	sh_addralign;
336   Elf32_Word	sh_entsize;
337 } Elf32_Shdr;
338 
339 typedef struct elf64_shdr {
340   Elf64_Word sh_name;		/* Section name, index in string tbl */
341   Elf64_Word sh_type;		/* Type of section */
342   Elf64_Xword sh_flags;		/* Miscellaneous section attributes */
343   Elf64_Addr sh_addr;		/* Section virtual addr at execution */
344   Elf64_Off sh_offset;		/* Section file offset */
345   Elf64_Xword sh_size;		/* Size of section in bytes */
346   Elf64_Word sh_link;		/* Index of another section */
347   Elf64_Word sh_info;		/* Additional section information */
348   Elf64_Xword sh_addralign;	/* Section alignment */
349   Elf64_Xword sh_entsize;	/* Entry size if section holds table */
350 } Elf64_Shdr;
351 
352 #define	EI_MAG0		0		/* e_ident[] indexes */
353 #define	EI_MAG1		1
354 #define	EI_MAG2		2
355 #define	EI_MAG3		3
356 #define	EI_CLASS	4
357 #define	EI_DATA		5
358 #define	EI_VERSION	6
359 #define	EI_OSABI	7
360 #define	EI_PAD		8
361 
362 #define	ELFMAG0		0x7f		/* EI_MAG */
363 #define	ELFMAG1		'E'
364 #define	ELFMAG2		'L'
365 #define	ELFMAG3		'F'
366 #define	ELFMAG		"\177ELF"
367 #define	SELFMAG		4
368 
369 #define	ELFCLASSNONE	0		/* EI_CLASS */
370 #define	ELFCLASS32	1
371 #define	ELFCLASS64	2
372 #define	ELFCLASSNUM	3
373 
374 #define ELFDATANONE	0		/* e_ident[EI_DATA] */
375 #define ELFDATA2LSB	1
376 #define ELFDATA2MSB	2
377 
378 #define EV_NONE		0		/* e_version, EI_VERSION */
379 #define EV_CURRENT	1
380 #define EV_NUM		2
381 
382 #define ELFOSABI_NONE	0
383 #define ELFOSABI_LINUX	3
384 
385 #ifndef ELF_OSABI
386 #define ELF_OSABI ELFOSABI_NONE
387 #endif
388 
389 /* Note definitions: NN_ defines names. NT_ defines types. */
390 
391 #define NN_GNU_PROPERTY_TYPE_0	"GNU"
392 #define NT_GNU_PROPERTY_TYPE_0	5
393 
394 /*
395  * Notes used in ET_CORE. Architectures export some of the arch register sets
396  * using the corresponding note types via the PTRACE_GETREGSET and
397  * PTRACE_SETREGSET requests.
398  */
399 #define NN_PRSTATUS	"CORE"
400 #define NT_PRSTATUS	1
401 #define NN_PRFPREG	"CORE"
402 #define NT_PRFPREG	2
403 #define NN_PRPSINFO	"CORE"
404 #define NT_PRPSINFO	3
405 #define NN_TASKSTRUCT	"CORE"
406 #define NT_TASKSTRUCT	4
407 #define NN_AUXV		"CORE"
408 #define NT_AUXV		6
409 /*
410  * Note to userspace developers: size of NT_SIGINFO note may increase
411  * in the future to accomodate more fields, don't assume it is fixed!
412  */
413 #define NN_SIGINFO      "CORE"
414 #define NT_SIGINFO      0x53494749
415 #define NN_FILE         "CORE"
416 #define NT_FILE         0x46494c45
417 #define NN_PRXFPREG     "LINUX"
418 #define NT_PRXFPREG     0x46e62b7f      /* copied from gdb5.1/include/elf/common.h */
419 #define NN_PPC_VMX	"LINUX"
420 #define NT_PPC_VMX	0x100		/* PowerPC Altivec/VMX registers */
421 #define NN_PPC_SPE	"LINUX"
422 #define NT_PPC_SPE	0x101		/* PowerPC SPE/EVR registers */
423 #define NN_PPC_VSX	"LINUX"
424 #define NT_PPC_VSX	0x102		/* PowerPC VSX registers */
425 #define NN_PPC_TAR	"LINUX"
426 #define NT_PPC_TAR	0x103		/* Target Address Register */
427 #define NN_PPC_PPR	"LINUX"
428 #define NT_PPC_PPR	0x104		/* Program Priority Register */
429 #define NN_PPC_DSCR	"LINUX"
430 #define NT_PPC_DSCR	0x105		/* Data Stream Control Register */
431 #define NN_PPC_EBB	"LINUX"
432 #define NT_PPC_EBB	0x106		/* Event Based Branch Registers */
433 #define NN_PPC_PMU	"LINUX"
434 #define NT_PPC_PMU	0x107		/* Performance Monitor Registers */
435 #define NN_PPC_TM_CGPR	"LINUX"
436 #define NT_PPC_TM_CGPR	0x108		/* TM checkpointed GPR Registers */
437 #define NN_PPC_TM_CFPR	"LINUX"
438 #define NT_PPC_TM_CFPR	0x109		/* TM checkpointed FPR Registers */
439 #define NN_PPC_TM_CVMX	"LINUX"
440 #define NT_PPC_TM_CVMX	0x10a		/* TM checkpointed VMX Registers */
441 #define NN_PPC_TM_CVSX	"LINUX"
442 #define NT_PPC_TM_CVSX	0x10b		/* TM checkpointed VSX Registers */
443 #define NN_PPC_TM_SPR	"LINUX"
444 #define NT_PPC_TM_SPR	0x10c		/* TM Special Purpose Registers */
445 #define NN_PPC_TM_CTAR	"LINUX"
446 #define NT_PPC_TM_CTAR	0x10d		/* TM checkpointed Target Address Register */
447 #define NN_PPC_TM_CPPR	"LINUX"
448 #define NT_PPC_TM_CPPR	0x10e		/* TM checkpointed Program Priority Register */
449 #define NN_PPC_TM_CDSCR	"LINUX"
450 #define NT_PPC_TM_CDSCR	0x10f		/* TM checkpointed Data Stream Control Register */
451 #define NN_PPC_PKEY	"LINUX"
452 #define NT_PPC_PKEY	0x110		/* Memory Protection Keys registers */
453 #define NN_PPC_DEXCR	"LINUX"
454 #define NT_PPC_DEXCR	0x111		/* PowerPC DEXCR registers */
455 #define NN_PPC_HASHKEYR	"LINUX"
456 #define NT_PPC_HASHKEYR	0x112		/* PowerPC HASHKEYR register */
457 #define NN_386_TLS	"LINUX"
458 #define NT_386_TLS	0x200		/* i386 TLS slots (struct user_desc) */
459 #define NN_386_IOPERM	"LINUX"
460 #define NT_386_IOPERM	0x201		/* x86 io permission bitmap (1=deny) */
461 #define NN_X86_XSTATE	"LINUX"
462 #define NT_X86_XSTATE	0x202		/* x86 extended state using xsave */
463 /* Old binutils treats 0x203 as a CET state */
464 #define NN_X86_SHSTK	"LINUX"
465 #define NT_X86_SHSTK	0x204		/* x86 SHSTK state */
466 #define NN_X86_XSAVE_LAYOUT	"LINUX"
467 #define NT_X86_XSAVE_LAYOUT	0x205	/* XSAVE layout description */
468 #define NN_S390_HIGH_GPRS	"LINUX"
469 #define NT_S390_HIGH_GPRS	0x300	/* s390 upper register halves */
470 #define NN_S390_TIMER	"LINUX"
471 #define NT_S390_TIMER	0x301		/* s390 timer register */
472 #define NN_S390_TODCMP	"LINUX"
473 #define NT_S390_TODCMP	0x302		/* s390 TOD clock comparator register */
474 #define NN_S390_TODPREG	"LINUX"
475 #define NT_S390_TODPREG	0x303		/* s390 TOD programmable register */
476 #define NN_S390_CTRS	"LINUX"
477 #define NT_S390_CTRS	0x304		/* s390 control registers */
478 #define NN_S390_PREFIX	"LINUX"
479 #define NT_S390_PREFIX	0x305		/* s390 prefix register */
480 #define NN_S390_LAST_BREAK	"LINUX"
481 #define NT_S390_LAST_BREAK	0x306	/* s390 breaking event address */
482 #define NN_S390_SYSTEM_CALL	"LINUX"
483 #define NT_S390_SYSTEM_CALL	0x307	/* s390 system call restart data */
484 #define NN_S390_TDB	"LINUX"
485 #define NT_S390_TDB	0x308		/* s390 transaction diagnostic block */
486 #define NN_S390_VXRS_LOW	"LINUX"
487 #define NT_S390_VXRS_LOW	0x309	/* s390 vector registers 0-15 upper half */
488 #define NN_S390_VXRS_HIGH	"LINUX"
489 #define NT_S390_VXRS_HIGH	0x30a	/* s390 vector registers 16-31 */
490 #define NN_S390_GS_CB	"LINUX"
491 #define NT_S390_GS_CB	0x30b		/* s390 guarded storage registers */
492 #define NN_S390_GS_BC	"LINUX"
493 #define NT_S390_GS_BC	0x30c		/* s390 guarded storage broadcast control block */
494 #define NN_S390_RI_CB	"LINUX"
495 #define NT_S390_RI_CB	0x30d		/* s390 runtime instrumentation */
496 #define NN_S390_PV_CPU_DATA	"LINUX"
497 #define NT_S390_PV_CPU_DATA	0x30e	/* s390 protvirt cpu dump data */
498 #define NN_ARM_VFP	"LINUX"
499 #define NT_ARM_VFP	0x400		/* ARM VFP/NEON registers */
500 #define NN_ARM_TLS	"LINUX"
501 #define NT_ARM_TLS	0x401		/* ARM TLS register */
502 #define NN_ARM_HW_BREAK	"LINUX"
503 #define NT_ARM_HW_BREAK	0x402		/* ARM hardware breakpoint registers */
504 #define NN_ARM_HW_WATCH	"LINUX"
505 #define NT_ARM_HW_WATCH	0x403		/* ARM hardware watchpoint registers */
506 #define NN_ARM_SYSTEM_CALL	"LINUX"
507 #define NT_ARM_SYSTEM_CALL	0x404	/* ARM system call number */
508 #define NN_ARM_SVE	"LINUX"
509 #define NT_ARM_SVE	0x405		/* ARM Scalable Vector Extension registers */
510 #define NN_ARM_PAC_MASK		"LINUX"
511 #define NT_ARM_PAC_MASK		0x406	/* ARM pointer authentication code masks */
512 #define NN_ARM_PACA_KEYS	"LINUX"
513 #define NT_ARM_PACA_KEYS	0x407	/* ARM pointer authentication address keys */
514 #define NN_ARM_PACG_KEYS	"LINUX"
515 #define NT_ARM_PACG_KEYS	0x408	/* ARM pointer authentication generic key */
516 #define NN_ARM_TAGGED_ADDR_CTRL	"LINUX"
517 #define NT_ARM_TAGGED_ADDR_CTRL	0x409	/* arm64 tagged address control (prctl()) */
518 #define NN_ARM_PAC_ENABLED_KEYS	"LINUX"
519 #define NT_ARM_PAC_ENABLED_KEYS	0x40a	/* arm64 ptr auth enabled keys (prctl()) */
520 #define NN_ARM_SSVE	"LINUX"
521 #define NT_ARM_SSVE	0x40b		/* ARM Streaming SVE registers */
522 #define NN_ARM_ZA	"LINUX"
523 #define NT_ARM_ZA	0x40c		/* ARM SME ZA registers */
524 #define NN_ARM_ZT	"LINUX"
525 #define NT_ARM_ZT	0x40d		/* ARM SME ZT registers */
526 #define NN_ARM_FPMR	"LINUX"
527 #define NT_ARM_FPMR	0x40e		/* ARM floating point mode register */
528 #define NN_ARM_POE	"LINUX"
529 #define NT_ARM_POE	0x40f		/* ARM POE registers */
530 #define NN_ARM_GCS	"LINUX"
531 #define NT_ARM_GCS	0x410		/* ARM GCS state */
532 #define NN_ARC_V2	"LINUX"
533 #define NT_ARC_V2	0x600		/* ARCv2 accumulator/extra registers */
534 #define NN_VMCOREDD	"LINUX"
535 #define NT_VMCOREDD	0x700		/* Vmcore Device Dump Note */
536 #define NN_MIPS_DSP	"LINUX"
537 #define NT_MIPS_DSP	0x800		/* MIPS DSP ASE registers */
538 #define NN_MIPS_FP_MODE	"LINUX"
539 #define NT_MIPS_FP_MODE	0x801		/* MIPS floating-point mode */
540 #define NN_MIPS_MSA	"LINUX"
541 #define NT_MIPS_MSA	0x802		/* MIPS SIMD registers */
542 #define NN_RISCV_CSR	"LINUX"
543 #define NT_RISCV_CSR	0x900		/* RISC-V Control and Status Registers */
544 #define NN_RISCV_VECTOR	"LINUX"
545 #define NT_RISCV_VECTOR	0x901		/* RISC-V vector registers */
546 #define NN_RISCV_TAGGED_ADDR_CTRL "LINUX"
547 #define NT_RISCV_TAGGED_ADDR_CTRL 0x902	/* RISC-V tagged address control (prctl()) */
548 #define NN_LOONGARCH_CPUCFG	"LINUX"
549 #define NT_LOONGARCH_CPUCFG	0xa00	/* LoongArch CPU config registers */
550 #define NN_LOONGARCH_CSR	"LINUX"
551 #define NT_LOONGARCH_CSR	0xa01	/* LoongArch control and status registers */
552 #define NN_LOONGARCH_LSX	"LINUX"
553 #define NT_LOONGARCH_LSX	0xa02	/* LoongArch Loongson SIMD Extension registers */
554 #define NN_LOONGARCH_LASX	"LINUX"
555 #define NT_LOONGARCH_LASX	0xa03	/* LoongArch Loongson Advanced SIMD Extension registers */
556 #define NN_LOONGARCH_LBT	"LINUX"
557 #define NT_LOONGARCH_LBT	0xa04	/* LoongArch Loongson Binary Translation registers */
558 #define NN_LOONGARCH_HW_BREAK	"LINUX"
559 #define NT_LOONGARCH_HW_BREAK	0xa05   /* LoongArch hardware breakpoint registers */
560 #define NN_LOONGARCH_HW_WATCH	"LINUX"
561 #define NT_LOONGARCH_HW_WATCH	0xa06   /* LoongArch hardware watchpoint registers */
562 
563 /* Note header in a PT_NOTE section */
564 typedef struct elf32_note {
565   Elf32_Word	n_namesz;	/* Name size */
566   Elf32_Word	n_descsz;	/* Content size */
567   Elf32_Word	n_type;		/* Content type */
568 } Elf32_Nhdr;
569 
570 /* Note header in a PT_NOTE section */
571 typedef struct elf64_note {
572   Elf64_Word n_namesz;	/* Name size */
573   Elf64_Word n_descsz;	/* Content size */
574   Elf64_Word n_type;	/* Content type */
575 } Elf64_Nhdr;
576 
577 /* .note.gnu.property types for EM_AARCH64: */
578 #define GNU_PROPERTY_AARCH64_FEATURE_1_AND	0xc0000000
579 
580 /* Bits for GNU_PROPERTY_AARCH64_FEATURE_1_BTI */
581 #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI	(1U << 0)
582 
583 typedef struct {
584   Elf32_Half	vd_version;
585   Elf32_Half	vd_flags;
586   Elf32_Half	vd_ndx;
587   Elf32_Half	vd_cnt;
588   Elf32_Word	vd_hash;
589   Elf32_Word	vd_aux;
590   Elf32_Word	vd_next;
591 } Elf32_Verdef;
592 
593 typedef struct {
594   Elf64_Half	vd_version;
595   Elf64_Half	vd_flags;
596   Elf64_Half	vd_ndx;
597   Elf64_Half	vd_cnt;
598   Elf64_Word	vd_hash;
599   Elf64_Word	vd_aux;
600   Elf64_Word	vd_next;
601 } Elf64_Verdef;
602 
603 typedef struct {
604   Elf32_Word    vda_name;
605   Elf32_Word    vda_next;
606 } Elf32_Verdaux;
607 
608 typedef struct {
609   Elf64_Word    vda_name;
610   Elf64_Word    vda_next;
611 } Elf64_Verdaux;
612 
613 #endif /* _UAPI_LINUX_ELF_H */
614