xref: /illumos-gate/usr/src/cmd/sgs/liblddbg/common/syms.c (revision 07a48826732249fcd3aa8dd53c8389595e9f1fbc)
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 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #include	<stdio.h>
28 #include	<dlfcn.h>
29 #include	"msg.h"
30 #include	"_debug.h"
31 #include	"libld.h"
32 
33 #if	!(defined(_ELF64))
34 
35 void
36 Dbg_syms_lookup_aout(Lm_list *lml, const char *name)
37 {
38 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
39 		return;
40 
41 	dbg_print(lml, MSG_INTL(MSG_SYM_AOUT), Dbg_demangle_name(name));
42 }
43 
44 #endif
45 
46 void
47 Dbg_syms_lookup(Rt_map *lmp, const char *name, const char *type)
48 {
49 	Lm_list	*lml = LIST(lmp);
50 
51 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
52 		return;
53 
54 	dbg_print(lml, MSG_INTL(MSG_SYM_LOOKUP), Dbg_demangle_name(name),
55 	    NAME(lmp), type);
56 }
57 
58 void
59 Dbg_syms_ignore_gnuver(Rt_map *lmp, const char *name, Word symndx,
60     Versym verndx)
61 {
62 	Lm_list	*lml = LIST(lmp);
63 
64 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
65 		return;
66 
67 	dbg_print(lml, MSG_INTL(MSG_SYM_IGNGNUVER), Dbg_demangle_name(name),
68 	    EC_WORD(symndx), EC_HALF(verndx), NAME(lmp));
69 }
70 
71 void
72 Dbg_syms_dlsym(Rt_map *clmp, const char *sym, int *in_nfavl, const char *next,
73     int flag)
74 {
75 	const char	*str, *retry, *from = NAME(clmp);
76 	Lm_list		*lml = LIST(clmp);
77 
78 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
79 		return;
80 
81 	/*
82 	 * The core functionality of dlsym() can be called twice.  The first
83 	 * attempt can be affected by path names that exist in the "not-found"
84 	 * AVL tree.  Should a "not-found" path name be found, a second attempt
85 	 * is made to locate the required file (in_nfavl is NULL).  This fall-
86 	 * back provides for file system changes while a process executes.
87 	 */
88 	if (in_nfavl)
89 		retry = MSG_ORIG(MSG_STR_EMPTY);
90 	else
91 		retry = MSG_INTL(MSG_STR_RETRY);
92 
93 	switch (flag) {
94 	case DBG_DLSYM_NEXT:
95 		str = MSG_ORIG(MSG_SYM_NEXT);
96 		break;
97 	case DBG_DLSYM_DEFAULT:
98 		str = MSG_ORIG(MSG_SYM_DEFAULT);
99 		break;
100 	case DBG_DLSYM_SELF:
101 		str = MSG_ORIG(MSG_SYM_SELF);
102 		break;
103 	case DBG_DLSYM_PROBE:
104 		str = MSG_ORIG(MSG_SYM_PROBE);
105 		break;
106 	case DBG_DLSYM_SINGLETON:
107 		str = MSG_ORIG(MSG_SYM_SINGLETON);
108 		break;
109 	default:
110 		str = MSG_ORIG(MSG_STR_EMPTY);
111 	}
112 
113 	Dbg_util_nl(lml, DBG_NL_STD);
114 	if (next == 0)
115 		dbg_print(lml, MSG_INTL(MSG_SYM_DLSYM_1),
116 		    Dbg_demangle_name(sym), from, retry, str);
117 	else
118 		dbg_print(lml, MSG_INTL(MSG_SYM_DLSYM_2),
119 		    Dbg_demangle_name(sym), from, next, retry, str);
120 }
121 
122 void
123 Dbg_syms_lazy_rescan(Lm_list *lml, const char *name)
124 {
125 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_FILES))
126 		return;
127 
128 	Dbg_util_nl(lml, DBG_NL_STD);
129 	dbg_print(lml, MSG_INTL(MSG_SYM_LAZY_RESCAN), Dbg_demangle_name(name));
130 }
131 
132 void
133 Dbg_syms_ar_title(Lm_list *lml, const char *file, int again)
134 {
135 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
136 		return;
137 
138 	Dbg_util_nl(lml, DBG_NL_STD);
139 	dbg_print(lml, MSG_INTL(MSG_SYM_AR_FILE), file,
140 	    again ? MSG_INTL(MSG_STR_AGAIN) : MSG_ORIG(MSG_STR_EMPTY));
141 }
142 
143 void
144 Dbg_syms_ar_entry(Lm_list *lml, Xword ndx, Elf_Arsym *arsym)
145 {
146 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
147 		return;
148 
149 	dbg_print(lml, MSG_INTL(MSG_SYM_AR_ENTRY), EC_XWORD(ndx),
150 	    Dbg_demangle_name(arsym->as_name));
151 }
152 
153 void
154 Dbg_syms_ar_checking(Lm_list *lml, Xword ndx, Elf_Arsym *arsym,
155     const char *name)
156 {
157 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
158 		return;
159 
160 	dbg_print(lml, MSG_INTL(MSG_SYM_AR_CHECK), EC_XWORD(ndx),
161 	    Dbg_demangle_name(arsym->as_name), name);
162 }
163 
164 void
165 Dbg_syms_ar_resolve(Lm_list *lml, Xword ndx, Elf_Arsym *arsym,
166     const char *fname, int flag)
167 {
168 	const char	*fmt;
169 
170 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
171 		return;
172 
173 	if (flag)
174 		fmt = MSG_INTL(MSG_SYM_AR_FORCEDEXRT);
175 	else
176 		fmt = MSG_INTL(MSG_SYM_AR_RESOLVE);
177 
178 	dbg_print(lml, fmt, EC_XWORD(ndx), Dbg_demangle_name(arsym->as_name),
179 	    fname);
180 }
181 
182 void
183 Dbg_syms_spec_title(Lm_list *lml)
184 {
185 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
186 		return;
187 
188 	Dbg_util_nl(lml, DBG_NL_STD);
189 	dbg_print(lml, MSG_INTL(MSG_SYM_SPECIAL));
190 }
191 
192 void
193 Dbg_syms_discarded(Lm_list *lml, Sym_desc *sdp)
194 {
195 	dbg_isec_name_buf_t	buf;
196 	char			*alloc_mem;
197 	const char		*file;
198 
199 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_UNUSED))
200 		return;
201 	if (DBG_NOTDETAIL())
202 		return;
203 
204 	if ((sdp->sd_file == NULL) || ((file = sdp->sd_file->ifl_name) == NULL))
205 		file = MSG_INTL(MSG_STR_UNKNOWN);
206 
207 	if (sdp->sd_isc) {
208 		dbg_print(lml, MSG_INTL(MSG_SYM_DISCARD_SEC),
209 		    Dbg_demangle_name(sdp->sd_name),
210 		    dbg_fmt_isec_name(sdp->sd_isc, buf, &alloc_mem), file);
211 		if (alloc_mem != NULL)
212 			free(alloc_mem);
213 	} else
214 		dbg_print(lml, MSG_INTL(MSG_SYM_DISCARD_FILE),
215 		    Dbg_demangle_name(sdp->sd_name), file);
216 }
217 
218 void
219 Dbg_syms_dup_discarded(Lm_list *lml, Word ndx, Sym_desc *sdp)
220 {
221 	const char	*file;
222 
223 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_UNUSED))
224 		return;
225 	if (DBG_NOTDETAIL())
226 		return;
227 
228 	if ((sdp->sd_file == NULL) || ((file = sdp->sd_file->ifl_name) == NULL))
229 		file = MSG_INTL(MSG_STR_UNKNOWN);
230 
231 	dbg_print(lml, MSG_INTL(MSG_SYM_DISCARD_DUP), EC_WORD(ndx),
232 	    Dbg_demangle_name(sdp->sd_name), file);
233 }
234 
235 void
236 Dbg_syms_entered(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
237 {
238 	Conv_inv_buf_t	inv_buf;
239 	Lm_list		*lml = ofl->ofl_lml;
240 
241 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
242 		return;
243 	if (DBG_NOTDETAIL())
244 		return;
245 
246 	Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_ENTERED),
247 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, sym,
248 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
249 	    conv_def_tag(sdp->sd_ref, &inv_buf));
250 }
251 
252 void
253 Dbg_syms_process(Lm_list *lml, Ifl_desc *ifl)
254 {
255 	Conv_inv_buf_t	inv_buf;
256 
257 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
258 		return;
259 
260 	Dbg_util_nl(lml, DBG_NL_STD);
261 	dbg_print(lml, MSG_INTL(MSG_SYM_PROCESS), ifl->ifl_name,
262 	    conv_ehdr_type(ifl->ifl_ehdr->e_ident[EI_OSABI],
263 	    ifl->ifl_ehdr->e_type, 0, &inv_buf));
264 }
265 
266 void
267 Dbg_syms_entry(Lm_list *lml, Word ndx, Sym_desc *sdp)
268 {
269 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
270 		return;
271 
272 	dbg_print(lml, MSG_INTL(MSG_SYM_BASIC), EC_WORD(ndx),
273 	    Dbg_demangle_name(sdp->sd_name));
274 }
275 
276 void
277 Dbg_syms_global(Lm_list *lml, Word ndx, const char *name)
278 {
279 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
280 		return;
281 
282 	dbg_print(lml, MSG_INTL(MSG_SYM_ADDING), EC_WORD(ndx),
283 	    Dbg_demangle_name(name));
284 }
285 
286 void
287 Dbg_syms_sec_title(Lm_list *lml)
288 {
289 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
290 		return;
291 	if (DBG_NOTDETAIL())
292 		return;
293 
294 	Dbg_util_nl(lml, DBG_NL_STD);
295 	dbg_print(lml, MSG_INTL(MSG_SYM_INDEX));
296 }
297 
298 void
299 Dbg_syms_sec_entry(Lm_list *lml, Word ndx, Sg_desc *sgp, Os_desc *osp)
300 {
301 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
302 		return;
303 	if (DBG_NOTDETAIL())
304 		return;
305 
306 	dbg_print(lml, MSG_INTL(MSG_SYM_SECTION), EC_WORD(ndx), osp->os_name,
307 	    (*sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL)));
308 }
309 
310 void
311 Dbg_syms_up_title(Lm_list *lml)
312 {
313 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
314 		return;
315 	if (DBG_NOTDETAIL())
316 		return;
317 
318 	Dbg_util_nl(lml, DBG_NL_STD);
319 	dbg_print(lml, MSG_INTL(MSG_SYM_FINAL));
320 	Elf_syms_table_title(lml, ELF_DBG_LD);
321 }
322 
323 void
324 Dbg_syms_ignore(Ofl_desc *ofl, Sym_desc *sdp)
325 {
326 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
327 		return;
328 	if (DBG_NOTDETAIL())
329 		return;
330 
331 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_IGNORE),
332 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
333 	    sdp->sd_sym, 0, 0, NULL, MSG_INTL(MSG_STR_UNUSED));
334 }
335 
336 void
337 Dbg_syms_old(Ofl_desc *ofl, Sym_desc *sdp)
338 {
339 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
340 		return;
341 	if (DBG_NOTDETAIL())
342 		return;
343 
344 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
345 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
346 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
347 	    0, NULL, sdp->sd_name);
348 }
349 
350 void
351 Dbg_syms_new(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
352 {
353 	Conv_inv_buf_t	inv_buf;
354 
355 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
356 		return;
357 	if (DBG_NOTDETAIL())
358 		return;
359 
360 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
361 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, sym,
362 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
363 	    conv_def_tag(sdp->sd_ref, &inv_buf));
364 }
365 
366 void
367 Dbg_syms_updated(Ofl_desc *ofl, Sym_desc *sdp, const char *name)
368 {
369 	Conv_inv_buf_t	inv_buf;
370 	Lm_list		*lml = ofl->ofl_lml;
371 
372 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
373 		return;
374 
375 	dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE), name);
376 
377 	if (DBG_NOTDETAIL())
378 		return;
379 
380 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_STR_EMPTY),
381 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
382 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
383 	    conv_def_tag(sdp->sd_ref, &inv_buf));
384 }
385 
386 void
387 Dbg_syms_created(Lm_list *lml, const char *name)
388 {
389 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
390 		return;
391 
392 	dbg_print(lml, MSG_INTL(MSG_SYM_CREATE), Dbg_demangle_name(name));
393 }
394 
395 void
396 Dbg_syms_resolving(Ofl_desc *ofl, Word ndx, const char *name, int row,
397     int col, Sym *osym, Sym *nsym, Sym_desc *sdp, Ifl_desc *ifl)
398 {
399 	Lm_list	*lml = ofl->ofl_lml;
400 	uchar_t	osabi = ofl->ofl_dehdr->e_ident[EI_OSABI];
401 	Half	mach = ofl->ofl_dehdr->e_machine;
402 
403 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
404 		return;
405 
406 	dbg_print(lml, MSG_INTL(MSG_SYM_RESOLVING), EC_WORD(ndx),
407 	    Dbg_demangle_name(name), row, col);
408 
409 	if (DBG_NOTDETAIL())
410 		return;
411 
412 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
413 	    osabi, mach, osym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
414 	    0, NULL, sdp->sd_file->ifl_name);
415 
416 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
417 	    osabi, mach, nsym, 0, 0, NULL, ifl->ifl_name);
418 }
419 
420 void
421 Dbg_syms_resolved(Ofl_desc *ofl, Sym_desc *sdp)
422 {
423 	Conv_inv_buf_t	inv_buf;
424 
425 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
426 		return;
427 	if (DBG_NOTDETAIL())
428 		return;
429 
430 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
431 	    MSG_INTL(MSG_STR_RESOLVED), ofl->ofl_dehdr->e_ident[EI_OSABI],
432 	    ofl->ofl_dehdr->e_machine, sdp->sd_sym,
433 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
434 	    conv_def_tag(sdp->sd_ref, &inv_buf));
435 }
436 
437 void
438 Dbg_syms_reloc(Ofl_desc *ofl, Sym_desc *sdp)
439 {
440 	static Boolean	symbol_title = TRUE;
441 	Conv_inv_buf_t	inv_buf;
442 	Lm_list	*lml = ofl->ofl_lml;
443 
444 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
445 		return;
446 
447 	if (symbol_title) {
448 		Dbg_util_nl(lml, DBG_NL_STD);
449 		dbg_print(lml, MSG_INTL(MSG_SYM_BSS));
450 
451 		symbol_title = FALSE;
452 	}
453 	dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE),
454 	    Dbg_demangle_name(sdp->sd_name));
455 
456 	if (DBG_NOTDETAIL())
457 		return;
458 
459 	Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_COPY),
460 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
461 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
462 	    conv_def_tag(sdp->sd_ref, &inv_buf));
463 }
464 
465 void
466 Dbg_syms_reduce(Ofl_desc *ofl, int which, Sym_desc *sdp, int idx,
467     const char *sname)
468 {
469 	static Boolean	sym_reduce_title = TRUE;
470 	static Boolean	sym_retain_title = TRUE;
471 	Boolean		isfromglobal = (which == DBG_SYM_REDUCE_GLOBAL);
472 	Boolean		isfromretain = (which == DBG_SYM_REDUCE_RETAIN);
473 	Lm_list		*lml = ofl->ofl_lml;
474 
475 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_VERSIONS))
476 		return;
477 
478 	if (sym_reduce_title && isfromglobal) {
479 		sym_reduce_title = FALSE;
480 		Dbg_util_nl(lml, DBG_NL_STD);
481 		dbg_print(lml, MSG_INTL(MSG_SYM_REDUCED));
482 	} else if (sym_retain_title && isfromretain) {
483 		sym_retain_title = FALSE;
484 		Dbg_util_nl(lml, DBG_NL_STD);
485 		dbg_print(lml, MSG_INTL(MSG_SYM_RETAINING));
486 	}
487 
488 	if ((sdp->sd_flags1 & FLG_SY1_ELIM) && isfromglobal)
489 		dbg_print(lml, MSG_INTL(MSG_SYM_ELIMINATING),
490 		    Dbg_demangle_name(sdp->sd_name));
491 	else if (isfromglobal)
492 		dbg_print(lml, MSG_INTL(MSG_SYM_REDUCING),
493 		    Dbg_demangle_name(sdp->sd_name));
494 	else
495 		dbg_print(lml, MSG_INTL(MSG_SYM_NOTELIMINATE),
496 		    Dbg_demangle_name(sdp->sd_name), sname, idx);
497 
498 	if (DBG_NOTDETAIL())
499 		return;
500 
501 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_LOCAL),
502 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
503 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
504 	    sdp->sd_file->ifl_name);
505 }
506 
507 void
508 Dbg_syms_dup_sort_addr(Lm_list *lml, const char *secname, const char *symname1,
509     const char *symname2, Addr addr)
510 {
511 	if (DBG_NOTCLASS(DBG_C_SYMBOLS) || DBG_NOTDETAIL())
512 		return;
513 
514 	dbg_print(lml, MSG_INTL(MSG_SYM_DUPSORTADDR), secname,
515 	    symname1, symname2, EC_ADDR(addr));
516 }
517 
518 void
519 Dbg_syminfo_title(Lm_list *lml)
520 {
521 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
522 		return;
523 	if (DBG_NOTDETAIL())
524 		return;
525 
526 	Dbg_util_nl(lml, DBG_NL_STD);
527 	dbg_print(lml, MSG_INTL(MSG_SYMINFO_INFO));
528 	Elf_syminfo_title(lml);
529 }
530 
531 void
532 Dbg_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, Sym *sym,
533     const char *strtab, Dyn *dyn)
534 {
535 	const char	*needed;
536 
537 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
538 		return;
539 	if (DBG_NOTDETAIL())
540 		return;
541 
542 	if (sip->si_boundto < SYMINFO_BT_LOWRESERVE)
543 		needed = strtab + dyn[sip->si_boundto].d_un.d_val;
544 	else
545 		needed = 0;
546 
547 	Elf_syminfo_entry(lml, ndx, sip,
548 	    Dbg_demangle_name(strtab + sym->st_name), needed);
549 }
550 
551 /*
552  * Symbol table output can differ slightly depending on the caller.  However,
553  * the final diagnostic is maintained here so hat the various message strings
554  * remain consistent
555  *
556  * elfdump:   index    value       size     type bind oth ver shndx       name
557  * ld:                 value       size     type bind oth ver shndx
558  */
559 void
560 Elf_syms_table_title(Lm_list *lml, int caller)
561 {
562 	if (caller == ELF_DBG_ELFDUMP) {
563 		if (DBG_NOTLONG())
564 			dbg_print(lml, MSG_INTL(MSG_SYM_EFS_TITLE));
565 		else
566 			dbg_print(lml, MSG_INTL(MSG_SYM_EFL_TITLE));
567 		return;
568 	}
569 
570 	if (caller == ELF_DBG_LD) {
571 		if (DBG_NOTLONG())
572 			dbg_print(lml, MSG_INTL(MSG_SYM_LDS_TITLE));
573 		else
574 			dbg_print(lml, MSG_INTL(MSG_SYM_LDL_TITLE));
575 		return;
576 	}
577 }
578 
579 void
580 Elf_syms_table_entry(Lm_list *lml, int caller, const char *prestr,
581     uchar_t osabi, Half mach, Sym *sym, Versym verndx, int gnuver,
582     const char *sec, const char *poststr)
583 {
584 	Conv_inv_buf_t	inv_buf1, inv_buf2, inv_buf3;
585 	Conv_inv_buf_t	inv_buf4, inv_buf5, inv_buf6;
586 	uchar_t		type = ELF_ST_TYPE(sym->st_info);
587 	uchar_t		bind = ELF_ST_BIND(sym->st_info);
588 	const char	*msg;
589 
590 	if ((caller == ELF_DBG_ELFDUMP) ||
591 	    (caller == ELF_DBG_LD)) {
592 		if (DBG_NOTLONG())
593 			msg = MSG_INTL(MSG_SYM_EFS_ENTRY);
594 		else
595 			msg = MSG_INTL(MSG_SYM_EFL_ENTRY);
596 
597 		if (sec == NULL)
598 			sec = conv_sym_shndx(osabi, mach, sym->st_shndx,
599 			    CONV_FMT_DECIMAL, &inv_buf6);
600 
601 		dbg_print(lml, msg, prestr,
602 		    conv_sym_value(mach, type, sym->st_value, &inv_buf1),
603 		    sym->st_size, conv_sym_info_type(mach, type, 0, &inv_buf2),
604 		    conv_sym_info_bind(bind, 0, &inv_buf3),
605 		    conv_sym_other(sym->st_other, &inv_buf4),
606 		    conv_ver_index(verndx, gnuver, &inv_buf5),
607 		    sec, Elf_demangle_name(poststr));
608 	}
609 }
610