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