10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51618Srie * Common Development and Distribution License (the "License"). 61618Srie * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 211618Srie 220Sstevel@tonic-gate /* 233466Srie * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 270Sstevel@tonic-gate 280Sstevel@tonic-gate /* 290Sstevel@tonic-gate * String conversion routine for .dynamic tag entries. 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate #include <stdio.h> 320Sstevel@tonic-gate #include <string.h> 330Sstevel@tonic-gate #include <sys/elf_SPARC.h> 34280Srie #include "rtld.h" 350Sstevel@tonic-gate #include "_conv.h" 360Sstevel@tonic-gate #include "dynamic_msg.h" 370Sstevel@tonic-gate 38*3492Sab196087 39*3492Sab196087 40*3492Sab196087 /* Instantiate a local copy of conv_map2str() from _conv.h */ 41*3492Sab196087 DEFINE_conv_map2str 42*3492Sab196087 43*3492Sab196087 44*3492Sab196087 452352Sab196087 #define POSSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 462352Sab196087 MSG_DFP_LAZYLOAD_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 472352Sab196087 MSG_DFP_GROUPPERM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 482352Sab196087 CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 490Sstevel@tonic-gate 500Sstevel@tonic-gate const char * 512352Sab196087 conv_dyn_posflag1(Xword flags, int fmt_flags) 520Sstevel@tonic-gate { 531618Srie static char string[POSSZ]; 541618Srie static Val_desc vda[] = { 551618Srie { DF_P1_LAZYLOAD, MSG_ORIG(MSG_DFP_LAZYLOAD) }, 561618Srie { DF_P1_GROUPPERM, MSG_ORIG(MSG_DFP_GROUPPERM) }, 571618Srie { 0, 0 } 581618Srie }; 592352Sab196087 static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda }; 602352Sab196087 static Val_desc vda_alt[] = { 612352Sab196087 { DF_P1_LAZYLOAD, MSG_ORIG(MSG_DFP_LAZYLOAD_ALT) }, 622352Sab196087 { DF_P1_GROUPPERM, MSG_ORIG(MSG_DFP_GROUPPERM) }, 632352Sab196087 { 0, 0 } 642352Sab196087 }; 652352Sab196087 static CONV_EXPN_FIELD_ARG conv_arg_alt = { string, sizeof (string), 662352Sab196087 vda_alt, NULL, 0, 0, MSG_ORIG(MSG_STR_EMPTY), NULL, 672352Sab196087 MSG_ORIG(MSG_STR_EMPTY) }; 682352Sab196087 692352Sab196087 CONV_EXPN_FIELD_ARG *arg; 701618Srie 710Sstevel@tonic-gate if (flags == 0) 720Sstevel@tonic-gate return (MSG_ORIG(MSG_GBL_ZERO)); 730Sstevel@tonic-gate 742352Sab196087 arg = (fmt_flags & CONV_FMT_ALTDUMP) ? &conv_arg_alt : &conv_arg; 752352Sab196087 arg->oflags = arg->rflags = flags; 762352Sab196087 (void) conv_expn_field(arg); 770Sstevel@tonic-gate 780Sstevel@tonic-gate return ((const char *)string); 790Sstevel@tonic-gate } 800Sstevel@tonic-gate 812352Sab196087 #define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 822352Sab196087 MSG_DF_ORIGIN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 832352Sab196087 MSG_DF_SYMBOLIC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 842352Sab196087 MSG_DF_TEXTREL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 852352Sab196087 MSG_DF_BIND_NOW_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 862352Sab196087 MSG_DF_STATIC_TLS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 872352Sab196087 CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 880Sstevel@tonic-gate 890Sstevel@tonic-gate const char * 902352Sab196087 conv_dyn_flag(Xword flags, int fmt_flags) 910Sstevel@tonic-gate { 921618Srie static char string[FLAGSZ]; 931618Srie static Val_desc vda[] = { 941618Srie { DF_ORIGIN, MSG_ORIG(MSG_DF_ORIGIN) }, 951618Srie { DF_SYMBOLIC, MSG_ORIG(MSG_DF_SYMBOLIC) }, 961618Srie { DF_TEXTREL, MSG_ORIG(MSG_DF_TEXTREL) }, 971618Srie { DF_BIND_NOW, MSG_ORIG(MSG_DF_BIND_NOW) }, 981618Srie { DF_STATIC_TLS, MSG_ORIG(MSG_DF_STATIC_TLS) }, 991618Srie { 0, 0 } 1001618Srie }; 1012352Sab196087 static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda }; 1021618Srie 1030Sstevel@tonic-gate if (flags == 0) 1040Sstevel@tonic-gate return (MSG_ORIG(MSG_GBL_ZERO)); 1050Sstevel@tonic-gate 1062352Sab196087 conv_arg.oflags = conv_arg.rflags = flags; 1072352Sab196087 if (fmt_flags & CONV_FMT_ALTDUMP) { 1082352Sab196087 conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY); 1092352Sab196087 } else { 1102352Sab196087 conv_arg.prefix = conv_arg.suffix = NULL; 1112352Sab196087 } 1122352Sab196087 (void) conv_expn_field(&conv_arg); 1130Sstevel@tonic-gate 1141618Srie return ((const char *)string); 1150Sstevel@tonic-gate } 1160Sstevel@tonic-gate 1172352Sab196087 #define FLAG1SZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 1182352Sab196087 MSG_DF1_NOW_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1192352Sab196087 MSG_DF1_GLOBAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1202352Sab196087 MSG_DF1_GROUP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1212352Sab196087 MSG_DF1_NODELETE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1222352Sab196087 MSG_DF1_LOADFLTR_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1232352Sab196087 MSG_DF1_INITFIRST_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1242352Sab196087 MSG_DF1_NOOPEN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1252352Sab196087 MSG_DF1_ORIGIN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1262352Sab196087 MSG_DF1_DIRECT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1272352Sab196087 MSG_DF1_TRANS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1282352Sab196087 MSG_DF1_INTERPOSE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1292352Sab196087 MSG_DF1_NODEFLIB_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1302352Sab196087 MSG_DF1_NODUMP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1312352Sab196087 MSG_DF1_CONFALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1322352Sab196087 MSG_DF1_ENDFILTEE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1332352Sab196087 MSG_DF1_DISPRELPND_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1342352Sab196087 MSG_DF1_DISPRELDNE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1352352Sab196087 MSG_DF1_NODIRECT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1362352Sab196087 MSG_DF1_IGNMULDEF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1372352Sab196087 MSG_DF1_NOKSYMS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1383466Srie MSG_DF1_NOHDR_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1392352Sab196087 MSG_DF1_NORELOC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1403466Srie MSG_DF1_SYMINTPOSE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1412352Sab196087 CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate const char * 1441618Srie conv_dyn_flag1(Xword flags) 1450Sstevel@tonic-gate { 1461618Srie static char string[FLAG1SZ]; 1471618Srie static Val_desc vda[] = { 1482352Sab196087 { DF_1_NOW, MSG_ORIG(MSG_DF1_NOW) }, 1491618Srie { DF_1_GLOBAL, MSG_ORIG(MSG_DF1_GLOBAL) }, 1501618Srie { DF_1_GROUP, MSG_ORIG(MSG_DF1_GROUP) }, 1511618Srie { DF_1_NODELETE, MSG_ORIG(MSG_DF1_NODELETE) }, 1521618Srie { DF_1_LOADFLTR, MSG_ORIG(MSG_DF1_LOADFLTR) }, 1531618Srie { DF_1_INITFIRST, MSG_ORIG(MSG_DF1_INITFIRST) }, 1541618Srie { DF_1_NOOPEN, MSG_ORIG(MSG_DF1_NOOPEN) }, 1551618Srie { DF_1_ORIGIN, MSG_ORIG(MSG_DF1_ORIGIN) }, 1561618Srie { DF_1_DIRECT, MSG_ORIG(MSG_DF1_DIRECT) }, 1571618Srie { DF_1_TRANS, MSG_ORIG(MSG_DF1_TRANS) }, 1581618Srie { DF_1_INTERPOSE, MSG_ORIG(MSG_DF1_INTERPOSE) }, 1591618Srie { DF_1_NODEFLIB, MSG_ORIG(MSG_DF1_NODEFLIB) }, 1601618Srie { DF_1_NODUMP, MSG_ORIG(MSG_DF1_NODUMP) }, 1611618Srie { DF_1_CONFALT, MSG_ORIG(MSG_DF1_CONFALT) }, 1621618Srie { DF_1_ENDFILTEE, MSG_ORIG(MSG_DF1_ENDFILTEE) }, 1631618Srie { DF_1_DISPRELPND, MSG_ORIG(MSG_DF1_DISPRELPND) }, 1641618Srie { DF_1_DISPRELDNE, MSG_ORIG(MSG_DF1_DISPRELDNE) }, 1651618Srie { DF_1_NODIRECT, MSG_ORIG(MSG_DF1_NODIRECT) }, 1661618Srie { DF_1_IGNMULDEF, MSG_ORIG(MSG_DF1_IGNMULDEF) }, 1671618Srie { DF_1_NOKSYMS, MSG_ORIG(MSG_DF1_NOKSYMS) }, 1683466Srie { DF_1_NOHDR, MSG_ORIG(MSG_DF1_NOHDR) }, 1691618Srie { DF_1_NORELOC, MSG_ORIG(MSG_DF1_NORELOC) }, 1703466Srie { DF_1_SYMINTPOSE, MSG_ORIG(MSG_DF1_SYMINTPOSE) }, 1711618Srie { 0, 0 } 1721618Srie }; 1732352Sab196087 static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda }; 1740Sstevel@tonic-gate 1750Sstevel@tonic-gate if (flags == 0) 1760Sstevel@tonic-gate return (MSG_ORIG(MSG_GBL_ZERO)); 1770Sstevel@tonic-gate 1782352Sab196087 conv_arg.oflags = conv_arg.rflags = flags; 1792352Sab196087 (void) conv_expn_field(&conv_arg); 1800Sstevel@tonic-gate 1811618Srie return ((const char *)string); 1820Sstevel@tonic-gate } 1830Sstevel@tonic-gate 1842352Sab196087 #define FEATSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 1852352Sab196087 MSG_DTF_PARINIT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1862352Sab196087 MSG_DTF_CONFEXP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 1872352Sab196087 CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate const char * 1902352Sab196087 conv_dyn_feature1(Xword flags, int fmt_flags) 1910Sstevel@tonic-gate { 1921618Srie static char string[FEATSZ]; 1931618Srie static Val_desc vda[] = { 1941618Srie { DTF_1_PARINIT, MSG_ORIG(MSG_DTF_PARINIT) }, 1951618Srie { DTF_1_CONFEXP, MSG_ORIG(MSG_DTF_CONFEXP) }, 1961618Srie { 0, 0 } 1971618Srie }; 1982352Sab196087 static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda }; 1990Sstevel@tonic-gate 2000Sstevel@tonic-gate if (flags == 0) 2010Sstevel@tonic-gate return (MSG_ORIG(MSG_GBL_ZERO)); 2020Sstevel@tonic-gate 2032352Sab196087 conv_arg.oflags = conv_arg.rflags = flags; 2042352Sab196087 if (fmt_flags & CONV_FMT_ALTDUMP) { 2052352Sab196087 conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY); 2062352Sab196087 } else { 2072352Sab196087 conv_arg.prefix = conv_arg.suffix = NULL; 2082352Sab196087 } 2092352Sab196087 (void) conv_expn_field(&conv_arg); 2100Sstevel@tonic-gate 2111618Srie return ((const char *)string); 2120Sstevel@tonic-gate } 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate const char * 2151976Sab196087 conv_dyn_tag(Xword tag, Half mach, int fmt_flags) 2160Sstevel@tonic-gate { 2172850Srie static Conv_inv_buf_t string; 218*3492Sab196087 219*3492Sab196087 /* 220*3492Sab196087 * Dynamic tag values are sparse, cover a wide range, and have 221*3492Sab196087 * holes. To handle this efficiently, we fall through a series 222*3492Sab196087 * of tests below, in increasing tag order, returning at the first 223*3492Sab196087 * match. 224*3492Sab196087 * 225*3492Sab196087 * If we fall all the way to the end, the tag is unknown, 226*3492Sab196087 * and its numeric value is printed. 227*3492Sab196087 */ 228*3492Sab196087 229*3492Sab196087 /* 230*3492Sab196087 * Most of the tag values are clustered in contiguous ranges. 231*3492Sab196087 * Each contiguous range of defined values is handled with 232*3492Sab196087 * an array that contains the message index corresponding to 233*3492Sab196087 * each value in that range. The DYN_RANGE macro checks the 234*3492Sab196087 * tag value against range of values starting at _start_tag. 235*3492Sab196087 * If there is a match, the index of the appropriate name is 236*3492Sab196087 * pulled from _array and returned to the caller. 237*3492Sab196087 */ 238*3492Sab196087 #define DYN_RANGE(_start_tag, _array) \ 239*3492Sab196087 if ((tag >= _start_tag) && (tag < (_start_tag + ARRAY_NELTS(_array)))) \ 240*3492Sab196087 return (MSG_ORIG(_array[tag - _start_tag])); 241*3492Sab196087 242*3492Sab196087 243*3492Sab196087 /* 244*3492Sab196087 * Generic dynamic tags: 245*3492Sab196087 * - Note hole between DT_FLAGS and DT_PREINIT_ARRAY 246*3492Sab196087 * - The first range has alternative names for dump, 247*3492Sab196087 * requiring a second array. 248*3492Sab196087 */ 249*3492Sab196087 static const Msg tags_null[] = { 2501618Srie MSG_DYN_NULL, MSG_DYN_NEEDED, 2511618Srie MSG_DYN_PLTRELSZ, MSG_DYN_PLTGOT, 2521618Srie MSG_DYN_HASH, MSG_DYN_STRTAB, 2531618Srie MSG_DYN_SYMTAB, MSG_DYN_RELA, 2541618Srie MSG_DYN_RELASZ, MSG_DYN_RELAENT, 2551618Srie MSG_DYN_STRSZ, MSG_DYN_SYMENT, 2561618Srie MSG_DYN_INIT, MSG_DYN_FINI, 2571618Srie MSG_DYN_SONAME, MSG_DYN_RPATH, 2581618Srie MSG_DYN_SYMBOLIC, MSG_DYN_REL, 2591618Srie MSG_DYN_RELSZ, MSG_DYN_RELENT, 2601618Srie MSG_DYN_PLTREL, MSG_DYN_DEBUG, 2611618Srie MSG_DYN_TEXTREL, MSG_DYN_JMPREL, 2621618Srie MSG_DYN_BIND_NOW, MSG_DYN_INIT_ARRAY, 2631618Srie MSG_DYN_FINI_ARRAY, MSG_DYN_INIT_ARRAYSZ, 2641618Srie MSG_DYN_FINI_ARRAYSZ, MSG_DYN_RUNPATH, 265*3492Sab196087 MSG_DYN_FLAGS 2661618Srie }; 267*3492Sab196087 static const Msg tags_null_alt[] = { 2681976Sab196087 MSG_DYN_NULL, MSG_DYN_NEEDED, 2691976Sab196087 MSG_DYN_PLTRELSZ_ALT, MSG_DYN_PLTGOT, 2701976Sab196087 MSG_DYN_HASH, MSG_DYN_STRTAB, 2711976Sab196087 MSG_DYN_SYMTAB, MSG_DYN_RELA, 2721976Sab196087 MSG_DYN_RELASZ, MSG_DYN_RELAENT, 2731976Sab196087 MSG_DYN_STRSZ, MSG_DYN_SYMENT, 2741976Sab196087 MSG_DYN_INIT, MSG_DYN_FINI, 2751976Sab196087 MSG_DYN_SONAME, MSG_DYN_RPATH, 2761976Sab196087 MSG_DYN_SYMBOLIC_ALT, MSG_DYN_REL, 2771976Sab196087 MSG_DYN_RELSZ, MSG_DYN_RELENT, 2781976Sab196087 MSG_DYN_PLTREL, MSG_DYN_DEBUG, 2791976Sab196087 MSG_DYN_TEXTREL, MSG_DYN_JMPREL, 2801976Sab196087 MSG_DYN_BIND_NOW, MSG_DYN_INIT_ARRAY, 2811976Sab196087 MSG_DYN_FINI_ARRAY, MSG_DYN_INIT_ARRAYSZ, 2821976Sab196087 MSG_DYN_FINI_ARRAYSZ, MSG_DYN_RUNPATH, 283*3492Sab196087 MSG_DYN_FLAGS 284*3492Sab196087 }; 285*3492Sab196087 static const Msg tags_preinit_array[] = { 2861976Sab196087 MSG_DYN_PREINIT_ARRAY, MSG_DYN_PREINIT_ARRAYSZ 2871976Sab196087 }; 2880Sstevel@tonic-gate 289*3492Sab196087 /* 290*3492Sab196087 * SUNW: DT_LOOS -> DT_HIOS range. 291*3492Sab196087 */ 292*3492Sab196087 static const Msg tags_sunw_auxiliary[] = { 293*3492Sab196087 MSG_DYN_SUNW_AUXILIARY, MSG_DYN_SUNW_RTLDINF, 294*3492Sab196087 MSG_DYN_SUNW_FILTER, MSG_DYN_SUNW_CAP, 295*3492Sab196087 MSG_DYN_SUNW_SYMTAB, MSG_DYN_SUNW_SYMSZ, 296*3492Sab196087 MSG_DYN_SUNW_SORTENT, MSG_DYN_SUNW_SYMSORTSZ, 297*3492Sab196087 MSG_DYN_SUNW_TLSSORT, MSG_DYN_SUNW_TLSSORTSZ 298*3492Sab196087 }; 2990Sstevel@tonic-gate 300*3492Sab196087 /* 301*3492Sab196087 * SUNW: DT_VALRNGLO - DT_VALRNGHI range. 302*3492Sab196087 */ 303*3492Sab196087 static const Msg tags_checksum[] = { 304*3492Sab196087 MSG_DYN_CHECKSUM, MSG_DYN_PLTPADSZ, 305*3492Sab196087 MSG_DYN_MOVEENT, MSG_DYN_MOVESZ, 306*3492Sab196087 MSG_DYN_FEATURE_1, MSG_DYN_POSFLAG_1, 307*3492Sab196087 MSG_DYN_SYMINSZ, MSG_DYN_SYMINENT 308*3492Sab196087 }; 309*3492Sab196087 310*3492Sab196087 /* 311*3492Sab196087 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range. 312*3492Sab196087 */ 313*3492Sab196087 static const Msg tags_config[] = { 314*3492Sab196087 MSG_DYN_CONFIG, MSG_DYN_DEPAUDIT, 315*3492Sab196087 MSG_DYN_AUDIT, MSG_DYN_PLTPAD, 316*3492Sab196087 MSG_DYN_MOVETAB, MSG_DYN_SYMINFO 317*3492Sab196087 }; 3180Sstevel@tonic-gate 319*3492Sab196087 /* 320*3492Sab196087 * SUNW: generic range. Note hole between DT_VERSYM and DT_RELACOUNT. 321*3492Sab196087 * We handle DT_VERSYM as a single value below. 322*3492Sab196087 */ 323*3492Sab196087 static const Msg tags_relacount[] = { 324*3492Sab196087 MSG_DYN_RELACOUNT, MSG_DYN_RELCOUNT, 325*3492Sab196087 MSG_DYN_FLAGS_1, MSG_DYN_VERDEF, 326*3492Sab196087 MSG_DYN_VERDEFNUM, MSG_DYN_VERNEED, 327*3492Sab196087 MSG_DYN_VERNEEDNUM 328*3492Sab196087 }; 329*3492Sab196087 330*3492Sab196087 /* 331*3492Sab196087 * DT_LOPROC - DT_HIPROC range. 332*3492Sab196087 */ 333*3492Sab196087 static const Msg tags_auxiliary[] = { 334*3492Sab196087 MSG_DYN_AUXILIARY, MSG_DYN_USED, 335*3492Sab196087 MSG_DYN_FILTER 336*3492Sab196087 }; 337*3492Sab196087 338*3492Sab196087 339*3492Sab196087 3400Sstevel@tonic-gate 341*3492Sab196087 if (tag <= DT_FLAGS) 342*3492Sab196087 return (conv_map2str(string, sizeof (string), tag, 343*3492Sab196087 fmt_flags, ARRAY_NELTS(tags_null), tags_null, 344*3492Sab196087 tags_null_alt, NULL)); 345*3492Sab196087 DYN_RANGE(DT_PREINIT_ARRAY, tags_preinit_array); 346*3492Sab196087 DYN_RANGE(DT_SUNW_AUXILIARY, tags_sunw_auxiliary); 347*3492Sab196087 DYN_RANGE(DT_CHECKSUM, tags_checksum); 348*3492Sab196087 DYN_RANGE(DT_CONFIG, tags_config); 349*3492Sab196087 if (tag == DT_VERSYM) 350*3492Sab196087 return (MSG_ORIG(MSG_DYN_VERSYM)); 351*3492Sab196087 DYN_RANGE(DT_RELACOUNT, tags_relacount); 352*3492Sab196087 DYN_RANGE(DT_AUXILIARY, tags_auxiliary); 3530Sstevel@tonic-gate 354*3492Sab196087 /* 355*3492Sab196087 * SUNW: machine specific range. 356*3492Sab196087 */ 357*3492Sab196087 if (((mach == EM_SPARC) || (mach == EM_SPARCV9) || 358*3492Sab196087 (mach == EM_SPARC32PLUS)) && (tag == DT_SPARC_REGISTER)) 359*3492Sab196087 /* this is so x86 can display a sparc binary */ 360*3492Sab196087 return (MSG_ORIG(MSG_DYN_REGISTER)); 361*3492Sab196087 362*3492Sab196087 if (tag == DT_DEPRECATED_SPARC_REGISTER) 363*3492Sab196087 return (MSG_ORIG(MSG_DYN_REGISTER)); 364*3492Sab196087 365*3492Sab196087 /* Unknown item */ 366*3492Sab196087 return (conv_invalid_val(string, CONV_INV_STRSIZE, tag, fmt_flags)); 367*3492Sab196087 368*3492Sab196087 #undef DYN_RANGE 3690Sstevel@tonic-gate } 370280Srie 3712352Sab196087 #define BINDTSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 3722352Sab196087 MSG_BND_NEEDED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 3732352Sab196087 MSG_BND_REFER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 3742352Sab196087 MSG_BND_FILTER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 3752352Sab196087 CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 376280Srie 377280Srie const char * 3781618Srie conv_bnd_type(uint_t flags) 379280Srie { 3801618Srie static char string[BINDTSZ]; 3811618Srie static Val_desc vda[] = { 3821618Srie { BND_NEEDED, MSG_ORIG(MSG_BND_NEEDED) }, 3831618Srie { BND_REFER, MSG_ORIG(MSG_BND_REFER) }, 3841618Srie { BND_FILTER, MSG_ORIG(MSG_BND_FILTER) }, 3851618Srie { 0, 0 } 3861618Srie }; 3872352Sab196087 static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda }; 388280Srie 3891618Srie if (flags == 0) 3901618Srie return (MSG_ORIG(MSG_STR_EMPTY)); 391280Srie 3922352Sab196087 conv_arg.oflags = conv_arg.rflags = flags; 3932352Sab196087 (void) conv_expn_field(&conv_arg); 3941618Srie 3951618Srie return ((const char *)string); 396280Srie } 397280Srie 3981824Srie /* 3991824Srie * Note, conv_bnd_obj() is called with either: 4001824Srie * LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or 4011824Srie * LML_FLG_OBJDELETED, or 4021824Srie * LML_FLG_ATEXIT. 4031824Srie */ 4042352Sab196087 #define BINDOSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 4052352Sab196087 MSG_BND_ADDED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 4062352Sab196087 MSG_BND_REEVAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 4072352Sab196087 CONV_INV_STRSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 408280Srie 409280Srie const char * 4101618Srie conv_bnd_obj(uint_t flags) 411280Srie { 4121618Srie static char string[BINDOSZ]; 4131618Srie static Val_desc vda[] = { 4141618Srie { LML_FLG_OBJADDED, MSG_ORIG(MSG_BND_ADDED) }, 4151618Srie { LML_FLG_OBJREEVAL, MSG_ORIG(MSG_BND_REEVAL) }, 4161618Srie { LML_FLG_OBJDELETED, MSG_ORIG(MSG_BND_DELETED) }, 4171618Srie { LML_FLG_ATEXIT, MSG_ORIG(MSG_BND_ATEXIT) }, 4181618Srie { 0, 0 } 4191618Srie }; 4202352Sab196087 static CONV_EXPN_FIELD_ARG conv_arg = { string, sizeof (string), vda }; 4211618Srie 4221824Srie if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL | 4231824Srie LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0) 4241824Srie return (MSG_ORIG(MSG_BND_REVISIT)); 425280Srie 426280Srie /* 4271618Srie * Note, we're not worried about unknown flags for this family, only 4282352Sab196087 * the selected flags are of interest, so we leave conv_arg.rflags 4292352Sab196087 * set to 0. 430280Srie */ 4312352Sab196087 conv_arg.oflags = flags; 4322352Sab196087 (void) conv_expn_field(&conv_arg); 433280Srie 4341618Srie return ((const char *)string); 435280Srie } 436