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 /* 230Sstevel@tonic-gate * Copyright (c) 1988 AT&T 240Sstevel@tonic-gate * All Rights Reserved 250Sstevel@tonic-gate * 2612449SRod.Evans@Sun.COM * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. 270Sstevel@tonic-gate */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifndef _CONV_H 300Sstevel@tonic-gate #define _CONV_H 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* 330Sstevel@tonic-gate * Global include file for conversion library. 340Sstevel@tonic-gate */ 350Sstevel@tonic-gate 360Sstevel@tonic-gate #include <stdlib.h> 370Sstevel@tonic-gate #include <libelf.h> 380Sstevel@tonic-gate #include <dlfcn.h> 390Sstevel@tonic-gate #include <libld.h> 400Sstevel@tonic-gate #include <sgs.h> 419273SAli.Bahrami@Sun.COM #include <sgsmsg.h> 420Sstevel@tonic-gate 430Sstevel@tonic-gate #ifdef __cplusplus 440Sstevel@tonic-gate extern "C" { 450Sstevel@tonic-gate #endif 460Sstevel@tonic-gate 470Sstevel@tonic-gate /* 480Sstevel@tonic-gate * Configuration features available - maintained here (instead of debug.h) 490Sstevel@tonic-gate * to save libconv from having to include debug.h which results in numerous 500Sstevel@tonic-gate * "declared but not used or defined" lint errors. 510Sstevel@tonic-gate */ 520Sstevel@tonic-gate #define CONF_EDLIBPATH 0x000100 /* ELF default library path */ 530Sstevel@tonic-gate #define CONF_ESLIBPATH 0x000200 /* ELF secure library path */ 540Sstevel@tonic-gate #define CONF_ADLIBPATH 0x000400 /* AOUT default library path */ 550Sstevel@tonic-gate #define CONF_ASLIBPATH 0x000800 /* AOUT secure library path */ 560Sstevel@tonic-gate #define CONF_DIRCFG 0x001000 /* directory configuration available */ 570Sstevel@tonic-gate #define CONF_OBJALT 0x002000 /* object alternatives available */ 580Sstevel@tonic-gate #define CONF_MEMRESV 0x004000 /* memory reservation required */ 590Sstevel@tonic-gate #define CONF_ENVS 0x008000 /* environment variables available */ 600Sstevel@tonic-gate #define CONF_FLTR 0x010000 /* filter information available */ 610Sstevel@tonic-gate #define CONF_FEATMSK 0xffff00 620Sstevel@tonic-gate 639406SAli.Bahrami@Sun.COM 649406SAli.Bahrami@Sun.COM /* 659406SAli.Bahrami@Sun.COM * Valid flags for conv_strproc_extract_value(). 669406SAli.Bahrami@Sun.COM */ 679406SAli.Bahrami@Sun.COM #define CONV_SPEXV_F_NOTRIM 0x0001 /* Do not trim whitespace around '=' */ 689406SAli.Bahrami@Sun.COM #define CONV_SPEXV_F_UCASE 0x0002 /* Convert value to uppercase */ 699406SAli.Bahrami@Sun.COM #define CONV_SPEXV_F_NULLOK 0x0004 /* Empty ("") value is OK */ 709406SAli.Bahrami@Sun.COM 710Sstevel@tonic-gate /* 724734Sab196087 * Buffer types: 734734Sab196087 * 744734Sab196087 * Many of the routines in this module require the user to supply a 754734Sab196087 * buffer into which the desired strings may be written. These are 764734Sab196087 * all arrays of characters, and might be defined as simple arrays 774734Sab196087 * of char. The problem with that approach is that when such an array 784734Sab196087 * is passed to a function, the C language considers it to have the 794734Sab196087 * type (char *), without any regard to its length. Not all of our 804734Sab196087 * buffers have the same length, and we want to ensure that the compiler 814734Sab196087 * will refuse to compile code that passes the wrong type of buffer to 824734Sab196087 * a given routine. The solution is to define the buffers as unions 834734Sab196087 * that contain the needed array, and then to pass the given union 844734Sab196087 * by address. The compiler will catch attempts to pass the wrong type 854734Sab196087 * of pointer, and the size of a structure/union is implicit in its type. 864734Sab196087 * 874734Sab196087 * A nice side effect of this approach is that we can use a union with 884734Sab196087 * multiple buffers to handle the cases where a given routine needs 894734Sab196087 * more than one type of buffer. The end result is a single buffer large 904734Sab196087 * enough to handle any of the subcases, but no larger. 914734Sab196087 */ 924734Sab196087 934734Sab196087 /* 944734Sab196087 * Size of buffer used by conv_invalid_val(): 954734Sab196087 * 961618Srie * Various values that can't be matched to a symbolic definition are converted 974734Sab196087 * to a numeric string. 984734Sab196087 * 994734Sab196087 * The buffer size reflects the maximum number of digits needed to 1004734Sab196087 * display an integer as text, plus a trailing null, and with room for 1014734Sab196087 * a leading "0x" if hexidecimal display is selected. 1029273SAli.Bahrami@Sun.COM * 1039273SAli.Bahrami@Sun.COM * The 32-bit version of this requires 12 characters, and the 64-bit version 1049273SAli.Bahrami@Sun.COM * needs 22. By using the larger value for both, we can have a single 1059273SAli.Bahrami@Sun.COM * definition, which is necessary for code that is ELFCLASS independent. A 1069273SAli.Bahrami@Sun.COM * nice side benefit is that it lets us dispense with a large number of 32/64 1079273SAli.Bahrami@Sun.COM * buffer size definitions that build off CONV_INV_BUFSIZE, and the macros 1089273SAli.Bahrami@Sun.COM * that would then be needed. 1094734Sab196087 */ 1109273SAli.Bahrami@Sun.COM #define CONV_INV_BUFSIZE 22 1114734Sab196087 typedef union { 1129273SAli.Bahrami@Sun.COM char buf[CONV_INV_BUFSIZE]; 1139273SAli.Bahrami@Sun.COM } Conv_inv_buf_t; 1144734Sab196087 1154734Sab196087 /* conv_ehdr_flags() */ 1169273SAli.Bahrami@Sun.COM #define CONV_EHDR_FLAGS_BUFSIZE 91 1174734Sab196087 typedef union { 1189273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 1199273SAli.Bahrami@Sun.COM char buf[CONV_EHDR_FLAGS_BUFSIZE]; 1209273SAli.Bahrami@Sun.COM } Conv_ehdr_flags_buf_t; 1214734Sab196087 1224734Sab196087 /* conv_reject_desc() */ 1234734Sab196087 typedef union { 1249273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 1259273SAli.Bahrami@Sun.COM Conv_ehdr_flags_buf_t flags_buf; 1269273SAli.Bahrami@Sun.COM } Conv_reject_desc_buf_t; 1274734Sab196087 1284734Sab196087 /* 129*12877SRod.Evans@Sun.COM * conv_la_bind() 130*12877SRod.Evans@Sun.COM */ 131*12877SRod.Evans@Sun.COM #define CONV_LA_BIND_BUFSIZE 56 132*12877SRod.Evans@Sun.COM typedef union { 133*12877SRod.Evans@Sun.COM Conv_inv_buf_t inv_buf; 134*12877SRod.Evans@Sun.COM char buf[CONV_LA_BIND_BUFSIZE]; 135*12877SRod.Evans@Sun.COM } Conv_la_bind_buf_t; 136*12877SRod.Evans@Sun.COM 137*12877SRod.Evans@Sun.COM /* 138*12877SRod.Evans@Sun.COM * conv_la_search() 139*12877SRod.Evans@Sun.COM */ 140*12877SRod.Evans@Sun.COM #define CONV_LA_SEARCH_BUFSIZE 111 141*12877SRod.Evans@Sun.COM typedef union { 142*12877SRod.Evans@Sun.COM Conv_inv_buf_t inv_buf; 143*12877SRod.Evans@Sun.COM char buf[CONV_LA_SEARCH_BUFSIZE]; 144*12877SRod.Evans@Sun.COM } Conv_la_search_buf_t; 145*12877SRod.Evans@Sun.COM 146*12877SRod.Evans@Sun.COM /* 147*12877SRod.Evans@Sun.COM * conv_la_symbind() 148*12877SRod.Evans@Sun.COM */ 149*12877SRod.Evans@Sun.COM #define CONV_LA_SYMBIND_BUFSIZE 113 150*12877SRod.Evans@Sun.COM typedef union { 151*12877SRod.Evans@Sun.COM Conv_inv_buf_t inv_buf; 152*12877SRod.Evans@Sun.COM char buf[CONV_LA_SYMBIND_BUFSIZE]; 153*12877SRod.Evans@Sun.COM } Conv_la_symbind_buf_t; 154*12877SRod.Evans@Sun.COM 155*12877SRod.Evans@Sun.COM /* 15611827SRod.Evans@Sun.COM * conv_cap_val_hw/sf() 1574734Sab196087 * 15811827SRod.Evans@Sun.COM * These sizes are based on the maximum number of capabilities that exist. 15911827SRod.Evans@Sun.COM * See common/elfcap. 1604734Sab196087 */ 1614734Sab196087 #define CONV_CAP_VAL_HW1_BUFSIZE 195 1624734Sab196087 typedef union { 1639273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 1649273SAli.Bahrami@Sun.COM char buf[CONV_CAP_VAL_HW1_BUFSIZE]; 1659273SAli.Bahrami@Sun.COM } Conv_cap_val_hw1_buf_t; 1664734Sab196087 16711827SRod.Evans@Sun.COM #define CONV_CAP_VAL_HW2_BUFSIZE CONV_INV_BUFSIZE /* for now */ 16811827SRod.Evans@Sun.COM typedef union { 16911827SRod.Evans@Sun.COM Conv_inv_buf_t inv_buf; 17011827SRod.Evans@Sun.COM char buf[CONV_CAP_VAL_HW2_BUFSIZE]; 17111827SRod.Evans@Sun.COM } Conv_cap_val_hw2_buf_t; 17211827SRod.Evans@Sun.COM 1734734Sab196087 #define CONV_CAP_VAL_SF1_BUFSIZE 45 1744734Sab196087 typedef union { 1759273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 1769273SAli.Bahrami@Sun.COM char buf[CONV_CAP_VAL_SF1_BUFSIZE]; 1779273SAli.Bahrami@Sun.COM } Conv_cap_val_sf1_buf_t; 1784734Sab196087 1794734Sab196087 /* conv_cap_val_buf() */ 1804734Sab196087 typedef union { 1819273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 1829273SAli.Bahrami@Sun.COM Conv_cap_val_hw1_buf_t cap_val_hw1_buf; 1839273SAli.Bahrami@Sun.COM Conv_cap_val_sf1_buf_t cap_val_sf1_buf; 18411827SRod.Evans@Sun.COM Conv_cap_val_hw2_buf_t cap_val_hw2_buf; 1859273SAli.Bahrami@Sun.COM } Conv_cap_val_buf_t; 1864734Sab196087 1874734Sab196087 /* conv_config_feat() */ 1889273SAli.Bahrami@Sun.COM #define CONV_CONFIG_FEAT_BUFSIZE 204 1894734Sab196087 typedef union { 1909273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 1919273SAli.Bahrami@Sun.COM char buf[CONV_CONFIG_FEAT_BUFSIZE]; 1929273SAli.Bahrami@Sun.COM } Conv_config_feat_buf_t; 1934734Sab196087 1944734Sab196087 /* conv_config_obj() */ 1959273SAli.Bahrami@Sun.COM #define CONV_CONFIG_OBJ_BUFSIZE 164 1964734Sab196087 typedef union { 1979273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 1989273SAli.Bahrami@Sun.COM char buf[CONV_CONFIG_OBJ_BUFSIZE]; 1999273SAli.Bahrami@Sun.COM } Conv_config_obj_buf_t; 2004734Sab196087 2014734Sab196087 /* conv_dl_mode() */ 2029273SAli.Bahrami@Sun.COM #define CONV_DL_MODE_BUFSIZE 132 2034734Sab196087 typedef union { 2049273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2059273SAli.Bahrami@Sun.COM char buf[CONV_DL_MODE_BUFSIZE]; 2069273SAli.Bahrami@Sun.COM } Conv_dl_mode_buf_t; 2074734Sab196087 2084734Sab196087 /* conv_dl_flag() */ 2099273SAli.Bahrami@Sun.COM #define CONV_DL_FLAG_BUFSIZE 185 2104734Sab196087 typedef union { 2119273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2129273SAli.Bahrami@Sun.COM char buf[CONV_DL_FLAG_BUFSIZE]; 2139273SAli.Bahrami@Sun.COM } Conv_dl_flag_buf_t; 2144734Sab196087 2154734Sab196087 /* conv_grphdl_flags() */ 2169963SRod.Evans@Sun.COM #define CONV_GRPHDL_FLAGS_BUFSIZE 78 2174734Sab196087 typedef union { 2189273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2199273SAli.Bahrami@Sun.COM char buf[CONV_GRPHDL_FLAGS_BUFSIZE]; 2209273SAli.Bahrami@Sun.COM } Conv_grphdl_flags_buf_t; 2214734Sab196087 2224734Sab196087 /* conv_grpdesc_flags() */ 2239577SRod.Evans@Sun.COM #define CONV_GRPDESC_FLAGS_BUFSIZE 91 2244734Sab196087 typedef union { 2259273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2269273SAli.Bahrami@Sun.COM char buf[CONV_GRPDESC_FLAGS_BUFSIZE]; 2279273SAli.Bahrami@Sun.COM } Conv_grpdesc_flags_buf_t; 2284734Sab196087 2294734Sab196087 /* conv_seg_flags() */ 23011734SAli.Bahrami@Sun.COM #define CONV_SEG_FLAGS_BUFSIZE 241 2314734Sab196087 typedef union { 2329273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2339273SAli.Bahrami@Sun.COM char buf[CONV_SEG_FLAGS_BUFSIZE]; 2349273SAli.Bahrami@Sun.COM } Conv_seg_flags_buf_t; 2354734Sab196087 2364734Sab196087 /* conv_dyn_posflag1() */ 23712449SRod.Evans@Sun.COM #define CONV_DYN_POSFLAG1_BUFSIZE 72 2384734Sab196087 typedef union { 2399273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2409273SAli.Bahrami@Sun.COM char buf[CONV_DYN_POSFLAG1_BUFSIZE]; 2419273SAli.Bahrami@Sun.COM } Conv_dyn_posflag1_buf_t; 2424734Sab196087 2434734Sab196087 /* conv_dyn_flag() */ 2449273SAli.Bahrami@Sun.COM #define CONV_DYN_FLAG_BUFSIZE 85 2454734Sab196087 typedef union { 2469273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2479273SAli.Bahrami@Sun.COM char buf[CONV_DYN_FLAG_BUFSIZE]; 2489273SAli.Bahrami@Sun.COM } Conv_dyn_flag_buf_t; 2494734Sab196087 2504734Sab196087 /* conv_dyn_flag1() */ 2519273SAli.Bahrami@Sun.COM #define CONV_DYN_FLAG1_BUFSIZE 361 2524734Sab196087 typedef union { 2539273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2549273SAli.Bahrami@Sun.COM char buf[CONV_DYN_FLAG1_BUFSIZE]; 2559273SAli.Bahrami@Sun.COM } Conv_dyn_flag1_buf_t; 2564734Sab196087 2574734Sab196087 /* conv_dyn_feature1() */ 2589273SAli.Bahrami@Sun.COM #define CONV_DYN_FEATURE1_BUFSIZE 54 2594734Sab196087 typedef union { 2609273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2619273SAli.Bahrami@Sun.COM char buf[CONV_DYN_FEATURE1_BUFSIZE]; 2629273SAli.Bahrami@Sun.COM } Conv_dyn_feature1_buf_t; 2634734Sab196087 2644734Sab196087 /* conv_bnd_type() */ 2659273SAli.Bahrami@Sun.COM #define CONV_BND_TYPE_BUFSIZE 51 2664734Sab196087 typedef union { 2679273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2689273SAli.Bahrami@Sun.COM char buf[CONV_BND_TYPE_BUFSIZE]; 2699273SAli.Bahrami@Sun.COM } Conv_bnd_type_buf_t; 2704734Sab196087 2714734Sab196087 /* conv_bnd_obj() */ 2729273SAli.Bahrami@Sun.COM #define CONV_BND_OBJ_BUFSIZE 60 2734734Sab196087 typedef union { 2749273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2759273SAli.Bahrami@Sun.COM char buf[CONV_BND_OBJ_BUFSIZE]; 2769273SAli.Bahrami@Sun.COM } Conv_bnd_obj_buf_t; 2774734Sab196087 2784734Sab196087 /* conv_phdr_flags() */ 2799273SAli.Bahrami@Sun.COM #define CONV_PHDR_FLAGS_BUFSIZE 57 2804734Sab196087 typedef union { 2819577SRod.Evans@Sun.COM Conv_inv_buf_t inv_buf; 2829577SRod.Evans@Sun.COM char buf[CONV_PHDR_FLAGS_BUFSIZE]; 2839273SAli.Bahrami@Sun.COM } Conv_phdr_flags_buf_t; 2844734Sab196087 2854734Sab196087 /* conv_sec_flags() */ 2869273SAli.Bahrami@Sun.COM #define CONV_SEC_FLAGS_BUFSIZE 190 2874734Sab196087 typedef union { 2889273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2899273SAli.Bahrami@Sun.COM char buf[CONV_SEC_FLAGS_BUFSIZE]; 2909273SAli.Bahrami@Sun.COM } Conv_sec_flags_buf_t; 2914734Sab196087 2924734Sab196087 /* conv_dwarf_ehe() */ 2939273SAli.Bahrami@Sun.COM #define CONV_DWARF_EHE_BUFSIZE 43 2944734Sab196087 typedef union { 2959273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 2969273SAli.Bahrami@Sun.COM char buf[CONV_DWARF_EHE_BUFSIZE]; 2979273SAli.Bahrami@Sun.COM } Conv_dwarf_ehe_buf_t; 2984734Sab196087 2995088Sab196087 /* conv_syminfo_flags() */ 30012449SRod.Evans@Sun.COM #define CONV_SYMINFO_FLAGS_BUFSIZE 230 3015088Sab196087 typedef union { 3029273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3039273SAli.Bahrami@Sun.COM char buf[CONV_SYMINFO_FLAGS_BUFSIZE]; 3049273SAli.Bahrami@Sun.COM } Conv_syminfo_flags_buf_t; 3055088Sab196087 3066635Sab196087 /* conv_cnote_pr_flags() */ 3079273SAli.Bahrami@Sun.COM #define CONV_CNOTE_PR_FLAGS_BUFSIZE 254 3086635Sab196087 typedef union { 3099273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3109273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_PR_FLAGS_BUFSIZE]; 3119273SAli.Bahrami@Sun.COM } Conv_cnote_pr_flags_buf_t; 3126635Sab196087 3136635Sab196087 /* conv_cnote_old_pr_flags() */ 3149273SAli.Bahrami@Sun.COM #define CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE 174 3156635Sab196087 typedef union { 3169273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3179273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE]; 3189273SAli.Bahrami@Sun.COM } Conv_cnote_old_pr_flags_buf_t; 3196635Sab196087 3206635Sab196087 /* conv_cnote_proc_flag() */ 3219273SAli.Bahrami@Sun.COM #define CONV_CNOTE_PROC_FLAG_BUFSIZE 39 3226635Sab196087 typedef union { 3239273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3249273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_PROC_FLAG_BUFSIZE]; 3259273SAli.Bahrami@Sun.COM } Conv_cnote_proc_flag_buf_t; 3266635Sab196087 3276635Sab196087 3286635Sab196087 /* conv_cnote_sigset() */ 3299273SAli.Bahrami@Sun.COM #define CONV_CNOTE_SIGSET_BUFSIZE 639 3306635Sab196087 typedef union { 3319273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3329273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_SIGSET_BUFSIZE]; 3339273SAli.Bahrami@Sun.COM } Conv_cnote_sigset_buf_t; 3346635Sab196087 3356635Sab196087 /* conv_cnote_fltset() */ 3369273SAli.Bahrami@Sun.COM #define CONV_CNOTE_FLTSET_BUFSIZE 511 3376635Sab196087 typedef union { 3389273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3399273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_FLTSET_BUFSIZE]; 3409273SAli.Bahrami@Sun.COM } Conv_cnote_fltset_buf_t; 3416635Sab196087 3426635Sab196087 /* conv_cnote_sysset() */ 34311798SRoger.Faulkner@Sun.COM #define CONV_CNOTE_SYSSET_BUFSIZE 3195 3446635Sab196087 typedef union { 3459273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3469273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_SYSSET_BUFSIZE]; 3479273SAli.Bahrami@Sun.COM } Conv_cnote_sysset_buf_t; 3486635Sab196087 3496635Sab196087 /* conv_cnote_sa_flags() */ 3509273SAli.Bahrami@Sun.COM #define CONV_CNOTE_SA_FLAGS_BUFSIZE 109 3516635Sab196087 typedef union { 3529273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3539273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_SA_FLAGS_BUFSIZE]; 3549273SAli.Bahrami@Sun.COM } Conv_cnote_sa_flags_buf_t; 3556635Sab196087 3566635Sab196087 /* conv_cnote_ss_flags() */ 3579273SAli.Bahrami@Sun.COM #define CONV_CNOTE_SS_FLAGS_BUFSIZE 48 3586635Sab196087 typedef union { 3599273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3609273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_SS_FLAGS_BUFSIZE]; 3619273SAli.Bahrami@Sun.COM } Conv_cnote_ss_flags_buf_t; 3626635Sab196087 3636635Sab196087 /* conv_cnote_cc_content() */ 3649273SAli.Bahrami@Sun.COM #define CONV_CNOTE_CC_CONTENT_BUFSIZE 97 3656635Sab196087 typedef union { 3669273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3679273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_CC_CONTENT_BUFSIZE]; 3689273SAli.Bahrami@Sun.COM } Conv_cnote_cc_content_buf_t; 3696635Sab196087 3706635Sab196087 /* conv_cnote_auxv_af() */ 3719273SAli.Bahrami@Sun.COM #define CONV_CNOTE_AUXV_AF_BUFSIZE 73 3726635Sab196087 typedef union { 3739273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3749273SAli.Bahrami@Sun.COM char buf[CONV_CNOTE_AUXV_AF_BUFSIZE]; 3759273SAli.Bahrami@Sun.COM } Conv_cnote_auxv_af_buf_t; 3766635Sab196087 3777682SAli.Bahrami@Sun.COM /* conv_ver_flags() */ 3789273SAli.Bahrami@Sun.COM #define CONV_VER_FLAGS_BUFSIZE 41 3797682SAli.Bahrami@Sun.COM typedef union { 3809273SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 3819273SAli.Bahrami@Sun.COM char buf[CONV_VER_FLAGS_BUFSIZE]; 3829273SAli.Bahrami@Sun.COM } Conv_ver_flags_buf_t; 3834734Sab196087 38411734SAli.Bahrami@Sun.COM /* conv_ent_flags() */ 38511734SAli.Bahrami@Sun.COM #define CONV_ENT_FLAGS_BUFSIZE 69 38611734SAli.Bahrami@Sun.COM typedef union { 38711734SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 38811734SAli.Bahrami@Sun.COM char buf[CONV_ENT_FLAGS_BUFSIZE]; 38911734SAli.Bahrami@Sun.COM } Conv_ent_flags_buf_t; 39011734SAli.Bahrami@Sun.COM 39111734SAli.Bahrami@Sun.COM /* conv_ent_files_flags() */ 39211827SRod.Evans@Sun.COM #define CONV_ENT_FILES_FLAGS_BUFSIZE 89 39311734SAli.Bahrami@Sun.COM typedef union { 39411734SAli.Bahrami@Sun.COM Conv_inv_buf_t inv_buf; 39511734SAli.Bahrami@Sun.COM char buf[CONV_ENT_FILES_FLAGS_BUFSIZE]; 39611734SAli.Bahrami@Sun.COM } Conv_ent_files_flags_buf_t; 39711734SAli.Bahrami@Sun.COM 3989577SRod.Evans@Sun.COM /* 3999577SRod.Evans@Sun.COM * conv_time() 4009577SRod.Evans@Sun.COM * 4019577SRod.Evans@Sun.COM * This size is based on the maximum "hour.min.sec.fraction: " time that 4029577SRod.Evans@Sun.COM * would be expected of ld(). 4039577SRod.Evans@Sun.COM */ 4049577SRod.Evans@Sun.COM #define CONV_TIME_BUFSIZE 18 4059577SRod.Evans@Sun.COM typedef union { 4069577SRod.Evans@Sun.COM char buf[CONV_TIME_BUFSIZE]; 4079577SRod.Evans@Sun.COM } Conv_time_buf_t; 4082850Srie 4092850Srie /* 4105088Sab196087 * Many conversion routines accept a fmt_flags argument of this type 4115088Sab196087 * to allow the caller to modify the output. There are two parts to 4125088Sab196087 * this value: 4135088Sab196087 * 4145088Sab196087 * (1) Format requests (decimal vs hex, etc...) 4155088Sab196087 * (2) The low order bits specified by CONV_MASK_FMT_ALT 4165088Sab196087 * and retrieved by CONV_TYPE_FMT_ALT are integer 4175088Sab196087 * values that specify that an alternate set of 4189273SAli.Bahrami@Sun.COM * strings should be used. 4195088Sab196087 * 4209273SAli.Bahrami@Sun.COM * The fmt_flags value is designed such that a caller can always 4219273SAli.Bahrami@Sun.COM * supply a 0 in order to receive default behavior. 4221618Srie */ 4235088Sab196087 typedef int Conv_fmt_flags_t; 4245088Sab196087 4255088Sab196087 /* 4269273SAli.Bahrami@Sun.COM * Type used to represent ELF constants within libconv. This relies on 4279273SAli.Bahrami@Sun.COM * the fact that there are no ELF constants that need more than 32-bits, 4289273SAli.Bahrami@Sun.COM * nor are there any signed values. 4299273SAli.Bahrami@Sun.COM */ 4309273SAli.Bahrami@Sun.COM typedef uint32_t Conv_elfvalue_t; 4319273SAli.Bahrami@Sun.COM 4329273SAli.Bahrami@Sun.COM /* 4339273SAli.Bahrami@Sun.COM * Most conversion routines are able to provide strings in one of 4349273SAli.Bahrami@Sun.COM * several alternative styles. The bottom 8 bits of Conv_fmt_flags_t 4359273SAli.Bahrami@Sun.COM * are used to specify which strings should be used for a given call 4369273SAli.Bahrami@Sun.COM * to a conversion routine: 4379273SAli.Bahrami@Sun.COM * 4389273SAli.Bahrami@Sun.COM * DEFAULT 4399273SAli.Bahrami@Sun.COM * The default string style used by a given conversion routine is 4409273SAli.Bahrami@Sun.COM * an independent choice made by that routine. Different routines 4419273SAli.Bahrami@Sun.COM * make different choices, based largely on historical usage and 4429273SAli.Bahrami@Sun.COM * the perceived common case. It may be an alias for one of the 4439273SAli.Bahrami@Sun.COM * specific styles listed below, or it may be unique. 4449273SAli.Bahrami@Sun.COM * 4459273SAli.Bahrami@Sun.COM * DUMP 4469273SAli.Bahrami@Sun.COM * Style of strings used by dump(1). 4479273SAli.Bahrami@Sun.COM * 4489273SAli.Bahrami@Sun.COM * FILE 4499273SAli.Bahrami@Sun.COM * Style of strings used by file(1). 4505088Sab196087 * 4519273SAli.Bahrami@Sun.COM * CRLE 4529273SAli.Bahrami@Sun.COM * Style of strings used by crle(1). 4539273SAli.Bahrami@Sun.COM * 4549273SAli.Bahrami@Sun.COM * CF 4559273SAli.Bahrami@Sun.COM * Canonical Form: The string is exactly the same as the name 4569273SAli.Bahrami@Sun.COM * of the #define macro that defines it in the public header files. 4579273SAli.Bahrami@Sun.COM * (e.g. STB_LOCAL, not LOCL, LOCAL, LOC, or any other variation). 4589273SAli.Bahrami@Sun.COM * 4599273SAli.Bahrami@Sun.COM * CFNP 4609273SAli.Bahrami@Sun.COM * No Prefix Canonical Form: The same strings supplied by CF, 4619273SAli.Bahrami@Sun.COM * but without their standard prefix. (e.g. LOCAL, instead of STT_LOCAL). 4629273SAli.Bahrami@Sun.COM * 4639273SAli.Bahrami@Sun.COM * NF 4649273SAli.Bahrami@Sun.COM * Natural Form: The form of the strings that might typically be entered 4659273SAli.Bahrami@Sun.COM * via a keyboard by an interactive user. These are usually the strings 4669273SAli.Bahrami@Sun.COM * from CFNP, converted to lowercase, although in some cases they may 4679273SAli.Bahrami@Sun.COM * take some other "natural" form. In command completion applications, 4689273SAli.Bahrami@Sun.COM * lowercase strings appear less formal, and are easier on the eye. 4699273SAli.Bahrami@Sun.COM * 4709273SAli.Bahrami@Sun.COM * Every routine is required to have a default style. The others are optional, 4719273SAli.Bahrami@Sun.COM * and may not be provided if not needed. If a given conversion routine does 4729273SAli.Bahrami@Sun.COM * not support alternative strings for a given CONV_FMT_ALT type, it silently 4739273SAli.Bahrami@Sun.COM * ignores the request and supplies the default set. This means that a utility 4749273SAli.Bahrami@Sun.COM * like dump(1) is free to specify a style like DUMP to every conversion 4755088Sab196087 * routine. It will receive its special strings if there are any, and 4765088Sab196087 * the defaults otherwise. 4775088Sab196087 */ 4785088Sab196087 #define CONV_MASK_FMT_ALT 0xff 4795088Sab196087 #define CONV_TYPE_FMT_ALT(fmt_flags) (fmt_flags & CONV_MASK_FMT_ALT) 4805088Sab196087 4815088Sab196087 #define CONV_FMT_ALT_DEFAULT 0 /* "Standard" strings */ 4829273SAli.Bahrami@Sun.COM #define CONV_FMT_ALT_DUMP 1 /* dump(1) */ 4839273SAli.Bahrami@Sun.COM #define CONV_FMT_ALT_FILE 2 /* file(1) */ 4849273SAli.Bahrami@Sun.COM #define CONV_FMT_ALT_CRLE 3 /* crle(1) */ 4859273SAli.Bahrami@Sun.COM #define CONV_FMT_ALT_CF 4 /* Canonical Form */ 4869273SAli.Bahrami@Sun.COM #define CONV_FMT_ALT_CFNP 5 /* No Prefix Canonical Form */ 4879273SAli.Bahrami@Sun.COM #define CONV_FMT_ALT_NF 6 /* Natural Form */ 4885088Sab196087 4895088Sab196087 /* 4905088Sab196087 * Flags that alter standard formatting for conversion routines. 4915088Sab196087 * These bits start after the range occupied by CONV_MASK_FMT_ALT. 4925088Sab196087 */ 4935088Sab196087 #define CONV_FMT_DECIMAL 0x0100 /* conv_invalid_val() should print */ 4941976Sab196087 /* integer print as decimal */ 4951976Sab196087 /* (default is hex) */ 4965088Sab196087 #define CONV_FMT_SPACE 0x0200 /* conv_invalid_val() should append */ 4971976Sab196087 /* a space after the number. */ 4985088Sab196087 #define CONV_FMT_NOBKT 0x0400 /* conv_expn_field() should omit */ 4995088Sab196087 /* prefix and suffix strings */ 5001976Sab196087 5019273SAli.Bahrami@Sun.COM /* 5029273SAli.Bahrami@Sun.COM * A Val_desc structure is used to associate an ELF constant and 5039273SAli.Bahrami@Sun.COM * the message code (Msg) for the string that corresponds to it. 5049273SAli.Bahrami@Sun.COM * 5059273SAli.Bahrami@Sun.COM * Val_desc2 adds v_osabi and v_mach fields to Val_desc, which allows 5069273SAli.Bahrami@Sun.COM * for non-generic mappings that apply only to a specific OSABI/machine. 5079273SAli.Bahrami@Sun.COM * Setting v_osabi to 0 (ELFOSABI_NONE) specifies that any OSABI matches. 5089273SAli.Bahrami@Sun.COM * Similarly, setting v_mach to 0 (EM_MACH) matches any machine. Hence, 5099273SAli.Bahrami@Sun.COM * setting v_osabi and v_mach to 0 in a Val_desc2 results in a generic item, 5109273SAli.Bahrami@Sun.COM * and is equivalent to simply using a Val_desc. 5119273SAli.Bahrami@Sun.COM * 5129273SAli.Bahrami@Sun.COM * These structs are used in two different contexts: 5139273SAli.Bahrami@Sun.COM * 5149273SAli.Bahrami@Sun.COM * 1) To expand bit-field data items, using conv_expn_field() to 5159273SAli.Bahrami@Sun.COM * process a NULL terminated array of Val_desc, or conv_expn_field2() 5169273SAli.Bahrami@Sun.COM * to process a null terminated array of Val_desc2. 5179273SAli.Bahrami@Sun.COM * 5189273SAli.Bahrami@Sun.COM * 2) To represent sparse ranges of non-bitfield values, referenced via 5199273SAli.Bahrami@Sun.COM * conv_ds_vd_t or conv_ds_vd2_t descriptors, as described below. 5209273SAli.Bahrami@Sun.COM */ 5219273SAli.Bahrami@Sun.COM typedef struct { 5229273SAli.Bahrami@Sun.COM Conv_elfvalue_t v_val; /* expansion value */ 5239273SAli.Bahrami@Sun.COM Msg v_msg; /* associated message string code */ 5249273SAli.Bahrami@Sun.COM } Val_desc; 5259273SAli.Bahrami@Sun.COM typedef struct { 5269273SAli.Bahrami@Sun.COM Conv_elfvalue_t v_val; /* expansion value */ 5279273SAli.Bahrami@Sun.COM uchar_t v_osabi; /* OSABI to which entry applies */ 5289273SAli.Bahrami@Sun.COM Half v_mach; /* Machine to which entry applies */ 5299273SAli.Bahrami@Sun.COM Msg v_msg; /* associated message string code */ 5309273SAli.Bahrami@Sun.COM } Val_desc2; 5319273SAli.Bahrami@Sun.COM 5329273SAli.Bahrami@Sun.COM /* 5339273SAli.Bahrami@Sun.COM * The conv_ds_XXX_t structs are used to pull together the information used 5349273SAli.Bahrami@Sun.COM * to map non-bitfield values to strings. They are a variant family, sharing 5359273SAli.Bahrami@Sun.COM * the same initial fields, with a generic "header" definition that can be 5369273SAli.Bahrami@Sun.COM * used to read those common fields and determine which subcase is being 5379273SAli.Bahrami@Sun.COM * seen. We do this instead of using a single struct containing a type code 5389273SAli.Bahrami@Sun.COM * and a union in order to allow for static compile-time initialization. 5399273SAli.Bahrami@Sun.COM * 5409273SAli.Bahrami@Sun.COM * conv_ds_t is the base type, containing the initial fields common to all 5419273SAli.Bahrami@Sun.COM * the variants. Variables of type conv_ds_t are never instantiated. This 5429273SAli.Bahrami@Sun.COM * type exists only to provide a common pointer type that can reference 5439273SAli.Bahrami@Sun.COM * any of the variants safely. In C++, it would be a virtual base class. 5449273SAli.Bahrami@Sun.COM * The fields common to all the variants are: 5459273SAli.Bahrami@Sun.COM * 5469273SAli.Bahrami@Sun.COM * ds_type: Identifies the variant 5479273SAli.Bahrami@Sun.COM * ds_baseval/ds_topval: The lower and upper bound of the range 5489273SAli.Bahrami@Sun.COM * of values represented by this conv_ds_XXX_t descriptor. 5499273SAli.Bahrami@Sun.COM * 5509273SAli.Bahrami@Sun.COM * There are three different variants: 5519273SAli.Bahrami@Sun.COM * conv_ds_msg_t (ds_type == CONV_DS_MSGARR) 5529273SAli.Bahrami@Sun.COM * This structure references an array of message codes corresponding 5539273SAli.Bahrami@Sun.COM * to consecutive ELF values. The first item in the array is the Msg 5549273SAli.Bahrami@Sun.COM * code for the value given by ds_baseval. Consecutive strings follow 5559273SAli.Bahrami@Sun.COM * in consecutive order. The final item corresponds to the value given 5569273SAli.Bahrami@Sun.COM * by ds_topval. Zero (0) Msg values can be used to represent missing 5579273SAli.Bahrami@Sun.COM * values. Entries with a 0 are quietly ignored. 5589273SAli.Bahrami@Sun.COM * 5599273SAli.Bahrami@Sun.COM * conv_ds_vd_t (ds_type == CONV_DS_VD) 5609273SAli.Bahrami@Sun.COM * This structure employs a NULL terminated array of Val_desc structs. 5619273SAli.Bahrami@Sun.COM * Each Val_desc supplies a mapping from a value in the range 5629273SAli.Bahrami@Sun.COM * (ds_baseval <= value <= ds_topval). The values described need not 5639273SAli.Bahrami@Sun.COM * be consecutive, and can be sparse. ds_baseval does not need to 5649273SAli.Bahrami@Sun.COM * correspond to the first item, and ds_topval need not correspond to 5659273SAli.Bahrami@Sun.COM * the final item. 5669273SAli.Bahrami@Sun.COM * 5679273SAli.Bahrami@Sun.COM * conv_ds_vd2_t (ds_type == CONV_DS_VD2) 5689273SAli.Bahrami@Sun.COM * This structure employs a NULL terminated array of Val_desc2 structs, 5699273SAli.Bahrami@Sun.COM * rather than Val_desc, adding the ability to specify OSABI and machine 5709273SAli.Bahrami@Sun.COM * as part of the value/string mapping. It is otherwise the same thing 5719273SAli.Bahrami@Sun.COM * as CONV_DS_VD. 5729273SAli.Bahrami@Sun.COM */ 5739273SAli.Bahrami@Sun.COM typedef enum { 5749273SAli.Bahrami@Sun.COM CONV_DS_MSGARR = 0, /* Array of Msg */ 5759273SAli.Bahrami@Sun.COM CONV_DS_VD = 1, /* Null terminated array of Val_desc */ 5769273SAli.Bahrami@Sun.COM CONV_DS_VD2 = 2, /* Null terminated array of Val_desc2 */ 5779273SAli.Bahrami@Sun.COM } conv_ds_type_t; 5789273SAli.Bahrami@Sun.COM 5799273SAli.Bahrami@Sun.COM #define CONV_DS_COMMON_FIELDS \ 5809273SAli.Bahrami@Sun.COM conv_ds_type_t ds_type; /* Type of data structure used */ \ 5819273SAli.Bahrami@Sun.COM uint32_t ds_baseval; /* Value of first item */ \ 5829273SAli.Bahrami@Sun.COM uint32_t ds_topval /* Value of last item */ 5839273SAli.Bahrami@Sun.COM 5849273SAli.Bahrami@Sun.COM typedef struct { /* Virtual base type --- do not instantiate */ 5859273SAli.Bahrami@Sun.COM CONV_DS_COMMON_FIELDS; 5869273SAli.Bahrami@Sun.COM } conv_ds_t; 5879273SAli.Bahrami@Sun.COM typedef struct { 5889273SAli.Bahrami@Sun.COM CONV_DS_COMMON_FIELDS; 5899273SAli.Bahrami@Sun.COM const Msg *ds_msg; 5909273SAli.Bahrami@Sun.COM } conv_ds_msg_t; 5919273SAli.Bahrami@Sun.COM typedef struct { 5929273SAli.Bahrami@Sun.COM CONV_DS_COMMON_FIELDS; 5939273SAli.Bahrami@Sun.COM const Val_desc *ds_vd; 5949273SAli.Bahrami@Sun.COM } conv_ds_vd_t; 5959273SAli.Bahrami@Sun.COM typedef struct { 5969273SAli.Bahrami@Sun.COM CONV_DS_COMMON_FIELDS; 5979273SAli.Bahrami@Sun.COM const Val_desc2 *ds_vd2; 5989273SAli.Bahrami@Sun.COM } conv_ds_vd2_t; 5991618Srie 6001618Srie /* 6019273SAli.Bahrami@Sun.COM * The initialization of conv_ds_msg_t can be completely derived from 6029273SAli.Bahrami@Sun.COM * its base value and the array of Msg codes. CONV_DS_MSG_INIT() is used 6039273SAli.Bahrami@Sun.COM * to do that. 6049273SAli.Bahrami@Sun.COM */ 6059273SAli.Bahrami@Sun.COM #define CONV_DS_MSG_INIT(_baseval, _arr) \ 6069273SAli.Bahrami@Sun.COM CONV_DS_MSGARR, _baseval, \ 6079273SAli.Bahrami@Sun.COM _baseval + (sizeof (_arr) / sizeof (_arr[0])) - 1, _arr 6089273SAli.Bahrami@Sun.COM 6099273SAli.Bahrami@Sun.COM /* 6109273SAli.Bahrami@Sun.COM * Null terminated arrays of pointers to conv_ds_XXX_t structs are processed 6119273SAli.Bahrami@Sun.COM * by conv_map_ds() to convert ELF constants to their symbolic names, and by 6129273SAli.Bahrami@Sun.COM * conv_iter_ds() to iterate over all the available value/name combinations. 6139273SAli.Bahrami@Sun.COM * 6149273SAli.Bahrami@Sun.COM * These pointers are formed by casting the address of the specific 6159273SAli.Bahrami@Sun.COM * variant types (described above) to generic base type pointer. 6169273SAli.Bahrami@Sun.COM * CONV_DS_ADDR() is a convenience macro to take the address of 6179273SAli.Bahrami@Sun.COM * one of these variants and turn it into a generic pointer. 6189273SAli.Bahrami@Sun.COM */ 6199273SAli.Bahrami@Sun.COM #define CONV_DS_ADDR(_item) ((conv_ds_t *)&(_item)) 6209273SAli.Bahrami@Sun.COM 6219273SAli.Bahrami@Sun.COM /* 6229273SAli.Bahrami@Sun.COM * Type used by libconv to represent osabi values passed to iteration 6239273SAli.Bahrami@Sun.COM * functions. The type in the ELF header is uchar_t. However, every possible 6249273SAli.Bahrami@Sun.COM * value 0-255 has a valid meaning, leaving us no extra value to assign 6259273SAli.Bahrami@Sun.COM * to mean "ALL". Using Half for osabi leaves us the top byte to use for 6269273SAli.Bahrami@Sun.COM * out of bound values. 6279273SAli.Bahrami@Sun.COM * 6289273SAli.Bahrami@Sun.COM * Non-iteration functions, and any code that does not need to use 6299273SAli.Bahrami@Sun.COM * CONV_OSABI_ALL, should use uchar_t for osabi. 6309273SAli.Bahrami@Sun.COM */ 6319273SAli.Bahrami@Sun.COM typedef Half conv_iter_osabi_t; 6329273SAli.Bahrami@Sun.COM 6339273SAli.Bahrami@Sun.COM /* 6349273SAli.Bahrami@Sun.COM * Many of the iteration functions accept an osabi or mach argument, 6359273SAli.Bahrami@Sun.COM * used to specify the type of object being processed. The following 6369273SAli.Bahrami@Sun.COM * values can be used to specify a wildcard that matches any item. Their 6379273SAli.Bahrami@Sun.COM * values are carefully chosen to ensure that they cannot be interpreted 6389273SAli.Bahrami@Sun.COM * as an otherwise valid osabi or machine. 6399273SAli.Bahrami@Sun.COM */ 6409273SAli.Bahrami@Sun.COM #define CONV_OSABI_ALL 1024 /* Larger than can be represented by uchar_t */ 6419273SAli.Bahrami@Sun.COM #define CONV_MACH_ALL EM_NUM /* Never a valid machine type */ 6429273SAli.Bahrami@Sun.COM 6439273SAli.Bahrami@Sun.COM /* 6449273SAli.Bahrami@Sun.COM * We compare Val_Desc2 descriptors with a specified osabi and machine 6459273SAli.Bahrami@Sun.COM * to determine whether to use it or not. This macro encapsulates that logic. 6469273SAli.Bahrami@Sun.COM * 6479273SAli.Bahrami@Sun.COM * We consider an osabi to match when any of the following things hold: 6489273SAli.Bahrami@Sun.COM * 6499273SAli.Bahrami@Sun.COM * - The descriptor osabi is ELFOSABI_NONE. 6509273SAli.Bahrami@Sun.COM * - The supplied osabi and the descriptor osabi match 6519273SAli.Bahrami@Sun.COM * - The supplied osabi is ELFOSABI_NONE, and the descriptor osabi is 6529273SAli.Bahrami@Sun.COM * ELFOSABI_SOLARIS. Many operating systems, Solaris included, 6539273SAli.Bahrami@Sun.COM * produce or have produced ELFOSABI_NONE native objects, if only 6549273SAli.Bahrami@Sun.COM * because OSABI ranges are not an original ELF feature. We 6559273SAli.Bahrami@Sun.COM * give our own objects the home field advantage. 6569273SAli.Bahrami@Sun.COM * - Iteration Only: An osabi value of CONV_OSABI_ALL is specified. 6579273SAli.Bahrami@Sun.COM * 6589273SAli.Bahrami@Sun.COM * We consider a machine to match when any of the following things hold: 6599273SAli.Bahrami@Sun.COM * 6609273SAli.Bahrami@Sun.COM * - The descriptor mach is EM_NONE. 6619273SAli.Bahrami@Sun.COM * - The supplied mach and the descriptor mach match 6629273SAli.Bahrami@Sun.COM * - Iteration Only: A mach value of CONV_MACH_ALL is specified. 6639273SAli.Bahrami@Sun.COM * 6649273SAli.Bahrami@Sun.COM * The special extra _ALL case for iteration is handled by defining a separate 6659273SAli.Bahrami@Sun.COM * macro with the extra CONV_xxx_ALL tests. 6669273SAli.Bahrami@Sun.COM */ 6679273SAli.Bahrami@Sun.COM #define CONV_VD2_SKIP_OSABI(_osabi, _vdp) \ 6689273SAli.Bahrami@Sun.COM ((_vdp->v_osabi != ELFOSABI_NONE) && (_vdp->v_osabi != osabi) && \ 6699273SAli.Bahrami@Sun.COM ((_osabi != ELFOSABI_NONE) || (_vdp->v_osabi != ELFOSABI_SOLARIS))) 6709273SAli.Bahrami@Sun.COM 6719273SAli.Bahrami@Sun.COM #define CONV_VD2_SKIP_MACH(_mach, _vdp) \ 6729273SAli.Bahrami@Sun.COM ((_vdp->v_mach != EM_NONE) && (_vdp->v_mach != _mach)) 6739273SAli.Bahrami@Sun.COM 6749273SAli.Bahrami@Sun.COM #define CONV_VD2_SKIP(_osabi, _mach, _vdp) \ 6759273SAli.Bahrami@Sun.COM (CONV_VD2_SKIP_OSABI(_osabi, _vdp) || CONV_VD2_SKIP_MACH(_mach, _vdp)) 6769273SAli.Bahrami@Sun.COM 6779273SAli.Bahrami@Sun.COM #define CONV_ITER_VD2_SKIP(_osabi, _mach, _vdp) \ 6789273SAli.Bahrami@Sun.COM ((CONV_VD2_SKIP_OSABI(_osabi, _vdp) && (_osabi != CONV_OSABI_ALL)) || \ 6799273SAli.Bahrami@Sun.COM (CONV_VD2_SKIP_MACH(_mach, _vdp) && (_mach != CONV_MACH_ALL))) 6809273SAli.Bahrami@Sun.COM 6819273SAli.Bahrami@Sun.COM 6829273SAli.Bahrami@Sun.COM /* 6839273SAli.Bahrami@Sun.COM * Possible return values from iteration functions. 6849273SAli.Bahrami@Sun.COM */ 6859273SAli.Bahrami@Sun.COM typedef enum { 6869273SAli.Bahrami@Sun.COM CONV_ITER_DONE, /* Stop: No more iterations are desired */ 6879273SAli.Bahrami@Sun.COM CONV_ITER_CONT /* Continue with following iterations */ 6889273SAli.Bahrami@Sun.COM } conv_iter_ret_t; 6899273SAli.Bahrami@Sun.COM 6909273SAli.Bahrami@Sun.COM /* 6919273SAli.Bahrami@Sun.COM * Prototype for caller supplied callback function to iteration functions. 6929273SAli.Bahrami@Sun.COM */ 6939273SAli.Bahrami@Sun.COM typedef conv_iter_ret_t (* conv_iter_cb_t)(const char *str, 6949273SAli.Bahrami@Sun.COM Conv_elfvalue_t value, void *uvalue); 6959273SAli.Bahrami@Sun.COM 6969273SAli.Bahrami@Sun.COM /* 6979273SAli.Bahrami@Sun.COM * User value block employed by conv_iter_strtol() 6981618Srie */ 6991618Srie typedef struct { 7009273SAli.Bahrami@Sun.COM const char *csl_str; /* String to search for */ 7019273SAli.Bahrami@Sun.COM size_t csl_strlen; /* # chars in csl_str to examine */ 7029273SAli.Bahrami@Sun.COM int csl_found; /* Init to 0, set to 1 if item found */ 7039273SAli.Bahrami@Sun.COM Conv_elfvalue_t csl_value; /* If csl_found, resulting value */ 7049273SAli.Bahrami@Sun.COM } conv_strtol_uvalue_t; 7051618Srie 7061618Srie /* 7072352Sab196087 * conv_expn_field() is willing to supply default strings for the 7082352Sab196087 * prefix, separator, and suffix arguments, if they are passed as NULL. 7092352Sab196087 * The caller needs to know how much room to allow for these items. 7102352Sab196087 * These values supply those sizes. 7112352Sab196087 */ 7122352Sab196087 #define CONV_EXPN_FIELD_DEF_PREFIX_SIZE 2 /* Default is "[ " */ 7132352Sab196087 #define CONV_EXPN_FIELD_DEF_SEP_SIZE 1 /* Default is " " */ 7142352Sab196087 #define CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 2 /* Default is " ]" */ 7152352Sab196087 7162352Sab196087 /* 7172352Sab196087 * conv_expn_field() requires a large number of inputs, many of which 7182352Sab196087 * can be NULL to accept default behavior. An argument of the following 7192352Sab196087 * type is used to supply them. 7202352Sab196087 */ 7212352Sab196087 typedef struct { 7222352Sab196087 char *buf; /* Buffer to receive generated string */ 7232352Sab196087 size_t bufsize; /* sizeof(buf) */ 7242352Sab196087 const char **lead_str; /* NULL, or array of pointers to strings to */ 7252352Sab196087 /* be output at the head of the list. */ 7262352Sab196087 /* Last entry must be NULL. */ 7272352Sab196087 Xword oflags; /* Bits for which output strings are desired */ 7282352Sab196087 Xword rflags; /* Bits for which a numeric value should be */ 7292352Sab196087 /* output if vdp does not provide str. */ 7302352Sab196087 /* Must be a proper subset of oflags */ 7312352Sab196087 const char *prefix; /* NULL, or string to prefix output with */ 7322352Sab196087 /* If NULL, "[ " is used. */ 7332352Sab196087 const char *sep; /* NULL, or string to separate output items */ 7342352Sab196087 /* with. If NULL, " " is used. */ 7352352Sab196087 const char *suffix; /* NULL, or string to suffix output with */ 7362352Sab196087 /* If NULL, " ]" is used. */ 7372352Sab196087 } CONV_EXPN_FIELD_ARG; 7382352Sab196087 7396635Sab196087 /* 7406635Sab196087 * Callback function for conv_str_to_c_literal(). A user supplied function 7416635Sab196087 * of this type is called by conv_str_to_c_literal() in order to dispatch 7426635Sab196087 * the translated output characters. 7436635Sab196087 * 7446635Sab196087 * buf - Pointer to output text 7456635Sab196087 * n - # of characters to output 7466635Sab196087 * uvalue - User value argument to conv_str_to_c_literal(), 7476635Sab196087 * passed through without interpretation. 7486635Sab196087 */ 7496635Sab196087 typedef void Conv_str_to_c_literal_func_t(const void *ptr, 7506635Sab196087 size_t size, void *uvalue); 7516635Sab196087 7522352Sab196087 /* 7539273SAli.Bahrami@Sun.COM * Generic miscellaneous interfaces 7540Sstevel@tonic-gate */ 7552647Srie extern uchar_t conv_check_native(char **, char **); 7569273SAli.Bahrami@Sun.COM extern const char *conv_lddstub(int); 7579406SAli.Bahrami@Sun.COM extern int conv_strproc_isspace(int); 7589406SAli.Bahrami@Sun.COM extern char *conv_strproc_trim(char *); 7599406SAli.Bahrami@Sun.COM extern Boolean conv_strproc_extract_value(char *, size_t, int, 7609406SAli.Bahrami@Sun.COM const char **); 7619406SAli.Bahrami@Sun.COM extern int conv_sys_eclass(void); 76211734SAli.Bahrami@Sun.COM extern int conv_translate_c_esc(char **); 7639273SAli.Bahrami@Sun.COM 7649273SAli.Bahrami@Sun.COM /* 7659273SAli.Bahrami@Sun.COM * Generic core formatting and iteration functionality 7669273SAli.Bahrami@Sun.COM */ 7679273SAli.Bahrami@Sun.COM extern conv_iter_ret_t _conv_iter_ds(conv_iter_osabi_t, Half, 7689273SAli.Bahrami@Sun.COM const conv_ds_t **, conv_iter_cb_t, void *, 7699273SAli.Bahrami@Sun.COM const char *); 7709273SAli.Bahrami@Sun.COM extern conv_iter_ret_t _conv_iter_ds_msg(const conv_ds_msg_t *, 7719273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *, const char *); 7729273SAli.Bahrami@Sun.COM extern conv_iter_ret_t _conv_iter_vd(const Val_desc *, conv_iter_cb_t, 7739273SAli.Bahrami@Sun.COM void *, const char *); 7749273SAli.Bahrami@Sun.COM extern conv_iter_ret_t _conv_iter_vd2(conv_iter_osabi_t, Half, 7759273SAli.Bahrami@Sun.COM const Val_desc2 *, conv_iter_cb_t, void *, 7769273SAli.Bahrami@Sun.COM const char *); 7779273SAli.Bahrami@Sun.COM extern int conv_iter_strtol_init(const char *, 7789273SAli.Bahrami@Sun.COM conv_strtol_uvalue_t *); 7799273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_strtol(const char *, Conv_elfvalue_t, void *); 7809273SAli.Bahrami@Sun.COM extern const char *_conv_map_ds(uchar_t, Half, Conv_elfvalue_t, 7819273SAli.Bahrami@Sun.COM const conv_ds_t **, Conv_fmt_flags_t, 7829273SAli.Bahrami@Sun.COM Conv_inv_buf_t *, const char *); 7839273SAli.Bahrami@Sun.COM 7849273SAli.Bahrami@Sun.COM 7859273SAli.Bahrami@Sun.COM /* 7869273SAli.Bahrami@Sun.COM * Generic formatting interfaces. 7879273SAli.Bahrami@Sun.COM */ 7889273SAli.Bahrami@Sun.COM extern const char *conv_bnd_obj(uint_t, Conv_bnd_obj_buf_t *); 7899273SAli.Bahrami@Sun.COM extern const char *conv_bnd_type(uint_t, Conv_bnd_type_buf_t *); 7904734Sab196087 extern const char *conv_config_feat(int, Conv_config_feat_buf_t *); 7914734Sab196087 extern const char *conv_config_obj(ushort_t, Conv_config_obj_buf_t *); 7921618Srie extern const char *conv_config_upm(const char *, const char *, 7931618Srie const char *, size_t); 7946635Sab196087 extern const char *conv_cnote_auxv_af(Word, Conv_fmt_flags_t, 7956635Sab196087 Conv_cnote_auxv_af_buf_t *); 7966635Sab196087 extern const char *conv_cnote_auxv_type(Word, Conv_fmt_flags_t, 7976635Sab196087 Conv_inv_buf_t *); 7986635Sab196087 extern const char *conv_cnote_cc_content(Lword, Conv_fmt_flags_t, 7996635Sab196087 Conv_cnote_cc_content_buf_t *); 8006635Sab196087 extern const char *conv_cnote_errno(int, Conv_fmt_flags_t, 8016635Sab196087 Conv_inv_buf_t *); 8026635Sab196087 extern const char *conv_cnote_fault(Word, Conv_fmt_flags_t, 8036635Sab196087 Conv_inv_buf_t *); 8046635Sab196087 extern const char *conv_cnote_fltset(uint32_t *, int, 8056635Sab196087 Conv_fmt_flags_t, Conv_cnote_fltset_buf_t *); 8066635Sab196087 extern const char *conv_cnote_old_pr_flags(int, Conv_fmt_flags_t, 8076635Sab196087 Conv_cnote_old_pr_flags_buf_t *); 8086635Sab196087 extern const char *conv_cnote_pr_dmodel(Word, Conv_fmt_flags_t, 8096635Sab196087 Conv_inv_buf_t *); 8106635Sab196087 extern const char *conv_cnote_pr_flags(int, Conv_fmt_flags_t, 8116635Sab196087 Conv_cnote_pr_flags_buf_t *); 8126635Sab196087 extern const char *conv_cnote_proc_flag(int, Conv_fmt_flags_t, 8136635Sab196087 Conv_cnote_proc_flag_buf_t *); 8146635Sab196087 extern const char *conv_cnote_pr_regname(Half, int, Conv_fmt_flags_t, 8156635Sab196087 Conv_inv_buf_t *inv_buf); 8166635Sab196087 extern const char *conv_cnote_pr_stype(Word, Conv_fmt_flags_t, 8176635Sab196087 Conv_inv_buf_t *); 8186635Sab196087 extern const char *conv_cnote_pr_what(short, short, Conv_fmt_flags_t, 8196635Sab196087 Conv_inv_buf_t *); 8206635Sab196087 extern const char *conv_cnote_pr_why(short, Conv_fmt_flags_t, 8216635Sab196087 Conv_inv_buf_t *); 8226635Sab196087 extern const char *conv_cnote_priv(int, Conv_fmt_flags_t, 8236635Sab196087 Conv_inv_buf_t *); 8246635Sab196087 extern const char *conv_cnote_psetid(int, Conv_fmt_flags_t, 8256635Sab196087 Conv_inv_buf_t *); 8266635Sab196087 extern const char *conv_cnote_sa_flags(int, Conv_fmt_flags_t, 8276635Sab196087 Conv_cnote_sa_flags_buf_t *); 8286635Sab196087 extern const char *conv_cnote_signal(Word, Conv_fmt_flags_t, 8296635Sab196087 Conv_inv_buf_t *); 8306635Sab196087 extern const char *conv_cnote_si_code(Half, int, int, Conv_fmt_flags_t, 8316635Sab196087 Conv_inv_buf_t *); 8326635Sab196087 extern const char *conv_cnote_sigset(uint32_t *, int, 8336635Sab196087 Conv_fmt_flags_t, Conv_cnote_sigset_buf_t *); 8346635Sab196087 extern const char *conv_cnote_ss_flags(int, Conv_fmt_flags_t, 8356635Sab196087 Conv_cnote_ss_flags_buf_t *); 8366635Sab196087 extern const char *conv_cnote_syscall(Word, Conv_fmt_flags_t, 8376635Sab196087 Conv_inv_buf_t *); 8386635Sab196087 extern const char *conv_cnote_sysset(uint32_t *, int, 8396635Sab196087 Conv_fmt_flags_t, Conv_cnote_sysset_buf_t *); 8406635Sab196087 extern const char *conv_cnote_type(Word, Conv_fmt_flags_t, 8416635Sab196087 Conv_inv_buf_t *); 8424734Sab196087 extern const char *conv_def_tag(Symref, Conv_inv_buf_t *); 8431618Srie extern const char *conv_demangle_name(const char *); 8445088Sab196087 extern const char *conv_dl_flag(int, Conv_fmt_flags_t, 8455088Sab196087 Conv_dl_flag_buf_t *); 84612029SRod.Evans@Sun.COM extern const char *conv_dl_info(int); 8474734Sab196087 extern const char *conv_dl_mode(int, int, Conv_dl_mode_buf_t *); 8489085SAli.Bahrami@Sun.COM extern const char *conv_dwarf_cfa(uchar_t, Conv_fmt_flags_t, 8499085SAli.Bahrami@Sun.COM Conv_inv_buf_t *); 8504734Sab196087 extern const char *conv_dwarf_ehe(uint_t, Conv_dwarf_ehe_buf_t *); 8519085SAli.Bahrami@Sun.COM extern const char *conv_dwarf_regname(Half, Word, Conv_fmt_flags_t, 8529085SAli.Bahrami@Sun.COM int *, Conv_inv_buf_t *); 8539273SAli.Bahrami@Sun.COM extern const char *conv_ehdr_abivers(uchar_t, Word, Conv_fmt_flags_t, 8545088Sab196087 Conv_inv_buf_t *); 8555088Sab196087 extern const char *conv_ehdr_class(uchar_t, Conv_fmt_flags_t, 8565088Sab196087 Conv_inv_buf_t *); 8575088Sab196087 extern const char *conv_ehdr_data(uchar_t, Conv_fmt_flags_t, 8585088Sab196087 Conv_inv_buf_t *); 8595088Sab196087 extern const char *conv_ehdr_flags(Half, Word, Conv_fmt_flags_t, 8605088Sab196087 Conv_ehdr_flags_buf_t *); 8615088Sab196087 extern const char *conv_ehdr_mach(Half, Conv_fmt_flags_t, 8625088Sab196087 Conv_inv_buf_t *); 8635088Sab196087 extern const char *conv_ehdr_osabi(uchar_t, Conv_fmt_flags_t, 8645088Sab196087 Conv_inv_buf_t *); 8659273SAli.Bahrami@Sun.COM extern const char *conv_ehdr_type(uchar_t, Half, Conv_fmt_flags_t, 8665088Sab196087 Conv_inv_buf_t *); 8675088Sab196087 extern const char *conv_ehdr_vers(Word, Conv_fmt_flags_t, 8685088Sab196087 Conv_inv_buf_t *); 8699273SAli.Bahrami@Sun.COM extern const char *conv_elfdata_type(Elf_Type, Conv_inv_buf_t *); 87011734SAli.Bahrami@Sun.COM extern const char *conv_ent_flags(ec_flags_t, Conv_ent_flags_buf_t *); 87111734SAli.Bahrami@Sun.COM extern const char *conv_ent_files_flags(Word, Conv_fmt_flags_t fmt_flags, 87211734SAli.Bahrami@Sun.COM Conv_ent_files_flags_buf_t *); 873*12877SRod.Evans@Sun.COM extern const char *conv_la_activity(uint_t, Conv_fmt_flags_t, 874*12877SRod.Evans@Sun.COM Conv_inv_buf_t *); 875*12877SRod.Evans@Sun.COM extern const char *conv_la_bind(uint_t, Conv_la_bind_buf_t *); 876*12877SRod.Evans@Sun.COM extern const char *conv_la_search(uint_t, Conv_la_search_buf_t *); 877*12877SRod.Evans@Sun.COM extern const char *conv_la_symbind(uint_t, Conv_la_symbind_buf_t *); 8789273SAli.Bahrami@Sun.COM extern const char *conv_grphdl_flags(uint_t, Conv_grphdl_flags_buf_t *); 8799273SAli.Bahrami@Sun.COM extern const char *conv_grpdesc_flags(uint_t, Conv_grpdesc_flags_buf_t *); 8809273SAli.Bahrami@Sun.COM extern Isa_desc *conv_isalist(void); 88111734SAli.Bahrami@Sun.COM extern const char *conv_mapfile_version(Word, Conv_fmt_flags_t, 88211734SAli.Bahrami@Sun.COM Conv_inv_buf_t *); 8839273SAli.Bahrami@Sun.COM extern const char *conv_phdr_flags(uchar_t, Word, Conv_fmt_flags_t, 8845088Sab196087 Conv_phdr_flags_buf_t *); 8859273SAli.Bahrami@Sun.COM extern const char *conv_phdr_type(uchar_t, Half, Word, Conv_fmt_flags_t, 8865088Sab196087 Conv_inv_buf_t *); 8876206Sab196087 extern const char *conv_reject_desc(Rej_desc *, Conv_reject_desc_buf_t *, 8886206Sab196087 Half mach); 8895088Sab196087 extern const char *conv_reloc_type(Half, Word, Conv_fmt_flags_t, 8905088Sab196087 Conv_inv_buf_t *); 8915088Sab196087 extern const char *conv_reloc_type_static(Half, Word, Conv_fmt_flags_t); 8925088Sab196087 extern const char *conv_reloc_386_type(Word, Conv_fmt_flags_t, 8935088Sab196087 Conv_inv_buf_t *); 8945088Sab196087 extern const char *conv_reloc_amd64_type(Word, Conv_fmt_flags_t, 8955088Sab196087 Conv_inv_buf_t *); 8965088Sab196087 extern const char *conv_reloc_SPARC_type(Word, Conv_fmt_flags_t, 8975088Sab196087 Conv_inv_buf_t *); 8989273SAli.Bahrami@Sun.COM extern const char *conv_sec_type(uchar_t, Half, Word, Conv_fmt_flags_t, 8995088Sab196087 Conv_inv_buf_t *); 90011734SAli.Bahrami@Sun.COM extern const char *conv_seg_flags(sg_flags_t, Conv_seg_flags_buf_t *); 9019273SAli.Bahrami@Sun.COM extern void conv_str_to_c_literal(const char *buf, size_t n, 9029273SAli.Bahrami@Sun.COM Conv_str_to_c_literal_func_t *cb_func, 9039273SAli.Bahrami@Sun.COM void *uvalue); 9045088Sab196087 extern const char *conv_sym_info_bind(uchar_t, Conv_fmt_flags_t, 9055088Sab196087 Conv_inv_buf_t *); 9065088Sab196087 extern const char *conv_sym_info_type(Half, uchar_t, Conv_fmt_flags_t, 9074734Sab196087 Conv_inv_buf_t *); 9089273SAli.Bahrami@Sun.COM extern const char *conv_sym_shndx(uchar_t, Half, Half, Conv_fmt_flags_t, 9099273SAli.Bahrami@Sun.COM Conv_inv_buf_t *); 9104734Sab196087 extern const char *conv_sym_other(uchar_t, Conv_inv_buf_t *); 9115088Sab196087 extern const char *conv_sym_other_vis(uchar_t, Conv_fmt_flags_t, 9125088Sab196087 Conv_inv_buf_t *); 9139273SAli.Bahrami@Sun.COM extern const char *conv_syminfo_boundto(Half, Conv_fmt_flags_t, 9149273SAli.Bahrami@Sun.COM Conv_inv_buf_t *); 9159273SAli.Bahrami@Sun.COM extern const char *conv_syminfo_flags(Half, Conv_fmt_flags_t, 9169273SAli.Bahrami@Sun.COM Conv_syminfo_flags_buf_t *); 9179577SRod.Evans@Sun.COM extern const char *conv_time(struct timeval *, struct timeval *, 9189577SRod.Evans@Sun.COM Conv_time_buf_t *); 9199273SAli.Bahrami@Sun.COM extern Uts_desc *conv_uts(void); 9209273SAli.Bahrami@Sun.COM extern const char *conv_ver_flags(Half, Conv_fmt_flags_t, 9219273SAli.Bahrami@Sun.COM Conv_ver_flags_buf_t *); 9229273SAli.Bahrami@Sun.COM extern const char *conv_ver_index(Versym, int, Conv_inv_buf_t *); 9239273SAli.Bahrami@Sun.COM 9249273SAli.Bahrami@Sun.COM 9259273SAli.Bahrami@Sun.COM /* 9269273SAli.Bahrami@Sun.COM * Generic iteration interfaces. 9279273SAli.Bahrami@Sun.COM */ 9289273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_cap_tags(Conv_fmt_flags_t, conv_iter_cb_t, 9299273SAli.Bahrami@Sun.COM void *); 9309273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_cap_val_hw1(Half, Conv_fmt_flags_t, 9319273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *); 93211827SRod.Evans@Sun.COM extern conv_iter_ret_t conv_iter_cap_val_hw2(Half, Conv_fmt_flags_t, 93311827SRod.Evans@Sun.COM conv_iter_cb_t, void *); 9349273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_cap_val_sf1(Conv_fmt_flags_t, conv_iter_cb_t, 9359273SAli.Bahrami@Sun.COM void *); 9369273SAli.Bahrami@Sun.COM 9379273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_dyn_feature1(Conv_fmt_flags_t, conv_iter_cb_t, 9389273SAli.Bahrami@Sun.COM void *); 9399273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_dyn_flag(Conv_fmt_flags_t, conv_iter_cb_t, 9409273SAli.Bahrami@Sun.COM void *); 9419273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_dyn_flag1(Conv_fmt_flags_t, conv_iter_cb_t, 9429273SAli.Bahrami@Sun.COM void *); 9439273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_dyn_posflag1(Conv_fmt_flags_t, conv_iter_cb_t, 9449273SAli.Bahrami@Sun.COM void *); 9459273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_dyn_tag(conv_iter_osabi_t, Half, 9469273SAli.Bahrami@Sun.COM Conv_fmt_flags_t, conv_iter_cb_t, void *); 9479273SAli.Bahrami@Sun.COM 9489273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_ehdr_abivers(conv_iter_osabi_t, 9499273SAli.Bahrami@Sun.COM Conv_fmt_flags_t, conv_iter_cb_t, void *); 9509273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_ehdr_class(Conv_fmt_flags_t, conv_iter_cb_t, 9519273SAli.Bahrami@Sun.COM void *); 9529273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_ehdr_data(Conv_fmt_flags_t, conv_iter_cb_t, 9539273SAli.Bahrami@Sun.COM void *); 9549273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_ehdr_eident(Conv_fmt_flags_t, conv_iter_cb_t, 9559273SAli.Bahrami@Sun.COM void *); 9569273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_ehdr_flags(Half, Conv_fmt_flags_t, 9579273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *); 9589273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_ehdr_mach(Conv_fmt_flags_t, conv_iter_cb_t, 9599273SAli.Bahrami@Sun.COM void *); 9609273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_ehdr_osabi(Conv_fmt_flags_t, conv_iter_cb_t, 9619273SAli.Bahrami@Sun.COM void *); 9629273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_ehdr_type(conv_iter_osabi_t, Conv_fmt_flags_t, 9639273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *); 9649273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_ehdr_vers(Conv_fmt_flags_t, conv_iter_cb_t, 9659273SAli.Bahrami@Sun.COM void *); 9669273SAli.Bahrami@Sun.COM 9679273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_phdr_flags(conv_iter_osabi_t, 9689273SAli.Bahrami@Sun.COM Conv_fmt_flags_t, conv_iter_cb_t, void *); 9699273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_phdr_type(conv_iter_osabi_t, Conv_fmt_flags_t, 9709273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *); 9719273SAli.Bahrami@Sun.COM 9729273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_sec_flags(conv_iter_osabi_t, Half, 9739273SAli.Bahrami@Sun.COM Conv_fmt_flags_t, conv_iter_cb_t, void *); 9749273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_sec_symtab(conv_iter_osabi_t, 9759273SAli.Bahrami@Sun.COM Conv_fmt_flags_t, conv_iter_cb_t, void *); 9769273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_sec_type(conv_iter_osabi_t, Half, 9779273SAli.Bahrami@Sun.COM Conv_fmt_flags_t, conv_iter_cb_t, void *); 9789273SAli.Bahrami@Sun.COM 9799273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_sym_info_bind(Conv_fmt_flags_t, 9809273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *); 9819273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_sym_other_vis(Conv_fmt_flags_t, 9829273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *); 9839273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_sym_shndx(conv_iter_osabi_t, Half, 9849273SAli.Bahrami@Sun.COM Conv_fmt_flags_t, conv_iter_cb_t, void *); 9859273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_sym_info_type(Half, Conv_fmt_flags_t, 9869273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *); 9879273SAli.Bahrami@Sun.COM 9889273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_syminfo_boundto(Conv_fmt_flags_t, 9899273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *); 9909273SAli.Bahrami@Sun.COM extern conv_iter_ret_t conv_iter_syminfo_flags(Conv_fmt_flags_t, 9919273SAli.Bahrami@Sun.COM conv_iter_cb_t, void *); 9929273SAli.Bahrami@Sun.COM 9939273SAli.Bahrami@Sun.COM /* 9949273SAli.Bahrami@Sun.COM * Define all class specific routines. 9959273SAli.Bahrami@Sun.COM */ 9969273SAli.Bahrami@Sun.COM #if defined(_ELF64) 9979273SAli.Bahrami@Sun.COM #define conv_cap_tag conv64_cap_tag 9989273SAli.Bahrami@Sun.COM #define conv_cap_val conv64_cap_val 9999273SAli.Bahrami@Sun.COM #define conv_cap_val_hw1 conv64_cap_val_hw1 100011827SRod.Evans@Sun.COM #define conv_cap_val_hw2 conv64_cap_val_hw2 10019273SAli.Bahrami@Sun.COM #define conv_cap_val_sf1 conv64_cap_val_sf1 10029273SAli.Bahrami@Sun.COM #define conv_dyn_feature1 conv64_dyn_feature1 10039273SAli.Bahrami@Sun.COM #define conv_dyn_flag1 conv64_dyn_flag1 10049273SAli.Bahrami@Sun.COM #define conv_dyn_flag conv64_dyn_flag 10059273SAli.Bahrami@Sun.COM #define conv_dyn_posflag1 conv64_dyn_posflag1 10069273SAli.Bahrami@Sun.COM #define conv_dyn_tag conv64_dyn_tag 10079273SAli.Bahrami@Sun.COM #define _conv_expn_field _conv64_expn_field 10089273SAli.Bahrami@Sun.COM #define _conv_expn_field2 _conv64_expn_field2 10099273SAli.Bahrami@Sun.COM #define conv_invalid_val conv64_invalid_val 10109273SAli.Bahrami@Sun.COM #define conv_sec_flags conv64_sec_flags 10119273SAli.Bahrami@Sun.COM #define conv_sec_linkinfo conv64_sec_linkinfo 10129273SAli.Bahrami@Sun.COM #define conv_sym_value conv64_sym_value 10139273SAli.Bahrami@Sun.COM #define conv_sym_SPARC_value conv64_sym_SPARC_value 10149273SAli.Bahrami@Sun.COM #else 10159273SAli.Bahrami@Sun.COM #define conv_cap_tag conv32_cap_tag 10169273SAli.Bahrami@Sun.COM #define conv_cap_val conv32_cap_val 10179273SAli.Bahrami@Sun.COM #define conv_cap_val_hw1 conv32_cap_val_hw1 101811827SRod.Evans@Sun.COM #define conv_cap_val_hw2 conv32_cap_val_hw2 10199273SAli.Bahrami@Sun.COM #define conv_cap_val_sf1 conv32_cap_val_sf1 10209273SAli.Bahrami@Sun.COM #define conv_dyn_feature1 conv32_dyn_feature1 10219273SAli.Bahrami@Sun.COM #define conv_dyn_flag1 conv32_dyn_flag1 10229273SAli.Bahrami@Sun.COM #define conv_dyn_flag conv32_dyn_flag 10239273SAli.Bahrami@Sun.COM #define conv_dyn_posflag1 conv32_dyn_posflag1 10249273SAli.Bahrami@Sun.COM #define conv_dyn_tag conv32_dyn_tag 10259273SAli.Bahrami@Sun.COM #define _conv_expn_field _conv32_expn_field 10269273SAli.Bahrami@Sun.COM #define _conv_expn_field2 _conv32_expn_field2 10279273SAli.Bahrami@Sun.COM #define conv_invalid_val conv32_invalid_val 10289273SAli.Bahrami@Sun.COM #define conv_sec_flags conv32_sec_flags 10299273SAli.Bahrami@Sun.COM #define conv_sec_linkinfo conv32_sec_linkinfo 10309273SAli.Bahrami@Sun.COM #define conv_sym_value conv32_sym_value 10319273SAli.Bahrami@Sun.COM #define conv_sym_SPARC_value conv32_sym_SPARC_value 10329273SAli.Bahrami@Sun.COM #endif 10339273SAli.Bahrami@Sun.COM 10349273SAli.Bahrami@Sun.COM /* 10359273SAli.Bahrami@Sun.COM * ELFCLASS-specific core formatting functionality 10369273SAli.Bahrami@Sun.COM */ 10379273SAli.Bahrami@Sun.COM extern int _conv_expn_field(CONV_EXPN_FIELD_ARG *, 10389273SAli.Bahrami@Sun.COM const Val_desc *, Conv_fmt_flags_t, const char *); 10399273SAli.Bahrami@Sun.COM extern int _conv_expn_field2(CONV_EXPN_FIELD_ARG *, uchar_t, 10409273SAli.Bahrami@Sun.COM Half, const Val_desc2 *, Conv_fmt_flags_t, 10419273SAli.Bahrami@Sun.COM const char *); 10429273SAli.Bahrami@Sun.COM extern const char *conv_invalid_val(Conv_inv_buf_t *, Xword, 10439273SAli.Bahrami@Sun.COM Conv_fmt_flags_t); 10449273SAli.Bahrami@Sun.COM 10459273SAli.Bahrami@Sun.COM /* 10469273SAli.Bahrami@Sun.COM * ELFCLASS-specific formatting interfaces. 10479273SAli.Bahrami@Sun.COM */ 10489273SAli.Bahrami@Sun.COM extern const char *conv_cap_tag(Xword, Conv_fmt_flags_t, 10499273SAli.Bahrami@Sun.COM Conv_inv_buf_t *); 105011827SRod.Evans@Sun.COM extern const char *conv_cap_val(Xword, Xword, Half, Conv_fmt_flags_t, 105111827SRod.Evans@Sun.COM Conv_cap_val_buf_t *); 10529273SAli.Bahrami@Sun.COM extern const char *conv_cap_val_hw1(Xword, Half, Conv_fmt_flags_t, 10539273SAli.Bahrami@Sun.COM Conv_cap_val_hw1_buf_t *); 105411827SRod.Evans@Sun.COM extern const char *conv_cap_val_hw2(Xword, Half, Conv_fmt_flags_t, 105511827SRod.Evans@Sun.COM Conv_cap_val_hw2_buf_t *); 10569273SAli.Bahrami@Sun.COM extern const char *conv_cap_val_sf1(Xword, Half, Conv_fmt_flags_t, 10579273SAli.Bahrami@Sun.COM Conv_cap_val_sf1_buf_t *); 10589273SAli.Bahrami@Sun.COM extern const char *conv_dyn_flag1(Xword, Conv_fmt_flags_t, 10599273SAli.Bahrami@Sun.COM Conv_dyn_flag1_buf_t *); 10609273SAli.Bahrami@Sun.COM extern const char *conv_dyn_flag(Xword, Conv_fmt_flags_t, 10619273SAli.Bahrami@Sun.COM Conv_dyn_flag_buf_t *); 10629273SAli.Bahrami@Sun.COM extern const char *conv_dyn_posflag1(Xword, Conv_fmt_flags_t, 10639273SAli.Bahrami@Sun.COM Conv_dyn_posflag1_buf_t *); 10649273SAli.Bahrami@Sun.COM extern const char *conv_dyn_tag(Xword, uchar_t, Half, Conv_fmt_flags_t, 10659273SAli.Bahrami@Sun.COM Conv_inv_buf_t *); 10669273SAli.Bahrami@Sun.COM extern const char *conv_dyn_feature1(Xword, Conv_fmt_flags_t, 10679273SAli.Bahrami@Sun.COM Conv_dyn_feature1_buf_t *); 10689273SAli.Bahrami@Sun.COM extern const char *conv_sec_flags(uchar_t osabi, Half mach, Xword, 10699273SAli.Bahrami@Sun.COM Conv_fmt_flags_t, Conv_sec_flags_buf_t *); 10709273SAli.Bahrami@Sun.COM extern const char *conv_sec_linkinfo(Word, Xword, Conv_inv_buf_t *); 10714734Sab196087 extern const char *conv_sym_value(Half, uchar_t, Addr, Conv_inv_buf_t *); 10725088Sab196087 extern const char *conv_sym_SPARC_value(Addr, Conv_fmt_flags_t, 10735088Sab196087 Conv_inv_buf_t *); 10749273SAli.Bahrami@Sun.COM 10759273SAli.Bahrami@Sun.COM /* 10769273SAli.Bahrami@Sun.COM * Define macros for _conv_XXX() routines that accept local_sgs_msg as the 10779273SAli.Bahrami@Sun.COM * final argument. The macros hide that argument from the caller's view and 10789273SAli.Bahrami@Sun.COM * supply the SGS message array for the file from which the macro is used 10799273SAli.Bahrami@Sun.COM * in its place. This trick is used to allow these functions to access the 10809273SAli.Bahrami@Sun.COM * message strings from any source file they are called from. 10819273SAli.Bahrami@Sun.COM */ 10829273SAli.Bahrami@Sun.COM #define conv_expn_field(_arg, _vdp, _fmt_flags) \ 10839273SAli.Bahrami@Sun.COM _conv_expn_field(_arg, _vdp, _fmt_flags, MSG_SGS_LOCAL_ARRAY) 10849273SAli.Bahrami@Sun.COM 10859273SAli.Bahrami@Sun.COM #define conv_expn_field2(_arg, _osabi, _mach, _vdp, _fmt_flags) \ 10869273SAli.Bahrami@Sun.COM _conv_expn_field2(_arg, _osabi, _mach, _vdp, _fmt_flags, \ 10879273SAli.Bahrami@Sun.COM MSG_SGS_LOCAL_ARRAY) 10889273SAli.Bahrami@Sun.COM 10899273SAli.Bahrami@Sun.COM #define conv_iter_ds(_osabi, _mach, _dsp, _func, _uvalue) \ 10909273SAli.Bahrami@Sun.COM _conv_iter_ds(_osabi, _mach, _dsp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY) 10919273SAli.Bahrami@Sun.COM 10929273SAli.Bahrami@Sun.COM #define conv_iter_vd(_vdp, _func, _uvalue) \ 10939273SAli.Bahrami@Sun.COM _conv_iter_vd(_vdp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY) 10949273SAli.Bahrami@Sun.COM 10959273SAli.Bahrami@Sun.COM #define conv_iter_vd2(_osabi, _mach, _vdp, _func, _uvalue) \ 10969273SAli.Bahrami@Sun.COM _conv_iter_vd2(_osabi, _mach, _vdp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY) 10979273SAli.Bahrami@Sun.COM 10989273SAli.Bahrami@Sun.COM #define conv_map_ds(_osabi, _mach, _value, _dsp, _fmt_flags, _inv_buf) \ 10999273SAli.Bahrami@Sun.COM _conv_map_ds(_osabi, _mach, _value, _dsp, _fmt_flags, _inv_buf, \ 11009273SAli.Bahrami@Sun.COM MSG_SGS_LOCAL_ARRAY) 11019273SAli.Bahrami@Sun.COM 11020Sstevel@tonic-gate 11030Sstevel@tonic-gate #ifdef __cplusplus 11040Sstevel@tonic-gate } 11050Sstevel@tonic-gate #endif 11060Sstevel@tonic-gate 11070Sstevel@tonic-gate #endif /* _CONV_H */ 1108