17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
55aefb655Srie  * Common Development and Distribution License (the "License").
65aefb655Srie  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
215aefb655Srie 
227c478bd9Sstevel@tonic-gate /*
235aefb655Srie  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate  * String conversion routine for .dynamic tag entries.
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate #include	<stdio.h>
327c478bd9Sstevel@tonic-gate #include	<string.h>
337c478bd9Sstevel@tonic-gate #include	<sys/elf_SPARC.h>
34dffec89cSrie #include	"rtld.h"
357c478bd9Sstevel@tonic-gate #include	"_conv.h"
367c478bd9Sstevel@tonic-gate #include	"dynamic_msg.h"
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #define	POSSZ	MSG_GBL_OSQBRKT_SIZE + \
397c478bd9Sstevel@tonic-gate 		MSG_DFP_LAZYLOAD_SIZE + \
407c478bd9Sstevel@tonic-gate 		MSG_DFP_GROUPPERM_SIZE + \
415aefb655Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate const char *
445aefb655Srie conv_dyn_posflag1(Xword flags)
457c478bd9Sstevel@tonic-gate {
465aefb655Srie 	static char	string[POSSZ];
475aefb655Srie 	static Val_desc vda[] = {
485aefb655Srie 		{ DF_P1_LAZYLOAD,	MSG_ORIG(MSG_DFP_LAZYLOAD) },
495aefb655Srie 		{ DF_P1_GROUPPERM,	MSG_ORIG(MSG_DFP_GROUPPERM) },
505aefb655Srie 		{ 0,			0 }
515aefb655Srie 	};
525aefb655Srie 
537c478bd9Sstevel@tonic-gate 	if (flags == 0)
547c478bd9Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
557c478bd9Sstevel@tonic-gate 
565aefb655Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), POSSZ);
575aefb655Srie 	if (conv_expn_field(string, POSSZ, vda, flags, flags, 0, 0))
585aefb655Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), POSSZ);
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate 	return ((const char *)string);
617c478bd9Sstevel@tonic-gate }
627c478bd9Sstevel@tonic-gate 
635aefb655Srie #define	FLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
645aefb655Srie 		MSG_DF_ORIGIN_SIZE + \
657c478bd9Sstevel@tonic-gate 		MSG_DF_SYMBOLIC_SIZE + \
667c478bd9Sstevel@tonic-gate 		MSG_DF_TEXTREL_SIZE + \
677c478bd9Sstevel@tonic-gate 		MSG_DF_BIND_NOW_SIZE + \
685aefb655Srie 		MSG_DF_STATIC_TLS_SIZE + \
695aefb655Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate const char *
725aefb655Srie conv_dyn_flag(Xword flags)
737c478bd9Sstevel@tonic-gate {
745aefb655Srie 	static char	string[FLAGSZ];
755aefb655Srie 	static Val_desc vda[] = {
765aefb655Srie 		{ DF_ORIGIN,		MSG_ORIG(MSG_DF_ORIGIN) },
775aefb655Srie 		{ DF_SYMBOLIC,		MSG_ORIG(MSG_DF_SYMBOLIC) },
785aefb655Srie 		{ DF_TEXTREL,		MSG_ORIG(MSG_DF_TEXTREL) },
795aefb655Srie 		{ DF_BIND_NOW,		MSG_ORIG(MSG_DF_BIND_NOW) },
805aefb655Srie 		{ DF_STATIC_TLS,	MSG_ORIG(MSG_DF_STATIC_TLS) },
815aefb655Srie 		{ 0,			0 }
825aefb655Srie 	};
835aefb655Srie 
847c478bd9Sstevel@tonic-gate 	if (flags == 0)
857c478bd9Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
865aefb655Srie 
875aefb655Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ);
885aefb655Srie 	if (conv_expn_field(string, FLAGSZ, vda, flags, flags, 0, 0))
895aefb655Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
905aefb655Srie 
915aefb655Srie 	return ((const char *)string);
927c478bd9Sstevel@tonic-gate }
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #define	FLAG1SZ	MSG_GBL_OSQBRKT_SIZE + \
957c478bd9Sstevel@tonic-gate 		MSG_DF1_NOW_SIZE + \
965aefb655Srie 		MSG_DF1_GLOBAL_SIZE + \
977c478bd9Sstevel@tonic-gate 		MSG_DF1_GROUP_SIZE + \
987c478bd9Sstevel@tonic-gate 		MSG_DF1_NODELETE_SIZE + \
997c478bd9Sstevel@tonic-gate 		MSG_DF1_LOADFLTR_SIZE + \
1007c478bd9Sstevel@tonic-gate 		MSG_DF1_INITFIRST_SIZE + \
1017c478bd9Sstevel@tonic-gate 		MSG_DF1_NOOPEN_SIZE + \
1027c478bd9Sstevel@tonic-gate 		MSG_DF1_ORIGIN_SIZE + \
1037c478bd9Sstevel@tonic-gate 		MSG_DF1_DIRECT_SIZE + \
1047c478bd9Sstevel@tonic-gate 		MSG_DF1_TRANS_SIZE + \
1057c478bd9Sstevel@tonic-gate 		MSG_DF1_INTERPOSE_SIZE + \
1067c478bd9Sstevel@tonic-gate 		MSG_DF1_NODEFLIB_SIZE + \
1077c478bd9Sstevel@tonic-gate 		MSG_DF1_NODUMP_SIZE + \
1087c478bd9Sstevel@tonic-gate 		MSG_DF1_CONFALT_SIZE + \
1097c478bd9Sstevel@tonic-gate 		MSG_DF1_ENDFILTEE_SIZE + \
1107c478bd9Sstevel@tonic-gate 		MSG_DF1_DISPRELPND_SIZE + \
1117c478bd9Sstevel@tonic-gate 		MSG_DF1_DISPRELDNE_SIZE + \
1127c478bd9Sstevel@tonic-gate 		MSG_DF1_NODIRECT_SIZE + \
1137c478bd9Sstevel@tonic-gate 		MSG_DF1_IGNMULDEF_SIZE + \
1147c478bd9Sstevel@tonic-gate 		MSG_DF1_NOKSYMS_SIZE + \
1157c478bd9Sstevel@tonic-gate 		MSG_DF1_NORELOC_SIZE + \
1164899432aSab 		MSG_DF1_NOHDR_SIZE + \
1175aefb655Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate const char *
1205aefb655Srie conv_dyn_flag1(Xword flags)
1217c478bd9Sstevel@tonic-gate {
1225aefb655Srie 	static char	string[FLAG1SZ];
1235aefb655Srie 	static Val_desc vda[] = {
1245aefb655Srie 		{ DF_1_NOW,		MSG_ORIG(MSG_DF_ORIGIN) },
1255aefb655Srie 		{ DF_1_GLOBAL,		MSG_ORIG(MSG_DF1_GLOBAL) },
1265aefb655Srie 		{ DF_1_GROUP,		MSG_ORIG(MSG_DF1_GROUP) },
1275aefb655Srie 		{ DF_1_NODELETE,	MSG_ORIG(MSG_DF1_NODELETE) },
1285aefb655Srie 		{ DF_1_LOADFLTR,	MSG_ORIG(MSG_DF1_LOADFLTR) },
1295aefb655Srie 		{ DF_1_INITFIRST,	MSG_ORIG(MSG_DF1_INITFIRST) },
1305aefb655Srie 		{ DF_1_NOOPEN,		MSG_ORIG(MSG_DF1_NOOPEN) },
1315aefb655Srie 		{ DF_1_ORIGIN,		MSG_ORIG(MSG_DF1_ORIGIN) },
1325aefb655Srie 		{ DF_1_DIRECT,		MSG_ORIG(MSG_DF1_DIRECT) },
1335aefb655Srie 		{ DF_1_TRANS,		MSG_ORIG(MSG_DF1_TRANS) },
1345aefb655Srie 		{ DF_1_INTERPOSE,	MSG_ORIG(MSG_DF1_INTERPOSE) },
1355aefb655Srie 		{ DF_1_NODEFLIB,	MSG_ORIG(MSG_DF1_NODEFLIB) },
1365aefb655Srie 		{ DF_1_NODUMP,		MSG_ORIG(MSG_DF1_NODUMP) },
1375aefb655Srie 		{ DF_1_CONFALT,		MSG_ORIG(MSG_DF1_CONFALT) },
1385aefb655Srie 		{ DF_1_ENDFILTEE,	MSG_ORIG(MSG_DF1_ENDFILTEE) },
1395aefb655Srie 		{ DF_1_DISPRELPND,	MSG_ORIG(MSG_DF1_DISPRELPND) },
1405aefb655Srie 		{ DF_1_DISPRELDNE,	MSG_ORIG(MSG_DF1_DISPRELDNE) },
1415aefb655Srie 		{ DF_1_NODIRECT,	MSG_ORIG(MSG_DF1_NODIRECT) },
1425aefb655Srie 		{ DF_1_IGNMULDEF,	MSG_ORIG(MSG_DF1_IGNMULDEF) },
1435aefb655Srie 		{ DF_1_NOKSYMS,		MSG_ORIG(MSG_DF1_NOKSYMS) },
1445aefb655Srie 		{ DF_1_NORELOC,		MSG_ORIG(MSG_DF1_NORELOC) },
1454899432aSab 		{ DF_1_NOHDR,		MSG_ORIG(MSG_DF1_NOHDR) },
1465aefb655Srie 		{ 0,			0 }
1475aefb655Srie 	};
1487c478bd9Sstevel@tonic-gate 
1497c478bd9Sstevel@tonic-gate 	if (flags == 0)
1507c478bd9Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1515aefb655Srie 
1525aefb655Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAG1SZ);
1535aefb655Srie 	if (conv_expn_field(string, FLAG1SZ, vda, flags, flags, 0, 0))
1545aefb655Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAG1SZ);
1555aefb655Srie 
1565aefb655Srie 	return ((const char *)string);
1577c478bd9Sstevel@tonic-gate }
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate #define	FEATSZ	MSG_GBL_OSQBRKT_SIZE + \
1607c478bd9Sstevel@tonic-gate 		MSG_DTF_PARINIT_SIZE + \
1617c478bd9Sstevel@tonic-gate 		MSG_DTF_CONFEXP_SIZE + \
1625aefb655Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate const char *
1655aefb655Srie conv_dyn_feature1(Xword flags)
1667c478bd9Sstevel@tonic-gate {
1675aefb655Srie 	static char	string[FEATSZ];
1685aefb655Srie 	static Val_desc vda[] = {
1695aefb655Srie 		{ DTF_1_PARINIT,	MSG_ORIG(MSG_DTF_PARINIT) },
1705aefb655Srie 		{ DTF_1_CONFEXP,	MSG_ORIG(MSG_DTF_CONFEXP) },
1715aefb655Srie 		{ 0,			0 }
1725aefb655Srie 	};
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate 	if (flags == 0)
1757c478bd9Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1767c478bd9Sstevel@tonic-gate 
1775aefb655Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FEATSZ);
1785aefb655Srie 	if (conv_expn_field(string, FEATSZ, vda, flags, flags, 0, 0))
1795aefb655Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FEATSZ);
1807c478bd9Sstevel@tonic-gate 
1815aefb655Srie 	return ((const char *)string);
1827c478bd9Sstevel@tonic-gate }
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate const char *
185*c13de8f6Sab conv_dyn_tag(Xword tag, Half mach, int fmt_flags)
1867c478bd9Sstevel@tonic-gate {
1875aefb655Srie 	static char		string[CONV_INV_STRSIZE];
1885aefb655Srie 	static const Msg	tags[DT_MAXPOSTAGS] = {
1895aefb655Srie 		MSG_DYN_NULL,		MSG_DYN_NEEDED,
1905aefb655Srie 		MSG_DYN_PLTRELSZ,	MSG_DYN_PLTGOT,
1915aefb655Srie 		MSG_DYN_HASH,		MSG_DYN_STRTAB,
1925aefb655Srie 		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
1935aefb655Srie 		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
1945aefb655Srie 		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
1955aefb655Srie 		MSG_DYN_INIT,		MSG_DYN_FINI,
1965aefb655Srie 		MSG_DYN_SONAME,		MSG_DYN_RPATH,
1975aefb655Srie 		MSG_DYN_SYMBOLIC,	MSG_DYN_REL,
1985aefb655Srie 		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
1995aefb655Srie 		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
2005aefb655Srie 		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
2015aefb655Srie 		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
2025aefb655Srie 		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
2035aefb655Srie 		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
2045aefb655Srie 		MSG_DYN_FLAGS,		MSG_DYN_NULL,
2055aefb655Srie 		MSG_DYN_PREINIT_ARRAY,	MSG_DYN_PREINIT_ARRAYSZ
2065aefb655Srie 	};
207*c13de8f6Sab 	static const Msg	tags_alt[DT_MAXPOSTAGS] = {
208*c13de8f6Sab 		MSG_DYN_NULL,		MSG_DYN_NEEDED,
209*c13de8f6Sab 		MSG_DYN_PLTRELSZ_ALT,	MSG_DYN_PLTGOT,
210*c13de8f6Sab 		MSG_DYN_HASH,		MSG_DYN_STRTAB,
211*c13de8f6Sab 		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
212*c13de8f6Sab 		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
213*c13de8f6Sab 		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
214*c13de8f6Sab 		MSG_DYN_INIT,		MSG_DYN_FINI,
215*c13de8f6Sab 		MSG_DYN_SONAME,		MSG_DYN_RPATH,
216*c13de8f6Sab 		MSG_DYN_SYMBOLIC_ALT,	MSG_DYN_REL,
217*c13de8f6Sab 		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
218*c13de8f6Sab 		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
219*c13de8f6Sab 		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
220*c13de8f6Sab 		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
221*c13de8f6Sab 		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
222*c13de8f6Sab 		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
223*c13de8f6Sab 		MSG_DYN_FLAGS,		MSG_DYN_NULL,
224*c13de8f6Sab 		MSG_DYN_PREINIT_ARRAY,	MSG_DYN_PREINIT_ARRAYSZ
225*c13de8f6Sab 	};
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate 	if (tag < DT_MAXPOSTAGS) {
2287c478bd9Sstevel@tonic-gate 		/*
2297c478bd9Sstevel@tonic-gate 		 * Generic dynamic tags.
2307c478bd9Sstevel@tonic-gate 		 */
231*c13de8f6Sab 		return ((fmt_flags & CONV_FMTALTMASK)
232*c13de8f6Sab 			? MSG_ORIG(tags_alt[tag]) : MSG_ORIG(tags[tag]));
2337c478bd9Sstevel@tonic-gate 	} else {
2347c478bd9Sstevel@tonic-gate 		/*
2357c478bd9Sstevel@tonic-gate 		 * SUNW: DT_LOOS -> DT_HIOS range.
2367c478bd9Sstevel@tonic-gate 		 */
2377c478bd9Sstevel@tonic-gate 		if (tag == DT_SUNW_AUXILIARY)
2387c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_AUXILIARY));
2397c478bd9Sstevel@tonic-gate 		else if (tag == DT_SUNW_RTLDINF)
2407c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_RTLDINF));
2417c478bd9Sstevel@tonic-gate 		else if (tag == DT_SUNW_FILTER)
2427c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_FILTER));
2437c478bd9Sstevel@tonic-gate 		else if (tag == DT_SUNW_CAP)
2447c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_CAP));
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate 		/*
2477c478bd9Sstevel@tonic-gate 		 * SUNW: DT_VALRNGLO - DT_VALRNGHI range.
2487c478bd9Sstevel@tonic-gate 		 */
2497c478bd9Sstevel@tonic-gate 		else if (tag == DT_CHECKSUM)
2507c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CHECKSUM));
2517c478bd9Sstevel@tonic-gate 		else if (tag == DT_PLTPADSZ)
2527c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPADSZ));
2537c478bd9Sstevel@tonic-gate 		else if (tag == DT_MOVEENT)
2547c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVEENT));
2557c478bd9Sstevel@tonic-gate 		else if (tag == DT_MOVESZ)
2567c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVESZ));
2577c478bd9Sstevel@tonic-gate 		else if (tag == DT_FEATURE_1)
2587c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FEATURE_1));
2597c478bd9Sstevel@tonic-gate 		else if (tag == DT_POSFLAG_1)
2607c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_POSFLAG_1));
2617c478bd9Sstevel@tonic-gate 		else if (tag == DT_SYMINSZ)
2627c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINSZ));
2637c478bd9Sstevel@tonic-gate 		else if (tag == DT_SYMINENT)
2647c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINENT));
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate 		/*
2677c478bd9Sstevel@tonic-gate 		 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
2687c478bd9Sstevel@tonic-gate 		 */
2697c478bd9Sstevel@tonic-gate 		else if (tag == DT_CONFIG)
2707c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CONFIG));
2717c478bd9Sstevel@tonic-gate 		else if (tag == DT_DEPAUDIT)
2727c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_DEPAUDIT));
2737c478bd9Sstevel@tonic-gate 		else if (tag == DT_AUDIT)
2747c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUDIT));
2757c478bd9Sstevel@tonic-gate 		else if (tag == DT_PLTPAD)
2767c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPAD));
2777c478bd9Sstevel@tonic-gate 		else if (tag == DT_MOVETAB)
2787c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVETAB));
2797c478bd9Sstevel@tonic-gate 		else if (tag == DT_SYMINFO)
2807c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINFO));
2817c478bd9Sstevel@tonic-gate 
2827c478bd9Sstevel@tonic-gate 		/*
2837c478bd9Sstevel@tonic-gate 		 * SUNW: generic range.
2847c478bd9Sstevel@tonic-gate 		 */
2857c478bd9Sstevel@tonic-gate 		else if (tag == DT_VERSYM)
2867c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERSYM));
2877c478bd9Sstevel@tonic-gate 		else if (tag == DT_RELACOUNT)
2887c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELACOUNT));
2897c478bd9Sstevel@tonic-gate 		else if (tag == DT_RELCOUNT)
2907c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELCOUNT));
2917c478bd9Sstevel@tonic-gate 		else if (tag == DT_FLAGS_1)
2927c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FLAGS_1));
2937c478bd9Sstevel@tonic-gate 		else if (tag == DT_VERDEF)
2947c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEF));
2957c478bd9Sstevel@tonic-gate 		else if (tag == DT_VERDEFNUM)
2967c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEFNUM));
2977c478bd9Sstevel@tonic-gate 		else if (tag == DT_VERNEED)
2987c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEED));
2997c478bd9Sstevel@tonic-gate 		else if (tag == DT_VERNEEDNUM)
3007c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEEDNUM));
3017c478bd9Sstevel@tonic-gate 		else if (tag == DT_AUXILIARY)
3027c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUXILIARY));
3037c478bd9Sstevel@tonic-gate 		else if (tag == DT_USED)
3047c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_USED));
3057c478bd9Sstevel@tonic-gate 		else if (tag == DT_FILTER)
3067c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FILTER));
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate 		/*
3097c478bd9Sstevel@tonic-gate 		 * SUNW: machine specific range.
3107c478bd9Sstevel@tonic-gate 		 */
3117c478bd9Sstevel@tonic-gate 		else if (((mach == EM_SPARC) || (mach == EM_SPARCV9) ||
3127c478bd9Sstevel@tonic-gate 		    (mach == EM_SPARC32PLUS)) && (tag == DT_SPARC_REGISTER))
3137c478bd9Sstevel@tonic-gate 			/* this is so x86 can display a sparc binary */
3147c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
3157c478bd9Sstevel@tonic-gate 		else if (tag == DT_DEPRECATED_SPARC_REGISTER)
3167c478bd9Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
3177c478bd9Sstevel@tonic-gate 		else
3185aefb655Srie 			return (conv_invalid_val(string, CONV_INV_STRSIZE,
319*c13de8f6Sab 			    tag, fmt_flags));
3207c478bd9Sstevel@tonic-gate 	}
3217c478bd9Sstevel@tonic-gate }
322dffec89cSrie 
3235aefb655Srie #define	BINDTSZ	MSG_GBL_OSQBRKT_SIZE + \
324dffec89cSrie 		MSG_BND_NEEDED_SIZE + \
325dffec89cSrie 		MSG_BND_REFER_SIZE + \
326dffec89cSrie 		MSG_BND_FILTER_SIZE + \
3275aefb655Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
328dffec89cSrie 
329dffec89cSrie const char *
3305aefb655Srie conv_bnd_type(uint_t flags)
331dffec89cSrie {
3325aefb655Srie 	static char	string[BINDTSZ];
3335aefb655Srie 	static Val_desc vda[] = {
3345aefb655Srie 		{ BND_NEEDED,		MSG_ORIG(MSG_BND_NEEDED) },
3355aefb655Srie 		{ BND_REFER,		MSG_ORIG(MSG_BND_REFER) },
3365aefb655Srie 		{ BND_FILTER,		MSG_ORIG(MSG_BND_FILTER) },
3375aefb655Srie 		{ 0,			0 }
3385aefb655Srie 	};
339dffec89cSrie 
3405aefb655Srie 	if (flags == 0)
341dffec89cSrie 		return (MSG_ORIG(MSG_STR_EMPTY));
3425aefb655Srie 
3435aefb655Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), BINDTSZ);
3445aefb655Srie 	if (conv_expn_field(string, BINDTSZ, vda, flags, flags, 0, 0))
3455aefb655Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), BINDTSZ);
3465aefb655Srie 
3475aefb655Srie 	return ((const char *)string);
348dffec89cSrie }
349dffec89cSrie 
35010a4fa49Srie /*
35110a4fa49Srie  * Note, conv_bnd_obj() is called with either:
35210a4fa49Srie  *	LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or
35310a4fa49Srie  *	LML_FLG_OBJDELETED, or
35410a4fa49Srie  *	LML_FLG_ATEXIT.
35510a4fa49Srie  */
3565aefb655Srie #define	BINDOSZ	MSG_GBL_OSQBRKT_SIZE + \
357dffec89cSrie 		MSG_BND_ADDED_SIZE + \
358dffec89cSrie 		MSG_BND_REEVAL_SIZE + \
359dffec89cSrie 		MSG_GBL_CSQBRKT_SIZE
360dffec89cSrie 
361dffec89cSrie const char *
3625aefb655Srie conv_bnd_obj(uint_t flags)
363dffec89cSrie {
3645aefb655Srie 	static char	string[BINDOSZ];
3655aefb655Srie 	static Val_desc vda[] = {
3665aefb655Srie 		{ LML_FLG_OBJADDED,	MSG_ORIG(MSG_BND_ADDED) },
3675aefb655Srie 		{ LML_FLG_OBJREEVAL,	MSG_ORIG(MSG_BND_REEVAL) },
3685aefb655Srie 		{ LML_FLG_OBJDELETED,	MSG_ORIG(MSG_BND_DELETED) },
3695aefb655Srie 		{ LML_FLG_ATEXIT,	MSG_ORIG(MSG_BND_ATEXIT) },
3705aefb655Srie 		{ 0,			0 }
3715aefb655Srie 	};
3725aefb655Srie 
37310a4fa49Srie 	if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL |
37410a4fa49Srie 	    LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0)
37510a4fa49Srie 		return (MSG_ORIG(MSG_BND_REVISIT));
376dffec89cSrie 
377dffec89cSrie 	/*
3785aefb655Srie 	 * Note, we're not worried about unknown flags for this family, only
3795aefb655Srie 	 * the selected flags are of interest.
380dffec89cSrie 	 */
3815aefb655Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), BINDOSZ);
3825aefb655Srie 	if (conv_expn_field(string, BINDOSZ, vda, flags, 0, 0, 0))
3835aefb655Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), BINDOSZ);
3845aefb655Srie 
3855aefb655Srie 	return ((const char *)string);
386dffec89cSrie }
387