dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sgs / liblddbg / common / libs.c
blob4407701626b188f2063e18ebe077fb55fbcda75b
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 (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
25 #include "msg.h"
26 #include "_debug.h"
27 #include "libld.h"
29 void
30 Dbg_libs_audit(Lm_list *lml, const char *opath, const char *npath)
32 if (DBG_NOTCLASS(DBG_C_LIBS))
33 return;
35 if (npath == opath)
36 return;
38 if (npath == NULL)
39 dbg_print(lml, MSG_INTL(MSG_LIB_SKIP), opath);
40 else
41 dbg_print(lml, MSG_INTL(MSG_LIB_ALTER), npath);
44 void
45 Dbg_libs_find(Lm_list *lml, const char *name)
47 if (DBG_NOTCLASS(DBG_C_LIBS))
48 return;
50 Dbg_util_nl(lml, DBG_NL_STD);
51 dbg_print(lml, MSG_INTL(MSG_LIB_FIND), name);
54 void
55 Dbg_libs_found(Lm_list *lml, const char *path, int alter)
57 if (DBG_NOTCLASS(DBG_C_LIBS))
58 return;
60 dbg_print(lml, MSG_INTL(MSG_LIB_TRYING), path, alter ?
61 MSG_INTL(MSG_STR_ALTER) : MSG_ORIG(MSG_STR_EMPTY));
64 void
65 Dbg_libs_insecure(Lm_list *lml, const char *path, int usable)
67 if (DBG_NOTCLASS(DBG_C_LIBS))
68 return;
70 if (usable)
71 dbg_print(lml, MSG_INTL(MSG_LIB_INUSE), path);
72 else
73 dbg_print(lml, MSG_INTL(MSG_LIB_IGNORE), path);
76 static void
77 Dbg_lib_dir_print(Lm_list *lml, APlist *libdir)
79 Aliste idx;
80 char *cp;
82 for (APLIST_TRAVERSE(libdir, idx, cp))
83 dbg_print(lml, MSG_ORIG(MSG_LIB_FILE), cp);
86 void
87 Dbg_libs_init(Lm_list *lml, APlist *ulibdir, APlist *dlibdir)
89 if (DBG_NOTCLASS(DBG_C_LIBS))
90 return;
92 dbg_print(lml, MSG_INTL(MSG_LIB_INITPATH));
93 Dbg_lib_dir_print(lml, ulibdir);
94 Dbg_lib_dir_print(lml, dlibdir);
97 void
98 Dbg_libs_l(Lm_list *lml, const char *name, const char *path)
100 if (DBG_NOTCLASS(DBG_C_LIBS))
101 return;
102 if (DBG_NOTDETAIL())
103 return;
105 dbg_print(lml, MSG_INTL(MSG_LIB_LOPT), name, path);
108 void
109 Dbg_libs_path(Lm_list *lml, const char *path, uint_t orig, const char *obj)
111 const char *fmt;
112 uint_t search;
114 if (path == NULL)
115 return;
116 if (DBG_NOTCLASS(DBG_C_LIBS))
117 return;
119 search = orig &
120 (LA_SER_LIBPATH | LA_SER_RUNPATH | LA_SER_DEFAULT | LA_SER_SECURE);
122 switch (search) {
123 case LA_SER_LIBPATH:
124 if (orig & LA_SER_CONFIG)
125 fmt = MSG_INTL(MSG_LIB_LDLIBPATHC);
126 else
127 fmt = MSG_INTL(MSG_LIB_LDLIBPATH);
128 break;
130 case LA_SER_RUNPATH:
131 fmt = MSG_INTL(MSG_LIB_RUNPATH);
132 break;
134 case LA_SER_DEFAULT:
135 if (orig & LA_SER_CONFIG)
136 fmt = MSG_INTL(MSG_LIB_DEFAULTC);
137 else
138 fmt = MSG_INTL(MSG_LIB_DEFAULT);
139 break;
141 case LA_SER_SECURE:
142 if (orig & LA_SER_CONFIG)
143 fmt = MSG_INTL(MSG_LIB_TDEFAULTC);
144 else
145 fmt = MSG_INTL(MSG_LIB_TDEFAULT);
146 break;
148 default:
149 return;
152 dbg_print(lml, fmt, path, obj);
155 void
156 Dbg_libs_req(Lm_list *lml, const char *so_name, const char *ref_file,
157 const char *name)
159 if (DBG_NOTCLASS(DBG_C_LIBS))
160 return;
161 if (DBG_NOTDETAIL())
162 return;
164 dbg_print(lml, MSG_INTL(MSG_LIB_REQUIRED), so_name, name, ref_file);
167 void
168 Dbg_libs_update(Lm_list *lml, APlist *ulibdir, APlist *dlibdir)
170 if (DBG_NOTCLASS(DBG_C_LIBS))
171 return;
173 dbg_print(lml, MSG_INTL(MSG_LIB_UPPATH));
174 Dbg_lib_dir_print(lml, ulibdir);
175 Dbg_lib_dir_print(lml, dlibdir);
178 void
179 Dbg_libs_yp(Lm_list *lml, const char *path)
181 if (DBG_NOTCLASS(DBG_C_LIBS))
182 return;
184 dbg_print(lml, MSG_INTL(MSG_LIB_LIBPATH), path);
187 void
188 Dbg_libs_ylu(Lm_list *lml, const char *path, const char *orig, int index)
190 if (DBG_NOTCLASS(DBG_C_LIBS))
191 return;
193 dbg_print(lml, MSG_INTL(MSG_LIB_YPATH), path, orig,
194 (index == YLDIR) ? 'L' : 'U');