dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sgs / liblddbg / common / syms.c
blob0a37ea8edb9b4b469c30c06e9bf595be182f9998
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
26 #include <stdio.h>
27 #include "msg.h"
28 #include "_debug.h"
29 #include "libld.h"
31 #if !(defined(_ELF64))
33 void
34 Dbg_syms_lookup_aout(Lm_list *lml, const char *name)
36 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
37 return;
39 dbg_print(lml, MSG_INTL(MSG_SYM_AOUT), Dbg_demangle_name(name));
42 #endif
44 void
45 Dbg_syms_lookup(Rt_map *lmp, const char *name, const char *type)
47 Lm_list *lml = LIST(lmp);
49 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
50 return;
52 dbg_print(lml, MSG_INTL(MSG_SYM_LOOKUP), Dbg_demangle_name(name),
53 NAME(lmp), type);
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) */
68 void
69 Dbg_syms_cap_lookup(Rt_map *lmp, uint_t type, const char *name, uint_t ndx,
70 Half mach, Syscapset *scapset)
72 Lm_list *lml = LIST(lmp);
73 const char *str = NULL;
74 Conv_cap_val_buf_t cap_val_buf;
76 if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_SYMBOLS))
77 return;
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;
100 dbg_print(lml, MSG_INTL(captype[type]), Dbg_demangle_name(name),
101 ndx, str);
104 void
105 Dbg_syms_ignore_gnuver(Rt_map *lmp, const char *name, Word symndx,
106 Versym verndx)
108 Lm_list *lml = LIST(lmp);
110 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
111 return;
113 dbg_print(lml, MSG_INTL(MSG_SYM_IGNGNUVER), Dbg_demangle_name(name),
114 EC_WORD(symndx), EC_HALF(verndx), NAME(lmp));
117 void
118 Dbg_syms_lazy_rescan(Lm_list *lml, const char *name)
120 if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_FILES))
121 return;
123 Dbg_util_nl(lml, DBG_NL_STD);
124 dbg_print(lml, MSG_INTL(MSG_SYM_LAZY_RESCAN), Dbg_demangle_name(name));
127 void
128 Dbg_syms_ar_title(Lm_list *lml, const char *file, Boolean again)
130 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
131 return;
133 dbg_print(lml, MSG_INTL(MSG_SYM_AR_FILE), file,
134 again ? MSG_INTL(MSG_STR_AGAIN) : MSG_ORIG(MSG_STR_EMPTY));
137 void
138 Dbg_syms_ar_skip(Lm_list *lml, const char *archive, Elf_Arsym *arsym)
140 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
141 return;
143 dbg_print(lml, MSG_INTL(MSG_SYM_AR_SKIP), archive,
144 Dbg_demangle_name(arsym->as_name));
147 void
148 Dbg_syms_ar_checking(Lm_list *lml, const char *fname, const char *objname,
149 Elf_Arsym *arsym)
151 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
152 return;
154 dbg_print(lml, MSG_INTL(MSG_SYM_AR_CHECK), fname, objname,
155 Dbg_demangle_name(arsym->as_name));
158 void
159 Dbg_syms_ar_resolve(Lm_list *lml, const char *fname, const char *objname,
160 Elf_Arsym *arsym)
162 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
163 return;
165 dbg_print(lml, MSG_INTL(MSG_SYM_AR_RESOLVE), fname, objname,
166 Dbg_demangle_name(arsym->as_name));
169 void
170 Dbg_syms_ar_force(Lm_list *lml, const char *fname, const char *objname)
172 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
173 return;
175 dbg_print(lml, MSG_INTL(MSG_SYM_AR_FORCE), fname, objname);
178 void
179 Dbg_syms_spec_title(Lm_list *lml)
181 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
182 return;
184 Dbg_util_nl(lml, DBG_NL_STD);
185 dbg_print(lml, MSG_INTL(MSG_SYM_SPECIAL));
188 void
189 Dbg_syms_discarded(Lm_list *lml, Sym_desc *sdp)
191 dbg_isec_name_buf_t buf;
192 char *alloc_mem;
193 const char *file;
195 if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_UNUSED))
196 return;
197 if (DBG_NOTDETAIL())
198 return;
200 if ((sdp->sd_file == NULL) || ((file = sdp->sd_file->ifl_name) == NULL))
201 file = MSG_INTL(MSG_STR_UNKNOWN);
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 free(alloc_mem);
208 } else
209 dbg_print(lml, MSG_INTL(MSG_SYM_DISCARD_FILE),
210 Dbg_demangle_name(sdp->sd_name), file);
213 void
214 Dbg_syms_dup_discarded(Lm_list *lml, Word ndx, Sym_desc *sdp)
216 const char *file;
218 if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_UNUSED))
219 return;
220 if (DBG_NOTDETAIL())
221 return;
223 if ((sdp->sd_file == NULL) || ((file = sdp->sd_file->ifl_name) == NULL))
224 file = MSG_INTL(MSG_STR_UNKNOWN);
226 dbg_print(lml, MSG_INTL(MSG_SYM_DISCARD_DUP), EC_WORD(ndx),
227 Dbg_demangle_name(sdp->sd_name), file);
230 void
231 Dbg_syms_entered(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
233 Conv_inv_buf_t inv_buf;
234 Lm_list *lml = ofl->ofl_lml;
236 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
237 return;
238 if (DBG_NOTDETAIL())
239 return;
241 Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_ENTERED),
242 ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, sym,
243 sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
244 conv_def_tag(sdp->sd_ref, &inv_buf));
247 void
248 Dbg_syms_process(Lm_list *lml, Ifl_desc *ifl)
250 Conv_inv_buf_t inv_buf;
252 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
253 return;
255 Dbg_util_nl(lml, DBG_NL_STD);
256 dbg_print(lml, MSG_INTL(MSG_SYM_PROCESS), ifl->ifl_name,
257 conv_ehdr_type(ifl->ifl_ehdr->e_ident[EI_OSABI],
258 ifl->ifl_ehdr->e_type, 0, &inv_buf));
261 void
262 Dbg_syms_entry(Lm_list *lml, Word ndx, Sym_desc *sdp)
264 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
265 return;
267 dbg_print(lml, MSG_INTL(MSG_SYM_BASIC), EC_WORD(ndx),
268 Dbg_demangle_name(sdp->sd_name));
271 void
272 Dbg_syms_global(Lm_list *lml, Word ndx, const char *name)
274 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
275 return;
277 dbg_print(lml, MSG_INTL(MSG_SYM_ADDING), EC_WORD(ndx),
278 Dbg_demangle_name(name));
281 void
282 Dbg_syms_cap_convert(Ofl_desc *ofl, Word ndx, const char *name, Sym *sym)
284 if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_SYMBOLS))
285 return;
287 dbg_print(ofl->ofl_lml, MSG_INTL(MSG_SYM_CAP_ORIG), EC_WORD(ndx),
288 Dbg_demangle_name(name));
290 if (DBG_NOTDETAIL())
291 return;
293 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
294 MSG_INTL(MSG_STR_ORIGINAL), ofl->ofl_dehdr->e_ident[EI_OSABI],
295 ofl->ofl_dehdr->e_machine, sym, 0, 0, NULL,
296 MSG_ORIG(MSG_STR_EMPTY));
299 void
300 Dbg_syms_cap_local(Ofl_desc *ofl, Word ndx, const char *name, Sym *sym,
301 Sym_desc *sdp)
303 Conv_inv_buf_t inv_buf;
305 if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_SYMBOLS))
306 return;
308 dbg_print(ofl->ofl_lml, MSG_INTL(MSG_SYM_CAP_LOCAL), EC_WORD(ndx),
309 Dbg_demangle_name(name));
311 if (DBG_NOTDETAIL())
312 return;
314 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
315 MSG_INTL(MSG_STR_ENTERED), ofl->ofl_dehdr->e_ident[EI_OSABI],
316 ofl->ofl_dehdr->e_machine, sym,
317 sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
318 conv_def_tag(sdp->sd_ref, &inv_buf));
321 void
322 Dbg_syms_wrap(Lm_list *lml, Word ndx, const char *orig_name, const char *name)
324 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
325 return;
327 dbg_print(lml, MSG_INTL(MSG_SYM_WRAP), EC_WORD(ndx),
328 Dbg_demangle_name(orig_name), Dbg_demangle_name(name));
331 void
332 Dbg_syms_sec_title(Lm_list *lml)
334 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
335 return;
336 if (DBG_NOTDETAIL())
337 return;
339 Dbg_util_nl(lml, DBG_NL_STD);
340 dbg_print(lml, MSG_INTL(MSG_SYM_INDEX));
343 void
344 Dbg_syms_sec_entry(Lm_list *lml, Word ndx, Sg_desc *sgp, Os_desc *osp)
346 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
347 return;
348 if (DBG_NOTDETAIL())
349 return;
351 dbg_print(lml, MSG_INTL(MSG_SYM_SECTION), EC_WORD(ndx), osp->os_name,
352 (*sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL)));
355 void
356 Dbg_syms_up_title(Lm_list *lml)
358 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
359 return;
360 if (DBG_NOTDETAIL())
361 return;
363 Dbg_util_nl(lml, DBG_NL_STD);
364 dbg_print(lml, MSG_INTL(MSG_SYM_FINAL));
365 Elf_syms_table_title(lml, ELF_DBG_LD);
368 void
369 Dbg_syms_ignore(Ofl_desc *ofl, Sym_desc *sdp)
371 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
372 return;
373 if (DBG_NOTDETAIL())
374 return;
376 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_IGNORE),
377 ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
378 sdp->sd_sym, 0, 0, NULL, MSG_INTL(MSG_STR_UNUSED));
381 void
382 Dbg_syms_old(Ofl_desc *ofl, Sym_desc *sdp)
384 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
385 return;
386 if (DBG_NOTDETAIL())
387 return;
389 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
390 ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
391 sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
392 0, NULL, sdp->sd_name);
395 void
396 Dbg_syms_new(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
398 Conv_inv_buf_t inv_buf;
400 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
401 return;
402 if (DBG_NOTDETAIL())
403 return;
405 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
406 ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, sym,
407 sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
408 conv_def_tag(sdp->sd_ref, &inv_buf));
411 void
412 Dbg_syms_updated(Ofl_desc *ofl, Sym_desc *sdp, const char *name)
414 Conv_inv_buf_t inv_buf;
415 Lm_list *lml = ofl->ofl_lml;
417 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
418 return;
420 dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE), name);
422 if (DBG_NOTDETAIL())
423 return;
425 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_STR_EMPTY),
426 ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
427 sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
428 conv_def_tag(sdp->sd_ref, &inv_buf));
431 void
432 Dbg_syms_created(Lm_list *lml, const char *name)
434 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
435 return;
437 dbg_print(lml, MSG_INTL(MSG_SYM_CREATE), Dbg_demangle_name(name));
440 void
441 Dbg_syms_resolving(Ofl_desc *ofl, Word ndx, const char *name, int row,
442 int col, Sym *osym, Sym *nsym, Sym_desc *sdp, Ifl_desc *ifl)
444 Lm_list *lml = ofl->ofl_lml;
445 uchar_t osabi = ofl->ofl_dehdr->e_ident[EI_OSABI];
446 Half mach = ofl->ofl_dehdr->e_machine;
448 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
449 return;
451 dbg_print(lml, MSG_INTL(MSG_SYM_RESOLVING), EC_WORD(ndx),
452 Dbg_demangle_name(name), row, col);
454 if (DBG_NOTDETAIL())
455 return;
457 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
458 osabi, mach, osym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0,
459 0, NULL, sdp->sd_file->ifl_name);
461 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
462 osabi, mach, nsym, 0, 0, NULL, ifl->ifl_name);
465 void
466 Dbg_syms_resolved(Ofl_desc *ofl, Sym_desc *sdp)
468 Conv_inv_buf_t inv_buf;
470 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
471 return;
472 if (DBG_NOTDETAIL())
473 return;
475 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
476 MSG_INTL(MSG_STR_RESOLVED), ofl->ofl_dehdr->e_ident[EI_OSABI],
477 ofl->ofl_dehdr->e_machine, sdp->sd_sym,
478 sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
479 conv_def_tag(sdp->sd_ref, &inv_buf));
482 void
483 Dbg_syms_copy_reloc(Ofl_desc *ofl, Sym_desc *sdp, Word align)
485 static Boolean symbol_title = TRUE;
486 Conv_inv_buf_t inv_buf;
487 Lm_list *lml = ofl->ofl_lml;
489 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
490 return;
492 if (symbol_title) {
493 Dbg_util_nl(lml, DBG_NL_STD);
494 dbg_print(lml, MSG_INTL(MSG_SYM_BSS));
496 symbol_title = FALSE;
500 * Copy relocation symbols come in pairs, the original reference
501 * (within a dependency), and the new destination (within the .bss of
502 * the executable). The latter is accompanied with a computed
503 * alignment.
505 if (align) {
506 dbg_print(lml, MSG_INTL(MSG_SYM_COPY_DST),
507 Dbg_demangle_name(sdp->sd_name), EC_WORD(align));
508 } else {
509 dbg_print(lml, MSG_INTL(MSG_SYM_COPY_REF),
510 Dbg_demangle_name(sdp->sd_name));
513 if (DBG_NOTDETAIL())
514 return;
516 Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_COPY),
517 ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
518 sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
519 conv_def_tag(sdp->sd_ref, &inv_buf));
522 void
523 Dbg_syms_reduce(Ofl_desc *ofl, int which, Sym_desc *sdp, int idx,
524 const char *sname)
526 static Boolean sym_reduce_title = TRUE;
527 static Boolean sym_retain_title = TRUE;
528 Boolean isfromglobal = (which == DBG_SYM_REDUCE_GLOBAL);
529 Boolean isfromretain = (which == DBG_SYM_REDUCE_RETAIN);
530 Lm_list *lml = ofl->ofl_lml;
532 if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_VERSIONS))
533 return;
535 if (sym_reduce_title && isfromglobal) {
536 sym_reduce_title = FALSE;
537 Dbg_util_nl(lml, DBG_NL_STD);
538 dbg_print(lml, MSG_INTL(MSG_SYM_REDUCED));
539 } else if (sym_retain_title && isfromretain) {
540 sym_retain_title = FALSE;
541 Dbg_util_nl(lml, DBG_NL_STD);
542 dbg_print(lml, MSG_INTL(MSG_SYM_RETAINING));
545 if ((sdp->sd_flags & FLG_SY_ELIM) && isfromglobal)
546 dbg_print(lml, MSG_INTL(MSG_SYM_ELIMINATING),
547 Dbg_demangle_name(sdp->sd_name));
548 else if (isfromglobal)
549 dbg_print(lml, MSG_INTL(MSG_SYM_REDUCING),
550 Dbg_demangle_name(sdp->sd_name));
551 else
552 dbg_print(lml, MSG_INTL(MSG_SYM_NOTELIMINATE),
553 Dbg_demangle_name(sdp->sd_name), sname, idx);
555 if (DBG_NOTDETAIL())
556 return;
558 Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_LOCAL),
559 ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine,
560 sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, 0, NULL,
561 sdp->sd_file->ifl_name);
564 void
565 Dbg_syms_dup_sort_addr(Lm_list *lml, const char *secname, const char *symname1,
566 const char *symname2, Addr addr)
568 if (DBG_NOTCLASS(DBG_C_SYMBOLS) || DBG_NOTDETAIL())
569 return;
571 dbg_print(lml, MSG_INTL(MSG_SYM_DUPSORTADDR), secname,
572 symname1, symname2, EC_ADDR(addr));
575 void
576 Dbg_syminfo_title(Lm_list *lml)
578 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
579 return;
580 if (DBG_NOTDETAIL())
581 return;
583 Dbg_util_nl(lml, DBG_NL_STD);
584 dbg_print(lml, MSG_INTL(MSG_SYMINFO_INFO));
585 Elf_syminfo_title(lml);
588 void
589 Dbg_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, Sym *sym,
590 const char *strtab, Dyn *dyn)
592 const char *needed;
594 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
595 return;
596 if (DBG_NOTDETAIL())
597 return;
599 if (sip->si_boundto < SYMINFO_BT_LOWRESERVE)
600 needed = strtab + dyn[sip->si_boundto].d_un.d_val;
601 else
602 needed = 0;
604 Elf_syminfo_entry(lml, ndx, sip,
605 Dbg_demangle_name(strtab + sym->st_name), needed);
609 * Symbol table output can differ slightly depending on the caller. However,
610 * the final diagnostic is maintained here so hat the various message strings
611 * remain consistent
613 * elfdump: index value size type bind oth ver shndx name
614 * ld: value size type bind oth ver shndx
616 void
617 Elf_syms_table_title(Lm_list *lml, int caller)
619 if (caller == ELF_DBG_ELFDUMP) {
620 if (DBG_NOTLONG())
621 dbg_print(lml, MSG_INTL(MSG_SYM_EFS_TITLE));
622 else
623 dbg_print(lml, MSG_INTL(MSG_SYM_EFL_TITLE));
624 return;
627 if (caller == ELF_DBG_LD) {
628 if (DBG_NOTLONG())
629 dbg_print(lml, MSG_INTL(MSG_SYM_LDS_TITLE));
630 else
631 dbg_print(lml, MSG_INTL(MSG_SYM_LDL_TITLE));
632 return;
636 void
637 Elf_syms_table_entry(Lm_list *lml, int caller, const char *prestr,
638 uchar_t osabi, Half mach, Sym *sym, Versym verndx, int gnuver,
639 const char *sec, const char *poststr)
641 Conv_inv_buf_t inv_buf1, inv_buf2, inv_buf3;
642 Conv_inv_buf_t inv_buf4, inv_buf5, inv_buf6;
643 uchar_t type = ELF_ST_TYPE(sym->st_info);
644 uchar_t bind = ELF_ST_BIND(sym->st_info);
645 const char *msg;
647 if ((caller == ELF_DBG_ELFDUMP) ||
648 (caller == ELF_DBG_LD)) {
649 if (DBG_NOTLONG())
650 msg = MSG_INTL(MSG_SYM_EFS_ENTRY);
651 else
652 msg = MSG_INTL(MSG_SYM_EFL_ENTRY);
654 if (sec == NULL)
655 sec = conv_sym_shndx(osabi, mach, sym->st_shndx,
656 CONV_FMT_DECIMAL, &inv_buf6);
658 dbg_print(lml, msg, prestr,
659 conv_sym_value(mach, type, sym->st_value, &inv_buf1),
660 sym->st_size, conv_sym_info_type(mach, type, 0, &inv_buf2),
661 conv_sym_info_bind(bind, 0, &inv_buf3),
662 conv_sym_other(sym->st_other, &inv_buf4),
663 conv_ver_index(verndx, gnuver, &inv_buf5),
664 sec, Elf_demangle_name(poststr));
668 void
669 Dbg_syms_cap_title(Ofl_desc *ofl)
671 Lm_list *lml = ofl->ofl_lml;
673 if (DBG_NOTCLASS(DBG_C_SYMBOLS))
674 return;
675 if (DBG_NOTDETAIL())
676 return;
678 Dbg_util_nl(lml, DBG_NL_STD);
679 dbg_print(lml, MSG_INTL(MSG_SYM_CAPABILITIES));
680 Elf_syms_table_title(lml, ELF_DBG_LD);