xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/dynamic.c (revision 2352:9cdfed81bb1c)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51618Srie  * Common Development and Distribution License (the "License").
61618Srie  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
211618Srie 
220Sstevel@tonic-gate /*
231618Srie  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate 
280Sstevel@tonic-gate /*
290Sstevel@tonic-gate  * String conversion routine for .dynamic tag entries.
300Sstevel@tonic-gate  */
310Sstevel@tonic-gate #include	<stdio.h>
320Sstevel@tonic-gate #include	<string.h>
330Sstevel@tonic-gate #include	<sys/elf_SPARC.h>
34280Srie #include	"rtld.h"
350Sstevel@tonic-gate #include	"_conv.h"
360Sstevel@tonic-gate #include	"dynamic_msg.h"
370Sstevel@tonic-gate 
38*2352Sab196087 #define	POSSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
39*2352Sab196087 		MSG_DFP_LAZYLOAD_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
40*2352Sab196087 		MSG_DFP_GROUPPERM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
41*2352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
420Sstevel@tonic-gate 
430Sstevel@tonic-gate const char *
44*2352Sab196087 conv_dyn_posflag1(Xword flags, int fmt_flags)
450Sstevel@tonic-gate {
461618Srie 	static char	string[POSSZ];
471618Srie 	static Val_desc vda[] = {
481618Srie 		{ DF_P1_LAZYLOAD,	MSG_ORIG(MSG_DFP_LAZYLOAD) },
491618Srie 		{ DF_P1_GROUPPERM,	MSG_ORIG(MSG_DFP_GROUPPERM) },
501618Srie 		{ 0,			0 }
511618Srie 	};
52*2352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
53*2352Sab196087 	static Val_desc vda_alt[] = {
54*2352Sab196087 		{ DF_P1_LAZYLOAD,	MSG_ORIG(MSG_DFP_LAZYLOAD_ALT) },
55*2352Sab196087 		{ DF_P1_GROUPPERM,	MSG_ORIG(MSG_DFP_GROUPPERM) },
56*2352Sab196087 		{ 0,			0 }
57*2352Sab196087 	};
58*2352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg_alt = { string, sizeof (string),
59*2352Sab196087 		vda_alt, NULL, 0, 0, MSG_ORIG(MSG_STR_EMPTY), NULL,
60*2352Sab196087 		MSG_ORIG(MSG_STR_EMPTY) };
61*2352Sab196087 
62*2352Sab196087 	CONV_EXPN_FIELD_ARG *arg;
631618Srie 
640Sstevel@tonic-gate 	if (flags == 0)
650Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
660Sstevel@tonic-gate 
67*2352Sab196087 	arg = (fmt_flags & CONV_FMT_ALTDUMP) ? &conv_arg_alt : &conv_arg;
68*2352Sab196087 	arg->oflags = arg->rflags = flags;
69*2352Sab196087 	(void) conv_expn_field(arg);
700Sstevel@tonic-gate 
710Sstevel@tonic-gate 	return ((const char *)string);
720Sstevel@tonic-gate }
730Sstevel@tonic-gate 
74*2352Sab196087 #define	FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
75*2352Sab196087 		MSG_DF_ORIGIN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
76*2352Sab196087 		MSG_DF_SYMBOLIC_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
77*2352Sab196087 		MSG_DF_TEXTREL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
78*2352Sab196087 		MSG_DF_BIND_NOW_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
79*2352Sab196087 		MSG_DF_STATIC_TLS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
80*2352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
810Sstevel@tonic-gate 
820Sstevel@tonic-gate const char *
83*2352Sab196087 conv_dyn_flag(Xword flags, int fmt_flags)
840Sstevel@tonic-gate {
851618Srie 	static char	string[FLAGSZ];
861618Srie 	static Val_desc vda[] = {
871618Srie 		{ DF_ORIGIN,		MSG_ORIG(MSG_DF_ORIGIN) },
881618Srie 		{ DF_SYMBOLIC,		MSG_ORIG(MSG_DF_SYMBOLIC) },
891618Srie 		{ DF_TEXTREL,		MSG_ORIG(MSG_DF_TEXTREL) },
901618Srie 		{ DF_BIND_NOW,		MSG_ORIG(MSG_DF_BIND_NOW) },
911618Srie 		{ DF_STATIC_TLS,	MSG_ORIG(MSG_DF_STATIC_TLS) },
921618Srie 		{ 0,			0 }
931618Srie 	};
94*2352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
951618Srie 
960Sstevel@tonic-gate 	if (flags == 0)
970Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
980Sstevel@tonic-gate 
99*2352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
100*2352Sab196087 	if (fmt_flags & CONV_FMT_ALTDUMP) {
101*2352Sab196087 		conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
102*2352Sab196087 	} else {
103*2352Sab196087 		conv_arg.prefix = conv_arg.suffix = NULL;
104*2352Sab196087 	}
105*2352Sab196087 	(void) conv_expn_field(&conv_arg);
1060Sstevel@tonic-gate 
1071618Srie 	return ((const char *)string);
1080Sstevel@tonic-gate }
1090Sstevel@tonic-gate 
110*2352Sab196087 #define	FLAG1SZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
111*2352Sab196087 		MSG_DF1_NOW_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
112*2352Sab196087 		MSG_DF1_GLOBAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
113*2352Sab196087 		MSG_DF1_GROUP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
114*2352Sab196087 		MSG_DF1_NODELETE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
115*2352Sab196087 		MSG_DF1_LOADFLTR_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
116*2352Sab196087 		MSG_DF1_INITFIRST_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
117*2352Sab196087 		MSG_DF1_NOOPEN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
118*2352Sab196087 		MSG_DF1_ORIGIN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
119*2352Sab196087 		MSG_DF1_DIRECT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
120*2352Sab196087 		MSG_DF1_TRANS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
121*2352Sab196087 		MSG_DF1_INTERPOSE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
122*2352Sab196087 		MSG_DF1_NODEFLIB_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
123*2352Sab196087 		MSG_DF1_NODUMP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
124*2352Sab196087 		MSG_DF1_CONFALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
125*2352Sab196087 		MSG_DF1_ENDFILTEE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
126*2352Sab196087 		MSG_DF1_DISPRELPND_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
127*2352Sab196087 		MSG_DF1_DISPRELDNE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
128*2352Sab196087 		MSG_DF1_NODIRECT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
129*2352Sab196087 		MSG_DF1_IGNMULDEF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
130*2352Sab196087 		MSG_DF1_NOKSYMS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
131*2352Sab196087 		MSG_DF1_NORELOC_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
132*2352Sab196087 		MSG_DF1_NOHDR_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
133*2352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate const char *
1361618Srie conv_dyn_flag1(Xword flags)
1370Sstevel@tonic-gate {
1381618Srie 	static char	string[FLAG1SZ];
1391618Srie 	static Val_desc vda[] = {
140*2352Sab196087 		{ DF_1_NOW,		MSG_ORIG(MSG_DF1_NOW) },
1411618Srie 		{ DF_1_GLOBAL,		MSG_ORIG(MSG_DF1_GLOBAL) },
1421618Srie 		{ DF_1_GROUP,		MSG_ORIG(MSG_DF1_GROUP) },
1431618Srie 		{ DF_1_NODELETE,	MSG_ORIG(MSG_DF1_NODELETE) },
1441618Srie 		{ DF_1_LOADFLTR,	MSG_ORIG(MSG_DF1_LOADFLTR) },
1451618Srie 		{ DF_1_INITFIRST,	MSG_ORIG(MSG_DF1_INITFIRST) },
1461618Srie 		{ DF_1_NOOPEN,		MSG_ORIG(MSG_DF1_NOOPEN) },
1471618Srie 		{ DF_1_ORIGIN,		MSG_ORIG(MSG_DF1_ORIGIN) },
1481618Srie 		{ DF_1_DIRECT,		MSG_ORIG(MSG_DF1_DIRECT) },
1491618Srie 		{ DF_1_TRANS,		MSG_ORIG(MSG_DF1_TRANS) },
1501618Srie 		{ DF_1_INTERPOSE,	MSG_ORIG(MSG_DF1_INTERPOSE) },
1511618Srie 		{ DF_1_NODEFLIB,	MSG_ORIG(MSG_DF1_NODEFLIB) },
1521618Srie 		{ DF_1_NODUMP,		MSG_ORIG(MSG_DF1_NODUMP) },
1531618Srie 		{ DF_1_CONFALT,		MSG_ORIG(MSG_DF1_CONFALT) },
1541618Srie 		{ DF_1_ENDFILTEE,	MSG_ORIG(MSG_DF1_ENDFILTEE) },
1551618Srie 		{ DF_1_DISPRELPND,	MSG_ORIG(MSG_DF1_DISPRELPND) },
1561618Srie 		{ DF_1_DISPRELDNE,	MSG_ORIG(MSG_DF1_DISPRELDNE) },
1571618Srie 		{ DF_1_NODIRECT,	MSG_ORIG(MSG_DF1_NODIRECT) },
1581618Srie 		{ DF_1_IGNMULDEF,	MSG_ORIG(MSG_DF1_IGNMULDEF) },
1591618Srie 		{ DF_1_NOKSYMS,		MSG_ORIG(MSG_DF1_NOKSYMS) },
1601618Srie 		{ DF_1_NORELOC,		MSG_ORIG(MSG_DF1_NORELOC) },
1611698Sab196087 		{ DF_1_NOHDR,		MSG_ORIG(MSG_DF1_NOHDR) },
1621618Srie 		{ 0,			0 }
1631618Srie 	};
164*2352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
1650Sstevel@tonic-gate 
1660Sstevel@tonic-gate 	if (flags == 0)
1670Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1680Sstevel@tonic-gate 
169*2352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
170*2352Sab196087 	(void) conv_expn_field(&conv_arg);
1710Sstevel@tonic-gate 
1721618Srie 	return ((const char *)string);
1730Sstevel@tonic-gate }
1740Sstevel@tonic-gate 
175*2352Sab196087 #define	FEATSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
176*2352Sab196087 		MSG_DTF_PARINIT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
177*2352Sab196087 		MSG_DTF_CONFEXP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
178*2352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1790Sstevel@tonic-gate 
1800Sstevel@tonic-gate const char *
181*2352Sab196087 conv_dyn_feature1(Xword flags, int fmt_flags)
1820Sstevel@tonic-gate {
1831618Srie 	static char	string[FEATSZ];
1841618Srie 	static Val_desc vda[] = {
1851618Srie 		{ DTF_1_PARINIT,	MSG_ORIG(MSG_DTF_PARINIT) },
1861618Srie 		{ DTF_1_CONFEXP,	MSG_ORIG(MSG_DTF_CONFEXP) },
1871618Srie 		{ 0,			0 }
1881618Srie 	};
189*2352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
1900Sstevel@tonic-gate 
1910Sstevel@tonic-gate 	if (flags == 0)
1920Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1930Sstevel@tonic-gate 
194*2352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
195*2352Sab196087 	if (fmt_flags & CONV_FMT_ALTDUMP) {
196*2352Sab196087 		conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
197*2352Sab196087 	} else {
198*2352Sab196087 		conv_arg.prefix = conv_arg.suffix = NULL;
199*2352Sab196087 	}
200*2352Sab196087 	(void) conv_expn_field(&conv_arg);
2010Sstevel@tonic-gate 
2021618Srie 	return ((const char *)string);
2030Sstevel@tonic-gate }
2040Sstevel@tonic-gate 
2050Sstevel@tonic-gate const char *
2061976Sab196087 conv_dyn_tag(Xword tag, Half mach, int fmt_flags)
2070Sstevel@tonic-gate {
2081618Srie 	static char		string[CONV_INV_STRSIZE];
2091618Srie 	static const Msg	tags[DT_MAXPOSTAGS] = {
2101618Srie 		MSG_DYN_NULL,		MSG_DYN_NEEDED,
2111618Srie 		MSG_DYN_PLTRELSZ,	MSG_DYN_PLTGOT,
2121618Srie 		MSG_DYN_HASH,		MSG_DYN_STRTAB,
2131618Srie 		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
2141618Srie 		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
2151618Srie 		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
2161618Srie 		MSG_DYN_INIT,		MSG_DYN_FINI,
2171618Srie 		MSG_DYN_SONAME,		MSG_DYN_RPATH,
2181618Srie 		MSG_DYN_SYMBOLIC,	MSG_DYN_REL,
2191618Srie 		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
2201618Srie 		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
2211618Srie 		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
2221618Srie 		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
2231618Srie 		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
2241618Srie 		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
2251618Srie 		MSG_DYN_FLAGS,		MSG_DYN_NULL,
2261618Srie 		MSG_DYN_PREINIT_ARRAY,	MSG_DYN_PREINIT_ARRAYSZ
2271618Srie 	};
2281976Sab196087 	static const Msg	tags_alt[DT_MAXPOSTAGS] = {
2291976Sab196087 		MSG_DYN_NULL,		MSG_DYN_NEEDED,
2301976Sab196087 		MSG_DYN_PLTRELSZ_ALT,	MSG_DYN_PLTGOT,
2311976Sab196087 		MSG_DYN_HASH,		MSG_DYN_STRTAB,
2321976Sab196087 		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
2331976Sab196087 		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
2341976Sab196087 		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
2351976Sab196087 		MSG_DYN_INIT,		MSG_DYN_FINI,
2361976Sab196087 		MSG_DYN_SONAME,		MSG_DYN_RPATH,
2371976Sab196087 		MSG_DYN_SYMBOLIC_ALT,	MSG_DYN_REL,
2381976Sab196087 		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
2391976Sab196087 		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
2401976Sab196087 		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
2411976Sab196087 		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
2421976Sab196087 		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
2431976Sab196087 		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
2441976Sab196087 		MSG_DYN_FLAGS,		MSG_DYN_NULL,
2451976Sab196087 		MSG_DYN_PREINIT_ARRAY,	MSG_DYN_PREINIT_ARRAYSZ
2461976Sab196087 	};
2470Sstevel@tonic-gate 
2480Sstevel@tonic-gate 	if (tag < DT_MAXPOSTAGS) {
2490Sstevel@tonic-gate 		/*
2500Sstevel@tonic-gate 		 * Generic dynamic tags.
2510Sstevel@tonic-gate 		 */
2521976Sab196087 		return ((fmt_flags & CONV_FMTALTMASK)
2531976Sab196087 			? MSG_ORIG(tags_alt[tag]) : MSG_ORIG(tags[tag]));
2540Sstevel@tonic-gate 	} else {
2550Sstevel@tonic-gate 		/*
2560Sstevel@tonic-gate 		 * SUNW: DT_LOOS -> DT_HIOS range.
2570Sstevel@tonic-gate 		 */
2580Sstevel@tonic-gate 		if (tag == DT_SUNW_AUXILIARY)
2590Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_AUXILIARY));
2600Sstevel@tonic-gate 		else if (tag == DT_SUNW_RTLDINF)
2610Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_RTLDINF));
2620Sstevel@tonic-gate 		else if (tag == DT_SUNW_FILTER)
2630Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_FILTER));
2640Sstevel@tonic-gate 		else if (tag == DT_SUNW_CAP)
2650Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_CAP));
2660Sstevel@tonic-gate 
2670Sstevel@tonic-gate 		/*
2680Sstevel@tonic-gate 		 * SUNW: DT_VALRNGLO - DT_VALRNGHI range.
2690Sstevel@tonic-gate 		 */
2700Sstevel@tonic-gate 		else if (tag == DT_CHECKSUM)
2710Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CHECKSUM));
2720Sstevel@tonic-gate 		else if (tag == DT_PLTPADSZ)
2730Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPADSZ));
2740Sstevel@tonic-gate 		else if (tag == DT_MOVEENT)
2750Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVEENT));
2760Sstevel@tonic-gate 		else if (tag == DT_MOVESZ)
2770Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVESZ));
2780Sstevel@tonic-gate 		else if (tag == DT_FEATURE_1)
2790Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FEATURE_1));
2800Sstevel@tonic-gate 		else if (tag == DT_POSFLAG_1)
2810Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_POSFLAG_1));
2820Sstevel@tonic-gate 		else if (tag == DT_SYMINSZ)
2830Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINSZ));
2840Sstevel@tonic-gate 		else if (tag == DT_SYMINENT)
2850Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINENT));
2860Sstevel@tonic-gate 
2870Sstevel@tonic-gate 		/*
2880Sstevel@tonic-gate 		 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
2890Sstevel@tonic-gate 		 */
2900Sstevel@tonic-gate 		else if (tag == DT_CONFIG)
2910Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CONFIG));
2920Sstevel@tonic-gate 		else if (tag == DT_DEPAUDIT)
2930Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_DEPAUDIT));
2940Sstevel@tonic-gate 		else if (tag == DT_AUDIT)
2950Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUDIT));
2960Sstevel@tonic-gate 		else if (tag == DT_PLTPAD)
2970Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPAD));
2980Sstevel@tonic-gate 		else if (tag == DT_MOVETAB)
2990Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVETAB));
3000Sstevel@tonic-gate 		else if (tag == DT_SYMINFO)
3010Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINFO));
3020Sstevel@tonic-gate 
3030Sstevel@tonic-gate 		/*
3040Sstevel@tonic-gate 		 * SUNW: generic range.
3050Sstevel@tonic-gate 		 */
3060Sstevel@tonic-gate 		else if (tag == DT_VERSYM)
3070Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERSYM));
3080Sstevel@tonic-gate 		else if (tag == DT_RELACOUNT)
3090Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELACOUNT));
3100Sstevel@tonic-gate 		else if (tag == DT_RELCOUNT)
3110Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELCOUNT));
3120Sstevel@tonic-gate 		else if (tag == DT_FLAGS_1)
3130Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FLAGS_1));
3140Sstevel@tonic-gate 		else if (tag == DT_VERDEF)
3150Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEF));
3160Sstevel@tonic-gate 		else if (tag == DT_VERDEFNUM)
3170Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEFNUM));
3180Sstevel@tonic-gate 		else if (tag == DT_VERNEED)
3190Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEED));
3200Sstevel@tonic-gate 		else if (tag == DT_VERNEEDNUM)
3210Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEEDNUM));
3220Sstevel@tonic-gate 		else if (tag == DT_AUXILIARY)
3230Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUXILIARY));
3240Sstevel@tonic-gate 		else if (tag == DT_USED)
3250Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_USED));
3260Sstevel@tonic-gate 		else if (tag == DT_FILTER)
3270Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FILTER));
3280Sstevel@tonic-gate 
3290Sstevel@tonic-gate 		/*
3300Sstevel@tonic-gate 		 * SUNW: machine specific range.
3310Sstevel@tonic-gate 		 */
3320Sstevel@tonic-gate 		else if (((mach == EM_SPARC) || (mach == EM_SPARCV9) ||
3330Sstevel@tonic-gate 		    (mach == EM_SPARC32PLUS)) && (tag == DT_SPARC_REGISTER))
3340Sstevel@tonic-gate 			/* this is so x86 can display a sparc binary */
3350Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
3360Sstevel@tonic-gate 		else if (tag == DT_DEPRECATED_SPARC_REGISTER)
3370Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
3380Sstevel@tonic-gate 		else
3391618Srie 			return (conv_invalid_val(string, CONV_INV_STRSIZE,
3401976Sab196087 			    tag, fmt_flags));
3410Sstevel@tonic-gate 	}
3420Sstevel@tonic-gate }
343280Srie 
344*2352Sab196087 #define	BINDTSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
345*2352Sab196087 		MSG_BND_NEEDED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
346*2352Sab196087 		MSG_BND_REFER_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
347*2352Sab196087 		MSG_BND_FILTER_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
348*2352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
349280Srie 
350280Srie const char *
3511618Srie conv_bnd_type(uint_t flags)
352280Srie {
3531618Srie 	static char	string[BINDTSZ];
3541618Srie 	static Val_desc vda[] = {
3551618Srie 		{ BND_NEEDED,		MSG_ORIG(MSG_BND_NEEDED) },
3561618Srie 		{ BND_REFER,		MSG_ORIG(MSG_BND_REFER) },
3571618Srie 		{ BND_FILTER,		MSG_ORIG(MSG_BND_FILTER) },
3581618Srie 		{ 0,			0 }
3591618Srie 	};
360*2352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
361280Srie 
3621618Srie 	if (flags == 0)
3631618Srie 		return (MSG_ORIG(MSG_STR_EMPTY));
364280Srie 
365*2352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
366*2352Sab196087 	(void) conv_expn_field(&conv_arg);
3671618Srie 
3681618Srie 	return ((const char *)string);
369280Srie }
370280Srie 
3711824Srie /*
3721824Srie  * Note, conv_bnd_obj() is called with either:
3731824Srie  *	LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or
3741824Srie  *	LML_FLG_OBJDELETED, or
3751824Srie  *	LML_FLG_ATEXIT.
3761824Srie  */
377*2352Sab196087 #define	BINDOSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
378*2352Sab196087 		MSG_BND_ADDED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
379*2352Sab196087 		MSG_BND_REEVAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
380*2352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
381280Srie 
382280Srie const char *
3831618Srie conv_bnd_obj(uint_t flags)
384280Srie {
3851618Srie 	static char	string[BINDOSZ];
3861618Srie 	static Val_desc vda[] = {
3871618Srie 		{ LML_FLG_OBJADDED,	MSG_ORIG(MSG_BND_ADDED) },
3881618Srie 		{ LML_FLG_OBJREEVAL,	MSG_ORIG(MSG_BND_REEVAL) },
3891618Srie 		{ LML_FLG_OBJDELETED,	MSG_ORIG(MSG_BND_DELETED) },
3901618Srie 		{ LML_FLG_ATEXIT,	MSG_ORIG(MSG_BND_ATEXIT) },
3911618Srie 		{ 0,			0 }
3921618Srie 	};
393*2352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
3941618Srie 
3951824Srie 	if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL |
3961824Srie 	    LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0)
3971824Srie 		return (MSG_ORIG(MSG_BND_REVISIT));
398280Srie 
399280Srie 	/*
4001618Srie 	 * Note, we're not worried about unknown flags for this family, only
401*2352Sab196087 	 * the selected flags are of interest, so we leave conv_arg.rflags
402*2352Sab196087 	 * set to 0.
403280Srie 	 */
404*2352Sab196087 	conv_arg.oflags = flags;
405*2352Sab196087 	(void) conv_expn_field(&conv_arg);
406280Srie 
4071618Srie 	return ((const char *)string);
408280Srie }
409