xref: /linux/include/uapi/linux/elf.h (revision 00e19ceec80b03a43f626f891fcc53e57919f1b3)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells #ifndef _UAPI_LINUX_ELF_H
3607ca46eSDavid Howells #define _UAPI_LINUX_ELF_H
4607ca46eSDavid Howells 
5607ca46eSDavid Howells #include <linux/types.h>
6607ca46eSDavid Howells #include <linux/elf-em.h>
7607ca46eSDavid Howells 
8607ca46eSDavid Howells /* 32-bit ELF base types. */
9607ca46eSDavid Howells typedef __u32	Elf32_Addr;
10607ca46eSDavid Howells typedef __u16	Elf32_Half;
11607ca46eSDavid Howells typedef __u32	Elf32_Off;
12607ca46eSDavid Howells typedef __s32	Elf32_Sword;
13607ca46eSDavid Howells typedef __u32	Elf32_Word;
14607ca46eSDavid Howells 
15607ca46eSDavid Howells /* 64-bit ELF base types. */
16607ca46eSDavid Howells typedef __u64	Elf64_Addr;
17607ca46eSDavid Howells typedef __u16	Elf64_Half;
18607ca46eSDavid Howells typedef __s16	Elf64_SHalf;
19607ca46eSDavid Howells typedef __u64	Elf64_Off;
20607ca46eSDavid Howells typedef __s32	Elf64_Sword;
21607ca46eSDavid Howells typedef __u32	Elf64_Word;
22607ca46eSDavid Howells typedef __u64	Elf64_Xword;
23607ca46eSDavid Howells typedef __s64	Elf64_Sxword;
24607ca46eSDavid Howells 
25607ca46eSDavid Howells /* These constants are for the segment types stored in the image headers */
26607ca46eSDavid Howells #define PT_NULL    0
27607ca46eSDavid Howells #define PT_LOAD    1
28607ca46eSDavid Howells #define PT_DYNAMIC 2
29607ca46eSDavid Howells #define PT_INTERP  3
30607ca46eSDavid Howells #define PT_NOTE    4
31607ca46eSDavid Howells #define PT_SHLIB   5
32607ca46eSDavid Howells #define PT_PHDR    6
33607ca46eSDavid Howells #define PT_TLS     7               /* Thread local storage segment */
34607ca46eSDavid Howells #define PT_LOOS    0x60000000      /* OS-specific */
35607ca46eSDavid Howells #define PT_HIOS    0x6fffffff      /* OS-specific */
36607ca46eSDavid Howells #define PT_LOPROC  0x70000000
37607ca46eSDavid Howells #define PT_HIPROC  0x7fffffff
38607ca46eSDavid Howells #define PT_GNU_EH_FRAME		0x6474e550
39db751e30SDave Martin #define PT_GNU_PROPERTY		0x6474e553
40607ca46eSDavid Howells 
41607ca46eSDavid Howells #define PT_GNU_STACK	(PT_LOOS + 0x474e551)
42607ca46eSDavid Howells 
43607ca46eSDavid Howells /*
44607ca46eSDavid Howells  * Extended Numbering
45607ca46eSDavid Howells  *
46607ca46eSDavid Howells  * If the real number of program header table entries is larger than
47607ca46eSDavid Howells  * or equal to PN_XNUM(0xffff), it is set to sh_info field of the
48607ca46eSDavid Howells  * section header at index 0, and PN_XNUM is set to e_phnum
49607ca46eSDavid Howells  * field. Otherwise, the section header at index 0 is zero
50607ca46eSDavid Howells  * initialized, if it exists.
51607ca46eSDavid Howells  *
52607ca46eSDavid Howells  * Specifications are available in:
53607ca46eSDavid Howells  *
54242260fbSChristian Kujau  * - Oracle: Linker and Libraries.
55242260fbSChristian Kujau  *   Part No: 817–1984–19, August 2011.
56242260fbSChristian Kujau  *   http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf
57607ca46eSDavid Howells  *
58607ca46eSDavid Howells  * - System V ABI AMD64 Architecture Processor Supplement
59242260fbSChristian Kujau  *   Draft Version 0.99.4,
60242260fbSChristian Kujau  *   January 13, 2010.
61242260fbSChristian Kujau  *   http://www.cs.washington.edu/education/courses/cse351/12wi/supp-docs/abi.pdf
62607ca46eSDavid Howells  */
63607ca46eSDavid Howells #define PN_XNUM 0xffff
64607ca46eSDavid Howells 
65607ca46eSDavid Howells /* These constants define the different elf file types */
66607ca46eSDavid Howells #define ET_NONE   0
67607ca46eSDavid Howells #define ET_REL    1
68607ca46eSDavid Howells #define ET_EXEC   2
69607ca46eSDavid Howells #define ET_DYN    3
70607ca46eSDavid Howells #define ET_CORE   4
71607ca46eSDavid Howells #define ET_LOPROC 0xff00
72607ca46eSDavid Howells #define ET_HIPROC 0xffff
73607ca46eSDavid Howells 
74607ca46eSDavid Howells /* This is the info that is needed to parse the dynamic section of the file */
75607ca46eSDavid Howells #define DT_NULL		0
76607ca46eSDavid Howells #define DT_NEEDED	1
77607ca46eSDavid Howells #define DT_PLTRELSZ	2
78607ca46eSDavid Howells #define DT_PLTGOT	3
79607ca46eSDavid Howells #define DT_HASH		4
80607ca46eSDavid Howells #define DT_STRTAB	5
81607ca46eSDavid Howells #define DT_SYMTAB	6
82607ca46eSDavid Howells #define DT_RELA		7
83607ca46eSDavid Howells #define DT_RELASZ	8
84607ca46eSDavid Howells #define DT_RELAENT	9
85607ca46eSDavid Howells #define DT_STRSZ	10
86607ca46eSDavid Howells #define DT_SYMENT	11
87607ca46eSDavid Howells #define DT_INIT		12
88607ca46eSDavid Howells #define DT_FINI		13
89607ca46eSDavid Howells #define DT_SONAME	14
90607ca46eSDavid Howells #define DT_RPATH 	15
91607ca46eSDavid Howells #define DT_SYMBOLIC	16
92607ca46eSDavid Howells #define DT_REL	        17
93607ca46eSDavid Howells #define DT_RELSZ	18
94607ca46eSDavid Howells #define DT_RELENT	19
95607ca46eSDavid Howells #define DT_PLTREL	20
96607ca46eSDavid Howells #define DT_DEBUG	21
97607ca46eSDavid Howells #define DT_TEXTREL	22
98607ca46eSDavid Howells #define DT_JMPREL	23
99607ca46eSDavid Howells #define DT_ENCODING	32
100607ca46eSDavid Howells #define OLD_DT_LOOS	0x60000000
101607ca46eSDavid Howells #define DT_LOOS		0x6000000d
102607ca46eSDavid Howells #define DT_HIOS		0x6ffff000
103607ca46eSDavid Howells #define DT_VALRNGLO	0x6ffffd00
104607ca46eSDavid Howells #define DT_VALRNGHI	0x6ffffdff
105607ca46eSDavid Howells #define DT_ADDRRNGLO	0x6ffffe00
106607ca46eSDavid Howells #define DT_ADDRRNGHI	0x6ffffeff
107607ca46eSDavid Howells #define DT_VERSYM	0x6ffffff0
108607ca46eSDavid Howells #define DT_RELACOUNT	0x6ffffff9
109607ca46eSDavid Howells #define DT_RELCOUNT	0x6ffffffa
110607ca46eSDavid Howells #define DT_FLAGS_1	0x6ffffffb
111607ca46eSDavid Howells #define DT_VERDEF	0x6ffffffc
112607ca46eSDavid Howells #define	DT_VERDEFNUM	0x6ffffffd
113607ca46eSDavid Howells #define DT_VERNEED	0x6ffffffe
114607ca46eSDavid Howells #define	DT_VERNEEDNUM	0x6fffffff
115607ca46eSDavid Howells #define OLD_DT_HIOS     0x6fffffff
116607ca46eSDavid Howells #define DT_LOPROC	0x70000000
117607ca46eSDavid Howells #define DT_HIPROC	0x7fffffff
118607ca46eSDavid Howells 
119607ca46eSDavid Howells /* This info is needed when parsing the symbol table */
120607ca46eSDavid Howells #define STB_LOCAL  0
121607ca46eSDavid Howells #define STB_GLOBAL 1
122607ca46eSDavid Howells #define STB_WEAK   2
123607ca46eSDavid Howells 
124607ca46eSDavid Howells #define STT_NOTYPE  0
125607ca46eSDavid Howells #define STT_OBJECT  1
126607ca46eSDavid Howells #define STT_FUNC    2
127607ca46eSDavid Howells #define STT_SECTION 3
128607ca46eSDavid Howells #define STT_FILE    4
129607ca46eSDavid Howells #define STT_COMMON  5
130607ca46eSDavid Howells #define STT_TLS     6
131607ca46eSDavid Howells 
132607ca46eSDavid Howells #define ELF_ST_BIND(x)		((x) >> 4)
133607ca46eSDavid Howells #define ELF_ST_TYPE(x)		(((unsigned int) x) & 0xf)
134607ca46eSDavid Howells #define ELF32_ST_BIND(x)	ELF_ST_BIND(x)
135607ca46eSDavid Howells #define ELF32_ST_TYPE(x)	ELF_ST_TYPE(x)
136607ca46eSDavid Howells #define ELF64_ST_BIND(x)	ELF_ST_BIND(x)
137607ca46eSDavid Howells #define ELF64_ST_TYPE(x)	ELF_ST_TYPE(x)
138607ca46eSDavid Howells 
139607ca46eSDavid Howells typedef struct dynamic{
140607ca46eSDavid Howells   Elf32_Sword d_tag;
141607ca46eSDavid Howells   union{
142607ca46eSDavid Howells     Elf32_Sword	d_val;
143607ca46eSDavid Howells     Elf32_Addr	d_ptr;
144607ca46eSDavid Howells   } d_un;
145607ca46eSDavid Howells } Elf32_Dyn;
146607ca46eSDavid Howells 
147607ca46eSDavid Howells typedef struct {
148607ca46eSDavid Howells   Elf64_Sxword d_tag;		/* entry tag value */
149607ca46eSDavid Howells   union {
150607ca46eSDavid Howells     Elf64_Xword d_val;
151607ca46eSDavid Howells     Elf64_Addr d_ptr;
152607ca46eSDavid Howells   } d_un;
153607ca46eSDavid Howells } Elf64_Dyn;
154607ca46eSDavid Howells 
155607ca46eSDavid Howells /* The following are used with relocations */
156607ca46eSDavid Howells #define ELF32_R_SYM(x) ((x) >> 8)
157607ca46eSDavid Howells #define ELF32_R_TYPE(x) ((x) & 0xff)
158607ca46eSDavid Howells 
159607ca46eSDavid Howells #define ELF64_R_SYM(i)			((i) >> 32)
160607ca46eSDavid Howells #define ELF64_R_TYPE(i)			((i) & 0xffffffff)
161607ca46eSDavid Howells 
162607ca46eSDavid Howells typedef struct elf32_rel {
163607ca46eSDavid Howells   Elf32_Addr	r_offset;
164607ca46eSDavid Howells   Elf32_Word	r_info;
165607ca46eSDavid Howells } Elf32_Rel;
166607ca46eSDavid Howells 
167607ca46eSDavid Howells typedef struct elf64_rel {
168607ca46eSDavid Howells   Elf64_Addr r_offset;	/* Location at which to apply the action */
169607ca46eSDavid Howells   Elf64_Xword r_info;	/* index and type of relocation */
170607ca46eSDavid Howells } Elf64_Rel;
171607ca46eSDavid Howells 
172607ca46eSDavid Howells typedef struct elf32_rela{
173607ca46eSDavid Howells   Elf32_Addr	r_offset;
174607ca46eSDavid Howells   Elf32_Word	r_info;
175607ca46eSDavid Howells   Elf32_Sword	r_addend;
176607ca46eSDavid Howells } Elf32_Rela;
177607ca46eSDavid Howells 
178607ca46eSDavid Howells typedef struct elf64_rela {
179607ca46eSDavid Howells   Elf64_Addr r_offset;	/* Location at which to apply the action */
180607ca46eSDavid Howells   Elf64_Xword r_info;	/* index and type of relocation */
181607ca46eSDavid Howells   Elf64_Sxword r_addend;	/* Constant addend used to compute value */
182607ca46eSDavid Howells } Elf64_Rela;
183607ca46eSDavid Howells 
184607ca46eSDavid Howells typedef struct elf32_sym{
185607ca46eSDavid Howells   Elf32_Word	st_name;
186607ca46eSDavid Howells   Elf32_Addr	st_value;
187607ca46eSDavid Howells   Elf32_Word	st_size;
188607ca46eSDavid Howells   unsigned char	st_info;
189607ca46eSDavid Howells   unsigned char	st_other;
190607ca46eSDavid Howells   Elf32_Half	st_shndx;
191607ca46eSDavid Howells } Elf32_Sym;
192607ca46eSDavid Howells 
193607ca46eSDavid Howells typedef struct elf64_sym {
194607ca46eSDavid Howells   Elf64_Word st_name;		/* Symbol name, index in string tbl */
195607ca46eSDavid Howells   unsigned char	st_info;	/* Type and binding attributes */
196607ca46eSDavid Howells   unsigned char	st_other;	/* No defined meaning, 0 */
197607ca46eSDavid Howells   Elf64_Half st_shndx;		/* Associated section index */
198607ca46eSDavid Howells   Elf64_Addr st_value;		/* Value of the symbol */
199607ca46eSDavid Howells   Elf64_Xword st_size;		/* Associated symbol size */
200607ca46eSDavid Howells } Elf64_Sym;
201607ca46eSDavid Howells 
202607ca46eSDavid Howells 
203607ca46eSDavid Howells #define EI_NIDENT	16
204607ca46eSDavid Howells 
205607ca46eSDavid Howells typedef struct elf32_hdr{
206607ca46eSDavid Howells   unsigned char	e_ident[EI_NIDENT];
207607ca46eSDavid Howells   Elf32_Half	e_type;
208607ca46eSDavid Howells   Elf32_Half	e_machine;
209607ca46eSDavid Howells   Elf32_Word	e_version;
210607ca46eSDavid Howells   Elf32_Addr	e_entry;  /* Entry point */
211607ca46eSDavid Howells   Elf32_Off	e_phoff;
212607ca46eSDavid Howells   Elf32_Off	e_shoff;
213607ca46eSDavid Howells   Elf32_Word	e_flags;
214607ca46eSDavid Howells   Elf32_Half	e_ehsize;
215607ca46eSDavid Howells   Elf32_Half	e_phentsize;
216607ca46eSDavid Howells   Elf32_Half	e_phnum;
217607ca46eSDavid Howells   Elf32_Half	e_shentsize;
218607ca46eSDavid Howells   Elf32_Half	e_shnum;
219607ca46eSDavid Howells   Elf32_Half	e_shstrndx;
220607ca46eSDavid Howells } Elf32_Ehdr;
221607ca46eSDavid Howells 
222607ca46eSDavid Howells typedef struct elf64_hdr {
223607ca46eSDavid Howells   unsigned char	e_ident[EI_NIDENT];	/* ELF "magic number" */
224607ca46eSDavid Howells   Elf64_Half e_type;
225607ca46eSDavid Howells   Elf64_Half e_machine;
226607ca46eSDavid Howells   Elf64_Word e_version;
227607ca46eSDavid Howells   Elf64_Addr e_entry;		/* Entry point virtual address */
228607ca46eSDavid Howells   Elf64_Off e_phoff;		/* Program header table file offset */
229607ca46eSDavid Howells   Elf64_Off e_shoff;		/* Section header table file offset */
230607ca46eSDavid Howells   Elf64_Word e_flags;
231607ca46eSDavid Howells   Elf64_Half e_ehsize;
232607ca46eSDavid Howells   Elf64_Half e_phentsize;
233607ca46eSDavid Howells   Elf64_Half e_phnum;
234607ca46eSDavid Howells   Elf64_Half e_shentsize;
235607ca46eSDavid Howells   Elf64_Half e_shnum;
236607ca46eSDavid Howells   Elf64_Half e_shstrndx;
237607ca46eSDavid Howells } Elf64_Ehdr;
238607ca46eSDavid Howells 
239607ca46eSDavid Howells /* These constants define the permissions on sections in the program
240607ca46eSDavid Howells    header, p_flags. */
241607ca46eSDavid Howells #define PF_R		0x4
242607ca46eSDavid Howells #define PF_W		0x2
243607ca46eSDavid Howells #define PF_X		0x1
244607ca46eSDavid Howells 
245607ca46eSDavid Howells typedef struct elf32_phdr{
246607ca46eSDavid Howells   Elf32_Word	p_type;
247607ca46eSDavid Howells   Elf32_Off	p_offset;
248607ca46eSDavid Howells   Elf32_Addr	p_vaddr;
249607ca46eSDavid Howells   Elf32_Addr	p_paddr;
250607ca46eSDavid Howells   Elf32_Word	p_filesz;
251607ca46eSDavid Howells   Elf32_Word	p_memsz;
252607ca46eSDavid Howells   Elf32_Word	p_flags;
253607ca46eSDavid Howells   Elf32_Word	p_align;
254607ca46eSDavid Howells } Elf32_Phdr;
255607ca46eSDavid Howells 
256607ca46eSDavid Howells typedef struct elf64_phdr {
257607ca46eSDavid Howells   Elf64_Word p_type;
258607ca46eSDavid Howells   Elf64_Word p_flags;
259607ca46eSDavid Howells   Elf64_Off p_offset;		/* Segment file offset */
260607ca46eSDavid Howells   Elf64_Addr p_vaddr;		/* Segment virtual address */
261607ca46eSDavid Howells   Elf64_Addr p_paddr;		/* Segment physical address */
262607ca46eSDavid Howells   Elf64_Xword p_filesz;		/* Segment size in file */
263607ca46eSDavid Howells   Elf64_Xword p_memsz;		/* Segment size in memory */
264607ca46eSDavid Howells   Elf64_Xword p_align;		/* Segment alignment, file & memory */
265607ca46eSDavid Howells } Elf64_Phdr;
266607ca46eSDavid Howells 
267607ca46eSDavid Howells /* sh_type */
268607ca46eSDavid Howells #define SHT_NULL	0
269607ca46eSDavid Howells #define SHT_PROGBITS	1
270607ca46eSDavid Howells #define SHT_SYMTAB	2
271607ca46eSDavid Howells #define SHT_STRTAB	3
272607ca46eSDavid Howells #define SHT_RELA	4
273607ca46eSDavid Howells #define SHT_HASH	5
274607ca46eSDavid Howells #define SHT_DYNAMIC	6
275607ca46eSDavid Howells #define SHT_NOTE	7
276607ca46eSDavid Howells #define SHT_NOBITS	8
277607ca46eSDavid Howells #define SHT_REL		9
278607ca46eSDavid Howells #define SHT_SHLIB	10
279607ca46eSDavid Howells #define SHT_DYNSYM	11
280607ca46eSDavid Howells #define SHT_NUM		12
281607ca46eSDavid Howells #define SHT_LOPROC	0x70000000
282607ca46eSDavid Howells #define SHT_HIPROC	0x7fffffff
283607ca46eSDavid Howells #define SHT_LOUSER	0x80000000
284607ca46eSDavid Howells #define SHT_HIUSER	0xffffffff
285607ca46eSDavid Howells 
286607ca46eSDavid Howells /* sh_flags */
287607ca46eSDavid Howells #define SHF_WRITE		0x1
288607ca46eSDavid Howells #define SHF_ALLOC		0x2
289607ca46eSDavid Howells #define SHF_EXECINSTR		0x4
2908d98e96bSJessica Yu #define SHF_RELA_LIVEPATCH	0x00100000
291444d13ffSJessica Yu #define SHF_RO_AFTER_INIT	0x00200000
292607ca46eSDavid Howells #define SHF_MASKPROC		0xf0000000
293607ca46eSDavid Howells 
294607ca46eSDavid Howells /* special section indexes */
295607ca46eSDavid Howells #define SHN_UNDEF	0
296607ca46eSDavid Howells #define SHN_LORESERVE	0xff00
297607ca46eSDavid Howells #define SHN_LOPROC	0xff00
298607ca46eSDavid Howells #define SHN_HIPROC	0xff1f
2998d98e96bSJessica Yu #define SHN_LIVEPATCH	0xff20
300607ca46eSDavid Howells #define SHN_ABS		0xfff1
301607ca46eSDavid Howells #define SHN_COMMON	0xfff2
302607ca46eSDavid Howells #define SHN_HIRESERVE	0xffff
303607ca46eSDavid Howells 
304607ca46eSDavid Howells typedef struct elf32_shdr {
305607ca46eSDavid Howells   Elf32_Word	sh_name;
306607ca46eSDavid Howells   Elf32_Word	sh_type;
307607ca46eSDavid Howells   Elf32_Word	sh_flags;
308607ca46eSDavid Howells   Elf32_Addr	sh_addr;
309607ca46eSDavid Howells   Elf32_Off	sh_offset;
310607ca46eSDavid Howells   Elf32_Word	sh_size;
311607ca46eSDavid Howells   Elf32_Word	sh_link;
312607ca46eSDavid Howells   Elf32_Word	sh_info;
313607ca46eSDavid Howells   Elf32_Word	sh_addralign;
314607ca46eSDavid Howells   Elf32_Word	sh_entsize;
315607ca46eSDavid Howells } Elf32_Shdr;
316607ca46eSDavid Howells 
317607ca46eSDavid Howells typedef struct elf64_shdr {
318607ca46eSDavid Howells   Elf64_Word sh_name;		/* Section name, index in string tbl */
319607ca46eSDavid Howells   Elf64_Word sh_type;		/* Type of section */
320607ca46eSDavid Howells   Elf64_Xword sh_flags;		/* Miscellaneous section attributes */
321607ca46eSDavid Howells   Elf64_Addr sh_addr;		/* Section virtual addr at execution */
322607ca46eSDavid Howells   Elf64_Off sh_offset;		/* Section file offset */
323607ca46eSDavid Howells   Elf64_Xword sh_size;		/* Size of section in bytes */
324607ca46eSDavid Howells   Elf64_Word sh_link;		/* Index of another section */
325607ca46eSDavid Howells   Elf64_Word sh_info;		/* Additional section information */
326607ca46eSDavid Howells   Elf64_Xword sh_addralign;	/* Section alignment */
327607ca46eSDavid Howells   Elf64_Xword sh_entsize;	/* Entry size if section holds table */
328607ca46eSDavid Howells } Elf64_Shdr;
329607ca46eSDavid Howells 
330607ca46eSDavid Howells #define	EI_MAG0		0		/* e_ident[] indexes */
331607ca46eSDavid Howells #define	EI_MAG1		1
332607ca46eSDavid Howells #define	EI_MAG2		2
333607ca46eSDavid Howells #define	EI_MAG3		3
334607ca46eSDavid Howells #define	EI_CLASS	4
335607ca46eSDavid Howells #define	EI_DATA		5
336607ca46eSDavid Howells #define	EI_VERSION	6
337607ca46eSDavid Howells #define	EI_OSABI	7
338607ca46eSDavid Howells #define	EI_PAD		8
339607ca46eSDavid Howells 
340607ca46eSDavid Howells #define	ELFMAG0		0x7f		/* EI_MAG */
341607ca46eSDavid Howells #define	ELFMAG1		'E'
342607ca46eSDavid Howells #define	ELFMAG2		'L'
343607ca46eSDavid Howells #define	ELFMAG3		'F'
344607ca46eSDavid Howells #define	ELFMAG		"\177ELF"
345607ca46eSDavid Howells #define	SELFMAG		4
346607ca46eSDavid Howells 
347607ca46eSDavid Howells #define	ELFCLASSNONE	0		/* EI_CLASS */
348607ca46eSDavid Howells #define	ELFCLASS32	1
349607ca46eSDavid Howells #define	ELFCLASS64	2
350607ca46eSDavid Howells #define	ELFCLASSNUM	3
351607ca46eSDavid Howells 
352607ca46eSDavid Howells #define ELFDATANONE	0		/* e_ident[EI_DATA] */
353607ca46eSDavid Howells #define ELFDATA2LSB	1
354607ca46eSDavid Howells #define ELFDATA2MSB	2
355607ca46eSDavid Howells 
356607ca46eSDavid Howells #define EV_NONE		0		/* e_version, EI_VERSION */
357607ca46eSDavid Howells #define EV_CURRENT	1
358607ca46eSDavid Howells #define EV_NUM		2
359607ca46eSDavid Howells 
360607ca46eSDavid Howells #define ELFOSABI_NONE	0
361607ca46eSDavid Howells #define ELFOSABI_LINUX	3
362607ca46eSDavid Howells 
363607ca46eSDavid Howells #ifndef ELF_OSABI
364607ca46eSDavid Howells #define ELF_OSABI ELFOSABI_NONE
365607ca46eSDavid Howells #endif
366607ca46eSDavid Howells 
367607ca46eSDavid Howells /*
368607ca46eSDavid Howells  * Notes used in ET_CORE. Architectures export some of the arch register sets
369607ca46eSDavid Howells  * using the corresponding note types via the PTRACE_GETREGSET and
370607ca46eSDavid Howells  * PTRACE_SETREGSET requests.
371*00e19ceeSDave Martin  * The note name for all these is "LINUX".
372607ca46eSDavid Howells  */
373607ca46eSDavid Howells #define NT_PRSTATUS	1
374607ca46eSDavid Howells #define NT_PRFPREG	2
375607ca46eSDavid Howells #define NT_PRPSINFO	3
376607ca46eSDavid Howells #define NT_TASKSTRUCT	4
377607ca46eSDavid Howells #define NT_AUXV		6
378607ca46eSDavid Howells /*
379607ca46eSDavid Howells  * Note to userspace developers: size of NT_SIGINFO note may increase
380607ca46eSDavid Howells  * in the future to accomodate more fields, don't assume it is fixed!
381607ca46eSDavid Howells  */
382607ca46eSDavid Howells #define NT_SIGINFO      0x53494749
383607ca46eSDavid Howells #define NT_FILE         0x46494c45
384607ca46eSDavid Howells #define NT_PRXFPREG     0x46e62b7f      /* copied from gdb5.1/include/elf/common.h */
385607ca46eSDavid Howells #define NT_PPC_VMX	0x100		/* PowerPC Altivec/VMX registers */
386607ca46eSDavid Howells #define NT_PPC_SPE	0x101		/* PowerPC SPE/EVR registers */
387607ca46eSDavid Howells #define NT_PPC_VSX	0x102		/* PowerPC VSX registers */
3880dc696bcSAnshuman Khandual #define NT_PPC_TAR	0x103		/* Target Address Register */
3890dc696bcSAnshuman Khandual #define NT_PPC_PPR	0x104		/* Program Priority Register */
3900dc696bcSAnshuman Khandual #define NT_PPC_DSCR	0x105		/* Data Stream Control Register */
3910dc696bcSAnshuman Khandual #define NT_PPC_EBB	0x106		/* Event Based Branch Registers */
3920dc696bcSAnshuman Khandual #define NT_PPC_PMU	0x107		/* Performance Monitor Registers */
3930dc696bcSAnshuman Khandual #define NT_PPC_TM_CGPR	0x108		/* TM checkpointed GPR Registers */
3940dc696bcSAnshuman Khandual #define NT_PPC_TM_CFPR	0x109		/* TM checkpointed FPR Registers */
3950dc696bcSAnshuman Khandual #define NT_PPC_TM_CVMX	0x10a		/* TM checkpointed VMX Registers */
3960dc696bcSAnshuman Khandual #define NT_PPC_TM_CVSX	0x10b		/* TM checkpointed VSX Registers */
3970dc696bcSAnshuman Khandual #define NT_PPC_TM_SPR	0x10c		/* TM Special Purpose Registers */
3980dc696bcSAnshuman Khandual #define NT_PPC_TM_CTAR	0x10d		/* TM checkpointed Target Address Register */
3990dc696bcSAnshuman Khandual #define NT_PPC_TM_CPPR	0x10e		/* TM checkpointed Program Priority Register */
4000dc696bcSAnshuman Khandual #define NT_PPC_TM_CDSCR	0x10f		/* TM checkpointed Data Stream Control Register */
401c5cc1f4dSThiago Jung Bauermann #define NT_PPC_PKEY	0x110		/* Memory Protection Keys registers */
402607ca46eSDavid Howells #define NT_386_TLS	0x200		/* i386 TLS slots (struct user_desc) */
403607ca46eSDavid Howells #define NT_386_IOPERM	0x201		/* x86 io permission bitmap (1=deny) */
404607ca46eSDavid Howells #define NT_X86_XSTATE	0x202		/* x86 extended state using xsave */
405607ca46eSDavid Howells #define NT_S390_HIGH_GPRS	0x300	/* s390 upper register halves */
406607ca46eSDavid Howells #define NT_S390_TIMER	0x301		/* s390 timer register */
407607ca46eSDavid Howells #define NT_S390_TODCMP	0x302		/* s390 TOD clock comparator register */
408607ca46eSDavid Howells #define NT_S390_TODPREG	0x303		/* s390 TOD programmable register */
409607ca46eSDavid Howells #define NT_S390_CTRS	0x304		/* s390 control registers */
410607ca46eSDavid Howells #define NT_S390_PREFIX	0x305		/* s390 prefix register */
411607ca46eSDavid Howells #define NT_S390_LAST_BREAK	0x306	/* s390 breaking event address */
412607ca46eSDavid Howells #define NT_S390_SYSTEM_CALL	0x307	/* s390 system call restart data */
413607ca46eSDavid Howells #define NT_S390_TDB	0x308		/* s390 transaction diagnostic block */
41480703617SMartin Schwidefsky #define NT_S390_VXRS_LOW	0x309	/* s390 vector registers 0-15 upper half */
41580703617SMartin Schwidefsky #define NT_S390_VXRS_HIGH	0x30a	/* s390 vector registers 16-31 */
416916cda1aSMartin Schwidefsky #define NT_S390_GS_CB	0x30b		/* s390 guarded storage registers */
417e525f8a6SMartin Schwidefsky #define NT_S390_GS_BC	0x30c		/* s390 guarded storage broadcast control block */
418262832bcSAlice Frosi #define NT_S390_RI_CB	0x30d		/* s390 runtime instrumentation */
419607ca46eSDavid Howells #define NT_ARM_VFP	0x400		/* ARM VFP/NEON registers */
420607ca46eSDavid Howells #define NT_ARM_TLS	0x401		/* ARM TLS register */
421607ca46eSDavid Howells #define NT_ARM_HW_BREAK	0x402		/* ARM hardware breakpoint registers */
422607ca46eSDavid Howells #define NT_ARM_HW_WATCH	0x403		/* ARM hardware watchpoint registers */
423766a85d7SAKASHI Takahiro #define NT_ARM_SYSTEM_CALL	0x404	/* ARM system call number */
42443d4da2cSDave Martin #define NT_ARM_SVE	0x405		/* ARM Scalable Vector Extension registers */
425ec6e822dSMark Rutland #define NT_ARM_PAC_MASK		0x406	/* ARM pointer authentication code masks */
426d0a060beSKristina Martsenko #define NT_ARM_PACA_KEYS	0x407	/* ARM pointer authentication address keys */
427d0a060beSKristina Martsenko #define NT_ARM_PACG_KEYS	0x408	/* ARM pointer authentication generic key */
428991c7ed6SVineet Gupta #define NT_ARC_V2	0x600		/* ARCv2 accumulator/extra registers */
4292724273eSRahul Lakkireddy #define NT_VMCOREDD	0x700		/* Vmcore Device Dump Note */
43044109c60SMaciej W. Rozycki #define NT_MIPS_DSP	0x800		/* MIPS DSP ASE registers */
4311ae22a0eSMaciej W. Rozycki #define NT_MIPS_FP_MODE	0x801		/* MIPS floating-point mode */
4323cd64083SPaul Burton #define NT_MIPS_MSA	0x802		/* MIPS SIMD registers */
433607ca46eSDavid Howells 
434*00e19ceeSDave Martin /* Note types with note name "GNU" */
435*00e19ceeSDave Martin #define NT_GNU_PROPERTY_TYPE_0	5
436*00e19ceeSDave Martin 
437607ca46eSDavid Howells /* Note header in a PT_NOTE section */
438607ca46eSDavid Howells typedef struct elf32_note {
439607ca46eSDavid Howells   Elf32_Word	n_namesz;	/* Name size */
440607ca46eSDavid Howells   Elf32_Word	n_descsz;	/* Content size */
441607ca46eSDavid Howells   Elf32_Word	n_type;		/* Content type */
442607ca46eSDavid Howells } Elf32_Nhdr;
443607ca46eSDavid Howells 
444607ca46eSDavid Howells /* Note header in a PT_NOTE section */
445607ca46eSDavid Howells typedef struct elf64_note {
446607ca46eSDavid Howells   Elf64_Word n_namesz;	/* Name size */
447607ca46eSDavid Howells   Elf64_Word n_descsz;	/* Content size */
448607ca46eSDavid Howells   Elf64_Word n_type;	/* Content type */
449607ca46eSDavid Howells } Elf64_Nhdr;
450607ca46eSDavid Howells 
451607ca46eSDavid Howells #endif /* _UAPI_LINUX_ELF_H */
452