xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/dynamic.c (revision 3466:4cc6ca6917b5)
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 /*
23*3466Srie  * Copyright 2007 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 
382352Sab196087 #define	POSSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
392352Sab196087 		MSG_DFP_LAZYLOAD_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
402352Sab196087 		MSG_DFP_GROUPPERM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
412352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
420Sstevel@tonic-gate 
430Sstevel@tonic-gate const char *
442352Sab196087 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 	};
522352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
532352Sab196087 	static Val_desc vda_alt[] = {
542352Sab196087 		{ DF_P1_LAZYLOAD,	MSG_ORIG(MSG_DFP_LAZYLOAD_ALT) },
552352Sab196087 		{ DF_P1_GROUPPERM,	MSG_ORIG(MSG_DFP_GROUPPERM) },
562352Sab196087 		{ 0,			0 }
572352Sab196087 	};
582352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg_alt = { string, sizeof (string),
592352Sab196087 		vda_alt, NULL, 0, 0, MSG_ORIG(MSG_STR_EMPTY), NULL,
602352Sab196087 		MSG_ORIG(MSG_STR_EMPTY) };
612352Sab196087 
622352Sab196087 	CONV_EXPN_FIELD_ARG *arg;
631618Srie 
640Sstevel@tonic-gate 	if (flags == 0)
650Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
660Sstevel@tonic-gate 
672352Sab196087 	arg = (fmt_flags & CONV_FMT_ALTDUMP) ? &conv_arg_alt : &conv_arg;
682352Sab196087 	arg->oflags = arg->rflags = flags;
692352Sab196087 	(void) conv_expn_field(arg);
700Sstevel@tonic-gate 
710Sstevel@tonic-gate 	return ((const char *)string);
720Sstevel@tonic-gate }
730Sstevel@tonic-gate 
742352Sab196087 #define	FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
752352Sab196087 		MSG_DF_ORIGIN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
762352Sab196087 		MSG_DF_SYMBOLIC_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
772352Sab196087 		MSG_DF_TEXTREL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
782352Sab196087 		MSG_DF_BIND_NOW_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
792352Sab196087 		MSG_DF_STATIC_TLS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
802352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
810Sstevel@tonic-gate 
820Sstevel@tonic-gate const char *
832352Sab196087 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 	};
942352Sab196087 	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 
992352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
1002352Sab196087 	if (fmt_flags & CONV_FMT_ALTDUMP) {
1012352Sab196087 		conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
1022352Sab196087 	} else {
1032352Sab196087 		conv_arg.prefix = conv_arg.suffix = NULL;
1042352Sab196087 	}
1052352Sab196087 	(void) conv_expn_field(&conv_arg);
1060Sstevel@tonic-gate 
1071618Srie 	return ((const char *)string);
1080Sstevel@tonic-gate }
1090Sstevel@tonic-gate 
1102352Sab196087 #define	FLAG1SZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1112352Sab196087 		MSG_DF1_NOW_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1122352Sab196087 		MSG_DF1_GLOBAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1132352Sab196087 		MSG_DF1_GROUP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1142352Sab196087 		MSG_DF1_NODELETE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1152352Sab196087 		MSG_DF1_LOADFLTR_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1162352Sab196087 		MSG_DF1_INITFIRST_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1172352Sab196087 		MSG_DF1_NOOPEN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1182352Sab196087 		MSG_DF1_ORIGIN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1192352Sab196087 		MSG_DF1_DIRECT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1202352Sab196087 		MSG_DF1_TRANS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1212352Sab196087 		MSG_DF1_INTERPOSE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1222352Sab196087 		MSG_DF1_NODEFLIB_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1232352Sab196087 		MSG_DF1_NODUMP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1242352Sab196087 		MSG_DF1_CONFALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1252352Sab196087 		MSG_DF1_ENDFILTEE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1262352Sab196087 		MSG_DF1_DISPRELPND_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1272352Sab196087 		MSG_DF1_DISPRELDNE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1282352Sab196087 		MSG_DF1_NODIRECT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1292352Sab196087 		MSG_DF1_IGNMULDEF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1302352Sab196087 		MSG_DF1_NOKSYMS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
131*3466Srie 		MSG_DF1_NOHDR_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1322352Sab196087 		MSG_DF1_NORELOC_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
133*3466Srie 		MSG_DF1_SYMINTPOSE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1342352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate const char *
1371618Srie conv_dyn_flag1(Xword flags)
1380Sstevel@tonic-gate {
1391618Srie 	static char	string[FLAG1SZ];
1401618Srie 	static Val_desc vda[] = {
1412352Sab196087 		{ DF_1_NOW,		MSG_ORIG(MSG_DF1_NOW) },
1421618Srie 		{ DF_1_GLOBAL,		MSG_ORIG(MSG_DF1_GLOBAL) },
1431618Srie 		{ DF_1_GROUP,		MSG_ORIG(MSG_DF1_GROUP) },
1441618Srie 		{ DF_1_NODELETE,	MSG_ORIG(MSG_DF1_NODELETE) },
1451618Srie 		{ DF_1_LOADFLTR,	MSG_ORIG(MSG_DF1_LOADFLTR) },
1461618Srie 		{ DF_1_INITFIRST,	MSG_ORIG(MSG_DF1_INITFIRST) },
1471618Srie 		{ DF_1_NOOPEN,		MSG_ORIG(MSG_DF1_NOOPEN) },
1481618Srie 		{ DF_1_ORIGIN,		MSG_ORIG(MSG_DF1_ORIGIN) },
1491618Srie 		{ DF_1_DIRECT,		MSG_ORIG(MSG_DF1_DIRECT) },
1501618Srie 		{ DF_1_TRANS,		MSG_ORIG(MSG_DF1_TRANS) },
1511618Srie 		{ DF_1_INTERPOSE,	MSG_ORIG(MSG_DF1_INTERPOSE) },
1521618Srie 		{ DF_1_NODEFLIB,	MSG_ORIG(MSG_DF1_NODEFLIB) },
1531618Srie 		{ DF_1_NODUMP,		MSG_ORIG(MSG_DF1_NODUMP) },
1541618Srie 		{ DF_1_CONFALT,		MSG_ORIG(MSG_DF1_CONFALT) },
1551618Srie 		{ DF_1_ENDFILTEE,	MSG_ORIG(MSG_DF1_ENDFILTEE) },
1561618Srie 		{ DF_1_DISPRELPND,	MSG_ORIG(MSG_DF1_DISPRELPND) },
1571618Srie 		{ DF_1_DISPRELDNE,	MSG_ORIG(MSG_DF1_DISPRELDNE) },
1581618Srie 		{ DF_1_NODIRECT,	MSG_ORIG(MSG_DF1_NODIRECT) },
1591618Srie 		{ DF_1_IGNMULDEF,	MSG_ORIG(MSG_DF1_IGNMULDEF) },
1601618Srie 		{ DF_1_NOKSYMS,		MSG_ORIG(MSG_DF1_NOKSYMS) },
161*3466Srie 		{ DF_1_NOHDR,		MSG_ORIG(MSG_DF1_NOHDR) },
1621618Srie 		{ DF_1_NORELOC,		MSG_ORIG(MSG_DF1_NORELOC) },
163*3466Srie 		{ DF_1_SYMINTPOSE,	MSG_ORIG(MSG_DF1_SYMINTPOSE) },
1641618Srie 		{ 0,			0 }
1651618Srie 	};
1662352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
1670Sstevel@tonic-gate 
1680Sstevel@tonic-gate 	if (flags == 0)
1690Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1700Sstevel@tonic-gate 
1712352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
1722352Sab196087 	(void) conv_expn_field(&conv_arg);
1730Sstevel@tonic-gate 
1741618Srie 	return ((const char *)string);
1750Sstevel@tonic-gate }
1760Sstevel@tonic-gate 
1772352Sab196087 #define	FEATSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1782352Sab196087 		MSG_DTF_PARINIT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1792352Sab196087 		MSG_DTF_CONFEXP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1802352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate const char *
1832352Sab196087 conv_dyn_feature1(Xword flags, int fmt_flags)
1840Sstevel@tonic-gate {
1851618Srie 	static char	string[FEATSZ];
1861618Srie 	static Val_desc vda[] = {
1871618Srie 		{ DTF_1_PARINIT,	MSG_ORIG(MSG_DTF_PARINIT) },
1881618Srie 		{ DTF_1_CONFEXP,	MSG_ORIG(MSG_DTF_CONFEXP) },
1891618Srie 		{ 0,			0 }
1901618Srie 	};
1912352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
1920Sstevel@tonic-gate 
1930Sstevel@tonic-gate 	if (flags == 0)
1940Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1950Sstevel@tonic-gate 
1962352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
1972352Sab196087 	if (fmt_flags & CONV_FMT_ALTDUMP) {
1982352Sab196087 		conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
1992352Sab196087 	} else {
2002352Sab196087 		conv_arg.prefix = conv_arg.suffix = NULL;
2012352Sab196087 	}
2022352Sab196087 	(void) conv_expn_field(&conv_arg);
2030Sstevel@tonic-gate 
2041618Srie 	return ((const char *)string);
2050Sstevel@tonic-gate }
2060Sstevel@tonic-gate 
2070Sstevel@tonic-gate const char *
2081976Sab196087 conv_dyn_tag(Xword tag, Half mach, int fmt_flags)
2090Sstevel@tonic-gate {
2102850Srie 	static Conv_inv_buf_t	string;
2111618Srie 	static const Msg	tags[DT_MAXPOSTAGS] = {
2121618Srie 		MSG_DYN_NULL,		MSG_DYN_NEEDED,
2131618Srie 		MSG_DYN_PLTRELSZ,	MSG_DYN_PLTGOT,
2141618Srie 		MSG_DYN_HASH,		MSG_DYN_STRTAB,
2151618Srie 		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
2161618Srie 		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
2171618Srie 		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
2181618Srie 		MSG_DYN_INIT,		MSG_DYN_FINI,
2191618Srie 		MSG_DYN_SONAME,		MSG_DYN_RPATH,
2201618Srie 		MSG_DYN_SYMBOLIC,	MSG_DYN_REL,
2211618Srie 		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
2221618Srie 		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
2231618Srie 		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
2241618Srie 		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
2251618Srie 		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
2261618Srie 		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
2271618Srie 		MSG_DYN_FLAGS,		MSG_DYN_NULL,
2281618Srie 		MSG_DYN_PREINIT_ARRAY,	MSG_DYN_PREINIT_ARRAYSZ
2291618Srie 	};
2301976Sab196087 	static const Msg	tags_alt[DT_MAXPOSTAGS] = {
2311976Sab196087 		MSG_DYN_NULL,		MSG_DYN_NEEDED,
2321976Sab196087 		MSG_DYN_PLTRELSZ_ALT,	MSG_DYN_PLTGOT,
2331976Sab196087 		MSG_DYN_HASH,		MSG_DYN_STRTAB,
2341976Sab196087 		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
2351976Sab196087 		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
2361976Sab196087 		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
2371976Sab196087 		MSG_DYN_INIT,		MSG_DYN_FINI,
2381976Sab196087 		MSG_DYN_SONAME,		MSG_DYN_RPATH,
2391976Sab196087 		MSG_DYN_SYMBOLIC_ALT,	MSG_DYN_REL,
2401976Sab196087 		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
2411976Sab196087 		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
2421976Sab196087 		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
2431976Sab196087 		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
2441976Sab196087 		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
2451976Sab196087 		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
2461976Sab196087 		MSG_DYN_FLAGS,		MSG_DYN_NULL,
2471976Sab196087 		MSG_DYN_PREINIT_ARRAY,	MSG_DYN_PREINIT_ARRAYSZ
2481976Sab196087 	};
2490Sstevel@tonic-gate 
2500Sstevel@tonic-gate 	if (tag < DT_MAXPOSTAGS) {
2510Sstevel@tonic-gate 		/*
2520Sstevel@tonic-gate 		 * Generic dynamic tags.
2530Sstevel@tonic-gate 		 */
2541976Sab196087 		return ((fmt_flags & CONV_FMTALTMASK)
2551976Sab196087 			? MSG_ORIG(tags_alt[tag]) : MSG_ORIG(tags[tag]));
2560Sstevel@tonic-gate 	} else {
2570Sstevel@tonic-gate 		/*
2580Sstevel@tonic-gate 		 * SUNW: DT_LOOS -> DT_HIOS range.
2590Sstevel@tonic-gate 		 */
2600Sstevel@tonic-gate 		if (tag == DT_SUNW_AUXILIARY)
2610Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_AUXILIARY));
2620Sstevel@tonic-gate 		else if (tag == DT_SUNW_RTLDINF)
2630Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_RTLDINF));
2640Sstevel@tonic-gate 		else if (tag == DT_SUNW_FILTER)
2650Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_FILTER));
2660Sstevel@tonic-gate 		else if (tag == DT_SUNW_CAP)
2670Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_CAP));
2682766Sab196087 		else if (tag == DT_SUNW_SYMTAB)
2692766Sab196087 			return (MSG_ORIG(MSG_DYN_SUNW_SYMTAB));
2702766Sab196087 		else if (tag == DT_SUNW_SYMSZ)
2712766Sab196087 			return (MSG_ORIG(MSG_DYN_SUNW_SYMSZ));
2720Sstevel@tonic-gate 
2730Sstevel@tonic-gate 		/*
2740Sstevel@tonic-gate 		 * SUNW: DT_VALRNGLO - DT_VALRNGHI range.
2750Sstevel@tonic-gate 		 */
2760Sstevel@tonic-gate 		else if (tag == DT_CHECKSUM)
2770Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CHECKSUM));
2780Sstevel@tonic-gate 		else if (tag == DT_PLTPADSZ)
2790Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPADSZ));
2800Sstevel@tonic-gate 		else if (tag == DT_MOVEENT)
2810Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVEENT));
2820Sstevel@tonic-gate 		else if (tag == DT_MOVESZ)
2830Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVESZ));
2840Sstevel@tonic-gate 		else if (tag == DT_FEATURE_1)
2850Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FEATURE_1));
2860Sstevel@tonic-gate 		else if (tag == DT_POSFLAG_1)
2870Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_POSFLAG_1));
2880Sstevel@tonic-gate 		else if (tag == DT_SYMINSZ)
2890Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINSZ));
2900Sstevel@tonic-gate 		else if (tag == DT_SYMINENT)
2910Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINENT));
2920Sstevel@tonic-gate 
2930Sstevel@tonic-gate 		/*
2940Sstevel@tonic-gate 		 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
2950Sstevel@tonic-gate 		 */
2960Sstevel@tonic-gate 		else if (tag == DT_CONFIG)
2970Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CONFIG));
2980Sstevel@tonic-gate 		else if (tag == DT_DEPAUDIT)
2990Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_DEPAUDIT));
3000Sstevel@tonic-gate 		else if (tag == DT_AUDIT)
3010Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUDIT));
3020Sstevel@tonic-gate 		else if (tag == DT_PLTPAD)
3030Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPAD));
3040Sstevel@tonic-gate 		else if (tag == DT_MOVETAB)
3050Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVETAB));
3060Sstevel@tonic-gate 		else if (tag == DT_SYMINFO)
3070Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINFO));
3080Sstevel@tonic-gate 
3090Sstevel@tonic-gate 		/*
3100Sstevel@tonic-gate 		 * SUNW: generic range.
3110Sstevel@tonic-gate 		 */
3120Sstevel@tonic-gate 		else if (tag == DT_VERSYM)
3130Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERSYM));
3140Sstevel@tonic-gate 		else if (tag == DT_RELACOUNT)
3150Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELACOUNT));
3160Sstevel@tonic-gate 		else if (tag == DT_RELCOUNT)
3170Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELCOUNT));
3180Sstevel@tonic-gate 		else if (tag == DT_FLAGS_1)
3190Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FLAGS_1));
3200Sstevel@tonic-gate 		else if (tag == DT_VERDEF)
3210Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEF));
3220Sstevel@tonic-gate 		else if (tag == DT_VERDEFNUM)
3230Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEFNUM));
3240Sstevel@tonic-gate 		else if (tag == DT_VERNEED)
3250Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEED));
3260Sstevel@tonic-gate 		else if (tag == DT_VERNEEDNUM)
3270Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEEDNUM));
3280Sstevel@tonic-gate 		else if (tag == DT_AUXILIARY)
3290Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUXILIARY));
3300Sstevel@tonic-gate 		else if (tag == DT_USED)
3310Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_USED));
3320Sstevel@tonic-gate 		else if (tag == DT_FILTER)
3330Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FILTER));
3340Sstevel@tonic-gate 
3350Sstevel@tonic-gate 		/*
3360Sstevel@tonic-gate 		 * SUNW: machine specific range.
3370Sstevel@tonic-gate 		 */
3380Sstevel@tonic-gate 		else if (((mach == EM_SPARC) || (mach == EM_SPARCV9) ||
3390Sstevel@tonic-gate 		    (mach == EM_SPARC32PLUS)) && (tag == DT_SPARC_REGISTER))
3400Sstevel@tonic-gate 			/* this is so x86 can display a sparc binary */
3410Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
3420Sstevel@tonic-gate 		else if (tag == DT_DEPRECATED_SPARC_REGISTER)
3430Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
3440Sstevel@tonic-gate 		else
3451618Srie 			return (conv_invalid_val(string, CONV_INV_STRSIZE,
3461976Sab196087 			    tag, fmt_flags));
3470Sstevel@tonic-gate 	}
3480Sstevel@tonic-gate }
349280Srie 
3502352Sab196087 #define	BINDTSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
3512352Sab196087 		MSG_BND_NEEDED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3522352Sab196087 		MSG_BND_REFER_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3532352Sab196087 		MSG_BND_FILTER_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3542352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
355280Srie 
356280Srie const char *
3571618Srie conv_bnd_type(uint_t flags)
358280Srie {
3591618Srie 	static char	string[BINDTSZ];
3601618Srie 	static Val_desc vda[] = {
3611618Srie 		{ BND_NEEDED,		MSG_ORIG(MSG_BND_NEEDED) },
3621618Srie 		{ BND_REFER,		MSG_ORIG(MSG_BND_REFER) },
3631618Srie 		{ BND_FILTER,		MSG_ORIG(MSG_BND_FILTER) },
3641618Srie 		{ 0,			0 }
3651618Srie 	};
3662352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
367280Srie 
3681618Srie 	if (flags == 0)
3691618Srie 		return (MSG_ORIG(MSG_STR_EMPTY));
370280Srie 
3712352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
3722352Sab196087 	(void) conv_expn_field(&conv_arg);
3731618Srie 
3741618Srie 	return ((const char *)string);
375280Srie }
376280Srie 
3771824Srie /*
3781824Srie  * Note, conv_bnd_obj() is called with either:
3791824Srie  *	LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or
3801824Srie  *	LML_FLG_OBJDELETED, or
3811824Srie  *	LML_FLG_ATEXIT.
3821824Srie  */
3832352Sab196087 #define	BINDOSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
3842352Sab196087 		MSG_BND_ADDED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3852352Sab196087 		MSG_BND_REEVAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3862352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
387280Srie 
388280Srie const char *
3891618Srie conv_bnd_obj(uint_t flags)
390280Srie {
3911618Srie 	static char	string[BINDOSZ];
3921618Srie 	static Val_desc vda[] = {
3931618Srie 		{ LML_FLG_OBJADDED,	MSG_ORIG(MSG_BND_ADDED) },
3941618Srie 		{ LML_FLG_OBJREEVAL,	MSG_ORIG(MSG_BND_REEVAL) },
3951618Srie 		{ LML_FLG_OBJDELETED,	MSG_ORIG(MSG_BND_DELETED) },
3961618Srie 		{ LML_FLG_ATEXIT,	MSG_ORIG(MSG_BND_ATEXIT) },
3971618Srie 		{ 0,			0 }
3981618Srie 	};
3992352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
4001618Srie 
4011824Srie 	if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL |
4021824Srie 	    LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0)
4031824Srie 		return (MSG_ORIG(MSG_BND_REVISIT));
404280Srie 
405280Srie 	/*
4061618Srie 	 * Note, we're not worried about unknown flags for this family, only
4072352Sab196087 	 * the selected flags are of interest, so we leave conv_arg.rflags
4082352Sab196087 	 * set to 0.
409280Srie 	 */
4102352Sab196087 	conv_arg.oflags = flags;
4112352Sab196087 	(void) conv_expn_field(&conv_arg);
412280Srie 
4131618Srie 	return ((const char *)string);
414280Srie }
415