xref: /titanic_41/usr/src/cmd/sgs/libconv/common/llib-lconv (revision 269552cd714f2f1e308fdde0fc69b18a7f1142b2)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26/* LINTLIBRARY */
27/* PROTOLIB1 */
28
29#include	<stdlib.h>
30#include	<libelf.h>
31#include	<_machelf.h>
32#include	<sgs.h>
33#include	<libld.h>
34#include	<conv.h>
35
36/*
37 * Define all generic interfaces.
38 */
39uchar_t		conv_check_native(char **, char **);
40const char      *conv_config_feat(int, Conv_config_feat_buf_t *);
41const char	*conv_config_obj(ushort_t, Conv_config_obj_buf_t *);
42const char	*conv_config_upm(const char *, const char *, const char *,
43		    size_t);
44const char	*conv_def_tag(Symref, Conv_inv_buf_t *);
45const char	*conv_demangle_name(const char *);
46const char	*conv_dl_flag(int, int, Conv_dl_flag_buf_t *);
47const char	*conv_dl_mode(int, int, Conv_dl_mode_buf_t *);
48const char	*conv_dwarf_ehe(uint_t, Conv_dwarf_ehe_buf_t *);
49const char	*conv_elfdata_type(Elf_Type, Conv_inv_buf_t *);
50int		conv_expn_field(CONV_EXPN_FIELD_ARG *, Conv_fmt_flags_t);
51const char	*conv_grphdl_flags(uint_t, Conv_grphdl_flags_buf_t *);
52const char	*conv_grpdesc_flags(uint_t, Conv_grpdesc_flags_buf_t *);
53Isa_desc	*conv_isalist(void);
54const char	*conv_lddstub(int);
55const char	*conv_seg_flags(Half, Conv_seg_flags_buf_t *);
56int		conv_sys_eclass(void);
57Uts_desc	*conv_uts(void);
58const char	*conv_ver_flags(Half, Conv_fmt_flags_t, Conv_ver_flags_buf_t *);
59const char	*conv_ver_index(Versym, int, Conv_inv_buf_t *);
60
61
62/*
63 * Define all class specific routines.
64 */
65const char	*conv32_bnd_obj(uint_t, Conv32_bnd_obj_buf_t *);
66const char	*conv64_bnd_obj(uint_t, Conv64_bnd_obj_buf_t *);
67const char	*conv32_bnd_type(uint_t, Conv32_bnd_type_buf_t *);
68const char	*conv64_bnd_type(uint_t, Conv64_bnd_type_buf_t *);
69const char	*conv32_cap_tag(Elf32_Word, Conv32_inv_buf_t *);
70const char	*conv64_cap_tag(Elf64_Xword, Conv64_inv_buf_t *);
71const char	*conv32_cap_val(Elf32_Word, Elf32_Word, Half,
72		    Conv32_cap_val_buf_t *);
73const char	*conv64_cap_val(Elf64_Xword, Elf64_Xword, Half,
74		    Conv64_cap_val_buf_t *);
75const char	*conv32_cap_val_hw1(Elf32_Word, Half, Conv_fmt_flags_t,
76		    Conv32_cap_val_hw1_buf_t *);
77const char	*conv64_cap_val_hw1(Elf64_Xword, Half, Conv_fmt_flags_t,
78		    Conv64_cap_val_hw1_buf_t *);
79const char	*conv32_cap_val_sf1(Elf32_Word, Half, Conv_fmt_flags_t,
80		    Conv32_cap_val_sf1_buf_t *);
81const char	*conv64_cap_val_sf1(Elf64_Xword, Half, Conv_fmt_flags_t,
82		    Conv64_cap_val_sf1_buf_t *);
83const char	*conv32_dyn_flag1(Elf32_Word, Conv_fmt_flags_t,
84		    Conv32_dyn_flag1_buf_t *);
85const char	*conv64_dyn_flag1(Elf64_Xword, Conv_fmt_flags_t,
86		    Conv64_dyn_flag1_buf_t *);
87const char	*conv32_dyn_flag(Elf32_Word, int, Conv32_dyn_flag_buf_t *);
88const char	*conv64_dyn_flag(Elf64_Xword, int, Conv64_dyn_flag_buf_t *);
89const char	*conv32_dyn_posflag1(Elf32_Word, int,
90		    Conv32_dyn_posflag1_buf_t *);
91const char	*conv64_dyn_posflag1(Elf64_Xword, int,
92		    Conv64_dyn_posflag1_buf_t *);
93const char	*conv32_dyn_tag(Elf32_Word, Elf32_Half, int,
94		    Conv32_inv_buf_t *);
95const char	*conv64_dyn_tag(Elf64_Xword, Elf64_Half, int,
96		    Conv64_inv_buf_t *);
97const char	*conv32_dyn_feature1(Elf32_Word, int,
98		    Conv32_dyn_feature1_buf_t *);
99const char	*conv64_dyn_feature1(Elf64_Xword, int,
100		    Conv64_dyn_feature1_buf_t *);
101const char	*conv32_ehdr_class(uchar_t, int, Conv32_inv_buf_t *);
102const char	*conv64_ehdr_class(uchar_t, int, Conv64_inv_buf_t *);
103const char	*conv32_ehdr_data(uchar_t, int, Conv32_inv_buf_t *);
104const char	*conv64_ehdr_data(uchar_t, int, Conv64_inv_buf_t *);
105const char	*conv32_ehdr_flags(Elf32_Half, Elf32_Word, Conv_fmt_flags_t,
106		    Conv32_ehdr_flags_buf_t *);
107const char	*conv64_ehdr_flags(Elf64_Half, Elf64_Word, Conv_fmt_flags_t,
108		    Conv64_ehdr_flags_buf_t *);
109const char	*conv32_ehdr_mach(Elf32_Half, int, Conv32_inv_buf_t *);
110const char	*conv64_ehdr_mach(Elf64_Half, int, Conv64_inv_buf_t *);
111const char	*conv32_ehdr_type(Elf32_Half, int, Conv32_inv_buf_t *);
112const char	*conv64_ehdr_type(Elf64_Half, int, Conv64_inv_buf_t *);
113const char	*conv32_ehdr_vers(Elf32_Word, int, Conv32_inv_buf_t *);
114const char	*conv64_ehdr_vers(Elf64_Word, int, Conv64_inv_buf_t *);
115const char	*conv32_invalid_val(Conv32_inv_buf_t *, Elf32_Word, int);
116const char	*conv64_invalid_val(Conv64_inv_buf_t *, Elf64_Xword, int);
117const char	*conv32_phdr_flags(Word,  Conv_fmt_flags_t,
118		    Conv32_phdr_flags_buf_t *);
119const char	*conv64_phdr_flags(Word,  Conv_fmt_flags_t,
120		    Conv64_phdr_flags_buf_t *);
121const char	*conv32_phdr_type(Elf32_Half, Word, int, Conv32_inv_buf_t *);
122const char	*conv64_phdr_type(Elf64_Half, Word, int, Conv64_inv_buf_t *);
123const char	*conv32_reject_desc(Rej_desc *, Conv32_reject_desc_buf_t *,
124		    Elf32_Half);
125const char	*conv64_reject_desc(Rej_desc *, Conv64_reject_desc_buf_t *,
126		    Elf64_Half);
127const char	*conv32_reloc_type(Half, Word, int, Conv32_inv_buf_t *);
128const char	*conv64_reloc_type(Half, Word, int, Conv64_inv_buf_t *);
129const char	*conv32_reloc_type_static(Half, Word, int);
130const char	*conv64_reloc_type_static(Half, Word, int);
131const char	*conv32_reloc_386_type(Word, int, Conv32_inv_buf_t *);
132const char	*conv64_reloc_386_type(Word, int, Conv64_inv_buf_t *);
133const char	*conv32_reloc_amd64_type(Word, int, Conv32_inv_buf_t *);
134const char	*conv64_reloc_amd64_type(Word, int, Conv64_inv_buf_t *);
135const char	*conv32_reloc_SPARC_type(Word, int, Conv32_inv_buf_t *);
136const char	*conv64_reloc_SPARC_type(Word, int, Conv64_inv_buf_t *);
137const char	*conv32_sec_flags(Elf32_Word, Conv_fmt_flags_t,
138		    Conv32_sec_flags_buf_t *);
139const char	*conv64_sec_flags(Elf64_Xword, Conv_fmt_flags_t,
140		    Conv64_sec_flags_buf_t *);
141const char	*conv32_sec_linkinfo(Elf32_Word, Elf32_Word,
142		    Conv32_inv_buf_t *);
143const char	*conv64_sec_linkinfo(Elf64_Word, Elf64_Xword,
144		    Conv64_inv_buf_t *);
145const char	*conv32_sec_type(Elf32_Half, Elf32_Word, int,
146		    Conv32_inv_buf_t *);
147const char	*conv64_sec_type(Elf64_Half, Elf64_Word, int,
148		    Conv64_inv_buf_t *);
149const char	*conv32_sym_info_bind(uchar_t, int, Conv32_inv_buf_t *);
150const char	*conv64_sym_info_bind(uchar_t, int, Conv64_inv_buf_t *);
151const char	*conv32_sym_info_type(Elf32_Half, uchar_t, int,
152		    Conv32_inv_buf_t *);
153const char	*conv64_sym_info_type(Elf64_Half, uchar_t, int,
154		    Conv64_inv_buf_t *);
155const char	*conv32_sym_shndx(Elf32_Half, Conv32_inv_buf_t *);
156const char	*conv64_sym_shndx(Elf64_Half, Conv64_inv_buf_t *);
157const char	*conv32_sym_other(uchar_t, Conv32_inv_buf_t *);
158const char	*conv64_sym_other(uchar_t, Conv64_inv_buf_t *);
159const char	*conv32_sym_value(Elf32_Half, uchar_t, Elf32_Addr,
160		    Conv32_inv_buf_t *);
161const char	*conv64_sym_value(Elf64_Half, uchar_t, Elf64_Addr,
162		    Conv64_inv_buf_t *);
163const char	*conv32_sym_SPARC_value(Elf32_Addr, int, Conv32_inv_buf_t *);
164const char	*conv64_sym_SPARC_value(Elf64_Addr, int, Conv64_inv_buf_t *);
165