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/*
23 *	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
24 *	  All Rights Reserved
25 *
26 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
27 * Use is subject to license terms.
28 */
29
30#ifndef _SYS_ELF_386_H
31#define	_SYS_ELF_386_H
32
33#ifdef	__cplusplus
34extern "C" {
35#endif
36
37#define	R_386_NONE		0	/* relocation type */
38#define	R_386_32		1
39#define	R_386_PC32		2
40#define	R_386_GOT32		3
41#define	R_386_PLT32		4
42#define	R_386_COPY		5
43#define	R_386_GLOB_DAT		6
44#define	R_386_JMP_SLOT		7
45#define	R_386_RELATIVE		8
46#define	R_386_GOTOFF		9
47#define	R_386_GOTPC		10
48#define	R_386_32PLT		11
49#define	R_386_TLS_GD_PLT	12
50#define	R_386_TLS_LDM_PLT	13
51#define	R_386_TLS_TPOFF		14
52#define	R_386_TLS_IE		15
53#define	R_386_TLS_GOTIE		16
54#define	R_386_TLS_LE		17
55#define	R_386_TLS_GD		18
56#define	R_386_TLS_LDM		19
57#define	R_386_16		20
58#define	R_386_PC16		21
59#define	R_386_8			22
60#define	R_386_PC8		23
61#define	R_386_UNKNOWN24		24
62#define	R_386_UNKNOWN25		25
63#define	R_386_UNKNOWN26		26
64#define	R_386_UNKNOWN27		27
65#define	R_386_UNKNOWN28		28
66#define	R_386_UNKNOWN29		29
67#define	R_386_UNKNOWN30		30
68#define	R_386_UNKNOWN31		31
69#define	R_386_TLS_LDO_32	32
70#define	R_386_UNKNOWN33		33
71#define	R_386_UNKNOWN34		34
72#define	R_386_TLS_DTPMOD32	35
73#define	R_386_TLS_DTPOFF32	36
74#define	R_386_UNKNOWN37		37
75#define	R_386_SIZE32		38
76#define	R_386_NUM		39
77
78#define	ELF_386_MAXPGSZ		0x10000	/* maximum page size */
79
80#define	SHF_ORDERED	0x40000000
81#define	SHF_EXCLUDE	0x80000000
82
83#define	SHN_BEFORE	0xff00
84#define	SHN_AFTER	0xff01
85
86/*
87 * There are consumers of this file that want to include elf defines for
88 * all architectures.  This is a problem for the defines below, because
89 * while they are architecture specific they have common names.  Hence to
90 * prevent attempts to redefine these variables we'll check if any of
91 * the other elf architecture header files have been included.  If
92 * they have then we'll just stick with the existing definitions.
93 */
94#if !defined(_SYS_ELF_MACH_COMMON)
95#define	_SYS_ELF_MACH_COMMON
96#define	_SYS_ELF_MACH_386
97
98/*
99 * Plt and Got information; the first few .got and .plt entries are reserved
100 *	PLT[0]	jump to dynamic linker
101 *	GOT[0]	address of _DYNAMIC
102 */
103#define	M_PLT_INSSIZE		6	/* single plt instruction size */
104#define	M_PLT_XNumber		1	/* PLT[0] reserved */
105#define	M_GOT_XDYNAMIC		0	/* got index for _DYNAMIC */
106#define	M_GOT_XLINKMAP		1	/* got index for link map */
107#define	M_GOT_XRTLD		2	/* got index for rtbinder */
108#define	M_GOT_XNumber		3	/* reserved no. of got entries */
109
110#define	M32_WORD_ALIGN		4
111#define	M32_PLT_ENTSIZE		16	/* plt entry size in bytes */
112#define	M32_PLT_ALIGN		M32_WORD_ALIGN	/* alignment of .plt section */
113#define	M32_GOT_ENTSIZE		4	/* got entry size in bytes */
114#define	M32_PLT_RESERVSZ	(M_PLT_XNumber * \
115				M32_PLT_ENTSIZE) /* first plt reserved */
116
117
118/*
119 * Make common alias for the 32/64 bit specific defines based on _ELF64
120 */
121#if !defined(_ELF64)
122/* architecture common defines */
123#define	M_WORD_ALIGN		M32_WORD_ALIGN
124#define	M_PLT_ENTSIZE		M32_PLT_ENTSIZE
125#define	M_PLT_ALIGN		M32_PLT_ALIGN
126#define	M_PLT_RESERVSZ		M32_PLT_RESERVSZ
127#define	M_GOT_ENTSIZE		M32_GOT_ENTSIZE
128#endif /* !_ELF64 */
129
130#endif /* !_SYS_ELF_MACH_COMMON */
131
132#ifdef	__cplusplus
133}
134#endif
135
136#endif	/* _SYS_ELF_386_H */
137