Print this page
10366 ld(1) should support GNU-style linker sets
10581 ld(1) should know kernel modules are a thing
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/sgs/libconv/common/dynamic.c
+++ new/usr/src/cmd/sgs/libconv/common/dynamic.c
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
22 22 /*
23 23 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 /*
27 27 * String conversion routine for .dynamic tag entries.
28 28 */
29 29 #include <stdio.h>
30 30 #include <string.h>
31 31 #include <sys/elf_SPARC.h>
32 32 #include "rtld.h"
33 33 #include "_conv.h"
34 34 #include "dynamic_msg.h"
35 35
36 36
37 37
38 38 const Val_desc *
39 39 conv_dyn_posflag1_strings(Conv_fmt_flags_t fmt_flags)
40 40 {
41 41 #define POSSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
42 42 MSG_DF_P1_LAZYLOAD_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
43 43 MSG_DF_P1_GROUPPERM_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
44 44 MSG_DF_P1_DEFERRED_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
45 45 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
46 46
47 47 /*
48 48 * Ensure that Conv_dyn_posflag1_buf_t is large enough:
49 49 *
50 50 * POSSZ is the real minimum size of the buffer required by
51 51 * conv_dyn_posflag1(). However, Conv_dyn_posflag1_buf_t uses
52 52 * CONV_DYN_POSFLAG1_BUFSIZE to set the buffer size. We do things
53 53 * this way because the definition of POSSZ uses
54 54 * information that is not available in the environment of other
55 55 * programs that include the conv.h header file.
56 56 */
57 57 #if (CONV_DYN_POSFLAG1_BUFSIZE != POSSZ) && !defined(__lint)
58 58 #define REPORT_BUFSIZE POSSZ
59 59 #include "report_bufsize.h"
60 60 #error "CONV_DYN_POSFLAG1_BUFSIZE does not match POSSZ"
61 61 #endif
62 62
63 63 static const Val_desc vda_def[] = {
64 64 { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_DEF },
65 65 { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_DEF },
66 66 { DF_P1_DEFERRED, MSG_DF_P1_DEFERRED_DEF },
67 67 { 0, 0 }
68 68 };
69 69 static const Val_desc vda_cf[] = {
70 70 { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_CF },
71 71 { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_CF },
72 72 { DF_P1_DEFERRED, MSG_DF_P1_DEFERRED_CF },
73 73 { 0, 0 }
74 74 };
75 75 static const Val_desc vda_cfnp[] = {
76 76 { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_CFNP },
77 77 { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_CFNP },
78 78 { DF_P1_DEFERRED, MSG_DF_P1_DEFERRED_CFNP },
79 79 { 0, 0 }
80 80 };
81 81 static const Val_desc vda_nf[] = {
82 82 { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_NF },
83 83 { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_NF },
84 84 { DF_P1_DEFERRED, MSG_DF_P1_DEFERRED_NF },
85 85 { 0, 0 }
86 86 };
87 87
88 88 switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
89 89 case CONV_FMT_ALT_DUMP:
90 90 case CONV_FMT_ALT_CFNP:
91 91 return (vda_cfnp);
92 92 case CONV_FMT_ALT_CF:
93 93 return (vda_cf);
94 94 case CONV_FMT_ALT_NF:
95 95 return (vda_nf);
96 96 }
97 97
98 98 return (vda_def);
99 99 }
100 100
101 101 conv_iter_ret_t
102 102 conv_iter_dyn_posflag1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
103 103 void *uvalue)
104 104 {
105 105 return (conv_iter_vd(conv_dyn_posflag1_strings(fmt_flags),
106 106 func, uvalue));
↓ open down ↓ |
106 lines elided |
↑ open up ↑ |
107 107 }
108 108
109 109 const Val_desc *
110 110 conv_dyn_flag_strings(Conv_fmt_flags_t fmt_flags)
111 111 {
112 112 #define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
113 113 MSG_DF_ORIGIN_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
114 114 MSG_DF_SYMBOLIC_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
115 115 MSG_DF_TEXTREL_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
116 116 MSG_DF_BIND_NOW_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
117 - MSG_DF_STATIC_TLS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
117 + MSG_DF_STATIC_TLS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
118 118 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
119 119
120 120 /*
121 121 * Ensure that Conv_dyn_flag_buf_t is large enough:
122 122 *
123 123 * FLAGSZ is the real minimum size of the buffer required by
124 124 * conv_dyn_flag(). However, Conv_dyn_flag_buf_t uses
125 125 * CONV_DYN_FLAG_BUFSIZE to set the buffer size. We do things this
126 126 * way because the definition of FLAGSZ uses information that is not
127 127 * available in the environment of other programs that include the
128 128 * conv.h header file.
129 129 */
130 130 #if (CONV_DYN_FLAG_BUFSIZE != FLAGSZ) && !defined(__lint)
131 131 #define REPORT_BUFSIZE FLAGSZ
132 132 #include "report_bufsize.h"
133 133 #error "CONV_DYN_FLAG_BUFSIZE does not match FLAGSZ"
134 134 #endif
135 135
136 136 static const Val_desc vda_cf[] = {
137 137 { DF_ORIGIN, MSG_DF_ORIGIN_CF },
138 138 { DF_SYMBOLIC, MSG_DF_SYMBOLIC_CF },
139 139 { DF_TEXTREL, MSG_DF_TEXTREL_CF },
140 140 { DF_BIND_NOW, MSG_DF_BIND_NOW_CF },
141 141 { DF_STATIC_TLS, MSG_DF_STATIC_TLS_CF },
142 142 { 0 }
143 143 };
144 144 static const Val_desc vda_cfnp[] = {
145 145 { DF_ORIGIN, MSG_DF_ORIGIN_CFNP },
146 146 { DF_SYMBOLIC, MSG_DF_SYMBOLIC_CFNP },
147 147 { DF_TEXTREL, MSG_DF_TEXTREL_CFNP },
148 148 { DF_BIND_NOW, MSG_DF_BIND_NOW_CFNP },
149 149 { DF_STATIC_TLS, MSG_DF_STATIC_TLS_CFNP },
150 150 { 0 }
151 151 };
152 152 static const Val_desc vda_nf[] = {
153 153 { DF_ORIGIN, MSG_DF_ORIGIN_NF },
154 154 { DF_SYMBOLIC, MSG_DF_SYMBOLIC_NF },
155 155 { DF_TEXTREL, MSG_DF_TEXTREL_NF },
156 156 { DF_BIND_NOW, MSG_DF_BIND_NOW_NF },
157 157 { DF_STATIC_TLS, MSG_DF_STATIC_TLS_NF },
158 158 { 0 }
159 159 };
160 160
161 161 switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
162 162 case CONV_FMT_ALT_CF:
163 163 return (vda_cf);
164 164 case CONV_FMT_ALT_NF:
165 165 return (vda_nf);
166 166 }
167 167
168 168 return (vda_cfnp);
169 169 }
170 170
171 171 conv_iter_ret_t
172 172 conv_iter_dyn_flag(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
173 173 void *uvalue)
174 174 {
175 175 return (conv_iter_vd(conv_dyn_flag_strings(fmt_flags), func, uvalue));
176 176 }
177 177
178 178 const Val_desc *
179 179 conv_dyn_flag1_strings(Conv_fmt_flags_t fmt_flags)
180 180 {
181 181 #define FLAG1SZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
182 182 MSG_DF_1_NOW_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
183 183 MSG_DF_1_GLOBAL_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
184 184 MSG_DF_1_GROUP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
185 185 MSG_DF_1_NODELETE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
186 186 MSG_DF_1_LOADFLTR_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
187 187 MSG_DF_1_INITFIRST_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
188 188 MSG_DF_1_NOOPEN_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
189 189 MSG_DF_1_ORIGIN_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
190 190 MSG_DF_1_DIRECT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
191 191 MSG_DF_1_TRANS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
192 192 MSG_DF_1_INTERPOSE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
193 193 MSG_DF_1_NODEFLIB_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
194 194 MSG_DF_1_NODUMP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
195 195 MSG_DF_1_CONFALT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
196 196 MSG_DF_1_ENDFILTEE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
197 197 MSG_DF_1_DISPRELPND_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
198 198 MSG_DF_1_DISPRELDNE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
199 199 MSG_DF_1_NODIRECT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
200 200 MSG_DF_1_IGNMULDEF_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
201 201 MSG_DF_1_NOKSYMS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
202 202 MSG_DF_1_NOHDR_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
203 203 MSG_DF_1_NORELOC_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
204 204 MSG_DF_1_SYMINTPOSE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
205 205 MSG_DF_1_GLOBAUDIT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
206 206 MSG_DF_1_SINGLETON_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
207 207 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
208 208
209 209 /*
210 210 * Ensure that Conv_dyn_flag1_buf_t is large enough:
211 211 *
212 212 * FLAG1SZ is the real minimum size of the buffer required by
213 213 * conv_dyn_flag1(). However, Conv_dyn_flag1_buf_t uses
214 214 * CONV_DYN_FLAG1_BUFSIZE to set the buffer size. We do things this
215 215 * way because the definition of FLAG1SZ uses information that is not
216 216 * available in the environment of other programs that include the
217 217 * conv.h header file.
218 218 */
219 219 #if (CONV_DYN_FLAG1_BUFSIZE != FLAG1SZ) && !defined(__lint)
220 220 #define REPORT_BUFSIZE FLAG1SZ
221 221 #include "report_bufsize.h"
222 222 #error "CONV_DYN_FLAG1_BUFSIZE does not match FLAG1SZ"
223 223 #endif
224 224
225 225 static const Val_desc vda_def[] = {
226 226 { DF_1_NOW, MSG_DF_1_NOW_CFNP },
227 227 { DF_1_GLOBAL, MSG_DF_1_GLOBAL_CFNP },
228 228 { DF_1_GROUP, MSG_DF_1_GROUP_CFNP },
229 229 { DF_1_NODELETE, MSG_DF_1_NODELETE_CFNP },
230 230 { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_CFNP },
231 231 { DF_1_INITFIRST, MSG_DF_1_INITFIRST_CFNP },
232 232 { DF_1_NOOPEN, MSG_DF_1_NOOPEN_CFNP },
233 233 { DF_1_ORIGIN, MSG_DF_1_ORIGIN_CFNP },
234 234 { DF_1_DIRECT, MSG_DF_1_DIRECT_CFNP },
235 235 { DF_1_TRANS, MSG_DF_1_TRANS_CFNP },
236 236 { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_DEF },
237 237 { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_CFNP },
238 238 { DF_1_NODUMP, MSG_DF_1_NODUMP_CFNP },
239 239 { DF_1_CONFALT, MSG_DF_1_CONFALT_CFNP },
240 240 { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_CFNP },
241 241 { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_DEF },
242 242 { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_DEF },
243 243 { DF_1_NODIRECT, MSG_DF_1_NODIRECT_CFNP },
244 244 { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_DEF },
245 245 { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_CFNP },
246 246 { DF_1_NOHDR, MSG_DF_1_NOHDR_CFNP },
247 247 { DF_1_EDITED, MSG_DF_1_EDITED_CFNP },
248 248 { DF_1_NORELOC, MSG_DF_1_NORELOC_CFNP },
249 249 { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_DEF },
250 250 { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_DEF },
251 251 { DF_1_SINGLETON, MSG_DF_1_SINGLETON_DEF },
252 252 { 0, 0 }
253 253 };
254 254 static const Val_desc vda_cf[] = {
255 255 { DF_1_NOW, MSG_DF_1_NOW_CF },
256 256 { DF_1_GLOBAL, MSG_DF_1_GLOBAL_CF },
257 257 { DF_1_GROUP, MSG_DF_1_GROUP_CF },
258 258 { DF_1_NODELETE, MSG_DF_1_NODELETE_CF },
259 259 { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_CF },
260 260 { DF_1_INITFIRST, MSG_DF_1_INITFIRST_CF },
261 261 { DF_1_NOOPEN, MSG_DF_1_NOOPEN_CF },
262 262 { DF_1_ORIGIN, MSG_DF_1_ORIGIN_CF },
263 263 { DF_1_DIRECT, MSG_DF_1_DIRECT_CF },
264 264 { DF_1_TRANS, MSG_DF_1_TRANS_CF },
265 265 { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_CF },
266 266 { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_CF },
267 267 { DF_1_NODUMP, MSG_DF_1_NODUMP_CF },
268 268 { DF_1_CONFALT, MSG_DF_1_CONFALT_CF },
269 269 { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_CF },
270 270 { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_CF },
271 271 { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_CF },
272 272 { DF_1_NODIRECT, MSG_DF_1_NODIRECT_CF },
273 273 { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_CF },
274 274 { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_CF },
275 275 { DF_1_NOHDR, MSG_DF_1_NOHDR_CF },
276 276 { DF_1_EDITED, MSG_DF_1_EDITED_CF },
277 277 { DF_1_NORELOC, MSG_DF_1_NORELOC_CF },
278 278 { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_CF },
279 279 { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_CF },
280 280 { DF_1_SINGLETON, MSG_DF_1_SINGLETON_CF },
281 281 { 0, 0 }
282 282 };
283 283 static const Val_desc vda_cfnp[] = {
284 284 { DF_1_NOW, MSG_DF_1_NOW_CFNP },
285 285 { DF_1_GLOBAL, MSG_DF_1_GLOBAL_CFNP },
286 286 { DF_1_GROUP, MSG_DF_1_GROUP_CFNP },
287 287 { DF_1_NODELETE, MSG_DF_1_NODELETE_CFNP },
288 288 { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_CFNP },
289 289 { DF_1_INITFIRST, MSG_DF_1_INITFIRST_CFNP },
290 290 { DF_1_NOOPEN, MSG_DF_1_NOOPEN_CFNP },
291 291 { DF_1_ORIGIN, MSG_DF_1_ORIGIN_CFNP },
292 292 { DF_1_DIRECT, MSG_DF_1_DIRECT_CFNP },
293 293 { DF_1_TRANS, MSG_DF_1_TRANS_CFNP },
294 294 { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_CFNP },
295 295 { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_CFNP },
296 296 { DF_1_NODUMP, MSG_DF_1_NODUMP_CFNP },
297 297 { DF_1_CONFALT, MSG_DF_1_CONFALT_CFNP },
298 298 { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_CFNP },
299 299 { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_CFNP },
300 300 { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_CFNP },
301 301 { DF_1_NODIRECT, MSG_DF_1_NODIRECT_CFNP },
302 302 { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_CFNP },
303 303 { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_CFNP },
304 304 { DF_1_NOHDR, MSG_DF_1_NOHDR_CFNP },
305 305 { DF_1_EDITED, MSG_DF_1_EDITED_CFNP },
306 306 { DF_1_NORELOC, MSG_DF_1_NORELOC_CFNP },
307 307 { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_CFNP },
308 308 { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_CFNP },
309 309 { DF_1_SINGLETON, MSG_DF_1_SINGLETON_CFNP },
310 310 { 0, 0 }
311 311 };
312 312 static const Val_desc vda_nf[] = {
313 313 { DF_1_NOW, MSG_DF_1_NOW_NF },
314 314 { DF_1_GLOBAL, MSG_DF_1_GLOBAL_NF },
315 315 { DF_1_GROUP, MSG_DF_1_GROUP_NF },
316 316 { DF_1_NODELETE, MSG_DF_1_NODELETE_NF },
317 317 { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_NF },
318 318 { DF_1_INITFIRST, MSG_DF_1_INITFIRST_NF },
319 319 { DF_1_NOOPEN, MSG_DF_1_NOOPEN_NF },
320 320 { DF_1_ORIGIN, MSG_DF_1_ORIGIN_NF },
321 321 { DF_1_DIRECT, MSG_DF_1_DIRECT_NF },
322 322 { DF_1_TRANS, MSG_DF_1_TRANS_NF },
323 323 { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_NF },
324 324 { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_NF },
325 325 { DF_1_NODUMP, MSG_DF_1_NODUMP_NF },
326 326 { DF_1_CONFALT, MSG_DF_1_CONFALT_NF },
327 327 { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_NF },
328 328 { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_NF },
329 329 { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_NF },
330 330 { DF_1_NODIRECT, MSG_DF_1_NODIRECT_NF },
331 331 { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_NF },
332 332 { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_NF },
333 333 { DF_1_NOHDR, MSG_DF_1_NOHDR_NF },
334 334 { DF_1_EDITED, MSG_DF_1_EDITED_NF },
335 335 { DF_1_NORELOC, MSG_DF_1_NORELOC_NF },
336 336 { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_NF },
337 337 { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_NF },
338 338 { DF_1_SINGLETON, MSG_DF_1_SINGLETON_NF },
339 339 { 0, 0 }
340 340 };
341 341
342 342 switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
343 343 case CONV_FMT_ALT_CF:
344 344 return (vda_cf);
345 345 case CONV_FMT_ALT_CFNP:
346 346 return (vda_cfnp);
347 347 case CONV_FMT_ALT_NF:
348 348 return (vda_nf);
349 349 }
350 350
351 351 return (vda_def);
352 352 }
353 353
354 354 conv_iter_ret_t
355 355 conv_iter_dyn_flag1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
356 356 void *uvalue)
357 357 {
358 358 return (conv_iter_vd(conv_dyn_flag1_strings(fmt_flags), func, uvalue));
359 359 }
360 360
361 361 const Val_desc *
362 362 conv_dyn_feature1_strings(Conv_fmt_flags_t fmt_flags)
363 363 {
364 364 #define FEATSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
365 365 MSG_DTF_1_PARINIT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
366 366 MSG_DTF_1_CONFEXP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
367 367 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
368 368
369 369 /*
370 370 * Ensure that Conv_dyn_feature1_buf_t is large enough:
371 371 *
372 372 * FEATSZ is the real min size of the buffer required by
373 373 * conv_dyn_feature1(). However, Conv_dyn_feature1_buf_t uses
374 374 * CONV_DYN_FEATURE1_BUFSIZE to set the buffer size. We do things
375 375 * this way because the definition of FEATSZ uses information that
376 376 * is not available in the environment of other programs that include
377 377 * the conv.h header file.
378 378 */
379 379 #if (CONV_DYN_FEATURE1_BUFSIZE != FEATSZ) && !defined(__lint)
380 380 #define REPORT_BUFSIZE FEATSZ
381 381 #include "report_bufsize.h"
382 382 #error "CONV_DYN_FEATURE1_BUFSIZE does not match FEATSZ"
383 383 #endif
384 384
385 385 static const Val_desc vda_cf[] = {
386 386 { DTF_1_PARINIT, MSG_DTF_1_PARINIT_CF },
387 387 { DTF_1_CONFEXP, MSG_DTF_1_CONFEXP_CF },
388 388 { 0, 0 }
389 389 };
390 390 static const Val_desc vda_cfnp[] = {
391 391 { DTF_1_PARINIT, MSG_DTF_1_PARINIT_CFNP },
392 392 { DTF_1_CONFEXP, MSG_DTF_1_CONFEXP_CFNP },
393 393 { 0, 0 }
394 394 };
395 395 static const Val_desc vda_nf[] = {
396 396 { DTF_1_PARINIT, MSG_DTF_1_PARINIT_NF },
397 397 { DTF_1_CONFEXP, MSG_DTF_1_CONFEXP_NF },
398 398 { 0, 0 }
399 399 };
400 400
401 401 switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
402 402 case CONV_FMT_ALT_CF:
403 403 return (vda_cf);
404 404 case CONV_FMT_ALT_NF:
405 405 return (vda_nf);
406 406 }
407 407
408 408 return (vda_cfnp);
409 409 }
410 410
411 411 conv_iter_ret_t
412 412 conv_iter_dyn_feature1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
413 413 void *uvalue)
414 414 {
415 415 return (conv_iter_vd(conv_dyn_feature1_strings(fmt_flags),
416 416 func, uvalue));
417 417 }
418 418
419 419 const conv_ds_t **
420 420 conv_dyn_tag_strings(conv_iter_osabi_t osabi, Half mach,
421 421 Conv_fmt_flags_t fmt_flags)
422 422 {
423 423 /*
424 424 * Maximum # of items that can be in the returned array. Size this
425 425 * by counting the maximum depth in the switch statement that fills
426 426 * retarr at the end of this function.
427 427 */
428 428 #define MAX_RET 12
429 429
430 430 /*
431 431 * Generic dynamic tags:
432 432 * - Note hole between DT_FLAGS and DT_PREINIT_ARRAY (tag 32).
433 433 * We use a 0, which is the signal for "not defined".
434 434 * - This range has alternative names for dump, requiring an
435 435 * additional array.
436 436 */
437 437 static const Msg tags_null_cf[] = {
438 438 MSG_DT_NULL_CF, MSG_DT_NEEDED_CF,
439 439 MSG_DT_PLTRELSZ_CF, MSG_DT_PLTGOT_CF,
440 440 MSG_DT_HASH_CF, MSG_DT_STRTAB_CF,
441 441 MSG_DT_SYMTAB_CF, MSG_DT_RELA_CF,
442 442 MSG_DT_RELASZ_CF, MSG_DT_RELAENT_CF,
443 443 MSG_DT_STRSZ_CF, MSG_DT_SYMENT_CF,
444 444 MSG_DT_INIT_CF, MSG_DT_FINI_CF,
445 445 MSG_DT_SONAME_CF, MSG_DT_RPATH_CF,
446 446 MSG_DT_SYMBOLIC_CF, MSG_DT_REL_CF,
447 447 MSG_DT_RELSZ_CF, MSG_DT_RELENT_CF,
448 448 MSG_DT_PLTREL_CF, MSG_DT_DEBUG_CF,
449 449 MSG_DT_TEXTREL_CF, MSG_DT_JMPREL_CF,
450 450 MSG_DT_BIND_NOW_CF, MSG_DT_INIT_ARRAY_CF,
451 451 MSG_DT_FINI_ARRAY_CF, MSG_DT_INIT_ARRAYSZ_CF,
452 452 MSG_DT_FINI_ARRAYSZ_CF, MSG_DT_RUNPATH_CF,
453 453 MSG_DT_FLAGS_CF, 0,
454 454 MSG_DT_PREINIT_ARRAY_CF, MSG_DT_PREINIT_ARRAYSZ_CF
455 455 };
456 456 static const Msg tags_null_cfnp[] = {
457 457 MSG_DT_NULL_CFNP, MSG_DT_NEEDED_CFNP,
458 458 MSG_DT_PLTRELSZ_CFNP, MSG_DT_PLTGOT_CFNP,
459 459 MSG_DT_HASH_CFNP, MSG_DT_STRTAB_CFNP,
460 460 MSG_DT_SYMTAB_CFNP, MSG_DT_RELA_CFNP,
461 461 MSG_DT_RELASZ_CFNP, MSG_DT_RELAENT_CFNP,
462 462 MSG_DT_STRSZ_CFNP, MSG_DT_SYMENT_CFNP,
463 463 MSG_DT_INIT_CFNP, MSG_DT_FINI_CFNP,
464 464 MSG_DT_SONAME_CFNP, MSG_DT_RPATH_CFNP,
465 465 MSG_DT_SYMBOLIC_CFNP, MSG_DT_REL_CFNP,
466 466 MSG_DT_RELSZ_CFNP, MSG_DT_RELENT_CFNP,
467 467 MSG_DT_PLTREL_CFNP, MSG_DT_DEBUG_CFNP,
468 468 MSG_DT_TEXTREL_CFNP, MSG_DT_JMPREL_CFNP,
469 469 MSG_DT_BIND_NOW_CFNP, MSG_DT_INIT_ARRAY_CFNP,
470 470 MSG_DT_FINI_ARRAY_CFNP, MSG_DT_INIT_ARRAYSZ_CFNP,
471 471 MSG_DT_FINI_ARRAYSZ_CFNP, MSG_DT_RUNPATH_CFNP,
472 472 MSG_DT_FLAGS_CFNP, 0,
473 473 MSG_DT_PREINIT_ARRAY_CFNP, MSG_DT_PREINIT_ARRAYSZ_CFNP
474 474 };
475 475 static const Msg tags_null_nf[] = {
476 476 MSG_DT_NULL_NF, MSG_DT_NEEDED_NF,
477 477 MSG_DT_PLTRELSZ_NF, MSG_DT_PLTGOT_NF,
478 478 MSG_DT_HASH_NF, MSG_DT_STRTAB_NF,
479 479 MSG_DT_SYMTAB_NF, MSG_DT_RELA_NF,
480 480 MSG_DT_RELASZ_NF, MSG_DT_RELAENT_NF,
481 481 MSG_DT_STRSZ_NF, MSG_DT_SYMENT_NF,
482 482 MSG_DT_INIT_NF, MSG_DT_FINI_NF,
483 483 MSG_DT_SONAME_NF, MSG_DT_RPATH_NF,
484 484 MSG_DT_SYMBOLIC_NF, MSG_DT_REL_NF,
485 485 MSG_DT_RELSZ_NF, MSG_DT_RELENT_NF,
486 486 MSG_DT_PLTREL_NF, MSG_DT_DEBUG_NF,
487 487 MSG_DT_TEXTREL_NF, MSG_DT_JMPREL_NF,
488 488 MSG_DT_BIND_NOW_NF, MSG_DT_INIT_ARRAY_NF,
489 489 MSG_DT_FINI_ARRAY_NF, MSG_DT_INIT_ARRAYSZ_NF,
490 490 MSG_DT_FINI_ARRAYSZ_NF, MSG_DT_RUNPATH_NF,
491 491 MSG_DT_FLAGS_NF, 0,
492 492 MSG_DT_PREINIT_ARRAY_NF, MSG_DT_PREINIT_ARRAYSZ_NF
493 493 };
494 494 static const Msg tags_null_dmp[] = {
495 495 MSG_DT_NULL_CFNP, MSG_DT_NEEDED_CFNP,
496 496 MSG_DT_PLTRELSZ_DMP, MSG_DT_PLTGOT_CFNP,
497 497 MSG_DT_HASH_CFNP, MSG_DT_STRTAB_CFNP,
498 498 MSG_DT_SYMTAB_CFNP, MSG_DT_RELA_CFNP,
499 499 MSG_DT_RELASZ_CFNP, MSG_DT_RELAENT_CFNP,
500 500 MSG_DT_STRSZ_CFNP, MSG_DT_SYMENT_CFNP,
501 501 MSG_DT_INIT_CFNP, MSG_DT_FINI_CFNP,
502 502 MSG_DT_SONAME_CFNP, MSG_DT_RPATH_CFNP,
503 503 MSG_DT_SYMBOLIC_DMP, MSG_DT_REL_CFNP,
504 504 MSG_DT_RELSZ_CFNP, MSG_DT_RELENT_CFNP,
505 505 MSG_DT_PLTREL_CFNP, MSG_DT_DEBUG_CFNP,
506 506 MSG_DT_TEXTREL_CFNP, MSG_DT_JMPREL_CFNP,
507 507 MSG_DT_BIND_NOW_CFNP, MSG_DT_INIT_ARRAY_CFNP,
508 508 MSG_DT_FINI_ARRAY_CFNP, MSG_DT_INIT_ARRAYSZ_CFNP,
509 509 MSG_DT_FINI_ARRAYSZ_CFNP, MSG_DT_RUNPATH_CFNP,
510 510 MSG_DT_FLAGS_CFNP, 0,
511 511 MSG_DT_PREINIT_ARRAY_CFNP, MSG_DT_PREINIT_ARRAYSZ_CFNP
512 512 };
513 513 static const conv_ds_msg_t ds_null_cf = {
514 514 CONV_DS_MSG_INIT(DT_NULL, tags_null_cf) };
515 515 static const conv_ds_msg_t ds_null_cfnp = {
516 516 CONV_DS_MSG_INIT(DT_NULL, tags_null_cfnp) };
517 517 static const conv_ds_msg_t ds_null_nf = {
518 518 CONV_DS_MSG_INIT(DT_NULL, tags_null_nf) };
519 519 static const conv_ds_msg_t ds_null_dmp = {
520 520 CONV_DS_MSG_INIT(DT_NULL, tags_null_dmp) };
521 521
522 522 /*
523 523 * DT_SPARC_REGISTER was originally assigned 0x7000001. It is processor
524 524 * specific, and should have been in the range DT_LOPROC-DT_HIPROC
525 525 * instead of here. When the error was fixed,
526 526 * DT_DEPRECATED_SPARC_REGISTER was created to maintain backward
527 527 * compatability.
528 528 */
529 529 static const Msg tags_sdreg_cf[] = {
530 530 MSG_DT_DEP_SPARC_REG_CF };
531 531 static const Msg tags_sdreg_cfnp[] = {
532 532 MSG_DT_DEP_SPARC_REG_CFNP };
533 533 static const Msg tags_sdreg_nf[] = {
534 534 MSG_DT_DEP_SPARC_REG_NF };
535 535
536 536 static const conv_ds_msg_t ds_sdreg_cf = {
537 537 CONV_DS_MSG_INIT(DT_DEPRECATED_SPARC_REGISTER, tags_sdreg_cf) };
538 538 static const conv_ds_msg_t ds_sdreg_cfnp = {
539 539 CONV_DS_MSG_INIT(DT_DEPRECATED_SPARC_REGISTER, tags_sdreg_cfnp) };
540 540 static const conv_ds_msg_t ds_sdreg_nf = {
541 541 CONV_DS_MSG_INIT(DT_DEPRECATED_SPARC_REGISTER, tags_sdreg_nf) };
542 542
543 543
544 544 /*
545 545 * SUNW: DT_LOOS -> DT_HIOS range. Note holes between DT_SUNW_TLSSORTSZ,
546 546 * DT_SUNW_STRPAD, and DT_SUNW_LDMACH. We handle the outliers
547 547 * separately below as single values.
548 548 */
549 549 static const Msg tags_sunw_auxiliary_cf[] = {
↓ open down ↓ |
422 lines elided |
↑ open up ↑ |
550 550 MSG_DT_SUNW_AUXILIARY_CF, MSG_DT_SUNW_RTLDINF_CF,
551 551 MSG_DT_SUNW_FILTER_CF, MSG_DT_SUNW_CAP_CF,
552 552 MSG_DT_SUNW_SYMTAB_CF, MSG_DT_SUNW_SYMSZ_CF,
553 553 MSG_DT_SUNW_SORTENT_CF, MSG_DT_SUNW_SYMSORT_CF,
554 554 MSG_DT_SUNW_SYMSORTSZ_CF, MSG_DT_SUNW_TLSSORT_CF,
555 555 MSG_DT_SUNW_TLSSORTSZ_CF, MSG_DT_SUNW_CAPINFO_CF,
556 556 MSG_DT_SUNW_STRPAD_CF, MSG_DT_SUNW_CAPCHAIN_CF,
557 557 MSG_DT_SUNW_LDMACH_CF, 0,
558 558 MSG_DT_SUNW_CAPCHAINENT_CF, 0,
559 559 MSG_DT_SUNW_CAPCHAINSZ_CF, 0,
560 - 0, 0,
561 - MSG_DT_SUNW_ASLR_CF
560 + 0, 0,
561 + MSG_DT_SUNW_ASLR_CF, 0,
562 + 0, 0,
563 + MSG_DT_SUNW_KMOD_CF
562 564 };
563 565 static const Msg tags_sunw_auxiliary_cfnp[] = {
564 566 MSG_DT_SUNW_AUXILIARY_CFNP, MSG_DT_SUNW_RTLDINF_CFNP,
565 567 MSG_DT_SUNW_FILTER_CFNP, MSG_DT_SUNW_CAP_CFNP,
566 568 MSG_DT_SUNW_SYMTAB_CFNP, MSG_DT_SUNW_SYMSZ_CFNP,
567 569 MSG_DT_SUNW_SORTENT_CFNP, MSG_DT_SUNW_SYMSORT_CFNP,
568 570 MSG_DT_SUNW_SYMSORTSZ_CFNP, MSG_DT_SUNW_TLSSORT_CFNP,
569 571 MSG_DT_SUNW_TLSSORTSZ_CFNP, MSG_DT_SUNW_CAPINFO_CFNP,
570 572 MSG_DT_SUNW_STRPAD_CFNP, MSG_DT_SUNW_CAPCHAIN_CFNP,
571 573 MSG_DT_SUNW_LDMACH_CFNP, 0,
572 574 MSG_DT_SUNW_CAPCHAINENT_CFNP, 0,
573 575 MSG_DT_SUNW_CAPCHAINSZ_CFNP, 0,
574 576 0, 0,
575 - MSG_DT_SUNW_ASLR_CFNP
577 + MSG_DT_SUNW_ASLR_CFNP, 0,
578 + 0, 0,
579 + MSG_DT_SUNW_KMOD_CFNP
576 580 };
577 581 static const Msg tags_sunw_auxiliary_nf[] = {
578 582 MSG_DT_SUNW_AUXILIARY_NF, MSG_DT_SUNW_RTLDINF_NF,
579 583 MSG_DT_SUNW_FILTER_NF, MSG_DT_SUNW_CAP_NF,
580 584 MSG_DT_SUNW_SYMTAB_NF, MSG_DT_SUNW_SYMSZ_NF,
581 585 MSG_DT_SUNW_SORTENT_NF, MSG_DT_SUNW_SYMSORT_NF,
582 586 MSG_DT_SUNW_SYMSORTSZ_NF, MSG_DT_SUNW_TLSSORT_NF,
583 587 MSG_DT_SUNW_TLSSORTSZ_NF, MSG_DT_SUNW_CAPINFO_NF,
584 588 MSG_DT_SUNW_STRPAD_NF, MSG_DT_SUNW_CAPCHAIN_NF,
585 589 MSG_DT_SUNW_LDMACH_NF, 0,
586 590 MSG_DT_SUNW_CAPCHAINENT_NF, 0,
587 591 MSG_DT_SUNW_CAPCHAINSZ_NF, 0,
588 592 0, 0,
589 - MSG_DT_SUNW_ASLR_NF
593 + MSG_DT_SUNW_ASLR_NF, 0,
594 + 0, 0,
595 + MSG_DT_SUNW_KMOD_NF
590 596 };
591 597 static const conv_ds_msg_t ds_sunw_auxiliary_cf = {
592 598 CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_cf) };
593 599 static const conv_ds_msg_t ds_sunw_auxiliary_cfnp = {
594 600 CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_cfnp) };
595 601 static const conv_ds_msg_t ds_sunw_auxiliary_nf = {
596 602 CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_nf) };
597 603
598 604 /*
599 605 * GNU: (In DT_VALRNGLO section) DT_GNU_PRELINKED - DT_GNU_LIBLISTSZ
600 606 */
601 607 static const Msg tags_gnu_prelinked_cf[] = {
602 608 MSG_DT_GNU_PRELINKED_CF, MSG_DT_GNU_CONFLICTSZ_CF,
603 609 MSG_DT_GNU_LIBLISTSZ_CF
604 610 };
605 611 static const Msg tags_gnu_prelinked_cfnp[] = {
606 612 MSG_DT_GNU_PRELINKED_CFNP, MSG_DT_GNU_CONFLICTSZ_CFNP,
607 613 MSG_DT_GNU_LIBLISTSZ_CFNP
608 614 };
609 615 static const Msg tags_gnu_prelinked_nf[] = {
610 616 MSG_DT_GNU_PRELINKED_NF, MSG_DT_GNU_CONFLICTSZ_NF,
611 617 MSG_DT_GNU_LIBLISTSZ_NF
612 618 };
613 619 static const conv_ds_msg_t ds_gnu_prelinked_cf = {
614 620 CONV_DS_MSG_INIT(DT_GNU_PRELINKED, tags_gnu_prelinked_cf) };
615 621 static const conv_ds_msg_t ds_gnu_prelinked_cfnp = {
616 622 CONV_DS_MSG_INIT(DT_GNU_PRELINKED, tags_gnu_prelinked_cfnp) };
617 623 static const conv_ds_msg_t ds_gnu_prelinked_nf = {
618 624 CONV_DS_MSG_INIT(DT_GNU_PRELINKED, tags_gnu_prelinked_nf) };
619 625
620 626 /*
621 627 * SUNW: DT_VALRNGLO - DT_VALRNGHI range.
622 628 */
623 629 static const Msg tags_checksum_cf[] = {
624 630 MSG_DT_CHECKSUM_CF, MSG_DT_PLTPADSZ_CF,
625 631 MSG_DT_MOVEENT_CF, MSG_DT_MOVESZ_CF,
626 632 MSG_DT_FEATURE_1_CF, MSG_DT_POSFLAG_1_CF,
627 633 MSG_DT_SYMINSZ_CF, MSG_DT_SYMINENT_CF
628 634 };
629 635 static const Msg tags_checksum_cfnp[] = {
630 636 MSG_DT_CHECKSUM_CFNP, MSG_DT_PLTPADSZ_CFNP,
631 637 MSG_DT_MOVEENT_CFNP, MSG_DT_MOVESZ_CFNP,
632 638 MSG_DT_FEATURE_1_CFNP, MSG_DT_POSFLAG_1_CFNP,
633 639 MSG_DT_SYMINSZ_CFNP, MSG_DT_SYMINENT_CFNP
634 640 };
635 641 static const Msg tags_checksum_nf[] = {
636 642 MSG_DT_CHECKSUM_NF, MSG_DT_PLTPADSZ_NF,
637 643 MSG_DT_MOVEENT_NF, MSG_DT_MOVESZ_NF,
638 644 MSG_DT_FEATURE_1_NF, MSG_DT_POSFLAG_1_NF,
639 645 MSG_DT_SYMINSZ_NF, MSG_DT_SYMINENT_NF
640 646 };
641 647 static const conv_ds_msg_t ds_checksum_cf = {
642 648 CONV_DS_MSG_INIT(DT_CHECKSUM, tags_checksum_cf) };
643 649 static const conv_ds_msg_t ds_checksum_cfnp = {
644 650 CONV_DS_MSG_INIT(DT_CHECKSUM, tags_checksum_cfnp) };
645 651 static const conv_ds_msg_t ds_checksum_nf = {
646 652 CONV_DS_MSG_INIT(DT_CHECKSUM, tags_checksum_nf) };
647 653
648 654 /*
649 655 * GNU: (In DT_ADDRRNGLO section) DT_GNU_HASH - DT_GNU_LIBLIST
650 656 */
651 657 static const Msg tags_gnu_hash_cf[] = {
652 658 MSG_DT_GNU_HASH_CF, MSG_DT_TLSDESC_PLT_CF,
653 659 MSG_DT_TLSDESC_GOT_CF, MSG_DT_GNU_CONFLICT_CF,
654 660 MSG_DT_GNU_LIBLIST_CF
655 661 };
656 662 static const Msg tags_gnu_hash_cfnp[] = {
657 663 MSG_DT_GNU_HASH_CFNP, MSG_DT_TLSDESC_PLT_CFNP,
658 664 MSG_DT_TLSDESC_GOT_CFNP, MSG_DT_GNU_CONFLICT_CFNP,
659 665 MSG_DT_GNU_LIBLIST_CFNP
660 666 };
661 667 static const Msg tags_gnu_hash_nf[] = {
662 668 MSG_DT_GNU_HASH_NF, MSG_DT_TLSDESC_PLT_NF,
663 669 MSG_DT_TLSDESC_GOT_NF, MSG_DT_GNU_CONFLICT_NF,
664 670 MSG_DT_GNU_LIBLIST_NF
665 671 };
666 672 static const conv_ds_msg_t ds_gnu_hash_cf = {
667 673 CONV_DS_MSG_INIT(DT_GNU_HASH, tags_gnu_hash_cf) };
668 674 static const conv_ds_msg_t ds_gnu_hash_cfnp = {
669 675 CONV_DS_MSG_INIT(DT_GNU_HASH, tags_gnu_hash_cfnp) };
670 676 static const conv_ds_msg_t ds_gnu_hash_nf = {
671 677 CONV_DS_MSG_INIT(DT_GNU_HASH, tags_gnu_hash_nf) };
672 678
673 679 /*
674 680 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
675 681 */
676 682 static const Msg tags_config_cf[] = {
677 683 MSG_DT_CONFIG_CF, MSG_DT_DEPAUDIT_CF,
678 684 MSG_DT_AUDIT_CF, MSG_DT_PLTPAD_CF,
679 685 MSG_DT_MOVETAB_CF, MSG_DT_SYMINFO_CF
680 686 };
681 687 static const Msg tags_config_cfnp[] = {
682 688 MSG_DT_CONFIG_CFNP, MSG_DT_DEPAUDIT_CFNP,
683 689 MSG_DT_AUDIT_CFNP, MSG_DT_PLTPAD_CFNP,
684 690 MSG_DT_MOVETAB_CFNP, MSG_DT_SYMINFO_CFNP
685 691 };
686 692 static const Msg tags_config_nf[] = {
687 693 MSG_DT_CONFIG_NF, MSG_DT_DEPAUDIT_NF,
688 694 MSG_DT_AUDIT_NF, MSG_DT_PLTPAD_NF,
689 695 MSG_DT_MOVETAB_NF, MSG_DT_SYMINFO_NF
690 696 };
691 697 static const conv_ds_msg_t ds_config_cf = {
692 698 CONV_DS_MSG_INIT(DT_CONFIG, tags_config_cf) };
693 699 static const conv_ds_msg_t ds_config_cfnp = {
694 700 CONV_DS_MSG_INIT(DT_CONFIG, tags_config_cfnp) };
695 701 static const conv_ds_msg_t ds_config_nf = {
696 702 CONV_DS_MSG_INIT(DT_CONFIG, tags_config_nf) };
697 703
698 704 /*
699 705 * SUNW: generic range. Note hole between DT_VERSYM and DT_RELACOUNT.
700 706 */
701 707 static const Msg tags_versym_cf[] = { MSG_DT_VERSYM_CF };
702 708 static const Msg tags_versym_cfnp[] = { MSG_DT_VERSYM_CFNP };
703 709 static const Msg tags_versym_nf[] = { MSG_DT_VERSYM_NF };
704 710 static const conv_ds_msg_t ds_versym_cf = {
705 711 CONV_DS_MSG_INIT(DT_VERSYM, tags_versym_cf) };
706 712 static const conv_ds_msg_t ds_versym_cfnp = {
707 713 CONV_DS_MSG_INIT(DT_VERSYM, tags_versym_cfnp) };
708 714 static const conv_ds_msg_t ds_versym_nf = {
709 715 CONV_DS_MSG_INIT(DT_VERSYM, tags_versym_nf) };
710 716
711 717 static const Msg tags_relacount_cf[] = {
712 718 MSG_DT_RELACOUNT_CF, MSG_DT_RELCOUNT_CF,
713 719 MSG_DT_FLAGS_1_CF, MSG_DT_VERDEF_CF,
714 720 MSG_DT_VERDEFNUM_CF, MSG_DT_VERNEED_CF,
715 721 MSG_DT_VERNEEDNUM_CF
716 722 };
717 723 static const Msg tags_relacount_cfnp[] = {
718 724 MSG_DT_RELACOUNT_CFNP, MSG_DT_RELCOUNT_CFNP,
719 725 MSG_DT_FLAGS_1_CFNP, MSG_DT_VERDEF_CFNP,
720 726 MSG_DT_VERDEFNUM_CFNP, MSG_DT_VERNEED_CFNP,
721 727 MSG_DT_VERNEEDNUM_CFNP
722 728 };
723 729 static const Msg tags_relacount_nf[] = {
724 730 MSG_DT_RELACOUNT_NF, MSG_DT_RELCOUNT_NF,
725 731 MSG_DT_FLAGS_1_NF, MSG_DT_VERDEF_NF,
726 732 MSG_DT_VERDEFNUM_NF, MSG_DT_VERNEED_NF,
727 733 MSG_DT_VERNEEDNUM_NF
728 734 };
729 735 static const conv_ds_msg_t ds_relacount_cf = {
730 736 CONV_DS_MSG_INIT(DT_RELACOUNT, tags_relacount_cf) };
731 737 static const conv_ds_msg_t ds_relacount_cfnp = {
732 738 CONV_DS_MSG_INIT(DT_RELACOUNT, tags_relacount_cfnp) };
733 739 static const conv_ds_msg_t ds_relacount_nf = {
734 740 CONV_DS_MSG_INIT(DT_RELACOUNT, tags_relacount_nf) };
735 741
736 742 /*
737 743 * DT_LOPROC - DT_HIPROC range: solaris/sparc-only
738 744 */
739 745 static const Msg tags_sparc_reg_cf[] = { MSG_DT_SPARC_REGISTER_CF };
740 746 static const Msg tags_sparc_reg_cfnp[] = { MSG_DT_SPARC_REGISTER_CFNP };
741 747 static const Msg tags_sparc_reg_nf[] = { MSG_DT_SPARC_REGISTER_NF };
742 748 static const Msg tags_sparc_reg_dmp[] = { MSG_DT_SPARC_REGISTER_DMP };
743 749 static const conv_ds_msg_t ds_sparc_reg_cf = {
744 750 CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_cf) };
745 751 static const conv_ds_msg_t ds_sparc_reg_cfnp = {
746 752 CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_cfnp) };
747 753 static const conv_ds_msg_t ds_sparc_reg_nf = {
748 754 CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_nf) };
749 755 static const conv_ds_msg_t ds_sparc_reg_dmp = {
750 756 CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_dmp) };
751 757
752 758 /*
753 759 * DT_LOPROC - DT_HIPROC range: Solaris osabi, all hardware
754 760 */
755 761 static const Msg tags_auxiliary_cf[] = {
756 762 MSG_DT_AUXILIARY_CF, MSG_DT_USED_CF,
757 763 MSG_DT_FILTER_CF
758 764 };
759 765 static const Msg tags_auxiliary_cfnp[] = {
760 766 MSG_DT_AUXILIARY_CFNP, MSG_DT_USED_CFNP,
761 767 MSG_DT_FILTER_CFNP
762 768 };
763 769 static const Msg tags_auxiliary_nf[] = {
764 770 MSG_DT_AUXILIARY_NF, MSG_DT_USED_NF,
765 771 MSG_DT_FILTER_NF
766 772 };
767 773 static const conv_ds_msg_t ds_auxiliary_cf = {
768 774 CONV_DS_MSG_INIT(DT_AUXILIARY, tags_auxiliary_cf) };
769 775 static const conv_ds_msg_t ds_auxiliary_cfnp = {
770 776 CONV_DS_MSG_INIT(DT_AUXILIARY, tags_auxiliary_cfnp) };
771 777 static const conv_ds_msg_t ds_auxiliary_nf = {
772 778 CONV_DS_MSG_INIT(DT_AUXILIARY, tags_auxiliary_nf) };
773 779
774 780
775 781 static const conv_ds_t *retarr[MAX_RET];
776 782
777 783 int ndx = 0;
778 784 int fmt_osabi = CONV_TYPE_FMT_ALT(fmt_flags);
779 785 int mach_sparc, osabi_solaris, osabi_linux;
780 786
781 787
782 788
783 789 osabi_solaris = (osabi == ELFOSABI_NONE) ||
784 790 (osabi == ELFOSABI_SOLARIS) || (osabi == CONV_OSABI_ALL);
785 791 osabi_linux = (osabi == ELFOSABI_LINUX) || (osabi == CONV_OSABI_ALL);
786 792 mach_sparc = (mach == EM_SPARC) || (mach == EM_SPARCV9) ||
787 793 (mach == EM_SPARC32PLUS) || (mach == CONV_MACH_ALL);
788 794
789 795 /*
790 796 * Fill in retarr with the descriptors for the messages that
791 797 * apply to the current osabi. Note that we order these items such
792 798 * that the more common are placed at the beginning, and the less
793 799 * likely at the end. This should speed the common case.
794 800 *
795 801 * Note that the CFNP and DMP styles are very similar, so they
796 802 * are combined in 'default', and fmt_osabi is consulted when there
797 803 * are differences.
798 804 */
799 805 switch (fmt_osabi) {
800 806 case CONV_FMT_ALT_CF:
801 807 retarr[ndx++] = CONV_DS_ADDR(ds_null_cf);
802 808 if (osabi_solaris)
803 809 retarr[ndx++] = CONV_DS_ADDR(ds_sunw_auxiliary_cf);
804 810 retarr[ndx++] = CONV_DS_ADDR(ds_checksum_cf);
805 811 retarr[ndx++] = CONV_DS_ADDR(ds_config_cf);
806 812 retarr[ndx++] = CONV_DS_ADDR(ds_versym_cf);
807 813 retarr[ndx++] = CONV_DS_ADDR(ds_relacount_cf);
808 814 if (osabi_solaris) {
809 815 retarr[ndx++] = CONV_DS_ADDR(ds_auxiliary_cf);
810 816 if (mach_sparc) {
811 817 retarr[ndx++] = CONV_DS_ADDR(ds_sparc_reg_cf);
812 818 retarr[ndx++] = CONV_DS_ADDR(ds_sdreg_cf);
813 819 }
814 820 }
815 821 if (osabi_linux) {
816 822 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_prelinked_cf);
817 823 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_hash_cf);
818 824 }
819 825 break;
820 826
821 827 case CONV_FMT_ALT_NF:
822 828 retarr[ndx++] = CONV_DS_ADDR(ds_null_nf);
823 829 if (osabi_solaris)
824 830 retarr[ndx++] = CONV_DS_ADDR(ds_sunw_auxiliary_nf);
825 831 retarr[ndx++] = CONV_DS_ADDR(ds_checksum_nf);
826 832 retarr[ndx++] = CONV_DS_ADDR(ds_config_nf);
827 833 retarr[ndx++] = CONV_DS_ADDR(ds_versym_nf);
828 834 retarr[ndx++] = CONV_DS_ADDR(ds_relacount_nf);
829 835 if (osabi_solaris) {
830 836 retarr[ndx++] = CONV_DS_ADDR(ds_auxiliary_nf);
831 837 if (mach_sparc) {
832 838 retarr[ndx++] = CONV_DS_ADDR(ds_sparc_reg_nf);
833 839 retarr[ndx++] = CONV_DS_ADDR(ds_sdreg_nf);
834 840 }
835 841 }
836 842 if (osabi_linux) {
837 843 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_prelinked_nf);
838 844 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_hash_nf);
839 845 }
840 846 break;
841 847 default:
842 848 /*
843 849 * The default style for the generic range is CFNP,
844 850 * while dump has a couple of different strings.
845 851 */
846 852
847 853 retarr[ndx++] = (fmt_osabi == CONV_FMT_ALT_DUMP) ?
848 854 CONV_DS_ADDR(ds_null_dmp) : CONV_DS_ADDR(ds_null_cfnp);
849 855 if (osabi_solaris)
850 856 retarr[ndx++] = CONV_DS_ADDR(ds_sunw_auxiliary_cfnp);
851 857 retarr[ndx++] = CONV_DS_ADDR(ds_checksum_cfnp);
852 858 retarr[ndx++] = CONV_DS_ADDR(ds_config_cfnp);
853 859 retarr[ndx++] = CONV_DS_ADDR(ds_versym_cfnp);
854 860 retarr[ndx++] = CONV_DS_ADDR(ds_relacount_cfnp);
855 861 if (osabi_solaris) {
856 862 retarr[ndx++] = CONV_DS_ADDR(ds_auxiliary_cfnp);
857 863 if (mach_sparc) {
858 864 /*
859 865 * The default style for DT_SPARC_REGISTER
860 866 * is the dump style, which omits the 'SPARC_'.
861 867 * CFNP keeps the prefix.
862 868 */
863 869 retarr[ndx++] =
864 870 (fmt_osabi == CONV_FMT_ALT_CFNP) ?
865 871 CONV_DS_ADDR(ds_sparc_reg_cfnp) :
866 872 CONV_DS_ADDR(ds_sparc_reg_dmp);
867 873 retarr[ndx++] = CONV_DS_ADDR(ds_sdreg_cfnp);
868 874 }
869 875 }
870 876 if (osabi_linux) {
871 877 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_prelinked_cfnp);
872 878 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_hash_cfnp);
873 879 }
874 880 break;
875 881 }
876 882
877 883 retarr[ndx++] = NULL;
878 884 assert(ndx <= MAX_RET);
879 885 return (retarr);
880 886 }
881 887
882 888 conv_iter_ret_t
883 889 conv_iter_dyn_tag(conv_iter_osabi_t osabi, Half mach,
884 890 Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
885 891 {
886 892 return (conv_iter_ds(osabi, mach,
887 893 conv_dyn_tag_strings(osabi, mach, fmt_flags), func, uvalue));
888 894 }
889 895
890 896
891 897 #define BINDTSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
892 898 MSG_BND_NEEDED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
893 899 MSG_BND_REFER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
894 900 MSG_BND_FILTER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
895 901 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
896 902
897 903 /*
898 904 * Ensure that Conv_bnd_type_buf_t is large enough:
899 905 *
900 906 * BINDTSZ is the real minimum size of the buffer required by conv_bnd_type().
901 907 * However, Conv_bnd_type_buf_t uses CONV_BND_TYPE_BUFSIZE to set the
902 908 * buffer size. We do things this way because the definition of BINDTSZ uses
903 909 * information that is not available in the environment of other programs
904 910 * that include the conv.h header file.
905 911 */
906 912 #if (CONV_BND_TYPE_BUFSIZE != BINDTSZ) && !defined(__lint)
907 913 #define REPORT_BUFSIZE BINDTSZ
908 914 #include "report_bufsize.h"
909 915 #error "CONV_BND_TYPE_BUFSIZE does not match BINDTSZ"
910 916 #endif
911 917
912 918 const char *
913 919 conv_bnd_type(uint_t flags, Conv_bnd_type_buf_t *bnd_type_buf)
914 920 {
915 921 static const Val_desc vda[] = {
916 922 { BND_NEEDED, MSG_BND_NEEDED },
917 923 { BND_REFER, MSG_BND_REFER },
918 924 { BND_FILTER, MSG_BND_FILTER },
919 925 { 0, 0 }
920 926 };
921 927 static CONV_EXPN_FIELD_ARG conv_arg = {
922 928 NULL, sizeof (bnd_type_buf->buf) };
923 929
924 930 if (flags == 0)
925 931 return (MSG_ORIG(MSG_STR_EMPTY));
926 932
927 933 conv_arg.buf = bnd_type_buf->buf;
928 934 conv_arg.oflags = conv_arg.rflags = flags;
929 935 (void) conv_expn_field(&conv_arg, vda, 0);
930 936
931 937 return ((const char *)bnd_type_buf->buf);
932 938 }
933 939
934 940 /*
935 941 * Note, conv_bnd_obj() is called with either:
936 942 * LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or
937 943 * LML_FLG_OBJDELETED, or
938 944 * LML_FLG_ATEXIT.
939 945 */
940 946 #define BINDOSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
941 947 MSG_BND_ADDED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
942 948 MSG_BND_REEVAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
943 949 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
944 950
945 951 /*
946 952 * Ensure that Conv_bnd_obj_buf_t is large enough:
947 953 *
948 954 * BINDOSZ is the real minimum size of the buffer required by conv_bnd_obj().
949 955 * However, Conv_bnd_obj_buf_t uses CONV_BND_OBJ_BUFSIZE to set the
950 956 * buffer size. We do things this way because the definition of BINDOSZ uses
951 957 * information that is not available in the environment of other programs
952 958 * that include the conv.h header file.
953 959 */
954 960 #if (CONV_BND_OBJ_BUFSIZE != BINDOSZ) && !defined(__lint)
955 961 #define REPORT_BUFSIZE BINDOSZ
956 962 #include "report_bufsize.h"
957 963 #error "CONV_BND_OBJ_BUFSIZE does not match BINDOSZ"
958 964 #endif
959 965
960 966 const char *
961 967 conv_bnd_obj(uint_t flags, Conv_bnd_obj_buf_t *bnd_obj_buf)
962 968 {
963 969 static const Val_desc vda[] = {
964 970 { LML_FLG_OBJADDED, MSG_BND_ADDED },
965 971 { LML_FLG_OBJREEVAL, MSG_BND_REEVAL },
966 972 { LML_FLG_OBJDELETED, MSG_BND_DELETED },
967 973 { LML_FLG_ATEXIT, MSG_BND_ATEXIT },
968 974 { 0, 0 }
969 975 };
970 976 static CONV_EXPN_FIELD_ARG conv_arg = {
971 977 NULL, sizeof (bnd_obj_buf->buf) };
972 978
973 979 if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL |
974 980 LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0)
975 981 return (MSG_ORIG(MSG_BND_REVISIT));
976 982
977 983 /*
978 984 * Note, we're not worried about unknown flags for this family, only
979 985 * the selected flags are of interest, so we leave conv_arg.rflags
980 986 * set to 0.
981 987 */
982 988 conv_arg.buf = bnd_obj_buf->buf;
983 989 conv_arg.oflags = flags;
984 990 (void) conv_expn_field(&conv_arg, vda, 0);
985 991
986 992 return ((const char *)bnd_obj_buf->buf);
987 993 }
↓ open down ↓ |
388 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX