dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sgs / liblddbg / common / unused.c
blob2dd0190b7ddccdb5f6ea2f8aa40a8e1fa9318c80
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 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #include "msg.h"
28 #include "_debug.h"
29 #include "libld.h"
31 void
32 Dbg_unused_unref(Rt_map *lmp, const char *depend)
34 if (DBG_NOTCLASS(DBG_C_UNUSED))
35 return;
36 if (DBG_NOTDETAIL())
37 return;
39 dbg_print(LIST(lmp), MSG_INTL(MSG_USD_UNREF), NAME(lmp), depend);
42 void
43 Dbg_unused_sec(Lm_list *lml, Is_desc *isp)
45 dbg_isec_name_buf_t buf;
46 char *alloc_mem;
47 const char *str;
49 if (DBG_NOTCLASS(DBG_C_UNUSED))
50 return;
51 if (DBG_NOTDETAIL())
52 return;
55 * If the file from which this section originates hasn't been referenced
56 * at all, skip this diagnostic, as it would have been covered under
57 * Dbg_unused_file() called from ignore_section_processing().
59 if (isp->is_file &&
60 ((isp->is_file->ifl_flags & FLG_IF_FILEREF) == 0))
61 return;
63 if (isp->is_flags & FLG_IS_DISCARD)
64 str = MSG_INTL(MSG_USD_SECDISCARD);
65 else
66 str = MSG_ORIG(MSG_STR_EMPTY);
68 dbg_print(lml, MSG_INTL(MSG_USD_SEC),
69 dbg_fmt_isec_name(isp, buf, &alloc_mem),
70 EC_XWORD(isp->is_shdr->sh_size), isp->is_file->ifl_name, str);
71 free(alloc_mem);
74 void
75 Dbg_unused_file(Lm_list *lml, const char *name, int needstr, uint_t cycle)
77 if (DBG_NOTCLASS(DBG_C_UNUSED))
78 return;
80 if (needstr)
81 dbg_print(lml, MSG_INTL(MSG_USD_NEEDSTR), name);
82 else if (cycle)
83 dbg_print(lml, MSG_INTL(MSG_USD_FILECYCLIC), name, cycle);
84 else
85 dbg_print(lml, MSG_INTL(MSG_USD_FILE), name);
88 void
89 Dbg_unused_path(Lm_list *lml, const char *path, uint_t orig, uint_t dup,
90 const char *obj)
92 const char *fmt;
94 if (DBG_NOTCLASS(DBG_C_UNUSED))
95 return;
96 if (DBG_NOTDETAIL())
97 return;
99 if (orig & LA_SER_LIBPATH) {
100 if (orig & LA_SER_CONFIG) {
101 if (dup)
102 fmt = MSG_INTL(MSG_DUP_LDLIBPATHC);
103 else
104 fmt = MSG_INTL(MSG_USD_LDLIBPATHC);
105 } else {
106 if (dup)
107 fmt = MSG_INTL(MSG_DUP_LDLIBPATH);
108 else
109 fmt = MSG_INTL(MSG_USD_LDLIBPATH);
111 } else if (orig & LA_SER_RUNPATH) {
112 fmt = MSG_INTL(MSG_USD_RUNPATH);
113 } else
114 return;
116 dbg_print(lml, fmt, path, obj);