xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/dynamic.c (revision 4679:3d9b5e6569cc)
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 /*
233466Srie  * 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 
383492Sab196087 
393492Sab196087 
403492Sab196087 /* Instantiate a local copy of conv_map2str() from _conv.h */
413492Sab196087 DEFINE_conv_map2str
423492Sab196087 
433492Sab196087 
443492Sab196087 
452352Sab196087 #define	POSSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
462352Sab196087 		MSG_DFP_LAZYLOAD_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
472352Sab196087 		MSG_DFP_GROUPPERM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
482352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
490Sstevel@tonic-gate 
500Sstevel@tonic-gate const char *
512352Sab196087 conv_dyn_posflag1(Xword flags, int fmt_flags)
520Sstevel@tonic-gate {
531618Srie 	static char	string[POSSZ];
541618Srie 	static Val_desc vda[] = {
551618Srie 		{ DF_P1_LAZYLOAD,	MSG_ORIG(MSG_DFP_LAZYLOAD) },
561618Srie 		{ DF_P1_GROUPPERM,	MSG_ORIG(MSG_DFP_GROUPPERM) },
571618Srie 		{ 0,			0 }
581618Srie 	};
592352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
602352Sab196087 	static Val_desc vda_alt[] = {
612352Sab196087 		{ DF_P1_LAZYLOAD,	MSG_ORIG(MSG_DFP_LAZYLOAD_ALT) },
622352Sab196087 		{ DF_P1_GROUPPERM,	MSG_ORIG(MSG_DFP_GROUPPERM) },
632352Sab196087 		{ 0,			0 }
642352Sab196087 	};
652352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg_alt = { string, sizeof (string),
662352Sab196087 		vda_alt, NULL, 0, 0, MSG_ORIG(MSG_STR_EMPTY), NULL,
672352Sab196087 		MSG_ORIG(MSG_STR_EMPTY) };
682352Sab196087 
692352Sab196087 	CONV_EXPN_FIELD_ARG *arg;
701618Srie 
710Sstevel@tonic-gate 	if (flags == 0)
720Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
730Sstevel@tonic-gate 
742352Sab196087 	arg = (fmt_flags & CONV_FMT_ALTDUMP) ? &conv_arg_alt : &conv_arg;
752352Sab196087 	arg->oflags = arg->rflags = flags;
762352Sab196087 	(void) conv_expn_field(arg);
770Sstevel@tonic-gate 
780Sstevel@tonic-gate 	return ((const char *)string);
790Sstevel@tonic-gate }
800Sstevel@tonic-gate 
812352Sab196087 #define	FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
822352Sab196087 		MSG_DF_ORIGIN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
832352Sab196087 		MSG_DF_SYMBOLIC_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
842352Sab196087 		MSG_DF_TEXTREL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
852352Sab196087 		MSG_DF_BIND_NOW_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
862352Sab196087 		MSG_DF_STATIC_TLS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
872352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
880Sstevel@tonic-gate 
890Sstevel@tonic-gate const char *
902352Sab196087 conv_dyn_flag(Xword flags, int fmt_flags)
910Sstevel@tonic-gate {
921618Srie 	static char	string[FLAGSZ];
931618Srie 	static Val_desc vda[] = {
941618Srie 		{ DF_ORIGIN,		MSG_ORIG(MSG_DF_ORIGIN) },
951618Srie 		{ DF_SYMBOLIC,		MSG_ORIG(MSG_DF_SYMBOLIC) },
961618Srie 		{ DF_TEXTREL,		MSG_ORIG(MSG_DF_TEXTREL) },
971618Srie 		{ DF_BIND_NOW,		MSG_ORIG(MSG_DF_BIND_NOW) },
981618Srie 		{ DF_STATIC_TLS,	MSG_ORIG(MSG_DF_STATIC_TLS) },
991618Srie 		{ 0,			0 }
1001618Srie 	};
1012352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
1021618Srie 
1030Sstevel@tonic-gate 	if (flags == 0)
1040Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1050Sstevel@tonic-gate 
1062352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
1072352Sab196087 	if (fmt_flags & CONV_FMT_ALTDUMP) {
1082352Sab196087 		conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
1092352Sab196087 	} else {
1102352Sab196087 		conv_arg.prefix = conv_arg.suffix = NULL;
1112352Sab196087 	}
1122352Sab196087 	(void) conv_expn_field(&conv_arg);
1130Sstevel@tonic-gate 
1141618Srie 	return ((const char *)string);
1150Sstevel@tonic-gate }
1160Sstevel@tonic-gate 
1172352Sab196087 #define	FLAG1SZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1182352Sab196087 		MSG_DF1_NOW_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1192352Sab196087 		MSG_DF1_GLOBAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1202352Sab196087 		MSG_DF1_GROUP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1212352Sab196087 		MSG_DF1_NODELETE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1222352Sab196087 		MSG_DF1_LOADFLTR_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1232352Sab196087 		MSG_DF1_INITFIRST_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1242352Sab196087 		MSG_DF1_NOOPEN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1252352Sab196087 		MSG_DF1_ORIGIN_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1262352Sab196087 		MSG_DF1_DIRECT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1272352Sab196087 		MSG_DF1_TRANS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1282352Sab196087 		MSG_DF1_INTERPOSE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1292352Sab196087 		MSG_DF1_NODEFLIB_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1302352Sab196087 		MSG_DF1_NODUMP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1312352Sab196087 		MSG_DF1_CONFALT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1322352Sab196087 		MSG_DF1_ENDFILTEE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1332352Sab196087 		MSG_DF1_DISPRELPND_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1342352Sab196087 		MSG_DF1_DISPRELDNE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1352352Sab196087 		MSG_DF1_NODIRECT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1362352Sab196087 		MSG_DF1_IGNMULDEF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1372352Sab196087 		MSG_DF1_NOKSYMS_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1383466Srie 		MSG_DF1_NOHDR_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1392352Sab196087 		MSG_DF1_NORELOC_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1403466Srie 		MSG_DF1_SYMINTPOSE_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
141*4679Srie 		MSG_DF1_GLOBAUDIT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1422352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1430Sstevel@tonic-gate 
1440Sstevel@tonic-gate const char *
1451618Srie conv_dyn_flag1(Xword flags)
1460Sstevel@tonic-gate {
1471618Srie 	static char	string[FLAG1SZ];
1481618Srie 	static Val_desc vda[] = {
1492352Sab196087 		{ DF_1_NOW,		MSG_ORIG(MSG_DF1_NOW) },
1501618Srie 		{ DF_1_GLOBAL,		MSG_ORIG(MSG_DF1_GLOBAL) },
1511618Srie 		{ DF_1_GROUP,		MSG_ORIG(MSG_DF1_GROUP) },
1521618Srie 		{ DF_1_NODELETE,	MSG_ORIG(MSG_DF1_NODELETE) },
1531618Srie 		{ DF_1_LOADFLTR,	MSG_ORIG(MSG_DF1_LOADFLTR) },
1541618Srie 		{ DF_1_INITFIRST,	MSG_ORIG(MSG_DF1_INITFIRST) },
1551618Srie 		{ DF_1_NOOPEN,		MSG_ORIG(MSG_DF1_NOOPEN) },
1561618Srie 		{ DF_1_ORIGIN,		MSG_ORIG(MSG_DF1_ORIGIN) },
1571618Srie 		{ DF_1_DIRECT,		MSG_ORIG(MSG_DF1_DIRECT) },
1581618Srie 		{ DF_1_TRANS,		MSG_ORIG(MSG_DF1_TRANS) },
1591618Srie 		{ DF_1_INTERPOSE,	MSG_ORIG(MSG_DF1_INTERPOSE) },
1601618Srie 		{ DF_1_NODEFLIB,	MSG_ORIG(MSG_DF1_NODEFLIB) },
1611618Srie 		{ DF_1_NODUMP,		MSG_ORIG(MSG_DF1_NODUMP) },
1621618Srie 		{ DF_1_CONFALT,		MSG_ORIG(MSG_DF1_CONFALT) },
1631618Srie 		{ DF_1_ENDFILTEE,	MSG_ORIG(MSG_DF1_ENDFILTEE) },
1643850Sab196087 		{ DF_1_DISPRELDNE,	MSG_ORIG(MSG_DF1_DISPRELDNE) },
1651618Srie 		{ DF_1_DISPRELPND,	MSG_ORIG(MSG_DF1_DISPRELPND) },
1661618Srie 		{ DF_1_NODIRECT,	MSG_ORIG(MSG_DF1_NODIRECT) },
1671618Srie 		{ DF_1_IGNMULDEF,	MSG_ORIG(MSG_DF1_IGNMULDEF) },
1681618Srie 		{ DF_1_NOKSYMS,		MSG_ORIG(MSG_DF1_NOKSYMS) },
1693466Srie 		{ DF_1_NOHDR,		MSG_ORIG(MSG_DF1_NOHDR) },
1703850Sab196087 		{ DF_1_EDITED,		MSG_ORIG(MSG_DF1_EDITED) },
1711618Srie 		{ DF_1_NORELOC,		MSG_ORIG(MSG_DF1_NORELOC) },
1723466Srie 		{ DF_1_SYMINTPOSE,	MSG_ORIG(MSG_DF1_SYMINTPOSE) },
173*4679Srie 		{ DF_1_GLOBAUDIT,	MSG_ORIG(MSG_DF1_GLOBAUDIT) },
1741618Srie 		{ 0,			0 }
1751618Srie 	};
1762352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
1770Sstevel@tonic-gate 
1780Sstevel@tonic-gate 	if (flags == 0)
1790Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1800Sstevel@tonic-gate 
1812352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
1822352Sab196087 	(void) conv_expn_field(&conv_arg);
1830Sstevel@tonic-gate 
1841618Srie 	return ((const char *)string);
1850Sstevel@tonic-gate }
1860Sstevel@tonic-gate 
1872352Sab196087 #define	FEATSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1882352Sab196087 		MSG_DTF_PARINIT_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1892352Sab196087 		MSG_DTF_CONFEXP_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1902352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate const char *
1932352Sab196087 conv_dyn_feature1(Xword flags, int fmt_flags)
1940Sstevel@tonic-gate {
1951618Srie 	static char	string[FEATSZ];
1961618Srie 	static Val_desc vda[] = {
1971618Srie 		{ DTF_1_PARINIT,	MSG_ORIG(MSG_DTF_PARINIT) },
1981618Srie 		{ DTF_1_CONFEXP,	MSG_ORIG(MSG_DTF_CONFEXP) },
1991618Srie 		{ 0,			0 }
2001618Srie 	};
2012352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
2020Sstevel@tonic-gate 
2030Sstevel@tonic-gate 	if (flags == 0)
2040Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
2050Sstevel@tonic-gate 
2062352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
2072352Sab196087 	if (fmt_flags & CONV_FMT_ALTDUMP) {
2082352Sab196087 		conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
2092352Sab196087 	} else {
2102352Sab196087 		conv_arg.prefix = conv_arg.suffix = NULL;
2112352Sab196087 	}
2122352Sab196087 	(void) conv_expn_field(&conv_arg);
2130Sstevel@tonic-gate 
2141618Srie 	return ((const char *)string);
2150Sstevel@tonic-gate }
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate const char *
2181976Sab196087 conv_dyn_tag(Xword tag, Half mach, int fmt_flags)
2190Sstevel@tonic-gate {
2202850Srie 	static Conv_inv_buf_t	string;
2213492Sab196087 
2223492Sab196087 	/*
2233492Sab196087 	 * Dynamic tag values are sparse, cover a wide range, and have
2243492Sab196087 	 * holes. To handle this efficiently, we fall through a series
2253492Sab196087 	 * of tests below, in increasing tag order, returning at the first
2263492Sab196087 	 * match.
2273492Sab196087 	 *
2283492Sab196087 	 * If we fall all the way to the end, the tag is unknown,
2293492Sab196087 	 * and its numeric value is printed.
2303492Sab196087 	 */
2313492Sab196087 
2323492Sab196087 	/*
2333492Sab196087 	 * Most of the tag values are clustered in contiguous ranges.
2343492Sab196087 	 * Each contiguous range of defined values is handled with
2353492Sab196087 	 * an array that contains the message index corresponding to
2363492Sab196087 	 * each value in that range. The DYN_RANGE macro checks the
2373492Sab196087 	 * tag value against range of values starting at _start_tag.
2383492Sab196087 	 * If there is a match, the index of the appropriate name is
2393492Sab196087 	 * pulled from _array and returned to the caller.
2403492Sab196087 	 */
2413492Sab196087 #define	DYN_RANGE(_start_tag, _array) \
2423492Sab196087 	if ((tag >= _start_tag) && (tag < (_start_tag + ARRAY_NELTS(_array)))) \
2433492Sab196087 		return (MSG_ORIG(_array[tag - _start_tag]));
2443492Sab196087 
2453492Sab196087 
2463492Sab196087 	/*
2473492Sab196087 	 * Generic dynamic tags:
2483492Sab196087 	 *	- Note hole between DT_FLAGS and DT_PREINIT_ARRAY
2493492Sab196087 	 *	- The first range has alternative names for dump,
2503492Sab196087 	 *	  requiring a second array.
2513492Sab196087 	 */
2523492Sab196087 	static const Msg	tags_null[] = {
2531618Srie 		MSG_DYN_NULL,		MSG_DYN_NEEDED,
2541618Srie 		MSG_DYN_PLTRELSZ,	MSG_DYN_PLTGOT,
2551618Srie 		MSG_DYN_HASH,		MSG_DYN_STRTAB,
2561618Srie 		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
2571618Srie 		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
2581618Srie 		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
2591618Srie 		MSG_DYN_INIT,		MSG_DYN_FINI,
2601618Srie 		MSG_DYN_SONAME,		MSG_DYN_RPATH,
2611618Srie 		MSG_DYN_SYMBOLIC,	MSG_DYN_REL,
2621618Srie 		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
2631618Srie 		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
2641618Srie 		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
2651618Srie 		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
2661618Srie 		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
2671618Srie 		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
2683492Sab196087 		MSG_DYN_FLAGS
2691618Srie 	};
2703492Sab196087 	static const Msg	tags_null_alt[] = {
2711976Sab196087 		MSG_DYN_NULL,		MSG_DYN_NEEDED,
2721976Sab196087 		MSG_DYN_PLTRELSZ_ALT,	MSG_DYN_PLTGOT,
2731976Sab196087 		MSG_DYN_HASH,		MSG_DYN_STRTAB,
2741976Sab196087 		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
2751976Sab196087 		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
2761976Sab196087 		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
2771976Sab196087 		MSG_DYN_INIT,		MSG_DYN_FINI,
2781976Sab196087 		MSG_DYN_SONAME,		MSG_DYN_RPATH,
2791976Sab196087 		MSG_DYN_SYMBOLIC_ALT,	MSG_DYN_REL,
2801976Sab196087 		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
2811976Sab196087 		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
2821976Sab196087 		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
2831976Sab196087 		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
2841976Sab196087 		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
2851976Sab196087 		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
2863492Sab196087 		MSG_DYN_FLAGS
2873492Sab196087 	};
2883492Sab196087 	static const Msg	tags_preinit_array[] = {
2891976Sab196087 		MSG_DYN_PREINIT_ARRAY,	MSG_DYN_PREINIT_ARRAYSZ
2901976Sab196087 	};
2910Sstevel@tonic-gate 
2923492Sab196087 	/*
2933850Sab196087 	 * SUNW: DT_LOOS -> DT_HIOS range. Note hole between DT_SUNW_TLSSORTSZ
2943850Sab196087 	 * and DT_SUNW_STRPAD. We handle DT_SUNW_STRPAD as a single value below.
2953492Sab196087 	 */
2963492Sab196087 	static const Msg	tags_sunw_auxiliary[] = {
2973492Sab196087 		MSG_DYN_SUNW_AUXILIARY,	MSG_DYN_SUNW_RTLDINF,
2983492Sab196087 		MSG_DYN_SUNW_FILTER,	MSG_DYN_SUNW_CAP,
2993492Sab196087 		MSG_DYN_SUNW_SYMTAB,	MSG_DYN_SUNW_SYMSZ,
3003731Srie 		MSG_DYN_SUNW_SORTENT,	MSG_DYN_SUNW_SYMSORT,
3013731Srie 		MSG_DYN_SUNW_SYMSORTSZ,	MSG_DYN_SUNW_TLSSORT,
3023731Srie 		MSG_DYN_SUNW_TLSSORTSZ
3033492Sab196087 	};
3040Sstevel@tonic-gate 
3053492Sab196087 	/*
3063492Sab196087 	 * SUNW: DT_VALRNGLO - DT_VALRNGHI range.
3073492Sab196087 	 */
3083492Sab196087 	static const Msg	tags_checksum[] = {
3093492Sab196087 		MSG_DYN_CHECKSUM,	MSG_DYN_PLTPADSZ,
3103492Sab196087 		MSG_DYN_MOVEENT,	MSG_DYN_MOVESZ,
3113492Sab196087 		MSG_DYN_FEATURE_1,	MSG_DYN_POSFLAG_1,
3123492Sab196087 		MSG_DYN_SYMINSZ,	MSG_DYN_SYMINENT
3133492Sab196087 	};
3143492Sab196087 
3153492Sab196087 	/*
3163492Sab196087 	 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
3173492Sab196087 	 */
3183492Sab196087 	static const Msg	tags_config[] = {
3193492Sab196087 		MSG_DYN_CONFIG,		MSG_DYN_DEPAUDIT,
3203492Sab196087 		MSG_DYN_AUDIT,		MSG_DYN_PLTPAD,
3213492Sab196087 		MSG_DYN_MOVETAB,	MSG_DYN_SYMINFO
3223492Sab196087 	};
3230Sstevel@tonic-gate 
3243492Sab196087 	/*
3253492Sab196087 	 * SUNW: generic range. Note hole between DT_VERSYM and DT_RELACOUNT.
3263492Sab196087 	 * We handle DT_VERSYM as a single value below.
3273492Sab196087 	 */
3283492Sab196087 	static const Msg	tags_relacount[] = {
3293492Sab196087 		MSG_DYN_RELACOUNT,	MSG_DYN_RELCOUNT,
3303492Sab196087 		MSG_DYN_FLAGS_1,	MSG_DYN_VERDEF,
3313492Sab196087 		MSG_DYN_VERDEFNUM,	MSG_DYN_VERNEED,
3323492Sab196087 		MSG_DYN_VERNEEDNUM
3333492Sab196087 	};
3343492Sab196087 
3353492Sab196087 	/*
3363492Sab196087 	 * DT_LOPROC - DT_HIPROC range.
3373492Sab196087 	 */
3383492Sab196087 	static const Msg	tags_auxiliary[] = {
3393492Sab196087 		MSG_DYN_AUXILIARY,	MSG_DYN_USED,
3403492Sab196087 		MSG_DYN_FILTER
3413492Sab196087 	};
3423492Sab196087 
3433492Sab196087 
3443492Sab196087 
3450Sstevel@tonic-gate 
3463492Sab196087 	if (tag <= DT_FLAGS)
3473492Sab196087 		return (conv_map2str(string, sizeof (string), tag,
348*4679Srie 		    fmt_flags, ARRAY_NELTS(tags_null), tags_null,
349*4679Srie 		    tags_null_alt, NULL));
3503492Sab196087 	DYN_RANGE(DT_PREINIT_ARRAY, tags_preinit_array);
3513492Sab196087 	DYN_RANGE(DT_SUNW_AUXILIARY, tags_sunw_auxiliary);
3523850Sab196087 	if (tag == DT_SUNW_STRPAD)
3533850Sab196087 		return (MSG_ORIG(MSG_DYN_SUNW_STRPAD));
3543492Sab196087 	DYN_RANGE(DT_CHECKSUM, tags_checksum);
3553492Sab196087 	DYN_RANGE(DT_CONFIG, tags_config);
3563492Sab196087 	if (tag == DT_VERSYM)
3573492Sab196087 		return (MSG_ORIG(MSG_DYN_VERSYM));
3583492Sab196087 	DYN_RANGE(DT_RELACOUNT, tags_relacount);
3593492Sab196087 	DYN_RANGE(DT_AUXILIARY, tags_auxiliary);
3600Sstevel@tonic-gate 
3613492Sab196087 	/*
3623492Sab196087 	 * SUNW: machine specific range.
3633492Sab196087 	 */
3643492Sab196087 	if (((mach == EM_SPARC) || (mach == EM_SPARCV9) ||
3653492Sab196087 	    (mach == EM_SPARC32PLUS)) && (tag == DT_SPARC_REGISTER))
3663492Sab196087 		/* this is so x86 can display a sparc binary */
3673492Sab196087 		return (MSG_ORIG(MSG_DYN_REGISTER));
3683492Sab196087 
3693492Sab196087 	if (tag == DT_DEPRECATED_SPARC_REGISTER)
3703492Sab196087 		return (MSG_ORIG(MSG_DYN_REGISTER));
3713492Sab196087 
3723492Sab196087 	/* Unknown item */
3733492Sab196087 	return (conv_invalid_val(string, CONV_INV_STRSIZE, tag, fmt_flags));
3743492Sab196087 
3753492Sab196087 #undef DYN_RANGE
3760Sstevel@tonic-gate }
377280Srie 
3782352Sab196087 #define	BINDTSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
3792352Sab196087 		MSG_BND_NEEDED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3802352Sab196087 		MSG_BND_REFER_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3812352Sab196087 		MSG_BND_FILTER_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
3822352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
383280Srie 
384280Srie const char *
3851618Srie conv_bnd_type(uint_t flags)
386280Srie {
3871618Srie 	static char	string[BINDTSZ];
3881618Srie 	static Val_desc vda[] = {
3891618Srie 		{ BND_NEEDED,		MSG_ORIG(MSG_BND_NEEDED) },
3901618Srie 		{ BND_REFER,		MSG_ORIG(MSG_BND_REFER) },
3911618Srie 		{ BND_FILTER,		MSG_ORIG(MSG_BND_FILTER) },
3921618Srie 		{ 0,			0 }
3931618Srie 	};
3942352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
395280Srie 
3961618Srie 	if (flags == 0)
3971618Srie 		return (MSG_ORIG(MSG_STR_EMPTY));
398280Srie 
3992352Sab196087 	conv_arg.oflags = conv_arg.rflags = flags;
4002352Sab196087 	(void) conv_expn_field(&conv_arg);
4011618Srie 
4021618Srie 	return ((const char *)string);
403280Srie }
404280Srie 
4051824Srie /*
4061824Srie  * Note, conv_bnd_obj() is called with either:
4071824Srie  *	LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or
4081824Srie  *	LML_FLG_OBJDELETED, or
4091824Srie  *	LML_FLG_ATEXIT.
4101824Srie  */
4112352Sab196087 #define	BINDOSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
4122352Sab196087 		MSG_BND_ADDED_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4132352Sab196087 		MSG_BND_REEVAL_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4142352Sab196087 		CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
415280Srie 
416280Srie const char *
4171618Srie conv_bnd_obj(uint_t flags)
418280Srie {
4191618Srie 	static char	string[BINDOSZ];
4201618Srie 	static Val_desc vda[] = {
4211618Srie 		{ LML_FLG_OBJADDED,	MSG_ORIG(MSG_BND_ADDED) },
4221618Srie 		{ LML_FLG_OBJREEVAL,	MSG_ORIG(MSG_BND_REEVAL) },
4231618Srie 		{ LML_FLG_OBJDELETED,	MSG_ORIG(MSG_BND_DELETED) },
4241618Srie 		{ LML_FLG_ATEXIT,	MSG_ORIG(MSG_BND_ATEXIT) },
4251618Srie 		{ 0,			0 }
4261618Srie 	};
4272352Sab196087 	static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda };
4281618Srie 
4291824Srie 	if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL |
4301824Srie 	    LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0)
4311824Srie 		return (MSG_ORIG(MSG_BND_REVISIT));
432280Srie 
433280Srie 	/*
4341618Srie 	 * Note, we're not worried about unknown flags for this family, only
4352352Sab196087 	 * the selected flags are of interest, so we leave conv_arg.rflags
4362352Sab196087 	 * set to 0.
437280Srie 	 */
4382352Sab196087 	conv_arg.oflags = flags;
4392352Sab196087 	(void) conv_expn_field(&conv_arg);
440280Srie 
4411618Srie 	return ((const char *)string);
442280Srie }
443