xref: /illumos-gate/usr/src/uts/common/sys/elf_SPARC.h (revision 4de2612967d06c4fdbf524a62556a1e8118a006f)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
24  *	  All Rights Reserved
25  *
26  *
27  *	Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
28  *	Use is subject to license terms.
29  */
30 
31 #ifndef _SYS_ELF_SPARC_H
32 #define	_SYS_ELF_SPARC_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.2 */
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #define	EF_SPARC_32PLUS_MASK	0xffff00	/* bits indicating V8+ type */
41 #define	EF_SPARC_32PLUS		0x000100	/* generic V8+ features */
42 #define	EF_SPARC_EXT_MASK	0xffff00	/* bits for vendor extensions */
43 #define	EF_SPARC_SUN_US1	0x000200	/* Sun UltraSPARC1 extensions */
44 #define	EF_SPARC_HAL_R1		0x000400	/* HAL R1 extensions */
45 #define	EF_SPARC_SUN_US3	0x000800	/* Sun UltraSPARC3 extensions */
46 
47 #define	EF_SPARCV9_MM		0x3		/* mask for memory model */
48 #define	EF_SPARCV9_TSO		0x0		/* total store ordering */
49 #define	EF_SPARCV9_PSO		0x1		/* partial store ordering */
50 #define	EF_SPARCV9_RMO		0x2		/* relaxed memory ordering */
51 
52 #define	R_SPARC_NONE		0		/* relocation type */
53 #define	R_SPARC_8		1
54 #define	R_SPARC_16		2
55 #define	R_SPARC_32		3
56 #define	R_SPARC_DISP8		4
57 #define	R_SPARC_DISP16		5
58 #define	R_SPARC_DISP32		6
59 #define	R_SPARC_WDISP30		7
60 #define	R_SPARC_WDISP22		8
61 #define	R_SPARC_HI22		9
62 #define	R_SPARC_22		10
63 #define	R_SPARC_13		11
64 #define	R_SPARC_LO10		12
65 #define	R_SPARC_GOT10		13
66 #define	R_SPARC_GOT13		14
67 #define	R_SPARC_GOT22		15
68 #define	R_SPARC_PC10		16
69 #define	R_SPARC_PC22		17
70 #define	R_SPARC_WPLT30		18
71 #define	R_SPARC_COPY		19
72 #define	R_SPARC_GLOB_DAT	20
73 #define	R_SPARC_JMP_SLOT	21
74 #define	R_SPARC_RELATIVE	22
75 #define	R_SPARC_UA32		23
76 #define	R_SPARC_PLT32		24
77 #define	R_SPARC_HIPLT22		25
78 #define	R_SPARC_LOPLT10		26
79 #define	R_SPARC_PCPLT32		27
80 #define	R_SPARC_PCPLT22		28
81 #define	R_SPARC_PCPLT10		29
82 #define	R_SPARC_10		30
83 #define	R_SPARC_11		31
84 #define	R_SPARC_64		32
85 #define	R_SPARC_OLO10		33
86 #define	R_SPARC_HH22		34
87 #define	R_SPARC_HM10		35
88 #define	R_SPARC_LM22		36
89 #define	R_SPARC_PC_HH22		37
90 #define	R_SPARC_PC_HM10		38
91 #define	R_SPARC_PC_LM22		39
92 #define	R_SPARC_WDISP16		40
93 #define	R_SPARC_WDISP19		41
94 #define	R_SPARC_GLOB_JMP	42
95 #define	R_SPARC_7		43
96 #define	R_SPARC_5		44
97 #define	R_SPARC_6		45
98 #define	R_SPARC_DISP64		46
99 #define	R_SPARC_PLT64		47
100 #define	R_SPARC_HIX22		48
101 #define	R_SPARC_LOX10		49
102 #define	R_SPARC_H44		50
103 #define	R_SPARC_M44		51
104 #define	R_SPARC_L44		52
105 #define	R_SPARC_REGISTER	53
106 #define	R_SPARC_UA64		54
107 #define	R_SPARC_UA16		55
108 #define	R_SPARC_TLS_GD_HI22	56
109 #define	R_SPARC_TLS_GD_LO10	57
110 #define	R_SPARC_TLS_GD_ADD	58
111 #define	R_SPARC_TLS_GD_CALL	59
112 #define	R_SPARC_TLS_LDM_HI22	60
113 #define	R_SPARC_TLS_LDM_LO10	61
114 #define	R_SPARC_TLS_LDM_ADD	62
115 #define	R_SPARC_TLS_LDM_CALL	63
116 #define	R_SPARC_TLS_LDO_HIX22	64
117 #define	R_SPARC_TLS_LDO_LOX10	65
118 #define	R_SPARC_TLS_LDO_ADD	66
119 #define	R_SPARC_TLS_IE_HI22	67
120 #define	R_SPARC_TLS_IE_LO10	68
121 #define	R_SPARC_TLS_IE_LD	69
122 #define	R_SPARC_TLS_IE_LDX	70
123 #define	R_SPARC_TLS_IE_ADD	71
124 #define	R_SPARC_TLS_LE_HIX22	72
125 #define	R_SPARC_TLS_LE_LOX10	73
126 #define	R_SPARC_TLS_DTPMOD32	74
127 #define	R_SPARC_TLS_DTPMOD64	75
128 #define	R_SPARC_TLS_DTPOFF32	76
129 #define	R_SPARC_TLS_DTPOFF64	77
130 #define	R_SPARC_TLS_TPOFF32	78
131 #define	R_SPARC_TLS_TPOFF64	79
132 #define	R_SPARC_GOTDATA_HIX22	80
133 #define	R_SPARC_GOTDATA_LOX10	81
134 #define	R_SPARC_GOTDATA_OP_HIX22	82
135 #define	R_SPARC_GOTDATA_OP_LOX10	83
136 #define	R_SPARC_GOTDATA_OP	84
137 #define	R_SPARC_H34		85
138 #define	R_SPARC_NUM		86		/* must be >last */
139 
140 /*
141  * Relocation aliases
142  */
143 #define	R_SPARC_L34	R_SPARC_L44	/* associated with R_SPARC_H34 */
144 					/*   same calc as R_SPARC_L44 */
145 
146 #define	ELF_SPARC_MAXPGSZ	0x10000		/* maximum page size */
147 #define	ELF_SPARCV9_MAXPGSZ	0x100000
148 
149 /*
150  * Processor specific section types
151  */
152 #define	SHT_SPARC_GOTDATA	0x70000000
153 
154 #define	SHF_ORDERED		0x40000000
155 #define	SHF_EXCLUDE		0x80000000
156 
157 #define	SHN_BEFORE		0xff00
158 #define	SHN_AFTER		0xff01
159 
160 #define	STT_SPARC_REGISTER	13		/* register symbol type */
161 
162 #define	DT_SPARC_REGISTER	0x70000001	/* identifies register */
163 						/*	symbols */
164 
165 
166 /*
167  * Register symbol numbers - to be used in the st_value field
168  * of register symbols.
169  */
170 #define	STO_SPARC_REGISTER_G1	0x1		/* register %g1 */
171 #define	STO_SPARC_REGISTER_G2	0x2		/* register %g2 */
172 #define	STO_SPARC_REGISTER_G3	0x3		/* register %g3 */
173 #define	STO_SPARC_REGISTER_G4	0x4		/* register %g4 */
174 #define	STO_SPARC_REGISTER_G5	0x5		/* register %g5 */
175 #define	STO_SPARC_REGISTER_G6	0x6		/* register %g6 */
176 #define	STO_SPARC_REGISTER_G7	0x7		/* register %g7 */
177 
178 
179 #ifdef	__cplusplus
180 }
181 #endif
182 
183 #endif	/* _SYS_ELF_SPARC_H */
184