xref: /titanic_41/usr/src/cmd/sgs/liblddbg/common/syms.c (revision cde2885fdf538266ee2a3b08dee2d5075ce8fa2b)
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 	const char	*file;
196 
197 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_UNUSED))
198 		return;
199 	if (DBG_NOTDETAIL())
200 		return;
201 
202 	if ((sdp->sd_file == NULL) || ((file = sdp->sd_file->ifl_name) == NULL))
203 		file = MSG_INTL(MSG_STR_UNKNOWN);
204 
205 	if (sdp->sd_isc) {
206 		dbg_print(lml, MSG_INTL(MSG_SYM_DISCARD_SEC),
207 		    Dbg_demangle_name(sdp->sd_name), sdp->sd_isc->is_name,
208 		    file);
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_sec_title(Lm_list *lml)
284 {
285 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
286 		return;
287 	if (DBG_NOTDETAIL())
288 		return;
289 
290 	Dbg_util_nl(lml, DBG_NL_STD);
291 	dbg_print(lml, MSG_INTL(MSG_SYM_INDEX));
292 }
293 
294 void
295 Dbg_syms_sec_entry(Lm_list *lml, Word ndx, Sg_desc *sgp, Os_desc *osp)
296 {
297 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
298 		return;
299 	if (DBG_NOTDETAIL())
300 		return;
301 
302 	dbg_print(lml, MSG_INTL(MSG_SYM_SECTION), EC_WORD(ndx), osp->os_name,
303 	    (*sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL)));
304 }
305 
306 void
307 Dbg_syms_up_title(Lm_list *lml)
308 {
309 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
310 		return;
311 	if (DBG_NOTDETAIL())
312 		return;
313 
314 	Dbg_util_nl(lml, DBG_NL_STD);
315 	dbg_print(lml, MSG_INTL(MSG_SYM_FINAL));
316 	Elf_syms_table_title(lml, ELF_DBG_LD);
317 }
318 
319 void
320 Dbg_syms_ignore(Ofl_desc *ofl, Sym_desc *sdp)
321 {
322 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
323 		return;
324 	if (DBG_NOTDETAIL())
325 		return;
326 
327 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_IGNORE),
328 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
329 	    sdp->sd_sym, 0, 0, NULL, MSG_INTL(MSG_STR_UNUSED));
330 }
331 
332 void
333 Dbg_syms_old(Ofl_desc *ofl, Sym_desc *sdp)
334 {
335 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
336 		return;
337 	if (DBG_NOTDETAIL())
338 		return;
339 
340 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
341 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
342 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
343 	    0, NULL, sdp->sd_name);
344 }
345 
346 void
347 Dbg_syms_new(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
348 {
349 	Conv_inv_buf_t	inv_buf;
350 
351 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
352 		return;
353 	if (DBG_NOTDETAIL())
354 		return;
355 
356 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
357 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, sym,
358 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
359 	    conv_def_tag(sdp->sd_ref, &inv_buf));
360 }
361 
362 void
363 Dbg_syms_updated(Ofl_desc *ofl, Sym_desc *sdp, const char *name)
364 {
365 	Conv_inv_buf_t	inv_buf;
366 	Lm_list		*lml = ofl->ofl_lml;
367 
368 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
369 		return;
370 
371 	dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE), name);
372 
373 	if (DBG_NOTDETAIL())
374 		return;
375 
376 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_STR_EMPTY),
377 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
378 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
379 	    conv_def_tag(sdp->sd_ref, &inv_buf));
380 }
381 
382 void
383 Dbg_syms_created(Lm_list *lml, const char *name)
384 {
385 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
386 		return;
387 
388 	dbg_print(lml, MSG_INTL(MSG_SYM_CREATE), Dbg_demangle_name(name));
389 }
390 
391 void
392 Dbg_syms_resolving(Ofl_desc *ofl, Word ndx, const char *name, int row,
393     int col, Sym *osym, Sym *nsym, Sym_desc *sdp, Ifl_desc *ifl)
394 {
395 	Lm_list	*lml = ofl->ofl_lml;
396 	uchar_t	osabi = ofl->ofl_dehdr->e_ident[EI_OSABI];
397 	Half	mach = ofl->ofl_dehdr->e_machine;
398 
399 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
400 		return;
401 
402 	dbg_print(lml, MSG_INTL(MSG_SYM_RESOLVING), EC_WORD(ndx),
403 	    Dbg_demangle_name(name), row, col);
404 
405 	if (DBG_NOTDETAIL())
406 		return;
407 
408 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
409 	    osabi, mach, osym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
410 	    0, NULL, sdp->sd_file->ifl_name);
411 
412 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
413 	    osabi, mach, nsym, 0, 0, NULL, ifl->ifl_name);
414 }
415 
416 void
417 Dbg_syms_resolved(Ofl_desc *ofl, Sym_desc *sdp)
418 {
419 	Conv_inv_buf_t	inv_buf;
420 
421 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
422 		return;
423 	if (DBG_NOTDETAIL())
424 		return;
425 
426 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
427 	    MSG_INTL(MSG_STR_RESOLVED), ofl->ofl_dehdr->e_ident[EI_OSABI],
428 	    ofl->ofl_dehdr->e_machine, sdp->sd_sym,
429 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
430 	    conv_def_tag(sdp->sd_ref, &inv_buf));
431 }
432 
433 void
434 Dbg_syms_reloc(Ofl_desc *ofl, Sym_desc *sdp)
435 {
436 	static Boolean	symbol_title = TRUE;
437 	Conv_inv_buf_t	inv_buf;
438 	Lm_list	*lml = ofl->ofl_lml;
439 
440 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
441 		return;
442 
443 	if (symbol_title) {
444 		Dbg_util_nl(lml, DBG_NL_STD);
445 		dbg_print(lml, MSG_INTL(MSG_SYM_BSS));
446 
447 		symbol_title = FALSE;
448 	}
449 	dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE),
450 	    Dbg_demangle_name(sdp->sd_name));
451 
452 	if (DBG_NOTDETAIL())
453 		return;
454 
455 	Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_COPY),
456 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
457 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
458 	    conv_def_tag(sdp->sd_ref, &inv_buf));
459 }
460 
461 void
462 Dbg_syms_reduce(Ofl_desc *ofl, int which, Sym_desc *sdp, int idx,
463     const char *sname)
464 {
465 	static Boolean	sym_reduce_title = TRUE;
466 	static Boolean	sym_retain_title = TRUE;
467 	Boolean		isfromglobal = (which == DBG_SYM_REDUCE_GLOBAL);
468 	Boolean		isfromretain = (which == DBG_SYM_REDUCE_RETAIN);
469 	Lm_list		*lml = ofl->ofl_lml;
470 
471 	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_VERSIONS))
472 		return;
473 
474 	if (sym_reduce_title && isfromglobal) {
475 		sym_reduce_title = FALSE;
476 		Dbg_util_nl(lml, DBG_NL_STD);
477 		dbg_print(lml, MSG_INTL(MSG_SYM_REDUCED));
478 	} else if (sym_retain_title && isfromretain) {
479 		sym_retain_title = FALSE;
480 		Dbg_util_nl(lml, DBG_NL_STD);
481 		dbg_print(lml, MSG_INTL(MSG_SYM_RETAINING));
482 	}
483 
484 	if ((sdp->sd_flags1 & FLG_SY1_ELIM) && isfromglobal)
485 		dbg_print(lml, MSG_INTL(MSG_SYM_ELIMINATING),
486 		    Dbg_demangle_name(sdp->sd_name));
487 	else if (isfromglobal)
488 		dbg_print(lml, MSG_INTL(MSG_SYM_REDUCING),
489 		    Dbg_demangle_name(sdp->sd_name));
490 	else
491 		dbg_print(lml, MSG_INTL(MSG_SYM_NOTELIMINATE),
492 		    Dbg_demangle_name(sdp->sd_name), sname, idx);
493 
494 	if (DBG_NOTDETAIL())
495 		return;
496 
497 	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_LOCAL),
498 	    ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
499 	    sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
500 	    sdp->sd_file->ifl_name);
501 }
502 
503 void
504 Dbg_syms_dup_sort_addr(Lm_list *lml, const char *secname, const char *symname1,
505     const char *symname2, Addr addr)
506 {
507 	if (DBG_NOTCLASS(DBG_C_SYMBOLS) || DBG_NOTDETAIL())
508 		return;
509 
510 	dbg_print(lml, MSG_INTL(MSG_SYM_DUPSORTADDR), secname,
511 	    symname1, symname2, EC_ADDR(addr));
512 }
513 
514 void
515 Dbg_syminfo_title(Lm_list *lml)
516 {
517 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
518 		return;
519 	if (DBG_NOTDETAIL())
520 		return;
521 
522 	Dbg_util_nl(lml, DBG_NL_STD);
523 	dbg_print(lml, MSG_INTL(MSG_SYMINFO_INFO));
524 	Elf_syminfo_title(lml);
525 }
526 
527 void
528 Dbg_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, Sym *sym,
529     const char *strtab, Dyn *dyn)
530 {
531 	const char	*needed;
532 
533 	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
534 		return;
535 	if (DBG_NOTDETAIL())
536 		return;
537 
538 	if (sip->si_boundto < SYMINFO_BT_LOWRESERVE)
539 		needed = strtab + dyn[sip->si_boundto].d_un.d_val;
540 	else
541 		needed = 0;
542 
543 	Elf_syminfo_entry(lml, ndx, sip,
544 	    Dbg_demangle_name(strtab + sym->st_name), needed);
545 }
546 
547 /*
548  * Symbol table output can differ slightly depending on the caller.  However,
549  * the final diagnostic is maintained here so hat the various message strings
550  * remain consistent
551  *
552  * elfdump:   index    value       size     type bind oth ver shndx       name
553  * ld:                 value       size     type bind oth ver shndx
554  */
555 void
556 Elf_syms_table_title(Lm_list *lml, int caller)
557 {
558 	if (caller == ELF_DBG_ELFDUMP) {
559 		if (DBG_NOTLONG())
560 			dbg_print(lml, MSG_INTL(MSG_SYM_EFS_TITLE));
561 		else
562 			dbg_print(lml, MSG_INTL(MSG_SYM_EFL_TITLE));
563 		return;
564 	}
565 
566 	if (caller == ELF_DBG_LD) {
567 		if (DBG_NOTLONG())
568 			dbg_print(lml, MSG_INTL(MSG_SYM_LDS_TITLE));
569 		else
570 			dbg_print(lml, MSG_INTL(MSG_SYM_LDL_TITLE));
571 		return;
572 	}
573 }
574 
575 void
576 Elf_syms_table_entry(Lm_list *lml, int caller, const char *prestr,
577     uchar_t osabi, Half mach, Sym *sym, Versym verndx, int gnuver,
578     const char *sec, const char *poststr)
579 {
580 	Conv_inv_buf_t	inv_buf1, inv_buf2, inv_buf3;
581 	Conv_inv_buf_t	inv_buf4, inv_buf5, inv_buf6;
582 	uchar_t		type = ELF_ST_TYPE(sym->st_info);
583 	uchar_t		bind = ELF_ST_BIND(sym->st_info);
584 	const char	*msg;
585 
586 	if ((caller == ELF_DBG_ELFDUMP) ||
587 	    (caller == ELF_DBG_LD)) {
588 		if (DBG_NOTLONG())
589 			msg = MSG_INTL(MSG_SYM_EFS_ENTRY);
590 		else
591 			msg = MSG_INTL(MSG_SYM_EFL_ENTRY);
592 
593 		if (sec == NULL)
594 			sec = conv_sym_shndx(osabi, mach, sym->st_shndx,
595 			    CONV_FMT_DECIMAL, &inv_buf6);
596 
597 		dbg_print(lml, msg, prestr,
598 		    conv_sym_value(mach, type, sym->st_value, &inv_buf1),
599 		    sym->st_size, conv_sym_info_type(mach, type, 0, &inv_buf2),
600 		    conv_sym_info_bind(bind, 0, &inv_buf3),
601 		    conv_sym_other(sym->st_other, &inv_buf4),
602 		    conv_ver_index(verndx, gnuver, &inv_buf5),
603 		    sec, Elf_demangle_name(poststr));
604 	}
605 }
606