summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-06-06 12:31:53 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-06-06 12:31:53 +0000
commit27fd28e2de00240bb1f30de8b4281f39643669b7 (patch)
treef5912ec0ad6b9df52bc22f3e0728ecb351e49cef /libexec
parentf0123640136c82f7c2e1d11266a0bc337b98da96 (diff)
Replace all 'if (_dl_debug) _dl_printf(...)' with a macro.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/dlfcn.c7
-rw-r--r--libexec/ld.so/loader.c23
-rw-r--r--libexec/ld.so/resolve.h4
3 files changed, 14 insertions, 20 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c
index ed7bd8fa71e..c9c743e0a63 100644
--- a/libexec/ld.so/dlfcn.c
+++ b/libexec/ld.so/dlfcn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dlfcn.c,v 1.4 2001/06/06 12:26:05 art Exp $ */
+/* $OpenBSD: dlfcn.c,v 1.5 2001/06/06 12:31:52 art Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -57,9 +57,8 @@ dlopen(const char *libname, int how)
elf_object_t *dynobj;
Elf_Dyn *dynp;
- if (_dl_debug) {
- _dl_printf("loading: %s\n", libname);
- }
+ DL_DEB(("loading: %s\n", libname));
+
object = _dl_load_shlib(libname, _dl_objects, OBJTYPE_DLO);
if(object == 0) {
return((void *)0);
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index adb1385795d..be7958efb29 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.15 2001/06/06 12:23:18 art Exp $ */
+/* $OpenBSD: loader.c,v 1.16 2001/06/06 12:31:52 art Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -83,8 +83,7 @@ _dl_debug_state(void)
void
_dl_run_dtors(elf_object_t *object)
{
- if (_dl_debug)
- _dl_printf("doing dtors: [%s]\n", object->load_name);
+ DL_DEB(("doing dtors: [%s]\n", object->load_name));
if (object->dyn.fini) {
(*object->dyn.fini)();
}
@@ -96,8 +95,7 @@ _dl_run_dtors(elf_object_t *object)
void
_dl_dtors(void)
{
- if(_dl_debug)
- _dl_printf("doing dtors\n");
+ DL_DEB(("doing dtors\n"));
if (_dl_objects->next) {
_dl_run_dtors(_dl_objects->next);
}
@@ -141,8 +139,7 @@ _dl_boot(const char **argv, const char **envp, const long loff,
} else {
_dl_pagesz = 4096;
}
- if (_dl_debug)
- _dl_printf("rtld loading: '%s'\n", _dl_progname);
+ DL_DEB(("rtld loading: '%s'\n", _dl_progname));
/*
* Don't allow someone to change the search paths if he runs
@@ -185,8 +182,7 @@ _dl_boot(const char **argv, const char **envp, const long loff,
dynobj = _dl_objects;
while (dynobj) {
- if (_dl_debug)
- _dl_printf("examining: '%s'\n", dynobj->load_name);
+ DL_DEB(("examining: '%s'\n", dynobj->load_name));
for (dynp = dynobj->load_dyn; dynp->d_tag; dynp++) {
const char *libname;
@@ -194,8 +190,7 @@ _dl_boot(const char **argv, const char **envp, const long loff,
continue;
libname = dynobj->dyn.strtab;
libname += dynp->d_un.d_val;
- if (_dl_debug)
- _dl_printf("needs: '%s'\n", libname);
+ DL_DEB(("needs: '%s'\n", libname));
if (_dl_load_shlib(libname, dynobj, OBJTYPE_LIB) == 0) {
_dl_printf("%s: can't load library '%s'\n",
_dl_progname, libname);
@@ -293,8 +288,7 @@ _dl_boot(const char **argv, const char **envp, const long loff,
if (_dl_debug || _dl_traceld) {
void _dl_show_objects(); /* remove -Wall warning */
_dl_show_objects();
- if (_dl_debug)
- _dl_printf("dynamic loading done.\n");
+ DL_DEB(("dynamic loading done.\n"));
}
_dl_unmaphints();
if (_dl_traceld) {
@@ -560,8 +554,7 @@ _dl_call_init(elf_object_t *object)
sym = 0;
ooff = _dl_find_symbol(".init", object, &sym, 1, 1);
if (sym) {
- if (_dl_debug)
- _dl_printf("calling .init in '%s'\n",object->load_name);
+ DL_DEB(("calling .init in '%s'\n",object->load_name));
(*(void(*)(void))(sym->st_value + ooff))();
}
#if 0 /*XXX*/
diff --git a/libexec/ld.so/resolve.h b/libexec/ld.so/resolve.h
index cebfb60ae3b..5a2fab71d26 100644
--- a/libexec/ld.so/resolve.h
+++ b/libexec/ld.so/resolve.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolve.h,v 1.4 2001/05/16 03:21:23 deraadt Exp $ */
+/* $OpenBSD: resolve.h,v 1.5 2001/06/06 12:31:52 art Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -158,6 +158,8 @@ extern char *_dl_bindnow;
extern char *_dl_traceld;
extern char *_dl_debug;
+#define DL_DEB(P) do { if (_dl_debug) _dl_printf P ; } while (0)
+
#define DL_NOT_FOUND 1
#define DL_CANT_OPEN 2
#define DL_NOT_ELF 3