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 2007 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 #pragma ident "%Z%%M% %I% %E% SMI" 27 28 /* 29 * String conversion routine for .dynamic tag entries. 30 */ 31 #include <stdio.h> 32 #include <string.h> 33 #include <sys/elf_SPARC.h> 34 #include "rtld.h" 35 #include "_conv.h" 36 #include "dynamic_msg.h" 37 38 39 40 /* Instantiate a local copy of conv_map2str() from _conv.h */ 41 DEFINE_conv_map2str 42 43 44 45 #define POSSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 46 MSG_DFP_LAZYLOAD_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 47 MSG_DFP_GROUPPERM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 48 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 49 50 /* 51 * Ensure that Conv_dyn_posflag1_buf_t is large enough: 52 * 53 * POSSZ is the real minimum size of the buffer required by conv_dyn_posflag1(). 54 * However, Conv_dyn_posflag1_buf_t uses CONV_DYN_POSFLAG1_BUFSIZE to set the 55 * buffer size. We do things this way because the definition of POSSZ uses 56 * information that is not available in the environment of other programs 57 * that include the conv.h header file. 58 */ 59 #if (CONV_DYN_POSFLAG1_BUFSIZE != POSSZ) && !defined(__lint) 60 #define REPORT_BUFSIZE POSSZ 61 #include "report_bufsize.h" 62 #error "CONV_DYN_POSFLAG1_BUFSIZE does not match POSSZ" 63 #endif 64 65 const char * 66 conv_dyn_posflag1(Xword flags, Conv_fmt_flags_t fmt_flags, 67 Conv_dyn_posflag1_buf_t *dyn_posflag1_buf) 68 { 69 static Val_desc vda[] = { 70 { DF_P1_LAZYLOAD, MSG_ORIG(MSG_DFP_LAZYLOAD) }, 71 { DF_P1_GROUPPERM, MSG_ORIG(MSG_DFP_GROUPPERM) }, 72 { 0, 0 } 73 }; 74 static CONV_EXPN_FIELD_ARG conv_arg = { 75 NULL, sizeof (dyn_posflag1_buf->buf), vda }; 76 static Val_desc vda_alt[] = { 77 { DF_P1_LAZYLOAD, MSG_ORIG(MSG_DFP_LAZYLOAD_ALT) }, 78 { DF_P1_GROUPPERM, MSG_ORIG(MSG_DFP_GROUPPERM) }, 79 { 0, 0 } 80 }; 81 static CONV_EXPN_FIELD_ARG conv_arg_alt = { 82 NULL, sizeof (dyn_posflag1_buf->buf), vda_alt, NULL, 0, 0, 83 MSG_ORIG(MSG_STR_EMPTY), NULL, MSG_ORIG(MSG_STR_EMPTY) }; 84 85 CONV_EXPN_FIELD_ARG *arg; 86 87 if (flags == 0) 88 return (MSG_ORIG(MSG_GBL_ZERO)); 89 90 arg = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) ? 91 &conv_arg_alt : &conv_arg; 92 arg->buf = dyn_posflag1_buf->buf; 93 arg->oflags = arg->rflags = flags; 94 (void) conv_expn_field(arg, fmt_flags); 95 96 return ((const char *)dyn_posflag1_buf); 97 } 98 99 #define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 100 MSG_DF_ORIGIN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 101 MSG_DF_SYMBOLIC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 102 MSG_DF_TEXTREL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 103 MSG_DF_BIND_NOW_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 104 MSG_DF_STATIC_TLS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 105 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 106 107 /* 108 * Ensure that Conv_dyn_flag_buf_t is large enough: 109 * 110 * FLAGSZ is the real minimum size of the buffer required by conv_dyn_flag(). 111 * However, Conv_dyn_flag_buf_t uses CONV_DYN_FLAG_BUFSIZE to set the 112 * buffer size. We do things this way because the definition of FLAGSZ uses 113 * information that is not available in the environment of other programs 114 * that include the conv.h header file. 115 */ 116 #if (CONV_DYN_FLAG_BUFSIZE != FLAGSZ) && !defined(__lint) 117 #define REPORT_BUFSIZE FLAGSZ 118 #include "report_bufsize.h" 119 #error "CONV_DYN_FLAG_BUFSIZE does not match FLAGSZ" 120 #endif 121 const char * 122 conv_dyn_flag(Xword flags, Conv_fmt_flags_t fmt_flags, 123 Conv_dyn_flag_buf_t *dyn_flag_buf) 124 { 125 static Val_desc vda[] = { 126 { DF_ORIGIN, MSG_ORIG(MSG_DF_ORIGIN) }, 127 { DF_SYMBOLIC, MSG_ORIG(MSG_DF_SYMBOLIC) }, 128 { DF_TEXTREL, MSG_ORIG(MSG_DF_TEXTREL) }, 129 { DF_BIND_NOW, MSG_ORIG(MSG_DF_BIND_NOW) }, 130 { DF_STATIC_TLS, MSG_ORIG(MSG_DF_STATIC_TLS) }, 131 { 0, 0 } 132 }; 133 static CONV_EXPN_FIELD_ARG conv_arg = { 134 NULL, sizeof (dyn_flag_buf->buf), vda }; 135 136 if (flags == 0) 137 return (MSG_ORIG(MSG_GBL_ZERO)); 138 139 conv_arg.buf = dyn_flag_buf->buf; 140 conv_arg.oflags = conv_arg.rflags = flags; 141 if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) { 142 conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY); 143 } else { 144 conv_arg.prefix = conv_arg.suffix = NULL; 145 } 146 (void) conv_expn_field(&conv_arg, fmt_flags); 147 148 return ((const char *)dyn_flag_buf->buf); 149 } 150 151 #define FLAG1SZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 152 MSG_DF1_NOW_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 153 MSG_DF1_GLOBAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 154 MSG_DF1_GROUP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 155 MSG_DF1_NODELETE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 156 MSG_DF1_LOADFLTR_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 157 MSG_DF1_INITFIRST_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 158 MSG_DF1_NOOPEN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 159 MSG_DF1_ORIGIN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 160 MSG_DF1_DIRECT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 161 MSG_DF1_TRANS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 162 MSG_DF1_INTERPOSE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 163 MSG_DF1_NODEFLIB_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 164 MSG_DF1_NODUMP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 165 MSG_DF1_CONFALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 166 MSG_DF1_ENDFILTEE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 167 MSG_DF1_DISPRELPND_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 168 MSG_DF1_DISPRELDNE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 169 MSG_DF1_NODIRECT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 170 MSG_DF1_IGNMULDEF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 171 MSG_DF1_NOKSYMS_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 172 MSG_DF1_NOHDR_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 173 MSG_DF1_NORELOC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 174 MSG_DF1_SYMINTPOSE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 175 MSG_DF1_GLOBAUDIT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 176 MSG_DF1_SINGLETON_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 177 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 178 179 /* 180 * Ensure that Conv_dyn_flag1_buf_t is large enough: 181 * 182 * FLAG1SZ is the real minimum size of the buffer required by conv_dyn_flag1(). 183 * However, Conv_dyn_flag1_buf_t uses CONV_DYN_FLAG1_BUFSIZE to set the 184 * buffer size. We do things this way because the definition of FLAG1SZ uses 185 * information that is not available in the environment of other programs 186 * that include the conv.h header file. 187 */ 188 #if (CONV_DYN_FLAG1_BUFSIZE != FLAG1SZ) && !defined(__lint) 189 #define REPORT_BUFSIZE FLAG1SZ 190 #include "report_bufsize.h" 191 #error "CONV_DYN_FLAG1_BUFSIZE does not match FLAG1SZ" 192 #endif 193 194 const char * 195 conv_dyn_flag1(Xword flags, Conv_fmt_flags_t fmt_flags, 196 Conv_dyn_flag1_buf_t *dyn_flag1_buf) 197 { 198 static Val_desc vda[] = { 199 { DF_1_NOW, MSG_ORIG(MSG_DF1_NOW) }, 200 { DF_1_GLOBAL, MSG_ORIG(MSG_DF1_GLOBAL) }, 201 { DF_1_GROUP, MSG_ORIG(MSG_DF1_GROUP) }, 202 { DF_1_NODELETE, MSG_ORIG(MSG_DF1_NODELETE) }, 203 { DF_1_LOADFLTR, MSG_ORIG(MSG_DF1_LOADFLTR) }, 204 { DF_1_INITFIRST, MSG_ORIG(MSG_DF1_INITFIRST) }, 205 { DF_1_NOOPEN, MSG_ORIG(MSG_DF1_NOOPEN) }, 206 { DF_1_ORIGIN, MSG_ORIG(MSG_DF1_ORIGIN) }, 207 { DF_1_DIRECT, MSG_ORIG(MSG_DF1_DIRECT) }, 208 { DF_1_TRANS, MSG_ORIG(MSG_DF1_TRANS) }, 209 { DF_1_INTERPOSE, MSG_ORIG(MSG_DF1_INTERPOSE) }, 210 { DF_1_NODEFLIB, MSG_ORIG(MSG_DF1_NODEFLIB) }, 211 { DF_1_NODUMP, MSG_ORIG(MSG_DF1_NODUMP) }, 212 { DF_1_CONFALT, MSG_ORIG(MSG_DF1_CONFALT) }, 213 { DF_1_ENDFILTEE, MSG_ORIG(MSG_DF1_ENDFILTEE) }, 214 { DF_1_DISPRELDNE, MSG_ORIG(MSG_DF1_DISPRELDNE) }, 215 { DF_1_DISPRELPND, MSG_ORIG(MSG_DF1_DISPRELPND) }, 216 { DF_1_NODIRECT, MSG_ORIG(MSG_DF1_NODIRECT) }, 217 { DF_1_IGNMULDEF, MSG_ORIG(MSG_DF1_IGNMULDEF) }, 218 { DF_1_NOKSYMS, MSG_ORIG(MSG_DF1_NOKSYMS) }, 219 { DF_1_NOHDR, MSG_ORIG(MSG_DF1_NOHDR) }, 220 { DF_1_EDITED, MSG_ORIG(MSG_DF1_EDITED) }, 221 { DF_1_NORELOC, MSG_ORIG(MSG_DF1_NORELOC) }, 222 { DF_1_SYMINTPOSE, MSG_ORIG(MSG_DF1_SYMINTPOSE) }, 223 { DF_1_GLOBAUDIT, MSG_ORIG(MSG_DF1_GLOBAUDIT) }, 224 { DF_1_SINGLETON, MSG_ORIG(MSG_DF1_SINGLETON) }, 225 { 0, 0 } 226 }; 227 static CONV_EXPN_FIELD_ARG conv_arg = { 228 NULL, sizeof (dyn_flag1_buf->buf), vda }; 229 230 if (flags == 0) 231 return (MSG_ORIG(MSG_GBL_ZERO)); 232 233 conv_arg.oflags = conv_arg.rflags = flags; 234 conv_arg.buf = dyn_flag1_buf->buf; 235 (void) conv_expn_field(&conv_arg, fmt_flags); 236 237 return ((const char *)dyn_flag1_buf->buf); 238 } 239 240 #define FEATSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 241 MSG_DTF_PARINIT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 242 MSG_DTF_CONFEXP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 243 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 244 245 /* 246 * Ensure that Conv_dyn_feature1_buf_t is large enough: 247 * 248 * FEATSZ is the real min size of the buffer required by conv_dyn_feature1(). 249 * However, Conv_dyn_feature1_buf_t uses CONV_DYN_FEATURE1_BUFSIZE to set the 250 * buffer size. We do things this way because the definition of FEATSZ uses 251 * information that is not available in the environment of other programs 252 * that include the conv.h header file. 253 */ 254 #if (CONV_DYN_FEATURE1_BUFSIZE != FEATSZ) && !defined(__lint) 255 #define REPORT_BUFSIZE FEATSZ 256 #include "report_bufsize.h" 257 #error "CONV_DYN_FEATURE1_BUFSIZE does not match FEATSZ" 258 #endif 259 260 const char * 261 conv_dyn_feature1(Xword flags, Conv_fmt_flags_t fmt_flags, 262 Conv_dyn_feature1_buf_t *dyn_feature1_buf) 263 { 264 static Val_desc vda[] = { 265 { DTF_1_PARINIT, MSG_ORIG(MSG_DTF_PARINIT) }, 266 { DTF_1_CONFEXP, MSG_ORIG(MSG_DTF_CONFEXP) }, 267 { 0, 0 } 268 }; 269 static CONV_EXPN_FIELD_ARG conv_arg = { 270 NULL, sizeof (dyn_feature1_buf->buf), vda }; 271 272 if (flags == 0) 273 return (MSG_ORIG(MSG_GBL_ZERO)); 274 275 conv_arg.buf = dyn_feature1_buf->buf; 276 conv_arg.oflags = conv_arg.rflags = flags; 277 if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) { 278 conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY); 279 } else { 280 conv_arg.prefix = conv_arg.suffix = NULL; 281 } 282 (void) conv_expn_field(&conv_arg, fmt_flags); 283 284 return ((const char *)dyn_feature1_buf->buf); 285 } 286 287 const char * 288 conv_dyn_tag(Xword tag, Half mach, Conv_fmt_flags_t fmt_flags, 289 Conv_inv_buf_t *inv_buf) 290 { 291 /* 292 * Dynamic tag values are sparse, cover a wide range, and have 293 * holes. To handle this efficiently, we fall through a series 294 * of tests below, in increasing tag order, returning at the first 295 * match. 296 * 297 * If we fall all the way to the end, the tag is unknown, 298 * and its numeric value is printed. 299 */ 300 301 /* 302 * Most of the tag values are clustered in contiguous ranges. 303 * Each contiguous range of defined values is handled with 304 * an array that contains the message index corresponding to 305 * each value in that range. The DYN_RANGE macro checks the 306 * tag value against range of values starting at _start_tag. 307 * If there is a match, the index of the appropriate name is 308 * pulled from _array and returned to the caller. 309 */ 310 #define DYN_RANGE(_start_tag, _array) \ 311 if ((tag >= _start_tag) && (tag < (_start_tag + ARRAY_NELTS(_array)))) \ 312 return (MSG_ORIG(_array[tag - _start_tag])); 313 314 315 /* 316 * Generic dynamic tags: 317 * - Note hole between DT_FLAGS and DT_PREINIT_ARRAY 318 * - The first range has alternative names for dump, 319 * requiring a second array. 320 */ 321 static const Msg tags_null[] = { 322 MSG_DYN_NULL, MSG_DYN_NEEDED, 323 MSG_DYN_PLTRELSZ, MSG_DYN_PLTGOT, 324 MSG_DYN_HASH, MSG_DYN_STRTAB, 325 MSG_DYN_SYMTAB, MSG_DYN_RELA, 326 MSG_DYN_RELASZ, MSG_DYN_RELAENT, 327 MSG_DYN_STRSZ, MSG_DYN_SYMENT, 328 MSG_DYN_INIT, MSG_DYN_FINI, 329 MSG_DYN_SONAME, MSG_DYN_RPATH, 330 MSG_DYN_SYMBOLIC, MSG_DYN_REL, 331 MSG_DYN_RELSZ, MSG_DYN_RELENT, 332 MSG_DYN_PLTREL, MSG_DYN_DEBUG, 333 MSG_DYN_TEXTREL, MSG_DYN_JMPREL, 334 MSG_DYN_BIND_NOW, MSG_DYN_INIT_ARRAY, 335 MSG_DYN_FINI_ARRAY, MSG_DYN_INIT_ARRAYSZ, 336 MSG_DYN_FINI_ARRAYSZ, MSG_DYN_RUNPATH, 337 MSG_DYN_FLAGS 338 }; 339 static const Msg tags_null_alt[] = { 340 MSG_DYN_NULL, MSG_DYN_NEEDED, 341 MSG_DYN_PLTRELSZ_ALT, MSG_DYN_PLTGOT, 342 MSG_DYN_HASH, MSG_DYN_STRTAB, 343 MSG_DYN_SYMTAB, MSG_DYN_RELA, 344 MSG_DYN_RELASZ, MSG_DYN_RELAENT, 345 MSG_DYN_STRSZ, MSG_DYN_SYMENT, 346 MSG_DYN_INIT, MSG_DYN_FINI, 347 MSG_DYN_SONAME, MSG_DYN_RPATH, 348 MSG_DYN_SYMBOLIC_ALT, MSG_DYN_REL, 349 MSG_DYN_RELSZ, MSG_DYN_RELENT, 350 MSG_DYN_PLTREL, MSG_DYN_DEBUG, 351 MSG_DYN_TEXTREL, MSG_DYN_JMPREL, 352 MSG_DYN_BIND_NOW, MSG_DYN_INIT_ARRAY, 353 MSG_DYN_FINI_ARRAY, MSG_DYN_INIT_ARRAYSZ, 354 MSG_DYN_FINI_ARRAYSZ, MSG_DYN_RUNPATH, 355 MSG_DYN_FLAGS 356 }; 357 static const Msg tags_preinit_array[] = { 358 MSG_DYN_PREINIT_ARRAY, MSG_DYN_PREINIT_ARRAYSZ 359 }; 360 361 /* 362 * SUNW: DT_LOOS -> DT_HIOS range. Note hole between DT_SUNW_TLSSORTSZ 363 * and DT_SUNW_STRPAD. We handle DT_SUNW_STRPAD as a single value below. 364 */ 365 static const Msg tags_sunw_auxiliary[] = { 366 MSG_DYN_SUNW_AUXILIARY, MSG_DYN_SUNW_RTLDINF, 367 MSG_DYN_SUNW_FILTER, MSG_DYN_SUNW_CAP, 368 MSG_DYN_SUNW_SYMTAB, MSG_DYN_SUNW_SYMSZ, 369 MSG_DYN_SUNW_SORTENT, MSG_DYN_SUNW_SYMSORT, 370 MSG_DYN_SUNW_SYMSORTSZ, MSG_DYN_SUNW_TLSSORT, 371 MSG_DYN_SUNW_TLSSORTSZ 372 }; 373 374 /* 375 * SUNW: DT_VALRNGLO - DT_VALRNGHI range. 376 */ 377 static const Msg tags_checksum[] = { 378 MSG_DYN_CHECKSUM, MSG_DYN_PLTPADSZ, 379 MSG_DYN_MOVEENT, MSG_DYN_MOVESZ, 380 MSG_DYN_FEATURE_1, MSG_DYN_POSFLAG_1, 381 MSG_DYN_SYMINSZ, MSG_DYN_SYMINENT 382 }; 383 384 /* 385 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range. 386 */ 387 static const Msg tags_config[] = { 388 MSG_DYN_CONFIG, MSG_DYN_DEPAUDIT, 389 MSG_DYN_AUDIT, MSG_DYN_PLTPAD, 390 MSG_DYN_MOVETAB, MSG_DYN_SYMINFO 391 }; 392 393 /* 394 * SUNW: generic range. Note hole between DT_VERSYM and DT_RELACOUNT. 395 * We handle DT_VERSYM as a single value below. 396 */ 397 static const Msg tags_relacount[] = { 398 MSG_DYN_RELACOUNT, MSG_DYN_RELCOUNT, 399 MSG_DYN_FLAGS_1, MSG_DYN_VERDEF, 400 MSG_DYN_VERDEFNUM, MSG_DYN_VERNEED, 401 MSG_DYN_VERNEEDNUM 402 }; 403 404 /* 405 * DT_LOPROC - DT_HIPROC range. 406 */ 407 static const Msg tags_auxiliary[] = { 408 MSG_DYN_AUXILIARY, MSG_DYN_USED, 409 MSG_DYN_FILTER 410 }; 411 412 413 414 415 if (tag <= DT_FLAGS) { 416 /* use 'dump' style? */ 417 if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) 418 return (conv_map2str(inv_buf, tag, fmt_flags, 419 ARRAY_NELTS(tags_null_alt), tags_null_alt)); 420 /* Standard style */ 421 return (conv_map2str(inv_buf, tag, fmt_flags, 422 ARRAY_NELTS(tags_null), tags_null)); 423 } 424 DYN_RANGE(DT_PREINIT_ARRAY, tags_preinit_array); 425 DYN_RANGE(DT_SUNW_AUXILIARY, tags_sunw_auxiliary); 426 if (tag == DT_SUNW_STRPAD) 427 return (MSG_ORIG(MSG_DYN_SUNW_STRPAD)); 428 DYN_RANGE(DT_CHECKSUM, tags_checksum); 429 DYN_RANGE(DT_CONFIG, tags_config); 430 if (tag == DT_VERSYM) 431 return (MSG_ORIG(MSG_DYN_VERSYM)); 432 DYN_RANGE(DT_RELACOUNT, tags_relacount); 433 DYN_RANGE(DT_AUXILIARY, tags_auxiliary); 434 435 /* 436 * SUNW: machine specific range. 437 */ 438 if (((mach == EM_SPARC) || (mach == EM_SPARCV9) || 439 (mach == EM_SPARC32PLUS)) && (tag == DT_SPARC_REGISTER)) 440 /* this is so x86 can display a sparc binary */ 441 return (MSG_ORIG(MSG_DYN_REGISTER)); 442 443 if (tag == DT_DEPRECATED_SPARC_REGISTER) 444 return (MSG_ORIG(MSG_DYN_REGISTER)); 445 446 /* Unknown item */ 447 return (conv_invalid_val(inv_buf, tag, fmt_flags)); 448 449 #undef DYN_RANGE 450 } 451 452 #define BINDTSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 453 MSG_BND_NEEDED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 454 MSG_BND_REFER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 455 MSG_BND_FILTER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 456 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 457 458 /* 459 * Ensure that Conv_bnd_type_buf_t is large enough: 460 * 461 * BINDTSZ is the real minimum size of the buffer required by conv_bnd_type(). 462 * However, Conv_bnd_type_buf_t uses CONV_BND_TYPE_BUFSIZE to set the 463 * buffer size. We do things this way because the definition of BINDTSZ uses 464 * information that is not available in the environment of other programs 465 * that include the conv.h header file. 466 */ 467 #if (CONV_BND_TYPE_BUFSIZE != BINDTSZ) && !defined(__lint) 468 #define REPORT_BUFSIZE BINDTSZ 469 #include "report_bufsize.h" 470 #error "CONV_BND_TYPE_BUFSIZE does not match BINDTSZ" 471 #endif 472 473 const char * 474 conv_bnd_type(uint_t flags, Conv_bnd_type_buf_t *bnd_type_buf) 475 { 476 static Val_desc vda[] = { 477 { BND_NEEDED, MSG_ORIG(MSG_BND_NEEDED) }, 478 { BND_REFER, MSG_ORIG(MSG_BND_REFER) }, 479 { BND_FILTER, MSG_ORIG(MSG_BND_FILTER) }, 480 { 0, 0 } 481 }; 482 static CONV_EXPN_FIELD_ARG conv_arg = { 483 NULL, sizeof (bnd_type_buf->buf), vda }; 484 485 if (flags == 0) 486 return (MSG_ORIG(MSG_STR_EMPTY)); 487 488 conv_arg.buf = bnd_type_buf->buf; 489 conv_arg.oflags = conv_arg.rflags = flags; 490 (void) conv_expn_field(&conv_arg, 0); 491 492 return ((const char *)bnd_type_buf->buf); 493 } 494 495 /* 496 * Note, conv_bnd_obj() is called with either: 497 * LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or 498 * LML_FLG_OBJDELETED, or 499 * LML_FLG_ATEXIT. 500 */ 501 #define BINDOSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 502 MSG_BND_ADDED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 503 MSG_BND_REEVAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 504 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 505 506 /* 507 * Ensure that Conv_bnd_obj_buf_t is large enough: 508 * 509 * BINDOSZ is the real minimum size of the buffer required by conv_bnd_obj(). 510 * However, Conv_bnd_obj_buf_t uses CONV_BND_OBJ_BUFSIZE to set the 511 * buffer size. We do things this way because the definition of BINDOSZ uses 512 * information that is not available in the environment of other programs 513 * that include the conv.h header file. 514 */ 515 #if (CONV_BND_OBJ_BUFSIZE != BINDOSZ) && !defined(__lint) 516 #define REPORT_BUFSIZE BINDOSZ 517 #include "report_bufsize.h" 518 #error "CONV_BND_OBJ_BUFSIZE does not match BINDOSZ" 519 #endif 520 521 const char * 522 conv_bnd_obj(uint_t flags, Conv_bnd_obj_buf_t *bnd_obj_buf) 523 { 524 static Val_desc vda[] = { 525 { LML_FLG_OBJADDED, MSG_ORIG(MSG_BND_ADDED) }, 526 { LML_FLG_OBJREEVAL, MSG_ORIG(MSG_BND_REEVAL) }, 527 { LML_FLG_OBJDELETED, MSG_ORIG(MSG_BND_DELETED) }, 528 { LML_FLG_ATEXIT, MSG_ORIG(MSG_BND_ATEXIT) }, 529 { 0, 0 } 530 }; 531 static CONV_EXPN_FIELD_ARG conv_arg = { 532 NULL, sizeof (bnd_obj_buf->buf), vda }; 533 534 if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL | 535 LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0) 536 return (MSG_ORIG(MSG_BND_REVISIT)); 537 538 /* 539 * Note, we're not worried about unknown flags for this family, only 540 * the selected flags are of interest, so we leave conv_arg.rflags 541 * set to 0. 542 */ 543 conv_arg.buf = bnd_obj_buf->buf; 544 conv_arg.oflags = flags; 545 (void) conv_expn_field(&conv_arg, 0); 546 547 return ((const char *)bnd_obj_buf->buf); 548 } 549