xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/sections.c (revision 9273:9a0603d78ad3)
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*9273SAli.Bahrami@Sun.COM  * Copyright 2009 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 
38*9273SAli.Bahrami@Sun.COM static const conv_ds_t **
39*9273SAli.Bahrami@Sun.COM sec_type_strings(conv_iter_osabi_t osabi, Half mach, Conv_fmt_flags_t fmt_flags)
40*9273SAli.Bahrami@Sun.COM {
41*9273SAli.Bahrami@Sun.COM 	/*
42*9273SAli.Bahrami@Sun.COM 	 * This routine can return an array with 1 generic array, up to
43*9273SAli.Bahrami@Sun.COM 	 * three osabi arrays, two machine arrays, plus the NULL termination.
44*9273SAli.Bahrami@Sun.COM 	 */
45*9273SAli.Bahrami@Sun.COM #define	MAX_RET	7
461976Sab196087 
47*9273SAli.Bahrami@Sun.COM 	static const Msg secs_def[SHT_NUM] = {
48*9273SAli.Bahrami@Sun.COM 		MSG_SHT_NULL,			MSG_SHT_PROGBITS,
49*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB,			MSG_SHT_STRTAB,
50*9273SAli.Bahrami@Sun.COM 		MSG_SHT_RELA,			MSG_SHT_HASH,
51*9273SAli.Bahrami@Sun.COM 		MSG_SHT_DYNAMIC,		MSG_SHT_NOTE,
52*9273SAli.Bahrami@Sun.COM 		MSG_SHT_NOBITS,			MSG_SHT_REL,
53*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SHLIB,			MSG_SHT_DYNSYM,
54*9273SAli.Bahrami@Sun.COM 		MSG_SHT_UNKNOWN12,		MSG_SHT_UNKNOWN13,
55*9273SAli.Bahrami@Sun.COM 		MSG_SHT_INIT_ARRAY,		MSG_SHT_FINI_ARRAY,
56*9273SAli.Bahrami@Sun.COM 		MSG_SHT_PREINIT_ARRAY,		MSG_SHT_GROUP,
57*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_SHNDX
58*9273SAli.Bahrami@Sun.COM 	};
59*9273SAli.Bahrami@Sun.COM 	static const Msg secs_dmp[SHT_NUM] = {
60*9273SAli.Bahrami@Sun.COM 		MSG_SHT_NULL_DMP,		MSG_SHT_PROGBITS_DMP,
61*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_DMP,		MSG_SHT_STRTAB_DMP,
62*9273SAli.Bahrami@Sun.COM 		MSG_SHT_RELA_DMP,		MSG_SHT_HASH_DMP,
63*9273SAli.Bahrami@Sun.COM 		MSG_SHT_DYNAMIC_DMP,		MSG_SHT_NOTE_DMP,
64*9273SAli.Bahrami@Sun.COM 		MSG_SHT_NOBITS_DMP,		MSG_SHT_REL_DMP,
65*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SHLIB_DMP,		MSG_SHT_DYNSYM_DMP,
66*9273SAli.Bahrami@Sun.COM 		MSG_SHT_UNKNOWN12_DMP,		MSG_SHT_UNKNOWN13_DMP,
67*9273SAli.Bahrami@Sun.COM 		MSG_SHT_INIT_ARRAY_DMP,		MSG_SHT_FINI_ARRAY_DMP,
68*9273SAli.Bahrami@Sun.COM 		MSG_SHT_PREINIT_ARRAY_DMP,	MSG_SHT_GROUP_DMP,
69*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_SHNDX_DMP
70*9273SAli.Bahrami@Sun.COM 	};
71*9273SAli.Bahrami@Sun.COM 	static const Msg secs_cf[SHT_NUM] = {
72*9273SAli.Bahrami@Sun.COM 		MSG_SHT_NULL_CF,		MSG_SHT_PROGBITS_CF,
73*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_CF,		MSG_SHT_STRTAB_CF,
74*9273SAli.Bahrami@Sun.COM 		MSG_SHT_RELA_CF,		MSG_SHT_HASH_CF,
75*9273SAli.Bahrami@Sun.COM 		MSG_SHT_DYNAMIC_CF,		MSG_SHT_NOTE_CF,
76*9273SAli.Bahrami@Sun.COM 		MSG_SHT_NOBITS_CF,		MSG_SHT_REL_CF,
77*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SHLIB_CF,		MSG_SHT_DYNSYM_CF,
78*9273SAli.Bahrami@Sun.COM 		MSG_SHT_UNKNOWN12_CF,		MSG_SHT_UNKNOWN13_CF,
79*9273SAli.Bahrami@Sun.COM 		MSG_SHT_INIT_ARRAY_CF,		MSG_SHT_FINI_ARRAY_CF,
80*9273SAli.Bahrami@Sun.COM 		MSG_SHT_PREINIT_ARRAY_CF,	MSG_SHT_GROUP_CF,
81*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_SHNDX_CF
82*9273SAli.Bahrami@Sun.COM 	};
83*9273SAli.Bahrami@Sun.COM 	static const Msg secs_nf[SHT_NUM] = {
84*9273SAli.Bahrami@Sun.COM 		MSG_SHT_NULL_NF,		MSG_SHT_PROGBITS_NF,
85*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_NF,		MSG_SHT_STRTAB_NF,
86*9273SAli.Bahrami@Sun.COM 		MSG_SHT_RELA_NF,		MSG_SHT_HASH_NF,
87*9273SAli.Bahrami@Sun.COM 		MSG_SHT_DYNAMIC_NF,		MSG_SHT_NOTE_NF,
88*9273SAli.Bahrami@Sun.COM 		MSG_SHT_NOBITS_NF,		MSG_SHT_REL_NF,
89*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SHLIB_NF,		MSG_SHT_DYNSYM_NF,
90*9273SAli.Bahrami@Sun.COM 		MSG_SHT_UNKNOWN12_NF,		MSG_SHT_UNKNOWN13_NF,
91*9273SAli.Bahrami@Sun.COM 		MSG_SHT_INIT_ARRAY_NF,		MSG_SHT_FINI_ARRAY_NF,
92*9273SAli.Bahrami@Sun.COM 		MSG_SHT_PREINIT_ARRAY_NF,	MSG_SHT_GROUP_NF,
93*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SYMTAB_SHNDX_NF
94*9273SAli.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
98*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_secs_def = {
99*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_NULL, secs_def) };
100*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_secs_dmp = {
101*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_NULL, secs_dmp) };
102*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_secs_cf = {
103*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_NULL, secs_cf) };
104*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_secs_nf = {
105*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_NULL, secs_nf) };
1060Sstevel@tonic-gate 
107*9273SAli.Bahrami@Sun.COM 
108*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_def[SHT_HISUNW - SHT_LOSUNW + 1] = {
109*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_SYMSORT,		MSG_SHT_SUNW_TLSSORT,
110*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_LDYNSYM,		MSG_SHT_SUNW_DOF,
111*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_CAP,		MSG_SHT_SUNW_SIGNATURE,
112*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_ANNOTATE,		MSG_SHT_SUNW_DEBUGSTR,
113*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_DEBUG,		MSG_SHT_SUNW_MOVE,
114*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_COMDAT,		MSG_SHT_SUNW_SYMINFO,
115*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERDEF,		MSG_SHT_SUNW_VERNEED,
116*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERSYM
117*9273SAli.Bahrami@Sun.COM 	};
118*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_dmp[SHT_HISUNW - SHT_LOSUNW + 1] = {
119*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_SYMSORT_DMP,	MSG_SHT_SUNW_TLSSORT_DMP,
120*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_LDYNSYM_DMP,	MSG_SHT_SUNW_DOF_DMP,
121*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_CAP_DMP,		MSG_SHT_SUNW_SIGNATURE_DMP,
122*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_ANNOTATE_DMP,	MSG_SHT_SUNW_DEBUGSTR_DMP,
123*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_DEBUG_DMP,		MSG_SHT_SUNW_MOVE_DMP,
124*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_COMDAT_DMP,	MSG_SHT_SUNW_SYMINFO_DMP,
125*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERDEF_DMP,	MSG_SHT_SUNW_VERNEED_DMP,
126*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERSYM_DMP
127*9273SAli.Bahrami@Sun.COM 	};
128*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_cf[SHT_HISUNW - SHT_LOSUNW + 1] = {
129*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_SYMSORT_CF,	MSG_SHT_SUNW_TLSSORT_CF,
130*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_LDYNSYM_CF,	MSG_SHT_SUNW_DOF_CF,
131*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_CAP_CF,		MSG_SHT_SUNW_SIGNATURE_CF,
132*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_ANNOTATE_CF,	MSG_SHT_SUNW_DEBUGSTR_CF,
133*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_DEBUG_CF,		MSG_SHT_SUNW_MOVE_CF,
134*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_COMDAT_CF,		MSG_SHT_SUNW_SYMINFO_CF,
135*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERDEF_CF,		MSG_SHT_SUNW_VERNEED_CF,
136*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERSYM_CF
137*9273SAli.Bahrami@Sun.COM 	};
138*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_nf[SHT_HISUNW - SHT_LOSUNW + 1] = {
139*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_SYMSORT_NF,	MSG_SHT_SUNW_TLSSORT_NF,
140*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_LDYNSYM_NF,	MSG_SHT_SUNW_DOF_NF,
141*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_CAP_NF,		MSG_SHT_SUNW_SIGNATURE_NF,
142*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_ANNOTATE_NF,	MSG_SHT_SUNW_DEBUGSTR_NF,
143*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_DEBUG_NF,		MSG_SHT_SUNW_MOVE_NF,
144*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_COMDAT_NF,		MSG_SHT_SUNW_SYMINFO_NF,
145*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERDEF_NF,		MSG_SHT_SUNW_VERNEED_NF,
146*9273SAli.Bahrami@Sun.COM 		MSG_SHT_SUNW_VERSYM_NF
147*9273SAli.Bahrami@Sun.COM 	};
1483492Sab196087 #if	(SHT_LOSUNW != SHT_SUNW_symsort)
1490Sstevel@tonic-gate #error	"SHT_LOSUNW has moved"
1500Sstevel@tonic-gate #endif
151*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_def = {
152*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SUNW_symsort, usecs_def) };
153*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_dmp = {
154*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SUNW_symsort, usecs_dmp) };
155*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_cf = {
156*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SUNW_symsort, usecs_cf) };
157*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_nf = {
158*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SUNW_symsort, usecs_nf) };
159*9273SAli.Bahrami@Sun.COM 
160*9273SAli.Bahrami@Sun.COM 
161*9273SAli.Bahrami@Sun.COM 	/* The Linux osabi range has two separate sequences */
162*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu1_def[] = {
163*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_ATTRIBUTES,		MSG_SHT_GNU_HASH,
164*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_LIBLIST,		MSG_SHT_CHECKSUM,
165*9273SAli.Bahrami@Sun.COM 	};
166*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu1_dmp[] = {
167*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_ATTRIBUTES_DMP,	MSG_SHT_GNU_HASH_DMP,
168*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_LIBLIST_DMP,	MSG_SHT_CHECKSUM_DMP,
169*9273SAli.Bahrami@Sun.COM 	};
170*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu1_cf[] = {
171*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_ATTRIBUTES_CF,	MSG_SHT_GNU_HASH_CF,
172*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_LIBLIST_CF,	MSG_SHT_CHECKSUM_CF,
173*9273SAli.Bahrami@Sun.COM 	};
174*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu1_nf[] = {
175*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_ATTRIBUTES_NF,	MSG_SHT_GNU_HASH_NF,
176*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_LIBLIST_NF,	MSG_SHT_CHECKSUM_NF,
177*9273SAli.Bahrami@Sun.COM 	};
178*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu1_def = {
179*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_def) };
180*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu1_dmp = {
181*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_dmp) };
182*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu1_cf = {
183*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_cf) };
184*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu1_nf = {
185*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_ATTRIBUTES, usecs_gnu1_nf) };
1860Sstevel@tonic-gate 
1871976Sab196087 
188*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu2_def[] = {
189*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERDEF,		MSG_SHT_GNU_VERNEED,
190*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERSYM
191*9273SAli.Bahrami@Sun.COM 	};
192*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu2_dmp[] = {
193*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERDEF_DMP,		MSG_SHT_GNU_VERNEED_DMP,
194*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERSYM_DMP
195*9273SAli.Bahrami@Sun.COM 	};
196*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu2_cf[] = {
197*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERDEF_CF,		MSG_SHT_GNU_VERNEED_CF,
198*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERSYM_CF
199*9273SAli.Bahrami@Sun.COM 	};
200*9273SAli.Bahrami@Sun.COM 	static const Msg usecs_gnu2_nf[] = {
201*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERDEF_NF,		MSG_SHT_GNU_VERNEED_NF,
202*9273SAli.Bahrami@Sun.COM 		MSG_SHT_GNU_VERSYM_NF
203*9273SAli.Bahrami@Sun.COM 	};
204*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu2_def = {
205*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_def) };
206*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu2_dmp = {
207*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_dmp) };
208*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu2_cf = {
209*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_cf) };
210*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_usecs_gnu2_nf = {
211*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_GNU_verdef, usecs_gnu2_nf) };
212*9273SAli.Bahrami@Sun.COM 
213*9273SAli.Bahrami@Sun.COM 
214*9273SAli.Bahrami@Sun.COM 	/* sparc processor range */
215*9273SAli.Bahrami@Sun.COM 	static const Msg sparc_def[] = { MSG_SHT_SPARC_GOTDATA };
216*9273SAli.Bahrami@Sun.COM 	static const Msg sparc_dmp[] = { MSG_SHT_SPARC_GOTDATA_DMP };
217*9273SAli.Bahrami@Sun.COM 	static const Msg sparc_cf[] = { MSG_SHT_SPARC_GOTDATA_CF };
218*9273SAli.Bahrami@Sun.COM 	static const Msg sparc_nf[] = { MSG_SHT_SPARC_GOTDATA_NF };
219*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_sparc_def = {
220*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_def) };
221*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_sparc_dmp = {
222*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_dmp) };
223*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_sparc_cf = {
224*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_cf) };
225*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_sparc_nf = {
226*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_SPARC_GOTDATA, sparc_nf) };
227*9273SAli.Bahrami@Sun.COM 
228*9273SAli.Bahrami@Sun.COM 	/* amd64 processor range */
229*9273SAli.Bahrami@Sun.COM 	static const Msg amd64_def[] = { MSG_SHT_AMD64_UNWIND };
230*9273SAli.Bahrami@Sun.COM 	static const Msg amd64_dmp[] = { MSG_SHT_AMD64_UNWIND_DMP };
231*9273SAli.Bahrami@Sun.COM 	static const Msg amd64_cf[] = { MSG_SHT_AMD64_UNWIND_CF };
232*9273SAli.Bahrami@Sun.COM 	static const Msg amd64_nf[] = { MSG_SHT_AMD64_UNWIND_NF };
233*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_amd64_def = {
234*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_def) };
235*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_amd64_dmp = {
236*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_dmp) };
237*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_amd64_cf = {
238*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_cf) };
239*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_amd64_nf = {
240*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHT_AMD64_UNWIND, amd64_nf) };
241*9273SAli.Bahrami@Sun.COM 
242*9273SAli.Bahrami@Sun.COM 
243*9273SAli.Bahrami@Sun.COM 	static const conv_ds_t	*retarr[MAX_RET];
244*9273SAli.Bahrami@Sun.COM 	int			retndx = 0;
245*9273SAli.Bahrami@Sun.COM 
246*9273SAli.Bahrami@Sun.COM 	/* Select the strings to use, based on string style and OSABI */
247*9273SAli.Bahrami@Sun.COM 	switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
248*9273SAli.Bahrami@Sun.COM 	case CONV_FMT_ALT_DUMP:
249*9273SAli.Bahrami@Sun.COM 		retarr[retndx++] = CONV_DS_ADDR(ds_secs_dmp);
250*9273SAli.Bahrami@Sun.COM 		break;
251*9273SAli.Bahrami@Sun.COM 	case CONV_FMT_ALT_CF:
252*9273SAli.Bahrami@Sun.COM 		retarr[retndx++] = CONV_DS_ADDR(ds_secs_cf);
253*9273SAli.Bahrami@Sun.COM 		break;
254*9273SAli.Bahrami@Sun.COM 	case CONV_FMT_ALT_NF:
255*9273SAli.Bahrami@Sun.COM 		retarr[retndx++] = CONV_DS_ADDR(ds_secs_nf);
256*9273SAli.Bahrami@Sun.COM 		break;
257*9273SAli.Bahrami@Sun.COM 	default:
258*9273SAli.Bahrami@Sun.COM 		retarr[retndx++] = CONV_DS_ADDR(ds_secs_def);
259*9273SAli.Bahrami@Sun.COM 		break;
260*9273SAli.Bahrami@Sun.COM 	}
261*9273SAli.Bahrami@Sun.COM 
262*9273SAli.Bahrami@Sun.COM 	if ((osabi == ELFOSABI_NONE) || (osabi == ELFOSABI_SOLARIS) ||
263*9273SAli.Bahrami@Sun.COM 	    (osabi == CONV_OSABI_ALL)) {
2645088Sab196087 		switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
2655088Sab196087 		case CONV_FMT_ALT_DUMP:
266*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_dmp);
267*9273SAli.Bahrami@Sun.COM 			break;
268*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_CF:
269*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_cf);
270*9273SAli.Bahrami@Sun.COM 			break;
271*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_NF:
272*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_nf);
273*9273SAli.Bahrami@Sun.COM 			break;
2745088Sab196087 		default:
275*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_def);
276*9273SAli.Bahrami@Sun.COM 			break;
2771976Sab196087 		}
2781976Sab196087 	}
2791976Sab196087 
280*9273SAli.Bahrami@Sun.COM 	if ((osabi == ELFOSABI_LINUX) || (osabi == CONV_OSABI_ALL)) {
281*9273SAli.Bahrami@Sun.COM 		switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
282*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_DUMP:
283*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_dmp);
284*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_dmp);
285*9273SAli.Bahrami@Sun.COM 			break;
286*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_CF:
287*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_cf);
288*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_cf);
289*9273SAli.Bahrami@Sun.COM 			break;
290*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_NF:
291*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_nf);
292*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_nf);
293*9273SAli.Bahrami@Sun.COM 			break;
294*9273SAli.Bahrami@Sun.COM 		default:
295*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu1_def);
296*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_usecs_gnu2_def);
297*9273SAli.Bahrami@Sun.COM 			break;
298*9273SAli.Bahrami@Sun.COM 		}
299*9273SAli.Bahrami@Sun.COM 	}
300*9273SAli.Bahrami@Sun.COM 
301*9273SAli.Bahrami@Sun.COM 	if ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
302*9273SAli.Bahrami@Sun.COM 	    (mach == EM_SPARCV9) || (mach == CONV_MACH_ALL)) {
303*9273SAli.Bahrami@Sun.COM 		switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
304*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_DUMP:
305*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_sparc_dmp);
306*9273SAli.Bahrami@Sun.COM 			break;
307*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_CF:
308*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_sparc_cf);
309*9273SAli.Bahrami@Sun.COM 			break;
310*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_NF:
311*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_sparc_nf);
312*9273SAli.Bahrami@Sun.COM 			break;
313*9273SAli.Bahrami@Sun.COM 		default:
314*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_sparc_def);
315*9273SAli.Bahrami@Sun.COM 			break;
316*9273SAli.Bahrami@Sun.COM 		}
317*9273SAli.Bahrami@Sun.COM 	}
318*9273SAli.Bahrami@Sun.COM 
319*9273SAli.Bahrami@Sun.COM 	if ((mach == EM_AMD64) || (mach == CONV_MACH_ALL)) {
320*9273SAli.Bahrami@Sun.COM 		switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
321*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_DUMP:
322*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_amd64_dmp);
323*9273SAli.Bahrami@Sun.COM 			break;
324*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_CF:
325*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_amd64_cf);
326*9273SAli.Bahrami@Sun.COM 			break;
327*9273SAli.Bahrami@Sun.COM 		case CONV_FMT_ALT_NF:
328*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_amd64_nf);
329*9273SAli.Bahrami@Sun.COM 			break;
330*9273SAli.Bahrami@Sun.COM 		default:
331*9273SAli.Bahrami@Sun.COM 			retarr[retndx++] = CONV_DS_ADDR(ds_amd64_def);
332*9273SAli.Bahrami@Sun.COM 			break;
333*9273SAli.Bahrami@Sun.COM 		}
334*9273SAli.Bahrami@Sun.COM 	}
335*9273SAli.Bahrami@Sun.COM 
336*9273SAli.Bahrami@Sun.COM 	retarr[retndx++] = NULL;
337*9273SAli.Bahrami@Sun.COM 	assert(retndx <= MAX_RET);
338*9273SAli.Bahrami@Sun.COM 	return (retarr);
339*9273SAli.Bahrami@Sun.COM 
340*9273SAli.Bahrami@Sun.COM #undef MAX_RET
341*9273SAli.Bahrami@Sun.COM }
342*9273SAli.Bahrami@Sun.COM 
343*9273SAli.Bahrami@Sun.COM const char *
344*9273SAli.Bahrami@Sun.COM conv_sec_type(uchar_t osabi, Half mach, Word sec, Conv_fmt_flags_t fmt_flags,
345*9273SAli.Bahrami@Sun.COM     Conv_inv_buf_t *inv_buf)
346*9273SAli.Bahrami@Sun.COM {
347*9273SAli.Bahrami@Sun.COM 	return (conv_map_ds(osabi, mach, sec,
348*9273SAli.Bahrami@Sun.COM 	    sec_type_strings(osabi, mach, fmt_flags), fmt_flags, inv_buf));
3490Sstevel@tonic-gate }
3500Sstevel@tonic-gate 
351*9273SAli.Bahrami@Sun.COM conv_iter_ret_t
352*9273SAli.Bahrami@Sun.COM conv_iter_sec_type(conv_iter_osabi_t osabi, Half mach,
353*9273SAli.Bahrami@Sun.COM     Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
354*9273SAli.Bahrami@Sun.COM {
355*9273SAli.Bahrami@Sun.COM 	return (conv_iter_ds(osabi, mach,
356*9273SAli.Bahrami@Sun.COM 	    sec_type_strings(osabi, mach, fmt_flags), func, uvalue));
357*9273SAli.Bahrami@Sun.COM }
358*9273SAli.Bahrami@Sun.COM 
3594734Sab196087 
3604734Sab196087 /*
361*9273SAli.Bahrami@Sun.COM  * Special iteration routine that returns strings for all symbol table
362*9273SAli.Bahrami@Sun.COM  * sections.
3634734Sab196087  */
364*9273SAli.Bahrami@Sun.COM conv_iter_ret_t
365*9273SAli.Bahrami@Sun.COM conv_iter_sec_symtab(conv_iter_osabi_t osabi, Conv_fmt_flags_t fmt_flags,
366*9273SAli.Bahrami@Sun.COM     conv_iter_cb_t func, void *uvalue)
367*9273SAli.Bahrami@Sun.COM {
368*9273SAli.Bahrami@Sun.COM 	static const Val_desc2 symtab_cf[] = {
369*9273SAli.Bahrami@Sun.COM 		{ SHT_SYMTAB,	0, 0,	MSG_SHT_SYMTAB_CF },
370*9273SAli.Bahrami@Sun.COM 		{ SHT_DYNSYM,	0, 0,	MSG_SHT_DYNSYM_CF },
371*9273SAli.Bahrami@Sun.COM 		{ SHT_SUNW_LDYNSYM, ELFOSABI_SOLARIS, 0,
372*9273SAli.Bahrami@Sun.COM 					MSG_SHT_SUNW_LDYNSYM_CF },
373*9273SAli.Bahrami@Sun.COM 
374*9273SAli.Bahrami@Sun.COM 		{ 0 }
375*9273SAli.Bahrami@Sun.COM 	};
376*9273SAli.Bahrami@Sun.COM 	static const Val_desc2 symtab_nf[] = {
377*9273SAli.Bahrami@Sun.COM 		{ SHT_SYMTAB,	0, 0,	MSG_SHT_SYMTAB_NF },
378*9273SAli.Bahrami@Sun.COM 		{ SHT_DYNSYM,	0, 0,	MSG_SHT_DYNSYM_NF },
379*9273SAli.Bahrami@Sun.COM 		{ SHT_SUNW_LDYNSYM, ELFOSABI_SOLARIS, 0,
380*9273SAli.Bahrami@Sun.COM 					MSG_SHT_SUNW_LDYNSYM_NF },
381*9273SAli.Bahrami@Sun.COM 
382*9273SAli.Bahrami@Sun.COM 		{ 0 }
383*9273SAli.Bahrami@Sun.COM 	};
384*9273SAli.Bahrami@Sun.COM 
385*9273SAli.Bahrami@Sun.COM 	const Val_desc2 *vdp;
386*9273SAli.Bahrami@Sun.COM 
387*9273SAli.Bahrami@Sun.COM 	vdp = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
388*9273SAli.Bahrami@Sun.COM 	    symtab_nf : symtab_cf;
389*9273SAli.Bahrami@Sun.COM 
390*9273SAli.Bahrami@Sun.COM 	return (conv_iter_vd2(osabi, EM_NONE, vdp, func, uvalue));
391*9273SAli.Bahrami@Sun.COM }
392*9273SAli.Bahrami@Sun.COM 
393*9273SAli.Bahrami@Sun.COM 
394*9273SAli.Bahrami@Sun.COM const Val_desc2 *
395*9273SAli.Bahrami@Sun.COM conv_sec_flags_strings(Conv_fmt_flags_t fmt_flags)
396*9273SAli.Bahrami@Sun.COM {
397*9273SAli.Bahrami@Sun.COM #define	FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
398*9273SAli.Bahrami@Sun.COM 	MSG_SHF_WRITE_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
399*9273SAli.Bahrami@Sun.COM 	MSG_SHF_ALLOC_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
400*9273SAli.Bahrami@Sun.COM 	MSG_SHF_EXECINSTR_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
401*9273SAli.Bahrami@Sun.COM 	MSG_SHF_MERGE_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
402*9273SAli.Bahrami@Sun.COM 	MSG_SHF_STRINGS_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
403*9273SAli.Bahrami@Sun.COM 	MSG_SHF_INFO_LINK_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
404*9273SAli.Bahrami@Sun.COM 	MSG_SHF_LINK_ORDER_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
405*9273SAli.Bahrami@Sun.COM 	MSG_SHF_OS_NONCONFORMING_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
406*9273SAli.Bahrami@Sun.COM 	MSG_SHF_GROUP_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
407*9273SAli.Bahrami@Sun.COM 	MSG_SHF_TLS_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
408*9273SAli.Bahrami@Sun.COM 	MSG_SHF_EXCLUDE_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
409*9273SAli.Bahrami@Sun.COM 	MSG_SHF_ORDERED_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
410*9273SAli.Bahrami@Sun.COM 	MSG_SHF_AMD64_LARGE_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
411*9273SAli.Bahrami@Sun.COM 	CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
412*9273SAli.Bahrami@Sun.COM 
413*9273SAli.Bahrami@Sun.COM 	/*
414*9273SAli.Bahrami@Sun.COM 	 * Ensure that Conv_sec_flags_buf_t is large enough:
415*9273SAli.Bahrami@Sun.COM 	 *
416*9273SAli.Bahrami@Sun.COM 	 * FLAGSZ is the real minimum size of the buffer required by
417*9273SAli.Bahrami@Sun.COM 	 * conv_sec_flags(). However, Conv_sec_flags_buf_t uses
418*9273SAli.Bahrami@Sun.COM 	 * CONV_SEC_FLAGS_BUFSIZE to set the buffer size. We do things this
419*9273SAli.Bahrami@Sun.COM 	 * way because the definition of FLAGSZ uses information that is not
420*9273SAli.Bahrami@Sun.COM 	 * available in the environment of other programs that include the
421*9273SAli.Bahrami@Sun.COM 	 * conv.h header file.
422*9273SAli.Bahrami@Sun.COM 	 */
4235152Sab196087 #if (CONV_SEC_FLAGS_BUFSIZE != FLAGSZ) && !defined(__lint)
4245152Sab196087 #define	REPORT_BUFSIZE FLAGSZ
4255152Sab196087 #include "report_bufsize.h"
4265152Sab196087 #error "CONV_SEC_FLAGS_BUFSIZE does not match FLAGSZ"
4274734Sab196087 #endif
4280Sstevel@tonic-gate 
429*9273SAli.Bahrami@Sun.COM #define	ALL	ELFOSABI_NONE, EM_NONE
430*9273SAli.Bahrami@Sun.COM #define	SOL	ELFOSABI_SOLARIS, EM_NONE
431*9273SAli.Bahrami@Sun.COM #define	AMD	ELFOSABI_NONE, EM_AMD64
432*9273SAli.Bahrami@Sun.COM 
433*9273SAli.Bahrami@Sun.COM 	static const Val_desc2 vda_cf[] = {
434*9273SAli.Bahrami@Sun.COM 		{ SHF_WRITE,		ALL,	MSG_SHF_WRITE_CF },
435*9273SAli.Bahrami@Sun.COM 		{ SHF_ALLOC,		ALL,	MSG_SHF_ALLOC_CF },
436*9273SAli.Bahrami@Sun.COM 		{ SHF_EXECINSTR,	ALL,	MSG_SHF_EXECINSTR_CF },
437*9273SAli.Bahrami@Sun.COM 		{ SHF_MERGE,		ALL,	MSG_SHF_MERGE_CF },
438*9273SAli.Bahrami@Sun.COM 		{ SHF_STRINGS,		ALL,	MSG_SHF_STRINGS_CF },
439*9273SAli.Bahrami@Sun.COM 		{ SHF_INFO_LINK,	ALL,	MSG_SHF_INFO_LINK_CF },
440*9273SAli.Bahrami@Sun.COM 		{ SHF_LINK_ORDER,	ALL,	MSG_SHF_LINK_ORDER_CF },
441*9273SAli.Bahrami@Sun.COM 		{ SHF_OS_NONCONFORMING,	ALL,	MSG_SHF_OS_NONCONFORMING_CF },
442*9273SAli.Bahrami@Sun.COM 		{ SHF_GROUP,		ALL,	MSG_SHF_GROUP_CF },
443*9273SAli.Bahrami@Sun.COM 		{ SHF_TLS,		ALL,	MSG_SHF_TLS_CF },
444*9273SAli.Bahrami@Sun.COM 		{ SHF_EXCLUDE,		SOL,	MSG_SHF_EXCLUDE_CF },
445*9273SAli.Bahrami@Sun.COM 		{ SHF_ORDERED,		SOL,	MSG_SHF_ORDERED_CF },
446*9273SAli.Bahrami@Sun.COM 		{ SHF_AMD64_LARGE,	AMD,	MSG_SHF_AMD64_LARGE_CF },
447*9273SAli.Bahrami@Sun.COM 		{ 0,			0 }
448*9273SAli.Bahrami@Sun.COM 	};
449*9273SAli.Bahrami@Sun.COM 	static const Val_desc2 vda_nf[] = {
450*9273SAli.Bahrami@Sun.COM 		{ SHF_WRITE,		ALL,	MSG_SHF_WRITE_NF },
451*9273SAli.Bahrami@Sun.COM 		{ SHF_ALLOC,		ALL,	MSG_SHF_ALLOC_NF },
452*9273SAli.Bahrami@Sun.COM 		{ SHF_EXECINSTR,	ALL,	MSG_SHF_EXECINSTR_NF },
453*9273SAli.Bahrami@Sun.COM 		{ SHF_MERGE,		ALL,	MSG_SHF_MERGE_NF },
454*9273SAli.Bahrami@Sun.COM 		{ SHF_STRINGS,		ALL,	MSG_SHF_STRINGS_NF },
455*9273SAli.Bahrami@Sun.COM 		{ SHF_INFO_LINK,	ALL,	MSG_SHF_INFO_LINK_NF },
456*9273SAli.Bahrami@Sun.COM 		{ SHF_LINK_ORDER,	ALL,	MSG_SHF_LINK_ORDER_NF },
457*9273SAli.Bahrami@Sun.COM 		{ SHF_OS_NONCONFORMING,	ALL,	MSG_SHF_OS_NONCONFORMING_NF },
458*9273SAli.Bahrami@Sun.COM 		{ SHF_GROUP,		ALL,	MSG_SHF_GROUP_NF },
459*9273SAli.Bahrami@Sun.COM 		{ SHF_TLS,		ALL,	MSG_SHF_TLS_NF },
460*9273SAli.Bahrami@Sun.COM 		{ SHF_EXCLUDE,		SOL,	MSG_SHF_EXCLUDE_NF },
461*9273SAli.Bahrami@Sun.COM 		{ SHF_ORDERED,		SOL,	MSG_SHF_ORDERED_NF },
462*9273SAli.Bahrami@Sun.COM 		{ SHF_AMD64_LARGE,	AMD,	MSG_SHF_AMD64_LARGE_NF },
4631618Srie 		{ 0,			0 }
4641618Srie 	};
4650Sstevel@tonic-gate 
466*9273SAli.Bahrami@Sun.COM 	return ((CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
467*9273SAli.Bahrami@Sun.COM 	    vda_nf : vda_cf);
4680Sstevel@tonic-gate 
469*9273SAli.Bahrami@Sun.COM #undef ALL
470*9273SAli.Bahrami@Sun.COM #undef SOL
471*9273SAli.Bahrami@Sun.COM #undef AMD
4720Sstevel@tonic-gate }
4730Sstevel@tonic-gate 
474*9273SAli.Bahrami@Sun.COM conv_iter_ret_t
475*9273SAli.Bahrami@Sun.COM conv_iter_sec_flags(conv_iter_osabi_t osabi, Half mach,
476*9273SAli.Bahrami@Sun.COM     Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func, void *uvalue)
4770Sstevel@tonic-gate {
478*9273SAli.Bahrami@Sun.COM 	static const Msg amd64_alias_cf[] = { MSG_SHF_X86_64_LARGE_CF };
479*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_msg_amd64_alias_cf = {
480*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHF_X86_64_LARGE, amd64_alias_cf) };
481*9273SAli.Bahrami@Sun.COM 	static const conv_ds_t	*ds_amd64_alias_cf[] = {
482*9273SAli.Bahrami@Sun.COM 	    CONV_DS_ADDR(ds_msg_amd64_alias_cf), NULL };
483*9273SAli.Bahrami@Sun.COM 
484*9273SAli.Bahrami@Sun.COM 	static const Msg amd64_alias_nf[] = { MSG_SHF_X86_64_LARGE_NF };
485*9273SAli.Bahrami@Sun.COM 	static const conv_ds_msg_t ds_msg_amd64_alias_nf = {
486*9273SAli.Bahrami@Sun.COM 	    CONV_DS_MSG_INIT(SHF_X86_64_LARGE, amd64_alias_nf) };
487*9273SAli.Bahrami@Sun.COM 	static const conv_ds_t	*ds_amd64_alias_nf[] = {
488*9273SAli.Bahrami@Sun.COM 	    CONV_DS_ADDR(ds_msg_amd64_alias_nf), NULL };
489*9273SAli.Bahrami@Sun.COM 
490*9273SAli.Bahrami@Sun.COM 
491*9273SAli.Bahrami@Sun.COM 	if (conv_iter_vd2(osabi, mach, conv_sec_flags_strings(fmt_flags),
492*9273SAli.Bahrami@Sun.COM 	    func, uvalue) == CONV_ITER_DONE)
493*9273SAli.Bahrami@Sun.COM 		return (CONV_ITER_DONE);
494*9273SAli.Bahrami@Sun.COM 
495*9273SAli.Bahrami@Sun.COM 	/* SHF_AMD64_LARGE is also known as SHF_X86_64_LARGE */
496*9273SAli.Bahrami@Sun.COM 	if (mach == EM_AMD64) {
497*9273SAli.Bahrami@Sun.COM 		const conv_ds_t **ds;
498*9273SAli.Bahrami@Sun.COM 
499*9273SAli.Bahrami@Sun.COM 		ds = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_NF) ?
500*9273SAli.Bahrami@Sun.COM 		    ds_amd64_alias_nf : ds_amd64_alias_cf;
501*9273SAli.Bahrami@Sun.COM 
502*9273SAli.Bahrami@Sun.COM 		return (conv_iter_ds(ELFOSABI_NONE, mach, ds, func, uvalue));
5030Sstevel@tonic-gate 	}
5044734Sab196087 
505*9273SAli.Bahrami@Sun.COM 	return (CONV_ITER_CONT);
5060Sstevel@tonic-gate }
507