xref: /titanic_44/usr/src/uts/common/sys/elf_386.h (revision d9452f237f843c1321abb5810d2f9ee6cbeae43c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52926dd2eSrie  * Common Development and Distribution License (the "License").
62926dd2eSrie  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate /*
232926dd2eSrie  *	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
242926dd2eSrie  *	  All Rights Reserved
252926dd2eSrie  *
26*d9452f23SEdward Pilatowicz  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_ELF_386_H
317c478bd9Sstevel@tonic-gate #define	_SYS_ELF_386_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #define	R_386_NONE		0	/* relocation type */
387c478bd9Sstevel@tonic-gate #define	R_386_32		1
397c478bd9Sstevel@tonic-gate #define	R_386_PC32		2
407c478bd9Sstevel@tonic-gate #define	R_386_GOT32		3
417c478bd9Sstevel@tonic-gate #define	R_386_PLT32		4
427c478bd9Sstevel@tonic-gate #define	R_386_COPY		5
437c478bd9Sstevel@tonic-gate #define	R_386_GLOB_DAT		6
447c478bd9Sstevel@tonic-gate #define	R_386_JMP_SLOT		7
457c478bd9Sstevel@tonic-gate #define	R_386_RELATIVE		8
467c478bd9Sstevel@tonic-gate #define	R_386_GOTOFF		9
477c478bd9Sstevel@tonic-gate #define	R_386_GOTPC		10
487c478bd9Sstevel@tonic-gate #define	R_386_32PLT		11
497c478bd9Sstevel@tonic-gate #define	R_386_TLS_GD_PLT	12
507c478bd9Sstevel@tonic-gate #define	R_386_TLS_LDM_PLT	13
517c478bd9Sstevel@tonic-gate #define	R_386_TLS_TPOFF		14
527c478bd9Sstevel@tonic-gate #define	R_386_TLS_IE		15
537c478bd9Sstevel@tonic-gate #define	R_386_TLS_GOTIE		16
547c478bd9Sstevel@tonic-gate #define	R_386_TLS_LE		17
557c478bd9Sstevel@tonic-gate #define	R_386_TLS_GD		18
567c478bd9Sstevel@tonic-gate #define	R_386_TLS_LDM		19
577c478bd9Sstevel@tonic-gate #define	R_386_16		20
587c478bd9Sstevel@tonic-gate #define	R_386_PC16		21
597c478bd9Sstevel@tonic-gate #define	R_386_8			22
607c478bd9Sstevel@tonic-gate #define	R_386_PC8		23
617c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN24		24
627c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN25		25
637c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN26		26
647c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN27		27
657c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN28		28
667c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN29		29
677c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN30		30
687c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN31		31
697c478bd9Sstevel@tonic-gate #define	R_386_TLS_LDO_32	32
707c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN33		33
717c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN34		34
727c478bd9Sstevel@tonic-gate #define	R_386_TLS_DTPMOD32	35
737c478bd9Sstevel@tonic-gate #define	R_386_TLS_DTPOFF32	36
747c478bd9Sstevel@tonic-gate #define	R_386_UNKNOWN37		37
752926dd2eSrie #define	R_386_SIZE32		38
762926dd2eSrie #define	R_386_NUM		39
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #define	ELF_386_MAXPGSZ		0x10000	/* maximum page size */
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate #define	SHF_ORDERED	0x40000000
817c478bd9Sstevel@tonic-gate #define	SHF_EXCLUDE	0x80000000
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #define	SHN_BEFORE	0xff00
847c478bd9Sstevel@tonic-gate #define	SHN_AFTER	0xff01
857c478bd9Sstevel@tonic-gate 
86*d9452f23SEdward Pilatowicz /*
87*d9452f23SEdward Pilatowicz  * There are consumers of this file that want to include elf defines for
88*d9452f23SEdward Pilatowicz  * all architectures.  This is a problem for the defines below, because
89*d9452f23SEdward Pilatowicz  * while they are architecture specific they have common names.  Hence to
90*d9452f23SEdward Pilatowicz  * prevent attempts to redefine these variables we'll check if any of
91*d9452f23SEdward Pilatowicz  * the other elf architecture header files have been included.  If
92*d9452f23SEdward Pilatowicz  * they have then we'll just stick with the existing definitions.
93*d9452f23SEdward Pilatowicz  */
94*d9452f23SEdward Pilatowicz #if !defined(_SYS_ELF_MACH_COMMON)
95*d9452f23SEdward Pilatowicz #define	_SYS_ELF_MACH_COMMON
96*d9452f23SEdward Pilatowicz #define	_SYS_ELF_MACH_386
97*d9452f23SEdward Pilatowicz 
98*d9452f23SEdward Pilatowicz /*
99*d9452f23SEdward Pilatowicz  * Plt and Got information; the first few .got and .plt entries are reserved
100*d9452f23SEdward Pilatowicz  *	PLT[0]	jump to dynamic linker
101*d9452f23SEdward Pilatowicz  *	GOT[0]	address of _DYNAMIC
102*d9452f23SEdward Pilatowicz  */
103*d9452f23SEdward Pilatowicz #define	M_PLT_INSSIZE		6	/* single plt instruction size */
104*d9452f23SEdward Pilatowicz #define	M_PLT_XNumber		1	/* PLT[0] reserved */
105*d9452f23SEdward Pilatowicz #define	M_GOT_XDYNAMIC		0	/* got index for _DYNAMIC */
106*d9452f23SEdward Pilatowicz #define	M_GOT_XLINKMAP		1	/* got index for link map */
107*d9452f23SEdward Pilatowicz #define	M_GOT_XRTLD		2	/* got index for rtbinder */
108*d9452f23SEdward Pilatowicz #define	M_GOT_XNumber		3	/* reserved no. of got entries */
109*d9452f23SEdward Pilatowicz 
110*d9452f23SEdward Pilatowicz #define	M32_WORD_ALIGN		4
111*d9452f23SEdward Pilatowicz #define	M32_PLT_ENTSIZE		16	/* plt entry size in bytes */
112*d9452f23SEdward Pilatowicz #define	M32_PLT_ALIGN		M32_WORD_ALIGN	/* alignment of .plt section */
113*d9452f23SEdward Pilatowicz #define	M32_GOT_ENTSIZE		4	/* got entry size in bytes */
114*d9452f23SEdward Pilatowicz #define	M32_PLT_RESERVSZ	(M_PLT_XNumber * \
115*d9452f23SEdward Pilatowicz 				M32_PLT_ENTSIZE) /* first plt reserved */
116*d9452f23SEdward Pilatowicz 
117*d9452f23SEdward Pilatowicz 
118*d9452f23SEdward Pilatowicz /*
119*d9452f23SEdward Pilatowicz  * Make common alias for the 32/64 bit specific defines based on _ELF64
120*d9452f23SEdward Pilatowicz  */
121*d9452f23SEdward Pilatowicz #if !defined(_ELF64)
122*d9452f23SEdward Pilatowicz /* architecture common defines */
123*d9452f23SEdward Pilatowicz #define	M_WORD_ALIGN		M32_WORD_ALIGN
124*d9452f23SEdward Pilatowicz #define	M_PLT_ENTSIZE		M32_PLT_ENTSIZE
125*d9452f23SEdward Pilatowicz #define	M_PLT_ALIGN		M32_PLT_ALIGN
126*d9452f23SEdward Pilatowicz #define	M_PLT_RESERVSZ		M32_PLT_RESERVSZ
127*d9452f23SEdward Pilatowicz #define	M_GOT_ENTSIZE		M32_GOT_ENTSIZE
128*d9452f23SEdward Pilatowicz #endif /* !_ELF64 */
129*d9452f23SEdward Pilatowicz 
130*d9452f23SEdward Pilatowicz #endif /* !_SYS_ELF_MACH_COMMON */
131*d9452f23SEdward Pilatowicz 
1327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1337c478bd9Sstevel@tonic-gate }
1347c478bd9Sstevel@tonic-gate #endif
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate #endif	/* _SYS_ELF_386_H */
137