1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Replace _dl_debug_* variables with _dl_debug_mask.

This commit is contained in:
Ulrich Drepper
2001-02-27 09:34:31 +00:00
parent 4d8bbe6380
commit 62dcee574f
15 changed files with 65 additions and 72 deletions

View File

@ -69,7 +69,8 @@ _dl_close (void *_map)
if (map->l_opencount > 1 || map->l_type != lt_loaded) if (map->l_opencount > 1 || map->l_type != lt_loaded)
{ {
/* There are still references to this object. Do nothing more. */ /* There are still references to this object. Do nothing more. */
if (__builtin_expect (_dl_debug_files, 0)) if (//__builtin_expect (_dl_debug_files, 0))
__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
{ {
char buf[20]; char buf[20];
@ -133,7 +134,8 @@ _dl_close (void *_map)
&& imap->l_init_called) && imap->l_init_called)
{ {
/* When debugging print a message first. */ /* When debugging print a message first. */
if (__builtin_expect (_dl_debug_impcalls, 0)) if (//__builtin_expect (_dl_debug_impcalls, 0))
__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
_dl_debug_message (1, "\ncalling fini: ", imap->l_name, _dl_debug_message (1, "\ncalling fini: ", imap->l_name,
"\n\n", NULL); "\n\n", NULL);

View File

@ -1,5 +1,5 @@
/* Load the dependencies of a mapped object. /* Load the dependencies of a mapped object.
Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -120,7 +120,7 @@ empty dynamics string token substitution")); \
else \ else \
{ \ { \
/* This is for DT_AUXILIARY. */ \ /* This is for DT_AUXILIARY. */ \
if (__builtin_expect (_dl_debug_libs, 0)) \ if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) \
_dl_debug_message (1, "cannot load auxiliary `", __str, \ _dl_debug_message (1, "cannot load auxiliary `", __str, \
"' because of empty dynamic string" \ "' because of empty dynamic string" \
" token substitution\n", NULL); \ " token substitution\n", NULL); \
@ -293,7 +293,7 @@ _dl_map_object_deps (struct link_map *map,
if (d->d_tag == DT_AUXILIARY) if (d->d_tag == DT_AUXILIARY)
{ {
/* Say that we are about to load an auxiliary library. */ /* Say that we are about to load an auxiliary library. */
if (__builtin_expect (_dl_debug_libs, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
_dl_debug_message (1, "load auxiliary object=", _dl_debug_message (1, "load auxiliary object=",
name, " requested by file=", name, " requested by file=",
l->l_name[0] l->l_name[0]
@ -316,7 +316,7 @@ _dl_map_object_deps (struct link_map *map,
else else
{ {
/* Say that we are about to load an auxiliary library. */ /* Say that we are about to load an auxiliary library. */
if (__builtin_expect (_dl_debug_libs, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
_dl_debug_message (1, "load filtered object=", name, _dl_debug_message (1, "load filtered object=", name,
" requested by file=", " requested by file=",
l->l_name[0] l->l_name[0]

View File

@ -1,5 +1,5 @@
/* Call the termination functions of loaded shared objects. /* Call the termination functions of loaded shared objects.
Copyright (C) 1995,96,98,99,2000 Free Software Foundation, Inc. Copyright (C) 1995,96,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -146,7 +146,7 @@ _dl_fini (void)
continue; continue;
/* When debugging print a message first. */ /* When debugging print a message first. */
if (__builtin_expect (_dl_debug_impcalls, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
_dl_debug_message (1, "\ncalling fini: ", _dl_debug_message (1, "\ncalling fini: ",
l->l_name[0] ? l->l_name : _dl_argv[0], l->l_name[0] ? l->l_name : _dl_argv[0],
"\n\n", NULL); "\n\n", NULL);

View File

@ -53,7 +53,7 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
return; return;
/* Print a debug message if wanted. */ /* Print a debug message if wanted. */
if (__builtin_expect (_dl_debug_impcalls, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
_dl_debug_message (1, "\ncalling init: ", _dl_debug_message (1, "\ncalling init: ",
l->l_name[0] ? l->l_name : _dl_argv[0], "\n\n", NULL); l->l_name[0] ? l->l_name : _dl_argv[0], "\n\n", NULL);
@ -108,7 +108,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
ElfW(Addr) *addrs; ElfW(Addr) *addrs;
unsigned int cnt; unsigned int cnt;
if (__builtin_expect (_dl_debug_impcalls, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
_dl_debug_message (1, "\ncalling preinit: ", _dl_debug_message (1, "\ncalling preinit: ",
main_map->l_name[0] main_map->l_name[0]
? main_map->l_name : _dl_argv[0], "\n\n", NULL); ? main_map->l_name : _dl_argv[0], "\n\n", NULL);

View File

@ -801,7 +801,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
return NULL; return NULL;
/* Print debugging message. */ /* Print debugging message. */
if (__builtin_expect (_dl_debug_files, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
_dl_debug_message (1, "file=", name, "; generating link map\n", NULL); _dl_debug_message (1, "file=", name, "; generating link map\n", NULL);
/* This is the ELF header. We read it in `open_verify'. */ /* This is the ELF header. We read it in `open_verify'. */
@ -1059,7 +1059,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
l->l_entry += l->l_addr; l->l_entry += l->l_addr;
if (__builtin_expect (_dl_debug_files, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
{ {
const size_t nibbles = sizeof (void *) * 2; const size_t nibbles = sizeof (void *) * 2;
char buf1[nibbles + 1]; char buf1[nibbles + 1];
@ -1351,7 +1351,7 @@ open_path (const char *name, size_t namelen, int preloaded,
/* If we are debugging the search for libraries print the path /* If we are debugging the search for libraries print the path
now if it hasn't happened now. */ now if it hasn't happened now. */
if (__builtin_expect (_dl_debug_libs, 0) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)
&& current_what != this_dir->what) && current_what != this_dir->what)
{ {
current_what = this_dir->what; current_what = this_dir->what;
@ -1372,7 +1372,7 @@ open_path (const char *name, size_t namelen, int preloaded,
- buf); - buf);
/* Print name we try if this is wanted. */ /* Print name we try if this is wanted. */
if (__builtin_expect (_dl_debug_libs, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
_dl_debug_message (1, " trying file=", buf, "\n", NULL); _dl_debug_message (1, " trying file=", buf, "\n", NULL);
fd = open_verify (buf, fbp); fd = open_verify (buf, fbp);
@ -1506,7 +1506,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
} }
/* Display information if we are debugging. */ /* Display information if we are debugging. */
if (__builtin_expect (_dl_debug_files, 0) && loader != NULL) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0) && loader != NULL)
_dl_debug_message (1, "\nfile=", name, "; needed by ", _dl_debug_message (1, "\nfile=", name, "; needed by ",
loader->l_name[0] ? loader->l_name : _dl_argv[0], loader->l_name[0] ? loader->l_name : _dl_argv[0],
"\n", NULL); "\n", NULL);
@ -1517,7 +1517,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
size_t namelen = strlen (name) + 1; size_t namelen = strlen (name) + 1;
if (__builtin_expect (_dl_debug_libs, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
_dl_debug_message (1, "find library=", name, "; searching\n", NULL); _dl_debug_message (1, "find library=", name, "; searching\n", NULL);
fd = -1; fd = -1;
@ -1654,7 +1654,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
&realname, &fb); &realname, &fb);
/* Add another newline when we a tracing the library loading. */ /* Add another newline when we a tracing the library loading. */
if (__builtin_expect (_dl_debug_libs, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
_dl_debug_message (1, "\n", NULL); _dl_debug_message (1, "\n", NULL);
} }
else else

View File

@ -1,5 +1,5 @@
/* Look up a symbol in the loaded objects. /* Look up a symbol in the loaded objects.
Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc. Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -161,7 +161,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
++map->l_opencount; ++map->l_opencount;
/* Display information if we are debugging. */ /* Display information if we are debugging. */
if (__builtin_expect (_dl_debug_files, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
_dl_debug_message (1, "\nfile=", _dl_debug_message (1, "\nfile=",
map->l_name[0] ? map->l_name : _dl_argv[0], map->l_name[0] ? map->l_name : _dl_argv[0],
"; needed by ", "; needed by ",
@ -242,7 +242,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
if (__builtin_expect (_dl_debug_bindings, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
_dl_debug_message (1, "binding file ", _dl_debug_message (1, "binding file ",
(reference_name && reference_name[0] (reference_name && reference_name[0]
? reference_name ? reference_name
@ -321,7 +321,7 @@ _dl_lookup_symbol_skip (const char *undef_name,
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
if (__builtin_expect (_dl_debug_bindings, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
_dl_debug_message (1, "binding file ", _dl_debug_message (1, "binding file ",
(reference_name && reference_name[0] (reference_name && reference_name[0]
? reference_name ? reference_name
@ -449,7 +449,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
if (__builtin_expect (_dl_debug_bindings, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
_dl_debug_message (1, "binding file ", _dl_debug_message (1, "binding file ",
(reference_name && reference_name[0] (reference_name && reference_name[0]
? reference_name ? reference_name
@ -540,7 +540,7 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
if (__builtin_expect (_dl_debug_bindings, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
_dl_debug_message (1, "binding file ", _dl_debug_message (1, "binding file ",
(reference_name && reference_name[0] (reference_name && reference_name[0]
? reference_name ? reference_name

View File

@ -242,7 +242,7 @@ dl_open_worker (void *a)
if (new->l_searchlist.r_list != NULL) if (new->l_searchlist.r_list != NULL)
{ {
/* Let the user know about the opencount. */ /* Let the user know about the opencount. */
if (__builtin_expect (_dl_debug_files, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
{ {
char buf[20]; char buf[20];
@ -342,7 +342,7 @@ dl_open_worker (void *a)
__libc_multiple_libcs = 1; __libc_multiple_libcs = 1;
/* Let the user know about the opencount. */ /* Let the user know about the opencount. */
if (__builtin_expect (_dl_debug_files, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
{ {
char buf[20]; char buf[20];

View File

@ -1,5 +1,5 @@
/* Relocate a shared object and resolve its references to other loaded objects. /* Relocate a shared object and resolve its references to other loaded objects.
Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc. Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -40,7 +40,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
&& __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0)) && __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0))
lazy = 0; lazy = 0;
if (__builtin_expect (_dl_debug_reloc, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_RELOC, 0))
_dl_debug_message (1, "\nrelocation processing: ", _dl_debug_message (1, "\nrelocation processing: ",
l->l_name[0] ? l->l_name : _dl_argv[0], l->l_name[0] ? l->l_name : _dl_argv[0],
lazy ? " (lazy)\n" : "\n", NULL); lazy ? " (lazy)\n" : "\n", NULL);

View File

@ -37,13 +37,7 @@ char **_dl_argv = &__progname; /* This is checked for some error messages. */
const char *_dl_platform; const char *_dl_platform;
size_t _dl_platformlen; size_t _dl_platformlen;
int _dl_debug_libs; int _dl_debug_mask;
int _dl_debug_impcalls;
int _dl_debug_bindings;
int _dl_debug_symbols;
int _dl_debug_versions;
int _dl_debug_reloc;
int _dl_debug_files;
int _dl_lazy; int _dl_lazy;
/* XXX I know about at least one case where we depend on the old weak /* XXX I know about at least one case where we depend on the old weak
behavior (it has to do with librt). Until we get DSO groups implemented behavior (it has to do with librt). Until we get DSO groups implemented

View File

@ -1,5 +1,5 @@
/* Handle symbol and library versioning. /* Handle symbol and library versioning.
Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -83,7 +83,7 @@ match_symbol (const char *name, ElfW(Word) hash, const char *string,
ElfW(Verdef) *def; ElfW(Verdef) *def;
/* Display information about what we are doing while debugging. */ /* Display information about what we are doing while debugging. */
if (__builtin_expect (_dl_debug_versions, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_VERSIONS, 0))
_dl_debug_message (1, "checking for version `", string, "' in file ", _dl_debug_message (1, "checking for version `", string, "' in file ",
map->l_name[0] ? map->l_name : _dl_argv[0], map->l_name[0] ? map->l_name : _dl_argv[0],
" required by file ", name, "\n", NULL); " required by file ", name, "\n", NULL);

View File

@ -1,5 +1,5 @@
/* Look up a symbol in the loaded objects. /* Look up a symbol in the loaded objects.
Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -60,7 +60,7 @@ FCT (const char *undef_name, unsigned long int hash, const ElfW(Sym) *ref,
continue; continue;
/* Print some debugging info if wanted. */ /* Print some debugging info if wanted. */
if (__builtin_expect (_dl_debug_symbols, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_SYMBOLS, 0))
_dl_debug_message (1, "symbol=", undef_name, "; lookup in file=", _dl_debug_message (1, "symbol=", undef_name, "; lookup in file=",
map->l_name[0] ? map->l_name : _dl_argv[0], map->l_name[0] ? map->l_name : _dl_argv[0],
"\n", NULL); "\n", NULL);

View File

@ -74,14 +74,7 @@ int _dl_dynamic_weak;
#else #else
int _dl_dynamic_weak = 1; int _dl_dynamic_weak = 1;
#endif #endif
int _dl_debug_libs; int _dl_debug_mask;
int _dl_debug_impcalls;
int _dl_debug_bindings;
int _dl_debug_symbols;
int _dl_debug_versions;
int _dl_debug_reloc;
int _dl_debug_files;
int _dl_debug_statistics;
const char *_dl_inhibit_rpath; /* RPATH values which should be const char *_dl_inhibit_rpath; /* RPATH values which should be
ignored. */ ignored. */
const char *_dl_origin_path; const char *_dl_origin_path;
@ -257,7 +250,8 @@ _dl_start_final (void *arg, struct link_map *bootstrap_map_p,
} }
#endif #endif
if (__builtin_expect (_dl_debug_statistics, 0)) if (//__builtin_expect (_dl_debug_statistics, 0))
__builtin_expect (_dl_debug_mask & DL_DEBUG_STATISTICS, 0))
print_statistics (); print_statistics ();
return *start_addr; return *start_addr;
@ -1197,13 +1191,10 @@ process_dl_debug (const char *dl_debug)
useful. */ useful. */
if (memcmp (dl_debug, "all", 3) == 0) if (memcmp (dl_debug, "all", 3) == 0)
{ {
_dl_debug_libs = 1; _dl_debug_mask = (DL_DEBUG_LIBS | DL_DEBUG_IMPCALLS
_dl_debug_impcalls = 1; | DL_DEBUG_RELOC | DL_DEBUG_FILES
_dl_debug_reloc = 1; | DL_DEBUG_SYMBOLS | DL_DEBUG_BINDINGS
_dl_debug_files = 1; | DL_DEBUG_VERSIONS);
_dl_debug_symbols = 1;
_dl_debug_bindings = 1;
_dl_debug_versions = 1;
any_debug = 1; any_debug = 1;
continue; continue;
} }
@ -1232,8 +1223,7 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
if (memcmp (dl_debug, "libs", 4) == 0) if (memcmp (dl_debug, "libs", 4) == 0)
{ {
_dl_debug_libs = 1; _dl_debug_mask |= DL_DEBUG_LIBS | DL_DEBUG_IMPCALLS;
_dl_debug_impcalls = 1;
any_debug = 1; any_debug = 1;
continue; continue;
} }
@ -1242,16 +1232,14 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
case 5: case 5:
if (memcmp (dl_debug, "reloc", 5) == 0) if (memcmp (dl_debug, "reloc", 5) == 0)
{ {
_dl_debug_reloc = 1; _dl_debug_mask |= DL_DEBUG_RELOC | DL_DEBUG_IMPCALLS;
_dl_debug_impcalls = 1;
any_debug = 1; any_debug = 1;
continue; continue;
} }
if (memcmp (dl_debug, "files", 5) == 0) if (memcmp (dl_debug, "files", 5) == 0)
{ {
_dl_debug_files = 1; _dl_debug_mask |= DL_DEBUG_FILES | DL_DEBUG_IMPCALLS;
_dl_debug_impcalls = 1;
any_debug = 1; any_debug = 1;
continue; continue;
} }
@ -1260,8 +1248,7 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
case 7: case 7:
if (memcmp (dl_debug, "symbols", 7) == 0) if (memcmp (dl_debug, "symbols", 7) == 0)
{ {
_dl_debug_symbols = 1; _dl_debug_mask |= DL_DEBUG_SYMBOLS | DL_DEBUG_IMPCALLS;
_dl_debug_impcalls = 1;
any_debug = 1; any_debug = 1;
continue; continue;
} }
@ -1270,16 +1257,14 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
case 8: case 8:
if (memcmp (dl_debug, "bindings", 8) == 0) if (memcmp (dl_debug, "bindings", 8) == 0)
{ {
_dl_debug_bindings = 1; _dl_debug_mask |= DL_DEBUG_BINDINGS | DL_DEBUG_IMPCALLS;
_dl_debug_impcalls = 1;
any_debug = 1; any_debug = 1;
continue; continue;
} }
if (memcmp (dl_debug, "versions", 8) == 0) if (memcmp (dl_debug, "versions", 8) == 0)
{ {
_dl_debug_versions = 1; _dl_debug_mask |= DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS;
_dl_debug_impcalls = 1;
any_debug = 1; any_debug = 1;
continue; continue;
} }
@ -1288,7 +1273,7 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
case 10: case 10:
if (memcmp (dl_debug, "statistics", 10) == 0) if (memcmp (dl_debug, "statistics", 10) == 0)
{ {
_dl_debug_statistics = 1; _dl_debug_mask |= DL_DEBUG_STATISTICS;
continue; continue;
} }
break; break;

View File

@ -1,5 +1,5 @@
/* Support for reading /etc/ld.so.cache files written by Linux ldconfig. /* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -154,7 +154,7 @@ _dl_load_cache_lookup (const char *name)
const char *best; const char *best;
/* Print a message if the loading of libs is traced. */ /* Print a message if the loading of libs is traced. */
if (_dl_debug_libs) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
_dl_debug_message (1, " search cache=", LD_SO_CACHE, "\n", NULL); _dl_debug_message (1, " search cache=", LD_SO_CACHE, "\n", NULL);
if (cache == NULL) if (cache == NULL)
@ -252,7 +252,7 @@ _dl_load_cache_lookup (const char *name)
} }
/* Print our result if wanted. */ /* Print our result if wanted. */
if (_dl_debug_libs && best != NULL) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0) && best != NULL)
_dl_debug_message (1, " trying file=", best, "\n", NULL); _dl_debug_message (1, " trying file=", best, "\n", NULL);
return best; return best;

View File

@ -184,6 +184,7 @@ extern struct link_map *_dl_profile_map;
extern const char *_dl_profile_output; extern const char *_dl_profile_output;
/* If nonzero the appropriate debug information is printed. */ /* If nonzero the appropriate debug information is printed. */
#if 0
extern int _dl_debug_libs; extern int _dl_debug_libs;
extern int _dl_debug_impcalls; extern int _dl_debug_impcalls;
extern int _dl_debug_bindings; extern int _dl_debug_bindings;
@ -191,6 +192,17 @@ extern int _dl_debug_symbols;
extern int _dl_debug_versions; extern int _dl_debug_versions;
extern int _dl_debug_reloc; extern int _dl_debug_reloc;
extern int _dl_debug_files; extern int _dl_debug_files;
#else
extern int _dl_debug_mask;
#define DL_DEBUG_LIBS (1 << 0)
#define DL_DEBUG_IMPCALLS (1 << 1)
#define DL_DEBUG_BINDINGS (1 << 2)
#define DL_DEBUG_SYMBOLS (1 << 3)
#define DL_DEBUG_VERSIONS (1 << 4)
#define DL_DEBUG_RELOC (1 << 5)
#define DL_DEBUG_FILES (1 << 6)
#define DL_DEBUG_STATISTICS (1 << 7)
#endif
/* Expect cache ID. */ /* Expect cache ID. */
extern int _dl_correct_cache_id; extern int _dl_correct_cache_id;

View File

@ -115,14 +115,14 @@ BP_SYM (__libc_start_main) (int (*main) (int, char **, char **),
/* Call the initializer of the program, if any. */ /* Call the initializer of the program, if any. */
#ifdef SHARED #ifdef SHARED
if (__builtin_expect (_dl_debug_impcalls, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
_dl_debug_message (1, "\ninitialize program: ", argv[0], "\n\n", NULL); _dl_debug_message (1, "\ninitialize program: ", argv[0], "\n\n", NULL);
#endif #endif
if (init) if (init)
(*init) (); (*init) ();
#ifdef SHARED #ifdef SHARED
if (__builtin_expect (_dl_debug_impcalls, 0)) if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
_dl_debug_message (1, "\ntransferring control: ", argv[0], "\n\n", NULL); _dl_debug_message (1, "\ntransferring control: ", argv[0], "\n\n", NULL);
#endif #endif