Print this page
3265 link-editor builds bogus .eh_frame_hdr on ia32
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/sgs/include/dwarf.h
+++ new/usr/src/cmd/sgs/include/dwarf.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /* Copyright (c) 1989 AT&T */
22 22 /* All Rights Reserved */
23 23
24 24
25 25 /*
26 26 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
27 27 * Use is subject to license terms.
28 28 */
29 29
30 30 #ifndef _DWARF_H
31 31 #define _DWARF_H
32 32
33 33 #include <sys/types.h>
34 34
35 35
36 36 #ifdef __cplusplus
37 37 extern "C" {
38 38 #endif
39 39
40 40
41 41
42 42 /* dwarf.h - manifest constants used in the .debug section of ELF files */
43 43
44 44
45 45 /* the "tag" - the first short of any legal record */
46 46
47 47 #define TAG_padding 0x0000
48 48 #define TAG_array_type 0x0001
49 49 #define TAG_class_type 0x0002
50 50 #define TAG_entry_point 0x0003
51 51 #define TAG_enumeration_type 0x0004
52 52 #define TAG_formal_parameter 0x0005
53 53 #define TAG_global_subroutine 0x0006
54 54 #define TAG_global_variable 0x0007
55 55 #define TAG_imported_declaration 0x0008
56 56 #define TAG_inline_subroutine 0x0009
57 57 #define TAG_label 0x000a
58 58 #define TAG_lexical_block 0x000b
59 59 #define TAG_local_variable 0x000c
60 60 #define TAG_member 0x000d
61 61 #define TAG_member_function 0x000e
62 62 #define TAG_pointer_type 0x000f
63 63 #define TAG_reference_type 0x0010
64 64 #define TAG_source_file 0x0011
65 65 #define TAG_string_type 0x0012
66 66 #define TAG_structure_type 0x0013
67 67 #define TAG_subroutine 0x0014
68 68 #define TAG_subroutine_type 0x0015
69 69 #define TAG_typedef 0x0016
70 70 #define TAG_union_type 0x0017
71 71 #define TAG_unspecified_parameters 0x0018
72 72 #define TAG_variant 0x0019
73 73
74 74
75 75 /* attribute forms are encoded as part */
76 76 /* of the attribute name and must fit */
77 77 /* into 4 bits */
78 78
79 79 #define FORM_MASK 0xf
80 80
81 81 #define FORM_NONE 0x0 /* error */
82 82 #define FORM_ADDR 0x1 /* relocated address */
83 83 #define FORM_REF 0x2 /* reference to another .debug entry */
84 84 #define FORM_BLOCK2 0x3 /* block with 2-byte length */
85 85 #define FORM_BLOCK4 0x4 /* block with 4-byte length (unused) */
86 86 #define FORM_DATA2 0x5 /* 2 bytes */
87 87 #define FORM_DATA4 0x6 /* 4 bytes */
88 88 #define FORM_DATA8 0x7 /* 8 bytes (two 4-byte values) */
89 89 #define FORM_STRING 0x8 /* NUL-terminated string */
90 90
91 91
92 92 /* attribute names, halfwords with low 4 bits indicating the form */
93 93
94 94 #define AT_padding (0x0000|FORM_NONE) /* just padding */
95 95 #define AT_sibling (0x0010|FORM_REF) /* next owned declaration */
96 96 #define AT_location (0x0020|FORM_BLOCK2) /* location description */
97 97 #define AT_name (0x0030|FORM_STRING) /* symbol name */
98 98 #define AT_dimensions (0x0040|FORM_DATA2) /* array dimensions */
99 99 #define AT_fund_type (0x0050|FORM_DATA2) /* fund type enum */
100 100 #define AT_mod_fund_type (0x0060|FORM_BLOCK2) /* modifiers & fund type enum */
101 101 #define AT_user_def_type (0x0070|FORM_REF) /* type entry */
102 102 #define AT_mod_u_d_type (0x0080|FORM_BLOCK2) /* modifiers & type entry ref */
103 103 #define AT_ordering (0x0090|FORM_DATA2) /* array row/column major */
104 104 #define AT_subscr_data (0x00a0|FORM_BLOCK2) /* list of array dim info */
105 105 #define AT_byte_size (0x00b0|FORM_DATA4) /* number bytes per instance */
106 106 #define AT_bit_offset (0x00c0|FORM_DATA2) /* number bits padding */
107 107 #define AT_bit_size (0x00d0|FORM_DATA4) /* number bits per instance */
108 108 #define AT_deriv_list (0x00e0|FORM_BLOCK2) /* list of base class refs */
109 109 #define AT_element_list (0x00f0|FORM_BLOCK4) /* list of enum data elements */
110 110 #define AT_stmt_list (0x0100|FORM_DATA4) /* offset in .line sect */
111 111 #define AT_low_pc (0x0110|FORM_ADDR) /* first machine instr */
112 112 #define AT_high_pc (0x0120|FORM_ADDR) /* beyond last machine instr */
113 113 #define AT_language (0x0130|FORM_DATA4) /* compiler enumeration */
114 114 #define AT_member (0x0140|FORM_REF) /* class description */
115 115 #define AT_discr (0x0150|FORM_REF) /* discriminant entry */
116 116 #define AT_discr_value (0x0160|FORM_BLOCK2) /* value of discr */
117 117 #define AT_visibility (0x0170|FORM_DATA2) /* visibility enumeration */
118 118 #define AT_import (0x0180|FORM_REF) /* imported declaration */
119 119 #define AT_string_length (0x0190|FORM_BLOCK2) /* runtime string size */
120 120
121 121
122 122 /* atoms which compose a location description; must fit in a byte */
123 123
124 124 #define OP_UNK 0x00 /* error */
125 125 #define OP_REG 0x01 /* push register (number) */
126 126 #define OP_BASEREG 0x02 /* push value of register (number) */
127 127 #define OP_ADDR 0x03 /* push address (relocated address) */
128 128 #define OP_CONST 0x04 /* push constant (number) */
129 129 #define OP_DEREF2 0x05 /* pop, deref and push 2 bytes (as a long) */
130 130 #define OP_DEREF4 0x06 /* pop, deref and push 4 bytes (as a long) */
131 131 #define OP_ADD 0x07 /* pop top 2 items, add, push result */
132 132
133 133 /* fundamental types; must fit in two bytes */
134 134
135 135 #define FT_none 0x0000 /* error */
136 136 #define FT_char 0x0001 /* "plain" char */
137 137 #define FT_signed_char 0x0002
138 138 #define FT_unsigned_char 0x0003
139 139 #define FT_short 0x0004 /* "plain" short */
140 140 #define FT_signed_short 0x0005
141 141 #define FT_unsigned_short 0x0006
142 142 #define FT_integer 0x0007 /* "plain" integer */
143 143 #define FT_signed_integer 0x0008
144 144 #define FT_unsigned_integer 0x0009
145 145 #define FT_long 0x000a /* "plain" long */
146 146 #define FT_signed_long 0x000b
147 147 #define FT_unsigned_long 0x000c
148 148 #define FT_pointer 0x000d /* (void *) */
149 149 #define FT_float 0x000e
150 150 #define FT_dbl_prec_float 0x000f
151 151 #define FT_ext_prec_float 0x0010
152 152 #define FT_complex 0x0011
153 153 #define FT_dbl_prec_complex 0x0012
154 154 #define FT_set 0x0013
155 155 #define FT_void 0x0014
156 156
157 157
158 158 /* type modifiers; must fit in a byte */
159 159
160 160 #define MOD_none 0x00 /* error */
161 161 #define MOD_pointer_to 0x01
162 162 #define MOD_reference_to 0x02
163 163
164 164
165 165 /* the "format" byte for array descriptions; formed from three */
166 166 /* one-bit fields */
167 167
168 168 #define FMT_FT 0 /* fundamental type */
169 169 #define FMT_UDT 1 /* user-defined type */
170 170
171 171 #define FMT_CONST 0 /* 4-byte constant */
172 172 #define FMT_EXPR 1 /* block with 2-byte length (loc descr) */
173 173
174 174 #define FMT_FT_C_C ((FMT_FT <<2) | (FMT_CONST<<1) | (FMT_CONST))
175 175 #define FMT_FT_C_X ((FMT_FT <<2) | (FMT_CONST<<1) | (FMT_EXPR))
176 176 #define FMT_FT_X_C ((FMT_FT <<2) | (FMT_EXPR <<1) | (FMT_CONST))
177 177 #define FMT_FT_X_X ((FMT_FT <<2) | (FMT_EXPR <<1) | (FMT_EXPR))
178 178 #define FMT_UT_C_C ((FMT_UDT<<2) | (FMT_CONST<<1) | (FMT_CONST))
179 179 #define FMT_UT_C_X ((FMT_UDT<<2) | (FMT_CONST<<1) | (FMT_EXPR))
180 180 #define FMT_UT_X_C ((FMT_UDT<<2) | (FMT_EXPR <<1) | (FMT_CONST))
181 181 #define FMT_UT_X_X ((FMT_UDT<<2) | (FMT_EXPR <<1) | (FMT_EXPR))
182 182
183 183 #define FMT_ET 8 /* element type */
184 184
185 185
186 186 /* ordering of arrays */
187 187
188 188 #define ORD_row_major 0
189 189 #define ORD_col_major 1
190 190
191 191
192 192 /* visibility values */
193 193
194 194 #define VIS_local 0 /* for static functions in C */
195 195 #define VIS_exported 1 /* for Modula */
196 196
197 197 /*
198 198 * DWARF Exception Header Encoding
199 199 *
200 200 * The DWARF Exception Header Encoding is used to describe the type of data
201 201 * used in the .eh_frame_hdr section. The upper 4 bits indicate how the value
202 202 * is to be applied. The lower 4 bits indicate the format of the data.
203 203 */
204 204
205 205 /*
206 206 * Dwarf Exception Header Value format
207 207 */
208 208 #define DW_EH_PE_omit 0xff /* No value is present. */
209 209 #define DW_EH_PE_absptr 0x00 /* Value is a void* */
210 210 #define DW_EH_PE_uleb128 0x01 /* Unsigned value is encoded using */
211 211 /* the Little Endian */
212 212 /* Base 128 (LEB128) */
213 213 #define DW_EH_PE_udata2 0x02 /* A 2 bytes unsigned value. */
214 214 #define DW_EH_PE_udata4 0x03 /* A 4 bytes unsigned value. */
215 215 #define DW_EH_PE_udata8 0x04 /* An 8 bytes unsigned value. */
216 216 #define DW_EH_PE_signed 0x08 /* bit on for all signed encodings */
217 217 #define DW_EH_PE_sleb128 0x09 /* Signed value is encoded using */
218 218 /* the Little Endian */
219 219 /* Base 128 (LEB128) */
220 220 #define DW_EH_PE_sdata2 0x0a /* A 2 bytes signed value. */
221 221 #define DW_EH_PE_sdata4 0x0b /* A 4 bytes signed value. */
222 222 #define DW_EH_PE_sdata8 0x0c /* An 8 bytes signed value. */
223 223
224 224 /*
↓ open down ↓ |
224 lines elided |
↑ open up ↑ |
225 225 * Dwarf Exception Header application
226 226 */
227 227 #define DW_EH_PE_absptr 0x00 /* Value is used with no */
228 228 /* modification. */
229 229 #define DW_EH_PE_pcrel 0x10 /* Value is reletive to the location */
230 230 /* of itself */
231 231 #define DW_EH_PE_textrel 0x20
232 232 #define DW_EH_PE_datarel 0x30 /* Value is reletive to the beginning */
233 233 /* of the eh_frame_hdr segment */
234 234 /* ( segment type PT_AMD64_UNWIND ) */
235 + /* when within that segment, or to */
236 + /* the GOT when without. */
235 237 #define DW_EH_PE_funcrel 0x40
236 238 #define DW_EH_PE_aligned 0x50 /* value is an aligned void* */
237 239 #define DW_EH_PE_indirect 0x80 /* bit to signal indirection after */
238 240 /* relocation */
239 241
240 242
241 243 /* language/compiler enumeration */
242 244
243 245 typedef enum _LANG {
244 246 LANG_UNK = 0,
245 247 LANG_ANSI_C_V1 = 1
246 248 } LANG;
247 249
248 250 /*
249 251 * Little Endian Base 128 (leb128) encoding/decoding routines
250 252 */
251 253 extern uint64_t uleb_extract(unsigned char *, uint64_t *);
252 254 extern int64_t sleb_extract(unsigned char *, uint64_t *);
253 255 extern uint64_t dwarf_ehe_extract(unsigned char *, uint64_t *,
254 - uint_t, unsigned char *, uint64_t, uint64_t);
256 + uint_t, unsigned char *, boolean_t, uint64_t,
257 + uint64_t, uint64_t);
255 258
256 259 #ifdef __cplusplus
257 260 }
258 261 #endif
259 262
260 263
261 264 #endif /* _DWARF_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX