xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/sections.c (revision 11827:d7ef53deac3f)
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  */
21685Srie 
220Sstevel@tonic-gate /*
23*11827SRod.Evans@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*
280Sstevel@tonic-gate  * String conversion routines for section attributes.
290Sstevel@tonic-gate  */
300Sstevel@tonic-gate #include	<string.h>
310Sstevel@tonic-gate #include	<sys/param.h>
320Sstevel@tonic-gate #include	<sys/elf_SPARC.h>
330Sstevel@tonic-gate #include	<sys/elf_amd64.h>
340Sstevel@tonic-gate #include	<_conv.h>
350Sstevel@tonic-gate #include	<sections_msg.h>
360Sstevel@tonic-gate 
371976Sab196087 
389273SAli.Bahrami@Sun.COM static const conv_ds_t **
sec_type_strings(conv_iter_osabi_t osabi,Half mach,Conv_fmt_flags_t fmt_flags)399273SAli.Bahrami@Sun.COM sec_type_strings(conv_iter_osabi_t osabi, Half mach, Conv_fmt_flags_t fmt_flags)
409273SAli.Bahrami@Sun.COM {
419273SAli.Bahrami@Sun.COM 	/*
429273SAli.Bahrami@Sun.COM 	 * This routine can return an array with 1 generic array, up to
439273SAli.Bahrami@Sun.COM 	 * three osabi arrays, two machine arrays, plus the NULL termination.
449273SAli.Bahrami@Sun.COM 	 */
459273SAli.Bahrami@Sun.COM #define	MAX_RET	7
461976Sab196087 
479273SAli.Bahrami@Sun.COM 	static const Msg secs_def[SHT_NUM] = {
489273SAli.Bahrami@Sun.COM 		MSG_SHT_NULL,			MSG_SHT_PROGBITS,
499273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB,			MSG_SHT_STRTAB,
509273SAli.Bahrami@Sun.COM 		MSG_SHT_RELA,			MSG_SHT_HASH,
519273SAli.Bahrami@Sun.COM 		MSG_SHT_DYNAMIC,		MSG_SHT_NOTE,
529273SAli.Bahrami@Sun.COM 		MSG_SHT_NOBITS,			MSG_SHT_REL,
539273SAli.Bahrami@Sun.COM 		MSG_SHT_SHLIB,			MSG_SHT_DYNSYM,
549273SAli.Bahrami@Sun.COM 		MSG_SHT_UNKNOWN12,		MSG_SHT_UNKNOWN13,
559273SAli.Bahrami@Sun.COM 		MSG_SHT_INIT_ARRAY,		MSG_SHT_FINI_ARRAY,
569273SAli.Bahrami@Sun.COM 		MSG_SHT_PREINIT_ARRAY,		MSG_SHT_GROUP,
579273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_SHNDX
589273SAli.Bahrami@Sun.COM 	};
599273SAli.Bahrami@Sun.COM 	static const Msg secs_dmp[SHT_NUM] = {
609273SAli.Bahrami@Sun.COM 		MSG_SHT_NULL_DMP,		MSG_SHT_PROGBITS_DMP,
619273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_DMP,		MSG_SHT_STRTAB_DMP,
629273SAli.Bahrami@Sun.COM 		MSG_SHT_RELA_DMP,		MSG_SHT_HASH_DMP,
639273SAli.Bahrami@Sun.COM 		MSG_SHT_DYNAMIC_DMP,		MSG_SHT_NOTE_DMP,
649273SAli.Bahrami@Sun.COM 		MSG_SHT_NOBITS_DMP,		MSG_SHT_REL_DMP,
659273SAli.Bahrami@Sun.COM 		MSG_SHT_SHLIB_DMP,		MSG_SHT_DYNSYM_DMP,
669273SAli.Bahrami@Sun.COM 		MSG_SHT_UNKNOWN12_DMP,		MSG_SHT_UNKNOWN13_DMP,
679273SAli.Bahrami@Sun.COM 		MSG_SHT_INIT_ARRAY_DMP,		MSG_SHT_FINI_ARRAY_DMP,
689273SAli.Bahrami@Sun.COM 		MSG_SHT_PREINIT_ARRAY_DMP,	MSG_SHT_GROUP_DMP,
699273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_SHNDX_DMP
709273SAli.Bahrami@Sun.COM 	};
719273SAli.Bahrami@Sun.COM 	static const Msg secs_cf[SHT_NUM] = {
729273SAli.Bahrami@Sun.COM 		MSG_SHT_NULL_CF,		MSG_SHT_PROGBITS_CF,
739273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_CF,		MSG_SHT_STRTAB_CF,
749273SAli.Bahrami@Sun.COM 		MSG_SHT_RELA_CF,		MSG_SHT_HASH_CF,
759273SAli.Bahrami@Sun.COM 		MSG_SHT_DYNAMIC_CF,		MSG_SHT_NOTE_CF,
769273SAli.Bahrami@Sun.COM 		MSG_SHT_NOBITS_CF,		MSG_SHT_REL_CF,
779273SAli.Bahrami@Sun.COM 		MSG_SHT_SHLIB_CF,		MSG_SHT_DYNSYM_CF,
789273SAli.Bahrami@Sun.COM 		MSG_SHT_UNKNOWN12_CF,		MSG_SHT_UNKNOWN13_CF,
799273SAli.Bahrami@Sun.COM 		MSG_SHT_INIT_ARRAY_CF,		MSG_SHT_FINI_ARRAY_CF,
809273SAli.Bahrami@Sun.COM 		MSG_SHT_PREINIT_ARRAY_CF,	MSG_SHT_GROUP_CF,
819273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_SHNDX_CF
829273SAli.Bahrami@Sun.COM 	};
839273SAli.Bahrami@Sun.COM 	static const Msg secs_nf[SHT_NUM] = {
849273SAli.Bahrami@Sun.COM 		MSG_SHT_NULL_NF,		MSG_SHT_PROGBITS_NF,
859273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_NF,		MSG_SHT_STRTAB_NF,
869273SAli.Bahrami@Sun.COM 		MSG_SHT_RELA_NF,		MSG_SHT_HASH_NF,
879273SAli.Bahrami@Sun.COM 		MSG_SHT_DYNAMIC_NF,		MSG_SHT_NOTE_NF,
889273SAli.Bahrami@Sun.COM 		MSG_SHT_NOBITS_NF,		MSG_SHT_REL_NF,
899273SAli.Bahrami@Sun.COM 		MSG_SHT_SHLIB_NF,		MSG_SHT_DYNSYM_NF,
909273SAli.Bahrami@Sun.COM 		MSG_SHT_UNKNOWN12_NF,		MSG_SHT_UNKNOWN13_NF,
919273SAli.Bahrami@Sun.COM 		MSG_SHT_INIT_ARRAY_NF,		MSG_SHT_FINI_ARRAY_NF,
929273SAli.Bahrami@Sun.COM 		MSG_SHT_PREINIT_ARRAY_NF,	MSG_SHT_GROUP_NF,
939273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_SHNDX_NF
949273SAli.Bahrami@Sun.COM 	};
950Sstevel@tonic-gate #if	(SHT_NUM != (SHT_SYMTAB_SHNDX + 1))
960Sstevel@tonic-gate #error	"SHT_NUM has grown"
970Sstevel@tonic-gate #endif
989273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_secs_def = {
999273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_NULL, secs_def) };
1009273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_secs_dmp = {
1019273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_NULL, secs_dmp) };
1029273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_secs_cf = {
1039273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_NULL, secs_cf) };
1049273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_secs_nf = {
1059273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_NULL, secs_nf) };
1060Sstevel@tonic-gate 
1079273SAli.Bahrami@Sun.COM 
1089273SAli.Bahrami@Sun.COM 	static const Msg usecs_def[SHT_HISUNW - SHT_LOSUNW + 1] = {
109*11827SRod.Evans@Sun.COM 		MSG_SHT_SUNW_CAPCHAIN,		MSG_SHT_SUNW_CAPINFO,
1109273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_SYMSORT,		MSG_SHT_SUNW_TLSSORT,
1119273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_LDYNSYM,		MSG_SHT_SUNW_DOF,
1129273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_CAP,		MSG_SHT_SUNW_SIGNATURE,
1139273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_ANNOTATE,		MSG_SHT_SUNW_DEBUGSTR,
1149273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_DEBUG,		MSG_SHT_SUNW_MOVE,
1159273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_COMDAT,		MSG_SHT_SUNW_SYMINFO,
1169273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERDEF,		MSG_SHT_SUNW_VERNEED,
1179273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERSYM
1189273SAli.Bahrami@Sun.COM 	};
1199273SAli.Bahrami@Sun.COM 	static const Msg usecs_dmp[SHT_HISUNW - SHT_LOSUNW + 1] = {
120*11827SRod.Evans@Sun.COM 		MSG_SHT_SUNW_CAPCHAIN_DMP,	MSG_SHT_SUNW_CAPINFO_DMP,
1219273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_SYMSORT_DMP,	MSG_SHT_SUNW_TLSSORT_DMP,
1229273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_LDYNSYM_DMP,	MSG_SHT_SUNW_DOF_DMP,
1239273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_CAP_DMP,		MSG_SHT_SUNW_SIGNATURE_DMP,
1249273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_ANNOTATE_DMP,	MSG_SHT_SUNW_DEBUGSTR_DMP,
1259273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_DEBUG_DMP,		MSG_SHT_SUNW_MOVE_DMP,
1269273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_COMDAT_DMP,	MSG_SHT_SUNW_SYMINFO_DMP,
1279273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERDEF_DMP,	MSG_SHT_SUNW_VERNEED_DMP,
1289273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERSYM_DMP
1299273SAli.Bahrami@Sun.COM 	};
1309273SAli.Bahrami@Sun.COM 	static const Msg usecs_cf[SHT_HISUNW - SHT_LOSUNW + 1] = {
131*11827SRod.Evans@Sun.COM 		MSG_SHT_SUNW_CAPCHAIN_CF,	MSG_SHT_SUNW_CAPINFO_CF,
1329273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_SYMSORT_CF,	MSG_SHT_SUNW_TLSSORT_CF,
1339273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_LDYNSYM_CF,	MSG_SHT_SUNW_DOF_CF,
1349273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_CAP_CF,		MSG_SHT_SUNW_SIGNATURE_CF,
1359273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_ANNOTATE_CF,	MSG_SHT_SUNW_DEBUGSTR_CF,
1369273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_DEBUG_CF,		MSG_SHT_SUNW_MOVE_CF,
1379273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_COMDAT_CF,		MSG_SHT_SUNW_SYMINFO_CF,
1389273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERDEF_CF,		MSG_SHT_SUNW_VERNEED_CF,
1399273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERSYM_CF
1409273SAli.Bahrami@Sun.COM 	};
1419273SAli.Bahrami@Sun.COM 	static const Msg usecs_nf[SHT_HISUNW - SHT_LOSUNW + 1] = {
142*11827SRod.Evans@Sun.COM 		MSG_SHT_SUNW_CAPCHAIN_NF,	MSG_SHT_SUNW_CAPINFO_NF,
1439273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_SYMSORT_NF,	MSG_SHT_SUNW_TLSSORT_NF,
1449273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_LDYNSYM_NF,	MSG_SHT_SUNW_DOF_NF,
1459273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_CAP_NF,		MSG_SHT_SUNW_SIGNATURE_NF,
1469273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_ANNOTATE_NF,	MSG_SHT_SUNW_DEBUGSTR_NF,
1479273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_DEBUG_NF,		MSG_SHT_SUNW_MOVE_NF,
1489273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_COMDAT_NF,		MSG_SHT_SUNW_SYMINFO_NF,
1499273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERDEF_NF,		MSG_SHT_SUNW_VERNEED_NF,
1509273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERSYM_NF
1519273SAli.Bahrami@Sun.COM 	};
152*11827SRod.Evans@Sun.COM #if	(SHT_LOSUNW != SHT_SUNW_capchain)
1530Sstevel@tonic-gate #error	"SHT_LOSUNW has moved"
1540Sstevel@tonic-gate #endif
1559273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_def = {
156*11827SRod.Evans@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SUNW_capchain, usecs_def) };
1579273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_dmp = {
158*11827SRod.Evans@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SUNW_capchain, usecs_dmp) };
1599273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_cf = {
160*11827SRod.Evans@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SUNW_capchain, usecs_cf) };
1619273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_nf = {
162*11827SRod.Evans@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SUNW_capchain, usecs_nf) };
1639273SAli.Bahrami@Sun.COM 
1649273SAli.Bahrami@Sun.COM 
1659273SAli.Bahrami@Sun.COM 	/* The Linux osabi range has two separate sequences */
1669273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu1_def[] = {
1679273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_ATTRIBUTES,		MSG_SHT_GNU_HASH,
1689273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_LIBLIST,		MSG_SHT_CHECKSUM,
1699273SAli.Bahrami@Sun.COM 	};
1709273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu1_dmp[] = {
1719273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_ATTRIBUTES_DMP,	MSG_SHT_GNU_HASH_DMP,
1729273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_LIBLIST_DMP,	MSG_SHT_CHECKSUM_DMP,
1739273SAli.Bahrami@Sun.COM 	};
1749273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu1_cf[] = {
1759273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_ATTRIBUTES_CF,	MSG_SHT_GNU_HASH_CF,
1769273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_LIBLIST_CF,	MSG_SHT_CHECKSUM_CF,
1779273SAli.Bahrami@Sun.COM 	};
1789273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu1_nf[] = {
1799273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_ATTRIBUTES_NF,	MSG_SHT_GNU_HASH_NF,
1809273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_LIBLIST_NF,	MSG_SHT_CHECKSUM_NF,
1819273SAli.Bahrami@Sun.COM 	};
1829273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu1_def = {
1839273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_def) };
1849273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu1_dmp = {
1859273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_dmp) };
1869273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu1_cf = {
1879273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_cf) };
1889273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu1_nf = {
1899273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_nf) };
1900Sstevel@tonic-gate 
1911976Sab196087 
1929273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu2_def[] = {
1939273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERDEF,		MSG_SHT_GNU_VERNEED,
1949273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERSYM
1959273SAli.Bahrami@Sun.COM 	};
1969273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu2_dmp[] = {
1979273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERDEF_DMP,		MSG_SHT_GNU_VERNEED_DMP,
1989273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERSYM_DMP
1999273SAli.Bahrami@Sun.COM 	};
2009273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu2_cf[] = {
2019273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERDEF_CF,		MSG_SHT_GNU_VERNEED_CF,
2029273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERSYM_CF
2039273SAli.Bahrami@Sun.COM 	};
2049273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu2_nf[] = {
2059273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERDEF_NF,		MSG_SHT_GNU_VERNEED_NF,
2069273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERSYM_NF
2079273SAli.Bahrami@Sun.COM 	};
2089273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu2_def = {
2099273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_def) };
2109273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu2_dmp = {
2119273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_dmp) };
2129273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu2_cf = {
2139273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_cf) };
2149273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu2_nf = {
2159273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_nf) };
2169273SAli.Bahrami@Sun.COM 
2179273SAli.Bahrami@Sun.COM 
2189273SAli.Bahrami@Sun.COM 	/* sparc processor range */
2199273SAli.Bahrami@Sun.COM 	static const Msg sparc_def[] = { MSG_SHT_SPARC_GOTDATA };
2209273SAli.Bahrami@Sun.COM 	static const Msg sparc_dmp[] = { MSG_SHT_SPARC_GOTDATA_DMP };
2219273SAli.Bahrami@Sun.COM 	static const Msg sparc_cf[] = { MSG_SHT_SPARC_GOTDATA_CF };
2229273SAli.Bahrami@Sun.COM 	static const Msg sparc_nf[] = { MSG_SHT_SPARC_GOTDATA_NF };
2239273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_sparc_def = {
2249273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_def) };
2259273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_sparc_dmp = {
2269273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_dmp) };
2279273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_sparc_cf = {
2289273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_cf) };
2299273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_sparc_nf = {
2309273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_nf) };
2319273SAli.Bahrami@Sun.COM 
2329273SAli.Bahrami@Sun.COM 	/* amd64 processor range */
2339273SAli.Bahrami@Sun.COM 	static const Msg amd64_def[] = { MSG_SHT_AMD64_UNWIND };
2349273SAli.Bahrami@Sun.COM 	static const Msg amd64_dmp[] = { MSG_SHT_AMD64_UNWIND_DMP };
2359273SAli.Bahrami@Sun.COM 	static const Msg amd64_cf[] = { MSG_SHT_AMD64_UNWIND_CF };
2369273SAli.Bahrami@Sun.COM 	static const Msg amd64_nf[] = { MSG_SHT_AMD64_UNWIND_NF };
2379273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_amd64_def = {
2389273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_def) };
2399273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_amd64_dmp = {
2409273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_dmp) };
2419273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_amd64_cf = {
2429273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_cf) };
2439273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_amd64_nf = {
2449273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_nf) };
2459273SAli.Bahrami@Sun.COM 
2469273SAli.Bahrami@Sun.COM 
2479273SAli.Bahrami@Sun.COM 	static const conv_ds_t	*retarr[MAX_RET];
2489273SAli.Bahrami@Sun.COM 	int			retndx = 0;
2499273SAli.Bahrami@Sun.COM 
2509273SAli.Bahrami@Sun.COM 	/* Select the strings to use, based on string style and OSABI */
2519273SAli.Bahrami@Sun.COM 	switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
2529273SAli.Bahrami@Sun.COM 	case CONV_FMT_ALT_DUMP:
2539273SAli.Bahrami@Sun.COM 		retarr[retndx++] = CONV_DS_ADDR(ds_secs_dmp);
2549273SAli.Bahrami@Sun.COM 		break;
2559273SAli.Bahrami@Sun.COM 	case CONV_FMT_ALT_CF:
2569273SAli.Bahrami@Sun.COM 		retarr[retndx++] = CONV_DS_ADDR(ds_secs_cf);
2579273SAli.Bahrami@Sun.COM 		break;
2589273SAli.Bahrami@Sun.COM 	case CONV_FMT_ALT_NF:
2599273SAli.Bahrami@Sun.COM 		retarr[retndx++] = CONV_DS_ADDR(ds_secs_nf);
2609273SAli.Bahrami@Sun.COM 		break;
2619273SAli.Bahrami@Sun.COM 	default:
2629273SAli.Bahrami@Sun.COM 		retarr[retndx++] = CONV_DS_ADDR(ds_secs_def);
2639273SAli.Bahrami@Sun.COM 		break;
2649273SAli.Bahrami@Sun.COM 	}
2659273SAli.Bahrami@Sun.COM 
2669273SAli.Bahrami@Sun.COM 	if ((osabi == ELFOSABI_NONE) || (osabi == ELFOSABI_SOLARIS) ||
2679273SAli.Bahrami@Sun.COM 	    (osabi == CONV_OSABI_ALL)) {
2685088Sab196087 		switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
2695088Sab196087 		case CONV_FMT_ALT_DUMP:
2709273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_dmp);
2719273SAli.Bahrami@Sun.COM 			break;
2729273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_CF:
2739273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_cf);
2749273SAli.Bahrami@Sun.COM 			break;
2759273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_NF:
2769273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_nf);
2779273SAli.Bahrami@Sun.COM 			break;
2785088Sab196087 		default:
2799273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_def);
2809273SAli.Bahrami@Sun.COM 			break;
2811976Sab196087 		}
2821976Sab196087 	}
2831976Sab196087 
2849273SAli.Bahrami@Sun.COM 	if ((osabi == ELFOSABI_LINUX) || (osabi == CONV_OSABI_ALL)) {
2859273SAli.Bahrami@Sun.COM 		switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
2869273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_DUMP:
2879273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_dmp);
2889273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_dmp);
2899273SAli.Bahrami@Sun.COM 			break;
2909273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_CF:
2919273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_cf);
2929273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_cf);
2939273SAli.Bahrami@Sun.COM 			break;
2949273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_NF:
2959273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_nf);
2969273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_nf);
2979273SAli.Bahrami@Sun.COM 			break;
2989273SAli.Bahrami@Sun.COM 		default:
2999273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_def);
3009273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_def);
3019273SAli.Bahrami@Sun.COM 			break;
3029273SAli.Bahrami@Sun.COM 		}
3039273SAli.Bahrami@Sun.COM 	}
3049273SAli.Bahrami@Sun.COM 
3059273SAli.Bahrami@Sun.COM 	if ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
3069273SAli.Bahrami@Sun.COM 	    (mach == EM_SPARCV9) || (mach == CONV_MACH_ALL)) {
3079273SAli.Bahrami@Sun.COM 		switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
3089273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_DUMP:
3099273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_sparc_dmp);
3109273SAli.Bahrami@Sun.COM 			break;
3119273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_CF:
3129273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_sparc_cf);
3139273SAli.Bahrami@Sun.COM 			break;
3149273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_NF:
3159273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_sparc_nf);
3169273SAli.Bahrami@Sun.COM 			break;
3179273SAli.Bahrami@Sun.COM 		default:
3189273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_sparc_def);
3199273SAli.Bahrami@Sun.COM 			break;
3209273SAli.Bahrami@Sun.COM 		}
3219273SAli.Bahrami@Sun.COM 	}
3229273SAli.Bahrami@Sun.COM 
3239273SAli.Bahrami@Sun.COM 	if ((mach == EM_AMD64) || (mach == CONV_MACH_ALL)) {
3249273SAli.Bahrami@Sun.COM 		switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
3259273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_DUMP:
3269273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_amd64_dmp);
3279273SAli.Bahrami@Sun.COM 			break;
3289273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_CF:
3299273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_amd64_cf);
3309273SAli.Bahrami@Sun.COM 			break;
3319273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_NF:
3329273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_amd64_nf);
3339273SAli.Bahrami@Sun.COM 			break;
3349273SAli.Bahrami@Sun.COM 		default:
3359273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_amd64_def);
3369273SAli.Bahrami@Sun.COM 			break;
3379273SAli.Bahrami@Sun.COM 		}
3389273SAli.Bahrami@Sun.COM 	}
3399273SAli.Bahrami@Sun.COM 
3409273SAli.Bahrami@Sun.COM 	retarr[retndx++] = NULL;
3419273SAli.Bahrami@Sun.COM 	assert(retndx <= MAX_RET);
3429273SAli.Bahrami@Sun.COM 	return (retarr);
3439273SAli.Bahrami@Sun.COM 
3449273SAli.Bahrami@Sun.COM #undef MAX_RET
3459273SAli.Bahrami@Sun.COM }
3469273SAli.Bahrami@Sun.COM 
3479273SAli.Bahrami@Sun.COM const char *
conv_sec_type(uchar_t osabi,Half mach,Word sec,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)3489273SAli.Bahrami@Sun.COM conv_sec_type(uchar_t osabi, Half mach, Word sec, Conv_fmt_flags_t fmt_flags,
3499273SAli.Bahrami@Sun.COM     Conv_inv_buf_t *inv_buf)
3509273SAli.Bahrami@Sun.COM {
3519273SAli.Bahrami@Sun.COM 	return (conv_map_ds(osabi, mach, sec,
3529273SAli.Bahrami@Sun.COM 	    sec_type_strings(osabi, mach, fmt_flags), fmt_flags, inv_buf));
3530Sstevel@tonic-gate }
3540Sstevel@tonic-gate 
3559273SAli.Bahrami@Sun.COM conv_iter_ret_t
conv_iter_sec_type(conv_iter_osabi_t osabi,Half mach,Conv_fmt_flags_t fmt_flags,conv_iter_cb_t func,void * uvalue)3569273SAli.Bahrami@Sun.COM conv_iter_sec_type(conv_iter_osabi_t osabi, Half mach,
3579273SAli.Bahrami@Sun.COM     Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
3589273SAli.Bahrami@Sun.COM {
3599273SAli.Bahrami@Sun.COM 	return (conv_iter_ds(osabi, mach,
3609273SAli.Bahrami@Sun.COM 	    sec_type_strings(osabi, mach, fmt_flags), func, uvalue));
3619273SAli.Bahrami@Sun.COM }
3629273SAli.Bahrami@Sun.COM 
3634734Sab196087 
3644734Sab196087 /*
3659273SAli.Bahrami@Sun.COM  * Special iteration routine that returns strings for all symbol table
3669273SAli.Bahrami@Sun.COM  * sections.
3674734Sab196087  */
3689273SAli.Bahrami@Sun.COM conv_iter_ret_t
conv_iter_sec_symtab(conv_iter_osabi_t osabi,Conv_fmt_flags_t fmt_flags,conv_iter_cb_t func,void * uvalue)3699273SAli.Bahrami@Sun.COM conv_iter_sec_symtab(conv_iter_osabi_t osabi, Conv_fmt_flags_t fmt_flags,
3709273SAli.Bahrami@Sun.COM     conv_iter_cb_t func, void *uvalue)
3719273SAli.Bahrami@Sun.COM {
3729273SAli.Bahrami@Sun.COM 	static const Val_desc2 symtab_cf[] = {
3739273SAli.Bahrami@Sun.COM 		{ SHT_SYMTAB,	0, 0,	MSG_SHT_SYMTAB_CF },
3749273SAli.Bahrami@Sun.COM 		{ SHT_DYNSYM,	0, 0,	MSG_SHT_DYNSYM_CF },
3759273SAli.Bahrami@Sun.COM 		{ SHT_SUNW_LDYNSYM, ELFOSABI_SOLARIS, 0,
3769273SAli.Bahrami@Sun.COM 					MSG_SHT_SUNW_LDYNSYM_CF },
3779273SAli.Bahrami@Sun.COM 
3789273SAli.Bahrami@Sun.COM 		{ 0 }
3799273SAli.Bahrami@Sun.COM 	};
3809273SAli.Bahrami@Sun.COM 	static const Val_desc2 symtab_nf[] = {
3819273SAli.Bahrami@Sun.COM 		{ SHT_SYMTAB,	0, 0,	MSG_SHT_SYMTAB_NF },
3829273SAli.Bahrami@Sun.COM 		{ SHT_DYNSYM,	0, 0,	MSG_SHT_DYNSYM_NF },
3839273SAli.Bahrami@Sun.COM 		{ SHT_SUNW_LDYNSYM, ELFOSABI_SOLARIS, 0,
3849273SAli.Bahrami@Sun.COM 					MSG_SHT_SUNW_LDYNSYM_NF },
3859273SAli.Bahrami@Sun.COM 
3869273SAli.Bahrami@Sun.COM 		{ 0 }
3879273SAli.Bahrami@Sun.COM 	};
3889273SAli.Bahrami@Sun.COM 
3899273SAli.Bahrami@Sun.COM 	const Val_desc2 *vdp;
3909273SAli.Bahrami@Sun.COM 
3919273SAli.Bahrami@Sun.COM 	vdp = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
3929273SAli.Bahrami@Sun.COM 	    symtab_nf : symtab_cf;
3939273SAli.Bahrami@Sun.COM 
3949273SAli.Bahrami@Sun.COM 	return (conv_iter_vd2(osabi, EM_NONE, vdp, func, uvalue));
3959273SAli.Bahrami@Sun.COM }
3969273SAli.Bahrami@Sun.COM 
3979273SAli.Bahrami@Sun.COM 
3989273SAli.Bahrami@Sun.COM const Val_desc2 *
conv_sec_flags_strings(Conv_fmt_flags_t fmt_flags)3999273SAli.Bahrami@Sun.COM conv_sec_flags_strings(Conv_fmt_flags_t fmt_flags)
4009273SAli.Bahrami@Sun.COM {
4019273SAli.Bahrami@Sun.COM #define	FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
4029273SAli.Bahrami@Sun.COM 	MSG_SHF_WRITE_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4039273SAli.Bahrami@Sun.COM 	MSG_SHF_ALLOC_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4049273SAli.Bahrami@Sun.COM 	MSG_SHF_EXECINSTR_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4059273SAli.Bahrami@Sun.COM 	MSG_SHF_MERGE_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4069273SAli.Bahrami@Sun.COM 	MSG_SHF_STRINGS_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4079273SAli.Bahrami@Sun.COM 	MSG_SHF_INFO_LINK_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4089273SAli.Bahrami@Sun.COM 	MSG_SHF_LINK_ORDER_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4099273SAli.Bahrami@Sun.COM 	MSG_SHF_OS_NONCONFORMING_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4109273SAli.Bahrami@Sun.COM 	MSG_SHF_GROUP_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4119273SAli.Bahrami@Sun.COM 	MSG_SHF_TLS_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4129273SAli.Bahrami@Sun.COM 	MSG_SHF_EXCLUDE_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4139273SAli.Bahrami@Sun.COM 	MSG_SHF_ORDERED_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4149273SAli.Bahrami@Sun.COM 	MSG_SHF_AMD64_LARGE_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
4159273SAli.Bahrami@Sun.COM 	CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
4169273SAli.Bahrami@Sun.COM 
4179273SAli.Bahrami@Sun.COM 	/*
4189273SAli.Bahrami@Sun.COM 	 * Ensure that Conv_sec_flags_buf_t is large enough:
4199273SAli.Bahrami@Sun.COM 	 *
4209273SAli.Bahrami@Sun.COM 	 * FLAGSZ is the real minimum size of the buffer required by
4219273SAli.Bahrami@Sun.COM 	 * conv_sec_flags(). However, Conv_sec_flags_buf_t uses
4229273SAli.Bahrami@Sun.COM 	 * CONV_SEC_FLAGS_BUFSIZE to set the buffer size. We do things this
4239273SAli.Bahrami@Sun.COM 	 * way because the definition of FLAGSZ uses information that is not
4249273SAli.Bahrami@Sun.COM 	 * available in the environment of other programs that include the
4259273SAli.Bahrami@Sun.COM 	 * conv.h header file.
4269273SAli.Bahrami@Sun.COM 	 */
4275152Sab196087 #if (CONV_SEC_FLAGS_BUFSIZE != FLAGSZ) && !defined(__lint)
4285152Sab196087 #define	REPORT_BUFSIZE FLAGSZ
4295152Sab196087 #include "report_bufsize.h"
4305152Sab196087 #error "CONV_SEC_FLAGS_BUFSIZE does not match FLAGSZ"
4314734Sab196087 #endif
4320Sstevel@tonic-gate 
4339273SAli.Bahrami@Sun.COM #define	ALL	ELFOSABI_NONE, EM_NONE
4349273SAli.Bahrami@Sun.COM #define	SOL	ELFOSABI_SOLARIS, EM_NONE
4359273SAli.Bahrami@Sun.COM #define	AMD	ELFOSABI_NONE, EM_AMD64
4369273SAli.Bahrami@Sun.COM 
4379273SAli.Bahrami@Sun.COM 	static const Val_desc2 vda_cf[] = {
4389273SAli.Bahrami@Sun.COM 		{ SHF_WRITE,		ALL,	MSG_SHF_WRITE_CF },
4399273SAli.Bahrami@Sun.COM 		{ SHF_ALLOC,		ALL,	MSG_SHF_ALLOC_CF },
4409273SAli.Bahrami@Sun.COM 		{ SHF_EXECINSTR,	ALL,	MSG_SHF_EXECINSTR_CF },
4419273SAli.Bahrami@Sun.COM 		{ SHF_MERGE,		ALL,	MSG_SHF_MERGE_CF },
4429273SAli.Bahrami@Sun.COM 		{ SHF_STRINGS,		ALL,	MSG_SHF_STRINGS_CF },
4439273SAli.Bahrami@Sun.COM 		{ SHF_INFO_LINK,	ALL,	MSG_SHF_INFO_LINK_CF },
4449273SAli.Bahrami@Sun.COM 		{ SHF_LINK_ORDER,	ALL,	MSG_SHF_LINK_ORDER_CF },
4459273SAli.Bahrami@Sun.COM 		{ SHF_OS_NONCONFORMING,	ALL,	MSG_SHF_OS_NONCONFORMING_CF },
4469273SAli.Bahrami@Sun.COM 		{ SHF_GROUP,		ALL,	MSG_SHF_GROUP_CF },
4479273SAli.Bahrami@Sun.COM 		{ SHF_TLS,		ALL,	MSG_SHF_TLS_CF },
4489273SAli.Bahrami@Sun.COM 		{ SHF_EXCLUDE,		SOL,	MSG_SHF_EXCLUDE_CF },
4499273SAli.Bahrami@Sun.COM 		{ SHF_ORDERED,		SOL,	MSG_SHF_ORDERED_CF },
4509273SAli.Bahrami@Sun.COM 		{ SHF_AMD64_LARGE,	AMD,	MSG_SHF_AMD64_LARGE_CF },
4519273SAli.Bahrami@Sun.COM 		{ 0,			0 }
4529273SAli.Bahrami@Sun.COM 	};
4539273SAli.Bahrami@Sun.COM 	static const Val_desc2 vda_nf[] = {
4549273SAli.Bahrami@Sun.COM 		{ SHF_WRITE,		ALL,	MSG_SHF_WRITE_NF },
4559273SAli.Bahrami@Sun.COM 		{ SHF_ALLOC,		ALL,	MSG_SHF_ALLOC_NF },
4569273SAli.Bahrami@Sun.COM 		{ SHF_EXECINSTR,	ALL,	MSG_SHF_EXECINSTR_NF },
4579273SAli.Bahrami@Sun.COM 		{ SHF_MERGE,		ALL,	MSG_SHF_MERGE_NF },
4589273SAli.Bahrami@Sun.COM 		{ SHF_STRINGS,		ALL,	MSG_SHF_STRINGS_NF },
4599273SAli.Bahrami@Sun.COM 		{ SHF_INFO_LINK,	ALL,	MSG_SHF_INFO_LINK_NF },
4609273SAli.Bahrami@Sun.COM 		{ SHF_LINK_ORDER,	ALL,	MSG_SHF_LINK_ORDER_NF },
4619273SAli.Bahrami@Sun.COM 		{ SHF_OS_NONCONFORMING,	ALL,	MSG_SHF_OS_NONCONFORMING_NF },
4629273SAli.Bahrami@Sun.COM 		{ SHF_GROUP,		ALL,	MSG_SHF_GROUP_NF },
4639273SAli.Bahrami@Sun.COM 		{ SHF_TLS,		ALL,	MSG_SHF_TLS_NF },
4649273SAli.Bahrami@Sun.COM 		{ SHF_EXCLUDE,		SOL,	MSG_SHF_EXCLUDE_NF },
4659273SAli.Bahrami@Sun.COM 		{ SHF_ORDERED,		SOL,	MSG_SHF_ORDERED_NF },
4669273SAli.Bahrami@Sun.COM 		{ SHF_AMD64_LARGE,	AMD,	MSG_SHF_AMD64_LARGE_NF },
4671618Srie 		{ 0,			0 }
4681618Srie 	};
4690Sstevel@tonic-gate 
4709273SAli.Bahrami@Sun.COM 	return ((CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
4719273SAli.Bahrami@Sun.COM 	    vda_nf : vda_cf);
4720Sstevel@tonic-gate 
4739273SAli.Bahrami@Sun.COM #undef ALL
4749273SAli.Bahrami@Sun.COM #undef SOL
4759273SAli.Bahrami@Sun.COM #undef AMD
4760Sstevel@tonic-gate }
4770Sstevel@tonic-gate 
4789273SAli.Bahrami@Sun.COM conv_iter_ret_t
conv_iter_sec_flags(conv_iter_osabi_t osabi,Half mach,Conv_fmt_flags_t fmt_flags,conv_iter_cb_t func,void * uvalue)4799273SAli.Bahrami@Sun.COM conv_iter_sec_flags(conv_iter_osabi_t osabi, Half mach,
4809273SAli.Bahrami@Sun.COM     Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
4810Sstevel@tonic-gate {
4829273SAli.Bahrami@Sun.COM 	static const Msg amd64_alias_cf[] = { MSG_SHF_X86_64_LARGE_CF };
4839273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_msg_amd64_alias_cf = {
4849273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHF_X86_64_LARGE, amd64_alias_cf) };
4859273SAli.Bahrami@Sun.COM 	static const conv_ds_t	*ds_amd64_alias_cf[] = {
4869273SAli.Bahrami@Sun.COM 	    CONV_DS_ADDR(ds_msg_amd64_alias_cf), NULL };
4879273SAli.Bahrami@Sun.COM 
4889273SAli.Bahrami@Sun.COM 	static const Msg amd64_alias_nf[] = { MSG_SHF_X86_64_LARGE_NF };
4899273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_msg_amd64_alias_nf = {
4909273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHF_X86_64_LARGE, amd64_alias_nf) };
4919273SAli.Bahrami@Sun.COM 	static const conv_ds_t	*ds_amd64_alias_nf[] = {
4929273SAli.Bahrami@Sun.COM 	    CONV_DS_ADDR(ds_msg_amd64_alias_nf), NULL };
4939273SAli.Bahrami@Sun.COM 
4949273SAli.Bahrami@Sun.COM 
4959273SAli.Bahrami@Sun.COM 	if (conv_iter_vd2(osabi, mach, conv_sec_flags_strings(fmt_flags),
4969273SAli.Bahrami@Sun.COM 	    func, uvalue) == CONV_ITER_DONE)
4979273SAli.Bahrami@Sun.COM 		return (CONV_ITER_DONE);
4989273SAli.Bahrami@Sun.COM 
4999273SAli.Bahrami@Sun.COM 	/* SHF_AMD64_LARGE is also known as SHF_X86_64_LARGE */
5009273SAli.Bahrami@Sun.COM 	if (mach == EM_AMD64) {
5019273SAli.Bahrami@Sun.COM 		const conv_ds_t **ds;
5029273SAli.Bahrami@Sun.COM 
5039273SAli.Bahrami@Sun.COM 		ds = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
5049273SAli.Bahrami@Sun.COM 		    ds_amd64_alias_nf : ds_amd64_alias_cf;
5059273SAli.Bahrami@Sun.COM 
5069273SAli.Bahrami@Sun.COM 		return (conv_iter_ds(ELFOSABI_NONE, mach, ds, func, uvalue));
5070Sstevel@tonic-gate 	}
5084734Sab196087 
5099273SAli.Bahrami@Sun.COM 	return (CONV_ITER_CONT);
5100Sstevel@tonic-gate }
511