xref: /onnv-gate/usr/src/uts/common/sys/elf_386.h (revision 10201:47013accbd9c)
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
52850Srie  * Common Development and Distribution License (the "License").
62850Srie  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate 
220Sstevel@tonic-gate /*
232850Srie  *	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
242850Srie  *	  All Rights Reserved
252850Srie  *
26*10201SEdward.Pilatowicz@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
270Sstevel@tonic-gate  * Use is subject to license terms.
280Sstevel@tonic-gate  */
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifndef _SYS_ELF_386_H
310Sstevel@tonic-gate #define	_SYS_ELF_386_H
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #define	R_386_NONE		0	/* relocation type */
380Sstevel@tonic-gate #define	R_386_32		1
390Sstevel@tonic-gate #define	R_386_PC32		2
400Sstevel@tonic-gate #define	R_386_GOT32		3
410Sstevel@tonic-gate #define	R_386_PLT32		4
420Sstevel@tonic-gate #define	R_386_COPY		5
430Sstevel@tonic-gate #define	R_386_GLOB_DAT		6
440Sstevel@tonic-gate #define	R_386_JMP_SLOT		7
450Sstevel@tonic-gate #define	R_386_RELATIVE		8
460Sstevel@tonic-gate #define	R_386_GOTOFF		9
470Sstevel@tonic-gate #define	R_386_GOTPC		10
480Sstevel@tonic-gate #define	R_386_32PLT		11
490Sstevel@tonic-gate #define	R_386_TLS_GD_PLT	12
500Sstevel@tonic-gate #define	R_386_TLS_LDM_PLT	13
510Sstevel@tonic-gate #define	R_386_TLS_TPOFF		14
520Sstevel@tonic-gate #define	R_386_TLS_IE		15
530Sstevel@tonic-gate #define	R_386_TLS_GOTIE		16
540Sstevel@tonic-gate #define	R_386_TLS_LE		17
550Sstevel@tonic-gate #define	R_386_TLS_GD		18
560Sstevel@tonic-gate #define	R_386_TLS_LDM		19
570Sstevel@tonic-gate #define	R_386_16		20
580Sstevel@tonic-gate #define	R_386_PC16		21
590Sstevel@tonic-gate #define	R_386_8			22
600Sstevel@tonic-gate #define	R_386_PC8		23
610Sstevel@tonic-gate #define	R_386_UNKNOWN24		24
620Sstevel@tonic-gate #define	R_386_UNKNOWN25		25
630Sstevel@tonic-gate #define	R_386_UNKNOWN26		26
640Sstevel@tonic-gate #define	R_386_UNKNOWN27		27
650Sstevel@tonic-gate #define	R_386_UNKNOWN28		28
660Sstevel@tonic-gate #define	R_386_UNKNOWN29		29
670Sstevel@tonic-gate #define	R_386_UNKNOWN30		30
680Sstevel@tonic-gate #define	R_386_UNKNOWN31		31
690Sstevel@tonic-gate #define	R_386_TLS_LDO_32	32
700Sstevel@tonic-gate #define	R_386_UNKNOWN33		33
710Sstevel@tonic-gate #define	R_386_UNKNOWN34		34
720Sstevel@tonic-gate #define	R_386_TLS_DTPMOD32	35
730Sstevel@tonic-gate #define	R_386_TLS_DTPOFF32	36
740Sstevel@tonic-gate #define	R_386_UNKNOWN37		37
752850Srie #define	R_386_SIZE32		38
762850Srie #define	R_386_NUM		39
770Sstevel@tonic-gate 
780Sstevel@tonic-gate #define	ELF_386_MAXPGSZ		0x10000	/* maximum page size */
790Sstevel@tonic-gate 
800Sstevel@tonic-gate #define	SHF_ORDERED	0x40000000
810Sstevel@tonic-gate #define	SHF_EXCLUDE	0x80000000
820Sstevel@tonic-gate 
830Sstevel@tonic-gate #define	SHN_BEFORE	0xff00
840Sstevel@tonic-gate #define	SHN_AFTER	0xff01
850Sstevel@tonic-gate 
86*10201SEdward.Pilatowicz@Sun.COM /*
87*10201SEdward.Pilatowicz@Sun.COM  * There are consumers of this file that want to include elf defines for
88*10201SEdward.Pilatowicz@Sun.COM  * all architectures.  This is a problem for the defines below, because
89*10201SEdward.Pilatowicz@Sun.COM  * while they are architecture specific they have common names.  Hence to
90*10201SEdward.Pilatowicz@Sun.COM  * prevent attempts to redefine these variables we'll check if any of
91*10201SEdward.Pilatowicz@Sun.COM  * the other elf architecture header files have been included.  If
92*10201SEdward.Pilatowicz@Sun.COM  * they have then we'll just stick with the existing definitions.
93*10201SEdward.Pilatowicz@Sun.COM  */
94*10201SEdward.Pilatowicz@Sun.COM #if !defined(_SYS_ELF_MACH_COMMON)
95*10201SEdward.Pilatowicz@Sun.COM #define	_SYS_ELF_MACH_COMMON
96*10201SEdward.Pilatowicz@Sun.COM #define	_SYS_ELF_MACH_386
97*10201SEdward.Pilatowicz@Sun.COM 
98*10201SEdward.Pilatowicz@Sun.COM /*
99*10201SEdward.Pilatowicz@Sun.COM  * Plt and Got information; the first few .got and .plt entries are reserved
100*10201SEdward.Pilatowicz@Sun.COM  *	PLT[0]	jump to dynamic linker
101*10201SEdward.Pilatowicz@Sun.COM  *	GOT[0]	address of _DYNAMIC
102*10201SEdward.Pilatowicz@Sun.COM  */
103*10201SEdward.Pilatowicz@Sun.COM #define	M_PLT_INSSIZE		6	/* single plt instruction size */
104*10201SEdward.Pilatowicz@Sun.COM #define	M_PLT_XNumber		1	/* PLT[0] reserved */
105*10201SEdward.Pilatowicz@Sun.COM #define	M_GOT_XDYNAMIC		0	/* got index for _DYNAMIC */
106*10201SEdward.Pilatowicz@Sun.COM #define	M_GOT_XLINKMAP		1	/* got index for link map */
107*10201SEdward.Pilatowicz@Sun.COM #define	M_GOT_XRTLD		2	/* got index for rtbinder */
108*10201SEdward.Pilatowicz@Sun.COM #define	M_GOT_XNumber		3	/* reserved no. of got entries */
109*10201SEdward.Pilatowicz@Sun.COM 
110*10201SEdward.Pilatowicz@Sun.COM #define	M32_WORD_ALIGN		4
111*10201SEdward.Pilatowicz@Sun.COM #define	M32_PLT_ENTSIZE		16	/* plt entry size in bytes */
112*10201SEdward.Pilatowicz@Sun.COM #define	M32_PLT_ALIGN		M32_WORD_ALIGN	/* alignment of .plt section */
113*10201SEdward.Pilatowicz@Sun.COM #define	M32_GOT_ENTSIZE		4	/* got entry size in bytes */
114*10201SEdward.Pilatowicz@Sun.COM #define	M32_PLT_RESERVSZ	(M_PLT_XNumber * \
115*10201SEdward.Pilatowicz@Sun.COM 				M32_PLT_ENTSIZE) /* first plt reserved */
116*10201SEdward.Pilatowicz@Sun.COM 
117*10201SEdward.Pilatowicz@Sun.COM 
118*10201SEdward.Pilatowicz@Sun.COM /*
119*10201SEdward.Pilatowicz@Sun.COM  * Make common alias for the 32/64 bit specific defines based on _ELF64
120*10201SEdward.Pilatowicz@Sun.COM  */
121*10201SEdward.Pilatowicz@Sun.COM #if !defined(_ELF64)
122*10201SEdward.Pilatowicz@Sun.COM /* architecture common defines */
123*10201SEdward.Pilatowicz@Sun.COM #define	M_WORD_ALIGN		M32_WORD_ALIGN
124*10201SEdward.Pilatowicz@Sun.COM #define	M_PLT_ENTSIZE		M32_PLT_ENTSIZE
125*10201SEdward.Pilatowicz@Sun.COM #define	M_PLT_ALIGN		M32_PLT_ALIGN
126*10201SEdward.Pilatowicz@Sun.COM #define	M_PLT_RESERVSZ		M32_PLT_RESERVSZ
127*10201SEdward.Pilatowicz@Sun.COM #define	M_GOT_ENTSIZE		M32_GOT_ENTSIZE
128*10201SEdward.Pilatowicz@Sun.COM #endif /* !_ELF64 */
129*10201SEdward.Pilatowicz@Sun.COM 
130*10201SEdward.Pilatowicz@Sun.COM #endif /* !_SYS_ELF_MACH_COMMON */
131*10201SEdward.Pilatowicz@Sun.COM 
1320Sstevel@tonic-gate #ifdef	__cplusplus
1330Sstevel@tonic-gate }
1340Sstevel@tonic-gate #endif
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate #endif	/* _SYS_ELF_386_H */
137