Ejemplo n.º 1
0
void
Dbg_util_edge_in(Lm_list *lml, Rt_map *clmp, uint_t flags, Rt_map *dlmp,
    int ndx, int flag)
{
	const char	*str;

	if (DBG_NOTCLASS(DBG_C_INIT))
		return;
	if (DBG_NOTDETAIL())
		return;

	if (flag & RT_SORT_REV)
		str = MSG_ORIG(MSG_SCN_INIT);
	else
		str = MSG_ORIG(MSG_SCN_FINI);

	if ((clmp == 0) || (ectoggle == 0))
		Dbg_util_nl(lml, DBG_NL_STD);
	if (clmp == 0) {
		dbg_print(lml, MSG_INTL(MSG_UTL_EDGE_TITLE), str);
		dbg_print(lml, MSG_INTL(MSG_UTL_EDGE_START), ndx, NAME(dlmp));
	} else
		dbg_print(lml, MSG_INTL(MSG_UTL_EDGE_IN), ndx, NAME(dlmp),
		    NAME(clmp), conv_bnd_type(flags));

	ectoggle = 1;
}
Ejemplo n.º 2
0
void
Dbg_support_action(Lm_list *lml, const char *obj, const char *func,
    Support_ndx ndx, const char *name)
{
	const char	*str;

	if (DBG_NOTCLASS(DBG_C_SUPPORT))
		return;
	if (DBG_NOTDETAIL())
		return;

	if (ndx == LDS_START)
		str = MSG_INTL(MSG_SUP_OUTFILE);
	else if (ndx == LDS_FILE)
		str = MSG_INTL(MSG_SUP_INFILE);
	else if (ndx == LDS_INP_SECTION)
		str = MSG_INTL(MSG_SUP_INSEC);
	else if (ndx == LDS_SECTION)
		str = MSG_INTL(MSG_SUP_SEC);

	if ((ndx == LDS_ATEXIT) || (ndx == LDS_VERSION) ||
	    (ndx == LDS_INPUT_DONE))
		dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_1), func, obj);
	else
		dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_2), func, obj,
		    str, name);
}
Ejemplo n.º 3
0
void
Dbg_unused_sec(Lm_list *lml, Is_desc *isp)
{
	const char	*str;

	if (DBG_NOTCLASS(DBG_C_UNUSED))
		return;
	if (DBG_NOTDETAIL())
		return;

	/*
	 * If the file from which this section originates hasn't been referenced
	 * at all, skip this diagnostic, as it would have been covered under
	 * Dbg_unused_file() called from ignore_section_processing().
	 */
	if (isp->is_file &&
	    ((isp->is_file->ifl_flags & FLG_IF_FILEREF) == 0))
		return;

	if (isp->is_flags & FLG_IS_DISCARD)
		str = MSG_INTL(MSG_USD_SECDISCARD);
	else
		str = MSG_ORIG(MSG_STR_EMPTY);

	dbg_print(lml, MSG_INTL(MSG_USD_SEC), isp->is_basename,
	    EC_XWORD(isp->is_shdr->sh_size), isp->is_file->ifl_name, str);
}
Ejemplo n.º 4
0
void
Dbg_util_scc_entry(Rt_map *lmp, uint_t idx)
{
	if (DBG_NOTCLASS(DBG_C_INIT))
		return;
	if (DBG_NOTDETAIL())
		return;

	dbg_print(LIST(lmp), MSG_ORIG(MSG_UTL_SCC_ENTRY), idx, NAME(lmp));
}
Ejemplo n.º 5
0
void
Dbg_unused_unref(Rt_map *lmp, const char *depend)
{
	if (DBG_NOTCLASS(DBG_C_UNUSED))
		return;
	if (DBG_NOTDETAIL())
		return;

	dbg_print(LIST(lmp), MSG_INTL(MSG_USD_UNREF), NAME(lmp), depend);
}
Ejemplo n.º 6
0
void
Dbg_util_edge_out(Rt_map *clmp, Rt_map *dlmp)
{
	if (DBG_NOTCLASS(DBG_C_INIT))
		return;
	if (DBG_NOTDETAIL())
		return;

	dbg_print(LIST(clmp), MSG_INTL(MSG_UTL_EDGE_OUT), SORTVAL(clmp),
	    NAME(clmp), NAME(dlmp));
}
Ejemplo n.º 7
0
void
Dbg_sec_strtab(Lm_list *lml, Os_desc *osp, Str_tbl *stp)
{
	uint_t	cnt;

	if (DBG_NOTCLASS(DBG_C_STRTAB))
		return;

	if (!osp)
		return;

	Dbg_util_nl(lml, DBG_NL_STD);
	if (stp->st_flags & FLG_STTAB_COMPRESS)
		dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_COMP), osp->os_name,
		    EC_XWORD(stp->st_fullstrsize), EC_XWORD(stp->st_strsize));
	else
		dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_STND), osp->os_name,
		    EC_XWORD(stp->st_fullstrsize));

	if ((DBG_NOTDETAIL()) ||
	    ((stp->st_flags & FLG_STTAB_COMPRESS) == 0))
		return;

	dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
	dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_HD), osp->os_name,
	    stp->st_hbckcnt);

	for (cnt = 0; cnt < stp->st_hbckcnt; cnt++) {
		Str_hash	*strhash = stp->st_hashbcks[cnt];

		if (strhash == NULL)
			continue;

		dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_BCKT), cnt);

		while (strhash) {
			size_t	stroff = strhash->hi_mstr->sm_strlen -
			    strhash->hi_strlen;

			if (stroff == 0) {
				dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_MSTR),
				    EC_XWORD(strhash->hi_refcnt),
				    strhash->hi_mstr->sm_str);
			} else {
				dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_SUFSTR),
				    EC_XWORD(strhash->hi_refcnt),
				    &strhash->hi_mstr->sm_str[stroff],
				    strhash->hi_mstr->sm_str);
			}

			strhash = strhash->hi_next;
		}
	}
}
Ejemplo n.º 8
0
void
Dbg_move_expand(Lm_list *lml, Move *mv, Addr addr)
{
	if (DBG_NOTCLASS(DBG_C_MOVE))
		return;
	if (DBG_NOTDETAIL())
		return;

	dbg_print(lml, MSG_INTL(MSG_MOVE_EXPAND), EC_ADDR(addr),
	    EC_LWORD(mv->m_value));
}
Ejemplo n.º 9
0
void
Dbg_move_adjexpandreloc(Lm_list *lml, Xword offset, const char *name)
{
	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
		return;
	if (DBG_NOTDETAIL())
		return;

	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJEXPAND), Dbg_demangle_name(name),
	    EC_XWORD(offset));
}
Ejemplo n.º 10
0
void
Dbg_move_outsctadj(Lm_list *lml, Sym_desc *sdp)
{
	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
		return;
	if (DBG_NOTDETAIL())
		return;

	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTSCTADJ),
	    Dbg_demangle_name(sdp->sd_name));
}
Ejemplo n.º 11
0
void
Dbg_move_outmove(Lm_list *lml, const char *name)
{
	if (DBG_NOTCLASS(DBG_C_MOVE))
		return;
	if (DBG_NOTDETAIL())
		return;

	Dbg_util_nl(lml, DBG_NL_STD);
	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTMOVE), name);
	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
}
Ejemplo n.º 12
0
void
Dbg_move_parexpn(Lm_list *lml, const char *name, const char *reason)
{
	if (DBG_NOTCLASS(DBG_C_MOVE))
		return;
	if (DBG_NOTDETAIL())
		return;

	Dbg_util_nl(lml, DBG_NL_STD);
	dbg_print(lml, MSG_INTL(MSG_MOVE_PAREXPN), name, reason);
	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
}
Ejemplo n.º 13
0
void
Dbg_move_data(Rt_map *lmp)
{
	Lm_list	*lml = LIST(lmp);

	if (DBG_NOTCLASS(DBG_C_MOVE))
		return;
	if (DBG_NOTDETAIL())
		return;

	dbg_print(lml, MSG_INTL(MSG_MOVE_FILE), NAME(lmp));
	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE2));
}
Ejemplo n.º 14
0
void
Dbg_util_broadcast(Rt_map *lmp)
{
	Lm_list	*lml = LIST(lmp);

	if (DBG_NOTCLASS(DBG_C_INIT))
		return;
	if (DBG_NOTDETAIL())
		return;

	Dbg_util_nl(lml, DBG_NL_STD);
	dbg_print(lml, MSG_INTL(MSG_UTL_BROAD), NAME(lmp));
	Dbg_util_nl(lml, DBG_NL_STD);
}
Ejemplo n.º 15
0
void
Dbg_sec_strtab(Lm_list *lml, Os_desc *osp, Str_tbl *stp)
{
	uint_t	i;

	if (DBG_NOTCLASS(DBG_C_STRTAB))
		return;

	if (!osp)
		return;

	Dbg_util_nl(lml, DBG_NL_STD);
	if (stp->st_flags & FLG_STTAB_COMPRESS)
		dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_COMP), osp->os_name,
		    stp->st_fullstringsize, stp->st_stringsize);
	else
		dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_STND), osp->os_name,
		    stp->st_fullstringsize);

	if ((DBG_NOTDETAIL()) ||
	    ((stp->st_flags & FLG_STTAB_COMPRESS) == 0))
		return;

	dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
	dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_HD), osp->os_name,
	    stp->st_hbckcnt);

	for (i = 0; i < stp->st_hbckcnt; i++) {
		Str_hash	*sthash;

		dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_BCKT), i);

		for (sthash = stp->st_hashbcks[i]; sthash;
		    sthash = sthash->hi_next) {
			uint_t	stroff = sthash->hi_mstr->sm_stlen -
			    sthash->hi_stlen;

			if (stroff == 0) {
				dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_MSTR),
				    sthash->hi_refcnt, sthash->hi_mstr->sm_str);
			} else {
				dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_SUFSTR),
				    sthash->hi_refcnt,
				    &sthash->hi_mstr->sm_str[stroff],
				    sthash->hi_mstr->sm_str);
			}
		}

	}
}
Ejemplo n.º 16
0
void
Dbg_util_dbnotify(Lm_list *lml, rd_event_e event, r_state_e state)
{
	const char	*estr;
	const char	*sstr;

	if (DBG_NOTCLASS(DBG_C_FILES))
		return;
	if (DBG_NOTDETAIL())
		return;

	switch (event) {
	case RD_PREINIT:
		estr = MSG_ORIG(MSG_UTL_EVNT_PREINIT);
		sstr = MSG_INTL(MSG_STR_NULL);
		break;
	case RD_POSTINIT:
		estr = MSG_ORIG(MSG_UTL_EVNT_POSTINIT);
		sstr = MSG_INTL(MSG_STR_NULL);
		break;
	case RD_DLACTIVITY:
		estr = MSG_ORIG(MSG_UTL_EVNT_DLACT);
		switch (state) {
		case RT_CONSISTENT:
			sstr = MSG_ORIG(MSG_UTL_STA_CONSIST);
			break;
		case RT_ADD:
			sstr = MSG_ORIG(MSG_UTL_STA_ADD);
			break;
		case RT_DELETE:
			sstr = MSG_ORIG(MSG_UTL_STA_DELETE);
			break;
		default:
			sstr = MSG_INTL(MSG_STR_NULL);
			break;
		}
		break;
	default:
		sstr = MSG_INTL(MSG_STR_NULL);
		estr = MSG_INTL(MSG_STR_UNKNOWN);
		break;
	}

	Dbg_util_nl(lml, DBG_NL_STD);
	dbg_print(lml, MSG_INTL(MSG_UTL_DBNOTIFY), estr, sstr);
	Dbg_util_nl(lml, DBG_NL_STD);
}
Ejemplo n.º 17
0
void
Dbg_sec_order_error(Lm_list *lml, Ifl_desc *ifl, Word ndx, int error)
{
	if (DBG_NOTCLASS(DBG_C_SECTIONS))
		return;
	if (DBG_NOTDETAIL())
		return;

	if (error == 0)
		return;

	dbg_print(lml, MSG_INTL(MSG_ORD_ERR_TITLE),
	    ifl->ifl_isdesc[ndx]->is_name, ifl->ifl_name);

	if (error)
		dbg_print(lml, MSG_INTL(order_errors[error - 1]));
}
Ejemplo n.º 18
0
void
Dbg_util_lcinterface(Rt_map *lmp, int tag, char *val)
{
	const char	*str;
	static char	string[CONV_INV_STRSIZE];

	if (DBG_NOTDETAIL())
		return;

	if (tag < CI_MAX)
		str = MSG_ORIG(tags[tag]);
	else
		str = conv_invalid_val(string, CONV_INV_STRSIZE, tag, 0);

	dbg_print(LIST(lmp), MSG_INTL(MSG_UTL_LCINTERFACE), NAME(lmp), str,
	    EC_NATPTR(val));
}
Ejemplo n.º 19
0
void
Dbg_move_entry1(Lm_list *lml, int which, Move *mv, Sym_desc *s)
{
	const char *str;

	if (DBG_NOTCLASS(DBG_C_MOVE))
		return;
	if (DBG_NOTDETAIL())
		return;

	if (which)
		str = MSG_INTL(MSG_MOVE_ENTRYIN);
	else
		str = MSG_INTL(MSG_MOVE_ENTRYOUT);

	dbg_print(lml, str, EC_XWORD(mv->m_poffset), EC_LWORD(mv->m_value),
	    mv->m_repeat, mv->m_stride, s->sd_name);
}
Ejemplo n.º 20
0
void
Dbg_move_entry2(Lm_list *lml, Move *mv, Word st_name, const char *name)
{
	const char *sname;

	if (DBG_NOTCLASS(DBG_C_MOVE))
		return;
	if (DBG_NOTDETAIL())
		return;

	if (st_name)
		sname = name;
	else
		sname = MSG_INTL(MSG_STR_UNKNOWN);

	dbg_print(lml, MSG_INTL(MSG_MOVE_ENTRYIN), EC_XWORD(mv->m_poffset),
	    EC_LWORD(mv->m_value), mv->m_repeat, mv->m_stride, sname);
}
Ejemplo n.º 21
0
void
Dbg_util_scc_title(Lm_list *lml, int sec)
{
	const char	*_sec;

	if (DBG_NOTCLASS(DBG_C_INIT))
		return;
	if (DBG_NOTDETAIL())
		return;

	if (sec)
		_sec = MSG_INTL(MSG_UTL_SCC_SUBI);
	else
		_sec = MSG_INTL(MSG_UTL_SCC_SUBF);

	Dbg_util_nl(lml, DBG_NL_STD);
	dbg_print(lml, MSG_INTL(MSG_UTL_SCC_TITLE), _sec);
}
Ejemplo n.º 22
0
void
Dbg_audit_symval(Lm_list *lml, const char *lib, const char *func,
    const char *sym, Addr pval, Addr nval)
{
	char	mesg[100];

	if (DBG_NOTCLASS(DBG_C_AUDITING))
		return;
	if (DBG_NOTDETAIL())
		return;

	if (pval == nval)
		mesg[0] = '\0';
	else
		(void) sprintf(mesg, MSG_INTL(MSG_AUD_SYMNEW), EC_XWORD(nval));

	dbg_print(lml, MSG_INTL(MSG_AUD_SYM), lib, func, Dbg_demangle_name(sym),
	    EC_XWORD(pval), mesg);
}
Ejemplo n.º 23
0
void
Dbg_util_wait(Rt_map *clmp, Rt_map *dlmp, int what)
{
	Lm_list		*lml = LIST(clmp);
	const char	*str;

	if (DBG_NOTCLASS(DBG_C_INIT))
		return;
	if (DBG_NOTDETAIL())
		return;

	if (what == DBG_WAIT_INIT)
		str = MSG_ORIG(MSG_SCN_INIT);
	else if (what == DBG_WAIT_FINI)
		str = MSG_ORIG(MSG_SCN_FINI);
	else
		str = MSG_INTL(MSG_STR_SYMBOL);

	Dbg_util_nl(lml, DBG_NL_STD);
	dbg_print(lml, MSG_INTL(MSG_UTL_WAIT), str, NAME(clmp), NAME(dlmp));
	Dbg_util_nl(lml, DBG_NL_STD);
}
Ejemplo n.º 24
0
void
Dbg_util_collect(Rt_map *lmp, int ndx, int flag)
{
	Lm_list		*lml = LIST(lmp);
	const char	*str;

	if (DBG_NOTCLASS(DBG_C_INIT))
		return;
	if (DBG_NOTDETAIL())
		return;

	if (flag & RT_SORT_REV)
		str = MSG_ORIG(MSG_SCN_INIT);
	else
		str = MSG_ORIG(MSG_SCN_FINI);

	if (ectoggle == 1) {
		Dbg_util_nl(lml, DBG_NL_STD);
		ectoggle = 0;
	}
	dbg_print(lml, MSG_INTL(MSG_UTL_COLLECT), ndx, NAME(lmp), str);
}
Ejemplo n.º 25
0
void
Dbg_got_display(Ofl_desc *ofl, Off goff, int stage,
    Word m_got_xnumber, size_t m_got_entsize)
{
	Lm_list		*lml = ofl->ofl_lml;
	Gottable	*gtp = ofl->ofl_gottable;
	Word		gotndx;
	Xword		*gptr;

	if (DBG_NOTCLASS(DBG_C_GOT))
		return;

	if (ofl->ofl_gotcnt == m_got_xnumber)
		return;

	Dbg_util_nl(lml, DBG_NL_STD);
	dbg_print(lml, MSG_INTL(MSG_GOT_INFO), EC_WORD(ofl->ofl_gotcnt));

	if (DBG_NOTDETAIL())
		return;

	qsort((char *)gtp, ofl->ofl_gotcnt, sizeof (Gottable),
	    (int(*)(const void *, const void *))Dbg_got_compare);

	if (stage == 0)
		dbg_print(lml, MSG_INTL(MSG_GOT_COLUMNS1));
	else
		dbg_print(lml, MSG_INTL(MSG_GOT_COLUMNS2));

	gptr = (Xword *)ofl->ofl_osgot->os_outdata->d_buf;

	for (gotndx = 0; gotndx < ofl->ofl_gotcnt; gotndx++, gtp++, gptr++) {
		Sym_desc	*sdp = gtp->gt_sym;
		const char	*refstr, *name;
		Gotndx		*gnp = &gtp->gt_gndx;
		Lword		gotaddval;
		Off		off = goff + (gotndx * m_got_entsize);
		char		index[INDEX_STR_SIZE];

		(void) snprintf(index, INDEX_STR_SIZE, MSG_ORIG(MSG_GOT_INDEX),
		    EC_SWORD(gnp->gn_gotndx));

		if (sdp == 0)
			refstr = MSG_ORIG(MSG_STR_EMPTY);
		else if (sdp->sd_flags & FLG_SY_SMGOT)
			refstr = MSG_ORIG(MSG_GOT_SMALL_PIC);
		else
			refstr = MSG_ORIG(MSG_GOT_BIG_PIC);

		if (sdp == 0)
			name = MSG_ORIG(MSG_STR_EMPTY);
		else if (sdp->sd_name)
			name = Dbg_demangle_name(sdp->sd_name);
		else
			name = MSG_INTL(MSG_STR_UNKNOWN);

		if (stage == 0)
			gotaddval = gnp->gn_addend;
		else
			gotaddval = *gptr;

		if ((sdp == 0) || (sdp->sd_sym->st_shndx == SHN_UNDEF) ||
		    (sdp->sd_file == 0)) {
			dbg_print(lml, MSG_INTL(MSG_GOT_FORMAT1), index,
			    refstr, EC_OFF(off), EC_XWORD(gotaddval), name);
		} else {
			dbg_print(lml, MSG_INTL(MSG_GOT_FORMAT2), index,
			    refstr, EC_OFF(off), EC_XWORD(gotaddval),
			    sdp->sd_file->ifl_name, name);
		}
	}
}
Ejemplo n.º 26
0
void
Dbg_sec_order_list(Ofl_desc *ofl, int flag)
{
	Os_desc		*osp;
	Is_desc		*isp1;
	Aliste		idx1;
	Lm_list		*lml = ofl->ofl_lml;
	const char	*str;

	if (DBG_NOTCLASS(DBG_C_SECTIONS))
		return;
	if (DBG_NOTDETAIL())
		return;

	Dbg_util_nl(lml, DBG_NL_STD);

	/*
	 * If the flag == 0, then the routine is called before sorting.
	 */
	if (flag == 0)
		str = MSG_INTL(MSG_ORD_SORT_BEFORE);
	else
		str = MSG_INTL(MSG_ORD_SORT_AFTER);

	for (APLIST_TRAVERSE(ofl->ofl_ordered, idx1, osp)) {
		int		os_isdescs_idx;
		Aliste		idx2;

		Dbg_util_nl(lml, DBG_NL_STD);
		dbg_print(lml, str, osp->os_name);
		dbg_print(lml, MSG_INTL(MSG_ORD_HDR_1),
		    EC_WORD(aplist_nitems(osp->os_isdescs[OS_ISD_BEFORE])),
		    EC_WORD(aplist_nitems(osp->os_isdescs[OS_ISD_ORDERED])),
		    EC_WORD(aplist_nitems(osp->os_isdescs[OS_ISD_DEFAULT])),
		    EC_WORD(aplist_nitems(osp->os_isdescs[OS_ISD_AFTER])));

		OS_ISDESCS_TRAVERSE(os_isdescs_idx, osp, idx2, isp1) {
			dbg_isec_name_buf_t	buf;
			char			*alloc_mem;
			const char		*isp1_str;
			Word			link;
			Ifl_desc		*ifl = isp1->is_file;
			Is_desc			*isp2;
			const char		*msg;

			/*
			 * An output segment that requires ordering might have
			 * as little as two sorted input sections.  For example,
			 * the crt's can provide a SHN_BEGIN and SHN_AFTER, and
			 * only these two sections must be processed.  Thus, if
			 * a input section is unordered, move on.  Diagnosing
			 * any unsorted section can produce way too much noise.
			 */
			if ((isp1->is_flags & FLG_IS_ORDERED) == 0)
				continue;

			if (isp1->is_shdr->sh_flags & SHF_ORDERED) {
				link = isp1->is_shdr->sh_info;
				msg = MSG_ORIG(MSG_SH_INFO);
			} else {	/* SHF_LINK_ORDER */
				link = isp1->is_shdr->sh_link;
				msg = MSG_ORIG(MSG_SH_LINK);
			}

			isp1_str = dbg_fmt_isec_name(isp1, buf, &alloc_mem);

			if (link == SHN_BEFORE) {
				dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_1), msg,
				    isp1_str, isp1->is_file->ifl_name);
			} else if (link == SHN_AFTER) {
				dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_2), msg,
				    isp1_str, isp1->is_file->ifl_name);
			} else {
				isp2 = ifl->ifl_isdesc[link];
				dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_3),
				    EC_WORD(isp2->is_keyident), isp1_str,
				    ifl->ifl_name, msg, isp2->is_name);
			}
			if (alloc_mem != NULL)
				free(alloc_mem);
		}
	}
