xref: /illumos-gate/usr/src/uts/common/sys/elf_amd64.h (revision 71269a2275bf5a143dad6461eee2710a344e7261)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_ELF_AMD64_H
28 #define	_SYS_ELF_AMD64_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	R_AMD64_NONE		0	/* relocation types */
37 #define	R_AMD64_64		1
38 #define	R_AMD64_PC32		2
39 #define	R_AMD64_GOT32		3
40 #define	R_AMD64_PLT32		4
41 #define	R_AMD64_COPY		5
42 #define	R_AMD64_GLOB_DAT	6
43 #define	R_AMD64_JUMP_SLOT	7
44 #define	R_AMD64_RELATIVE	8
45 #define	R_AMD64_GOTPCREL	9
46 #define	R_AMD64_32		10
47 #define	R_AMD64_32S		11
48 #define	R_AMD64_16		12
49 #define	R_AMD64_PC16		13
50 #define	R_AMD64_8		14
51 #define	R_AMD64_PC8		15
52 #define	R_AMD64_DTPMOD64	16
53 #define	R_AMD64_DTPOFF64	17
54 #define	R_AMD64_TPOFF64		18
55 #define	R_AMD64_TLSGD		19
56 #define	R_AMD64_TLSLD		20
57 #define	R_AMD64_DTPOFF32	21
58 #define	R_AMD64_GOTTPOFF	22
59 #define	R_AMD64_TPOFF32		23
60 #define	R_AMD64_PC64		24
61 #define	R_AMD64_GOTOFF64	25
62 #define	R_AMD64_GOTPC32		26
63 #define	R_AMD64_GOT64		27	/* reserved for future expansion */
64 #define	R_AMD64_GOTPCREL64	28	/* reserved for future expansion */
65 #define	R_AMD64_GOTPC64		29	/* reserved for future expansion */
66 #define	R_AMD64_GOTPLT64	30	/* reserved for future expansion */
67 #define	R_AMD64_PLTOFF64	31	/* reserved for future expansion */
68 #define	R_AMD64_SIZE32		32
69 #define	R_AMD64_SIZE64		33
70 #define	R_AMD64_NUM		34
71 
72 
73 /*
74  * The "System V Application Binary Interface, AMD64 Architecture Processor
75  * Supplement", defines relocations in terms of R_X86_64_ rather than R_AMD64_.
76  * Maintain both relocation naming conventions for compatibility.
77  */
78 #define	R_X86_64_NONE		R_AMD64_NONE
79 #define	R_X86_64_64		R_AMD64_64
80 #define	R_X86_64_PC32		R_AMD64_PC32
81 #define	R_X86_64_GOT32		R_AMD64_GOT32
82 #define	R_X86_64_PLT32		R_AMD64_PLT32
83 #define	R_X86_64_COPY		R_AMD64_COPY
84 #define	R_X86_64_GLOB_DAT	R_AMD64_GLOB_DAT
85 #define	R_X86_64_JUMP_SLOT	R_AMD64_JUMP_SLOT
86 #define	R_X86_64_RELATIVE	R_AMD64_RELATIVE
87 #define	R_X86_64_GOTPCREL	R_AMD64_GOTPCREL
88 #define	R_X86_64_32		R_AMD64_32
89 #define	R_X86_64_32S		R_AMD64_32S
90 #define	R_X86_64_16		R_AMD64_16
91 #define	R_X86_64_PC16		R_AMD64_PC16
92 #define	R_X86_64_8		R_AMD64_8
93 #define	R_X86_64_PC8		R_AMD64_PC8
94 #define	R_X86_64_DTPMOD64	R_AMD64_DTPMOD64
95 #define	R_X86_64_DTPOFF64	R_AMD64_DTPOFF64
96 #define	R_X86_64_TPOFF64	R_AMD64_TPOFF64
97 #define	R_X86_64_TLSGD		R_AMD64_TLSGD
98 #define	R_X86_64_TLSLD		R_AMD64_TLSLD
99 #define	R_X86_64_DTPOFF32	R_AMD64_DTPOFF32
100 #define	R_X86_64_GOTTPOFF	R_AMD64_GOTTPOFF
101 #define	R_X86_64_TPOFF32	R_AMD64_TPOFF32
102 #define	R_X86_64_PC64		R_AMD64_PC64
103 #define	R_X86_64_GOTPC32	R_AMD64_GOTPC32
104 #define	R_X86_64_GOTOFF64	R_AMD64_GOTOFF64
105 #define	R_X86_64_GOT64		R_AMD64_GOT64
106 #define	R_X86_64_GOTPCREL64	R_AMD64_GOTPCREL64
107 #define	R_X86_64_GOTPC64	R_AMD64_GOTPC64
108 #define	R_X86_64_GOTPLT64	R_AMD64_GOTPLT64
109 #define	R_X86_64_PLTOFF64	R_AMD64_PLTOFF64
110 #define	R_X86_64_SIZE32		R_AMD64_SIZE32
111 #define	R_X86_64_SIZE64		R_AMD64_SIZE64
112 #define	R_X86_64_NUM		R_AMD64_NUM
113 
114 
115 #define	ELF_AMD64_MAXPGSZ	0x100000	/* maximum page size */
116 
117 /*
118  * processor specific section types
119  */
120 #define	SHT_AMD64_UNWIND	0x70000001	/* unwind information */
121 
122 
123 /*
124  * NOTE: PT_SUNW_UNWIND is defined in the OS specific range
125  *	 to conform with the amd64 psABI.
126  */
127 
128 #define	SHF_AMD64_LARGE		0x10000000
129 #define	SHF_X86_64_LARGE	SHF_AMD64_LARGE
130 #define	SHF_ORDERED		0x40000000
131 #define	SHF_EXCLUDE		0x80000000
132 
133 #define	SHN_BEFORE		0xff00
134 #define	SHN_AFTER		0xff01
135 #define	SHN_AMD64_LCOMMON	0xff02
136 #define	SHN_X86_64_LCOMMON	SHN_AMD64_LCOMMON
137 
138 
139 #ifdef	__cplusplus
140 }
141 #endif
142 
143 #endif	/* _SYS_ELF_AMD64_H */
144