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