xref: /onnv-gate/usr/src/uts/common/sys/elf.h (revision 942:8cf53d6a7d2e)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
23641Skalai  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
280Sstevel@tonic-gate /*	  All Rights Reserved  	*/
290Sstevel@tonic-gate 
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifndef _SYS_ELF_H
320Sstevel@tonic-gate #define	_SYS_ELF_H
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #include <sys/elftypes.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #ifdef	__cplusplus
390Sstevel@tonic-gate extern "C" {
400Sstevel@tonic-gate #endif
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #define	ELF32_FSZ_ADDR	4
430Sstevel@tonic-gate #define	ELF32_FSZ_HALF	2
440Sstevel@tonic-gate #define	ELF32_FSZ_OFF	4
450Sstevel@tonic-gate #define	ELF32_FSZ_SWORD	4
460Sstevel@tonic-gate #define	ELF32_FSZ_WORD	4
470Sstevel@tonic-gate 
480Sstevel@tonic-gate #define	ELF64_FSZ_ADDR	8
490Sstevel@tonic-gate #define	ELF64_FSZ_HALF	2
500Sstevel@tonic-gate #define	ELF64_FSZ_OFF	8
510Sstevel@tonic-gate #define	ELF64_FSZ_SWORD	4
520Sstevel@tonic-gate #define	ELF64_FSZ_WORD	4
530Sstevel@tonic-gate #define	ELF64_FSZ_SXWORD 8
540Sstevel@tonic-gate #define	ELF64_FSZ_XWORD	8
550Sstevel@tonic-gate 
560Sstevel@tonic-gate /*
570Sstevel@tonic-gate  *	"Enumerations" below use ...NUM as the number of
580Sstevel@tonic-gate  *	values in the list.  It should be 1 greater than the
590Sstevel@tonic-gate  *	highest "real" value.
600Sstevel@tonic-gate  */
610Sstevel@tonic-gate 
620Sstevel@tonic-gate /*
630Sstevel@tonic-gate  *	ELF header
640Sstevel@tonic-gate  */
650Sstevel@tonic-gate 
660Sstevel@tonic-gate #define	EI_NIDENT	16
670Sstevel@tonic-gate 
680Sstevel@tonic-gate typedef struct {
690Sstevel@tonic-gate 	unsigned char	e_ident[EI_NIDENT];	/* ident bytes */
700Sstevel@tonic-gate 	Elf32_Half	e_type;			/* file type */
710Sstevel@tonic-gate 	Elf32_Half	e_machine;		/* target machine */
720Sstevel@tonic-gate 	Elf32_Word	e_version;		/* file version */
730Sstevel@tonic-gate 	Elf32_Addr	e_entry;		/* start address */
740Sstevel@tonic-gate 	Elf32_Off	e_phoff;		/* phdr file offset */
750Sstevel@tonic-gate 	Elf32_Off	e_shoff;		/* shdr file offset */
760Sstevel@tonic-gate 	Elf32_Word	e_flags;		/* file flags */
770Sstevel@tonic-gate 	Elf32_Half	e_ehsize;		/* sizeof ehdr */
780Sstevel@tonic-gate 	Elf32_Half	e_phentsize;		/* sizeof phdr */
790Sstevel@tonic-gate 	Elf32_Half	e_phnum;		/* number phdrs */
800Sstevel@tonic-gate 	Elf32_Half	e_shentsize;		/* sizeof shdr */
810Sstevel@tonic-gate 	Elf32_Half	e_shnum;		/* number shdrs */
820Sstevel@tonic-gate 	Elf32_Half	e_shstrndx;		/* shdr string index */
830Sstevel@tonic-gate } Elf32_Ehdr;
840Sstevel@tonic-gate 
850Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
860Sstevel@tonic-gate typedef struct {
870Sstevel@tonic-gate 	unsigned char	e_ident[EI_NIDENT];	/* ident bytes */
880Sstevel@tonic-gate 	Elf64_Half	e_type;			/* file type */
890Sstevel@tonic-gate 	Elf64_Half	e_machine;		/* target machine */
900Sstevel@tonic-gate 	Elf64_Word	e_version;		/* file version */
910Sstevel@tonic-gate 	Elf64_Addr	e_entry;		/* start address */
920Sstevel@tonic-gate 	Elf64_Off	e_phoff;		/* phdr file offset */
930Sstevel@tonic-gate 	Elf64_Off	e_shoff;		/* shdr file offset */
940Sstevel@tonic-gate 	Elf64_Word	e_flags;		/* file flags */
950Sstevel@tonic-gate 	Elf64_Half	e_ehsize;		/* sizeof ehdr */
960Sstevel@tonic-gate 	Elf64_Half	e_phentsize;		/* sizeof phdr */
970Sstevel@tonic-gate 	Elf64_Half	e_phnum;		/* number phdrs */
980Sstevel@tonic-gate 	Elf64_Half	e_shentsize;		/* sizeof shdr */
990Sstevel@tonic-gate 	Elf64_Half	e_shnum;		/* number shdrs */
1000Sstevel@tonic-gate 	Elf64_Half	e_shstrndx;		/* shdr string index */
1010Sstevel@tonic-gate } Elf64_Ehdr;
1020Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
1030Sstevel@tonic-gate 
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate #define	EI_MAG0		0	/* e_ident[] indexes */
1060Sstevel@tonic-gate #define	EI_MAG1		1
1070Sstevel@tonic-gate #define	EI_MAG2		2
1080Sstevel@tonic-gate #define	EI_MAG3		3
1090Sstevel@tonic-gate #define	EI_CLASS	4	/* File class */
1100Sstevel@tonic-gate #define	EI_DATA		5	/* Data encoding */
1110Sstevel@tonic-gate #define	EI_VERSION	6	/* File version */
1120Sstevel@tonic-gate #define	EI_OSABI	7	/* Operating system/ABI identification */
1130Sstevel@tonic-gate #define	EI_ABIVERSION	8	/* ABI version */
1140Sstevel@tonic-gate #define	EI_PAD		9	/* Start of padding bytes */
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate #define	ELFMAG0		0x7f		/* EI_MAG */
1170Sstevel@tonic-gate #define	ELFMAG1		'E'
1180Sstevel@tonic-gate #define	ELFMAG2		'L'
1190Sstevel@tonic-gate #define	ELFMAG3		'F'
1200Sstevel@tonic-gate #define	ELFMAG		"\177ELF"
1210Sstevel@tonic-gate #define	SELFMAG		4
1220Sstevel@tonic-gate 
1230Sstevel@tonic-gate #define	ELFCLASSNONE	0		/* EI_CLASS */
1240Sstevel@tonic-gate #define	ELFCLASS32	1
1250Sstevel@tonic-gate #define	ELFCLASS64	2
1260Sstevel@tonic-gate #define	ELFCLASSNUM	3
1270Sstevel@tonic-gate 
1280Sstevel@tonic-gate #define	ELFDATANONE	0		/* EI_DATA */
1290Sstevel@tonic-gate #define	ELFDATA2LSB	1
1300Sstevel@tonic-gate #define	ELFDATA2MSB	2
1310Sstevel@tonic-gate #define	ELFDATANUM	3
1320Sstevel@tonic-gate 
1330Sstevel@tonic-gate #define	ET_NONE		0		/* e_type */
1340Sstevel@tonic-gate #define	ET_REL		1
1350Sstevel@tonic-gate #define	ET_EXEC		2
1360Sstevel@tonic-gate #define	ET_DYN		3
1370Sstevel@tonic-gate #define	ET_CORE		4
1380Sstevel@tonic-gate #define	ET_NUM		5
1390Sstevel@tonic-gate #define	ET_LOOS		0xfe00		/* OS specific range */
1400Sstevel@tonic-gate #define	ET_LOSUNW	0xfeff
1410Sstevel@tonic-gate #define	ET_SUNWPSEUDO	0xfeff
1420Sstevel@tonic-gate #define	ET_HISUNW	0xfeff
1430Sstevel@tonic-gate #define	ET_HIOS		0xfeff
1440Sstevel@tonic-gate #define	ET_LOPROC	0xff00		/* processor specific range */
1450Sstevel@tonic-gate #define	ET_HIPROC	0xffff
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate #define	ET_LOPROC	0xff00		/* processor specific range */
1480Sstevel@tonic-gate #define	ET_HIPROC	0xffff
1490Sstevel@tonic-gate 
1500Sstevel@tonic-gate #define	EM_NONE		0		/* e_machine */
1510Sstevel@tonic-gate #define	EM_M32		1		/* AT&T WE 32100 */
1520Sstevel@tonic-gate #define	EM_SPARC	2		/* Sun SPARC */
1530Sstevel@tonic-gate #define	EM_386		3		/* Intel 80386 */
1540Sstevel@tonic-gate #define	EM_68K		4		/* Motorola 68000 */
1550Sstevel@tonic-gate #define	EM_88K		5		/* Motorola 88000 */
1560Sstevel@tonic-gate #define	EM_486		6		/* Intel 80486 */
1570Sstevel@tonic-gate #define	EM_860		7		/* Intel i860 */
1580Sstevel@tonic-gate #define	EM_MIPS		8		/* MIPS RS3000 Big-Endian */
1590Sstevel@tonic-gate #define	EM_S370		9		/* IBM System/370 Processor */
1600Sstevel@tonic-gate #define	EM_MIPS_RS3_LE	10		/* MIPS RS3000 Little-Endian */
1610Sstevel@tonic-gate #define	EM_RS6000	11		/* RS6000 */
1620Sstevel@tonic-gate #define	EM_UNKNOWN12	12
1630Sstevel@tonic-gate #define	EM_UNKNOWN13	13
1640Sstevel@tonic-gate #define	EM_UNKNOWN14	14
1650Sstevel@tonic-gate #define	EM_PA_RISC	15		/* PA-RISC */
1660Sstevel@tonic-gate #define	EM_nCUBE	16		/* nCUBE */
1670Sstevel@tonic-gate #define	EM_VPP500	17		/* Fujitsu VPP500 */
1680Sstevel@tonic-gate #define	EM_SPARC32PLUS	18		/* Sun SPARC 32+ */
1690Sstevel@tonic-gate #define	EM_960		19		/* Intel 80960 */
1700Sstevel@tonic-gate #define	EM_PPC		20		/* PowerPC */
1710Sstevel@tonic-gate #define	EM_PPC64	21		/* 64-bit PowerPC */
1720Sstevel@tonic-gate #define	EM_UNKNOWN22	22
1730Sstevel@tonic-gate #define	EM_UNKNOWN23	23
1740Sstevel@tonic-gate #define	EM_UNKNOWN24	24
1750Sstevel@tonic-gate #define	EM_UNKNOWN25	25
1760Sstevel@tonic-gate #define	EM_UNKNOWN26	26
1770Sstevel@tonic-gate #define	EM_UNKNOWN27	27
1780Sstevel@tonic-gate #define	EM_UNKNOWN28	28
1790Sstevel@tonic-gate #define	EM_UNKNOWN29	29
1800Sstevel@tonic-gate #define	EM_UNKNOWN30	30
1810Sstevel@tonic-gate #define	EM_UNKNOWN31	31
1820Sstevel@tonic-gate #define	EM_UNKNOWN32	32
1830Sstevel@tonic-gate #define	EM_UNKNOWN33	33
1840Sstevel@tonic-gate #define	EM_UNKNOWN34	34
1850Sstevel@tonic-gate #define	EM_UNKNOWN35	35
1860Sstevel@tonic-gate #define	EM_V800		36		/* NEX V800 */
1870Sstevel@tonic-gate #define	EM_FR20		37		/* Fujitsu FR20 */
1880Sstevel@tonic-gate #define	EM_RH32		38		/* TRW RH-32 */
1890Sstevel@tonic-gate #define	EM_RCE		39		/* Motorola RCE */
1900Sstevel@tonic-gate #define	EM_ARM		40		/* Advanced RISC Marchines ARM */
1910Sstevel@tonic-gate #define	EM_ALPHA	41		/* Digital Alpha */
1920Sstevel@tonic-gate #define	EM_SH		42		/* Hitachi SH */
1930Sstevel@tonic-gate #define	EM_SPARCV9	43		/* Sun SPARC V9 (64-bit) */
1940Sstevel@tonic-gate #define	EM_TRICORE	44		/* Siemens Tricore embedded processor */
1950Sstevel@tonic-gate #define	EM_ARC		45		/* Argonaut RISC Core, */
1960Sstevel@tonic-gate 					/*	Argonaut Technologies Inc. */
1970Sstevel@tonic-gate #define	EM_H8_300	46		/* Hitachi H8/300 */
1980Sstevel@tonic-gate #define	EM_H8_300H	47		/* Hitachi H8/300H */
1990Sstevel@tonic-gate #define	EM_H8S		48		/* Hitachi H8S */
2000Sstevel@tonic-gate #define	EM_H8_500	49		/* Hitachi H8/500 */
2010Sstevel@tonic-gate #define	EM_IA_64	50		/* Intel IA64 */
2020Sstevel@tonic-gate #define	EM_MIPS_X	51		/* Stanford MIPS-X */
2030Sstevel@tonic-gate #define	EM_COLDFIRE	52		/* Motorola ColdFire */
2040Sstevel@tonic-gate #define	EM_68HC12	53		/* Motorola M68HC12 */
2050Sstevel@tonic-gate #define	EM_MMA		54		/* Fujitsu MMA Mulimedia Accelerator */
2060Sstevel@tonic-gate #define	EM_PCP		55		/* Siemens PCP */
2070Sstevel@tonic-gate #define	EM_NCPU		56		/* Sony nCPU embedded RISC processor */
2080Sstevel@tonic-gate #define	EM_NDR1		57		/* Denso NDR1 microprocessor */
2090Sstevel@tonic-gate #define	EM_STARCORE	58		/* Motorola Star*Core processor */
2100Sstevel@tonic-gate #define	EM_ME16		59		/* Toyota ME16 processor */
2110Sstevel@tonic-gate #define	EM_ST100	60		/* STMicroelectronics ST100 processor */
2120Sstevel@tonic-gate #define	EM_TINYJ	61		/* Advanced Logic Corp. TinyJ */
2130Sstevel@tonic-gate 					/*	embedded processor family */
2140Sstevel@tonic-gate #define	EM_AMD64	62		/* AMDs x86-64 architecture */
2150Sstevel@tonic-gate #define	EM_X86_64	EM_AMD64	/* (compatibility) */
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate #define	EM_PDSP		63		/* Sony DSP Processor */
2180Sstevel@tonic-gate #define	EM_UNKNOWN64	64
2190Sstevel@tonic-gate #define	EM_UNKNOWN65	65
2200Sstevel@tonic-gate #define	EM_FX66		66		/* Siemens FX66 microcontroller */
2210Sstevel@tonic-gate #define	EM_ST9PLUS	67		/* STMicroelectronics ST9+8/16 bit */
2220Sstevel@tonic-gate 					/*	microcontroller */
2230Sstevel@tonic-gate #define	EM_ST7		68		/* STMicroelectronics ST7 8-bit */
2240Sstevel@tonic-gate 					/*	microcontroller */
2250Sstevel@tonic-gate #define	EM_68HC16	69		/* Motorola MC68HC16 Microcontroller */
2260Sstevel@tonic-gate #define	EM_68HC11	70		/* Motorola MC68HC11 Microcontroller */
2270Sstevel@tonic-gate #define	EM_68HC08	71		/* Motorola MC68HC08 Microcontroller */
2280Sstevel@tonic-gate #define	EM_68HC05	72		/* Motorola MC68HC05 Microcontroller */
2290Sstevel@tonic-gate #define	EM_SVX		73		/* Silicon Graphics SVx */
2300Sstevel@tonic-gate #define	EM_ST19		74		/* STMicroelectronics ST19 8-bit */
2310Sstevel@tonic-gate 					/*	microcontroller */
2320Sstevel@tonic-gate #define	EM_VAX		75		/* Digital VAX */
2330Sstevel@tonic-gate #define	EM_CRIS		76		/* Axis Communications 32-bit */
2340Sstevel@tonic-gate 					/*	embedded processor */
2350Sstevel@tonic-gate #define	EM_JAVELIN	77		/* Infineon Technologies 32-bit */
2360Sstevel@tonic-gate 					/*	embedded processor */
2370Sstevel@tonic-gate #define	EM_FIREPATH	78		/* Element 14 64-bit DSP Processor */
2380Sstevel@tonic-gate #define	EM_ZSP		79		/* LSI Logic 16-bit DSP Processor */
2390Sstevel@tonic-gate #define	EM_MMIX		80		/* Donald Knuth's educational */
2400Sstevel@tonic-gate 					/*	64-bit processor */
2410Sstevel@tonic-gate #define	EM_HUANY	81		/* Harvard University */
2420Sstevel@tonic-gate 					/*	machine-independent */
2430Sstevel@tonic-gate 					/*	object files */
2440Sstevel@tonic-gate #define	EM_PRISM	82		/* SiTera Prism */
2450Sstevel@tonic-gate #define	EM_AVR		83		/* Atmel AVR 8-bit microcontroller */
2460Sstevel@tonic-gate #define	EM_FR30		84		/* Fujitsu FR30 */
2470Sstevel@tonic-gate #define	EM_D10V		85		/* Mitsubishi D10V */
2480Sstevel@tonic-gate #define	EM_D30V		86		/* Mitsubishi D30V */
2490Sstevel@tonic-gate #define	EM_V850		87		/* NEC v850 */
2500Sstevel@tonic-gate #define	EM_M32R		88		/* Mitsubishi M32R */
2510Sstevel@tonic-gate #define	EM_MN10300	89		/* Matsushita MN10300 */
2520Sstevel@tonic-gate #define	EM_MN10200	90		/* Matsushita MN10200 */
2530Sstevel@tonic-gate #define	EM_PJ		91		/* picoJava */
2540Sstevel@tonic-gate #define	EM_OPENRISC	92		/* OpenRISC 32-bit embedded processor */
2550Sstevel@tonic-gate #define	EM_ARC_A5	93		/* ARC Cores Tangent-A5 */
2560Sstevel@tonic-gate #define	EM_XTENSA	94		/* Tensilica Xtensa architecture */
2570Sstevel@tonic-gate #define	EM_NUM		95
2580Sstevel@tonic-gate 
2590Sstevel@tonic-gate #define	EV_NONE		0		/* e_version, EI_VERSION */
2600Sstevel@tonic-gate #define	EV_CURRENT	1
2610Sstevel@tonic-gate #define	EV_NUM		2
2620Sstevel@tonic-gate 
2630Sstevel@tonic-gate 
2640Sstevel@tonic-gate #define	ELFOSABI_NONE		0	/* No extensions or unspecified */
2650Sstevel@tonic-gate #define	ELFOSABI_HPUX		1	/* Hewlett-Packard HP-UX */
2660Sstevel@tonic-gate #define	ELFOSABI_NETBSD		2	/* NetBSD */
2670Sstevel@tonic-gate #define	ELFOSABI_LINUX		3	/* Linux */
2680Sstevel@tonic-gate #define	ELFOSABI_UNKNOWN4	4
2690Sstevel@tonic-gate #define	ELFOSABI_UNKNOWN5	5
2700Sstevel@tonic-gate #define	ELFOSABI_SOLARIS	6	/* Sun Solaris */
2710Sstevel@tonic-gate #define	ELFOSABI_AIX		7	/* AIX */
2720Sstevel@tonic-gate #define	ELFOSABI_IRIX		8	/* IRIX */
2730Sstevel@tonic-gate #define	ELFOSABI_FREEBSD	9	/* FreeBSD */
2740Sstevel@tonic-gate #define	ELFOSABI_TRU64		10	/* Compaq TRU64 UNIX */
2750Sstevel@tonic-gate #define	ELFOSABI_MODESTO	11	/* Novell Modesto */
2760Sstevel@tonic-gate #define	ELFOSABI_OPENBSD	12	/* Open BSD */
2770Sstevel@tonic-gate 
2780Sstevel@tonic-gate 
2790Sstevel@tonic-gate /*
2800Sstevel@tonic-gate  *	Program header
2810Sstevel@tonic-gate  */
2820Sstevel@tonic-gate 
2830Sstevel@tonic-gate typedef struct {
2840Sstevel@tonic-gate 	Elf32_Word	p_type;		/* entry type */
2850Sstevel@tonic-gate 	Elf32_Off	p_offset;	/* file offset */
2860Sstevel@tonic-gate 	Elf32_Addr	p_vaddr;	/* virtual address */
2870Sstevel@tonic-gate 	Elf32_Addr	p_paddr;	/* physical address */
2880Sstevel@tonic-gate 	Elf32_Word	p_filesz;	/* file size */
2890Sstevel@tonic-gate 	Elf32_Word	p_memsz;	/* memory size */
2900Sstevel@tonic-gate 	Elf32_Word	p_flags;	/* entry flags */
2910Sstevel@tonic-gate 	Elf32_Word	p_align;	/* memory/file alignment */
2920Sstevel@tonic-gate } Elf32_Phdr;
2930Sstevel@tonic-gate 
2940Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
2950Sstevel@tonic-gate typedef struct {
2960Sstevel@tonic-gate 	Elf64_Word	p_type;		/* entry type */
2970Sstevel@tonic-gate 	Elf64_Word	p_flags;	/* entry flags */
2980Sstevel@tonic-gate 	Elf64_Off	p_offset;	/* file offset */
2990Sstevel@tonic-gate 	Elf64_Addr	p_vaddr;	/* virtual address */
3000Sstevel@tonic-gate 	Elf64_Addr	p_paddr;	/* physical address */
3010Sstevel@tonic-gate 	Elf64_Xword	p_filesz;	/* file size */
3020Sstevel@tonic-gate 	Elf64_Xword	p_memsz;	/* memory size */
3030Sstevel@tonic-gate 	Elf64_Xword	p_align;	/* memory/file alignment */
3040Sstevel@tonic-gate } Elf64_Phdr;
3050Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
3060Sstevel@tonic-gate 
3070Sstevel@tonic-gate 
3080Sstevel@tonic-gate #define	PT_NULL		0		/* p_type */
3090Sstevel@tonic-gate #define	PT_LOAD		1
3100Sstevel@tonic-gate #define	PT_DYNAMIC	2
3110Sstevel@tonic-gate #define	PT_INTERP	3
3120Sstevel@tonic-gate #define	PT_NOTE		4
3130Sstevel@tonic-gate #define	PT_SHLIB	5
3140Sstevel@tonic-gate #define	PT_PHDR		6
3150Sstevel@tonic-gate #define	PT_TLS		7
3160Sstevel@tonic-gate #define	PT_NUM		8
3170Sstevel@tonic-gate 
3180Sstevel@tonic-gate #define	PT_LOOS		0x60000000	/* OS specific range */
3190Sstevel@tonic-gate 
3200Sstevel@tonic-gate /*
3210Sstevel@tonic-gate  * Note: The amd64 psABI defines that the UNWIND program header
3220Sstevel@tonic-gate  *	 should reside in the OS specific range of the program
3230Sstevel@tonic-gate  *	 headers.
3240Sstevel@tonic-gate  */
3250Sstevel@tonic-gate #define	PT_SUNW_UNWIND	0x6464e550	/* amd64 UNWIND program header */
3260Sstevel@tonic-gate #define	PT_GNU_EH_FRAME	PT_SUNW_UNWIND
3270Sstevel@tonic-gate 
3280Sstevel@tonic-gate 
3290Sstevel@tonic-gate #define	PT_LOSUNW	0x6ffffffa
3300Sstevel@tonic-gate #define	PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
3310Sstevel@tonic-gate #define	PT_SUNWSTACK	0x6ffffffb	/* describes the stack segment */
3320Sstevel@tonic-gate #define	PT_SUNWDTRACE	0x6ffffffc	/* private */
3330Sstevel@tonic-gate #define	PT_SUNWCAP	0x6ffffffd	/* hard/soft capabilities segment */
3340Sstevel@tonic-gate #define	PT_HISUNW	0x6fffffff
3350Sstevel@tonic-gate #define	PT_HIOS		0x6fffffff
3360Sstevel@tonic-gate 
3370Sstevel@tonic-gate #define	PT_LOPROC	0x70000000	/* processor specific range */
3380Sstevel@tonic-gate #define	PT_HIPROC	0x7fffffff
3390Sstevel@tonic-gate 
3400Sstevel@tonic-gate #define	PF_R		0x4		/* p_flags */
3410Sstevel@tonic-gate #define	PF_W		0x2
3420Sstevel@tonic-gate #define	PF_X		0x1
3430Sstevel@tonic-gate 
3440Sstevel@tonic-gate #define	PF_MASKOS	0x0ff00000	/* OS specific values */
3450Sstevel@tonic-gate #define	PF_MASKPROC	0xf0000000	/* processor specific values */
3460Sstevel@tonic-gate 
3470Sstevel@tonic-gate #define	PF_SUNW_FAILURE	0x00100000	/* mapping absent due to failure */
3480Sstevel@tonic-gate 
349*942Sahl #define	PN_XNUM		0xffff		/* extended program header index */
350*942Sahl 
3510Sstevel@tonic-gate /*
3520Sstevel@tonic-gate  *	Section header
3530Sstevel@tonic-gate  */
3540Sstevel@tonic-gate 
3550Sstevel@tonic-gate typedef struct {
3560Sstevel@tonic-gate 	Elf32_Word	sh_name;	/* section name */
3570Sstevel@tonic-gate 	Elf32_Word	sh_type;	/* SHT_... */
3580Sstevel@tonic-gate 	Elf32_Word	sh_flags;	/* SHF_... */
3590Sstevel@tonic-gate 	Elf32_Addr	sh_addr;	/* virtual address */
3600Sstevel@tonic-gate 	Elf32_Off	sh_offset;	/* file offset */
3610Sstevel@tonic-gate 	Elf32_Word	sh_size;	/* section size */
3620Sstevel@tonic-gate 	Elf32_Word	sh_link;	/* misc info */
3630Sstevel@tonic-gate 	Elf32_Word	sh_info;	/* misc info */
3640Sstevel@tonic-gate 	Elf32_Word	sh_addralign;	/* memory alignment */
3650Sstevel@tonic-gate 	Elf32_Word	sh_entsize;	/* entry size if table */
3660Sstevel@tonic-gate } Elf32_Shdr;
3670Sstevel@tonic-gate 
3680Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
3690Sstevel@tonic-gate typedef struct {
3700Sstevel@tonic-gate 	Elf64_Word	sh_name;	/* section name */
3710Sstevel@tonic-gate 	Elf64_Word	sh_type;	/* SHT_... */
3720Sstevel@tonic-gate 	Elf64_Xword	sh_flags;	/* SHF_... */
3730Sstevel@tonic-gate 	Elf64_Addr	sh_addr;	/* virtual address */
3740Sstevel@tonic-gate 	Elf64_Off	sh_offset;	/* file offset */
3750Sstevel@tonic-gate 	Elf64_Xword	sh_size;	/* section size */
3760Sstevel@tonic-gate 	Elf64_Word	sh_link;	/* misc info */
3770Sstevel@tonic-gate 	Elf64_Word	sh_info;	/* misc info */
3780Sstevel@tonic-gate 	Elf64_Xword	sh_addralign;	/* memory alignment */
3790Sstevel@tonic-gate 	Elf64_Xword	sh_entsize;	/* entry size if table */
3800Sstevel@tonic-gate } Elf64_Shdr;
3810Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
3820Sstevel@tonic-gate 
3830Sstevel@tonic-gate #define	SHT_NULL		0		/* sh_type */
3840Sstevel@tonic-gate #define	SHT_PROGBITS		1
3850Sstevel@tonic-gate #define	SHT_SYMTAB		2
3860Sstevel@tonic-gate #define	SHT_STRTAB		3
3870Sstevel@tonic-gate #define	SHT_RELA		4
3880Sstevel@tonic-gate #define	SHT_HASH		5
3890Sstevel@tonic-gate #define	SHT_DYNAMIC		6
3900Sstevel@tonic-gate #define	SHT_NOTE		7
3910Sstevel@tonic-gate #define	SHT_NOBITS		8
3920Sstevel@tonic-gate #define	SHT_REL			9
3930Sstevel@tonic-gate #define	SHT_SHLIB		10
3940Sstevel@tonic-gate #define	SHT_DYNSYM		11
3950Sstevel@tonic-gate #define	SHT_UNKNOWN12		12
3960Sstevel@tonic-gate #define	SHT_UNKNOWN13		13
3970Sstevel@tonic-gate #define	SHT_INIT_ARRAY		14
3980Sstevel@tonic-gate #define	SHT_FINI_ARRAY		15
3990Sstevel@tonic-gate #define	SHT_PREINIT_ARRAY	16
4000Sstevel@tonic-gate #define	SHT_GROUP		17
4010Sstevel@tonic-gate #define	SHT_SYMTAB_SHNDX	18
4020Sstevel@tonic-gate #define	SHT_NUM			19
4030Sstevel@tonic-gate 
4040Sstevel@tonic-gate #define	SHT_LOOS		0x60000000	/* OS specific range */
4050Sstevel@tonic-gate #define	SHT_LOSUNW		0x6ffffff4
4060Sstevel@tonic-gate #define	SHT_SUNW_dof		0x6ffffff4
4070Sstevel@tonic-gate #define	SHT_SUNW_cap		0x6ffffff5
4080Sstevel@tonic-gate #define	SHT_SUNW_SIGNATURE	0x6ffffff6
4090Sstevel@tonic-gate #define	SHT_SUNW_ANNOTATE	0x6ffffff7
4100Sstevel@tonic-gate #define	SHT_SUNW_DEBUGSTR	0x6ffffff8
4110Sstevel@tonic-gate #define	SHT_SUNW_DEBUG		0x6ffffff9
4120Sstevel@tonic-gate #define	SHT_SUNW_move		0x6ffffffa
4130Sstevel@tonic-gate #define	SHT_SUNW_COMDAT		0x6ffffffb
4140Sstevel@tonic-gate #define	SHT_SUNW_syminfo	0x6ffffffc
4150Sstevel@tonic-gate #define	SHT_SUNW_verdef		0x6ffffffd
4160Sstevel@tonic-gate #define	SHT_SUNW_verneed	0x6ffffffe
4170Sstevel@tonic-gate #define	SHT_SUNW_versym		0x6fffffff
4180Sstevel@tonic-gate #define	SHT_HISUNW		0x6fffffff
4190Sstevel@tonic-gate #define	SHT_HIOS		0x6fffffff
4200Sstevel@tonic-gate 
4210Sstevel@tonic-gate #define	SHT_LOPROC	0x70000000	/* processor specific range */
4220Sstevel@tonic-gate #define	SHT_HIPROC	0x7fffffff
4230Sstevel@tonic-gate 
4240Sstevel@tonic-gate #define	SHT_LOUSER	0x80000000
4250Sstevel@tonic-gate #define	SHT_HIUSER	0xffffffff
4260Sstevel@tonic-gate 
4270Sstevel@tonic-gate #define	SHF_WRITE		0x01		/* sh_flags */
4280Sstevel@tonic-gate #define	SHF_ALLOC		0x02
4290Sstevel@tonic-gate #define	SHF_EXECINSTR		0x04
4300Sstevel@tonic-gate #define	SHF_MERGE		0x10
4310Sstevel@tonic-gate #define	SHF_STRINGS		0x20
4320Sstevel@tonic-gate #define	SHF_INFO_LINK		0x40
4330Sstevel@tonic-gate #define	SHF_LINK_ORDER		0x80
4340Sstevel@tonic-gate #define	SHF_OS_NONCONFORMING	0x100
4350Sstevel@tonic-gate #define	SHF_GROUP		0x200
4360Sstevel@tonic-gate #define	SHF_TLS			0x400
4370Sstevel@tonic-gate 
4380Sstevel@tonic-gate #define	SHF_MASKOS	0x0ff00000	/* OS specific values */
4390Sstevel@tonic-gate 
4400Sstevel@tonic-gate 
4410Sstevel@tonic-gate #define	SHF_MASKPROC	0xf0000000	/* processor specific values */
4420Sstevel@tonic-gate 
4430Sstevel@tonic-gate #define	SHN_UNDEF	0		/* special section numbers */
4440Sstevel@tonic-gate #define	SHN_LORESERVE	0xff00
4450Sstevel@tonic-gate #define	SHN_LOPROC	0xff00		/* processor specific range */
4460Sstevel@tonic-gate #define	SHN_HIPROC	0xff1f
4470Sstevel@tonic-gate #define	SHN_LOOS	0xff20		/* OS specific range */
4480Sstevel@tonic-gate #define	SHN_LOSUNW	0xff3f
4490Sstevel@tonic-gate #define	SHN_SUNW_IGNORE	0xff3f
4500Sstevel@tonic-gate #define	SHN_HISUNW	0xff3f
4510Sstevel@tonic-gate #define	SHN_HIOS	0xff3f
4520Sstevel@tonic-gate #define	SHN_ABS		0xfff1
4530Sstevel@tonic-gate #define	SHN_COMMON	0xfff2
4540Sstevel@tonic-gate #define	SHN_XINDEX	0xffff		/* extended sect index */
4550Sstevel@tonic-gate #define	SHN_HIRESERVE	0xffff
4560Sstevel@tonic-gate 
4570Sstevel@tonic-gate 
4580Sstevel@tonic-gate 
4590Sstevel@tonic-gate /*
4600Sstevel@tonic-gate  *	Symbol table
4610Sstevel@tonic-gate  */
4620Sstevel@tonic-gate 
4630Sstevel@tonic-gate typedef struct {
4640Sstevel@tonic-gate 	Elf32_Word	st_name;
4650Sstevel@tonic-gate 	Elf32_Addr	st_value;
4660Sstevel@tonic-gate 	Elf32_Word	st_size;
4670Sstevel@tonic-gate 	unsigned char	st_info;	/* bind, type: ELF_32_ST_... */
4680Sstevel@tonic-gate 	unsigned char	st_other;
4690Sstevel@tonic-gate 	Elf32_Half	st_shndx;	/* SHN_... */
4700Sstevel@tonic-gate } Elf32_Sym;
4710Sstevel@tonic-gate 
4720Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
4730Sstevel@tonic-gate typedef struct {
4740Sstevel@tonic-gate 	Elf64_Word	st_name;
4750Sstevel@tonic-gate 	unsigned char	st_info;	/* bind, type: ELF_64_ST_... */
4760Sstevel@tonic-gate 	unsigned char	st_other;
4770Sstevel@tonic-gate 	Elf64_Half	st_shndx;	/* SHN_... */
4780Sstevel@tonic-gate 	Elf64_Addr	st_value;
4790Sstevel@tonic-gate 	Elf64_Xword	st_size;
4800Sstevel@tonic-gate } Elf64_Sym;
4810Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
4820Sstevel@tonic-gate 
4830Sstevel@tonic-gate #define	STN_UNDEF	0
4840Sstevel@tonic-gate 
4850Sstevel@tonic-gate /*
4860Sstevel@tonic-gate  *	The macros compose and decompose values for S.st_info
4870Sstevel@tonic-gate  *
4880Sstevel@tonic-gate  *	bind = ELF32_ST_BIND(S.st_info)
4890Sstevel@tonic-gate  *	type = ELF32_ST_TYPE(S.st_info)
4900Sstevel@tonic-gate  *	S.st_info = ELF32_ST_INFO(bind, type)
4910Sstevel@tonic-gate  */
4920Sstevel@tonic-gate 
4930Sstevel@tonic-gate #define	ELF32_ST_BIND(info)		((info) >> 4)
4940Sstevel@tonic-gate #define	ELF32_ST_TYPE(info)		((info) & 0xf)
4950Sstevel@tonic-gate #define	ELF32_ST_INFO(bind, type)	(((bind)<<4)+((type)&0xf))
4960Sstevel@tonic-gate 
4970Sstevel@tonic-gate #define	ELF64_ST_BIND(info)		((info) >> 4)
4980Sstevel@tonic-gate #define	ELF64_ST_TYPE(info)		((info) & 0xf)
4990Sstevel@tonic-gate #define	ELF64_ST_INFO(bind, type)	(((bind)<<4)+((type)&0xf))
5000Sstevel@tonic-gate 
5010Sstevel@tonic-gate 
5020Sstevel@tonic-gate #define	STB_LOCAL	0		/* BIND */
5030Sstevel@tonic-gate #define	STB_GLOBAL	1
5040Sstevel@tonic-gate #define	STB_WEAK	2
5050Sstevel@tonic-gate #define	STB_NUM		3
5060Sstevel@tonic-gate 
5070Sstevel@tonic-gate #define	STB_LOPROC	13		/* processor specific range */
5080Sstevel@tonic-gate #define	STB_HIPROC	15
5090Sstevel@tonic-gate 
5100Sstevel@tonic-gate #define	STT_NOTYPE	0		/* TYPE */
5110Sstevel@tonic-gate #define	STT_OBJECT	1
5120Sstevel@tonic-gate #define	STT_FUNC	2
5130Sstevel@tonic-gate #define	STT_SECTION	3
5140Sstevel@tonic-gate #define	STT_FILE	4
5150Sstevel@tonic-gate #define	STT_COMMON	5
5160Sstevel@tonic-gate #define	STT_TLS		6
5170Sstevel@tonic-gate #define	STT_NUM		7
5180Sstevel@tonic-gate 
5190Sstevel@tonic-gate #define	STT_LOPROC	13		/* processor specific range */
5200Sstevel@tonic-gate #define	STT_HIPROC	15
5210Sstevel@tonic-gate 
5220Sstevel@tonic-gate /*
5230Sstevel@tonic-gate  *	The macros decompose values for S.st_other
5240Sstevel@tonic-gate  *
5250Sstevel@tonic-gate  *	visibility = ELF32_ST_VISIBILITY(S.st_other)
5260Sstevel@tonic-gate  */
5270Sstevel@tonic-gate #define	ELF32_ST_VISIBILITY(other)	((other)&0x3)
5280Sstevel@tonic-gate #define	ELF64_ST_VISIBILITY(other)	((other)&0x3)
5290Sstevel@tonic-gate 
5300Sstevel@tonic-gate #define	STV_DEFAULT	0
5310Sstevel@tonic-gate #define	STV_INTERNAL	1
5320Sstevel@tonic-gate #define	STV_HIDDEN	2
5330Sstevel@tonic-gate #define	STV_PROTECTED	3
5340Sstevel@tonic-gate 
5350Sstevel@tonic-gate 
5360Sstevel@tonic-gate /*
5370Sstevel@tonic-gate  *	Relocation
5380Sstevel@tonic-gate  */
5390Sstevel@tonic-gate 
5400Sstevel@tonic-gate typedef struct {
5410Sstevel@tonic-gate 	Elf32_Addr	r_offset;
5420Sstevel@tonic-gate 	Elf32_Word	r_info;		/* sym, type: ELF32_R_... */
5430Sstevel@tonic-gate } Elf32_Rel;
5440Sstevel@tonic-gate 
5450Sstevel@tonic-gate typedef struct {
5460Sstevel@tonic-gate 	Elf32_Addr	r_offset;
5470Sstevel@tonic-gate 	Elf32_Word	r_info;		/* sym, type: ELF32_R_... */
5480Sstevel@tonic-gate 	Elf32_Sword	r_addend;
5490Sstevel@tonic-gate } Elf32_Rela;
5500Sstevel@tonic-gate 
5510Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
5520Sstevel@tonic-gate typedef struct {
5530Sstevel@tonic-gate 	Elf64_Addr	r_offset;
5540Sstevel@tonic-gate 	Elf64_Xword	r_info;		/* sym, type: ELF64_R_... */
5550Sstevel@tonic-gate } Elf64_Rel;
5560Sstevel@tonic-gate 
5570Sstevel@tonic-gate typedef struct {
5580Sstevel@tonic-gate 	Elf64_Addr	r_offset;
5590Sstevel@tonic-gate 	Elf64_Xword	r_info;		/* sym, type: ELF64_R_... */
5600Sstevel@tonic-gate 	Elf64_Sxword	r_addend;
5610Sstevel@tonic-gate } Elf64_Rela;
5620Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
5630Sstevel@tonic-gate 
5640Sstevel@tonic-gate 
5650Sstevel@tonic-gate /*
5660Sstevel@tonic-gate  *	The macros compose and decompose values for Rel.r_info, Rela.f_info
5670Sstevel@tonic-gate  *
5680Sstevel@tonic-gate  *	sym = ELF32_R_SYM(R.r_info)
5690Sstevel@tonic-gate  *	type = ELF32_R_TYPE(R.r_info)
5700Sstevel@tonic-gate  *	R.r_info = ELF32_R_INFO(sym, type)
5710Sstevel@tonic-gate  */
5720Sstevel@tonic-gate 
5730Sstevel@tonic-gate #define	ELF32_R_SYM(info)	((info)>>8)
5740Sstevel@tonic-gate #define	ELF32_R_TYPE(info)	((unsigned char)(info))
5750Sstevel@tonic-gate #define	ELF32_R_INFO(sym, type)	(((sym)<<8)+(unsigned char)(type))
5760Sstevel@tonic-gate 
5770Sstevel@tonic-gate #define	ELF64_R_SYM(info)	((info)>>32)
5780Sstevel@tonic-gate #define	ELF64_R_TYPE(info)    	((Elf64_Word)(info))
5790Sstevel@tonic-gate #define	ELF64_R_INFO(sym, type)	(((Elf64_Xword)(sym)<<32)+(Elf64_Xword)(type))
5800Sstevel@tonic-gate 
5810Sstevel@tonic-gate 
5820Sstevel@tonic-gate /*
5830Sstevel@tonic-gate  * The r_info field is composed of two 32-bit components: the symbol
5840Sstevel@tonic-gate  * table index and the relocation type.  The relocation type for SPARC V9
5850Sstevel@tonic-gate  * is further decomposed into an 8-bit type identifier and a 24-bit type
5860Sstevel@tonic-gate  * dependent data field.  For the existing Elf32 relocation types,
5870Sstevel@tonic-gate  * that data field is zero.
5880Sstevel@tonic-gate  */
5890Sstevel@tonic-gate #define	ELF64_R_TYPE_DATA(info)	(((Elf64_Xword)(info)<<32)>>40)
5900Sstevel@tonic-gate #define	ELF64_R_TYPE_ID(info)	(((Elf64_Xword)(info)<<56)>>56)
5910Sstevel@tonic-gate #define	ELF64_R_TYPE_INFO(data, type)	\
5920Sstevel@tonic-gate 		(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
5930Sstevel@tonic-gate 
5940Sstevel@tonic-gate 
5950Sstevel@tonic-gate /*
5960Sstevel@tonic-gate  * Section Group Flags (SHT_GROUP)
5970Sstevel@tonic-gate  */
5980Sstevel@tonic-gate #define	GRP_COMDAT	0x01
5990Sstevel@tonic-gate 
6000Sstevel@tonic-gate 
6010Sstevel@tonic-gate /*
6020Sstevel@tonic-gate  *	Note entry header
6030Sstevel@tonic-gate  */
6040Sstevel@tonic-gate 
6050Sstevel@tonic-gate typedef struct {
6060Sstevel@tonic-gate 	Elf32_Word	n_namesz;	/* length of note's name */
6070Sstevel@tonic-gate 	Elf32_Word	n_descsz;	/* length of note's "desc" */
6080Sstevel@tonic-gate 	Elf32_Word	n_type;		/* type of note */
6090Sstevel@tonic-gate } Elf32_Nhdr;
6100Sstevel@tonic-gate 
6110Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
6120Sstevel@tonic-gate typedef struct {
6130Sstevel@tonic-gate 	Elf64_Word	n_namesz;	/* length of note's name */
6140Sstevel@tonic-gate 	Elf64_Word	n_descsz;	/* length of note's "desc" */
6150Sstevel@tonic-gate 	Elf64_Word	n_type;		/* type of note */
6160Sstevel@tonic-gate } Elf64_Nhdr;
6170Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
6180Sstevel@tonic-gate 
6190Sstevel@tonic-gate /*
6200Sstevel@tonic-gate  *	Move entry
6210Sstevel@tonic-gate  */
6220Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
6230Sstevel@tonic-gate typedef struct {
6240Sstevel@tonic-gate 	Elf32_Lword	m_value;	/* symbol value */
6250Sstevel@tonic-gate 	Elf32_Word 	m_info;		/* size + index */
6260Sstevel@tonic-gate 	Elf32_Word	m_poffset;	/* symbol offset */
6270Sstevel@tonic-gate 	Elf32_Half	m_repeat;	/* repeat count */
6280Sstevel@tonic-gate 	Elf32_Half	m_stride;	/* stride info */
6290Sstevel@tonic-gate } Elf32_Move;
6300Sstevel@tonic-gate 
6310Sstevel@tonic-gate /*
6320Sstevel@tonic-gate  *	The macros compose and decompose values for Move.r_info
6330Sstevel@tonic-gate  *
6340Sstevel@tonic-gate  *	sym = ELF32_M_SYM(M.m_info)
6350Sstevel@tonic-gate  *	size = ELF32_M_SIZE(M.m_info)
6360Sstevel@tonic-gate  *	M.m_info = ELF32_M_INFO(sym, size)
6370Sstevel@tonic-gate  */
6380Sstevel@tonic-gate #define	ELF32_M_SYM(info)	((info)>>8)
6390Sstevel@tonic-gate #define	ELF32_M_SIZE(info)	((unsigned char)(info))
6400Sstevel@tonic-gate #define	ELF32_M_INFO(sym, size)	(((sym)<<8)+(unsigned char)(size))
6410Sstevel@tonic-gate 
6420Sstevel@tonic-gate typedef struct {
6430Sstevel@tonic-gate 	Elf64_Lword	m_value;	/* symbol value */
6440Sstevel@tonic-gate 	Elf64_Xword 	m_info;		/* size + index */
6450Sstevel@tonic-gate 	Elf64_Xword	m_poffset;	/* symbol offset */
6460Sstevel@tonic-gate 	Elf64_Half	m_repeat;	/* repeat count */
6470Sstevel@tonic-gate 	Elf64_Half	m_stride;	/* stride info */
6480Sstevel@tonic-gate } Elf64_Move;
6490Sstevel@tonic-gate #define	ELF64_M_SYM(info)	((info)>>8)
6500Sstevel@tonic-gate #define	ELF64_M_SIZE(info)	((unsigned char)(info))
6510Sstevel@tonic-gate #define	ELF64_M_INFO(sym, size)	(((sym)<<8)+(unsigned char)(size))
6520Sstevel@tonic-gate 
6530Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
6540Sstevel@tonic-gate 
6550Sstevel@tonic-gate 
6560Sstevel@tonic-gate /*
6570Sstevel@tonic-gate  *	Hardware/Software capabilities entry
6580Sstevel@tonic-gate  */
6590Sstevel@tonic-gate #ifndef	_ASM
6600Sstevel@tonic-gate typedef struct {
6610Sstevel@tonic-gate 	Elf32_Word	c_tag;		/* how to interpret value */
6620Sstevel@tonic-gate 	union {
6630Sstevel@tonic-gate 		Elf32_Word	c_val;
6640Sstevel@tonic-gate 		Elf32_Addr	c_ptr;
6650Sstevel@tonic-gate 	} c_un;
6660Sstevel@tonic-gate } Elf32_Cap;
6670Sstevel@tonic-gate 
6680Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
6690Sstevel@tonic-gate typedef struct {
6700Sstevel@tonic-gate 	Elf64_Xword	c_tag;		/* how to interpret value */
6710Sstevel@tonic-gate 	union {
6720Sstevel@tonic-gate 		Elf64_Xword	c_val;
6730Sstevel@tonic-gate 		Elf64_Addr	c_ptr;
6740Sstevel@tonic-gate 	} c_un;
6750Sstevel@tonic-gate } Elf64_Cap;
6760Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
6770Sstevel@tonic-gate #endif
6780Sstevel@tonic-gate 
6790Sstevel@tonic-gate #define	CA_SUNW_NULL	0
6800Sstevel@tonic-gate #define	CA_SUNW_HW_1	1		/* first hardware capabilities entry */
6810Sstevel@tonic-gate #define	CA_SUNW_SF_1	2		/* first software capabilities entry */
6820Sstevel@tonic-gate 
6830Sstevel@tonic-gate /*
6840Sstevel@tonic-gate  * Define software capabilities (CA_SUNW_SF_1 values).  Note, hardware
6850Sstevel@tonic-gate  * capabilities (CA_SUNW_HW_1 values) are taken directly from sys/auxv_$MACH.h.
6860Sstevel@tonic-gate  */
6870Sstevel@tonic-gate #define	SF1_SUNW_FPKNWN	0x001		/* use/non-use of frame pointer is */
6880Sstevel@tonic-gate #define	SF1_SUNW_FPUSED	0x002		/*	known, and frame pointer is */
6890Sstevel@tonic-gate 					/*	in use */
6900Sstevel@tonic-gate #define	SF1_SUNW_MASK	0x003		/* known software capabilities mask */
6910Sstevel@tonic-gate 
6920Sstevel@tonic-gate 
6930Sstevel@tonic-gate /*
6940Sstevel@tonic-gate  *	Known values for note entry types (e_type == ET_CORE)
6950Sstevel@tonic-gate  */
6960Sstevel@tonic-gate 
6970Sstevel@tonic-gate #define	NT_PRSTATUS	1	/* prstatus_t	<sys/old_procfs.h>	*/
6980Sstevel@tonic-gate #define	NT_PRFPREG	2	/* prfpregset_t	<sys/old_procfs.h>	*/
6990Sstevel@tonic-gate #define	NT_PRPSINFO	3	/* prpsinfo_t	<sys/old_procfs.h>	*/
7000Sstevel@tonic-gate #define	NT_PRXREG	4	/* prxregset_t	<sys/procfs.h>		*/
7010Sstevel@tonic-gate #define	NT_PLATFORM	5	/* string from sysinfo(SI_PLATFORM)	*/
7020Sstevel@tonic-gate #define	NT_AUXV		6	/* auxv_t array	<sys/auxv.h>		*/
7030Sstevel@tonic-gate #define	NT_GWINDOWS	7	/* gwindows_t	SPARC only		*/
7040Sstevel@tonic-gate #define	NT_ASRS		8	/* asrset_t	SPARC V9 only		*/
7050Sstevel@tonic-gate #define	NT_LDT		9	/* ssd array	<sys/sysi86.h> IA32 only */
7060Sstevel@tonic-gate #define	NT_PSTATUS	10	/* pstatus_t	<sys/procfs.h>		*/
7070Sstevel@tonic-gate #define	NT_PSINFO	13	/* psinfo_t	<sys/procfs.h>		*/
7080Sstevel@tonic-gate #define	NT_PRCRED	14	/* prcred_t	<sys/procfs.h>		*/
7090Sstevel@tonic-gate #define	NT_UTSNAME	15	/* struct utsname <sys/utsname.h>	*/
7100Sstevel@tonic-gate #define	NT_LWPSTATUS	16	/* lwpstatus_t	<sys/procfs.h>		*/
7110Sstevel@tonic-gate #define	NT_LWPSINFO	17	/* lwpsinfo_t	<sys/procfs.h>		*/
7120Sstevel@tonic-gate #define	NT_PRPRIV	18	/* prpriv_t	<sys/procfs.h>		*/
7130Sstevel@tonic-gate #define	NT_PRPRIVINFO	19	/* priv_impl_info_t <sys/priv.h>	*/
7140Sstevel@tonic-gate #define	NT_CONTENT	20	/* core_content_t <sys/corectl.h>	*/
7150Sstevel@tonic-gate #define	NT_ZONENAME	21	/* string from getzonenamebyid(3C)	*/
7160Sstevel@tonic-gate 
7170Sstevel@tonic-gate #ifdef _KERNEL
7180Sstevel@tonic-gate /*
7190Sstevel@tonic-gate  * The following routine checks the processor-specific
7200Sstevel@tonic-gate  * fields of an ELF header.
7210Sstevel@tonic-gate  */
7220Sstevel@tonic-gate int	elfheadcheck(unsigned char, Elf32_Half, Elf32_Word);
7230Sstevel@tonic-gate #endif
7240Sstevel@tonic-gate 
7250Sstevel@tonic-gate #ifdef	__cplusplus
7260Sstevel@tonic-gate }
7270Sstevel@tonic-gate #endif
7280Sstevel@tonic-gate 
7290Sstevel@tonic-gate #if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_M32)
7300Sstevel@tonic-gate #include <sys/elf_M32.h>
7310Sstevel@tonic-gate #endif
7320Sstevel@tonic-gate 
7330Sstevel@tonic-gate #if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_SPARC)
7340Sstevel@tonic-gate #include <sys/elf_SPARC.h>
7350Sstevel@tonic-gate #endif
7360Sstevel@tonic-gate 
7370Sstevel@tonic-gate #if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_386)
7380Sstevel@tonic-gate #include <sys/elf_386.h>
7390Sstevel@tonic-gate #endif
7400Sstevel@tonic-gate 
7410Sstevel@tonic-gate #if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_AMD64)
7420Sstevel@tonic-gate #include <sys/elf_amd64.h>
7430Sstevel@tonic-gate #endif
7440Sstevel@tonic-gate 
7450Sstevel@tonic-gate #endif	/* _SYS_ELF_H */
746