Print this page
7595 sgs native-proto fails on pre-7029 illumos-gate
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/sgs/include/conv.h
+++ new/usr/src/cmd/sgs/include/conv.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]
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 1988 AT&T
24 24 * All Rights Reserved
25 25 *
26 26 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
27 27 * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
28 + * Copyright 2016 RackTop Systems.
28 29 */
29 30
30 31 #ifndef _CONV_H
31 32 #define _CONV_H
32 33
33 34 /*
34 35 * Global include file for conversion library.
35 36 */
36 37
37 38 #include <stdlib.h>
38 39 #include <libelf.h>
39 40 #include <dlfcn.h>
40 41 #include <libld.h>
41 42 #include <sgs.h>
42 43 #include <sgsmsg.h>
43 44
45 +#ifndef NATIVE_BUILD
44 46 #include <sys/secflags.h>
47 +#endif
45 48
46 49 #ifdef __cplusplus
47 50 extern "C" {
48 51 #endif
49 52
50 53 /*
51 54 * Configuration features available - maintained here (instead of debug.h)
52 55 * to save libconv from having to include debug.h which results in numerous
53 56 * "declared but not used or defined" lint errors.
54 57 */
55 58 #define CONF_EDLIBPATH 0x000100 /* ELF default library path */
56 59 #define CONF_ESLIBPATH 0x000200 /* ELF secure library path */
57 60 #define CONF_ADLIBPATH 0x000400 /* AOUT default library path */
58 61 #define CONF_ASLIBPATH 0x000800 /* AOUT secure library path */
59 62 #define CONF_DIRCFG 0x001000 /* directory configuration available */
60 63 #define CONF_OBJALT 0x002000 /* object alternatives available */
61 64 #define CONF_MEMRESV 0x004000 /* memory reservation required */
62 65 #define CONF_ENVS 0x008000 /* environment variables available */
63 66 #define CONF_FLTR 0x010000 /* filter information available */
64 67 #define CONF_FEATMSK 0xffff00
65 68
66 69
67 70 /*
68 71 * Valid flags for conv_strproc_extract_value().
69 72 */
70 73 #define CONV_SPEXV_F_NOTRIM 0x0001 /* Do not trim whitespace around '=' */
71 74 #define CONV_SPEXV_F_UCASE 0x0002 /* Convert value to uppercase */
72 75 #define CONV_SPEXV_F_NULLOK 0x0004 /* Empty ("") value is OK */
73 76
74 77 /*
75 78 * Buffer types:
76 79 *
77 80 * Many of the routines in this module require the user to supply a
78 81 * buffer into which the desired strings may be written. These are
79 82 * all arrays of characters, and might be defined as simple arrays
80 83 * of char. The problem with that approach is that when such an array
81 84 * is passed to a function, the C language considers it to have the
82 85 * type (char *), without any regard to its length. Not all of our
83 86 * buffers have the same length, and we want to ensure that the compiler
84 87 * will refuse to compile code that passes the wrong type of buffer to
85 88 * a given routine. The solution is to define the buffers as unions
86 89 * that contain the needed array, and then to pass the given union
87 90 * by address. The compiler will catch attempts to pass the wrong type
88 91 * of pointer, and the size of a structure/union is implicit in its type.
89 92 *
90 93 * A nice side effect of this approach is that we can use a union with
91 94 * multiple buffers to handle the cases where a given routine needs
92 95 * more than one type of buffer. The end result is a single buffer large
93 96 * enough to handle any of the subcases, but no larger.
94 97 */
95 98
96 99 /*
97 100 * Size of buffer used by conv_invalid_val():
98 101 *
99 102 * Various values that can't be matched to a symbolic definition are converted
100 103 * to a numeric string.
101 104 *
102 105 * The buffer size reflects the maximum number of digits needed to
103 106 * display an integer as text, plus a trailing null, and with room for
104 107 * a leading "0x" if hexidecimal display is selected.
105 108 *
106 109 * The 32-bit version of this requires 12 characters, and the 64-bit version
107 110 * needs 22. By using the larger value for both, we can have a single
108 111 * definition, which is necessary for code that is ELFCLASS independent. A
109 112 * nice side benefit is that it lets us dispense with a large number of 32/64
110 113 * buffer size definitions that build off CONV_INV_BUFSIZE, and the macros
111 114 * that would then be needed.
112 115 */
113 116 #define CONV_INV_BUFSIZE 22
114 117 typedef union {
115 118 char buf[CONV_INV_BUFSIZE];
116 119 } Conv_inv_buf_t;
117 120
118 121 /* conv_ehdr_flags() */
119 122 #define CONV_EHDR_FLAGS_BUFSIZE 91
120 123 typedef union {
121 124 Conv_inv_buf_t inv_buf;
122 125 char buf[CONV_EHDR_FLAGS_BUFSIZE];
123 126 } Conv_ehdr_flags_buf_t;
124 127
125 128 /* conv_reject_desc() */
126 129 typedef union {
127 130 Conv_inv_buf_t inv_buf;
128 131 Conv_ehdr_flags_buf_t flags_buf;
129 132 } Conv_reject_desc_buf_t;
130 133
131 134 /*
132 135 * conv_la_bind()
133 136 */
134 137 #define CONV_LA_BIND_BUFSIZE 56
135 138 typedef union {
136 139 Conv_inv_buf_t inv_buf;
137 140 char buf[CONV_LA_BIND_BUFSIZE];
138 141 } Conv_la_bind_buf_t;
139 142
140 143 /*
141 144 * conv_la_search()
142 145 */
143 146 #define CONV_LA_SEARCH_BUFSIZE 111
144 147 typedef union {
145 148 Conv_inv_buf_t inv_buf;
146 149 char buf[CONV_LA_SEARCH_BUFSIZE];
147 150 } Conv_la_search_buf_t;
148 151
149 152 /*
150 153 * conv_la_symbind()
151 154 */
152 155 #define CONV_LA_SYMBIND_BUFSIZE 113
153 156 typedef union {
154 157 Conv_inv_buf_t inv_buf;
155 158 char buf[CONV_LA_SYMBIND_BUFSIZE];
156 159 } Conv_la_symbind_buf_t;
157 160
158 161 /*
159 162 * conv_cap_val_hw/sf()
160 163 *
161 164 * These sizes are based on the maximum number of capabilities that exist.
162 165 * See common/elfcap.
163 166 */
164 167 #define CONV_CAP_VAL_HW1_BUFSIZE 195
165 168 typedef union {
166 169 Conv_inv_buf_t inv_buf;
167 170 char buf[CONV_CAP_VAL_HW1_BUFSIZE];
168 171 } Conv_cap_val_hw1_buf_t;
169 172
170 173 #define CONV_CAP_VAL_HW2_BUFSIZE CONV_INV_BUFSIZE /* for now */
171 174 typedef union {
172 175 Conv_inv_buf_t inv_buf;
173 176 char buf[CONV_CAP_VAL_HW2_BUFSIZE];
174 177 } Conv_cap_val_hw2_buf_t;
175 178
176 179 #define CONV_CAP_VAL_SF1_BUFSIZE 45
177 180 typedef union {
178 181 Conv_inv_buf_t inv_buf;
179 182 char buf[CONV_CAP_VAL_SF1_BUFSIZE];
180 183 } Conv_cap_val_sf1_buf_t;
181 184
182 185 /* conv_cap_val_buf() */
183 186 typedef union {
184 187 Conv_inv_buf_t inv_buf;
185 188 Conv_cap_val_hw1_buf_t cap_val_hw1_buf;
186 189 Conv_cap_val_sf1_buf_t cap_val_sf1_buf;
187 190 Conv_cap_val_hw2_buf_t cap_val_hw2_buf;
188 191 } Conv_cap_val_buf_t;
189 192
190 193 /* conv_config_feat() */
191 194 #define CONV_CONFIG_FEAT_BUFSIZE 204
192 195 typedef union {
193 196 Conv_inv_buf_t inv_buf;
194 197 char buf[CONV_CONFIG_FEAT_BUFSIZE];
195 198 } Conv_config_feat_buf_t;
196 199
197 200 /* conv_config_obj() */
198 201 #define CONV_CONFIG_OBJ_BUFSIZE 164
199 202 typedef union {
200 203 Conv_inv_buf_t inv_buf;
201 204 char buf[CONV_CONFIG_OBJ_BUFSIZE];
202 205 } Conv_config_obj_buf_t;
203 206
204 207 /* conv_dl_mode() */
205 208 #define CONV_DL_MODE_BUFSIZE 132
206 209 typedef union {
207 210 Conv_inv_buf_t inv_buf;
208 211 char buf[CONV_DL_MODE_BUFSIZE];
209 212 } Conv_dl_mode_buf_t;
210 213
211 214 /* conv_dl_flag() */
212 215 #define CONV_DL_FLAG_BUFSIZE 185
213 216 typedef union {
214 217 Conv_inv_buf_t inv_buf;
215 218 char buf[CONV_DL_FLAG_BUFSIZE];
216 219 } Conv_dl_flag_buf_t;
217 220
218 221 /* conv_grphdl_flags() */
219 222 #define CONV_GRPHDL_FLAGS_BUFSIZE 78
220 223 typedef union {
221 224 Conv_inv_buf_t inv_buf;
222 225 char buf[CONV_GRPHDL_FLAGS_BUFSIZE];
223 226 } Conv_grphdl_flags_buf_t;
224 227
225 228 /* conv_grpdesc_flags() */
226 229 #define CONV_GRPDESC_FLAGS_BUFSIZE 91
227 230 typedef union {
228 231 Conv_inv_buf_t inv_buf;
229 232 char buf[CONV_GRPDESC_FLAGS_BUFSIZE];
230 233 } Conv_grpdesc_flags_buf_t;
231 234
232 235 /* conv_seg_flags() */
233 236 #define CONV_SEG_FLAGS_BUFSIZE 241
234 237 typedef union {
235 238 Conv_inv_buf_t inv_buf;
236 239 char buf[CONV_SEG_FLAGS_BUFSIZE];
237 240 } Conv_seg_flags_buf_t;
238 241
239 242 /* conv_dyn_posflag1() */
240 243 #define CONV_DYN_POSFLAG1_BUFSIZE 72
241 244 typedef union {
242 245 Conv_inv_buf_t inv_buf;
243 246 char buf[CONV_DYN_POSFLAG1_BUFSIZE];
244 247 } Conv_dyn_posflag1_buf_t;
245 248
246 249 /* conv_dyn_flag() */
247 250 #define CONV_DYN_FLAG_BUFSIZE 85
248 251 typedef union {
249 252 Conv_inv_buf_t inv_buf;
250 253 char buf[CONV_DYN_FLAG_BUFSIZE];
251 254 } Conv_dyn_flag_buf_t;
252 255
253 256 /* conv_dyn_flag1() */
254 257 #define CONV_DYN_FLAG1_BUFSIZE 361
255 258 typedef union {
256 259 Conv_inv_buf_t inv_buf;
257 260 char buf[CONV_DYN_FLAG1_BUFSIZE];
258 261 } Conv_dyn_flag1_buf_t;
259 262
260 263 /* conv_dyn_feature1() */
261 264 #define CONV_DYN_FEATURE1_BUFSIZE 54
262 265 typedef union {
263 266 Conv_inv_buf_t inv_buf;
264 267 char buf[CONV_DYN_FEATURE1_BUFSIZE];
265 268 } Conv_dyn_feature1_buf_t;
266 269
267 270 /* conv_bnd_type() */
268 271 #define CONV_BND_TYPE_BUFSIZE 51
269 272 typedef union {
270 273 Conv_inv_buf_t inv_buf;
271 274 char buf[CONV_BND_TYPE_BUFSIZE];
272 275 } Conv_bnd_type_buf_t;
273 276
274 277 /* conv_bnd_obj() */
275 278 #define CONV_BND_OBJ_BUFSIZE 60
276 279 typedef union {
277 280 Conv_inv_buf_t inv_buf;
278 281 char buf[CONV_BND_OBJ_BUFSIZE];
279 282 } Conv_bnd_obj_buf_t;
280 283
281 284 /* conv_phdr_flags() */
282 285 #define CONV_PHDR_FLAGS_BUFSIZE 88
283 286 typedef union {
284 287 Conv_inv_buf_t inv_buf;
285 288 char buf[CONV_PHDR_FLAGS_BUFSIZE];
286 289 } Conv_phdr_flags_buf_t;
287 290
288 291 /* conv_sec_flags() */
289 292 #define CONV_SEC_FLAGS_BUFSIZE 190
290 293 typedef union {
291 294 Conv_inv_buf_t inv_buf;
292 295 char buf[CONV_SEC_FLAGS_BUFSIZE];
293 296 } Conv_sec_flags_buf_t;
294 297
295 298 /* conv_dwarf_ehe() */
296 299 #define CONV_DWARF_EHE_BUFSIZE 43
297 300 typedef union {
298 301 Conv_inv_buf_t inv_buf;
299 302 char buf[CONV_DWARF_EHE_BUFSIZE];
300 303 } Conv_dwarf_ehe_buf_t;
301 304
302 305 /* conv_syminfo_flags() */
303 306 #define CONV_SYMINFO_FLAGS_BUFSIZE 230
304 307 typedef union {
305 308 Conv_inv_buf_t inv_buf;
306 309 char buf[CONV_SYMINFO_FLAGS_BUFSIZE];
307 310 } Conv_syminfo_flags_buf_t;
308 311
309 312 /* conv_cnote_pr_flags() */
310 313 #define CONV_CNOTE_PR_FLAGS_BUFSIZE 254
311 314 typedef union {
312 315 Conv_inv_buf_t inv_buf;
313 316 char buf[CONV_CNOTE_PR_FLAGS_BUFSIZE];
314 317 } Conv_cnote_pr_flags_buf_t;
315 318
316 319 /* conv_cnote_old_pr_flags() */
317 320 #define CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE 174
318 321 typedef union {
319 322 Conv_inv_buf_t inv_buf;
↓ open down ↓ |
265 lines elided |
↑ open up ↑ |
320 323 char buf[CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE];
321 324 } Conv_cnote_old_pr_flags_buf_t;
322 325
323 326 /* conv_cnote_proc_flag() */
324 327 #define CONV_CNOTE_PROC_FLAG_BUFSIZE 39
325 328 typedef union {
326 329 Conv_inv_buf_t inv_buf;
327 330 char buf[CONV_CNOTE_PROC_FLAG_BUFSIZE];
328 331 } Conv_cnote_proc_flag_buf_t;
329 332
333 +#ifndef NATIVE_BUILD
330 334 /* conv_prsecflags() */
331 335 #define CONV_PRSECFLAGS_BUFSIZE 57
332 336 typedef union {
333 337 Conv_inv_buf_t inv_buf;
334 338 char buf[CONV_PRSECFLAGS_BUFSIZE];
335 339 } Conv_secflags_buf_t;
340 +#endif
336 341
337 342 /* conv_cnote_sigset() */
338 343 #define CONV_CNOTE_SIGSET_BUFSIZE 639
339 344 typedef union {
340 345 Conv_inv_buf_t inv_buf;
341 346 char buf[CONV_CNOTE_SIGSET_BUFSIZE];
342 347 } Conv_cnote_sigset_buf_t;
343 348
344 349 /* conv_cnote_fltset() */
345 350 #define CONV_CNOTE_FLTSET_BUFSIZE 511
346 351 typedef union {
347 352 Conv_inv_buf_t inv_buf;
348 353 char buf[CONV_CNOTE_FLTSET_BUFSIZE];
349 354 } Conv_cnote_fltset_buf_t;
350 355
351 356 /* conv_cnote_sysset() */
352 357 #define CONV_CNOTE_SYSSET_BUFSIZE 3195
353 358 typedef union {
354 359 Conv_inv_buf_t inv_buf;
355 360 char buf[CONV_CNOTE_SYSSET_BUFSIZE];
356 361 } Conv_cnote_sysset_buf_t;
357 362
358 363 /* conv_cnote_sa_flags() */
359 364 #define CONV_CNOTE_SA_FLAGS_BUFSIZE 109
360 365 typedef union {
361 366 Conv_inv_buf_t inv_buf;
362 367 char buf[CONV_CNOTE_SA_FLAGS_BUFSIZE];
363 368 } Conv_cnote_sa_flags_buf_t;
364 369
365 370 /* conv_cnote_ss_flags() */
366 371 #define CONV_CNOTE_SS_FLAGS_BUFSIZE 48
367 372 typedef union {
368 373 Conv_inv_buf_t inv_buf;
369 374 char buf[CONV_CNOTE_SS_FLAGS_BUFSIZE];
370 375 } Conv_cnote_ss_flags_buf_t;
371 376
372 377 /* conv_cnote_cc_content() */
373 378 #define CONV_CNOTE_CC_CONTENT_BUFSIZE 97
374 379 typedef union {
375 380 Conv_inv_buf_t inv_buf;
376 381 char buf[CONV_CNOTE_CC_CONTENT_BUFSIZE];
377 382 } Conv_cnote_cc_content_buf_t;
378 383
379 384 /* conv_cnote_auxv_af() */
380 385 #define CONV_CNOTE_AUXV_AF_BUFSIZE 73
381 386 typedef union {
382 387 Conv_inv_buf_t inv_buf;
383 388 char buf[CONV_CNOTE_AUXV_AF_BUFSIZE];
384 389 } Conv_cnote_auxv_af_buf_t;
385 390
386 391 /* conv_ver_flags() */
387 392 #define CONV_VER_FLAGS_BUFSIZE 41
388 393 typedef union {
389 394 Conv_inv_buf_t inv_buf;
390 395 char buf[CONV_VER_FLAGS_BUFSIZE];
391 396 } Conv_ver_flags_buf_t;
392 397
393 398 /* conv_ent_flags() */
394 399 #define CONV_ENT_FLAGS_BUFSIZE 69
395 400 typedef union {
396 401 Conv_inv_buf_t inv_buf;
397 402 char buf[CONV_ENT_FLAGS_BUFSIZE];
398 403 } Conv_ent_flags_buf_t;
399 404
400 405 /* conv_ent_files_flags() */
401 406 #define CONV_ENT_FILES_FLAGS_BUFSIZE 89
402 407 typedef union {
403 408 Conv_inv_buf_t inv_buf;
404 409 char buf[CONV_ENT_FILES_FLAGS_BUFSIZE];
405 410 } Conv_ent_files_flags_buf_t;
406 411
407 412 /*
408 413 * conv_time()
409 414 *
410 415 * This size is based on the maximum "hour.min.sec.fraction: " time that
411 416 * would be expected of ld().
412 417 */
413 418 #define CONV_TIME_BUFSIZE 18
414 419 typedef union {
415 420 char buf[CONV_TIME_BUFSIZE];
416 421 } Conv_time_buf_t;
417 422
418 423 /*
419 424 * Many conversion routines accept a fmt_flags argument of this type
420 425 * to allow the caller to modify the output. There are two parts to
421 426 * this value:
422 427 *
423 428 * (1) Format requests (decimal vs hex, etc...)
424 429 * (2) The low order bits specified by CONV_MASK_FMT_ALT
425 430 * and retrieved by CONV_TYPE_FMT_ALT are integer
426 431 * values that specify that an alternate set of
427 432 * strings should be used.
428 433 *
429 434 * The fmt_flags value is designed such that a caller can always
430 435 * supply a 0 in order to receive default behavior.
431 436 */
432 437 typedef int Conv_fmt_flags_t;
433 438
434 439 /*
435 440 * Type used to represent ELF constants within libconv. This relies on
436 441 * the fact that there are no ELF constants that need more than 32-bits,
437 442 * nor are there any signed values.
438 443 */
439 444 typedef uint32_t Conv_elfvalue_t;
440 445
441 446 /*
442 447 * Most conversion routines are able to provide strings in one of
443 448 * several alternative styles. The bottom 8 bits of Conv_fmt_flags_t
444 449 * are used to specify which strings should be used for a given call
445 450 * to a conversion routine:
446 451 *
447 452 * DEFAULT
448 453 * The default string style used by a given conversion routine is
449 454 * an independent choice made by that routine. Different routines
450 455 * make different choices, based largely on historical usage and
451 456 * the perceived common case. It may be an alias for one of the
452 457 * specific styles listed below, or it may be unique.
453 458 *
454 459 * DUMP
455 460 * Style of strings used by dump(1).
456 461 *
457 462 * FILE
458 463 * Style of strings used by file(1).
459 464 *
460 465 * CRLE
461 466 * Style of strings used by crle(1).
462 467 *
463 468 * CF
464 469 * Canonical Form: The string is exactly the same as the name
465 470 * of the #define macro that defines it in the public header files.
466 471 * (e.g. STB_LOCAL, not LOCL, LOCAL, LOC, or any other variation).
467 472 *
468 473 * CFNP
469 474 * No Prefix Canonical Form: The same strings supplied by CF,
470 475 * but without their standard prefix. (e.g. LOCAL, instead of STT_LOCAL).
471 476 *
472 477 * NF
473 478 * Natural Form: The form of the strings that might typically be entered
474 479 * via a keyboard by an interactive user. These are usually the strings
475 480 * from CFNP, converted to lowercase, although in some cases they may
476 481 * take some other "natural" form. In command completion applications,
477 482 * lowercase strings appear less formal, and are easier on the eye.
478 483 *
479 484 * Every routine is required to have a default style. The others are optional,
480 485 * and may not be provided if not needed. If a given conversion routine does
481 486 * not support alternative strings for a given CONV_FMT_ALT type, it silently
482 487 * ignores the request and supplies the default set. This means that a utility
483 488 * like dump(1) is free to specify a style like DUMP to every conversion
484 489 * routine. It will receive its special strings if there are any, and
485 490 * the defaults otherwise.
486 491 */
487 492 #define CONV_MASK_FMT_ALT 0xff
488 493 #define CONV_TYPE_FMT_ALT(fmt_flags) (fmt_flags & CONV_MASK_FMT_ALT)
489 494
490 495 #define CONV_FMT_ALT_DEFAULT 0 /* "Standard" strings */
491 496 #define CONV_FMT_ALT_DUMP 1 /* dump(1) */
492 497 #define CONV_FMT_ALT_FILE 2 /* file(1) */
493 498 #define CONV_FMT_ALT_CRLE 3 /* crle(1) */
494 499 #define CONV_FMT_ALT_CF 4 /* Canonical Form */
495 500 #define CONV_FMT_ALT_CFNP 5 /* No Prefix Canonical Form */
496 501 #define CONV_FMT_ALT_NF 6 /* Natural Form */
497 502
498 503 /*
499 504 * Flags that alter standard formatting for conversion routines.
500 505 * These bits start after the range occupied by CONV_MASK_FMT_ALT.
501 506 */
502 507 #define CONV_FMT_DECIMAL 0x0100 /* conv_invalid_val() should print */
503 508 /* integer print as decimal */
504 509 /* (default is hex) */
505 510 #define CONV_FMT_SPACE 0x0200 /* conv_invalid_val() should append */
506 511 /* a space after the number. */
507 512 #define CONV_FMT_NOBKT 0x0400 /* conv_expn_field() should omit */
508 513 /* prefix and suffix strings */
509 514
510 515 /*
511 516 * A Val_desc structure is used to associate an ELF constant and
512 517 * the message code (Msg) for the string that corresponds to it.
513 518 *
514 519 * Val_desc2 adds v_osabi and v_mach fields to Val_desc, which allows
515 520 * for non-generic mappings that apply only to a specific OSABI/machine.
516 521 * Setting v_osabi to 0 (ELFOSABI_NONE) specifies that any OSABI matches.
517 522 * Similarly, setting v_mach to 0 (EM_MACH) matches any machine. Hence,
518 523 * setting v_osabi and v_mach to 0 in a Val_desc2 results in a generic item,
519 524 * and is equivalent to simply using a Val_desc.
520 525 *
521 526 * These structs are used in two different contexts:
522 527 *
523 528 * 1) To expand bit-field data items, using conv_expn_field() to
524 529 * process a NULL terminated array of Val_desc, or conv_expn_field2()
525 530 * to process a null terminated array of Val_desc2.
526 531 *
527 532 * 2) To represent sparse ranges of non-bitfield values, referenced via
528 533 * conv_ds_vd_t or conv_ds_vd2_t descriptors, as described below.
529 534 */
530 535 typedef struct {
531 536 Conv_elfvalue_t v_val; /* expansion value */
532 537 Msg v_msg; /* associated message string code */
533 538 } Val_desc;
534 539 typedef struct {
535 540 Conv_elfvalue_t v_val; /* expansion value */
536 541 uchar_t v_osabi; /* OSABI to which entry applies */
537 542 Half v_mach; /* Machine to which entry applies */
538 543 Msg v_msg; /* associated message string code */
539 544 } Val_desc2;
540 545
541 546 /*
542 547 * The conv_ds_XXX_t structs are used to pull together the information used
543 548 * to map non-bitfield values to strings. They are a variant family, sharing
544 549 * the same initial fields, with a generic "header" definition that can be
545 550 * used to read those common fields and determine which subcase is being
546 551 * seen. We do this instead of using a single struct containing a type code
547 552 * and a union in order to allow for static compile-time initialization.
548 553 *
549 554 * conv_ds_t is the base type, containing the initial fields common to all
550 555 * the variants. Variables of type conv_ds_t are never instantiated. This
551 556 * type exists only to provide a common pointer type that can reference
552 557 * any of the variants safely. In C++, it would be a virtual base class.
553 558 * The fields common to all the variants are:
554 559 *
555 560 * ds_type: Identifies the variant
556 561 * ds_baseval/ds_topval: The lower and upper bound of the range
557 562 * of values represented by this conv_ds_XXX_t descriptor.
558 563 *
559 564 * There are three different variants:
560 565 * conv_ds_msg_t (ds_type == CONV_DS_MSGARR)
561 566 * This structure references an array of message codes corresponding
562 567 * to consecutive ELF values. The first item in the array is the Msg
563 568 * code for the value given by ds_baseval. Consecutive strings follow
564 569 * in consecutive order. The final item corresponds to the value given
565 570 * by ds_topval. Zero (0) Msg values can be used to represent missing
566 571 * values. Entries with a 0 are quietly ignored.
567 572 *
568 573 * conv_ds_vd_t (ds_type == CONV_DS_VD)
569 574 * This structure employs a NULL terminated array of Val_desc structs.
570 575 * Each Val_desc supplies a mapping from a value in the range
571 576 * (ds_baseval <= value <= ds_topval). The values described need not
572 577 * be consecutive, and can be sparse. ds_baseval does not need to
573 578 * correspond to the first item, and ds_topval need not correspond to
574 579 * the final item.
575 580 *
576 581 * conv_ds_vd2_t (ds_type == CONV_DS_VD2)
577 582 * This structure employs a NULL terminated array of Val_desc2 structs,
578 583 * rather than Val_desc, adding the ability to specify OSABI and machine
579 584 * as part of the value/string mapping. It is otherwise the same thing
580 585 * as CONV_DS_VD.
581 586 */
582 587 typedef enum {
583 588 CONV_DS_MSGARR = 0, /* Array of Msg */
584 589 CONV_DS_VD = 1, /* Null terminated array of Val_desc */
585 590 CONV_DS_VD2 = 2, /* Null terminated array of Val_desc2 */
586 591 } conv_ds_type_t;
587 592
588 593 #define CONV_DS_COMMON_FIELDS \
589 594 conv_ds_type_t ds_type; /* Type of data structure used */ \
590 595 uint32_t ds_baseval; /* Value of first item */ \
591 596 uint32_t ds_topval /* Value of last item */
592 597
593 598 typedef struct { /* Virtual base type --- do not instantiate */
594 599 CONV_DS_COMMON_FIELDS;
595 600 } conv_ds_t;
596 601 typedef struct {
597 602 CONV_DS_COMMON_FIELDS;
598 603 const Msg *ds_msg;
599 604 } conv_ds_msg_t;
600 605 typedef struct {
601 606 CONV_DS_COMMON_FIELDS;
602 607 const Val_desc *ds_vd;
603 608 } conv_ds_vd_t;
604 609 typedef struct {
605 610 CONV_DS_COMMON_FIELDS;
606 611 const Val_desc2 *ds_vd2;
607 612 } conv_ds_vd2_t;
608 613
609 614 /*
610 615 * The initialization of conv_ds_msg_t can be completely derived from
611 616 * its base value and the array of Msg codes. CONV_DS_MSG_INIT() is used
612 617 * to do that.
613 618 */
614 619 #define CONV_DS_MSG_INIT(_baseval, _arr) \
615 620 CONV_DS_MSGARR, _baseval, \
616 621 _baseval + (sizeof (_arr) / sizeof (_arr[0])) - 1, _arr
617 622
618 623 /*
619 624 * Null terminated arrays of pointers to conv_ds_XXX_t structs are processed
620 625 * by conv_map_ds() to convert ELF constants to their symbolic names, and by
621 626 * conv_iter_ds() to iterate over all the available value/name combinations.
622 627 *
623 628 * These pointers are formed by casting the address of the specific
624 629 * variant types (described above) to generic base type pointer.
625 630 * CONV_DS_ADDR() is a convenience macro to take the address of
626 631 * one of these variants and turn it into a generic pointer.
627 632 */
628 633 #define CONV_DS_ADDR(_item) ((conv_ds_t *)&(_item))
629 634
630 635 /*
631 636 * Type used by libconv to represent osabi values passed to iteration
632 637 * functions. The type in the ELF header is uchar_t. However, every possible
633 638 * value 0-255 has a valid meaning, leaving us no extra value to assign
634 639 * to mean "ALL". Using Half for osabi leaves us the top byte to use for
635 640 * out of bound values.
636 641 *
637 642 * Non-iteration functions, and any code that does not need to use
638 643 * CONV_OSABI_ALL, should use uchar_t for osabi.
639 644 */
640 645 typedef Half conv_iter_osabi_t;
641 646
642 647 /*
643 648 * Many of the iteration functions accept an osabi or mach argument,
644 649 * used to specify the type of object being processed. The following
645 650 * values can be used to specify a wildcard that matches any item. Their
646 651 * values are carefully chosen to ensure that they cannot be interpreted
647 652 * as an otherwise valid osabi or machine.
648 653 */
649 654 #define CONV_OSABI_ALL 1024 /* Larger than can be represented by uchar_t */
650 655 #define CONV_MACH_ALL EM_NUM /* Never a valid machine type */
651 656
652 657 /*
653 658 * We compare Val_Desc2 descriptors with a specified osabi and machine
654 659 * to determine whether to use it or not. This macro encapsulates that logic.
655 660 *
656 661 * We consider an osabi to match when any of the following things hold:
657 662 *
658 663 * - The descriptor osabi is ELFOSABI_NONE.
659 664 * - The supplied osabi and the descriptor osabi match
660 665 * - The supplied osabi is ELFOSABI_NONE, and the descriptor osabi is
661 666 * ELFOSABI_SOLARIS. Many operating systems, Solaris included,
662 667 * produce or have produced ELFOSABI_NONE native objects, if only
663 668 * because OSABI ranges are not an original ELF feature. We
664 669 * give our own objects the home field advantage.
665 670 * - Iteration Only: An osabi value of CONV_OSABI_ALL is specified.
666 671 *
667 672 * We consider a machine to match when any of the following things hold:
668 673 *
669 674 * - The descriptor mach is EM_NONE.
670 675 * - The supplied mach and the descriptor mach match
671 676 * - Iteration Only: A mach value of CONV_MACH_ALL is specified.
672 677 *
673 678 * The special extra _ALL case for iteration is handled by defining a separate
674 679 * macro with the extra CONV_xxx_ALL tests.
675 680 */
676 681 #define CONV_VD2_SKIP_OSABI(_osabi, _vdp) \
677 682 ((_vdp->v_osabi != ELFOSABI_NONE) && (_vdp->v_osabi != osabi) && \
678 683 ((_osabi != ELFOSABI_NONE) || (_vdp->v_osabi != ELFOSABI_SOLARIS)))
679 684
680 685 #define CONV_VD2_SKIP_MACH(_mach, _vdp) \
681 686 ((_vdp->v_mach != EM_NONE) && (_vdp->v_mach != _mach))
682 687
683 688 #define CONV_VD2_SKIP(_osabi, _mach, _vdp) \
684 689 (CONV_VD2_SKIP_OSABI(_osabi, _vdp) || CONV_VD2_SKIP_MACH(_mach, _vdp))
685 690
686 691 #define CONV_ITER_VD2_SKIP(_osabi, _mach, _vdp) \
687 692 ((CONV_VD2_SKIP_OSABI(_osabi, _vdp) && (_osabi != CONV_OSABI_ALL)) || \
688 693 (CONV_VD2_SKIP_MACH(_mach, _vdp) && (_mach != CONV_MACH_ALL)))
689 694
690 695
691 696 /*
692 697 * Possible return values from iteration functions.
693 698 */
694 699 typedef enum {
695 700 CONV_ITER_DONE, /* Stop: No more iterations are desired */
696 701 CONV_ITER_CONT /* Continue with following iterations */
697 702 } conv_iter_ret_t;
698 703
699 704 /*
700 705 * Prototype for caller supplied callback function to iteration functions.
701 706 */
702 707 typedef conv_iter_ret_t (* conv_iter_cb_t)(const char *str,
703 708 Conv_elfvalue_t value, void *uvalue);
704 709
705 710 /*
706 711 * User value block employed by conv_iter_strtol()
707 712 */
708 713 typedef struct {
709 714 const char *csl_str; /* String to search for */
710 715 size_t csl_strlen; /* # chars in csl_str to examine */
711 716 int csl_found; /* Init to 0, set to 1 if item found */
712 717 Conv_elfvalue_t csl_value; /* If csl_found, resulting value */
713 718 } conv_strtol_uvalue_t;
714 719
715 720 /*
716 721 * conv_expn_field() is willing to supply default strings for the
717 722 * prefix, separator, and suffix arguments, if they are passed as NULL.
718 723 * The caller needs to know how much room to allow for these items.
719 724 * These values supply those sizes.
720 725 */
721 726 #define CONV_EXPN_FIELD_DEF_PREFIX_SIZE 2 /* Default is "[ " */
722 727 #define CONV_EXPN_FIELD_DEF_SEP_SIZE 1 /* Default is " " */
723 728 #define CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 2 /* Default is " ]" */
724 729
725 730 /*
726 731 * conv_expn_field() requires a large number of inputs, many of which
727 732 * can be NULL to accept default behavior. An argument of the following
728 733 * type is used to supply them.
729 734 */
730 735 typedef struct {
731 736 char *buf; /* Buffer to receive generated string */
732 737 size_t bufsize; /* sizeof(buf) */
733 738 const char **lead_str; /* NULL, or array of pointers to strings to */
734 739 /* be output at the head of the list. */
735 740 /* Last entry must be NULL. */
736 741 Xword oflags; /* Bits for which output strings are desired */
737 742 Xword rflags; /* Bits for which a numeric value should be */
738 743 /* output if vdp does not provide str. */
739 744 /* Must be a proper subset of oflags */
740 745 const char *prefix; /* NULL, or string to prefix output with */
741 746 /* If NULL, "[ " is used. */
742 747 const char *sep; /* NULL, or string to separate output items */
743 748 /* with. If NULL, " " is used. */
744 749 const char *suffix; /* NULL, or string to suffix output with */
745 750 /* If NULL, " ]" is used. */
746 751 } CONV_EXPN_FIELD_ARG;
747 752
748 753 /*
749 754 * Callback function for conv_str_to_c_literal(). A user supplied function
750 755 * of this type is called by conv_str_to_c_literal() in order to dispatch
751 756 * the translated output characters.
752 757 *
753 758 * buf - Pointer to output text
754 759 * n - # of characters to output
755 760 * uvalue - User value argument to conv_str_to_c_literal(),
756 761 * passed through without interpretation.
757 762 */
758 763 typedef void Conv_str_to_c_literal_func_t(const void *ptr,
759 764 size_t size, void *uvalue);
760 765
761 766 /*
762 767 * Generic miscellaneous interfaces
763 768 */
764 769 extern uchar_t conv_check_native(char **, char **);
765 770 extern const char *conv_lddstub(int);
766 771 extern int conv_strproc_isspace(int);
767 772 extern char *conv_strproc_trim(char *);
768 773 extern Boolean conv_strproc_extract_value(char *, size_t, int,
769 774 const char **);
770 775 extern int conv_sys_eclass(void);
771 776 extern int conv_translate_c_esc(char **);
772 777
773 778 /*
774 779 * Generic core formatting and iteration functionality
775 780 */
776 781 extern conv_iter_ret_t _conv_iter_ds(conv_iter_osabi_t, Half,
777 782 const conv_ds_t **, conv_iter_cb_t, void *,
778 783 const char *);
779 784 extern conv_iter_ret_t _conv_iter_ds_msg(const conv_ds_msg_t *,
780 785 conv_iter_cb_t, void *, const char *);
781 786 extern conv_iter_ret_t _conv_iter_vd(const Val_desc *, conv_iter_cb_t,
782 787 void *, const char *);
783 788 extern conv_iter_ret_t _conv_iter_vd2(conv_iter_osabi_t, Half,
784 789 const Val_desc2 *, conv_iter_cb_t, void *,
785 790 const char *);
786 791 extern int conv_iter_strtol_init(const char *,
787 792 conv_strtol_uvalue_t *);
788 793 extern conv_iter_ret_t conv_iter_strtol(const char *, Conv_elfvalue_t, void *);
789 794 extern const char *_conv_map_ds(uchar_t, Half, Conv_elfvalue_t,
790 795 const conv_ds_t **, Conv_fmt_flags_t,
791 796 Conv_inv_buf_t *, const char *);
792 797
793 798
794 799 /*
795 800 * Generic formatting interfaces.
796 801 */
797 802 extern const char *conv_bnd_obj(uint_t, Conv_bnd_obj_buf_t *);
798 803 extern const char *conv_bnd_type(uint_t, Conv_bnd_type_buf_t *);
799 804 extern const char *conv_config_feat(int, Conv_config_feat_buf_t *);
800 805 extern const char *conv_config_obj(ushort_t, Conv_config_obj_buf_t *);
801 806 extern const char *conv_config_upm(const char *, const char *,
802 807 const char *, size_t);
803 808 extern const char *conv_cnote_auxv_af(Word, Conv_fmt_flags_t,
804 809 Conv_cnote_auxv_af_buf_t *);
805 810 extern const char *conv_cnote_auxv_type(Word, Conv_fmt_flags_t,
806 811 Conv_inv_buf_t *);
807 812 extern const char *conv_cnote_cc_content(Lword, Conv_fmt_flags_t,
808 813 Conv_cnote_cc_content_buf_t *);
809 814 extern const char *conv_cnote_errno(int, Conv_fmt_flags_t,
810 815 Conv_inv_buf_t *);
811 816 extern const char *conv_cnote_fault(Word, Conv_fmt_flags_t,
812 817 Conv_inv_buf_t *);
813 818 extern const char *conv_cnote_fltset(uint32_t *, int,
814 819 Conv_fmt_flags_t, Conv_cnote_fltset_buf_t *);
815 820 extern const char *conv_cnote_old_pr_flags(int, Conv_fmt_flags_t,
816 821 Conv_cnote_old_pr_flags_buf_t *);
817 822 extern const char *conv_cnote_pr_dmodel(Word, Conv_fmt_flags_t,
818 823 Conv_inv_buf_t *);
819 824 extern const char *conv_cnote_pr_flags(int, Conv_fmt_flags_t,
820 825 Conv_cnote_pr_flags_buf_t *);
821 826 extern const char *conv_cnote_proc_flag(int, Conv_fmt_flags_t,
822 827 Conv_cnote_proc_flag_buf_t *);
↓ open down ↓ |
477 lines elided |
↑ open up ↑ |
823 828 extern const char *conv_cnote_pr_regname(Half, int, Conv_fmt_flags_t,
824 829 Conv_inv_buf_t *inv_buf);
825 830 extern const char *conv_cnote_pr_stype(Word, Conv_fmt_flags_t,
826 831 Conv_inv_buf_t *);
827 832 extern const char *conv_cnote_pr_what(short, short, Conv_fmt_flags_t,
828 833 Conv_inv_buf_t *);
829 834 extern const char *conv_cnote_pr_why(short, Conv_fmt_flags_t,
830 835 Conv_inv_buf_t *);
831 836 extern const char *conv_cnote_priv(int, Conv_fmt_flags_t,
832 837 Conv_inv_buf_t *);
838 +#ifndef NATIVE_BUILD
833 839 extern const char *conv_prsecflags(secflagset_t, Conv_fmt_flags_t,
834 840 Conv_secflags_buf_t *);
841 +#endif
835 842 extern const char *conv_cnote_psetid(int, Conv_fmt_flags_t,
836 843 Conv_inv_buf_t *);
837 844 extern const char *conv_cnote_sa_flags(int, Conv_fmt_flags_t,
838 845 Conv_cnote_sa_flags_buf_t *);
839 846 extern const char *conv_cnote_signal(Word, Conv_fmt_flags_t,
840 847 Conv_inv_buf_t *);
841 848 extern const char *conv_cnote_si_code(Half, int, int, Conv_fmt_flags_t,
842 849 Conv_inv_buf_t *);
843 850 extern const char *conv_cnote_sigset(uint32_t *, int,
844 851 Conv_fmt_flags_t, Conv_cnote_sigset_buf_t *);
845 852 extern const char *conv_cnote_ss_flags(int, Conv_fmt_flags_t,
846 853 Conv_cnote_ss_flags_buf_t *);
847 854 extern const char *conv_cnote_syscall(Word, Conv_fmt_flags_t,
848 855 Conv_inv_buf_t *);
849 856 extern const char *conv_cnote_sysset(uint32_t *, int,
850 857 Conv_fmt_flags_t, Conv_cnote_sysset_buf_t *);
851 858 extern const char *conv_cnote_fileflags(uint32_t, Conv_fmt_flags_t,
852 859 char *, size_t);
853 860 extern const char *conv_cnote_filemode(uint32_t, Conv_fmt_flags_t,
854 861 char *, size_t);
855 862 extern const char *conv_cnote_type(Word, Conv_fmt_flags_t,
856 863 Conv_inv_buf_t *);
857 864 extern const char *conv_def_tag(Symref, Conv_inv_buf_t *);
858 865 extern const char *conv_demangle_name(const char *);
859 866 extern const char *conv_dl_flag(int, Conv_fmt_flags_t,
860 867 Conv_dl_flag_buf_t *);
861 868 extern const char *conv_dl_info(int);
862 869 extern const char *conv_dl_mode(int, int, Conv_dl_mode_buf_t *);
863 870 extern const char *conv_dwarf_cfa(uchar_t, Conv_fmt_flags_t,
864 871 Conv_inv_buf_t *);
865 872 extern const char *conv_dwarf_ehe(uint_t, Conv_dwarf_ehe_buf_t *);
866 873 extern const char *conv_dwarf_regname(Half, Word, Conv_fmt_flags_t,
867 874 int *, Conv_inv_buf_t *);
868 875 extern const char *conv_ehdr_abivers(uchar_t, Word, Conv_fmt_flags_t,
869 876 Conv_inv_buf_t *);
870 877 extern const char *conv_ehdr_class(uchar_t, Conv_fmt_flags_t,
871 878 Conv_inv_buf_t *);
872 879 extern const char *conv_ehdr_data(uchar_t, Conv_fmt_flags_t,
873 880 Conv_inv_buf_t *);
874 881 extern const char *conv_ehdr_flags(Half, Word, Conv_fmt_flags_t,
875 882 Conv_ehdr_flags_buf_t *);
876 883 extern const char *conv_ehdr_mach(Half, Conv_fmt_flags_t,
877 884 Conv_inv_buf_t *);
878 885 extern const char *conv_ehdr_osabi(uchar_t, Conv_fmt_flags_t,
879 886 Conv_inv_buf_t *);
880 887 extern const char *conv_ehdr_type(uchar_t, Half, Conv_fmt_flags_t,
881 888 Conv_inv_buf_t *);
882 889 extern const char *conv_ehdr_vers(Word, Conv_fmt_flags_t,
883 890 Conv_inv_buf_t *);
884 891 extern const char *conv_elfdata_type(Elf_Type, Conv_inv_buf_t *);
885 892 extern const char *conv_ent_flags(ec_flags_t, Conv_ent_flags_buf_t *);
886 893 extern const char *conv_ent_files_flags(Word, Conv_fmt_flags_t fmt_flags,
887 894 Conv_ent_files_flags_buf_t *);
888 895 extern const char *conv_la_activity(uint_t, Conv_fmt_flags_t,
889 896 Conv_inv_buf_t *);
890 897 extern const char *conv_la_bind(uint_t, Conv_la_bind_buf_t *);
891 898 extern const char *conv_la_search(uint_t, Conv_la_search_buf_t *);
892 899 extern const char *conv_la_symbind(uint_t, Conv_la_symbind_buf_t *);
893 900 extern const char *conv_grphdl_flags(uint_t, Conv_grphdl_flags_buf_t *);
894 901 extern const char *conv_grpdesc_flags(uint_t, Conv_grpdesc_flags_buf_t *);
895 902 extern Isa_desc *conv_isalist(void);
896 903 extern const char *conv_mapfile_version(Word, Conv_fmt_flags_t,
897 904 Conv_inv_buf_t *);
898 905 extern const char *conv_phdr_flags(uchar_t, Word, Conv_fmt_flags_t,
899 906 Conv_phdr_flags_buf_t *);
900 907 extern const char *conv_phdr_type(uchar_t, Half, Word, Conv_fmt_flags_t,
901 908 Conv_inv_buf_t *);
902 909 extern const char *conv_reject_desc(Rej_desc *, Conv_reject_desc_buf_t *,
903 910 Half mach);
904 911 extern const char *conv_reloc_type(Half, Word, Conv_fmt_flags_t,
905 912 Conv_inv_buf_t *);
906 913 extern const char *conv_reloc_type_static(Half, Word, Conv_fmt_flags_t);
907 914 extern const char *conv_reloc_386_type(Word, Conv_fmt_flags_t,
908 915 Conv_inv_buf_t *);
909 916 extern const char *conv_reloc_amd64_type(Word, Conv_fmt_flags_t,
910 917 Conv_inv_buf_t *);
911 918 extern const char *conv_reloc_SPARC_type(Word, Conv_fmt_flags_t,
912 919 Conv_inv_buf_t *);
913 920 extern const char *conv_sec_type(uchar_t, Half, Word, Conv_fmt_flags_t,
914 921 Conv_inv_buf_t *);
915 922 extern const char *conv_seg_flags(sg_flags_t, Conv_seg_flags_buf_t *);
916 923 extern void conv_str_to_c_literal(const char *buf, size_t n,
917 924 Conv_str_to_c_literal_func_t *cb_func,
918 925 void *uvalue);
919 926 extern const char *conv_sym_info_bind(uchar_t, Conv_fmt_flags_t,
920 927 Conv_inv_buf_t *);
921 928 extern const char *conv_sym_info_type(Half, uchar_t, Conv_fmt_flags_t,
922 929 Conv_inv_buf_t *);
923 930 extern const char *conv_sym_shndx(uchar_t, Half, Half, Conv_fmt_flags_t,
924 931 Conv_inv_buf_t *);
925 932 extern const char *conv_sym_other(uchar_t, Conv_inv_buf_t *);
926 933 extern const char *conv_sym_other_vis(uchar_t, Conv_fmt_flags_t,
927 934 Conv_inv_buf_t *);
928 935 extern const char *conv_syminfo_boundto(Half, Conv_fmt_flags_t,
929 936 Conv_inv_buf_t *);
930 937 extern const char *conv_syminfo_flags(Half, Conv_fmt_flags_t,
931 938 Conv_syminfo_flags_buf_t *);
932 939 extern const char *conv_time(struct timeval *, struct timeval *,
933 940 Conv_time_buf_t *);
934 941 extern Uts_desc *conv_uts(void);
935 942 extern const char *conv_ver_flags(Half, Conv_fmt_flags_t,
936 943 Conv_ver_flags_buf_t *);
937 944 extern const char *conv_ver_index(Versym, int, Conv_inv_buf_t *);
938 945
939 946
940 947 /*
941 948 * Generic iteration interfaces.
942 949 */
943 950 extern conv_iter_ret_t conv_iter_cap_tags(Conv_fmt_flags_t, conv_iter_cb_t,
944 951 void *);
945 952 extern conv_iter_ret_t conv_iter_cap_val_hw1(Half, Conv_fmt_flags_t,
946 953 conv_iter_cb_t, void *);
947 954 extern conv_iter_ret_t conv_iter_cap_val_hw2(Half, Conv_fmt_flags_t,
948 955 conv_iter_cb_t, void *);
949 956 extern conv_iter_ret_t conv_iter_cap_val_sf1(Conv_fmt_flags_t, conv_iter_cb_t,
950 957 void *);
951 958
952 959 extern conv_iter_ret_t conv_iter_dyn_feature1(Conv_fmt_flags_t, conv_iter_cb_t,
953 960 void *);
954 961 extern conv_iter_ret_t conv_iter_dyn_flag(Conv_fmt_flags_t, conv_iter_cb_t,
955 962 void *);
956 963 extern conv_iter_ret_t conv_iter_dyn_flag1(Conv_fmt_flags_t, conv_iter_cb_t,
957 964 void *);
958 965 extern conv_iter_ret_t conv_iter_dyn_posflag1(Conv_fmt_flags_t, conv_iter_cb_t,
959 966 void *);
960 967 extern conv_iter_ret_t conv_iter_dyn_tag(conv_iter_osabi_t, Half,
961 968 Conv_fmt_flags_t, conv_iter_cb_t, void *);
962 969
963 970 extern conv_iter_ret_t conv_iter_ehdr_abivers(conv_iter_osabi_t,
964 971 Conv_fmt_flags_t, conv_iter_cb_t, void *);
965 972 extern conv_iter_ret_t conv_iter_ehdr_class(Conv_fmt_flags_t, conv_iter_cb_t,
966 973 void *);
967 974 extern conv_iter_ret_t conv_iter_ehdr_data(Conv_fmt_flags_t, conv_iter_cb_t,
968 975 void *);
969 976 extern conv_iter_ret_t conv_iter_ehdr_eident(Conv_fmt_flags_t, conv_iter_cb_t,
970 977 void *);
971 978 extern conv_iter_ret_t conv_iter_ehdr_flags(Half, Conv_fmt_flags_t,
972 979 conv_iter_cb_t, void *);
973 980 extern conv_iter_ret_t conv_iter_ehdr_mach(Conv_fmt_flags_t, conv_iter_cb_t,
974 981 void *);
975 982 extern conv_iter_ret_t conv_iter_ehdr_osabi(Conv_fmt_flags_t, conv_iter_cb_t,
976 983 void *);
977 984 extern conv_iter_ret_t conv_iter_ehdr_type(conv_iter_osabi_t, Conv_fmt_flags_t,
978 985 conv_iter_cb_t, void *);
979 986 extern conv_iter_ret_t conv_iter_ehdr_vers(Conv_fmt_flags_t, conv_iter_cb_t,
980 987 void *);
981 988
982 989 extern conv_iter_ret_t conv_iter_phdr_flags(conv_iter_osabi_t,
983 990 Conv_fmt_flags_t, conv_iter_cb_t, void *);
984 991 extern conv_iter_ret_t conv_iter_phdr_type(conv_iter_osabi_t, Conv_fmt_flags_t,
985 992 conv_iter_cb_t, void *);
986 993
987 994 extern conv_iter_ret_t conv_iter_sec_flags(conv_iter_osabi_t, Half,
988 995 Conv_fmt_flags_t, conv_iter_cb_t, void *);
989 996 extern conv_iter_ret_t conv_iter_sec_symtab(conv_iter_osabi_t,
990 997 Conv_fmt_flags_t, conv_iter_cb_t, void *);
991 998 extern conv_iter_ret_t conv_iter_sec_type(conv_iter_osabi_t, Half,
992 999 Conv_fmt_flags_t, conv_iter_cb_t, void *);
993 1000
994 1001 extern conv_iter_ret_t conv_iter_sym_info_bind(Conv_fmt_flags_t,
995 1002 conv_iter_cb_t, void *);
996 1003 extern conv_iter_ret_t conv_iter_sym_other_vis(Conv_fmt_flags_t,
997 1004 conv_iter_cb_t, void *);
998 1005 extern conv_iter_ret_t conv_iter_sym_shndx(conv_iter_osabi_t, Half,
999 1006 Conv_fmt_flags_t, conv_iter_cb_t, void *);
1000 1007 extern conv_iter_ret_t conv_iter_sym_info_type(Half, Conv_fmt_flags_t,
1001 1008 conv_iter_cb_t, void *);
1002 1009
1003 1010 extern conv_iter_ret_t conv_iter_syminfo_boundto(Conv_fmt_flags_t,
1004 1011 conv_iter_cb_t, void *);
1005 1012 extern conv_iter_ret_t conv_iter_syminfo_flags(Conv_fmt_flags_t,
1006 1013 conv_iter_cb_t, void *);
1007 1014
1008 1015 /*
1009 1016 * Define all class specific routines.
1010 1017 */
1011 1018 #if defined(_ELF64)
1012 1019 #define conv_cap_tag conv64_cap_tag
1013 1020 #define conv_cap_val conv64_cap_val
1014 1021 #define conv_cap_val_hw1 conv64_cap_val_hw1
1015 1022 #define conv_cap_val_hw2 conv64_cap_val_hw2
1016 1023 #define conv_cap_val_sf1 conv64_cap_val_sf1
1017 1024 #define conv_dyn_feature1 conv64_dyn_feature1
1018 1025 #define conv_dyn_flag1 conv64_dyn_flag1
1019 1026 #define conv_dyn_flag conv64_dyn_flag
1020 1027 #define conv_dyn_posflag1 conv64_dyn_posflag1
1021 1028 #define conv_dyn_tag conv64_dyn_tag
1022 1029 #define _conv_expn_field _conv64_expn_field
1023 1030 #define _conv_expn_field2 _conv64_expn_field2
1024 1031 #define conv_invalid_val conv64_invalid_val
1025 1032 #define conv_sec_flags conv64_sec_flags
1026 1033 #define conv_sec_linkinfo conv64_sec_linkinfo
1027 1034 #define conv_sym_value conv64_sym_value
1028 1035 #define conv_sym_SPARC_value conv64_sym_SPARC_value
1029 1036 #else
1030 1037 #define conv_cap_tag conv32_cap_tag
1031 1038 #define conv_cap_val conv32_cap_val
1032 1039 #define conv_cap_val_hw1 conv32_cap_val_hw1
1033 1040 #define conv_cap_val_hw2 conv32_cap_val_hw2
1034 1041 #define conv_cap_val_sf1 conv32_cap_val_sf1
1035 1042 #define conv_dyn_feature1 conv32_dyn_feature1
1036 1043 #define conv_dyn_flag1 conv32_dyn_flag1
1037 1044 #define conv_dyn_flag conv32_dyn_flag
1038 1045 #define conv_dyn_posflag1 conv32_dyn_posflag1
1039 1046 #define conv_dyn_tag conv32_dyn_tag
1040 1047 #define _conv_expn_field _conv32_expn_field
1041 1048 #define _conv_expn_field2 _conv32_expn_field2
1042 1049 #define conv_invalid_val conv32_invalid_val
1043 1050 #define conv_sec_flags conv32_sec_flags
1044 1051 #define conv_sec_linkinfo conv32_sec_linkinfo
1045 1052 #define conv_sym_value conv32_sym_value
1046 1053 #define conv_sym_SPARC_value conv32_sym_SPARC_value
1047 1054 #endif
1048 1055
1049 1056 /*
1050 1057 * ELFCLASS-specific core formatting functionality
1051 1058 */
1052 1059 extern int _conv_expn_field(CONV_EXPN_FIELD_ARG *,
1053 1060 const Val_desc *, Conv_fmt_flags_t, const char *);
1054 1061 extern int _conv_expn_field2(CONV_EXPN_FIELD_ARG *, uchar_t,
1055 1062 Half, const Val_desc2 *, Conv_fmt_flags_t,
1056 1063 const char *);
1057 1064 extern const char *conv_invalid_val(Conv_inv_buf_t *, Xword,
1058 1065 Conv_fmt_flags_t);
1059 1066
1060 1067 /*
1061 1068 * ELFCLASS-specific formatting interfaces.
1062 1069 */
1063 1070 extern const char *conv_cap_tag(Xword, Conv_fmt_flags_t,
1064 1071 Conv_inv_buf_t *);
1065 1072 extern const char *conv_cap_val(Xword, Xword, Half, Conv_fmt_flags_t,
1066 1073 Conv_cap_val_buf_t *);
1067 1074 extern const char *conv_cap_val_hw1(Xword, Half, Conv_fmt_flags_t,
1068 1075 Conv_cap_val_hw1_buf_t *);
1069 1076 extern const char *conv_cap_val_hw2(Xword, Half, Conv_fmt_flags_t,
1070 1077 Conv_cap_val_hw2_buf_t *);
1071 1078 extern const char *conv_cap_val_sf1(Xword, Half, Conv_fmt_flags_t,
1072 1079 Conv_cap_val_sf1_buf_t *);
1073 1080 extern const char *conv_dyn_flag1(Xword, Conv_fmt_flags_t,
1074 1081 Conv_dyn_flag1_buf_t *);
1075 1082 extern const char *conv_dyn_flag(Xword, Conv_fmt_flags_t,
1076 1083 Conv_dyn_flag_buf_t *);
1077 1084 extern const char *conv_dyn_posflag1(Xword, Conv_fmt_flags_t,
1078 1085 Conv_dyn_posflag1_buf_t *);
1079 1086 extern const char *conv_dyn_tag(Xword, uchar_t, Half, Conv_fmt_flags_t,
1080 1087 Conv_inv_buf_t *);
1081 1088 extern const char *conv_dyn_feature1(Xword, Conv_fmt_flags_t,
1082 1089 Conv_dyn_feature1_buf_t *);
1083 1090 extern const char *conv_sec_flags(uchar_t osabi, Half mach, Xword,
1084 1091 Conv_fmt_flags_t, Conv_sec_flags_buf_t *);
1085 1092 extern const char *conv_sec_linkinfo(Word, Xword, Conv_inv_buf_t *);
1086 1093 extern const char *conv_sym_value(Half, uchar_t, Addr, Conv_inv_buf_t *);
1087 1094 extern const char *conv_sym_SPARC_value(Addr, Conv_fmt_flags_t,
1088 1095 Conv_inv_buf_t *);
1089 1096
1090 1097 /*
1091 1098 * Define macros for _conv_XXX() routines that accept local_sgs_msg as the
1092 1099 * final argument. The macros hide that argument from the caller's view and
1093 1100 * supply the SGS message array for the file from which the macro is used
1094 1101 * in its place. This trick is used to allow these functions to access the
1095 1102 * message strings from any source file they are called from.
1096 1103 */
1097 1104 #define conv_expn_field(_arg, _vdp, _fmt_flags) \
1098 1105 _conv_expn_field(_arg, _vdp, _fmt_flags, MSG_SGS_LOCAL_ARRAY)
1099 1106
1100 1107 #define conv_expn_field2(_arg, _osabi, _mach, _vdp, _fmt_flags) \
1101 1108 _conv_expn_field2(_arg, _osabi, _mach, _vdp, _fmt_flags, \
1102 1109 MSG_SGS_LOCAL_ARRAY)
1103 1110
1104 1111 #define conv_iter_ds(_osabi, _mach, _dsp, _func, _uvalue) \
1105 1112 _conv_iter_ds(_osabi, _mach, _dsp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY)
1106 1113
1107 1114 #define conv_iter_vd(_vdp, _func, _uvalue) \
1108 1115 _conv_iter_vd(_vdp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY)
1109 1116
1110 1117 #define conv_iter_vd2(_osabi, _mach, _vdp, _func, _uvalue) \
1111 1118 _conv_iter_vd2(_osabi, _mach, _vdp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY)
1112 1119
1113 1120 #define conv_map_ds(_osabi, _mach, _value, _dsp, _fmt_flags, _inv_buf) \
1114 1121 _conv_map_ds(_osabi, _mach, _value, _dsp, _fmt_flags, _inv_buf, \
1115 1122 MSG_SGS_LOCAL_ARRAY)
1116 1123
1117 1124
1118 1125 #ifdef __cplusplus
1119 1126 }
1120 1127 #endif
1121 1128
1122 1129 #endif /* _CONV_H */
↓ open down ↓ |
278 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX