xref: /titanic_44/usr/src/cmd/sgs/liblddbg/common/syms.c (revision 8339b41da2395f0525c46ceedfeb01961893ec44)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 #include	<stdio.h>
27 #include	"msg.h"
28 #include	"_debug.h"
29 #include	"libld.h"
30 
31 #if	!(defined(_ELF64))
32 
33 void
34 Dbg_syms_lookup_aout(Lm_list *lml, const char *name)
35 {
36 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
37 		return;
38 
39 	dbg_print(lml, MSG_INTL(MSG_SYM_AOUT), Dbg_demangle_name(name));
40 }
41 
42 #endif
43 
44 void
45 Dbg_syms_lookup(Rt_map *lmp, const char *name, const char *type)
46 {
47 	Lm_list	*lml = LIST(lmp);
48 
49 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
50 		return;
51 
52 	dbg_print(lml, MSG_INTL(MSG_SYM_LOOKUP), Dbg_demangle_name(name),
53 	    NAME(lmp), type);
54 }
55 
56 static	const Msg captype[DBG_CAP_MACH + 1] = {
57 	MSG_CAP_SYM_DEFAULT,		/* MSG_INTL(MSG_CAP_SYM_DEFAULT) */
58 	MSG_CAP_SYM_USED,		/* MSG_INTL(MSG_CAP_SYM_USED) */
59 	MSG_CAP_SYM_CANDIDATE,		/* MSG_INTL(MSG_CAP_SYM_CANDIDATE) */
60 	MSG_CAP_SYM_REJECTED,		/* MSG_INTL(MSG_CAP_SYM_REJECTED) */
61 	MSG_CAP_SYM_HW_1,		/* MSG_INTL(MSG_CAP_SYM_HW_1) */
62 	MSG_CAP_SYM_SF_1,		/* MSG_INTL(MSG_CAP_SYM_SF_1) */
63 	MSG_CAP_SYM_HW_2,		/* MSG_INTL(MSG_CAP_SYM_HW_2) */
64 	MSG_CAP_SYM_PLAT,		/* MSG_INTL(MSG_CAP_SYM_PLAT) */
65 	MSG_CAP_SYM_MACH		/* MSG_INTL(MSG_CAP_SYM_MACH) */
66 };
67 
68 void
69 Dbg_syms_cap_lookup(Rt_map *lmp, uint_t type, const char *name, uint_t ndx,
70     Half mach, Syscapset *scapset)
71 {
72 	Lm_list			*lml = LIST(lmp);
73 	const char		*str = NULL;
74 	Conv_cap_val_buf_t	cap_val_buf;
75 
76 	if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_SYMBOLS))
77 		return;
78 
79 	switch (type) {
80 	case DBG_CAP_HW_1:
81 		str = conv_cap_val_hw1(scapset->sc_hw_1, mach, 0,
82 		    &cap_val_buf.cap_val_hw1_buf);
83 		break;
84 	case DBG_CAP_SF_1:
85 		str = conv_cap_val_sf1(scapset->sc_sf_1, mach, 0,
86 		    &cap_val_buf.cap_val_sf1_buf);
87 		break;
88 	case DBG_CAP_HW_2:
89 		str = conv_cap_val_hw2(scapset->sc_hw_2, mach, 0,
90 		    &cap_val_buf.cap_val_hw2_buf);
91 		break;
92 	case DBG_CAP_MACH:
93 		str = scapset->sc_mach;
94 		break;
95 	case DBG_CAP_PLAT:
96 		str = scapset->sc_plat;
97 		break;
98 	}
99 
100 	dbg_print(lml, MSG_INTL(captype[type]), Dbg_demangle_name(name),
101 	    ndx, str);
102 }
103 
104 void
105 Dbg_syms_ignore_gnuver(Rt_map *lmp, const char *name, Word symndx,
106     Versym verndx)
107 {
108 	Lm_list	*lml = LIST(lmp);
109 
110 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
111 		return;
112 
113 	dbg_print(lml, MSG_INTL(MSG_SYM_IGNGNUVER), Dbg_demangle_name(name),
114 	    EC_WORD(symndx), EC_HALF(verndx), NAME(lmp));
115 }
116 
117 void
118 Dbg_syms_lazy_rescan(Lm_list *lml, const char *name)
119 {
120 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_FILES))
121 		return;
122 
123 	Dbg_util_nl(lml, DBG_NL_STD);
124 	dbg_print(lml, MSG_INTL(MSG_SYM_LAZY_RESCAN), Dbg_demangle_name(name));
125 }
126 
127 void
128 Dbg_syms_ar_title(Lm_list *lml, const char *file, Boolean again)
129 {
130 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
131 		return;
132 
133 	dbg_print(lml, MSG_INTL(MSG_SYM_AR_FILE), file,
134 	    again ? MSG_INTL(MSG_STR_AGAIN) : MSG_ORIG(MSG_STR_EMPTY));
135 }
136 
137 void
138 Dbg_syms_ar_skip(Lm_list *lml, const char *archive, Elf_Arsym *arsym)
139 {
140 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
141 		return;
142 
143 	dbg_print(lml, MSG_INTL(MSG_SYM_AR_SKIP), archive,
144 	    Dbg_demangle_name(arsym->as_name));
145 }
146 
147 void
148 Dbg_syms_ar_checking(Lm_list *lml, const char *fname, const char *objname,
149     Elf_Arsym *arsym)
150 {
151 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
152 		return;
153 
154 	dbg_print(lml, MSG_INTL(MSG_SYM_AR_CHECK), fname, objname,
155 	    Dbg_demangle_name(arsym->as_name));
156 }
157 
158 void
159 Dbg_syms_ar_resolve(Lm_list *lml, const char *fname, const char *objname,
160     Elf_Arsym *arsym)
161 {
162 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
163 		return;
164 
165 	dbg_print(lml, MSG_INTL(MSG_SYM_AR_RESOLVE), fname, objname,
166 	    Dbg_demangle_name(arsym->as_name));
167 }
168 
169 void
170 Dbg_syms_ar_force(Lm_list *lml, const char *fname, const char *objname)
171 {
172 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
173 		return;
174 
175 	dbg_print(lml, MSG_INTL(MSG_SYM_AR_FORCE), fname, objname);
176 }
177 
178 void
179 Dbg_syms_spec_title(Lm_list *lml)
180 {
181 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
182 		return;
183 
184 	Dbg_util_nl(lml, DBG_NL_STD);
185 	dbg_print(lml, MSG_INTL(MSG_SYM_SPECIAL));
186 }
187 
188 void
189 Dbg_syms_discarded(Lm_list *lml, Sym_desc *sdp)
190 {
191 	dbg_isec_name_buf_t	buf;
192 	char			*alloc_mem;
193 	const char		*file;
194 
195 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_UNUSED))
196 		return;
197 	if (DBG_NOTDETAIL())
198 		return;
199 
200 	if ((sdp->sd_file == NULL) || ((file = sdp->sd_file->ifl_name) == NULL))
201 		file = MSG_INTL(MSG_STR_UNKNOWN);
202 
203 	if (sdp->sd_isc) {
204 		dbg_print(lml, MSG_INTL(MSG_SYM_DISCARD_SEC),
205 		    Dbg_demangle_name(sdp->sd_name),
206 		    dbg_fmt_isec_name(sdp->sd_isc, buf, &alloc_mem), file);
207 		if (alloc_mem != NULL)
208 			free(alloc_mem);
209 	} else
210 		dbg_print(lml, MSG_INTL(MSG_SYM_DISCARD_FILE),
211 		    Dbg_demangle_name(sdp->sd_name), file);
212 }
213 
214 void
215 Dbg_syms_dup_discarded(Lm_list *lml, Word ndx, Sym_desc *sdp)
216 {
217 	const char	*file;
218 
219 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_UNUSED))
220 		return;
221 	if (DBG_NOTDETAIL())
222 		return;
223 
224 	if ((sdp->sd_file == NULL) || ((file = sdp->sd_file->ifl_name) == NULL))
225 		file = MSG_INTL(MSG_STR_UNKNOWN);
226 
227 	dbg_print(lml, MSG_INTL(MSG_SYM_DISCARD_DUP), EC_WORD(ndx),
228 	    Dbg_demangle_name(sdp->sd_name), file);
229 }
230 
231 void
232 Dbg_syms_entered(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
233 {
234 	Conv_inv_buf_t	inv_buf;
235 	Lm_list		*lml = ofl->ofl_lml;
236 
237 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
238 		return;
239 	if (DBG_NOTDETAIL())
240 		return;
241 
242 	Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_ENTERED),
243 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, sym,
244 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
245 	    conv_def_tag(sdp->sd_ref, &inv_buf));
246 }
247 
248 void
249 Dbg_syms_process(Lm_list *lml, Ifl_desc *ifl)
250 {
251 	Conv_inv_buf_t	inv_buf;
252 
253 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
254 		return;
255 
256 	Dbg_util_nl(lml, DBG_NL_STD);
257 	dbg_print(lml, MSG_INTL(MSG_SYM_PROCESS), ifl->ifl_name,
258 	    conv_ehdr_type(ifl->ifl_ehdr->e_ident[EI_OSABI],
259 	    ifl->ifl_ehdr->e_type, 0, &inv_buf));
260 }
261 
262 void
263 Dbg_syms_entry(Lm_list *lml, Word ndx, Sym_desc *sdp)
264 {
265 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
266 		return;
267 
268 	dbg_print(lml, MSG_INTL(MSG_SYM_BASIC), EC_WORD(ndx),
269 	    Dbg_demangle_name(sdp->sd_name));
270 }
271 
272 void
273 Dbg_syms_global(Lm_list *lml, Word ndx, const char *name)
274 {
275 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
276 		return;
277 
278 	dbg_print(lml, MSG_INTL(MSG_SYM_ADDING), EC_WORD(ndx),
279 	    Dbg_demangle_name(name));
280 }
281 
282 void
283 Dbg_syms_cap_convert(Ofl_desc *ofl, Word ndx, const char *name, Sym *sym)
284 {
285 	if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_SYMBOLS))
286 		return;
287 
288 	dbg_print(ofl->ofl_lml, MSG_INTL(MSG_SYM_CAP_ORIG), EC_WORD(ndx),
289 	    Dbg_demangle_name(name));
290 
291 	if (DBG_NOTDETAIL())
292 		return;
293 
294 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
295 	    MSG_INTL(MSG_STR_ORIGINAL), ofl->ofl_dehdr->e_ident[EI_OSABI],
296 	    ofl->ofl_dehdr->e_machine, sym, 0, 0, NULL,
297 	    MSG_ORIG(MSG_STR_EMPTY));
298 }
299 
300 void
301 Dbg_syms_cap_local(Ofl_desc *ofl, Word ndx, const char *name, Sym *sym,
302     Sym_desc *sdp)
303 {
304 	Conv_inv_buf_t	inv_buf;
305 
306 	if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_SYMBOLS))
307 		return;
308 
309 	dbg_print(ofl->ofl_lml, MSG_INTL(MSG_SYM_CAP_LOCAL), EC_WORD(ndx),
310 	    Dbg_demangle_name(name));
311 
312 	if (DBG_NOTDETAIL())
313 		return;
314 
315 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
316 	    MSG_INTL(MSG_STR_ENTERED), ofl->ofl_dehdr->e_ident[EI_OSABI],
317 	    ofl->ofl_dehdr->e_machine, sym,
318 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
319 	    conv_def_tag(sdp->sd_ref, &inv_buf));
320 }
321 
322 void
323 Dbg_syms_wrap(Lm_list *lml, Word ndx, const char *orig_name, const char *name)
324 {
325 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
326 		return;
327 
328 	dbg_print(lml, MSG_INTL(MSG_SYM_WRAP), EC_WORD(ndx),
329 	    Dbg_demangle_name(orig_name), Dbg_demangle_name(name));
330 }
331 
332 void
333 Dbg_syms_sec_title(Lm_list *lml)
334 {
335 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
336 		return;
337 	if (DBG_NOTDETAIL())
338 		return;
339 
340 	Dbg_util_nl(lml, DBG_NL_STD);
341 	dbg_print(lml, MSG_INTL(MSG_SYM_INDEX));
342 }
343 
344 void
345 Dbg_syms_sec_entry(Lm_list *lml, Word ndx, Sg_desc *sgp, Os_desc *osp)
346 {
347 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
348 		return;
349 	if (DBG_NOTDETAIL())
350 		return;
351 
352 	dbg_print(lml, MSG_INTL(MSG_SYM_SECTION), EC_WORD(ndx), osp->os_name,
353 	    (*sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL)));
354 }
355 
356 void
357 Dbg_syms_up_title(Lm_list *lml)
358 {
359 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
360 		return;
361 	if (DBG_NOTDETAIL())
362 		return;
363 
364 	Dbg_util_nl(lml, DBG_NL_STD);
365 	dbg_print(lml, MSG_INTL(MSG_SYM_FINAL));
366 	Elf_syms_table_title(lml, ELF_DBG_LD);
367 }
368 
369 void
370 Dbg_syms_ignore(Ofl_desc *ofl, Sym_desc *sdp)
371 {
372 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
373 		return;
374 	if (DBG_NOTDETAIL())
375 		return;
376 
377 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_IGNORE),
378 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
379 	    sdp->sd_sym, 0, 0, NULL, MSG_INTL(MSG_STR_UNUSED));
380 }
381 
382 void
383 Dbg_syms_old(Ofl_desc *ofl, Sym_desc *sdp)
384 {
385 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
386 		return;
387 	if (DBG_NOTDETAIL())
388 		return;
389 
390 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
391 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
392 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
393 	    0, NULL, sdp->sd_name);
394 }
395 
396 void
397 Dbg_syms_new(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
398 {
399 	Conv_inv_buf_t	inv_buf;
400 
401 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
402 		return;
403 	if (DBG_NOTDETAIL())
404 		return;
405 
406 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
407 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, sym,
408 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
409 	    conv_def_tag(sdp->sd_ref, &inv_buf));
410 }
411 
412 void
413 Dbg_syms_updated(Ofl_desc *ofl, Sym_desc *sdp, const char *name)
414 {
415 	Conv_inv_buf_t	inv_buf;
416 	Lm_list		*lml = ofl->ofl_lml;
417 
418 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
419 		return;
420 
421 	dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE), name);
422 
423 	if (DBG_NOTDETAIL())
424 		return;
425 
426 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_STR_EMPTY),
427 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
428 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
429 	    conv_def_tag(sdp->sd_ref, &inv_buf));
430 }
431 
432 void
433 Dbg_syms_created(Lm_list *lml, const char *name)
434 {
435 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
436 		return;
437 
438 	dbg_print(lml, MSG_INTL(MSG_SYM_CREATE), Dbg_demangle_name(name));
439 }
440 
441 void
442 Dbg_syms_resolving(Ofl_desc *ofl, Word ndx, const char *name, int row,
443     int col, Sym *osym, Sym *nsym, Sym_desc *sdp, Ifl_desc *ifl)
444 {
445 	Lm_list	*lml = ofl->ofl_lml;
446 	uchar_t	osabi = ofl->ofl_dehdr->e_ident[EI_OSABI];
447 	Half	mach = ofl->ofl_dehdr->e_machine;
448 
449 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
450 		return;
451 
452 	dbg_print(lml, MSG_INTL(MSG_SYM_RESOLVING), EC_WORD(ndx),
453 	    Dbg_demangle_name(name), row, col);
454 
455 	if (DBG_NOTDETAIL())
456 		return;
457 
458 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
459 	    osabi, mach, osym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
460 	    0, NULL, sdp->sd_file->ifl_name);
461 
462 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
463 	    osabi, mach, nsym, 0, 0, NULL, ifl->ifl_name);
464 }
465 
466 void
467 Dbg_syms_resolved(Ofl_desc *ofl, Sym_desc *sdp)
468 {
469 	Conv_inv_buf_t	inv_buf;
470 
471 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
472 		return;
473 	if (DBG_NOTDETAIL())
474 		return;
475 
476 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
477 	    MSG_INTL(MSG_STR_RESOLVED), ofl->ofl_dehdr->e_ident[EI_OSABI],
478 	    ofl->ofl_dehdr->e_machine, sdp->sd_sym,
479 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
480 	    conv_def_tag(sdp->sd_ref, &inv_buf));
481 }
482 
483 void
484 Dbg_syms_reloc(Ofl_desc *ofl, Sym_desc *sdp)
485 {
486 	static Boolean	symbol_title = TRUE;
487 	Conv_inv_buf_t	inv_buf;
488 	Lm_list	*lml = ofl->ofl_lml;
489 
490 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
491 		return;
492 
493 	if (symbol_title) {
494 		Dbg_util_nl(lml, DBG_NL_STD);
495 		dbg_print(lml, MSG_INTL(MSG_SYM_BSS));
496 
497 		symbol_title = FALSE;
498 	}
499 	dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE),
500 	    Dbg_demangle_name(sdp->sd_name));
501 
502 	if (DBG_NOTDETAIL())
503 		return;
504 
505 	Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_COPY),
506 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
507 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
508 	    conv_def_tag(sdp->sd_ref, &inv_buf));
509 }
510 
511 void
512 Dbg_syms_reduce(Ofl_desc *ofl, int which, Sym_desc *sdp, int idx,
513     const char *sname)
514 {
515 	static Boolean	sym_reduce_title = TRUE;
516 	static Boolean	sym_retain_title = TRUE;
517 	Boolean		isfromglobal = (which == DBG_SYM_REDUCE_GLOBAL);
518 	Boolean		isfromretain = (which == DBG_SYM_REDUCE_RETAIN);
519 	Lm_list		*lml = ofl->ofl_lml;
520 
521 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_VERSIONS))
522 		return;
523 
524 	if (sym_reduce_title && isfromglobal) {
525 		sym_reduce_title = FALSE;
526 		Dbg_util_nl(lml, DBG_NL_STD);
527 		dbg_print(lml, MSG_INTL(MSG_SYM_REDUCED));
528 	} else if (sym_retain_title && isfromretain) {
529 		sym_retain_title = FALSE;
530 		Dbg_util_nl(lml, DBG_NL_STD);
531 		dbg_print(lml, MSG_INTL(MSG_SYM_RETAINING));
532 	}
533 
534 	if ((sdp->sd_flags & FLG_SY_ELIM) && isfromglobal)
535 		dbg_print(lml, MSG_INTL(MSG_SYM_ELIMINATING),
536 		    Dbg_demangle_name(sdp->sd_name));
537 	else if (isfromglobal)
538 		dbg_print(lml, MSG_INTL(MSG_SYM_REDUCING),
539 		    Dbg_demangle_name(sdp->sd_name));
540 	else
541 		dbg_print(lml, MSG_INTL(MSG_SYM_NOTELIMINATE),
542 		    Dbg_demangle_name(sdp->sd_name), sname, idx);
543 
544 	if (DBG_NOTDETAIL())
545 		return;
546 
547 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_LOCAL),
548 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
549 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
550 	    sdp->sd_file->ifl_name);
551 }
552 
553 void
554 Dbg_syms_dup_sort_addr(Lm_list *lml, const char *secname, const char *symname1,
555     const char *symname2, Addr addr)
556 {
557 	if (DBG_NOTCLASS(DBG_C_SYMBOLS) || DBG_NOTDETAIL())
558 		return;
559 
560 	dbg_print(lml, MSG_INTL(MSG_SYM_DUPSORTADDR), secname,
561 	    symname1, symname2, EC_ADDR(addr));
562 }
563 
564 void
565 Dbg_syminfo_title(Lm_list *lml)
566 {
567 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
568 		return;
569 	if (DBG_NOTDETAIL())
570 		return;
571 
572 	Dbg_util_nl(lml, DBG_NL_STD);
573 	dbg_print(lml, MSG_INTL(MSG_SYMINFO_INFO));
574 	Elf_syminfo_title(lml);
575 }
576 
577 void
578 Dbg_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, Sym *sym,
579     const char *strtab, Dyn *dyn)
580 {
581 	const char	*needed;
582 
583 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
584 		return;
585 	if (DBG_NOTDETAIL())
586 		return;
587 
588 	if (sip->si_boundto < SYMINFO_BT_LOWRESERVE)
589 		needed = strtab + dyn[sip->si_boundto].d_un.d_val;
590 	else
591 		needed = 0;
592 
593 	Elf_syminfo_entry(lml, ndx, sip,
594 	    Dbg_demangle_name(strtab + sym->st_name), needed);
595 }
596 
597 /*
598  * Symbol table output can differ slightly depending on the caller.  However,
599  * the final diagnostic is maintained here so hat the various message strings
600  * remain consistent
601  *
602  * elfdump:   index    value       size     type bind oth ver shndx       name
603  * ld:                 value       size     type bind oth ver shndx
604  */
605 void
606 Elf_syms_table_title(Lm_list *lml, int caller)
607 {
608 	if (caller == ELF_DBG_ELFDUMP) {
609 		if (DBG_NOTLONG())
610 			dbg_print(lml, MSG_INTL(MSG_SYM_EFS_TITLE));
611 		else
612 			dbg_print(lml, MSG_INTL(MSG_SYM_EFL_TITLE));
613 		return;
614 	}
615 
616 	if (caller == ELF_DBG_LD) {
617 		if (DBG_NOTLONG())
618 			dbg_print(lml, MSG_INTL(MSG_SYM_LDS_TITLE));
619 		else
620 			dbg_print(lml, MSG_INTL(MSG_SYM_LDL_TITLE));
621 		return;
622 	}
623 }
624 
625 void
626 Elf_syms_table_entry(Lm_list *lml, int caller, const char *prestr,
627     uchar_t osabi, Half mach, Sym *sym, Versym verndx, int gnuver,
628     const char *sec, const char *poststr)
629 {
630 	Conv_inv_buf_t	inv_buf1, inv_buf2, inv_buf3;
631 	Conv_inv_buf_t	inv_buf4, inv_buf5, inv_buf6;
632 	uchar_t		type = ELF_ST_TYPE(sym->st_info);
633 	uchar_t		bind = ELF_ST_BIND(sym->st_info);
634 	const char	*msg;
635 
636 	if ((caller == ELF_DBG_ELFDUMP) ||
637 	    (caller == ELF_DBG_LD)) {
638 		if (DBG_NOTLONG())
639 			msg = MSG_INTL(MSG_SYM_EFS_ENTRY);
640 		else
641 			msg = MSG_INTL(MSG_SYM_EFL_ENTRY);
642 
643 		if (sec == NULL)
644 			sec = conv_sym_shndx(osabi, mach, sym->st_shndx,
645 			    CONV_FMT_DECIMAL, &inv_buf6);
646 
647 		dbg_print(lml, msg, prestr,
648 		    conv_sym_value(mach, type, sym->st_value, &inv_buf1),
649 		    sym->st_size, conv_sym_info_type(mach, type, 0, &inv_buf2),
650 		    conv_sym_info_bind(bind, 0, &inv_buf3),
651 		    conv_sym_other(sym->st_other, &inv_buf4),
652 		    conv_ver_index(verndx, gnuver, &inv_buf5),
653 		    sec, Elf_demangle_name(poststr));
654 	}
655 }
656 
657 void
658 Dbg_syms_cap_title(Ofl_desc *ofl)
659 {
660 	Lm_list	*lml = ofl->ofl_lml;
661 
662 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
663 		return;
664 	if (DBG_NOTDETAIL())
665 		return;
666 
667 	Dbg_util_nl(lml, DBG_NL_STD);
668 	dbg_print(lml, MSG_INTL(MSG_SYM_CAPABILITIES));
669 	Elf_syms_table_title(lml, ELF_DBG_LD);
670 }
671