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 2010 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* 28 * String conversion routine for .dynamic tag entries. 29 */ 30 #include <stdio.h> 31 #include <string.h> 32 #include <sys/elf_SPARC.h> 33 #include "rtld.h" 34 #include "_conv.h" 35 #include "dynamic_msg.h" 36 37 38 39 const Val_desc * 40 conv_dyn_posflag1_strings(Conv_fmt_flags_t fmt_flags) 41 { 42 #define POSSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 43 MSG_DF_P1_LAZYLOAD_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 44 MSG_DF_P1_GROUPPERM_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 45 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 46 47 /* 48 * Ensure that Conv_dyn_posflag1_buf_t is large enough: 49 * 50 * POSSZ is the real minimum size of the buffer required by 51 * conv_dyn_posflag1(). However, Conv_dyn_posflag1_buf_t uses 52 * CONV_DYN_POSFLAG1_BUFSIZE to set the buffer size. We do things 53 * this way because the definition of POSSZ uses 54 * information that is not available in the environment of other 55 * programs that include the conv.h header file. 56 */ 57 #if (CONV_DYN_POSFLAG1_BUFSIZE != POSSZ) && !defined(__lint) 58 #define REPORT_BUFSIZE POSSZ 59 #include "report_bufsize.h" 60 #error "CONV_DYN_POSFLAG1_BUFSIZE does not match POSSZ" 61 #endif 62 63 static const Val_desc vda_def[] = { 64 { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_DEF }, 65 { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_CFNP }, 66 { 0, 0 } 67 }; 68 static const Val_desc vda_cf[] = { 69 { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_CF }, 70 { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_CF }, 71 { 0, 0 } 72 }; 73 static const Val_desc vda_cfnp[] = { 74 { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_CFNP }, 75 { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_CFNP }, 76 { 0, 0 } 77 }; 78 static const Val_desc vda_nf[] = { 79 { DF_P1_LAZYLOAD, MSG_DF_P1_LAZYLOAD_NF }, 80 { DF_P1_GROUPPERM, MSG_DF_P1_GROUPPERM_NF }, 81 { 0, 0 } 82 }; 83 84 switch (CONV_TYPE_FMT_ALT(fmt_flags)) { 85 case CONV_FMT_ALT_DUMP: 86 case CONV_FMT_ALT_CFNP: 87 return (vda_cfnp); 88 case CONV_FMT_ALT_CF: 89 return (vda_cf); 90 case CONV_FMT_ALT_NF: 91 return (vda_nf); 92 } 93 94 return (vda_def); 95 } 96 97 conv_iter_ret_t 98 conv_iter_dyn_posflag1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, 99 void *uvalue) 100 { 101 return (conv_iter_vd(conv_dyn_posflag1_strings(fmt_flags), 102 func, uvalue)); 103 } 104 105 const Val_desc * 106 conv_dyn_flag_strings(Conv_fmt_flags_t fmt_flags) 107 { 108 #define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 109 MSG_DF_ORIGIN_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 110 MSG_DF_SYMBOLIC_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 111 MSG_DF_TEXTREL_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 112 MSG_DF_BIND_NOW_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 113 MSG_DF_STATIC_TLS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 114 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 115 116 /* 117 * Ensure that Conv_dyn_flag_buf_t is large enough: 118 * 119 * FLAGSZ is the real minimum size of the buffer required by 120 * conv_dyn_flag(). However, Conv_dyn_flag_buf_t uses 121 * CONV_DYN_FLAG_BUFSIZE to set the buffer size. We do things this 122 * way because the definition of FLAGSZ uses information that is not 123 * available in the environment of other programs that include the 124 * conv.h header file. 125 */ 126 #if (CONV_DYN_FLAG_BUFSIZE != FLAGSZ) && !defined(__lint) 127 #define REPORT_BUFSIZE FLAGSZ 128 #include "report_bufsize.h" 129 #error "CONV_DYN_FLAG_BUFSIZE does not match FLAGSZ" 130 #endif 131 132 static const Val_desc vda_cf[] = { 133 { DF_ORIGIN, MSG_DF_ORIGIN_CF }, 134 { DF_SYMBOLIC, MSG_DF_SYMBOLIC_CF }, 135 { DF_TEXTREL, MSG_DF_TEXTREL_CF }, 136 { DF_BIND_NOW, MSG_DF_BIND_NOW_CF }, 137 { DF_STATIC_TLS, MSG_DF_STATIC_TLS_CF }, 138 { 0 } 139 }; 140 static const Val_desc vda_cfnp[] = { 141 { DF_ORIGIN, MSG_DF_ORIGIN_CFNP }, 142 { DF_SYMBOLIC, MSG_DF_SYMBOLIC_CFNP }, 143 { DF_TEXTREL, MSG_DF_TEXTREL_CFNP }, 144 { DF_BIND_NOW, MSG_DF_BIND_NOW_CFNP }, 145 { DF_STATIC_TLS, MSG_DF_STATIC_TLS_CFNP }, 146 { 0 } 147 }; 148 static const Val_desc vda_nf[] = { 149 { DF_ORIGIN, MSG_DF_ORIGIN_NF }, 150 { DF_SYMBOLIC, MSG_DF_SYMBOLIC_NF }, 151 { DF_TEXTREL, MSG_DF_TEXTREL_NF }, 152 { DF_BIND_NOW, MSG_DF_BIND_NOW_NF }, 153 { DF_STATIC_TLS, MSG_DF_STATIC_TLS_NF }, 154 { 0 } 155 }; 156 157 switch (CONV_TYPE_FMT_ALT(fmt_flags)) { 158 case CONV_FMT_ALT_CF: 159 return (vda_cf); 160 case CONV_FMT_ALT_NF: 161 return (vda_nf); 162 } 163 164 return (vda_cfnp); 165 } 166 167 conv_iter_ret_t 168 conv_iter_dyn_flag(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, 169 void *uvalue) 170 { 171 return (conv_iter_vd(conv_dyn_flag_strings(fmt_flags), func, uvalue)); 172 } 173 174 const Val_desc * 175 conv_dyn_flag1_strings(Conv_fmt_flags_t fmt_flags) 176 { 177 #define FLAG1SZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 178 MSG_DF_1_NOW_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 179 MSG_DF_1_GLOBAL_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 180 MSG_DF_1_GROUP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 181 MSG_DF_1_NODELETE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 182 MSG_DF_1_LOADFLTR_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 183 MSG_DF_1_INITFIRST_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 184 MSG_DF_1_NOOPEN_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 185 MSG_DF_1_ORIGIN_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 186 MSG_DF_1_DIRECT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 187 MSG_DF_1_TRANS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 188 MSG_DF_1_INTERPOSE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 189 MSG_DF_1_NODEFLIB_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 190 MSG_DF_1_NODUMP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 191 MSG_DF_1_CONFALT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 192 MSG_DF_1_ENDFILTEE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 193 MSG_DF_1_DISPRELPND_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 194 MSG_DF_1_DISPRELDNE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 195 MSG_DF_1_NODIRECT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 196 MSG_DF_1_IGNMULDEF_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 197 MSG_DF_1_NOKSYMS_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 198 MSG_DF_1_NOHDR_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 199 MSG_DF_1_NORELOC_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 200 MSG_DF_1_SYMINTPOSE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 201 MSG_DF_1_GLOBAUDIT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 202 MSG_DF_1_SINGLETON_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 203 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 204 205 /* 206 * Ensure that Conv_dyn_flag1_buf_t is large enough: 207 * 208 * FLAG1SZ is the real minimum size of the buffer required by 209 * conv_dyn_flag1(). However, Conv_dyn_flag1_buf_t uses 210 * CONV_DYN_FLAG1_BUFSIZE to set the buffer size. We do things this 211 * way because the definition of FLAG1SZ uses information that is not 212 * available in the environment of other programs that include the 213 * conv.h header file. 214 */ 215 #if (CONV_DYN_FLAG1_BUFSIZE != FLAG1SZ) && !defined(__lint) 216 #define REPORT_BUFSIZE FLAG1SZ 217 #include "report_bufsize.h" 218 #error "CONV_DYN_FLAG1_BUFSIZE does not match FLAG1SZ" 219 #endif 220 221 static const Val_desc vda_def[] = { 222 { DF_1_NOW, MSG_DF_1_NOW_CFNP }, 223 { DF_1_GLOBAL, MSG_DF_1_GLOBAL_CFNP }, 224 { DF_1_GROUP, MSG_DF_1_GROUP_CFNP }, 225 { DF_1_NODELETE, MSG_DF_1_NODELETE_CFNP }, 226 { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_CFNP }, 227 { DF_1_INITFIRST, MSG_DF_1_INITFIRST_CFNP }, 228 { DF_1_NOOPEN, MSG_DF_1_NOOPEN_CFNP }, 229 { DF_1_ORIGIN, MSG_DF_1_ORIGIN_CFNP }, 230 { DF_1_DIRECT, MSG_DF_1_DIRECT_CFNP }, 231 { DF_1_TRANS, MSG_DF_1_TRANS_CFNP }, 232 { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_DEF }, 233 { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_CFNP }, 234 { DF_1_NODUMP, MSG_DF_1_NODUMP_CFNP }, 235 { DF_1_CONFALT, MSG_DF_1_CONFALT_CFNP }, 236 { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_CFNP }, 237 { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_DEF }, 238 { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_DEF }, 239 { DF_1_NODIRECT, MSG_DF_1_NODIRECT_CFNP }, 240 { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_DEF }, 241 { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_CFNP }, 242 { DF_1_NOHDR, MSG_DF_1_NOHDR_CFNP }, 243 { DF_1_EDITED, MSG_DF_1_EDITED_CFNP }, 244 { DF_1_NORELOC, MSG_DF_1_NORELOC_CFNP }, 245 { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_DEF }, 246 { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_DEF }, 247 { DF_1_SINGLETON, MSG_DF_1_SINGLETON_DEF }, 248 { 0, 0 } 249 }; 250 static const Val_desc vda_cf[] = { 251 { DF_1_NOW, MSG_DF_1_NOW_CF }, 252 { DF_1_GLOBAL, MSG_DF_1_GLOBAL_CF }, 253 { DF_1_GROUP, MSG_DF_1_GROUP_CF }, 254 { DF_1_NODELETE, MSG_DF_1_NODELETE_CF }, 255 { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_CF }, 256 { DF_1_INITFIRST, MSG_DF_1_INITFIRST_CF }, 257 { DF_1_NOOPEN, MSG_DF_1_NOOPEN_CF }, 258 { DF_1_ORIGIN, MSG_DF_1_ORIGIN_CF }, 259 { DF_1_DIRECT, MSG_DF_1_DIRECT_CF }, 260 { DF_1_TRANS, MSG_DF_1_TRANS_CF }, 261 { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_CF }, 262 { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_CF }, 263 { DF_1_NODUMP, MSG_DF_1_NODUMP_CF }, 264 { DF_1_CONFALT, MSG_DF_1_CONFALT_CF }, 265 { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_CF }, 266 { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_CF }, 267 { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_CF }, 268 { DF_1_NODIRECT, MSG_DF_1_NODIRECT_CF }, 269 { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_CF }, 270 { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_CF }, 271 { DF_1_NOHDR, MSG_DF_1_NOHDR_CF }, 272 { DF_1_EDITED, MSG_DF_1_EDITED_CF }, 273 { DF_1_NORELOC, MSG_DF_1_NORELOC_CF }, 274 { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_CF }, 275 { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_CF }, 276 { DF_1_SINGLETON, MSG_DF_1_SINGLETON_CF }, 277 { 0, 0 } 278 }; 279 static const Val_desc vda_cfnp[] = { 280 { DF_1_NOW, MSG_DF_1_NOW_CFNP }, 281 { DF_1_GLOBAL, MSG_DF_1_GLOBAL_CFNP }, 282 { DF_1_GROUP, MSG_DF_1_GROUP_CFNP }, 283 { DF_1_NODELETE, MSG_DF_1_NODELETE_CFNP }, 284 { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_CFNP }, 285 { DF_1_INITFIRST, MSG_DF_1_INITFIRST_CFNP }, 286 { DF_1_NOOPEN, MSG_DF_1_NOOPEN_CFNP }, 287 { DF_1_ORIGIN, MSG_DF_1_ORIGIN_CFNP }, 288 { DF_1_DIRECT, MSG_DF_1_DIRECT_CFNP }, 289 { DF_1_TRANS, MSG_DF_1_TRANS_CFNP }, 290 { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_CFNP }, 291 { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_CFNP }, 292 { DF_1_NODUMP, MSG_DF_1_NODUMP_CFNP }, 293 { DF_1_CONFALT, MSG_DF_1_CONFALT_CFNP }, 294 { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_CFNP }, 295 { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_CFNP }, 296 { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_CFNP }, 297 { DF_1_NODIRECT, MSG_DF_1_NODIRECT_CFNP }, 298 { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_CFNP }, 299 { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_CFNP }, 300 { DF_1_NOHDR, MSG_DF_1_NOHDR_CFNP }, 301 { DF_1_EDITED, MSG_DF_1_EDITED_CFNP }, 302 { DF_1_NORELOC, MSG_DF_1_NORELOC_CFNP }, 303 { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_CFNP }, 304 { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_CFNP }, 305 { DF_1_SINGLETON, MSG_DF_1_SINGLETON_CFNP }, 306 { 0, 0 } 307 }; 308 static const Val_desc vda_nf[] = { 309 { DF_1_NOW, MSG_DF_1_NOW_NF }, 310 { DF_1_GLOBAL, MSG_DF_1_GLOBAL_NF }, 311 { DF_1_GROUP, MSG_DF_1_GROUP_NF }, 312 { DF_1_NODELETE, MSG_DF_1_NODELETE_NF }, 313 { DF_1_LOADFLTR, MSG_DF_1_LOADFLTR_NF }, 314 { DF_1_INITFIRST, MSG_DF_1_INITFIRST_NF }, 315 { DF_1_NOOPEN, MSG_DF_1_NOOPEN_NF }, 316 { DF_1_ORIGIN, MSG_DF_1_ORIGIN_NF }, 317 { DF_1_DIRECT, MSG_DF_1_DIRECT_NF }, 318 { DF_1_TRANS, MSG_DF_1_TRANS_NF }, 319 { DF_1_INTERPOSE, MSG_DF_1_INTERPOSE_NF }, 320 { DF_1_NODEFLIB, MSG_DF_1_NODEFLIB_NF }, 321 { DF_1_NODUMP, MSG_DF_1_NODUMP_NF }, 322 { DF_1_CONFALT, MSG_DF_1_CONFALT_NF }, 323 { DF_1_ENDFILTEE, MSG_DF_1_ENDFILTEE_NF }, 324 { DF_1_DISPRELDNE, MSG_DF_1_DISPRELDNE_NF }, 325 { DF_1_DISPRELPND, MSG_DF_1_DISPRELPND_NF }, 326 { DF_1_NODIRECT, MSG_DF_1_NODIRECT_NF }, 327 { DF_1_IGNMULDEF, MSG_DF_1_IGNMULDEF_NF }, 328 { DF_1_NOKSYMS, MSG_DF_1_NOKSYMS_NF }, 329 { DF_1_NOHDR, MSG_DF_1_NOHDR_NF }, 330 { DF_1_EDITED, MSG_DF_1_EDITED_NF }, 331 { DF_1_NORELOC, MSG_DF_1_NORELOC_NF }, 332 { DF_1_SYMINTPOSE, MSG_DF_1_SYMINTPOSE_NF }, 333 { DF_1_GLOBAUDIT, MSG_DF_1_GLOBAUDIT_NF }, 334 { DF_1_SINGLETON, MSG_DF_1_SINGLETON_NF }, 335 { 0, 0 } 336 }; 337 338 switch (CONV_TYPE_FMT_ALT(fmt_flags)) { 339 case CONV_FMT_ALT_CF: 340 return (vda_cf); 341 case CONV_FMT_ALT_CFNP: 342 return (vda_cfnp); 343 case CONV_FMT_ALT_NF: 344 return (vda_nf); 345 } 346 347 return (vda_def); 348 } 349 350 conv_iter_ret_t 351 conv_iter_dyn_flag1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, 352 void *uvalue) 353 { 354 return (conv_iter_vd(conv_dyn_flag1_strings(fmt_flags), func, uvalue)); 355 } 356 357 const Val_desc * 358 conv_dyn_feature1_strings(Conv_fmt_flags_t fmt_flags) 359 { 360 #define FEATSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 361 MSG_DTF_1_PARINIT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 362 MSG_DTF_1_CONFEXP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 363 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 364 365 /* 366 * Ensure that Conv_dyn_feature1_buf_t is large enough: 367 * 368 * FEATSZ is the real min size of the buffer required by 369 * conv_dyn_feature1(). However, Conv_dyn_feature1_buf_t uses 370 * CONV_DYN_FEATURE1_BUFSIZE to set the buffer size. We do things 371 * this way because the definition of FEATSZ uses information that 372 * is not available in the environment of other programs that include 373 * the conv.h header file. 374 */ 375 #if (CONV_DYN_FEATURE1_BUFSIZE != FEATSZ) && !defined(__lint) 376 #define REPORT_BUFSIZE FEATSZ 377 #include "report_bufsize.h" 378 #error "CONV_DYN_FEATURE1_BUFSIZE does not match FEATSZ" 379 #endif 380 381 static const Val_desc vda_cf[] = { 382 { DTF_1_PARINIT, MSG_DTF_1_PARINIT_CF }, 383 { DTF_1_CONFEXP, MSG_DTF_1_CONFEXP_CF }, 384 { 0, 0 } 385 }; 386 static const Val_desc vda_cfnp[] = { 387 { DTF_1_PARINIT, MSG_DTF_1_PARINIT_CFNP }, 388 { DTF_1_CONFEXP, MSG_DTF_1_CONFEXP_CFNP }, 389 { 0, 0 } 390 }; 391 static const Val_desc vda_nf[] = { 392 { DTF_1_PARINIT, MSG_DTF_1_PARINIT_NF }, 393 { DTF_1_CONFEXP, MSG_DTF_1_CONFEXP_NF }, 394 { 0, 0 } 395 }; 396 397 switch (CONV_TYPE_FMT_ALT(fmt_flags)) { 398 case CONV_FMT_ALT_CF: 399 return (vda_cf); 400 case CONV_FMT_ALT_NF: 401 return (vda_nf); 402 } 403 404 return (vda_cfnp); 405 } 406 407 conv_iter_ret_t 408 conv_iter_dyn_feature1(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, 409 void *uvalue) 410 { 411 return (conv_iter_vd(conv_dyn_feature1_strings(fmt_flags), 412 func, uvalue)); 413 } 414 415 const conv_ds_t ** 416 conv_dyn_tag_strings(conv_iter_osabi_t osabi, Half mach, 417 Conv_fmt_flags_t fmt_flags) 418 { 419 /* 420 * Maximum # of items that can be in the returned array. Size this 421 * by counting the maximum depth in the switch statement that fills 422 * retarr at the end of this function. 423 */ 424 #define MAX_RET 12 425 426 /* 427 * Generic dynamic tags: 428 * - Note hole between DT_FLAGS and DT_PREINIT_ARRAY (tag 32). 429 * We use a 0, which is the signal for "not defined". 430 * - This range has alternative names for dump, requiring an 431 * additional array. 432 */ 433 static const Msg tags_null_cf[] = { 434 MSG_DT_NULL_CF, MSG_DT_NEEDED_CF, 435 MSG_DT_PLTRELSZ_CF, MSG_DT_PLTGOT_CF, 436 MSG_DT_HASH_CF, MSG_DT_STRTAB_CF, 437 MSG_DT_SYMTAB_CF, MSG_DT_RELA_CF, 438 MSG_DT_RELASZ_CF, MSG_DT_RELAENT_CF, 439 MSG_DT_STRSZ_CF, MSG_DT_SYMENT_CF, 440 MSG_DT_INIT_CF, MSG_DT_FINI_CF, 441 MSG_DT_SONAME_CF, MSG_DT_RPATH_CF, 442 MSG_DT_SYMBOLIC_CF, MSG_DT_REL_CF, 443 MSG_DT_RELSZ_CF, MSG_DT_RELENT_CF, 444 MSG_DT_PLTREL_CF, MSG_DT_DEBUG_CF, 445 MSG_DT_TEXTREL_CF, MSG_DT_JMPREL_CF, 446 MSG_DT_BIND_NOW_CF, MSG_DT_INIT_ARRAY_CF, 447 MSG_DT_FINI_ARRAY_CF, MSG_DT_INIT_ARRAYSZ_CF, 448 MSG_DT_FINI_ARRAYSZ_CF, MSG_DT_RUNPATH_CF, 449 MSG_DT_FLAGS_CF, 0, 450 MSG_DT_PREINIT_ARRAY_CF, MSG_DT_PREINIT_ARRAYSZ_CF 451 }; 452 static const Msg tags_null_cfnp[] = { 453 MSG_DT_NULL_CFNP, MSG_DT_NEEDED_CFNP, 454 MSG_DT_PLTRELSZ_CFNP, MSG_DT_PLTGOT_CFNP, 455 MSG_DT_HASH_CFNP, MSG_DT_STRTAB_CFNP, 456 MSG_DT_SYMTAB_CFNP, MSG_DT_RELA_CFNP, 457 MSG_DT_RELASZ_CFNP, MSG_DT_RELAENT_CFNP, 458 MSG_DT_STRSZ_CFNP, MSG_DT_SYMENT_CFNP, 459 MSG_DT_INIT_CFNP, MSG_DT_FINI_CFNP, 460 MSG_DT_SONAME_CFNP, MSG_DT_RPATH_CFNP, 461 MSG_DT_SYMBOLIC_CFNP, MSG_DT_REL_CFNP, 462 MSG_DT_RELSZ_CFNP, MSG_DT_RELENT_CFNP, 463 MSG_DT_PLTREL_CFNP, MSG_DT_DEBUG_CFNP, 464 MSG_DT_TEXTREL_CFNP, MSG_DT_JMPREL_CFNP, 465 MSG_DT_BIND_NOW_CFNP, MSG_DT_INIT_ARRAY_CFNP, 466 MSG_DT_FINI_ARRAY_CFNP, MSG_DT_INIT_ARRAYSZ_CFNP, 467 MSG_DT_FINI_ARRAYSZ_CFNP, MSG_DT_RUNPATH_CFNP, 468 MSG_DT_FLAGS_CFNP, 0, 469 MSG_DT_PREINIT_ARRAY_CFNP, MSG_DT_PREINIT_ARRAYSZ_CFNP 470 }; 471 static const Msg tags_null_nf[] = { 472 MSG_DT_NULL_NF, MSG_DT_NEEDED_NF, 473 MSG_DT_PLTRELSZ_NF, MSG_DT_PLTGOT_NF, 474 MSG_DT_HASH_NF, MSG_DT_STRTAB_NF, 475 MSG_DT_SYMTAB_NF, MSG_DT_RELA_NF, 476 MSG_DT_RELASZ_NF, MSG_DT_RELAENT_NF, 477 MSG_DT_STRSZ_NF, MSG_DT_SYMENT_NF, 478 MSG_DT_INIT_NF, MSG_DT_FINI_NF, 479 MSG_DT_SONAME_NF, MSG_DT_RPATH_NF, 480 MSG_DT_SYMBOLIC_NF, MSG_DT_REL_NF, 481 MSG_DT_RELSZ_NF, MSG_DT_RELENT_NF, 482 MSG_DT_PLTREL_NF, MSG_DT_DEBUG_NF, 483 MSG_DT_TEXTREL_NF, MSG_DT_JMPREL_NF, 484 MSG_DT_BIND_NOW_NF, MSG_DT_INIT_ARRAY_NF, 485 MSG_DT_FINI_ARRAY_NF, MSG_DT_INIT_ARRAYSZ_NF, 486 MSG_DT_FINI_ARRAYSZ_NF, MSG_DT_RUNPATH_NF, 487 MSG_DT_FLAGS_NF, 0, 488 MSG_DT_PREINIT_ARRAY_NF, MSG_DT_PREINIT_ARRAYSZ_NF 489 }; 490 static const Msg tags_null_dmp[] = { 491 MSG_DT_NULL_CFNP, MSG_DT_NEEDED_CFNP, 492 MSG_DT_PLTRELSZ_DMP, MSG_DT_PLTGOT_CFNP, 493 MSG_DT_HASH_CFNP, MSG_DT_STRTAB_CFNP, 494 MSG_DT_SYMTAB_CFNP, MSG_DT_RELA_CFNP, 495 MSG_DT_RELASZ_CFNP, MSG_DT_RELAENT_CFNP, 496 MSG_DT_STRSZ_CFNP, MSG_DT_SYMENT_CFNP, 497 MSG_DT_INIT_CFNP, MSG_DT_FINI_CFNP, 498 MSG_DT_SONAME_CFNP, MSG_DT_RPATH_CFNP, 499 MSG_DT_SYMBOLIC_DMP, MSG_DT_REL_CFNP, 500 MSG_DT_RELSZ_CFNP, MSG_DT_RELENT_CFNP, 501 MSG_DT_PLTREL_CFNP, MSG_DT_DEBUG_CFNP, 502 MSG_DT_TEXTREL_CFNP, MSG_DT_JMPREL_CFNP, 503 MSG_DT_BIND_NOW_CFNP, MSG_DT_INIT_ARRAY_CFNP, 504 MSG_DT_FINI_ARRAY_CFNP, MSG_DT_INIT_ARRAYSZ_CFNP, 505 MSG_DT_FINI_ARRAYSZ_CFNP, MSG_DT_RUNPATH_CFNP, 506 MSG_DT_FLAGS_CFNP, 0, 507 MSG_DT_PREINIT_ARRAY_CFNP, MSG_DT_PREINIT_ARRAYSZ_CFNP 508 }; 509 static const conv_ds_msg_t ds_null_cf = { 510 CONV_DS_MSG_INIT(DT_NULL, tags_null_cf) }; 511 static const conv_ds_msg_t ds_null_cfnp = { 512 CONV_DS_MSG_INIT(DT_NULL, tags_null_cfnp) }; 513 static const conv_ds_msg_t ds_null_nf = { 514 CONV_DS_MSG_INIT(DT_NULL, tags_null_nf) }; 515 static const conv_ds_msg_t ds_null_dmp = { 516 CONV_DS_MSG_INIT(DT_NULL, tags_null_dmp) }; 517 518 /* 519 * DT_SPARC_REGISTER was originally assigned 0x7000001. It is processor 520 * specific, and should have been in the range DT_LOPROC-DT_HIPROC 521 * instead of here. When the error was fixed, 522 * DT_DEPRECATED_SPARC_REGISTER was created to maintain backward 523 * compatability. 524 */ 525 static const Msg tags_sdreg_cf[] = { 526 MSG_DT_DEP_SPARC_REG_CF }; 527 static const Msg tags_sdreg_cfnp[] = { 528 MSG_DT_DEP_SPARC_REG_CFNP }; 529 static const Msg tags_sdreg_nf[] = { 530 MSG_DT_DEP_SPARC_REG_NF }; 531 532 static const conv_ds_msg_t ds_sdreg_cf = { 533 CONV_DS_MSG_INIT(DT_DEPRECATED_SPARC_REGISTER, tags_sdreg_cf) }; 534 static const conv_ds_msg_t ds_sdreg_cfnp = { 535 CONV_DS_MSG_INIT(DT_DEPRECATED_SPARC_REGISTER, tags_sdreg_cfnp) }; 536 static const conv_ds_msg_t ds_sdreg_nf = { 537 CONV_DS_MSG_INIT(DT_DEPRECATED_SPARC_REGISTER, tags_sdreg_nf) }; 538 539 540 /* 541 * SUNW: DT_LOOS -> DT_HIOS range. Note holes between DT_SUNW_TLSSORTSZ, 542 * DT_SUNW_STRPAD, and DT_SUNW_LDMACH. We handle the outliers 543 * separately below as single values. 544 */ 545 static const Msg tags_sunw_auxiliary_cf[] = { 546 MSG_DT_SUNW_AUXILIARY_CF, MSG_DT_SUNW_RTLDINF_CF, 547 MSG_DT_SUNW_FILTER_CF, MSG_DT_SUNW_CAP_CF, 548 MSG_DT_SUNW_SYMTAB_CF, MSG_DT_SUNW_SYMSZ_CF, 549 MSG_DT_SUNW_SORTENT_CF, MSG_DT_SUNW_SYMSORT_CF, 550 MSG_DT_SUNW_SYMSORTSZ_CF, MSG_DT_SUNW_TLSSORT_CF, 551 MSG_DT_SUNW_TLSSORTSZ_CF, MSG_DT_SUNW_CAPINFO_CF, 552 MSG_DT_SUNW_STRPAD_CF, MSG_DT_SUNW_CAPCHAIN_CF, 553 MSG_DT_SUNW_LDMACH_CF, 0, 554 MSG_DT_SUNW_CAPCHAINENT_CF, 0, 555 MSG_DT_SUNW_CAPCHAINSZ_CF 556 }; 557 static const Msg tags_sunw_auxiliary_cfnp[] = { 558 MSG_DT_SUNW_AUXILIARY_CFNP, MSG_DT_SUNW_RTLDINF_CFNP, 559 MSG_DT_SUNW_FILTER_CFNP, MSG_DT_SUNW_CAP_CFNP, 560 MSG_DT_SUNW_SYMTAB_CFNP, MSG_DT_SUNW_SYMSZ_CFNP, 561 MSG_DT_SUNW_SORTENT_CFNP, MSG_DT_SUNW_SYMSORT_CFNP, 562 MSG_DT_SUNW_SYMSORTSZ_CFNP, MSG_DT_SUNW_TLSSORT_CFNP, 563 MSG_DT_SUNW_TLSSORTSZ_CFNP, MSG_DT_SUNW_CAPINFO_CFNP, 564 MSG_DT_SUNW_STRPAD_CFNP, MSG_DT_SUNW_CAPCHAIN_CFNP, 565 MSG_DT_SUNW_LDMACH_CFNP, 0, 566 MSG_DT_SUNW_CAPCHAINENT_CFNP, 0, 567 MSG_DT_SUNW_CAPCHAINSZ_CFNP 568 }; 569 static const Msg tags_sunw_auxiliary_nf[] = { 570 MSG_DT_SUNW_AUXILIARY_NF, MSG_DT_SUNW_RTLDINF_NF, 571 MSG_DT_SUNW_FILTER_NF, MSG_DT_SUNW_CAP_NF, 572 MSG_DT_SUNW_SYMTAB_NF, MSG_DT_SUNW_SYMSZ_NF, 573 MSG_DT_SUNW_SORTENT_NF, MSG_DT_SUNW_SYMSORT_NF, 574 MSG_DT_SUNW_SYMSORTSZ_NF, MSG_DT_SUNW_TLSSORT_NF, 575 MSG_DT_SUNW_TLSSORTSZ_NF, MSG_DT_SUNW_CAPINFO_NF, 576 MSG_DT_SUNW_STRPAD_NF, MSG_DT_SUNW_CAPCHAIN_NF, 577 MSG_DT_SUNW_LDMACH_NF, 0, 578 MSG_DT_SUNW_CAPCHAINENT_NF, 0, 579 MSG_DT_SUNW_CAPCHAINSZ_NF 580 }; 581 static const conv_ds_msg_t ds_sunw_auxiliary_cf = { 582 CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_cf) }; 583 static const conv_ds_msg_t ds_sunw_auxiliary_cfnp = { 584 CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_cfnp) }; 585 static const conv_ds_msg_t ds_sunw_auxiliary_nf = { 586 CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_nf) }; 587 588 /* 589 * GNU: (In DT_VALRNGLO section) DT_GNU_PRELINKED - DT_GNU_LIBLISTSZ 590 */ 591 static const Msg tags_gnu_prelinked_cf[] = { 592 MSG_DT_GNU_PRELINKED_CF, MSG_DT_GNU_CONFLICTSZ_CF, 593 MSG_DT_GNU_LIBLISTSZ_CF 594 }; 595 static const Msg tags_gnu_prelinked_cfnp[] = { 596 MSG_DT_GNU_PRELINKED_CFNP, MSG_DT_GNU_CONFLICTSZ_CFNP, 597 MSG_DT_GNU_LIBLISTSZ_CFNP 598 }; 599 static const Msg tags_gnu_prelinked_nf[] = { 600 MSG_DT_GNU_PRELINKED_NF, MSG_DT_GNU_CONFLICTSZ_NF, 601 MSG_DT_GNU_LIBLISTSZ_NF 602 }; 603 static const conv_ds_msg_t ds_gnu_prelinked_cf = { 604 CONV_DS_MSG_INIT(DT_GNU_PRELINKED, tags_gnu_prelinked_cf) }; 605 static const conv_ds_msg_t ds_gnu_prelinked_cfnp = { 606 CONV_DS_MSG_INIT(DT_GNU_PRELINKED, tags_gnu_prelinked_cfnp) }; 607 static const conv_ds_msg_t ds_gnu_prelinked_nf = { 608 CONV_DS_MSG_INIT(DT_GNU_PRELINKED, tags_gnu_prelinked_nf) }; 609 610 /* 611 * SUNW: DT_VALRNGLO - DT_VALRNGHI range. 612 */ 613 static const Msg tags_checksum_cf[] = { 614 MSG_DT_CHECKSUM_CF, MSG_DT_PLTPADSZ_CF, 615 MSG_DT_MOVEENT_CF, MSG_DT_MOVESZ_CF, 616 MSG_DT_FEATURE_1_CF, MSG_DT_POSFLAG_1_CF, 617 MSG_DT_SYMINSZ_CF, MSG_DT_SYMINENT_CF 618 }; 619 static const Msg tags_checksum_cfnp[] = { 620 MSG_DT_CHECKSUM_CFNP, MSG_DT_PLTPADSZ_CFNP, 621 MSG_DT_MOVEENT_CFNP, MSG_DT_MOVESZ_CFNP, 622 MSG_DT_FEATURE_1_CFNP, MSG_DT_POSFLAG_1_CFNP, 623 MSG_DT_SYMINSZ_CFNP, MSG_DT_SYMINENT_CFNP 624 }; 625 static const Msg tags_checksum_nf[] = { 626 MSG_DT_CHECKSUM_NF, MSG_DT_PLTPADSZ_NF, 627 MSG_DT_MOVEENT_NF, MSG_DT_MOVESZ_NF, 628 MSG_DT_FEATURE_1_NF, MSG_DT_POSFLAG_1_NF, 629 MSG_DT_SYMINSZ_NF, MSG_DT_SYMINENT_NF 630 }; 631 static const conv_ds_msg_t ds_checksum_cf = { 632 CONV_DS_MSG_INIT(DT_CHECKSUM, tags_checksum_cf) }; 633 static const conv_ds_msg_t ds_checksum_cfnp = { 634 CONV_DS_MSG_INIT(DT_CHECKSUM, tags_checksum_cfnp) }; 635 static const conv_ds_msg_t ds_checksum_nf = { 636 CONV_DS_MSG_INIT(DT_CHECKSUM, tags_checksum_nf) }; 637 638 /* 639 * GNU: (In DT_ADDRRNGLO section) DT_GNU_HASH - DT_GNU_LIBLIST 640 */ 641 static const Msg tags_gnu_hash_cf[] = { 642 MSG_DT_GNU_HASH_CF, MSG_DT_TLSDESC_PLT_CF, 643 MSG_DT_TLSDESC_GOT_CF, MSG_DT_GNU_CONFLICT_CF, 644 MSG_DT_GNU_LIBLIST_CF 645 }; 646 static const Msg tags_gnu_hash_cfnp[] = { 647 MSG_DT_GNU_HASH_CFNP, MSG_DT_TLSDESC_PLT_CFNP, 648 MSG_DT_TLSDESC_GOT_CFNP, MSG_DT_GNU_CONFLICT_CFNP, 649 MSG_DT_GNU_LIBLIST_CFNP 650 }; 651 static const Msg tags_gnu_hash_nf[] = { 652 MSG_DT_GNU_HASH_NF, MSG_DT_TLSDESC_PLT_NF, 653 MSG_DT_TLSDESC_GOT_NF, MSG_DT_GNU_CONFLICT_NF, 654 MSG_DT_GNU_LIBLIST_NF 655 }; 656 static const conv_ds_msg_t ds_gnu_hash_cf = { 657 CONV_DS_MSG_INIT(DT_GNU_HASH, tags_gnu_hash_cf) }; 658 static const conv_ds_msg_t ds_gnu_hash_cfnp = { 659 CONV_DS_MSG_INIT(DT_GNU_HASH, tags_gnu_hash_cfnp) }; 660 static const conv_ds_msg_t ds_gnu_hash_nf = { 661 CONV_DS_MSG_INIT(DT_GNU_HASH, tags_gnu_hash_nf) }; 662 663 /* 664 * SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range. 665 */ 666 static const Msg tags_config_cf[] = { 667 MSG_DT_CONFIG_CF, MSG_DT_DEPAUDIT_CF, 668 MSG_DT_AUDIT_CF, MSG_DT_PLTPAD_CF, 669 MSG_DT_MOVETAB_CF, MSG_DT_SYMINFO_CF 670 }; 671 static const Msg tags_config_cfnp[] = { 672 MSG_DT_CONFIG_CFNP, MSG_DT_DEPAUDIT_CFNP, 673 MSG_DT_AUDIT_CFNP, MSG_DT_PLTPAD_CFNP, 674 MSG_DT_MOVETAB_CFNP, MSG_DT_SYMINFO_CFNP 675 }; 676 static const Msg tags_config_nf[] = { 677 MSG_DT_CONFIG_NF, MSG_DT_DEPAUDIT_NF, 678 MSG_DT_AUDIT_NF, MSG_DT_PLTPAD_NF, 679 MSG_DT_MOVETAB_NF, MSG_DT_SYMINFO_NF 680 }; 681 static const conv_ds_msg_t ds_config_cf = { 682 CONV_DS_MSG_INIT(DT_CONFIG, tags_config_cf) }; 683 static const conv_ds_msg_t ds_config_cfnp = { 684 CONV_DS_MSG_INIT(DT_CONFIG, tags_config_cfnp) }; 685 static const conv_ds_msg_t ds_config_nf = { 686 CONV_DS_MSG_INIT(DT_CONFIG, tags_config_nf) }; 687 688 /* 689 * SUNW: generic range. Note hole between DT_VERSYM and DT_RELACOUNT. 690 */ 691 static const Msg tags_versym_cf[] = { MSG_DT_VERSYM_CF }; 692 static const Msg tags_versym_cfnp[] = { MSG_DT_VERSYM_CFNP }; 693 static const Msg tags_versym_nf[] = { MSG_DT_VERSYM_NF }; 694 static const conv_ds_msg_t ds_versym_cf = { 695 CONV_DS_MSG_INIT(DT_VERSYM, tags_versym_cf) }; 696 static const conv_ds_msg_t ds_versym_cfnp = { 697 CONV_DS_MSG_INIT(DT_VERSYM, tags_versym_cfnp) }; 698 static const conv_ds_msg_t ds_versym_nf = { 699 CONV_DS_MSG_INIT(DT_VERSYM, tags_versym_nf) }; 700 701 static const Msg tags_relacount_cf[] = { 702 MSG_DT_RELACOUNT_CF, MSG_DT_RELCOUNT_CF, 703 MSG_DT_FLAGS_1_CF, MSG_DT_VERDEF_CF, 704 MSG_DT_VERDEFNUM_CF, MSG_DT_VERNEED_CF, 705 MSG_DT_VERNEEDNUM_CF 706 }; 707 static const Msg tags_relacount_cfnp[] = { 708 MSG_DT_RELACOUNT_CFNP, MSG_DT_RELCOUNT_CFNP, 709 MSG_DT_FLAGS_1_CFNP, MSG_DT_VERDEF_CFNP, 710 MSG_DT_VERDEFNUM_CFNP, MSG_DT_VERNEED_CFNP, 711 MSG_DT_VERNEEDNUM_CFNP 712 }; 713 static const Msg tags_relacount_nf[] = { 714 MSG_DT_RELACOUNT_NF, MSG_DT_RELCOUNT_NF, 715 MSG_DT_FLAGS_1_NF, MSG_DT_VERDEF_NF, 716 MSG_DT_VERDEFNUM_NF, MSG_DT_VERNEED_NF, 717 MSG_DT_VERNEEDNUM_NF 718 }; 719 static const conv_ds_msg_t ds_relacount_cf = { 720 CONV_DS_MSG_INIT(DT_RELACOUNT, tags_relacount_cf) }; 721 static const conv_ds_msg_t ds_relacount_cfnp = { 722 CONV_DS_MSG_INIT(DT_RELACOUNT, tags_relacount_cfnp) }; 723 static const conv_ds_msg_t ds_relacount_nf = { 724 CONV_DS_MSG_INIT(DT_RELACOUNT, tags_relacount_nf) }; 725 726 /* 727 * DT_LOPROC - DT_HIPROC range: solaris/sparc-only 728 */ 729 static const Msg tags_sparc_reg_cf[] = { MSG_DT_SPARC_REGISTER_CF }; 730 static const Msg tags_sparc_reg_cfnp[] = { MSG_DT_SPARC_REGISTER_CFNP }; 731 static const Msg tags_sparc_reg_nf[] = { MSG_DT_SPARC_REGISTER_NF }; 732 static const Msg tags_sparc_reg_dmp[] = { MSG_DT_SPARC_REGISTER_DMP }; 733 static const conv_ds_msg_t ds_sparc_reg_cf = { 734 CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_cf) }; 735 static const conv_ds_msg_t ds_sparc_reg_cfnp = { 736 CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_cfnp) }; 737 static const conv_ds_msg_t ds_sparc_reg_nf = { 738 CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_nf) }; 739 static const conv_ds_msg_t ds_sparc_reg_dmp = { 740 CONV_DS_MSG_INIT(DT_SPARC_REGISTER, tags_sparc_reg_dmp) }; 741 742 /* 743 * DT_LOPROC - DT_HIPROC range: Solaris osabi, all hardware 744 */ 745 static const Msg tags_auxiliary_cf[] = { 746 MSG_DT_AUXILIARY_CF, MSG_DT_USED_CF, 747 MSG_DT_FILTER_CF 748 }; 749 static const Msg tags_auxiliary_cfnp[] = { 750 MSG_DT_AUXILIARY_CFNP, MSG_DT_USED_CFNP, 751 MSG_DT_FILTER_CFNP 752 }; 753 static const Msg tags_auxiliary_nf[] = { 754 MSG_DT_AUXILIARY_NF, MSG_DT_USED_NF, 755 MSG_DT_FILTER_NF 756 }; 757 static const conv_ds_msg_t ds_auxiliary_cf = { 758 CONV_DS_MSG_INIT(DT_AUXILIARY, tags_auxiliary_cf) }; 759 static const conv_ds_msg_t ds_auxiliary_cfnp = { 760 CONV_DS_MSG_INIT(DT_AUXILIARY, tags_auxiliary_cfnp) }; 761 static const conv_ds_msg_t ds_auxiliary_nf = { 762 CONV_DS_MSG_INIT(DT_AUXILIARY, tags_auxiliary_nf) }; 763 764 765 static const conv_ds_t *retarr[MAX_RET]; 766 767 int ndx = 0; 768 int fmt_osabi = CONV_TYPE_FMT_ALT(fmt_flags); 769 int mach_sparc, osabi_solaris, osabi_linux; 770 771 772 773 osabi_solaris = (osabi == ELFOSABI_NONE) || 774 (osabi == ELFOSABI_SOLARIS) || (osabi == CONV_OSABI_ALL); 775 osabi_linux = (osabi == ELFOSABI_LINUX) || (osabi == CONV_OSABI_ALL); 776 mach_sparc = (mach == EM_SPARC) || (mach == EM_SPARCV9) || 777 (mach == EM_SPARC32PLUS) || (mach == CONV_MACH_ALL); 778 779 /* 780 * Fill in retarr with the descriptors for the messages that 781 * apply to the current osabi. Note that we order these items such 782 * that the more common are placed at the beginning, and the less 783 * likely at the end. This should speed the common case. 784 * 785 * Note that the CFNP and DMP styles are very similar, so they 786 * are combined in 'default', and fmt_osabi is consulted when there 787 * are differences. 788 */ 789 switch (fmt_osabi) { 790 case CONV_FMT_ALT_CF: 791 retarr[ndx++] = CONV_DS_ADDR(ds_null_cf); 792 if (osabi_solaris) 793 retarr[ndx++] = CONV_DS_ADDR(ds_sunw_auxiliary_cf); 794 retarr[ndx++] = CONV_DS_ADDR(ds_checksum_cf); 795 retarr[ndx++] = CONV_DS_ADDR(ds_config_cf); 796 retarr[ndx++] = CONV_DS_ADDR(ds_versym_cf); 797 retarr[ndx++] = CONV_DS_ADDR(ds_relacount_cf); 798 if (osabi_solaris) { 799 retarr[ndx++] = CONV_DS_ADDR(ds_auxiliary_cf); 800 if (mach_sparc) { 801 retarr[ndx++] = CONV_DS_ADDR(ds_sparc_reg_cf); 802 retarr[ndx++] = CONV_DS_ADDR(ds_sdreg_cf); 803 } 804 } 805 if (osabi_linux) { 806 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_prelinked_cf); 807 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_hash_cf); 808 } 809 break; 810 811 case CONV_FMT_ALT_NF: 812 retarr[ndx++] = CONV_DS_ADDR(ds_null_nf); 813 if (osabi_solaris) 814 retarr[ndx++] = CONV_DS_ADDR(ds_sunw_auxiliary_nf); 815 retarr[ndx++] = CONV_DS_ADDR(ds_checksum_nf); 816 retarr[ndx++] = CONV_DS_ADDR(ds_config_nf); 817 retarr[ndx++] = CONV_DS_ADDR(ds_versym_nf); 818 retarr[ndx++] = CONV_DS_ADDR(ds_relacount_nf); 819 if (osabi_solaris) { 820 retarr[ndx++] = CONV_DS_ADDR(ds_auxiliary_nf); 821 if (mach_sparc) { 822 retarr[ndx++] = CONV_DS_ADDR(ds_sparc_reg_nf); 823 retarr[ndx++] = CONV_DS_ADDR(ds_sdreg_nf); 824 } 825 } 826 if (osabi_linux) { 827 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_prelinked_nf); 828 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_hash_nf); 829 } 830 break; 831 default: 832 /* 833 * The default style for the generic range is CFNP, 834 * while dump has a couple of different strings. 835 */ 836 837 retarr[ndx++] = (fmt_osabi == CONV_FMT_ALT_DUMP) ? 838 CONV_DS_ADDR(ds_null_dmp) : CONV_DS_ADDR(ds_null_cfnp); 839 if (osabi_solaris) 840 retarr[ndx++] = CONV_DS_ADDR(ds_sunw_auxiliary_cfnp); 841 retarr[ndx++] = CONV_DS_ADDR(ds_checksum_cfnp); 842 retarr[ndx++] = CONV_DS_ADDR(ds_config_cfnp); 843 retarr[ndx++] = CONV_DS_ADDR(ds_versym_cfnp); 844 retarr[ndx++] = CONV_DS_ADDR(ds_relacount_cfnp); 845 if (osabi_solaris) { 846 retarr[ndx++] = CONV_DS_ADDR(ds_auxiliary_cfnp); 847 if (mach_sparc) { 848 /* 849 * The default style for DT_SPARC_REGISTER 850 * is the dump style, which omits the 'SPARC_'. 851 * CFNP keeps the prefix. 852 */ 853 retarr[ndx++] = 854 (fmt_osabi == CONV_FMT_ALT_CFNP) ? 855 CONV_DS_ADDR(ds_sparc_reg_cfnp) : 856 CONV_DS_ADDR(ds_sparc_reg_dmp); 857 retarr[ndx++] = CONV_DS_ADDR(ds_sdreg_cfnp); 858 } 859 } 860 if (osabi_linux) { 861 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_prelinked_cfnp); 862 retarr[ndx++] = CONV_DS_ADDR(ds_gnu_hash_cfnp); 863 } 864 break; 865 } 866 867 retarr[ndx++] = NULL; 868 assert(ndx <= MAX_RET); 869 return (retarr); 870 } 871 872 conv_iter_ret_t 873 conv_iter_dyn_tag(conv_iter_osabi_t osabi, Half mach, 874 Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue) 875 { 876 return (conv_iter_ds(osabi, mach, 877 conv_dyn_tag_strings(osabi, mach, fmt_flags), func, uvalue)); 878 } 879 880 881 #define BINDTSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 882 MSG_BND_NEEDED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 883 MSG_BND_REFER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 884 MSG_BND_FILTER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 885 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 886 887 /* 888 * Ensure that Conv_bnd_type_buf_t is large enough: 889 * 890 * BINDTSZ is the real minimum size of the buffer required by conv_bnd_type(). 891 * However, Conv_bnd_type_buf_t uses CONV_BND_TYPE_BUFSIZE to set the 892 * buffer size. We do things this way because the definition of BINDTSZ uses 893 * information that is not available in the environment of other programs 894 * that include the conv.h header file. 895 */ 896 #if (CONV_BND_TYPE_BUFSIZE != BINDTSZ) && !defined(__lint) 897 #define REPORT_BUFSIZE BINDTSZ 898 #include "report_bufsize.h" 899 #error "CONV_BND_TYPE_BUFSIZE does not match BINDTSZ" 900 #endif 901 902 const char * 903 conv_bnd_type(uint_t flags, Conv_bnd_type_buf_t *bnd_type_buf) 904 { 905 static const Val_desc vda[] = { 906 { BND_NEEDED, MSG_BND_NEEDED }, 907 { BND_REFER, MSG_BND_REFER }, 908 { BND_FILTER, MSG_BND_FILTER }, 909 { 0, 0 } 910 }; 911 static CONV_EXPN_FIELD_ARG conv_arg = { 912 NULL, sizeof (bnd_type_buf->buf) }; 913 914 if (flags == 0) 915 return (MSG_ORIG(MSG_STR_EMPTY)); 916 917 conv_arg.buf = bnd_type_buf->buf; 918 conv_arg.oflags = conv_arg.rflags = flags; 919 (void) conv_expn_field(&conv_arg, vda, 0); 920 921 return ((const char *)bnd_type_buf->buf); 922 } 923 924 /* 925 * Note, conv_bnd_obj() is called with either: 926 * LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or 927 * LML_FLG_OBJDELETED, or 928 * LML_FLG_ATEXIT. 929 */ 930 #define BINDOSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ 931 MSG_BND_ADDED_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 932 MSG_BND_REEVAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ 933 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 934 935 /* 936 * Ensure that Conv_bnd_obj_buf_t is large enough: 937 * 938 * BINDOSZ is the real minimum size of the buffer required by conv_bnd_obj(). 939 * However, Conv_bnd_obj_buf_t uses CONV_BND_OBJ_BUFSIZE to set the 940 * buffer size. We do things this way because the definition of BINDOSZ uses 941 * information that is not available in the environment of other programs 942 * that include the conv.h header file. 943 */ 944 #if (CONV_BND_OBJ_BUFSIZE != BINDOSZ) && !defined(__lint) 945 #define REPORT_BUFSIZE BINDOSZ 946 #include "report_bufsize.h" 947 #error "CONV_BND_OBJ_BUFSIZE does not match BINDOSZ" 948 #endif 949 950 const char * 951 conv_bnd_obj(uint_t flags, Conv_bnd_obj_buf_t *bnd_obj_buf) 952 { 953 static const Val_desc vda[] = { 954 { LML_FLG_OBJADDED, MSG_BND_ADDED }, 955 { LML_FLG_OBJREEVAL, MSG_BND_REEVAL }, 956 { LML_FLG_OBJDELETED, MSG_BND_DELETED }, 957 { LML_FLG_ATEXIT, MSG_BND_ATEXIT }, 958 { 0, 0 } 959 }; 960 static CONV_EXPN_FIELD_ARG conv_arg = { 961 NULL, sizeof (bnd_obj_buf->buf) }; 962 963 if ((flags & (LML_FLG_OBJADDED | LML_FLG_OBJREEVAL | 964 LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0) 965 return (MSG_ORIG(MSG_BND_REVISIT)); 966 967 /* 968 * Note, we're not worried about unknown flags for this family, only 969 * the selected flags are of interest, so we leave conv_arg.rflags 970 * set to 0. 971 */ 972 conv_arg.buf = bnd_obj_buf->buf; 973 conv_arg.oflags = flags; 974 (void) conv_expn_field(&conv_arg, vda, 0); 975 976 return ((const char *)bnd_obj_buf->buf); 977 } 978