Ejemplo n.º 27
0
void
Dbg_sec_order_list(Ofl_desc *ofl, int flag)
{
	Os_desc		*osp;
	Is_desc		*isp1;
	Listnode	*lnp1, *lnp2;
	Lm_list		*lml = ofl->ofl_lml;
	const char	*str;

	if (DBG_NOTCLASS(DBG_C_SECTIONS))
		return;
	if (DBG_NOTDETAIL())
		return;

	Dbg_util_nl(lml, DBG_NL_STD);

	/*
	 * If the flag == 0, then the routine is called before sorting.
	 */
	if (flag == 0)
		str = MSG_INTL(MSG_ORD_SORT_BEFORE);
	else
		str = MSG_INTL(MSG_ORD_SORT_AFTER);

	for (LIST_TRAVERSE(&ofl->ofl_ordered, lnp1, osp)) {
		Sort_desc	*sort = osp->os_sort;

		dbg_print(lml, str, osp->os_name);
		dbg_print(lml, MSG_INTL(MSG_ORD_HDR_1),
		    EC_WORD(sort->st_beforecnt), EC_WORD(sort->st_aftercnt),
		    EC_WORD(sort->st_ordercnt));

		for (LIST_TRAVERSE(&osp->os_isdescs, lnp2, isp1)) {
			Word		link;
			Ifl_desc	*ifl = isp1->is_file;
			Is_desc		*isp2;
			const char	*msg;

			if ((isp1->is_flags & FLG_IS_ORDERED) == 0) {
				dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_0),
				    isp1->is_name, isp1->is_file->ifl_name);
				continue;
			}

			if (isp1->is_shdr->sh_flags & SHF_ORDERED) {
				link = isp1->is_shdr->sh_info;
				msg = MSG_ORIG(MSG_SH_INFO);
			} else {
				/* SHF_LINK_ORDER */
				link = isp1->is_shdr->sh_link;
				msg = MSG_ORIG(MSG_SH_LINK);
			}

			if (link == SHN_BEFORE) {
				dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_1),
				    isp1->is_name, isp1->is_file->ifl_name,
				    msg);
				continue;
			}

			if (link == SHN_AFTER) {
				dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_2),
				    isp1->is_name, isp1->is_file->ifl_name,
				    msg);
				continue;
			}

			isp2 = ifl->ifl_isdesc[link];
			dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_3),
			    isp1->is_name, ifl->ifl_name, msg, isp2->is_name,
			    isp2->is_key);
		}
	}
	Dbg_util_nl(lml, DBG_NL_STD);
}