xref: /illumos-gate/usr/src/uts/common/sys/elf_386.h (revision a530dbfe)
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  *
26d9452f23SEdward 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
61*a530dbfeSRichard Lowe #define	R_386_TLS_GD_32		24
62*a530dbfeSRichard Lowe #define	R_386_TLS_GD_PUSH	25
63*a530dbfeSRichard Lowe #define	R_386_TLS_GD_CALL	26
64*a530dbfeSRichard Lowe #define	R_386_TLS_GD_POP	27
65*a530dbfeSRichard Lowe #define	R_386_TLS_LDM_32	28
66*a530dbfeSRichard Lowe #define	R_386_TLS_LDM_PUSH	29
67*a530dbfeSRichard Lowe #define	R_386_TLS_LDM_CALL	30
68*a530dbfeSRichard Lowe #define	R_386_TLS_LDM_POP	31
697c478bd9Sstevel@tonic-gate #define	R_386_TLS_LDO_32	32
70*a530dbfeSRichard Lowe #define	R_386_TLS_IE_32		33
71*a530dbfeSRichard Lowe #define	R_386_TLS_LE_32		34
727c478bd9Sstevel@tonic-gate #define	R_386_TLS_DTPMOD32	35
737c478bd9Sstevel@tonic-gate #define	R_386_TLS_DTPOFF32	36
74*a530dbfeSRichard Lowe #define	R_386_TLS_TPOFF32	37
752926dd2eSrie #define	R_386_SIZE32		38
76*a530dbfeSRichard Lowe #define	R_386_TLS_GOTDESC	39
77*a530dbfeSRichard Lowe #define	R_386_TLS_DESC_CALL	40
78*a530dbfeSRichard Lowe #define	R_386_TLS_DESC		41
79*a530dbfeSRichard Lowe #define	R_386_IRELATIVE		42
80*a530dbfeSRichard Lowe #define	R_386_GOT32X		43
81*a530dbfeSRichard Lowe #define	R_386_NUM		44
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #define	ELF_386_MAXPGSZ		0x10000	/* maximum page size */
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #define	SHF_ORDERED	0x40000000
867c478bd9Sstevel@tonic-gate #define	SHF_EXCLUDE	0x80000000
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #define	SHN_BEFORE	0xff00
897c478bd9Sstevel@tonic-gate #define	SHN_AFTER	0xff01
907c478bd9Sstevel@tonic-gate 
91d9452f23SEdward Pilatowicz /*
92d9452f23SEdward Pilatowicz  * There are consumers of this file that want to include elf defines for
93d9452f23SEdward Pilatowicz  * all architectures.  This is a problem for the defines below, because
94d9452f23SEdward Pilatowicz  * while they are architecture specific they have common names.  Hence to
95d9452f23SEdward Pilatowicz  * prevent attempts to redefine these variables we'll check if any of
96d9452f23SEdward Pilatowicz  * the other elf architecture header files have been included.  If
97d9452f23SEdward Pilatowicz  * they have then we'll just stick with the existing definitions.
98d9452f23SEdward Pilatowicz  */
99d9452f23SEdward Pilatowicz #if !defined(_SYS_ELF_MACH_COMMON)
100d9452f23SEdward Pilatowicz #define	_SYS_ELF_MACH_COMMON
101d9452f23SEdward Pilatowicz #define	_SYS_ELF_MACH_386
102d9452f23SEdward Pilatowicz 
103d9452f23SEdward Pilatowicz /*
104d9452f23SEdward Pilatowicz  * Plt and Got information; the first few .got and .plt entries are reserved
105d9452f23SEdward Pilatowicz  *	PLT[0]	jump to dynamic linker
106d9452f23SEdward Pilatowicz  *	GOT[0]	address of _DYNAMIC
107d9452f23SEdward Pilatowicz  */
108d9452f23SEdward Pilatowicz #define	M_PLT_INSSIZE		6	/* single plt instruction size */
109d9452f23SEdward Pilatowicz #define	M_PLT_XNumber		1	/* PLT[0] reserved */
110d9452f23SEdward Pilatowicz #define	M_GOT_XDYNAMIC		0	/* got index for _DYNAMIC */
111d9452f23SEdward Pilatowicz #define	M_GOT_XLINKMAP		1	/* got index for link map */
112d9452f23SEdward Pilatowicz #define	M_GOT_XRTLD		2	/* got index for rtbinder */
113d9452f23SEdward Pilatowicz #define	M_GOT_XNumber		3	/* reserved no. of got entries */
114d9452f23SEdward Pilatowicz 
115d9452f23SEdward Pilatowicz #define	M32_WORD_ALIGN		4
116d9452f23SEdward Pilatowicz #define	M32_PLT_ENTSIZE		16	/* plt entry size in bytes */
117d9452f23SEdward Pilatowicz #define	M32_PLT_ALIGN		M32_WORD_ALIGN	/* alignment of .plt section */
118d9452f23SEdward Pilatowicz #define	M32_GOT_ENTSIZE		4	/* got entry size in bytes */
119d9452f23SEdward Pilatowicz #define	M32_PLT_RESERVSZ	(M_PLT_XNumber * \
120d9452f23SEdward Pilatowicz 				M32_PLT_ENTSIZE) /* first plt reserved */
121d9452f23SEdward Pilatowicz 
122d9452f23SEdward Pilatowicz 
123d9452f23SEdward Pilatowicz /*
124d9452f23SEdward Pilatowicz  * Make common alias for the 32/64 bit specific defines based on _ELF64
125d9452f23SEdward Pilatowicz  */
126d9452f23SEdward Pilatowicz #if !defined(_ELF64)
127d9452f23SEdward Pilatowicz /* architecture common defines */
128d9452f23SEdward Pilatowicz #define	M_WORD_ALIGN		M32_WORD_ALIGN
129d9452f23SEdward Pilatowicz #define	M_PLT_ENTSIZE		M32_PLT_ENTSIZE
130d9452f23SEdward Pilatowicz #define	M_PLT_ALIGN		M32_PLT_ALIGN
131d9452f23SEdward Pilatowicz #define	M_PLT_RESERVSZ		M32_PLT_RESERVSZ
132d9452f23SEdward Pilatowicz #define	M_GOT_ENTSIZE		M32_GOT_ENTSIZE
133d9452f23SEdward Pilatowicz #endif /* !_ELF64 */
134d9452f23SEdward Pilatowicz 
135d9452f23SEdward Pilatowicz #endif /* !_SYS_ELF_MACH_COMMON */
136d9452f23SEdward Pilatowicz 
1377c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1387c478bd9Sstevel@tonic-gate }
1397c478bd9Sstevel@tonic-gate #endif
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate #endif	/* _SYS_ELF_386_H */
142