xref: /illumos-gate/usr/src/uts/common/sys/elf.h (revision 56726c7e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
23  * Copyright (c) 2018, Joyent, Inc.
24  * Copyright 2022 Oxide Computer Company
25  */
26 /*
27  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
32 /*	  All Rights Reserved	*/
33 
34 
35 #ifndef _SYS_ELF_H
36 #define	_SYS_ELF_H
37 
38 #include <sys/elftypes.h>
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 #define	ELF32_FSZ_ADDR	4
45 #define	ELF32_FSZ_HALF	2
46 #define	ELF32_FSZ_OFF	4
47 #define	ELF32_FSZ_SWORD	4
48 #define	ELF32_FSZ_WORD	4
49 
50 #define	ELF64_FSZ_ADDR	8
51 #define	ELF64_FSZ_HALF	2
52 #define	ELF64_FSZ_OFF	8
53 #define	ELF64_FSZ_SWORD	4
54 #define	ELF64_FSZ_WORD	4
55 #define	ELF64_FSZ_SXWORD 8
56 #define	ELF64_FSZ_XWORD	8
57 
58 /*
59  *	"Enumerations" below use ...NUM as the number of
60  *	values in the list.  It should be 1 greater than the
61  *	highest "real" value.
62  */
63 
64 /*
65  *	ELF header
66  */
67 
68 #define	EI_NIDENT	16
69 
70 typedef struct {
71 	unsigned char	e_ident[EI_NIDENT];	/* ident bytes */
72 	Elf32_Half	e_type;			/* file type */
73 	Elf32_Half	e_machine;		/* target machine */
74 	Elf32_Word	e_version;		/* file version */
75 	Elf32_Addr	e_entry;		/* start address */
76 	Elf32_Off	e_phoff;		/* phdr file offset */
77 	Elf32_Off	e_shoff;		/* shdr file offset */
78 	Elf32_Word	e_flags;		/* file flags */
79 	Elf32_Half	e_ehsize;		/* sizeof ehdr */
80 	Elf32_Half	e_phentsize;		/* sizeof phdr */
81 	Elf32_Half	e_phnum;		/* number phdrs */
82 	Elf32_Half	e_shentsize;		/* sizeof shdr */
83 	Elf32_Half	e_shnum;		/* number shdrs */
84 	Elf32_Half	e_shstrndx;		/* shdr string index */
85 } Elf32_Ehdr;
86 
87 #if defined(_LP64) || defined(_LONGLONG_TYPE)
88 typedef struct {
89 	unsigned char	e_ident[EI_NIDENT];	/* ident bytes */
90 	Elf64_Half	e_type;			/* file type */
91 	Elf64_Half	e_machine;		/* target machine */
92 	Elf64_Word	e_version;		/* file version */
93 	Elf64_Addr	e_entry;		/* start address */
94 	Elf64_Off	e_phoff;		/* phdr file offset */
95 	Elf64_Off	e_shoff;		/* shdr file offset */
96 	Elf64_Word	e_flags;		/* file flags */
97 	Elf64_Half	e_ehsize;		/* sizeof ehdr */
98 	Elf64_Half	e_phentsize;		/* sizeof phdr */
99 	Elf64_Half	e_phnum;		/* number phdrs */
100 	Elf64_Half	e_shentsize;		/* sizeof shdr */
101 	Elf64_Half	e_shnum;		/* number shdrs */
102 	Elf64_Half	e_shstrndx;		/* shdr string index */
103 } Elf64_Ehdr;
104 #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
105 
106 
107 #define	EI_MAG0		0	/* e_ident[] indexes */
108 #define	EI_MAG1		1
109 #define	EI_MAG2		2
110 #define	EI_MAG3		3
111 #define	EI_CLASS	4	/* File class */
112 #define	EI_DATA		5	/* Data encoding */
113 #define	EI_VERSION	6	/* File version */
114 #define	EI_OSABI	7	/* Operating system/ABI identification */
115 #define	EI_ABIVERSION	8	/* ABI version */
116 #define	EI_PAD		9	/* Start of padding bytes */
117 
118 #define	ELFMAG0		0x7f		/* EI_MAG */
119 #define	ELFMAG1		'E'
120 #define	ELFMAG2		'L'
121 #define	ELFMAG3		'F'
122 #define	ELFMAG		"\177ELF"
123 #define	SELFMAG		4
124 
125 #define	ELFCLASSNONE	0		/* EI_CLASS */
126 #define	ELFCLASS32	1
127 #define	ELFCLASS64	2
128 #define	ELFCLASSNUM	3
129 
130 #define	ELFDATANONE	0		/* EI_DATA */
131 #define	ELFDATA2LSB	1
132 #define	ELFDATA2MSB	2
133 #define	ELFDATANUM	3
134 
135 #define	ET_NONE		0		/* e_type */
136 #define	ET_REL		1
137 #define	ET_EXEC		2
138 #define	ET_DYN		3
139 #define	ET_CORE		4
140 #define	ET_NUM		5
141 #define	ET_LOOS		0xfe00		/* OS specific range */
142 #define	ET_LOSUNW	0xfeff
143 #define	ET_SUNWPSEUDO	0xfeff
144 #define	ET_HISUNW	0xfeff
145 #define	ET_HIOS		0xfeff
146 #define	ET_LOPROC	0xff00		/* processor specific range */
147 #define	ET_HIPROC	0xffff
148 
149 #define	ET_LOPROC	0xff00		/* processor specific range */
150 #define	ET_HIPROC	0xffff
151 
152 #define	EM_NONE		0	/* e_machine */
153 #define	EM_M32		1	/* AT&T WE 32100 */
154 #define	EM_SPARC	2	/* Sun SPARC */
155 #define	EM_386		3	/* Intel 80386 */
156 #define	EM_68K		4	/* Motorola 68000 */
157 #define	EM_88K		5	/* Motorola 88000 */
158 #define	EM_486		6	/* Intel 80486 */
159 #define	EM_860		7	/* Intel i860 */
160 #define	EM_MIPS		8	/* MIPS RS3000 Big-Endian */
161 #define	EM_S370		9	/* IBM System/370 Processor */
162 #define	EM_MIPS_RS3_LE	10	/* MIPS RS3000 Little-Endian */
163 #define	EM_RS6000	11	/* RS6000 */
164 #define	EM_UNKNOWN12	12
165 #define	EM_UNKNOWN13	13
166 #define	EM_UNKNOWN14	14
167 #define	EM_PA_RISC	15	/* PA-RISC */
168 #define	EM_PARISC	EM_PA_RISC	/* Alias: GNU compatibility */
169 #define	EM_nCUBE	16	/* nCUBE */
170 #define	EM_VPP500	17	/* Fujitsu VPP500 */
171 #define	EM_SPARC32PLUS	18	/* Sun SPARC 32+ */
172 #define	EM_960		19	/* Intel 80960 */
173 #define	EM_PPC		20	/* PowerPC */
174 #define	EM_PPC64	21	/* 64-bit PowerPC */
175 #define	EM_S390		22	/* IBM System/390 Processor */
176 #define	EM_UNKNOWN22	EM_S390		/* Alias: Older published name */
177 #define	EM_UNKNOWN23	23
178 #define	EM_UNKNOWN24	24
179 #define	EM_UNKNOWN25	25
180 #define	EM_UNKNOWN26	26
181 #define	EM_UNKNOWN27	27
182 #define	EM_UNKNOWN28	28
183 #define	EM_UNKNOWN29	29
184 #define	EM_UNKNOWN30	30
185 #define	EM_UNKNOWN31	31
186 #define	EM_UNKNOWN32	32
187 #define	EM_UNKNOWN33	33
188 #define	EM_UNKNOWN34	34
189 #define	EM_UNKNOWN35	35
190 #define	EM_V800		36	/* NEX V800 */
191 #define	EM_FR20		37	/* Fujitsu FR20 */
192 #define	EM_RH32		38	/* TRW RH-32 */
193 #define	EM_RCE		39	/* Motorola RCE */
194 #define	EM_ARM		40	/* Advanced RISC Marchines ARM */
195 #define	EM_ALPHA	41	/* Digital Alpha */
196 #define	EM_SH		42	/* Hitachi SH */
197 #define	EM_SPARCV9	43	/* Sun SPARC V9 (64-bit) */
198 #define	EM_TRICORE	44	/* Siemens Tricore embedded processor */
199 #define	EM_ARC		45	/* Argonaut RISC Core, */
200 				/*	Argonaut Technologies Inc. */
201 #define	EM_H8_300	46	/* Hitachi H8/300 */
202 #define	EM_H8_300H	47	/* Hitachi H8/300H */
203 #define	EM_H8S		48	/* Hitachi H8S */
204 #define	EM_H8_500	49	/* Hitachi H8/500 */
205 #define	EM_IA_64	50	/* Intel IA64 */
206 #define	EM_MIPS_X	51	/* Stanford MIPS-X */
207 #define	EM_COLDFIRE	52	/* Motorola ColdFire */
208 #define	EM_68HC12	53	/* Motorola M68HC12 */
209 #define	EM_MMA		54	/* Fujitsu MMA Mulimedia Accelerator */
210 #define	EM_PCP		55	/* Siemens PCP */
211 #define	EM_NCPU		56	/* Sony nCPU embedded RISC processor */
212 #define	EM_NDR1		57	/* Denso NDR1 microprocessor */
213 #define	EM_STARCORE	58	/* Motorola Star*Core processor */
214 #define	EM_ME16		59	/* Toyota ME16 processor */
215 #define	EM_ST100	60	/* STMicroelectronics ST100 processor */
216 #define	EM_TINYJ	61	/* Advanced Logic Corp. TinyJ */
217 				/*	embedded processor family */
218 #define	EM_AMD64	62	/* AMDs x86-64 architecture */
219 #define	EM_X86_64	EM_AMD64	/* (compatibility) */
220 
221 #define	EM_PDSP		63	/* Sony DSP Processor */
222 #define	EM_UNKNOWN64	64
223 #define	EM_UNKNOWN65	65
224 #define	EM_FX66		66	/* Siemens FX66 microcontroller */
225 #define	EM_ST9PLUS	67	/* STMicroelectronics ST9+8/16 bit */
226 				/*	microcontroller */
227 #define	EM_ST7		68	/* STMicroelectronics ST7 8-bit */
228 				/*	microcontroller */
229 #define	EM_68HC16	69	/* Motorola MC68HC16 Microcontroller */
230 #define	EM_68HC11	70	/* Motorola MC68HC11 Microcontroller */
231 #define	EM_68HC08	71	/* Motorola MC68HC08 Microcontroller */
232 #define	EM_68HC05	72	/* Motorola MC68HC05 Microcontroller */
233 #define	EM_SVX		73	/* Silicon Graphics SVx */
234 #define	EM_ST19		74	/* STMicroelectronics ST19 8-bit */
235 				/*	microcontroller */
236 #define	EM_VAX		75	/* Digital VAX */
237 #define	EM_CRIS		76	/* Axis Communications 32-bit */
238 				/*	embedded processor */
239 #define	EM_JAVELIN	77	/* Infineon Technologies 32-bit */
240 				/*	embedded processor */
241 #define	EM_FIREPATH	78	/* Element 14 64-bit DSP Processor */
242 #define	EM_ZSP		79	/* LSI Logic 16-bit DSP Processor */
243 #define	EM_MMIX		80	/* Donald Knuth's educational */
244 				/*	64-bit processor */
245 #define	EM_HUANY	81	/* Harvard University */
246 				/*	machine-independent */
247 				/*	object files */
248 #define	EM_PRISM	82	/* SiTera Prism */
249 #define	EM_AVR		83	/* Atmel AVR 8-bit microcontroller */
250 #define	EM_FR30		84	/* Fujitsu FR30 */
251 #define	EM_D10V		85	/* Mitsubishi D10V */
252 #define	EM_D30V		86	/* Mitsubishi D30V */
253 #define	EM_V850		87	/* NEC v850 */
254 #define	EM_M32R		88	/* Mitsubishi M32R */
255 #define	EM_MN10300	89	/* Matsushita MN10300 */
256 #define	EM_MN10200	90	/* Matsushita MN10200 */
257 #define	EM_PJ		91	/* picoJava */
258 #define	EM_OPENRISC	92	/* OpenRISC 32-bit embedded processor */
259 #define	EM_ARC_A5	93	/* ARC Cores Tangent-A5 */
260 #define	EM_XTENSA	94	/* Tensilica Xtensa architecture */
261 
262 #define	EM_VIDEOCORE	95	/* Alphamosaic VideoCore processor */
263 #define	EM_TMM_GPP	96	/* Thompson Multimedia General Purpose */
264 				/* Processor */
265 #define	EM_NS32K	97	/* National Semiconductor 32000 series */
266 #define	EM_TPC		98	/* Tenor Network TPC processor */
267 #define	EM_SNP1K	99	/* Trebia SNP 1000 processor */
268 #define	EM_ST200	100	/* STMicroelectronics (www.st.com) ST200 */
269 				/* microcontroller */
270 #define	EM_IP2K		101	/* Ubicom IP2xxx microcontroller family */
271 #define	EM_MAX		102	/* MAX Processor */
272 #define	EM_CR		103	/* National Semiconductor CompactRISC */
273 				/* microprocessor */
274 #define	EM_F2MC16	104	/* Fujitsu F2MC16 */
275 #define	EM_MSP430	105	/* Texas Instruments embedded microcontroller */
276 				/* msp430 */
277 #define	EM_BLACKFIN	106	/* Analog Devices Blackfin (DSP) processor */
278 #define	EM_SE_C33	107	/* S1C33 Family of Seiko Epson processors */
279 #define	EM_SEP		108	/* Sharp embedded microprocessor */
280 #define	EM_ARCA		109	/* Arca RISC Microprocessor */
281 #define	EM_UNICORE	110	/* Microprocessor series from PKU-Unity Ltd. */
282 				/* and MPRC of Peking University */
283 #define	EM_EXCESS	111	/* eXcess: 16/32/64-bit configurable embedded */
284 				/* CPU */
285 #define	EM_DXP		112	/* Icera Semiconductor Inc. Deep Execution */
286 				/* Processor */
287 #define	EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
288 #define	EM_CRX		114	/* National Semiconductor CompactRISC CRX */
289 				/* microprocessor */
290 #define	EM_XGATE	115	/* Motorola XGATE embedded processor */
291 #define	EM_C166		116	/* Infineon C16x/XC16x processor */
292 #define	EM_M16C		117	/* Renesas M16C series microprocessors */
293 #define	EM_DSPIC30F	118	/* Microchip Technology dsPIC30F Digital */
294 				/* Signal Controller */
295 #define	EM_CE		119	/* Freescale Communication Engine RISC core */
296 #define	EM_M32C		120	/* Renesas M32C series microprocessors */
297 
298 #define	EM_TSK3000	131	/* Altium TSK3000 core */
299 #define	EM_RS08		132	/* Freescale RS08 embedded processor */
300 #define	EM_SHARC	133	/* Analog Devices SHARC family of 32-bit DSP */
301 				/* processors */
302 #define	EM_ECOG2	134	/* Cyan Technology eCOG2 microprocessor */
303 #define	EM_SCORE7	135	/* Sunplus S+core7 RISC processor */
304 #define	EM_DSP24	136	/* New Japan Radio (NJR) 24-bit DSP Processor */
305 #define	EM_VIDEOCORE3	137	/* Broadcom VideoCore III processor */
306 #define	EM_LATTICEMICO32	138	/* RISC processor for Lattice FPGA */
307 					/* architecture */
308 #define	EM_SE_C17	139	/* Seiko Epson C17 family */
309 #define	EM_TI_C6000	140	/* The Texas Instruments TMS320C6000 DSP */
310 				/* family */
311 #define	EM_TI_C2000	141	/* The Texas Instruments TMS320C2000 DSP */
312 				/* family */
313 #define	EM_TI_C5500	142	/* The Texas Instruments TMS320C55x DSP */
314 				/* family */
315 #define	EM_TI_ARP32	143	/* Texas Instruments Application Specific */
316 				/* RISC Processor, 32bit fetch */
317 #define	EM_TI_PRU	144	/* Texas Instruments Programmable Realtime */
318 				/* Unit */
319 
320 #define	EM_MMDSP_PLUS	160	/* STMicroelectronics 64bit VLIW Data Signal */
321 				/* Processor */
322 #define	EM_CYPRESS_M8C	161	/* Cypress M8C microprocessor */
323 #define	EM_R32C		162	/* Renesas R32C series microprocessors */
324 #define	EM_TRIMEDIA	163	/* NXP Semiconductors TriMedia architecture */
325 				/* family */
326 #define	EM_QDSP6	164	/* QUALCOMM DSP6 Processor */
327 #define	EM_8051		165	/* Intel 8051 and variants */
328 #define	EM_STXP7X	166	/* STMicroelectronics STxP7x family of */
329 				/* configurable and extensible RISC */
330 				/* processors */
331 #define	EM_NDS32	167	/* Andes Technology compact code size */
332 				/* embedded RISC processor family */
333 #define	EM_ECOG1	168	/* Cyan Technology eCOG1X family */
334 #define	EM_ECOG1X	EM_EC0G1X	/* Cyan Technology eCOG1X family */
335 #define	EM_MAXQ30	169	/* Dallas Semiconductor MAXQ30 Core */
336 				/* Micro-controllers */
337 #define	EM_XIMO16	170	/* New Japan Radio (NJR) 16-bit DSP Processor */
338 #define	EM_MANIK	171	/* M2000 Reconfigurable RISC Microprocessor */
339 #define	EM_CRAYNV2	172	/* Cray Inc. NV2 vector architecture */
340 #define	EM_RX		173	/* Renesas RX family */
341 #define	EM_METAG	174	/* Imagination Technologies META processor */
342 				/* architecture */
343 #define	EM_MCST_ELBRUS	175	/* MCST Elbrus general purpose hardware */
344 				/* architecture */
345 #define	EM_ECOG16	176	/* Cyan Technology eCOG16 family */
346 #define	EM_CR16		177	/* National Semiconductor CompactRISC */
347 				/* CR16 16-bit microprocessor */
348 #define	EM_ETPU		178	/* Freescale Extended Time Processing Unit */
349 #define	EM_SLE9X	179	/* Infineon Technologies SLE9X core */
350 #define	EM_L10M		180	/* Intel L10M */
351 #define	EM_K10M		181	/* Intel K10M */
352 
353 #define	EM_AARCH64	183	/* ARM 64-bit architecture (AARCH64) */
354 
355 #define	EM_AVR32	185	/* Atmel Corporation 32-bit microprocessor */
356 				/* family */
357 #define	EM_STM8		186	/* STMicroeletronics STM8 8-bit */
358 				/* microcontroller */
359 #define	EM_TILE64	187	/* Tilera TILE64 multicore architecture */
360 				/* family */
361 #define	EM_TILEPRO	188	/* Tilera TILEPro multicore architecture */
362 				/* family */
363 #define	EM_MICROBLAZE	189	/* Xilinx MicroBlaze 32-bit RISC soft */
364 				/* processor core */
365 #define	EM_CUDA		190	/* NVIDIA CUDA architecture */
366 #define	EM_TILEGX	191	/* Tilera TILE-Gx multicore architecture */
367 				/* family */
368 #define	EM_CLOUDSHIELD	192	/* CloudShield architecture family */
369 #define	EM_COREA_1ST	193	/* KIPO-KAIST Core-A 1st generation processor */
370 				/* family */
371 #define	EM_COREA_2ND	194	/* KIPO-KAIST Core-A 2nd generation processor */
372 				/* family */
373 #define	EM_ARC_COMPACT2	195	/* Synopsys ARCompact V2 */
374 #define	EM_OPEN8	196	/* Open8 8-bit RISC soft processor core */
375 #define	EM_RL78		197	/* Renesas RL78 family */
376 #define	EM_VIDEOCORE5	198	/* Broadcom VideoCore V processor */
377 #define	EM_78KOR	199	/* Renesas 78KOR family */
378 #define	EM_56800EX	200	/* Freescale 56800EX Digital Signal */
379 				/* Controller (DSC) */
380 #define	EM_BA1		201	/* Beyond BA1 CPU architecture */
381 #define	EM_BA2		202	/* Beyond BA2 CPU architecture */
382 #define	EM_XCORE	203	/* XMOS xCORE processor family */
383 #define	EM_MCHP_PIC	204	/* Microchip 8-bit PIC(r) family */
384 #define	EM_INTEL205	205	/* Reserved by Intel */
385 #define	EM_INTEL206	206	/* Reserved by Intel */
386 #define	EM_INTEL207	207	/* Reserved by Intel */
387 #define	EM_INTEL208	208	/* Reserved by Intel */
388 #define	EM_INTEL209	209	/* Reserved by Intel */
389 #define	EM_KM32		210	/* KM211 KM32 32-bit processor */
390 #define	EM_KMX32	211	/* KM211 KMX32 32-bit processor */
391 #define	EM_KMX16	212	/* KM211 KMX16 16-bit processor */
392 #define	EM_KMX8		213	/* KM211 KMX8 8-bit processor */
393 #define	EM_KVARC	214	/* KM211 KVARC processor */
394 #define	EM_CDP		215	/* Paneve CDP architecture family */
395 #define	EM_COGE		216	/* Cognitive Smart Memory Processor */
396 #define	EM_COOL		217	/* Bluechip Systems CoolEngine */
397 #define	EM_NORC		218	/* Nanoradio Optimized RISC */
398 #define	EM_CSR_KALIMBA	219	/* CSR Kalimba architecture family */
399 #define	EM_Z80		220	/* Zilog Z80 */
400 #define	EM_VISIUM	221	/* Controls and Data Services VISIUMcore */
401 				/* processor */
402 #define	EM_FT32		222	/* FTDI Chip FT32 high performance 32-bit */
403 				/* RISC architecture */
404 #define	EM_MOXIE	223	/* Moxie processor family */
405 #define	EM_AMDGPU	224	/* AMD GPU architecture */
406 
407 #define	EM_RISCV	243	/* RISC-V */
408 
409 #define	EM_NUM		244
410 
411 #define	EV_NONE		0		/* e_version, EI_VERSION */
412 #define	EV_CURRENT	1
413 #define	EV_NUM		2
414 
415 
416 #define	ELFOSABI_NONE		0	/* No extensions or unspecified */
417 #define	ELFOSABI_SYSV		ELFOSABI_NONE
418 #define	ELFOSABI_HPUX		1	/* Hewlett-Packard HP-UX */
419 #define	ELFOSABI_NETBSD		2	/* NetBSD */
420 #define	ELFOSABI_LINUX		3	/* Linux */
421 #define	ELFOSABI_UNKNOWN4	4
422 #define	ELFOSABI_UNKNOWN5	5
423 #define	ELFOSABI_SOLARIS	6	/* Sun Solaris */
424 #define	ELFOSABI_AIX		7	/* AIX */
425 #define	ELFOSABI_IRIX		8	/* IRIX */
426 #define	ELFOSABI_FREEBSD	9	/* FreeBSD */
427 #define	ELFOSABI_TRU64		10	/* Compaq TRU64 UNIX */
428 #define	ELFOSABI_MODESTO	11	/* Novell Modesto */
429 #define	ELFOSABI_OPENBSD	12	/* Open BSD */
430 #define	ELFOSABI_OPENVMS	13	/* Open VMS */
431 #define	ELFOSABI_NSK		14	/* Hewlett-Packard Non-Stop Kernel */
432 #define	ELFOSABI_AROS		15	/* Amiga Research OS */
433 #define	ELFOSABI_FENIXOS	16	/* The FenixOS highly scalable */
434 					/* multi-core OS */
435 #define	ELFOSABI_CLOUDABI	17	/* Nuxi CloudABI */
436 #define	ELFOSABI_OPENVOS	18	/* Stratus Technologies OpenVOS */
437 #define	ELFOSABI_ARM		97	/* ARM */
438 #define	ELFOSABI_STANDALONE	255	/* standalone (embedded) application */
439 
440 #define	EAV_SUNW_NONE		0	/* EI_ABIVERSION */
441 #define	EAV_SUNW_CURRENT	1
442 #define	EAV_SUNW_NUM		2
443 
444 
445 /*
446  *	Program header
447  */
448 
449 typedef struct {
450 	Elf32_Word	p_type;		/* entry type */
451 	Elf32_Off	p_offset;	/* file offset */
452 	Elf32_Addr	p_vaddr;	/* virtual address */
453 	Elf32_Addr	p_paddr;	/* physical address */
454 	Elf32_Word	p_filesz;	/* file size */
455 	Elf32_Word	p_memsz;	/* memory size */
456 	Elf32_Word	p_flags;	/* entry flags */
457 	Elf32_Word	p_align;	/* memory/file alignment */
458 } Elf32_Phdr;
459 
460 #if defined(_LP64) || defined(_LONGLONG_TYPE)
461 typedef struct {
462 	Elf64_Word	p_type;		/* entry type */
463 	Elf64_Word	p_flags;	/* entry flags */
464 	Elf64_Off	p_offset;	/* file offset */
465 	Elf64_Addr	p_vaddr;	/* virtual address */
466 	Elf64_Addr	p_paddr;	/* physical address */
467 	Elf64_Xword	p_filesz;	/* file size */
468 	Elf64_Xword	p_memsz;	/* memory size */
469 	Elf64_Xword	p_align;	/* memory/file alignment */
470 } Elf64_Phdr;
471 #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
472 
473 
474 #define	PT_NULL		0		/* p_type */
475 #define	PT_LOAD		1
476 #define	PT_DYNAMIC	2
477 #define	PT_INTERP	3
478 #define	PT_NOTE		4
479 #define	PT_SHLIB	5
480 #define	PT_PHDR		6
481 #define	PT_TLS		7
482 #define	PT_NUM		8
483 
484 #define	PT_LOOS		0x60000000	/* OS specific range */
485 
486 /*
487  * PT_SUNW_UNWIND and PT_SUNW_EH_FRAME perform the same function,
488  * providing access to the .eh_frame_hdr section of the object.
489  * PT_SUNW_UNWIND is the original value, while PT_SUNW_EH_FRAME is
490  * required by the amd64 psABI. The Solaris link-editor (ld) tags output
491  * objects with PT_SUNW_UNWIND, but the Solaris runtime linker (ld.so.1)
492  * will accept and use either value.
493  */
494 #define	PT_SUNW_UNWIND		0x6464e550
495 #define	PT_SUNW_EH_FRAME	0x6474e550
496 #define	PT_GNU_EH_FRAME		PT_SUNW_EH_FRAME
497 
498 /*
499  * Linux specific program headers not currently used by Solaris
500  */
501 #define	PT_GNU_STACK	0x6474e551	/* Indicates stack executability */
502 #define	PT_GNU_RELRO	0x6474e552	/* Read-only after relocation */
503 
504 #define	PT_LOSUNW	0x6ffffffa
505 #define	PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment (unused) */
506 #define	PT_SUNWSTACK	0x6ffffffb	/* describes the stack segment */
507 #define	PT_SUNWDTRACE	0x6ffffffc	/* private */
508 #define	PT_SUNWCAP	0x6ffffffd	/* hard/soft capabilities segment */
509 #define	PT_HISUNW	0x6fffffff
510 #define	PT_HIOS		0x6fffffff
511 
512 #define	PT_LOPROC	0x70000000	/* processor specific range */
513 #define	PT_HIPROC	0x7fffffff
514 
515 #define	PF_R		0x4		/* p_flags */
516 #define	PF_W		0x2
517 #define	PF_X		0x1
518 
519 #define	PF_MASKOS	0x0ff00000	/* OS specific values */
520 #define	PF_MASKPROC	0xf0000000	/* processor specific values */
521 
522 #define	PF_SUNW_FAILURE	0x00100000	/* mapping absent due to failure */
523 #define	PF_SUNW_KILLED	0x00200000	/* signal received during dump */
524 #define	PF_SUNW_SIGINFO	0x00400000	/* segment has killing sig's siginfo */
525 
526 #define	PN_XNUM		0xffff		/* extended program header index */
527 
528 /*
529  *	Section header
530  */
531 
532 typedef struct {
533 	Elf32_Word	sh_name;	/* section name */
534 	Elf32_Word	sh_type;	/* SHT_... */
535 	Elf32_Word	sh_flags;	/* SHF_... */
536 	Elf32_Addr	sh_addr;	/* virtual address */
537 	Elf32_Off	sh_offset;	/* file offset */
538 	Elf32_Word	sh_size;	/* section size */
539 	Elf32_Word	sh_link;	/* misc info */
540 	Elf32_Word	sh_info;	/* misc info */
541 	Elf32_Word	sh_addralign;	/* memory alignment */
542 	Elf32_Word	sh_entsize;	/* entry size if table */
543 } Elf32_Shdr;
544 
545 #if defined(_LP64) || defined(_LONGLONG_TYPE)
546 typedef struct {
547 	Elf64_Word	sh_name;	/* section name */
548 	Elf64_Word	sh_type;	/* SHT_... */
549 	Elf64_Xword	sh_flags;	/* SHF_... */
550 	Elf64_Addr	sh_addr;	/* virtual address */
551 	Elf64_Off	sh_offset;	/* file offset */
552 	Elf64_Xword	sh_size;	/* section size */
553 	Elf64_Word	sh_link;	/* misc info */
554 	Elf64_Word	sh_info;	/* misc info */
555 	Elf64_Xword	sh_addralign;	/* memory alignment */
556 	Elf64_Xword	sh_entsize;	/* entry size if table */
557 } Elf64_Shdr;
558 #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
559 
560 #define	SHT_NULL		0		/* sh_type */
561 #define	SHT_PROGBITS		1
562 #define	SHT_SYMTAB		2
563 #define	SHT_STRTAB		3
564 #define	SHT_RELA		4
565 #define	SHT_HASH		5
566 #define	SHT_DYNAMIC		6
567 #define	SHT_NOTE		7
568 #define	SHT_NOBITS		8
569 #define	SHT_REL			9
570 #define	SHT_SHLIB		10
571 #define	SHT_DYNSYM		11
572 #define	SHT_UNKNOWN12		12
573 #define	SHT_UNKNOWN13		13
574 #define	SHT_INIT_ARRAY		14
575 #define	SHT_FINI_ARRAY		15
576 #define	SHT_PREINIT_ARRAY	16
577 #define	SHT_GROUP		17
578 #define	SHT_SYMTAB_SHNDX	18
579 #define	SHT_NUM			19
580 
581 /* Solaris ABI specific values */
582 #define	SHT_LOOS		0x60000000	/* OS specific range */
583 #define	SHT_LOSUNW		0x6fffffef
584 #define	SHT_SUNW_capchain	0x6fffffef
585 #define	SHT_SUNW_capinfo	0x6ffffff0
586 #define	SHT_SUNW_symsort	0x6ffffff1
587 #define	SHT_SUNW_tlssort	0x6ffffff2
588 #define	SHT_SUNW_LDYNSYM	0x6ffffff3
589 #define	SHT_SUNW_dof		0x6ffffff4
590 #define	SHT_SUNW_cap		0x6ffffff5
591 #define	SHT_SUNW_SIGNATURE	0x6ffffff6
592 #define	SHT_SUNW_ANNOTATE	0x6ffffff7
593 #define	SHT_SUNW_DEBUGSTR	0x6ffffff8
594 #define	SHT_SUNW_DEBUG		0x6ffffff9
595 #define	SHT_SUNW_move		0x6ffffffa
596 #define	SHT_SUNW_COMDAT		0x6ffffffb
597 #define	SHT_SUNW_syminfo	0x6ffffffc
598 #define	SHT_SUNW_verdef		0x6ffffffd
599 #define	SHT_GNU_verdef		SHT_SUNW_verdef
600 #define	SHT_SUNW_verneed	0x6ffffffe
601 #define	SHT_GNU_verneed		SHT_SUNW_verneed
602 #define	SHT_SUNW_versym		0x6fffffff
603 #define	SHT_GNU_versym		SHT_SUNW_versym
604 #define	SHT_HISUNW		0x6fffffff
605 #define	SHT_HIOS		0x6fffffff
606 
607 /*
608  * GNU/Linux OSABI specific values with different meanings than under Solaris.
609  * Due to the overlap in assigned values with the Solaris OSABI, correct
610  * interpretation of these values requires knowledge of the OSABI used by
611  * the object.
612  */
613 #define	SHT_GNU_ATTRIBUTES	0x6ffffff5	/* Object attributes */
614 #define	SHT_GNU_HASH		0x6ffffff6	/* GNU-style hash table */
615 #define	SHT_GNU_LIBLIST		0x6ffffff7	/* Prelink library list */
616 #define	SHT_CHECKSUM		0x6ffffff8	/* Checksum for DSO content */
617 
618 /*
619  * LLVM-specific section types, actually independent of any (ELF) OS.
620  * See: https://llvm.org/docs/Extensions.html
621  */
622 #define	SHT_LLVM_ODRTAB		0x6fff4c00 /* ODR Table */
623 #define	SHT_LLVM_LINKER_OPTIONS	0x6fff4c01 /* Linker options */
624 #define	SHT_LLVM_UNKNOWN1	0x6fff4c02 /* previously call graph profile */
625 #define	SHT_LLVM_ADDRSIG	0x6fff4c03 /* significant address table */
626 #define	SHT_LLVM_DEPENDENT_LIBRARIES	0x6fff4c04 /* dependent libraries. */
627 #define	SHT_LLVM_SYMPART	0x6fff4c05 /* symbol partition specs. */
628 #define	SHT_LLVM_PART_EHDR	0x6fff4c06 /* ehdr for loadable part. */
629 #define	SHT_LLVM_PART_PHDR	0x6fff4c07 /* phdrs for loadable part. */
630 #define	SHT_LLVM_BB_ADDR_MAP	0x6fff4c08 /* basic block addr map */
631 #define	SHT_LLVM_CALL_GRAPH_PROFILE	0x6fff4c09 /* call graph profile */
632 
633 #define	SHT_LOPROC	0x70000000	/* processor specific range */
634 #define	SHT_HIPROC	0x7fffffff
635 
636 #define	SHT_LOUSER	0x80000000
637 #define	SHT_HIUSER	0xffffffff
638 
639 #define	SHF_WRITE		0x01		/* sh_flags */
640 #define	SHF_ALLOC		0x02
641 #define	SHF_EXECINSTR		0x04
642 #define	SHF_MERGE		0x10
643 #define	SHF_STRINGS		0x20
644 #define	SHF_INFO_LINK		0x40
645 #define	SHF_LINK_ORDER		0x80
646 #define	SHF_OS_NONCONFORMING	0x100
647 #define	SHF_GROUP		0x200
648 #define	SHF_TLS			0x400
649 
650 #define	SHF_MASKOS	0x0ff00000	/* OS specific values */
651 
652 
653 #define	SHF_MASKPROC	0xf0000000	/* processor specific values */
654 
655 #define	SHN_UNDEF	0		/* special section numbers */
656 #define	SHN_LORESERVE	0xff00
657 #define	SHN_LOPROC	0xff00		/* processor specific range */
658 #define	SHN_HIPROC	0xff1f
659 #define	SHN_LOOS	0xff20		/* OS specific range */
660 #define	SHN_LOSUNW	0xff3f
661 #define	SHN_SUNW_IGNORE	0xff3f
662 #define	SHN_HISUNW	0xff3f
663 #define	SHN_HIOS	0xff3f
664 #define	SHN_ABS		0xfff1
665 #define	SHN_COMMON	0xfff2
666 #define	SHN_XINDEX	0xffff		/* extended sect index */
667 #define	SHN_HIRESERVE	0xffff
668 
669 
670 
671 /*
672  *	Symbol table
673  */
674 
675 typedef struct {
676 	Elf32_Word	st_name;
677 	Elf32_Addr	st_value;
678 	Elf32_Word	st_size;
679 	unsigned char	st_info;	/* bind, type: ELF_32_ST_... */
680 	unsigned char	st_other;
681 	Elf32_Half	st_shndx;	/* SHN_... */
682 } Elf32_Sym;
683 
684 #if defined(_LP64) || defined(_LONGLONG_TYPE)
685 typedef struct {
686 	Elf64_Word	st_name;
687 	unsigned char	st_info;	/* bind, type: ELF_64_ST_... */
688 	unsigned char	st_other;
689 	Elf64_Half	st_shndx;	/* SHN_... */
690 	Elf64_Addr	st_value;
691 	Elf64_Xword	st_size;
692 } Elf64_Sym;
693 #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
694 
695 #define	STN_UNDEF	0
696 
697 /*
698  *	Macros to compose and decompose values for S.st_info
699  *
700  *	bind = ELF32_ST_BIND(S.st_info)
701  *	type = ELF32_ST_TYPE(S.st_info)
702  *	S.st_info = ELF32_ST_INFO(bind, type)
703  */
704 
705 #define	ELF32_ST_BIND(info)		((info) >> 4)
706 #define	ELF32_ST_TYPE(info)		((info) & 0xf)
707 #define	ELF32_ST_INFO(bind, type)	(((bind)<<4)+((type)&0xf))
708 
709 #define	ELF64_ST_BIND(info)		((info) >> 4)
710 #define	ELF64_ST_TYPE(info)		((info) & 0xf)
711 #define	ELF64_ST_INFO(bind, type)	(((bind)<<4)+((type)&0xf))
712 
713 
714 #define	STB_LOCAL	0		/* BIND */
715 #define	STB_GLOBAL	1
716 #define	STB_WEAK	2
717 #define	STB_NUM		3
718 
719 #define	STB_LOOS	10		/* operating system specific range */
720 #define	STB_HIOS	12
721 
722 #define	STB_LOPROC	13		/* processor specific range */
723 #define	STB_HIPROC	15
724 
725 #define	STT_NOTYPE	0		/* symbol type is unspecified */
726 #define	STT_OBJECT	1		/* data object */
727 #define	STT_FUNC	2		/* code object */
728 #define	STT_SECTION	3		/* symbol identifies an ELF section */
729 #define	STT_FILE	4		/* symbol's name is file name */
730 #define	STT_COMMON	5		/* common data object */
731 #define	STT_TLS		6		/* thread-local data object */
732 #define	STT_NUM		7		/* # defined types in generic range */
733 #define	STT_LOOS	10		/* OS specific range */
734 #define	STT_HIOS	12
735 #define	STT_LOPROC	13		/* processor specific range */
736 #define	STT_HIPROC	15
737 
738 /*
739  *	Macros to decompose values for S.st_other
740  *
741  *	visibility = ELF32_ST_VISIBILITY(S.st_other)
742  */
743 #define	ELF32_ST_VISIBILITY(other)	((other)&0x7)
744 #define	ELF64_ST_VISIBILITY(other)	((other)&0x7)
745 
746 #define	STV_DEFAULT	0
747 #define	STV_INTERNAL	1
748 #define	STV_HIDDEN	2
749 #define	STV_PROTECTED	3
750 #define	STV_EXPORTED	4
751 #define	STV_SINGLETON	5
752 #define	STV_ELIMINATE	6
753 
754 #define	STV_NUM		7
755 
756 /*
757  *	Relocation
758  */
759 
760 typedef struct {
761 	Elf32_Addr	r_offset;
762 	Elf32_Word	r_info;		/* sym, type: ELF32_R_... */
763 } Elf32_Rel;
764 
765 typedef struct {
766 	Elf32_Addr	r_offset;
767 	Elf32_Word	r_info;		/* sym, type: ELF32_R_... */
768 	Elf32_Sword	r_addend;
769 } Elf32_Rela;
770 
771 #if defined(_LP64) || defined(_LONGLONG_TYPE)
772 typedef struct {
773 	Elf64_Addr	r_offset;
774 	Elf64_Xword	r_info;		/* sym, type: ELF64_R_... */
775 } Elf64_Rel;
776 
777 typedef struct {
778 	Elf64_Addr	r_offset;
779 	Elf64_Xword	r_info;		/* sym, type: ELF64_R_... */
780 	Elf64_Sxword	r_addend;
781 } Elf64_Rela;
782 #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
783 
784 
785 /*
786  *	Macros to compose and decompose values for Rel.r_info, Rela.f_info
787  *
788  *	sym = ELF32_R_SYM(R.r_info)
789  *	type = ELF32_R_TYPE(R.r_info)
790  *	R.r_info = ELF32_R_INFO(sym, type)
791  */
792 
793 #define	ELF32_R_SYM(info)	((info)>>8)
794 #define	ELF32_R_TYPE(info)	((unsigned char)(info))
795 #define	ELF32_R_INFO(sym, type)	(((sym)<<8)+(unsigned char)(type))
796 
797 #define	ELF64_R_SYM(info)	((info)>>32)
798 #define	ELF64_R_TYPE(info)	((Elf64_Word)(info))
799 #define	ELF64_R_INFO(sym, type)	(((Elf64_Xword)(sym)<<32)+(Elf64_Xword)(type))
800 
801 
802 /*
803  * The r_info field is composed of two 32-bit components: the symbol
804  * table index and the relocation type.  The relocation type for SPARC V9
805  * is further decomposed into an 8-bit type identifier and a 24-bit type
806  * dependent data field.  For the existing Elf32 relocation types,
807  * that data field is zero.
808  */
809 #define	ELF64_R_TYPE_DATA(info)	(((Elf64_Xword)(info)<<32)>>40)
810 #define	ELF64_R_TYPE_ID(info)	(((Elf64_Xword)(info)<<56)>>56)
811 #define	ELF64_R_TYPE_INFO(data, type)	\
812 		(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
813 
814 
815 /*
816  * Section Group Flags (SHT_GROUP)
817  */
818 #define	GRP_COMDAT	0x01
819 
820 
821 /*
822  *	Note entry header
823  */
824 
825 typedef struct {
826 	Elf32_Word	n_namesz;	/* length of note's name */
827 	Elf32_Word	n_descsz;	/* length of note's "desc" */
828 	Elf32_Word	n_type;		/* type of note */
829 } Elf32_Nhdr;
830 
831 #if defined(_LP64) || defined(_LONGLONG_TYPE)
832 typedef struct {
833 	Elf64_Word	n_namesz;	/* length of note's name */
834 	Elf64_Word	n_descsz;	/* length of note's "desc" */
835 	Elf64_Word	n_type;		/* type of note */
836 } Elf64_Nhdr;
837 #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
838 
839 /*
840  *	Move entry
841  */
842 #if defined(_LP64) || defined(_LONGLONG_TYPE)
843 typedef struct {
844 	Elf32_Lword	m_value;	/* symbol value */
845 	Elf32_Word	m_info;		/* size + index */
846 	Elf32_Word	m_poffset;	/* symbol offset */
847 	Elf32_Half	m_repeat;	/* repeat count */
848 	Elf32_Half	m_stride;	/* stride info */
849 } Elf32_Move;
850 
851 /*
852  *	Macros to compose and decompose values for Move.r_info
853  *
854  *	sym = ELF32_M_SYM(M.m_info)
855  *	size = ELF32_M_SIZE(M.m_info)
856  *	M.m_info = ELF32_M_INFO(sym, size)
857  */
858 #define	ELF32_M_SYM(info)	((info)>>8)
859 #define	ELF32_M_SIZE(info)	((unsigned char)(info))
860 #define	ELF32_M_INFO(sym, size)	(((sym)<<8)+(unsigned char)(size))
861 
862 typedef struct {
863 	Elf64_Lword	m_value;	/* symbol value */
864 	Elf64_Xword	m_info;		/* size + index */
865 	Elf64_Xword	m_poffset;	/* symbol offset */
866 	Elf64_Half	m_repeat;	/* repeat count */
867 	Elf64_Half	m_stride;	/* stride info */
868 } Elf64_Move;
869 #define	ELF64_M_SYM(info)	((info)>>8)
870 #define	ELF64_M_SIZE(info)	((unsigned char)(info))
871 #define	ELF64_M_INFO(sym, size)	(((sym)<<8)+(unsigned char)(size))
872 
873 #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
874 
875 
876 /*
877  *	Capabilities entry, Capabilities info and Capabilities chain.
878  */
879 #ifndef	_ASM
880 typedef struct {
881 	Elf32_Word	c_tag;		/* how to interpret value */
882 	union {
883 		Elf32_Word	c_val;
884 		Elf32_Addr	c_ptr;
885 	} c_un;
886 } Elf32_Cap;
887 
888 typedef	Elf32_Word	Elf32_Capinfo;
889 typedef	Elf32_Word	Elf32_Capchain;
890 
891 /*
892  *	Macros to compose and decompose values for capabilities info.
893  *
894  *	sym = ELF32_C_SYM(info)
895  *	grp = ELF32_C_GROUP(info)
896  *	info = ELF32_C_INFO(sym, grp)
897  */
898 #define	ELF32_C_SYM(info)	((info)>>8)
899 #define	ELF32_C_GROUP(info)	((unsigned char)(info))
900 #define	ELF32_C_INFO(sym, grp)	(((sym)<<8)+(unsigned char)(grp))
901 
902 
903 #if defined(_LP64) || defined(_LONGLONG_TYPE)
904 typedef struct {
905 	Elf64_Xword	c_tag;		/* how to interpret value */
906 	union {
907 		Elf64_Xword	c_val;
908 		Elf64_Addr	c_ptr;
909 	} c_un;
910 } Elf64_Cap;
911 
912 typedef	Elf64_Xword	Elf64_Capinfo;
913 typedef	Elf64_Word	Elf64_Capchain;
914 
915 /*
916  *	Macros to compose and decompose values for capabilities info.
917  *
918  *	sym = ELF64_C_SYM(info)
919  *	grp = ELF64_C_GROUP(info)
920  *	info = ELF64_C_INFO(sym, grp)
921  */
922 #define	ELF64_C_SYM(info)	((info)>>32)
923 #define	ELF64_C_GROUP(info)	((Elf64_Word)(info))
924 #define	ELF64_C_INFO(sym, grp)	(((Elf64_Xword)(sym)<<32)+(Elf64_Xword)(grp))
925 
926 #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
927 #endif
928 
929 /*
930  * Version numbers for SHT_SUNW_capinfo and SHT_SUNW_capchain.
931  */
932 #define	CAPINFO_NONE		0
933 #define	CAPINFO_CURRENT		1
934 #define	CAPINFO_NUM		2
935 
936 #define	CAPCHAIN_NONE		0
937 #define	CAPCHAIN_CURRENT	1
938 #define	CAPCHAIN_NUM		2
939 
940 /*
941  * A SHT_SUNW_capinfo table mirrors a symbol table.  A capabilities symbol has
942  * a SHT_SUNW_capinfo table entry that provides an index into the associated
943  * SHT_SUNW_cap capabilities group, and the symbol index of the associated lead
944  * symbol.  A capabilities symbol is a local symbol.  A global lead capabilities
945  * symbol is tagged with a group CAPINFO_SUNW_GLOB.
946  */
947 #define	CAPINFO_SUNW_GLOB	0xff
948 
949 /*
950  * Capabilities values.
951  */
952 #define	CA_SUNW_NULL	0
953 #define	CA_SUNW_HW_1	1		/* first hardware capabilities entry */
954 #define	CA_SUNW_SF_1	2		/* first software capabilities entry */
955 #define	CA_SUNW_HW_2	3		/* second hardware capabilities entry */
956 #define	CA_SUNW_PLAT	4		/* platform capability entry */
957 #define	CA_SUNW_MACH	5		/* machine capability entry */
958 #define	CA_SUNW_ID	6		/* capability identifier */
959 #define	CA_SUNW_HW_3	7		/* third hardware capabilities entry */
960 #define	CA_SUNW_NUM	8
961 
962 /*
963  * Define software capabilities (CA_SUNW_SF_1 values).  Note, hardware
964  * capabilities (CA_SUNW_HW_1 values) are taken directly from sys/auxv_$MACH.h.
965  */
966 #define	SF1_SUNW_FPKNWN	0x001		/* frame pointer usage is known */
967 #define	SF1_SUNW_FPUSED	0x002		/* frame pointer is in use */
968 #define	SF1_SUNW_ADDR32	0x004		/* 32-bit address space requirement */
969 #define	SF1_SUNW_MASK	0x007		/* known software capabilities mask */
970 
971 /*
972  *	Known values for note entry types (e_type == ET_CORE)
973  */
974 #define	NT_PRSTATUS	1	/* prstatus_t	<sys/old_procfs.h>	*/
975 #define	NT_PRFPREG	2	/* prfpregset_t	<sys/old_procfs.h>	*/
976 #define	NT_PRPSINFO	3	/* prpsinfo_t	<sys/old_procfs.h>	*/
977 #define	NT_PRXREG	4	/* prxregset_t	<sys/procfs.h>		*/
978 #define	NT_PLATFORM	5	/* string from sysinfo(SI_PLATFORM)	*/
979 #define	NT_AUXV		6	/* auxv_t array	<sys/auxv.h>		*/
980 #define	NT_GWINDOWS	7	/* gwindows_t	SPARC only		*/
981 #define	NT_ASRS		8	/* asrset_t	SPARC V9 only		*/
982 #define	NT_LDT		9	/* ssd array	<sys/sysi86.h> IA32 only */
983 #define	NT_PSTATUS	10	/* pstatus_t	<sys/procfs.h>		*/
984 #define	NT_PSINFO	13	/* psinfo_t	<sys/procfs.h>		*/
985 #define	NT_PRCRED	14	/* prcred_t	<sys/procfs.h>		*/
986 #define	NT_UTSNAME	15	/* struct utsname <sys/utsname.h>	*/
987 #define	NT_LWPSTATUS	16	/* lwpstatus_t	<sys/procfs.h>		*/
988 #define	NT_LWPSINFO	17	/* lwpsinfo_t	<sys/procfs.h>		*/
989 #define	NT_PRPRIV	18	/* prpriv_t	<sys/procfs.h>		*/
990 #define	NT_PRPRIVINFO	19	/* priv_impl_info_t <sys/priv.h>	*/
991 #define	NT_CONTENT	20	/* core_content_t <sys/corectl.h>	*/
992 #define	NT_ZONENAME	21	/* string from getzonenamebyid(3C)	*/
993 #define	NT_FDINFO	22	/* open fd info				*/
994 #define	NT_SPYMASTER	23	/* psinfo_t for agent LWP spymaster	*/
995 #define	NT_SECFLAGS	24	/* process security-flags */
996 #define	NT_LWPNAME	25	/* prlwpname_t */
997 #define	NT_UPANIC	26	/* prupanic_t */
998 #define	NT_NUM		26
999 
1000 
1001 #ifdef _KERNEL
1002 /*
1003  * The following routine checks the processor-specific
1004  * fields of an ELF header.
1005  */
1006 int	elfheadcheck(unsigned char, Elf32_Half, Elf32_Word);
1007 #endif
1008 
1009 #ifdef	__cplusplus
1010 }
1011 #endif
1012 
1013 #if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_SPARC)
1014 #include <sys/elf_SPARC.h>
1015 #endif
1016 
1017 #if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_386)
1018 #include <sys/elf_386.h>
1019 #endif
1020 
1021 #if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_AMD64)
1022 #include <sys/elf_amd64.h>
1023 #endif
1024 
1025 #endif	/* _SYS_ELF_H */
1026