17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
55aefb655Srie * Common Development and Distribution License (the "License").
65aefb655Srie * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
215aefb655Srie
227c478bd9Sstevel@tonic-gate /*
23*2020b2b6SRod Evans * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate */
257c478bd9Sstevel@tonic-gate #include "msg.h"
267c478bd9Sstevel@tonic-gate #include "_debug.h"
277c478bd9Sstevel@tonic-gate #include "libld.h"
287c478bd9Sstevel@tonic-gate
295aefb655Srie void
Dbg_libs_audit(Lm_list * lml,const char * opath,const char * npath)305aefb655Srie Dbg_libs_audit(Lm_list *lml, const char *opath, const char *npath)
315aefb655Srie {
32*2020b2b6SRod Evans if (DBG_NOTCLASS(DBG_C_LIBS))
335aefb655Srie return;
345aefb655Srie
355aefb655Srie if (npath == opath)
365aefb655Srie return;
37*2020b2b6SRod Evans
38*2020b2b6SRod Evans if (npath == NULL)
395aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_SKIP), opath);
405aefb655Srie else
415aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_ALTER), npath);
425aefb655Srie }
435aefb655Srie
445aefb655Srie void
Dbg_libs_find(Lm_list * lml,const char * name)455aefb655Srie Dbg_libs_find(Lm_list *lml, const char *name)
465aefb655Srie {
475aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
485aefb655Srie return;
495aefb655Srie
505aefb655Srie Dbg_util_nl(lml, DBG_NL_STD);
515aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_FIND), name);
525aefb655Srie }
535aefb655Srie
545aefb655Srie void
Dbg_libs_found(Lm_list * lml,const char * path,int alter)555aefb655Srie Dbg_libs_found(Lm_list *lml, const char *path, int alter)
565aefb655Srie {
575aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
585aefb655Srie return;
595aefb655Srie
605aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_TRYING), path, alter ?
615aefb655Srie MSG_INTL(MSG_STR_ALTER) : MSG_ORIG(MSG_STR_EMPTY));
625aefb655Srie }
635aefb655Srie
645aefb655Srie void
Dbg_libs_insecure(Lm_list * lml,const char * path,int usable)653dbfc803SRod Evans Dbg_libs_insecure(Lm_list *lml, const char *path, int usable)
665aefb655Srie {
675aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
685aefb655Srie return;
695aefb655Srie
703dbfc803SRod Evans if (usable)
713dbfc803SRod Evans dbg_print(lml, MSG_INTL(MSG_LIB_INUSE), path);
723dbfc803SRod Evans else
733dbfc803SRod Evans dbg_print(lml, MSG_INTL(MSG_LIB_IGNORE), path);
745aefb655Srie }
755aefb655Srie
767c478bd9Sstevel@tonic-gate static void
Dbg_lib_dir_print(Lm_list * lml,APlist * libdir)7757ef7aa9SRod Evans Dbg_lib_dir_print(Lm_list *lml, APlist *libdir)
787c478bd9Sstevel@tonic-gate {
7957ef7aa9SRod Evans Aliste idx;
8057ef7aa9SRod Evans char *cp;
817c478bd9Sstevel@tonic-gate
8257ef7aa9SRod Evans for (APLIST_TRAVERSE(libdir, idx, cp))
835aefb655Srie dbg_print(lml, MSG_ORIG(MSG_LIB_FILE), cp);
847c478bd9Sstevel@tonic-gate }
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate void
Dbg_libs_init(Lm_list * lml,APlist * ulibdir,APlist * dlibdir)8757ef7aa9SRod Evans Dbg_libs_init(Lm_list *lml, APlist *ulibdir, APlist *dlibdir)
887c478bd9Sstevel@tonic-gate {
895aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
907c478bd9Sstevel@tonic-gate return;
917c478bd9Sstevel@tonic-gate
925aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_INITPATH));
935aefb655Srie Dbg_lib_dir_print(lml, ulibdir);
945aefb655Srie Dbg_lib_dir_print(lml, dlibdir);
957c478bd9Sstevel@tonic-gate }
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate void
Dbg_libs_l(Lm_list * lml,const char * name,const char * path)985aefb655Srie Dbg_libs_l(Lm_list *lml, const char *name, const char *path)
997c478bd9Sstevel@tonic-gate {
1005aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
1017c478bd9Sstevel@tonic-gate return;
1027c478bd9Sstevel@tonic-gate if (DBG_NOTDETAIL())
1037c478bd9Sstevel@tonic-gate return;
1047c478bd9Sstevel@tonic-gate
1055aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_LOPT), name, path);
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gate void
Dbg_libs_path(Lm_list * lml,const char * path,uint_t orig,const char * obj)1099aa23310Srie Dbg_libs_path(Lm_list *lml, const char *path, uint_t orig, const char *obj)
1107c478bd9Sstevel@tonic-gate {
1117c478bd9Sstevel@tonic-gate const char *fmt;
112ba7962c0SRod Evans uint_t search;
1137c478bd9Sstevel@tonic-gate
114ba7962c0SRod Evans if (path == NULL)
1157c478bd9Sstevel@tonic-gate return;
1165aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
1177c478bd9Sstevel@tonic-gate return;
1187c478bd9Sstevel@tonic-gate
119ba7962c0SRod Evans search = orig &
120ba7962c0SRod Evans (LA_SER_LIBPATH | LA_SER_RUNPATH | LA_SER_DEFAULT | LA_SER_SECURE);
121ba7962c0SRod Evans
122ba7962c0SRod Evans switch (search) {
123ba7962c0SRod Evans case LA_SER_LIBPATH:
1247c478bd9Sstevel@tonic-gate if (orig & LA_SER_CONFIG)
1257c478bd9Sstevel@tonic-gate fmt = MSG_INTL(MSG_LIB_LDLIBPATHC);
1267c478bd9Sstevel@tonic-gate else
1277c478bd9Sstevel@tonic-gate fmt = MSG_INTL(MSG_LIB_LDLIBPATH);
128ba7962c0SRod Evans break;
129ba7962c0SRod Evans
130ba7962c0SRod Evans case LA_SER_RUNPATH:
1311d1fba8aSrie fmt = MSG_INTL(MSG_LIB_RUNPATH);
132ba7962c0SRod Evans break;
133ba7962c0SRod Evans
134ba7962c0SRod Evans case LA_SER_DEFAULT:
1357c478bd9Sstevel@tonic-gate if (orig & LA_SER_CONFIG)
1367c478bd9Sstevel@tonic-gate fmt = MSG_INTL(MSG_LIB_DEFAULTC);
1377c478bd9Sstevel@tonic-gate else
1387c478bd9Sstevel@tonic-gate fmt = MSG_INTL(MSG_LIB_DEFAULT);
139ba7962c0SRod Evans break;
140ba7962c0SRod Evans
141ba7962c0SRod Evans case LA_SER_SECURE:
142ba7962c0SRod Evans if (orig & LA_SER_CONFIG)
143ba7962c0SRod Evans fmt = MSG_INTL(MSG_LIB_TDEFAULTC);
144ba7962c0SRod Evans else
145ba7962c0SRod Evans fmt = MSG_INTL(MSG_LIB_TDEFAULT);
146ba7962c0SRod Evans break;
147ba7962c0SRod Evans
148ba7962c0SRod Evans default:
149ba7962c0SRod Evans return;
1507c478bd9Sstevel@tonic-gate }
151ba7962c0SRod Evans
1525aefb655Srie dbg_print(lml, fmt, path, obj);
1537c478bd9Sstevel@tonic-gate }
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gate void
Dbg_libs_req(Lm_list * lml,const char * so_name,const char * ref_file,const char * name)1565aefb655Srie Dbg_libs_req(Lm_list *lml, const char *so_name, const char *ref_file,
1575aefb655Srie const char *name)
1587c478bd9Sstevel@tonic-gate {
1595aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
1607c478bd9Sstevel@tonic-gate return;
1617c478bd9Sstevel@tonic-gate if (DBG_NOTDETAIL())
1627c478bd9Sstevel@tonic-gate return;
1637c478bd9Sstevel@tonic-gate
1645aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_REQUIRED), so_name, name, ref_file);
1657c478bd9Sstevel@tonic-gate }
1667c478bd9Sstevel@tonic-gate
1677c478bd9Sstevel@tonic-gate void
Dbg_libs_update(Lm_list * lml,APlist * ulibdir,APlist * dlibdir)16857ef7aa9SRod Evans Dbg_libs_update(Lm_list *lml, APlist *ulibdir, APlist *dlibdir)
1697c478bd9Sstevel@tonic-gate {
1705aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
1717c478bd9Sstevel@tonic-gate return;
1727c478bd9Sstevel@tonic-gate
1735aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_UPPATH));
1745aefb655Srie Dbg_lib_dir_print(lml, ulibdir);
1755aefb655Srie Dbg_lib_dir_print(lml, dlibdir);
1767c478bd9Sstevel@tonic-gate }
1777c478bd9Sstevel@tonic-gate
1787c478bd9Sstevel@tonic-gate void
Dbg_libs_yp(Lm_list * lml,const char * path)1795aefb655Srie Dbg_libs_yp(Lm_list *lml, const char *path)
1807c478bd9Sstevel@tonic-gate {
1815aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
1827c478bd9Sstevel@tonic-gate return;
1837c478bd9Sstevel@tonic-gate
1845aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_LIBPATH), path);
1857c478bd9Sstevel@tonic-gate }
1867c478bd9Sstevel@tonic-gate
1877c478bd9Sstevel@tonic-gate void
Dbg_libs_ylu(Lm_list * lml,const char * path,const char * orig,int index)1885aefb655Srie Dbg_libs_ylu(Lm_list *lml, const char *path, const char *orig, int index)
1897c478bd9Sstevel@tonic-gate {
1905aefb655Srie if (DBG_NOTCLASS(DBG_C_LIBS))
1917c478bd9Sstevel@tonic-gate return;
1927c478bd9Sstevel@tonic-gate
1935aefb655Srie dbg_print(lml, MSG_INTL(MSG_LIB_YPATH), path, orig,
1945aefb655Srie (index == YLDIR) ? 'L' : 'U');
1957c478bd9Sstevel@tonic-gate }
196