xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/dynamic.c (revision 1824:9cc314774a20)
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 
380Sstevel@tonic-gate #define	POSSZ	MSG_GBL_OSQBRKT_SIZE + \
390Sstevel@tonic-gate 		MSG_DFP_LAZYLOAD_SIZE + \
400Sstevel@tonic-gate 		MSG_DFP_GROUPPERM_SIZE + \
411618Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
420Sstevel@tonic-gate 
430Sstevel@tonic-gate const char *
441618Srie conv_dyn_posflag1(Xword 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 	};
521618Srie 
530Sstevel@tonic-gate 	if (flags == 0)
540Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
550Sstevel@tonic-gate 
561618Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), POSSZ);
571618Srie 	if (conv_expn_field(string, POSSZ, vda, flags, flags, 0, 0))
581618Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), POSSZ);
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 	return ((const char *)string);
610Sstevel@tonic-gate }
620Sstevel@tonic-gate 
631618Srie #define	FLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
641618Srie 		MSG_DF_ORIGIN_SIZE + \
650Sstevel@tonic-gate 		MSG_DF_SYMBOLIC_SIZE + \
660Sstevel@tonic-gate 		MSG_DF_TEXTREL_SIZE + \
670Sstevel@tonic-gate 		MSG_DF_BIND_NOW_SIZE + \
681618Srie 		MSG_DF_STATIC_TLS_SIZE + \
691618Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
700Sstevel@tonic-gate 
710Sstevel@tonic-gate const char *
721618Srie conv_dyn_flag(Xword flags)
730Sstevel@tonic-gate {
741618Srie 	static char	string[FLAGSZ];
751618Srie 	static Val_desc vda[] = {
761618Srie 		{ DF_ORIGIN,		MSG_ORIG(MSG_DF_ORIGIN) },
771618Srie 		{ DF_SYMBOLIC,		MSG_ORIG(MSG_DF_SYMBOLIC) },
781618Srie 		{ DF_TEXTREL,		MSG_ORIG(MSG_DF_TEXTREL) },
791618Srie 		{ DF_BIND_NOW,		MSG_ORIG(MSG_DF_BIND_NOW) },
801618Srie 		{ DF_STATIC_TLS,	MSG_ORIG(MSG_DF_STATIC_TLS) },
811618Srie 		{ 0,			0 }
821618Srie 	};
831618Srie 
840Sstevel@tonic-gate 	if (flags == 0)
850Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
860Sstevel@tonic-gate 
871618Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ);
881618Srie 	if (conv_expn_field(string, FLAGSZ, vda, flags, flags, 0, 0))
891618Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
900Sstevel@tonic-gate 
911618Srie 	return ((const char *)string);
920Sstevel@tonic-gate }
930Sstevel@tonic-gate 
940Sstevel@tonic-gate #define	FLAG1SZ	MSG_GBL_OSQBRKT_SIZE + \
950Sstevel@tonic-gate 		MSG_DF1_NOW_SIZE + \
961618Srie 		MSG_DF1_GLOBAL_SIZE + \
970Sstevel@tonic-gate 		MSG_DF1_GROUP_SIZE + \
980Sstevel@tonic-gate 		MSG_DF1_NODELETE_SIZE + \
990Sstevel@tonic-gate 		MSG_DF1_LOADFLTR_SIZE + \
1000Sstevel@tonic-gate 		MSG_DF1_INITFIRST_SIZE + \
1010Sstevel@tonic-gate 		MSG_DF1_NOOPEN_SIZE + \
1020Sstevel@tonic-gate 		MSG_DF1_ORIGIN_SIZE + \
1030Sstevel@tonic-gate 		MSG_DF1_DIRECT_SIZE + \
1040Sstevel@tonic-gate 		MSG_DF1_TRANS_SIZE + \
1050Sstevel@tonic-gate 		MSG_DF1_INTERPOSE_SIZE + \
1060Sstevel@tonic-gate 		MSG_DF1_NODEFLIB_SIZE + \
1070Sstevel@tonic-gate 		MSG_DF1_NODUMP_SIZE + \
1080Sstevel@tonic-gate 		MSG_DF1_CONFALT_SIZE + \
1090Sstevel@tonic-gate 		MSG_DF1_ENDFILTEE_SIZE + \
1100Sstevel@tonic-gate 		MSG_DF1_DISPRELPND_SIZE + \
1110Sstevel@tonic-gate 		MSG_DF1_DISPRELDNE_SIZE + \
1120Sstevel@tonic-gate 		MSG_DF1_NODIRECT_SIZE + \
1130Sstevel@tonic-gate 		MSG_DF1_IGNMULDEF_SIZE + \
1140Sstevel@tonic-gate 		MSG_DF1_NOKSYMS_SIZE + \
1150Sstevel@tonic-gate 		MSG_DF1_NORELOC_SIZE + \
1161698Sab196087 		MSG_DF1_NOHDR_SIZE + \
1171618Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate const char *
1201618Srie conv_dyn_flag1(Xword flags)
1210Sstevel@tonic-gate {
1221618Srie 	static char	string[FLAG1SZ];
1231618Srie 	static Val_desc vda[] = {
1241618Srie 		{ DF_1_NOW,		MSG_ORIG(MSG_DF_ORIGIN) },
1251618Srie 		{ DF_1_GLOBAL,		MSG_ORIG(MSG_DF1_GLOBAL) },
1261618Srie 		{ DF_1_GROUP,		MSG_ORIG(MSG_DF1_GROUP) },
1271618Srie 		{ DF_1_NODELETE,	MSG_ORIG(MSG_DF1_NODELETE) },
1281618Srie 		{ DF_1_LOADFLTR,	MSG_ORIG(MSG_DF1_LOADFLTR) },
1291618Srie 		{ DF_1_INITFIRST,	MSG_ORIG(MSG_DF1_INITFIRST) },
1301618Srie 		{ DF_1_NOOPEN,		MSG_ORIG(MSG_DF1_NOOPEN) },
1311618Srie 		{ DF_1_ORIGIN,		MSG_ORIG(MSG_DF1_ORIGIN) },
1321618Srie 		{ DF_1_DIRECT,		MSG_ORIG(MSG_DF1_DIRECT) },
1331618Srie 		{ DF_1_TRANS,		MSG_ORIG(MSG_DF1_TRANS) },
1341618Srie 		{ DF_1_INTERPOSE,	MSG_ORIG(MSG_DF1_INTERPOSE) },
1351618Srie 		{ DF_1_NODEFLIB,	MSG_ORIG(MSG_DF1_NODEFLIB) },
1361618Srie 		{ DF_1_NODUMP,		MSG_ORIG(MSG_DF1_NODUMP) },
1371618Srie 		{ DF_1_CONFALT,		MSG_ORIG(MSG_DF1_CONFALT) },
1381618Srie 		{ DF_1_ENDFILTEE,	MSG_ORIG(MSG_DF1_ENDFILTEE) },
1391618Srie 		{ DF_1_DISPRELPND,	MSG_ORIG(MSG_DF1_DISPRELPND) },
1401618Srie 		{ DF_1_DISPRELDNE,	MSG_ORIG(MSG_DF1_DISPRELDNE) },
1411618Srie 		{ DF_1_NODIRECT,	MSG_ORIG(MSG_DF1_NODIRECT) },
1421618Srie 		{ DF_1_IGNMULDEF,	MSG_ORIG(MSG_DF1_IGNMULDEF) },
1431618Srie 		{ DF_1_NOKSYMS,		MSG_ORIG(MSG_DF1_NOKSYMS) },
1441618Srie 		{ DF_1_NORELOC,		MSG_ORIG(MSG_DF1_NORELOC) },
1451698Sab196087 		{ DF_1_NOHDR,		MSG_ORIG(MSG_DF1_NOHDR) },
1461618Srie 		{ 0,			0 }
1471618Srie 	};
1480Sstevel@tonic-gate 
1490Sstevel@tonic-gate 	if (flags == 0)
1500Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1510Sstevel@tonic-gate 
1521618Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAG1SZ);
1531618Srie 	if (conv_expn_field(string, FLAG1SZ, vda, flags, flags, 0, 0))
1541618Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAG1SZ);
1550Sstevel@tonic-gate 
1561618Srie 	return ((const char *)string);
1570Sstevel@tonic-gate }
1580Sstevel@tonic-gate 
1590Sstevel@tonic-gate #define	FEATSZ	MSG_GBL_OSQBRKT_SIZE + \
1600Sstevel@tonic-gate 		MSG_DTF_PARINIT_SIZE + \
1610Sstevel@tonic-gate 		MSG_DTF_CONFEXP_SIZE + \
1621618Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
1630Sstevel@tonic-gate 
1640Sstevel@tonic-gate const char *
1651618Srie conv_dyn_feature1(Xword flags)
1660Sstevel@tonic-gate {
1671618Srie 	static char	string[FEATSZ];
1681618Srie 	static Val_desc vda[] = {
1691618Srie 		{ DTF_1_PARINIT,	MSG_ORIG(MSG_DTF_PARINIT) },
1701618Srie 		{ DTF_1_CONFEXP,	MSG_ORIG(MSG_DTF_CONFEXP) },
1711618Srie 		{ 0,			0 }
1721618Srie 	};
1730Sstevel@tonic-gate 
1740Sstevel@tonic-gate 	if (flags == 0)
1750Sstevel@tonic-gate 		return (MSG_ORIG(MSG_GBL_ZERO));
1760Sstevel@tonic-gate 
1771618Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FEATSZ);
1781618Srie 	if (conv_expn_field(string, FEATSZ, vda, flags, flags, 0, 0))
1791618Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FEATSZ);
1800Sstevel@tonic-gate 
1811618Srie 	return ((const char *)string);
1820Sstevel@tonic-gate }
1830Sstevel@tonic-gate 
1840Sstevel@tonic-gate const char *
1851618Srie conv_dyn_tag(Xword tag, Half mach)
1860Sstevel@tonic-gate {
1871618Srie 	static char		string[CONV_INV_STRSIZE];
1881618Srie 	static const Msg	tags[DT_MAXPOSTAGS] = {
1891618Srie 		MSG_DYN_NULL,		MSG_DYN_NEEDED,
1901618Srie 		MSG_DYN_PLTRELSZ,	MSG_DYN_PLTGOT,
1911618Srie 		MSG_DYN_HASH,		MSG_DYN_STRTAB,
1921618Srie 		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
1931618Srie 		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
1941618Srie 		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
1951618Srie 		MSG_DYN_INIT,		MSG_DYN_FINI,
1961618Srie 		MSG_DYN_SONAME,		MSG_DYN_RPATH,
1971618Srie 		MSG_DYN_SYMBOLIC,	MSG_DYN_REL,
1981618Srie 		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
1991618Srie 		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
2001618Srie 		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
2011618Srie 		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
2021618Srie 		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
2031618Srie 		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
2041618Srie 		MSG_DYN_FLAGS,		MSG_DYN_NULL,
2051618Srie 		MSG_DYN_PREINIT_ARRAY,	MSG_DYN_PREINIT_ARRAYSZ
2061618Srie 	};
2070Sstevel@tonic-gate 
2080Sstevel@tonic-gate 	if (tag < DT_MAXPOSTAGS) {
2090Sstevel@tonic-gate 		/*
2100Sstevel@tonic-gate 		 * Generic dynamic tags.
2110Sstevel@tonic-gate 		 */
2121618Srie 		return (MSG_ORIG(tags[tag]));
2130Sstevel@tonic-gate 	} else {
2140Sstevel@tonic-gate 		/*
2150Sstevel@tonic-gate 		 * SUNW: DT_LOOS -> DT_HIOS range.
2160Sstevel@tonic-gate 		 */
2170Sstevel@tonic-gate 		if (tag == DT_SUNW_AUXILIARY)
2180Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_AUXILIARY));
2190Sstevel@tonic-gate 		else if (tag == DT_SUNW_RTLDINF)
2200Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_RTLDINF));
2210Sstevel@tonic-gate 		else if (tag == DT_SUNW_FILTER)
2220Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_FILTER));
2230Sstevel@tonic-gate 		else if (tag == DT_SUNW_CAP)
2240Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SUNW_CAP));
2250Sstevel@tonic-gate 
2260Sstevel@tonic-gate 		/*
2270Sstevel@tonic-gate 		 * SUNW: DT_VALRNGLO - DT_VALRNGHI range.
2280Sstevel@tonic-gate 		 */
2290Sstevel@tonic-gate 		else if (tag == DT_CHECKSUM)
2300Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CHECKSUM));
2310Sstevel@tonic-gate 		else if (tag == DT_PLTPADSZ)
2320Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPADSZ));
2330Sstevel@tonic-gate 		else if (tag == DT_MOVEENT)
2340Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVEENT));
2350Sstevel@tonic-gate 		else if (tag == DT_MOVESZ)
2360Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVESZ));
2370Sstevel@tonic-gate 		else if (tag == DT_FEATURE_1)
2380Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FEATURE_1));
2390Sstevel@tonic-gate 		else if (tag == DT_POSFLAG_1)
2400Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_POSFLAG_1));
2410Sstevel@tonic-gate 		else if (tag == DT_SYMINSZ)
2420Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINSZ));
2430Sstevel@tonic-gate 		else if (tag == DT_SYMINENT)
2440Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINENT));
2450Sstevel@tonic-gate 
2460Sstevel@tonic-gate 		/*
2470Sstevel@tonic-gate 		 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
2480Sstevel@tonic-gate 		 */
2490Sstevel@tonic-gate 		else if (tag == DT_CONFIG)
2500Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_CONFIG));
2510Sstevel@tonic-gate 		else if (tag == DT_DEPAUDIT)
2520Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_DEPAUDIT));
2530Sstevel@tonic-gate 		else if (tag == DT_AUDIT)
2540Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUDIT));
2550Sstevel@tonic-gate 		else if (tag == DT_PLTPAD)
2560Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_PLTPAD));
2570Sstevel@tonic-gate 		else if (tag == DT_MOVETAB)
2580Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_MOVETAB));
2590Sstevel@tonic-gate 		else if (tag == DT_SYMINFO)
2600Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_SYMINFO));
2610Sstevel@tonic-gate 
2620Sstevel@tonic-gate 		/*
2630Sstevel@tonic-gate 		 * SUNW: generic range.
2640Sstevel@tonic-gate 		 */
2650Sstevel@tonic-gate 		else if (tag == DT_VERSYM)
2660Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERSYM));
2670Sstevel@tonic-gate 		else if (tag == DT_RELACOUNT)
2680Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELACOUNT));
2690Sstevel@tonic-gate 		else if (tag == DT_RELCOUNT)
2700Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_RELCOUNT));
2710Sstevel@tonic-gate 		else if (tag == DT_FLAGS_1)
2720Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FLAGS_1));
2730Sstevel@tonic-gate 		else if (tag == DT_VERDEF)
2740Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEF));
2750Sstevel@tonic-gate 		else if (tag == DT_VERDEFNUM)
2760Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERDEFNUM));
2770Sstevel@tonic-gate 		else if (tag == DT_VERNEED)
2780Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEED));
2790Sstevel@tonic-gate 		else if (tag == DT_VERNEEDNUM)
2800Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_VERNEEDNUM));
2810Sstevel@tonic-gate 		else if (tag == DT_AUXILIARY)
2820Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_AUXILIARY));
2830Sstevel@tonic-gate 		else if (tag == DT_USED)
2840Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_USED));
2850Sstevel@tonic-gate 		else if (tag == DT_FILTER)
2860Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_FILTER));
2870Sstevel@tonic-gate 
2880Sstevel@tonic-gate 		/*
2890Sstevel@tonic-gate 		 * SUNW: machine specific range.
2900Sstevel@tonic-gate 		 */
2910Sstevel@tonic-gate 		else if (((mach == EM_SPARC) || (mach == EM_SPARCV9) ||
2920Sstevel@tonic-gate 		    (mach == EM_SPARC32PLUS)) && (tag == DT_SPARC_REGISTER))
2930Sstevel@tonic-gate 			/* this is so x86 can display a sparc binary */
2940Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
2950Sstevel@tonic-gate 		else if (tag == DT_DEPRECATED_SPARC_REGISTER)
2960Sstevel@tonic-gate 			return (MSG_ORIG(MSG_DYN_REGISTER));
2970Sstevel@tonic-gate 		else
2981618Srie 			return (conv_invalid_val(string, CONV_INV_STRSIZE,
2991618Srie 			    tag, 0));
3000Sstevel@tonic-gate 	}
3010Sstevel@tonic-gate }
302280Srie 
3031618Srie #define	BINDTSZ	MSG_GBL_OSQBRKT_SIZE + \
304280Srie 		MSG_BND_NEEDED_SIZE + \
305280Srie 		MSG_BND_REFER_SIZE + \
306280Srie 		MSG_BND_FILTER_SIZE + \
3071618Srie 		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
308280Srie 
309280Srie const char *
3101618Srie conv_bnd_type(uint_t flags)
311280Srie {
3121618Srie 	static char	string[BINDTSZ];
3131618Srie 	static Val_desc vda[] = {
3141618Srie 		{ BND_NEEDED,		MSG_ORIG(MSG_BND_NEEDED) },
3151618Srie 		{ BND_REFER,		MSG_ORIG(MSG_BND_REFER) },
3161618Srie 		{ BND_FILTER,		MSG_ORIG(MSG_BND_FILTER) },
3171618Srie 		{ 0,			0 }
3181618Srie 	};
319280Srie 
3201618Srie 	if (flags == 0)
3211618Srie 		return (MSG_ORIG(MSG_STR_EMPTY));
322280Srie 
3231618Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), BINDTSZ);
3241618Srie 	if (conv_expn_field(string, BINDTSZ, vda, flags, flags, 0, 0))
3251618Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), BINDTSZ);
3261618Srie 
3271618Srie 	return ((const char *)string);
328280Srie }
329280Srie 
330*1824Srie /*
331*1824Srie  * Note, conv_bnd_obj() is called with either:
332*1824Srie  *	LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or
333*1824Srie  *	LML_FLG_OBJDELETED, or
334*1824Srie  *	LML_FLG_ATEXIT.
335*1824Srie  */
3361618Srie #define	BINDOSZ	MSG_GBL_OSQBRKT_SIZE + \
337280Srie 		MSG_BND_ADDED_SIZE + \
338280Srie 		MSG_BND_REEVAL_SIZE + \
339280Srie 		MSG_GBL_CSQBRKT_SIZE
340280Srie 
341280Srie const char *
3421618Srie conv_bnd_obj(uint_t flags)
343280Srie {
3441618Srie 	static char	string[BINDOSZ];
3451618Srie 	static Val_desc vda[] = {
3461618Srie 		{ LML_FLG_OBJADDED,	MSG_ORIG(MSG_BND_ADDED) },
3471618Srie 		{ LML_FLG_OBJREEVAL,	MSG_ORIG(MSG_BND_REEVAL) },
3481618Srie 		{ LML_FLG_OBJDELETED,	MSG_ORIG(MSG_BND_DELETED) },
3491618Srie 		{ LML_FLG_ATEXIT,	MSG_ORIG(MSG_BND_ATEXIT) },
3501618Srie 		{ 0,			0 }
3511618Srie 	};
3521618Srie 
353*1824Srie 	if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL |
354*1824Srie 	    LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0)
355*1824Srie 		return (MSG_ORIG(MSG_BND_REVISIT));
356280Srie 
357280Srie 	/*
3581618Srie 	 * Note, we're not worried about unknown flags for this family, only
3591618Srie 	 * the selected flags are of interest.
360280Srie 	 */
3611618Srie 	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), BINDOSZ);
3621618Srie 	if (conv_expn_field(string, BINDOSZ, vda, flags, 0, 0, 0))
3631618Srie 		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), BINDOSZ);
364280Srie 
3651618Srie 	return ((const char *)string);
366280Srie }
367