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