xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/dynamic.c (revision 2766:897bcb036a29)
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 
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 + \
1312352Sab196087 		MSG_DF1_NORELOC_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1322352Sab196087 		MSG_DF1_NOHDR_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1332352Sab196087 		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[] = {
1402352Sab196087 		{ 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 	};
1642352Sab196087 	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 
1692352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
1702352Sab196087 	(void) conv_expn_field(&conv_arg);
1710Sstevel@tonic-gate 
1721618Srie 	return ((const char *)string);
1730Sstevel@tonic-gate }
1740Sstevel@tonic-gate 
1752352Sab196087 #define	FEATSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1762352Sab196087 		MSG_DTF_PARINIT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1772352Sab196087 		MSG_DTF_CONFEXP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1782352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1790Sstevel@tonic-gate 
1800Sstevel@tonic-gate const char *
1812352Sab196087 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 	};
1892352Sab196087 	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 
1942352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
1952352Sab196087 	if (fmt_flags & CONV_FMT_ALTDUMP) {
1962352Sab196087 		conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
1972352Sab196087 	} else {
1982352Sab196087 		conv_arg.prefix = conv_arg.suffix = NULL;
1992352Sab196087 	}
2002352Sab196087 	(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));
266*2766Sab196087 		else if (tag == DT_SUNW_SYMTAB)
267*2766Sab196087 			return (MSG_ORIG(MSG_DYN_SUNW_SYMTAB));
268*2766Sab196087 		else if (tag == DT_SUNW_SYMSZ)
269*2766Sab196087 			return (MSG_ORIG(MSG_DYN_SUNW_SYMSZ));
2700Sstevel@tonic-gate 
2710Sstevel@tonic-gate 		/*
2720Sstevel@tonic-gate 		 * SUNW: DT_VALRNGLO - DT_VALRNGHI range.
2730Sstevel@tonic-gate 		 */
2740Sstevel@tonic-gate 		else if (tag == DT_CHECKSUM)
2750Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CHECKSUM));
2760Sstevel@tonic-gate 		else if (tag == DT_PLTPADSZ)
2770Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPADSZ));
2780Sstevel@tonic-gate 		else if (tag == DT_MOVEENT)
2790Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVEENT));
2800Sstevel@tonic-gate 		else if (tag == DT_MOVESZ)
2810Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVESZ));
2820Sstevel@tonic-gate 		else if (tag == DT_FEATURE_1)
2830Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FEATURE_1));
2840Sstevel@tonic-gate 		else if (tag == DT_POSFLAG_1)
2850Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_POSFLAG_1));
2860Sstevel@tonic-gate 		else if (tag == DT_SYMINSZ)
2870Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINSZ));
2880Sstevel@tonic-gate 		else if (tag == DT_SYMINENT)
2890Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINENT));
2900Sstevel@tonic-gate 
2910Sstevel@tonic-gate 		/*
2920Sstevel@tonic-gate 		 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
2930Sstevel@tonic-gate 		 */
2940Sstevel@tonic-gate 		else if (tag == DT_CONFIG)
2950Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CONFIG));
2960Sstevel@tonic-gate 		else if (tag == DT_DEPAUDIT)
2970Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_DEPAUDIT));
2980Sstevel@tonic-gate 		else if (tag == DT_AUDIT)
2990Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUDIT));
3000Sstevel@tonic-gate 		else if (tag == DT_PLTPAD)
3010Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPAD));
3020Sstevel@tonic-gate 		else if (tag == DT_MOVETAB)
3030Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVETAB));
3040Sstevel@tonic-gate 		else if (tag == DT_SYMINFO)
3050Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINFO));
3060Sstevel@tonic-gate 
3070Sstevel@tonic-gate 		/*
3080Sstevel@tonic-gate 		 * SUNW: generic range.
3090Sstevel@tonic-gate 		 */
3100Sstevel@tonic-gate 		else if (tag == DT_VERSYM)
3110Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERSYM));
3120Sstevel@tonic-gate 		else if (tag == DT_RELACOUNT)
3130Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELACOUNT));
3140Sstevel@tonic-gate 		else if (tag == DT_RELCOUNT)
3150Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELCOUNT));
3160Sstevel@tonic-gate 		else if (tag == DT_FLAGS_1)
3170Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FLAGS_1));
3180Sstevel@tonic-gate 		else if (tag == DT_VERDEF)
3190Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEF));
3200Sstevel@tonic-gate 		else if (tag == DT_VERDEFNUM)
3210Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEFNUM));
3220Sstevel@tonic-gate 		else if (tag == DT_VERNEED)
3230Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEED));
3240Sstevel@tonic-gate 		else if (tag == DT_VERNEEDNUM)
3250Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEEDNUM));
3260Sstevel@tonic-gate 		else if (tag == DT_AUXILIARY)
3270Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUXILIARY));
3280Sstevel@tonic-gate 		else if (tag == DT_USED)
3290Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_USED));
3300Sstevel@tonic-gate 		else if (tag == DT_FILTER)
3310Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FILTER));
3320Sstevel@tonic-gate 
3330Sstevel@tonic-gate 		/*
3340Sstevel@tonic-gate 		 * SUNW: machine specific range.
3350Sstevel@tonic-gate 		 */
3360Sstevel@tonic-gate 		else if (((mach == EM_SPARC) || (mach == EM_SPARCV9) ||
3370Sstevel@tonic-gate 		    (mach == EM_SPARC32PLUS)) && (tag == DT_SPARC_REGISTER))
3380Sstevel@tonic-gate 			/* this is so x86 can display a sparc binary */
3390Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
3400Sstevel@tonic-gate 		else if (tag == DT_DEPRECATED_SPARC_REGISTER)
3410Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
3420Sstevel@tonic-gate 		else
3431618Srie 			return (conv_invalid_val(string, CONV_INV_STRSIZE,
3441976Sab196087 			    tag, fmt_flags));
3450Sstevel@tonic-gate 	}
3460Sstevel@tonic-gate }
347280Srie 
3482352Sab196087 #define	BINDTSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
3492352Sab196087 		MSG_BND_NEEDED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3502352Sab196087 		MSG_BND_REFER_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3512352Sab196087 		MSG_BND_FILTER_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3522352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
353280Srie 
354280Srie const char *
3551618Srie conv_bnd_type(uint_t flags)
356280Srie {
3571618Srie 	static char	string[BINDTSZ];
3581618Srie 	static Val_desc vda[] = {
3591618Srie 		{ BND_NEEDED,		MSG_ORIG(MSG_BND_NEEDED) },
3601618Srie 		{ BND_REFER,		MSG_ORIG(MSG_BND_REFER) },
3611618Srie 		{ BND_FILTER,		MSG_ORIG(MSG_BND_FILTER) },
3621618Srie 		{ 0,			0 }
3631618Srie 	};
3642352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
365280Srie 
3661618Srie 	if (flags == 0)
3671618Srie 		return (MSG_ORIG(MSG_STR_EMPTY));
368280Srie 
3692352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
3702352Sab196087 	(void) conv_expn_field(&conv_arg);
3711618Srie 
3721618Srie 	return ((const char *)string);
373280Srie }
374280Srie 
3751824Srie /*
3761824Srie  * Note, conv_bnd_obj() is called with either:
3771824Srie  *	LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or
3781824Srie  *	LML_FLG_OBJDELETED, or
3791824Srie  *	LML_FLG_ATEXIT.
3801824Srie  */
3812352Sab196087 #define	BINDOSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
3822352Sab196087 		MSG_BND_ADDED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3832352Sab196087 		MSG_BND_REEVAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3842352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
385280Srie 
386280Srie const char *
3871618Srie conv_bnd_obj(uint_t flags)
388280Srie {
3891618Srie 	static char	string[BINDOSZ];
3901618Srie 	static Val_desc vda[] = {
3911618Srie 		{ LML_FLG_OBJADDED,	MSG_ORIG(MSG_BND_ADDED) },
3921618Srie 		{ LML_FLG_OBJREEVAL,	MSG_ORIG(MSG_BND_REEVAL) },
3931618Srie 		{ LML_FLG_OBJDELETED,	MSG_ORIG(MSG_BND_DELETED) },
3941618Srie 		{ LML_FLG_ATEXIT,	MSG_ORIG(MSG_BND_ATEXIT) },
3951618Srie 		{ 0,			0 }
3961618Srie 	};
3972352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
3981618Srie 
3991824Srie 	if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL |
4001824Srie 	    LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0)
4011824Srie 		return (MSG_ORIG(MSG_BND_REVISIT));
402280Srie 
403280Srie 	/*
4041618Srie 	 * Note, we're not worried about unknown flags for this family, only
4052352Sab196087 	 * the selected flags are of interest, so we leave conv_arg.rflags
4062352Sab196087 	 * set to 0.
407280Srie 	 */
4082352Sab196087 	conv_arg.oflags = flags;
4092352Sab196087 	(void) conv_expn_field(&conv_arg);
410280Srie 
4111618Srie 	return ((const char *)string);
412280Srie }
413