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