xref: /titanic_50/usr/src/cmd/sgs/liblddbg/common/files.c (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
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  */
2111a2bb38Srie 
227c478bd9Sstevel@tonic-gate /*
23dc0f59e5SAli Bahrami  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
2641072f3cSrie #include	<sys/auxv.h>
277c478bd9Sstevel@tonic-gate #include	<string.h>
287c478bd9Sstevel@tonic-gate #include	<unistd.h>
297c478bd9Sstevel@tonic-gate #include	<fcntl.h>
307c478bd9Sstevel@tonic-gate #include	<limits.h>
317c478bd9Sstevel@tonic-gate #include	<stdio.h>
325aefb655Srie #include	<libld.h>
335aefb655Srie #include	<rtld.h>
345aefb655Srie #include	<conv.h>
357c478bd9Sstevel@tonic-gate #include	"msg.h"
367c478bd9Sstevel@tonic-gate #include	"_debug.h"
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate void
Dbg_file_analyze(Rt_map * lmp)397c478bd9Sstevel@tonic-gate Dbg_file_analyze(Rt_map *lmp)
407c478bd9Sstevel@tonic-gate {
41de777a60Sab196087 	Conv_dl_mode_buf_t	dl_mode_buf;
425aefb655Srie 	Lm_list			*lml = LIST(lmp);
435aefb655Srie 
445aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
457c478bd9Sstevel@tonic-gate 		return;
467c478bd9Sstevel@tonic-gate 
475aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
485aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_ANALYZE), NAME(lmp),
49de777a60Sab196087 	    conv_dl_mode(MODE(lmp), 1, &dl_mode_buf));
507c478bd9Sstevel@tonic-gate }
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate void
Dbg_file_mmapobj(Lm_list * lml,const char * name,mmapobj_result_t * ompp,uint_t onum)5356deab07SRod Evans Dbg_file_mmapobj(Lm_list *lml, const char *name, mmapobj_result_t *ompp,
5456deab07SRod Evans     uint_t onum)
5556deab07SRod Evans {
5656deab07SRod Evans 	mmapobj_result_t	*mpp;
5756deab07SRod Evans 	uint_t			mnum;
5856deab07SRod Evans 
5956deab07SRod Evans 	if (DBG_NOTCLASS(DBG_C_FILES))
6056deab07SRod Evans 		return;
6156deab07SRod Evans 	if (DBG_NOTDETAIL())
6256deab07SRod Evans 		return;
6356deab07SRod Evans 
6456deab07SRod Evans 	Dbg_util_nl(lml, DBG_NL_STD);
6556deab07SRod Evans 	dbg_print(lml, MSG_INTL(MSG_FIL_MMAPOBJ), name, onum);
6656deab07SRod Evans 
6756deab07SRod Evans 	for (mnum = 0, mpp = ompp; mnum < onum; mnum++, mpp++) {
6856deab07SRod Evans 		const char	*str;
6956deab07SRod Evans 		uint_t		type = MR_GET_TYPE(mpp->mr_flags);
7056deab07SRod Evans 
7156deab07SRod Evans 		if (type == MR_PADDING)
7256deab07SRod Evans 			str = MSG_ORIG(MSG_MR_PADDING);
7356deab07SRod Evans 		else if (type == MR_HDR_ELF)
7456deab07SRod Evans 			str = MSG_ORIG(MSG_MR_HDR_ELF);
7556deab07SRod Evans 		else if (type == MR_HDR_AOUT)
7656deab07SRod Evans 			str = MSG_ORIG(MSG_MR_HDR_AOUT);
7756deab07SRod Evans 		else
7856deab07SRod Evans 			str = MSG_ORIG(MSG_STR_EMPTY);
7956deab07SRod Evans 
8056deab07SRod Evans 		dbg_print(lml, MSG_INTL(MSG_FIL_MMAPOBJ_1), mnum,
8156deab07SRod Evans 		    EC_NATPTR(mpp->mr_addr), EC_OFF(mpp->mr_fsize), str);
8256deab07SRod Evans 		dbg_print(lml, MSG_INTL(MSG_FIL_MMAPOBJ_2),
8356deab07SRod Evans 		    EC_OFF(mpp->mr_offset), EC_OFF(mpp->mr_msize));
8456deab07SRod Evans 	}
8556deab07SRod Evans 	Dbg_util_nl(lml, DBG_NL_STD);
8656deab07SRod Evans }
8756deab07SRod Evans 
8856deab07SRod Evans void
Dbg_file_aout(Lm_list * lml,const char * name,Addr addr,size_t size,const char * lmid,Aliste lmco)8956deab07SRod Evans Dbg_file_aout(Lm_list *lml, const char *name, Addr addr, size_t size,
9056deab07SRod Evans     const char *lmid, Aliste lmco)
917c478bd9Sstevel@tonic-gate {
925aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
937c478bd9Sstevel@tonic-gate 		return;
947c478bd9Sstevel@tonic-gate 
955aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_AOUT), name);
9656deab07SRod Evans 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_AS), EC_ADDR(addr), EC_OFF(size));
975aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco));
987c478bd9Sstevel@tonic-gate }
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate void
Dbg_file_elf(Lm_list * lml,const char * name,Addr addr,size_t size,const char * lmid,Aliste lmco)10156deab07SRod Evans Dbg_file_elf(Lm_list *lml, const char *name, Addr addr, size_t size,
10256deab07SRod Evans     const char *lmid, Aliste lmco)
1037c478bd9Sstevel@tonic-gate {
1047c478bd9Sstevel@tonic-gate 	const char	*str;
1057c478bd9Sstevel@tonic-gate 
1065aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1077c478bd9Sstevel@tonic-gate 		return;
1087c478bd9Sstevel@tonic-gate 
10956deab07SRod Evans 	if (addr == 0)
1107c478bd9Sstevel@tonic-gate 		str = MSG_INTL(MSG_STR_TEMPORARY);
1117c478bd9Sstevel@tonic-gate 	else
1127c478bd9Sstevel@tonic-gate 		str = MSG_ORIG(MSG_STR_EMPTY);
1137c478bd9Sstevel@tonic-gate 
1145aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_ELF), name, str);
11556deab07SRod Evans 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_AS), EC_ADDR(addr), EC_OFF(size));
1165aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco));
1177c478bd9Sstevel@tonic-gate }
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate void
Dbg_file_ldso(Rt_map * lmp,char ** envp,auxv_t * auxv,const char * lmid,Aliste lmco)1205aefb655Srie Dbg_file_ldso(Rt_map *lmp, char **envp, auxv_t *auxv, const char *lmid,
1215aefb655Srie     Aliste lmco)
1227c478bd9Sstevel@tonic-gate {
1235aefb655Srie 	Lm_list	*lml = LIST(lmp);
1245aefb655Srie 
1255aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1267c478bd9Sstevel@tonic-gate 		return;
1277c478bd9Sstevel@tonic-gate 
1285aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
1295aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_LDSO), PATHNAME(lmp));
13056deab07SRod Evans 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_AS), EC_ADDR(ADDR(lmp)),
13156deab07SRod Evans 	    EC_OFF(MSIZE(lmp)));
1325aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_EA), EC_NATPTR(envp),
1335aefb655Srie 	    EC_NATPTR(auxv));
1345aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco));
1355aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
1365aefb655Srie }
1375aefb655Srie 
1385aefb655Srie 
1395aefb655Srie void
Dbg_file_prot(Rt_map * lmp,int prot)1405aefb655Srie Dbg_file_prot(Rt_map *lmp, int prot)
1415aefb655Srie {
1425aefb655Srie 	Lm_list	*lml = LIST(lmp);
1435aefb655Srie 
1445aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1455aefb655Srie 		return;
1465aefb655Srie 
1475aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
1485aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_PROT), NAME(lmp), (prot ? '+' : '-'));
1497c478bd9Sstevel@tonic-gate }
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate void
Dbg_file_delete(Rt_map * lmp)1525aefb655Srie Dbg_file_delete(Rt_map *lmp)
1537c478bd9Sstevel@tonic-gate {
1545aefb655Srie 	Lm_list	*lml = LIST(lmp);
1555aefb655Srie 
1565aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1577c478bd9Sstevel@tonic-gate 		return;
1587c478bd9Sstevel@tonic-gate 
1595aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
1605aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DELETE), NAME(lmp));
1617c478bd9Sstevel@tonic-gate }
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate static int	hdl_title = 0;
1647c478bd9Sstevel@tonic-gate static Msg	hdl_str = 0;
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate void
Dbg_file_hdl_title(int type)1677c478bd9Sstevel@tonic-gate Dbg_file_hdl_title(int type)
1687c478bd9Sstevel@tonic-gate {
1698af2c5b9Srie 	static const Msg titles[] = {
1708af2c5b9Srie 		MSG_FIL_HDL_CREATE,	/* MSG_INTL(MSG_FIL_HDL_CREATE) */
1718af2c5b9Srie 		MSG_FIL_HDL_ADD,	/* MSG_INTL(MSG_FIL_HDL_ADD) */
1728af2c5b9Srie 		MSG_FIL_HDL_DELETE,	/* MSG_INTL(MSG_FIL_HDL_DELETE) */
1738af2c5b9Srie 		MSG_FIL_HDL_ORPHAN,	/* MSG_INTL(MSG_FIL_HDL_ORPHAN) */
1748af2c5b9Srie 		MSG_FIL_HDL_REINST,	/* MSG_INTL(MSG_FIL_HDL_REINST) */
1758af2c5b9Srie 	};
1768af2c5b9Srie 
1775aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
1787c478bd9Sstevel@tonic-gate 		return;
1797c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
1807c478bd9Sstevel@tonic-gate 		return;
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate 	/*
1838af2c5b9Srie 	 * Establish a binding title for later use in Dbg_file_hdl_action.
1847c478bd9Sstevel@tonic-gate 	 */
1858af2c5b9Srie 	if (type <= DBG_HDL_REINST) {
1868af2c5b9Srie 		hdl_str = titles[type];
1878af2c5b9Srie 		hdl_title = 1;
1888af2c5b9Srie 	} else {
1897c478bd9Sstevel@tonic-gate 		hdl_str = 0;
1908af2c5b9Srie 		hdl_title = 0;
19102ca3e02Srie 	}
1927c478bd9Sstevel@tonic-gate }
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate void
Dbg_file_hdl_collect(Grp_hdl * ghp,const char * name)1957c478bd9Sstevel@tonic-gate Dbg_file_hdl_collect(Grp_hdl *ghp, const char *name)
1967c478bd9Sstevel@tonic-gate {
197de777a60Sab196087 	Conv_grphdl_flags_buf_t	grphdl_flags_buf;
1985aefb655Srie 	Lm_list		*lml = ghp->gh_ownlml;
1997c478bd9Sstevel@tonic-gate 	const char	*str;
2007c478bd9Sstevel@tonic-gate 
2015aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
2027c478bd9Sstevel@tonic-gate 		return;
2037c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
2047c478bd9Sstevel@tonic-gate 		return;
2057c478bd9Sstevel@tonic-gate 
2065aefb655Srie 	if (ghp->gh_ownlmp)
2075aefb655Srie 		str = NAME(ghp->gh_ownlmp);
2087c478bd9Sstevel@tonic-gate 	else
2097c478bd9Sstevel@tonic-gate 		str = MSG_INTL(MSG_STR_ORPHAN);
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate 	if (hdl_title) {
2127c478bd9Sstevel@tonic-gate 		hdl_title = 0;
2135aefb655Srie 		Dbg_util_nl(lml, DBG_NL_STD);
2147c478bd9Sstevel@tonic-gate 	}
2157c478bd9Sstevel@tonic-gate 	if (name)
2165aefb655Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_HDL_RETAIN), str, name);
2177c478bd9Sstevel@tonic-gate 	else
2185aefb655Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_HDL_COLLECT), str,
219de777a60Sab196087 		    conv_grphdl_flags(ghp->gh_flags, &grphdl_flags_buf));
2207c478bd9Sstevel@tonic-gate }
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate void
Dbg_file_hdl_action(Grp_hdl * ghp,Rt_map * lmp,int type,uint_t flags)22302ca3e02Srie Dbg_file_hdl_action(Grp_hdl *ghp, Rt_map *lmp, int type, uint_t flags)
2247c478bd9Sstevel@tonic-gate {
225de777a60Sab196087 	Conv_grpdesc_flags_buf_t grpdesc_flags_buf;
22602ca3e02Srie 	const char	*mode, *group;
2275aefb655Srie 	Lm_list		*lml = LIST(lmp);
2287c478bd9Sstevel@tonic-gate 	Msg		str;
2297c478bd9Sstevel@tonic-gate 
2308af2c5b9Srie 	static const Msg fmt[] = {
2318af2c5b9Srie 		MSG_FIL_DEP_ADD,	/* MSG_INTL(MSG_FIL_DEP_ADD) */
2328af2c5b9Srie 		MSG_FIL_DEP_UPDATE,	/* MSG_INTL(MSG_FIL_DEP_UPDATE) */
2338af2c5b9Srie 		MSG_FIL_DEP_DELETE,	/* MSG_INTL(MSG_FIL_DEP_DELETE) */
2348af2c5b9Srie 		MSG_FIL_DEP_REMOVE,	/* MSG_INTL(MSG_FIL_DEP_REMOVE) */
2358af2c5b9Srie 		MSG_FIL_DEP_REMAIN,	/* MSG_INTL(MSG_FIL_DEP_REMAIN) */
2368af2c5b9Srie 		MSG_FIL_DEP_ORPHAN,	/* MSG_INTL(MSG_FIL_DEP_ORPHAN) */
2378af2c5b9Srie 		MSG_FIL_DEP_REINST,	/* MSG_INTL(MSG_FIL_DEP_REINST) */
2388af2c5b9Srie 	};
2395aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
2407c478bd9Sstevel@tonic-gate 		return;
2417c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
2427c478bd9Sstevel@tonic-gate 		return;
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate 	if (hdl_title) {
2455aefb655Srie 		Dbg_util_nl(lml, DBG_NL_STD);
2467c478bd9Sstevel@tonic-gate 		if (hdl_str) {
2472017c965SRod Evans 			Conv_grphdl_flags_buf_t grphdl_flags_buf;
2487c478bd9Sstevel@tonic-gate 			const char	*name;
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate 			/*
2517c478bd9Sstevel@tonic-gate 			 * Protect ourselves in case this handle has no
2527c478bd9Sstevel@tonic-gate 			 * originating owner.
2537c478bd9Sstevel@tonic-gate 			 */
2545aefb655Srie 			if (ghp->gh_ownlmp)
2555aefb655Srie 				name = NAME(ghp->gh_ownlmp);
2567c478bd9Sstevel@tonic-gate 			else
2577c478bd9Sstevel@tonic-gate 				name = MSG_INTL(MSG_STR_UNKNOWN);
2587c478bd9Sstevel@tonic-gate 
2592017c965SRod Evans 			dbg_print(lml, MSG_INTL(hdl_str), name,
2602017c965SRod Evans 			    conv_grphdl_flags(ghp->gh_flags, &grphdl_flags_buf),
2612017c965SRod Evans 			    EC_NATPTR(ghp));
2627c478bd9Sstevel@tonic-gate 		}
2637c478bd9Sstevel@tonic-gate 		hdl_title = 0;
2647c478bd9Sstevel@tonic-gate 	}
2657c478bd9Sstevel@tonic-gate 
266de777a60Sab196087 	/*
2678af2c5b9Srie 	 * Establish a binding descriptor format string.
268de777a60Sab196087 	 */
2698af2c5b9Srie 	if (type > DBG_DEP_REINST)
27002ca3e02Srie 		return;
2717c478bd9Sstevel@tonic-gate 
2728af2c5b9Srie 	str = fmt[type];
2738af2c5b9Srie 
2748af2c5b9Srie 	if (((type == DBG_DEP_ADD) || (type == DBG_DEP_UPDATE)) && flags)
275de777a60Sab196087 		group = conv_grpdesc_flags(flags, &grpdesc_flags_buf);
27602ca3e02Srie 	else
27702ca3e02Srie 		group = MSG_ORIG(MSG_STR_EMPTY);
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate 	if ((MODE(lmp) & (RTLD_GLOBAL | RTLD_NODELETE)) ==
2807c478bd9Sstevel@tonic-gate 	    (RTLD_GLOBAL | RTLD_NODELETE))
2817c478bd9Sstevel@tonic-gate 		mode = MSG_ORIG(MSG_MODE_GLOBNODEL);
2827c478bd9Sstevel@tonic-gate 	else if (MODE(lmp) & RTLD_GLOBAL)
2837c478bd9Sstevel@tonic-gate 		mode = MSG_ORIG(MSG_MODE_GLOB);
2847c478bd9Sstevel@tonic-gate 	else if (MODE(lmp) & RTLD_NODELETE)
2857c478bd9Sstevel@tonic-gate 		mode = MSG_ORIG(MSG_MODE_NODEL);
2867c478bd9Sstevel@tonic-gate 	else
2877c478bd9Sstevel@tonic-gate 		mode = MSG_ORIG(MSG_STR_EMPTY);
2887c478bd9Sstevel@tonic-gate 
28902ca3e02Srie 	dbg_print(lml, MSG_INTL(str), NAME(lmp), mode, group);
2907c478bd9Sstevel@tonic-gate }
2917c478bd9Sstevel@tonic-gate 
2927c478bd9Sstevel@tonic-gate void
Dbg_file_bind_entry(Lm_list * lml,Bnd_desc * bdp)2935aefb655Srie Dbg_file_bind_entry(Lm_list *lml, Bnd_desc *bdp)
2947c478bd9Sstevel@tonic-gate {
295de777a60Sab196087 	Conv_bnd_type_buf_t bnd_type_buf;
296de777a60Sab196087 
2975aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
2987c478bd9Sstevel@tonic-gate 		return;
2997c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
3007c478bd9Sstevel@tonic-gate 		return;
3017c478bd9Sstevel@tonic-gate 
3027c478bd9Sstevel@tonic-gate 	/*
3037c478bd9Sstevel@tonic-gate 	 * Print the dependency together with the modes of the binding.
3047c478bd9Sstevel@tonic-gate 	 */
3055aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
3065aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_BND_ADD), NAME(bdp->b_caller));
3075aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_BND_FILE), NAME(bdp->b_depend),
308de777a60Sab196087 	    conv_bnd_type(bdp->b_flags, &bnd_type_buf));
309dffec89cSrie }
310dffec89cSrie 
311dffec89cSrie void
Dbg_file_bindings(Rt_map * lmp,int flag)3125aefb655Srie Dbg_file_bindings(Rt_map *lmp, int flag)
313dffec89cSrie {
314de777a60Sab196087 	Conv_bnd_obj_buf_t	bnd_obj_buf;
315de777a60Sab196087 	Conv_bnd_type_buf_t	bnd_type_buf;
316dffec89cSrie 	const char	*str;
317dffec89cSrie 	Rt_map		*tlmp;
3185aefb655Srie 	Lm_list		*lml = LIST(lmp);
319dffec89cSrie 	int		next = 0;
320dffec89cSrie 
3215aefb655Srie 	if (DBG_NOTCLASS(DBG_C_INIT))
322dffec89cSrie 		return;
323dffec89cSrie 	if (DBG_NOTDETAIL())
324dffec89cSrie 		return;
325dffec89cSrie 
326dffec89cSrie 	if (flag & RT_SORT_REV)
327dffec89cSrie 		str = MSG_ORIG(MSG_SCN_INIT);
328dffec89cSrie 	else
329dffec89cSrie 		str = MSG_ORIG(MSG_SCN_FINI);
330dffec89cSrie 
3315aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
3325aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DEP_TITLE), str,
333de777a60Sab196087 	    conv_bnd_obj(lml->lm_flags, &bnd_obj_buf));
334dffec89cSrie 
335dffec89cSrie 	/* LINTED */
336dffec89cSrie 	for (tlmp = lmp; tlmp; tlmp = (Rt_map *)NEXT(tlmp)) {
337cce0e03bSab196087 		Bnd_desc	*bdp;
338cce0e03bSab196087 		Aliste		idx;
339dffec89cSrie 
340dffec89cSrie 		/*
341dffec89cSrie 		 * For .init processing, only collect objects that have been
342dffec89cSrie 		 * relocated and haven't already been collected.
343dffec89cSrie 		 * For .fini processing, only collect objects that have had
344dffec89cSrie 		 * their .init collected, and haven't already been .fini
345dffec89cSrie 		 * collected.
346dffec89cSrie 		 */
347dffec89cSrie 		if (flag & RT_SORT_REV) {
348dffec89cSrie 			if ((FLAGS(tlmp) & (FLG_RT_RELOCED |
349dffec89cSrie 			    FLG_RT_INITCLCT)) != FLG_RT_RELOCED)
350dffec89cSrie 				continue;
351dffec89cSrie 
352dffec89cSrie 		} else {
353dffec89cSrie 			if ((flag & RT_SORT_DELETE) &&
354dffec89cSrie 			    ((FLAGS(tlmp) & FLG_RT_DELETE) == 0))
355dffec89cSrie 				continue;
356dffec89cSrie 			if (((FLAGS(tlmp) &
357dffec89cSrie 			    (FLG_RT_INITCLCT | FLG_RT_FINICLCT)) ==
358dffec89cSrie 			    FLG_RT_INITCLCT) == 0)
359dffec89cSrie 				continue;
360dffec89cSrie 		}
361dffec89cSrie 
362dffec89cSrie 		if (next++)
3635aefb655Srie 			Dbg_util_nl(lml, DBG_NL_STD);
364dffec89cSrie 
365cce0e03bSab196087 		if (DEPENDS(tlmp) == NULL)
3665aefb655Srie 			dbg_print(lml, MSG_INTL(MSG_FIL_DEP_NONE), NAME(tlmp));
367dffec89cSrie 		else {
3685aefb655Srie 			dbg_print(lml, MSG_INTL(MSG_FIL_DEP_ENT), NAME(tlmp));
369dffec89cSrie 
370cce0e03bSab196087 			for (APLIST_TRAVERSE(DEPENDS(tlmp), idx, bdp)) {
3715aefb655Srie 				dbg_print(lml, MSG_INTL(MSG_FIL_BND_FILE),
372cce0e03bSab196087 				    NAME(bdp->b_depend),
373cce0e03bSab196087 				    conv_bnd_type(bdp->b_flags,
374de777a60Sab196087 				    &bnd_type_buf));
375dffec89cSrie 			}
376dffec89cSrie 		}
377dffec89cSrie 	}
3785aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
3797c478bd9Sstevel@tonic-gate }
3807c478bd9Sstevel@tonic-gate 
3817c478bd9Sstevel@tonic-gate void
Dbg_file_bindings_done(Lm_list * lml)38220272c2eSAli Bahrami Dbg_file_bindings_done(Lm_list *lml)
38320272c2eSAli Bahrami {
38420272c2eSAli Bahrami 	if (DBG_NOTCLASS(DBG_C_INIT))
38520272c2eSAli Bahrami 		return;
38620272c2eSAli Bahrami 	if (DBG_NOTDETAIL())
38720272c2eSAli Bahrami 		return;
38820272c2eSAli Bahrami 
38920272c2eSAli Bahrami 	DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
39020272c2eSAli Bahrami }
39120272c2eSAli Bahrami 
39220272c2eSAli Bahrami void
Dbg_file_lazyload(Rt_map * clmp,const char * fname,const char * sname)3935aefb655Srie Dbg_file_lazyload(Rt_map *clmp, const char *fname, const char *sname)
3947c478bd9Sstevel@tonic-gate {
3955aefb655Srie 	Lm_list	*lml = LIST(clmp);
3965aefb655Srie 
3975aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
3987c478bd9Sstevel@tonic-gate 		return;
3997c478bd9Sstevel@tonic-gate 
4005aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4015aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_LAZYLOAD), fname, NAME(clmp),
4025aefb655Srie 	    Dbg_demangle_name(sname));
4037c478bd9Sstevel@tonic-gate }
4047c478bd9Sstevel@tonic-gate 
4057c478bd9Sstevel@tonic-gate void
Dbg_file_preload(Lm_list * lml,const char * name)4065aefb655Srie Dbg_file_preload(Lm_list *lml, const char *name)
4077c478bd9Sstevel@tonic-gate {
4085aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4097c478bd9Sstevel@tonic-gate 		return;
4107c478bd9Sstevel@tonic-gate 
4115aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4125aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_PRELOAD), name);
4137c478bd9Sstevel@tonic-gate }
4147c478bd9Sstevel@tonic-gate 
4157c478bd9Sstevel@tonic-gate void
Dbg_file_needed(Rt_map * lmp,const char * name)4165aefb655Srie Dbg_file_needed(Rt_map *lmp, const char *name)
4177c478bd9Sstevel@tonic-gate {
4185aefb655Srie 	Lm_list	*lml = LIST(lmp);
4195aefb655Srie 
4205aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4217c478bd9Sstevel@tonic-gate 		return;
4227c478bd9Sstevel@tonic-gate 
4235aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4245aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_NEEDED), name, NAME(lmp));
4257c478bd9Sstevel@tonic-gate }
4267c478bd9Sstevel@tonic-gate 
4277c478bd9Sstevel@tonic-gate void
Dbg_file_filter(Lm_list * lml,const char * filter,const char * filtee,int config)4285aefb655Srie Dbg_file_filter(Lm_list *lml, const char *filter, const char *filtee,
4295aefb655Srie     int config)
4307c478bd9Sstevel@tonic-gate {
4315aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4327c478bd9Sstevel@tonic-gate 		return;
4337c478bd9Sstevel@tonic-gate 
4345aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4357c478bd9Sstevel@tonic-gate 	if (config)
4365aefb655Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTER_1), filter, filtee);
4377c478bd9Sstevel@tonic-gate 	else
4385aefb655Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTER_2), filter, filtee);
4397c478bd9Sstevel@tonic-gate }
4407c478bd9Sstevel@tonic-gate 
4417c478bd9Sstevel@tonic-gate void
Dbg_file_filtee(Lm_list * lml,const char * filter,const char * filtee,int audit)4425aefb655Srie Dbg_file_filtee(Lm_list *lml, const char *filter, const char *filtee, int audit)
4437c478bd9Sstevel@tonic-gate {
4445aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4457c478bd9Sstevel@tonic-gate 		return;
4467c478bd9Sstevel@tonic-gate 
4475aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
448*2020b2b6SRod Evans 
449*2020b2b6SRod Evans 	if (audit)
450*2020b2b6SRod Evans 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_3), filtee);
451*2020b2b6SRod Evans 	else if (filter)
452*2020b2b6SRod Evans 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_1), filtee, filter);
4537c478bd9Sstevel@tonic-gate 	else
4545aefb655Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_2), filtee);
4557c478bd9Sstevel@tonic-gate }
4567c478bd9Sstevel@tonic-gate 
4577c478bd9Sstevel@tonic-gate void
Dbg_file_fixname(Lm_list * lml,const char * oname,const char * nname)4585aefb655Srie Dbg_file_fixname(Lm_list *lml, const char *oname, const char *nname)
4597c478bd9Sstevel@tonic-gate {
4605aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4617c478bd9Sstevel@tonic-gate 		return;
4627c478bd9Sstevel@tonic-gate 
4635aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
4645aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_FIXNAME), oname, nname);
4657c478bd9Sstevel@tonic-gate }
4667c478bd9Sstevel@tonic-gate 
4677c478bd9Sstevel@tonic-gate void
Dbg_file_output(Ofl_desc * ofl)4687c478bd9Sstevel@tonic-gate Dbg_file_output(Ofl_desc *ofl)
4697c478bd9Sstevel@tonic-gate {
4707c478bd9Sstevel@tonic-gate 	const char	*prefix = MSG_ORIG(MSG_PTH_OBJECT);
4717c478bd9Sstevel@tonic-gate 	char		*oname, *nname, *ofile;
4727c478bd9Sstevel@tonic-gate 	int		fd;
4737c478bd9Sstevel@tonic-gate 
4745aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
4757c478bd9Sstevel@tonic-gate 		return;
4767c478bd9Sstevel@tonic-gate 	if (DBG_NOTDETAIL())
4777c478bd9Sstevel@tonic-gate 		return;
4787c478bd9Sstevel@tonic-gate 
4797c478bd9Sstevel@tonic-gate 	/*
4807c478bd9Sstevel@tonic-gate 	 * Obtain the present input object filename for concatenation to the
4817c478bd9Sstevel@tonic-gate 	 * prefix name.
4827c478bd9Sstevel@tonic-gate 	 */
4837c478bd9Sstevel@tonic-gate 	oname = (char *)ofl->ofl_name;
4847c478bd9Sstevel@tonic-gate 	if ((ofile = strrchr(oname, '/')) == NULL)
4857c478bd9Sstevel@tonic-gate 		ofile = oname;
4867c478bd9Sstevel@tonic-gate 	else
4877c478bd9Sstevel@tonic-gate 		ofile++;
4887c478bd9Sstevel@tonic-gate 
4897c478bd9Sstevel@tonic-gate 	/*
4907c478bd9Sstevel@tonic-gate 	 * Concatenate the prefix with the object filename, open the file and
4917c478bd9Sstevel@tonic-gate 	 * write out the present Elf memory image.  As this is debugging we
4927c478bd9Sstevel@tonic-gate 	 * ignore all errors.
4937c478bd9Sstevel@tonic-gate 	 */
4945aefb655Srie 	if ((nname = malloc(strlen(prefix) + strlen(ofile) + 1)) != 0) {
4957c478bd9Sstevel@tonic-gate 		(void) strcpy(nname, prefix);
4967c478bd9Sstevel@tonic-gate 		(void) strcat(nname, ofile);
4977c478bd9Sstevel@tonic-gate 		if ((fd = open(nname, O_RDWR | O_CREAT | O_TRUNC,
4987c478bd9Sstevel@tonic-gate 		    0666)) != -1) {
4995aefb655Srie 			(void) write(fd, ofl->ofl_nehdr, ofl->ofl_size);
5005aefb655Srie 			(void) close(fd);
5017c478bd9Sstevel@tonic-gate 		}
5027c478bd9Sstevel@tonic-gate 		free(nname);
5037c478bd9Sstevel@tonic-gate 	}
5047c478bd9Sstevel@tonic-gate }
5057c478bd9Sstevel@tonic-gate 
5067c478bd9Sstevel@tonic-gate void
Dbg_file_config_dis(Lm_list * lml,const char * config,int features)5075aefb655Srie Dbg_file_config_dis(Lm_list *lml, const char *config, int features)
5087c478bd9Sstevel@tonic-gate {
509de777a60Sab196087 	Conv_config_feat_buf_t	config_feat_buf;
5107c478bd9Sstevel@tonic-gate 	const char		*str;
5117c478bd9Sstevel@tonic-gate 
51208278a5eSRod Evans 	if (features == 0)
51308278a5eSRod Evans 		return;
51408278a5eSRod Evans 
515c13de8f6Sab196087 	switch (features & ~CONF_FEATMSK) {
516c13de8f6Sab196087 	case DBG_CONF_IGNORE:
5177c478bd9Sstevel@tonic-gate 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_1);
518c13de8f6Sab196087 		break;
519c13de8f6Sab196087 	case DBG_CONF_VERSION:
5207c478bd9Sstevel@tonic-gate 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_2);
521c13de8f6Sab196087 		break;
522c13de8f6Sab196087 	case DBG_CONF_PRCFAIL:
5237c478bd9Sstevel@tonic-gate 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_3);
524c13de8f6Sab196087 		break;
525c13de8f6Sab196087 	case DBG_CONF_CORRUPT:
5267c478bd9Sstevel@tonic-gate 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_4);
527c13de8f6Sab196087 		break;
528c13de8f6Sab196087 	case DBG_CONF_ABIMISMATCH:
529c13de8f6Sab196087 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_5);
530c13de8f6Sab196087 		break;
531c13de8f6Sab196087 	default:
532de777a60Sab196087 		str = conv_config_feat(features, &config_feat_buf);
533c13de8f6Sab196087 		break;
534c13de8f6Sab196087 	}
5357c478bd9Sstevel@tonic-gate 
5365aefb655Srie 	Dbg_util_nl(lml, DBG_NL_FRC);
5375aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_CONFIG_ERR), config, str);
5385aefb655Srie 	Dbg_util_nl(lml, DBG_NL_FRC);
5397c478bd9Sstevel@tonic-gate }
5407c478bd9Sstevel@tonic-gate 
5417c478bd9Sstevel@tonic-gate void
Dbg_file_config_obj(Lm_list * lml,const char * dir,const char * file,const char * config)5425aefb655Srie Dbg_file_config_obj(Lm_list *lml, const char *dir, const char *file,
5435aefb655Srie     const char *config)
5447c478bd9Sstevel@tonic-gate {
5457c478bd9Sstevel@tonic-gate 	char	*name, _name[PATH_MAX];
5467c478bd9Sstevel@tonic-gate 
5475aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
5487c478bd9Sstevel@tonic-gate 		return;
5497c478bd9Sstevel@tonic-gate 
5507c478bd9Sstevel@tonic-gate 	if (file) {
5517c478bd9Sstevel@tonic-gate 		(void) snprintf(_name, PATH_MAX, MSG_ORIG(MSG_FMT_PATH),
5527c478bd9Sstevel@tonic-gate 		    dir, file);
5537c478bd9Sstevel@tonic-gate 		name = _name;
5547c478bd9Sstevel@tonic-gate 	} else
5557c478bd9Sstevel@tonic-gate 		name = (char *)dir;
5567c478bd9Sstevel@tonic-gate 
5575aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_CONFIG), name, config);
5587c478bd9Sstevel@tonic-gate }
5597c478bd9Sstevel@tonic-gate 
5605aefb655Srie void
Dbg_file_del_rescan(Lm_list * lml)5615aefb655Srie Dbg_file_del_rescan(Lm_list *lml)
5625aefb655Srie {
5635aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
5645aefb655Srie 		return;
5657c478bd9Sstevel@tonic-gate 
5665aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
5675aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_DEL_RESCAN));
5685aefb655Srie }
5695aefb655Srie 
5705aefb655Srie void
Dbg_file_mode_promote(Rt_map * lmp,int mode)5715aefb655Srie Dbg_file_mode_promote(Rt_map *lmp, int mode)
5725aefb655Srie {
573de777a60Sab196087 	Conv_dl_mode_buf_t	dl_mode_buf;
5745aefb655Srie 	Lm_list			*lml = LIST(lmp);
5755aefb655Srie 
5765aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
5775aefb655Srie 		return;
5785aefb655Srie 
5795aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
5805aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_PROMOTE), NAME(lmp),
581de777a60Sab196087 	    conv_dl_mode(mode, 0, &dl_mode_buf));
5825aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
5835aefb655Srie }
5845aefb655Srie 
5855aefb655Srie void
Dbg_file_deferred(Lm_list * lml,const char * oname,const char * nname)586f441771bSRod Evans Dbg_file_deferred(Lm_list *lml, const char *oname, const char *nname)
587f441771bSRod Evans {
588f441771bSRod Evans 	if (DBG_NOTCLASS(DBG_C_FILES))
589f441771bSRod Evans 		return;
590f441771bSRod Evans 
591f441771bSRod Evans 	Dbg_util_nl(lml, DBG_NL_STD);
592f441771bSRod Evans 	dbg_print(lml, MSG_INTL(MSG_FIL_DEFERRED), oname, nname);
593f441771bSRod Evans }
594f441771bSRod Evans 
595f441771bSRod Evans void
Dbg_file_cntl(Lm_list * lml,Aliste flmco,Aliste tlmco)5965aefb655Srie Dbg_file_cntl(Lm_list *lml, Aliste flmco, Aliste tlmco)
5975aefb655Srie {
5985aefb655Srie 	Lm_cntl	*lmc;
5995aefb655Srie 	Aliste	off;
6005aefb655Srie 
6015aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6025aefb655Srie 		return;
6035aefb655Srie 	if (DBG_NOTDETAIL())
6045aefb655Srie 		return;
6055aefb655Srie 
6065aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6075aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_CNTL_TITLE), EC_XWORD(flmco),
6085aefb655Srie 	    EC_XWORD(tlmco));
6095aefb655Srie 
610cce0e03bSab196087 	for (ALIST_TRAVERSE_BY_OFFSET(lml->lm_lists, off, lmc)) {
6115aefb655Srie 		Rt_map	*lmp;
6125aefb655Srie 
6135aefb655Srie 		/* LINTED */
6145aefb655Srie 		for (lmp = lmc->lc_head; lmp; lmp = (Rt_map *)NEXT(lmp))
6155aefb655Srie 			dbg_print(lml, MSG_ORIG(MSG_CNTL_ENTRY), EC_XWORD(off),
6165aefb655Srie 			    NAME(lmp));
6175aefb655Srie 	}
6185aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6195aefb655Srie }
6205aefb655Srie 
621551cffe3SAli Bahrami /*
622551cffe3SAli Bahrami  * Report archive rescan operation.
623551cffe3SAli Bahrami  *	argv_start_ndx, argv_end_ndx - Index range of command line arguments
624551cffe3SAli Bahrami  *		from which archives are to be reprocessed.
625551cffe3SAli Bahrami  */
6265aefb655Srie void
Dbg_file_ar_rescan(Lm_list * lml,int argv_start_ndx,int argv_end_ndx)627551cffe3SAli Bahrami Dbg_file_ar_rescan(Lm_list *lml, int argv_start_ndx, int argv_end_ndx)
6285aefb655Srie {
6295aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6305aefb655Srie 		return;
6315aefb655Srie 
6325aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
633551cffe3SAli Bahrami 	dbg_print(lml, MSG_INTL(MSG_FIL_AR_RESCAN),
634551cffe3SAli Bahrami 	    argv_start_ndx, argv_end_ndx);
6355aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6365aefb655Srie }
6375aefb655Srie 
6385aefb655Srie void
Dbg_file_ar(Lm_list * lml,const char * name,Boolean again)639dc0f59e5SAli Bahrami Dbg_file_ar(Lm_list *lml, const char *name, Boolean again)
6405aefb655Srie {
6415aefb655Srie 	const char	*str;
6425aefb655Srie 
6435aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6445aefb655Srie 		return;
6455aefb655Srie 
6465aefb655Srie 	if (again)
6475aefb655Srie 		str = MSG_INTL(MSG_STR_AGAIN);
6485aefb655Srie 	else
6495aefb655Srie 		str = MSG_ORIG(MSG_STR_EMPTY);
6505aefb655Srie 
6515aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6525aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_ARCHIVE), name, str);
6535aefb655Srie }
6545aefb655Srie 
6555aefb655Srie void
Dbg_file_generic(Lm_list * lml,Ifl_desc * ifl)6565aefb655Srie Dbg_file_generic(Lm_list *lml, Ifl_desc *ifl)
6575aefb655Srie {
658de777a60Sab196087 	Conv_inv_buf_t inv_buf;
659de777a60Sab196087 
6605aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6615aefb655Srie 		return;
6625aefb655Srie 
6635aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
6645aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_BASIC), ifl->ifl_name,
6654f680cc6SAli Bahrami 	    conv_ehdr_type(ifl->ifl_ehdr->e_ident[EI_OSABI],
6664f680cc6SAli Bahrami 	    ifl->ifl_ehdr->e_type, 0, &inv_buf));
6675aefb655Srie }
6685aefb655Srie 
6695aefb655Srie static const Msg
6707c478bd9Sstevel@tonic-gate reject[] = {
6717c478bd9Sstevel@tonic-gate 	MSG_STR_EMPTY,
6727c478bd9Sstevel@tonic-gate 	MSG_REJ_MACH,		/* MSG_INTL(MSG_REJ_MACH) */
6737c478bd9Sstevel@tonic-gate 	MSG_REJ_CLASS,		/* MSG_INTL(MSG_REJ_CLASS) */
6747c478bd9Sstevel@tonic-gate 	MSG_REJ_DATA,		/* MSG_INTL(MSG_REJ_DATA) */
6757c478bd9Sstevel@tonic-gate 	MSG_REJ_TYPE,		/* MSG_INTL(MSG_REJ_TYPE) */
6767c478bd9Sstevel@tonic-gate 	MSG_REJ_BADFLAG,	/* MSG_INTL(MSG_REJ_BADFLAG) */
6777c478bd9Sstevel@tonic-gate 	MSG_REJ_MISFLAG,	/* MSG_INTL(MSG_REJ_MISFLAG) */
6787c478bd9Sstevel@tonic-gate 	MSG_REJ_VERSION,	/* MSG_INTL(MSG_REJ_VERSION) */
6797c478bd9Sstevel@tonic-gate 	MSG_REJ_HAL,		/* MSG_INTL(MSG_REJ_HAL) */
6807c478bd9Sstevel@tonic-gate 	MSG_REJ_US3,		/* MSG_INTL(MSG_REJ_US3) */
6817c478bd9Sstevel@tonic-gate 	MSG_REJ_STR,		/* MSG_INTL(MSG_REJ_STR) */
6827c478bd9Sstevel@tonic-gate 	MSG_REJ_UNKFILE,	/* MSG_INTL(MSG_REJ_UNKFILE) */
68308278a5eSRod Evans 	MSG_REJ_UNKCAP,		/* MSG_INTL(MSG_REJ_UNKCAP) */
6847c478bd9Sstevel@tonic-gate 	MSG_REJ_HWCAP_1,	/* MSG_INTL(MSG_REJ_HWCAP_1) */
68508278a5eSRod Evans 	MSG_REJ_SFCAP_1,	/* MSG_INTL(MSG_REJ_SFCAP_1) */
68608278a5eSRod Evans 	MSG_REJ_MACHCAP,	/* MSG_INTL(MSG_REJ_MACHCAP) */
68708278a5eSRod Evans 	MSG_REJ_PLATCAP,	/* MSG_INTL(MSG_REJ_PLATCAP) */
68808278a5eSRod Evans 	MSG_REJ_HWCAP_2		/* MSG_INTL(MSG_REJ_HWCAP_2) */
6897c478bd9Sstevel@tonic-gate };
6907c478bd9Sstevel@tonic-gate 
6917c478bd9Sstevel@tonic-gate void
Dbg_file_rejected(Lm_list * lml,Rej_desc * rej,Half mach)692ba2be530Sab196087 Dbg_file_rejected(Lm_list *lml, Rej_desc *rej, Half mach)
6937c478bd9Sstevel@tonic-gate {
694de777a60Sab196087 	Conv_reject_desc_buf_t rej_buf;
695de777a60Sab196087 
6965aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
6977c478bd9Sstevel@tonic-gate 		return;
6987c478bd9Sstevel@tonic-gate 
6995aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
7005aefb655Srie 	dbg_print(lml, MSG_INTL(reject[rej->rej_type]), rej->rej_name ?
701de777a60Sab196087 	    rej->rej_name : MSG_INTL(MSG_STR_UNKNOWN),
702ba2be530Sab196087 	    conv_reject_desc(rej, &rej_buf, mach));
7035aefb655Srie 	Dbg_util_nl(lml, DBG_NL_STD);
7047c478bd9Sstevel@tonic-gate }
7057c478bd9Sstevel@tonic-gate 
7067c478bd9Sstevel@tonic-gate void
Dbg_file_reuse(Lm_list * lml,const char * nname,const char * oname)7075aefb655Srie Dbg_file_reuse(Lm_list *lml, const char *nname, const char *oname)
7087c478bd9Sstevel@tonic-gate {
7095aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
7107c478bd9Sstevel@tonic-gate 		return;
7117c478bd9Sstevel@tonic-gate 
712dc0f59e5SAli Bahrami 	Dbg_util_nl(lml, DBG_NL_STD);
7135aefb655Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_REUSE), nname, oname);
7147c478bd9Sstevel@tonic-gate }
7157c478bd9Sstevel@tonic-gate 
7167c478bd9Sstevel@tonic-gate void
Dbg_file_skip(Lm_list * lml,const char * oname,const char * nname)7175aefb655Srie Dbg_file_skip(Lm_list *lml, const char *oname, const char *nname)
7187c478bd9Sstevel@tonic-gate {
7195aefb655Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
7207c478bd9Sstevel@tonic-gate 		return;
7217c478bd9Sstevel@tonic-gate 
7225aefb655Srie 	if (oname && strcmp(nname, oname))
7235aefb655Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_SKIP_1), nname, oname);
7245aefb655Srie 	else
7255aefb655Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_SKIP_2), nname);
7267c478bd9Sstevel@tonic-gate }
7273906e0c2Srie 
7283906e0c2Srie void
Dbg_file_modified(Lm_list * lml,const char * obj,const char * oname,const char * nname,int ofd,int nfd,Elf * oelf,Elf * nelf)7293906e0c2Srie Dbg_file_modified(Lm_list *lml, const char *obj, const char *oname,
7303906e0c2Srie     const char *nname, int ofd, int nfd, Elf *oelf, Elf *nelf)
7313906e0c2Srie {
7323906e0c2Srie 	const char	*str;
7333906e0c2Srie 
7343906e0c2Srie 	if (DBG_NOTCLASS(DBG_C_FILES | DBG_C_SUPPORT))
7353906e0c2Srie 		return;
7363906e0c2Srie 	if (DBG_NOTDETAIL())
7373906e0c2Srie 		return;
7383906e0c2Srie 
7393906e0c2Srie 	Dbg_util_nl(lml, DBG_NL_STD);
7403906e0c2Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_MODIFIED), oname, obj);
7413906e0c2Srie 
7423906e0c2Srie 	if (nname != oname)
7433906e0c2Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_NAMECHANGE), nname);
7443906e0c2Srie 	if (nfd != ofd) {
7453906e0c2Srie 		if (nfd == -1)
7463906e0c2Srie 			str = MSG_INTL(MSG_FIL_IGNORE);
7473906e0c2Srie 		else
7483906e0c2Srie 			str = MSG_ORIG(MSG_STR_EMPTY);
7493906e0c2Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_FDCHANGE), ofd, nfd, str);
7503906e0c2Srie 	}
7513906e0c2Srie 	if (nelf != oelf) {
7523906e0c2Srie 		if (nelf == 0)
7533906e0c2Srie 			str = MSG_INTL(MSG_FIL_IGNORE);
7543906e0c2Srie 		else
7553906e0c2Srie 			str = MSG_ORIG(MSG_STR_EMPTY);
7563906e0c2Srie 		dbg_print(lml, MSG_INTL(MSG_FIL_ELFCHANGE), EC_NATPTR(oelf),
7573906e0c2Srie 		    EC_NATPTR(nelf), str);
7583906e0c2Srie 	}
7593906e0c2Srie 	Dbg_util_nl(lml, DBG_NL_STD);
7603906e0c2Srie }
76102ca3e02Srie 
76202ca3e02Srie void
Dbg_file_cleanup(Lm_list * lml,const char * name,Aliste lmco)76302ca3e02Srie Dbg_file_cleanup(Lm_list *lml, const char *name, Aliste lmco)
76402ca3e02Srie {
76502ca3e02Srie 	if (DBG_NOTCLASS(DBG_C_FILES))
76602ca3e02Srie 		return;
76702ca3e02Srie 
76802ca3e02Srie 	Dbg_util_nl(lml, DBG_NL_STD);
76902ca3e02Srie 	dbg_print(lml, MSG_INTL(MSG_FIL_CLEANUP), name, EC_XWORD(lmco));
77002ca3e02Srie }
771