dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sgs / liblddbg / common / version.c
blob830adc93cca02f4eac8c44b72ee6d780a8d79a51
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #include <stdio.h>
28 #include <debug.h>
29 #include "msg.h"
30 #include "_debug.h"
32 void
33 Dbg_ver_avail_title(Lm_list *lml, const char *file)
35 if (DBG_NOTCLASS(DBG_C_VERSIONS))
36 return;
38 Dbg_util_nl(lml, DBG_NL_STD);
39 dbg_print(lml, MSG_INTL(MSG_VER_AVAIL_1), file);
40 dbg_print(lml, MSG_INTL(MSG_VER_AVAIL_2));
43 void
44 Dbg_ver_def_title(Lm_list *lml, const char *file)
46 if (DBG_NOTCLASS(DBG_C_VERSIONS))
47 return;
49 Dbg_util_nl(lml, DBG_NL_STD);
50 dbg_print(lml, MSG_INTL(MSG_VER_DEF_TITLE), file);
51 Elf_ver_def_title(lml);
54 void
55 Dbg_ver_need_title(Lm_list *lml, const char *file)
57 if (DBG_NOTCLASS(DBG_C_VERSIONS))
58 return;
60 Dbg_util_nl(lml, DBG_NL_STD);
61 dbg_print(lml, MSG_INTL(MSG_VER_NEED_TITLE), file);
62 Elf_ver_need_title(lml, 0);
65 void
66 Dbg_ver_need_entry(Lm_list *lml, Half cnt, const char *file,
67 const char *version)
69 if (DBG_NOTCLASS(DBG_C_VERSIONS))
70 return;
72 if (cnt)
73 Elf_ver_line_4(lml, version);
74 else
75 Elf_ver_line_5(lml, file, version);
78 void
79 Dbg_ver_symbol(Lm_list *lml, const char *name)
81 static Boolean ver_symbol_title = TRUE;
83 if (DBG_NOTCLASS(DBG_C_VERSIONS | DBG_C_SYMBOLS))
84 return;
86 if (DBG_NOTCLASS(DBG_C_VERSIONS))
87 if (ver_symbol_title) {
88 ver_symbol_title = FALSE;
89 Dbg_util_nl(lml, DBG_NL_STD);
90 dbg_print(lml, MSG_INTL(MSG_SYM_VERSION));
93 Dbg_syms_created(lml, name);
97 * This function doesn't test for any specific debugging category, thus it will
98 * be generated for any debugging family.
100 void
101 Dbg_ver_nointerface(Lm_list *lml, const char *name)
103 Dbg_util_nl(lml, DBG_NL_STD);
104 dbg_print(lml, MSG_INTL(MSG_VER_NOINTERFACE), name);
105 Dbg_util_nl(lml, DBG_NL_STD);
108 void
109 Dbg_ver_desc_entry(Lm_list *lml, Ver_desc *vdp)
111 Conv_ver_flags_buf_t ver_flags_buf;
112 const char *dep;
113 Ver_desc *_vdp, *__vdp;
114 Aliste idx;
115 char index[10];
117 if (DBG_NOTCLASS(DBG_C_VERSIONS))
118 return;
120 if (vdp->vd_deps) {
121 _vdp = (Ver_desc *)vdp->vd_deps->apl_data[0];
122 dep = _vdp->vd_name;
123 } else {
124 _vdp = 0;
125 dep = MSG_ORIG(MSG_STR_EMPTY);
127 (void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), vdp->vd_ndx);
128 Elf_ver_line_1(lml, index, vdp->vd_name, dep,
129 conv_ver_flags(vdp->vd_flags, 0, &ver_flags_buf));
132 * Loop through the dependency list in case there are more that one
133 * dependency.
135 for (APLIST_TRAVERSE(vdp->vd_deps, idx, __vdp)) {
136 if (_vdp == __vdp)
137 continue;
138 Elf_ver_line_4(lml, __vdp->vd_name);
142 void
143 Dbg_ver_avail_entry(Lm_list *lml, Ver_index *vip, const char *select)
145 if (DBG_NOTCLASS(DBG_C_VERSIONS))
146 return;
148 if (select) {
149 if (DBG_NOTLONG())
150 dbg_print(lml, MSG_ORIG(MSG_VER_SELECTED),
151 vip->vi_name, select);
152 else
153 dbg_print(lml, MSG_ORIG(MSG_VER_L_SELECTED),
154 vip->vi_name, select);
155 } else {
156 if (DBG_NOTLONG())
157 dbg_print(lml, MSG_ORIG(MSG_VER_ALL), vip->vi_name);
158 else
159 dbg_print(lml, MSG_ORIG(MSG_VER_L_ALL), vip->vi_name);
163 void
164 Elf_ver_def_title(Lm_list *lml)
166 dbg_print(lml, MSG_INTL(MSG_VER_DEF));
170 * entry:
171 * gnuver - If True (non-zero), the version rules used by the
172 * GNU ld are assumed. If False (0), Solaris ld rules apply.
174 void
175 Elf_ver_need_title(Lm_list *lml, int gnuver)
177 if (gnuver)
178 dbg_print(lml, MSG_INTL(MSG_VER_NEED_GNUVER));
179 else
180 dbg_print(lml, MSG_INTL(MSG_VER_NEED));
183 void
184 Elf_ver_line_1(Lm_list *lml, const char *index, const char *name,
185 const char *dep, const char *flags)
187 if (DBG_NOTLONG())
188 dbg_print(lml, MSG_INTL(MSG_VER_LINE_1), index, name,
189 dep, flags);
190 else
191 dbg_print(lml, MSG_INTL(MSG_VER_LLINE_1), index, name,
192 dep, flags);
195 void
196 Elf_ver_line_2(Lm_list *lml, const char *name, const char *dep)
198 dbg_print(lml, MSG_INTL(MSG_VER_LINE_2), name, dep);
201 void
202 Elf_ver_line_3(Lm_list *lml, const char *name, const char *dep,
203 const char *flags)
205 dbg_print(lml, MSG_INTL(MSG_VER_LINE_3), name, dep, flags);
208 void
209 Elf_ver_line_4(Lm_list *lml, const char *version)
211 dbg_print(lml, MSG_INTL(MSG_VER_LINE_4), version);
214 void
215 Elf_ver_line_5(Lm_list *lml, const char *file, const char *version)
217 if (DBG_NOTLONG())
218 dbg_print(lml, MSG_INTL(MSG_VER_LINE_5), file, version);
219 else
220 dbg_print(lml, MSG_INTL(MSG_VER_LLINE_5), file, version);
224 * Called after final call to Dbg_ver_need() to inject final newline.
226 void
227 Dbg_ver_need_done(Lm_list *lml)
229 if (DBG_NOTCLASS(DBG_C_VERSIONS))
230 return;
232 Dbg_util_nl(lml, DBG_NL_STD);