about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--elf/dl-close.c6
-rw-r--r--elf/dl-deps.c8
-rw-r--r--elf/dl-fini.c4
-rw-r--r--elf/dl-init.c4
-rw-r--r--elf/dl-load.c14
-rw-r--r--elf/dl-lookup.c12
-rw-r--r--elf/dl-open.c4
-rw-r--r--elf/dl-reloc.c4
-rw-r--r--elf/dl-support.c8
-rw-r--r--elf/dl-version.c4
-rw-r--r--elf/do-lookup.h4
-rw-r--r--elf/rtld.c43
-rw-r--r--sysdeps/generic/dl-cache.c6
-rw-r--r--sysdeps/generic/ldsodefs.h12
-rw-r--r--sysdeps/generic/libc-start.c4
15 files changed, 65 insertions, 72 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index df0572265d..723a9702fd 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -69,7 +69,8 @@ _dl_close (void *_map)
   if (map->l_opencount > 1 || map->l_type != lt_loaded)
     {
       /* 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];
 
@@ -133,7 +134,8 @@ _dl_close (void *_map)
 	  && imap->l_init_called)
 	{
 	  /* 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,
 			       "\n\n", NULL);
 
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index d7239819a2..7d0c1808e8 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -1,5 +1,5 @@
 /* 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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -120,7 +120,7 @@ empty dynamics string token substitution"));				      \
 	    else							      \
 	      {								      \
 		/* 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,     \
 				     "' because of empty dynamic string"      \
 				     " token substitution\n", NULL);	      \
@@ -293,7 +293,7 @@ _dl_map_object_deps (struct link_map *map,
 		if (d->d_tag == DT_AUXILIARY)
 		  {
 		    /* 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=",
 					 name, " requested by file=",
 					 l->l_name[0]
@@ -316,7 +316,7 @@ _dl_map_object_deps (struct link_map *map,
 		else
 		  {
 		    /* 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,
 					 " requested by file=",
 					 l->l_name[0]
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index 4ed3975bda..37b1f5238f 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -1,5 +1,5 @@
 /* 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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -146,7 +146,7 @@ _dl_fini (void)
 	    continue;
 
 	  /* 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: ",
 			       l->l_name[0] ? l->l_name : _dl_argv[0],
 			       "\n\n", NULL);
diff --git a/elf/dl-init.c b/elf/dl-init.c
index e77edbb1c7..502518728e 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -53,7 +53,7 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
     return;
 
   /* 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: ",
 		       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;
       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: ",
 			   main_map->l_name[0]
 			   ? main_map->l_name : _dl_argv[0], "\n\n", NULL);
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 157d827419..315ea41e26 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -801,7 +801,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
     return NULL;
 
   /* 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);
 
   /* 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;
 
-  if (__builtin_expect (_dl_debug_files, 0))
+  if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
     {
       const size_t nibbles = sizeof (void *) * 2;
       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
 	 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;
@@ -1372,7 +1372,7 @@ open_path (const char *name, size_t namelen, int preloaded,
 	     - buf);
 
 	  /* 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);
 
 	  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.  */
-  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 ",
 		       loader->l_name[0] ? loader->l_name : _dl_argv[0],
 		       "\n", NULL);
@@ -1517,7 +1517,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
 
       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);
 
       fd = -1;
@@ -1654,7 +1654,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
 			&realname, &fb);
 
       /* 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);
     }
   else
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 9e0a25da80..5ef9345287 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -1,5 +1,5 @@
 /* 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.
 
    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;
 
 	      /* 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=",
 				   map->l_name[0] ? map->l_name : _dl_argv[0],
 				   ";  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;
 
-  if (__builtin_expect (_dl_debug_bindings, 0))
+  if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
     _dl_debug_message (1, "binding file ",
 		       (reference_name && reference_name[0]
 			? reference_name
@@ -321,7 +321,7 @@ _dl_lookup_symbol_skip (const char *undef_name,
 
   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 ",
 		       (reference_name && reference_name[0]
 			? reference_name
@@ -449,7 +449,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
 
   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 ",
 		       (reference_name && reference_name[0]
 			? 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;
 
-  if (__builtin_expect (_dl_debug_bindings, 0))
+  if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
     _dl_debug_message (1, "binding file ",
 		       (reference_name && reference_name[0]
 			? reference_name
diff --git a/elf/dl-open.c b/elf/dl-open.c
index c02ecab26d..76276df080 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -242,7 +242,7 @@ dl_open_worker (void *a)
   if (new->l_searchlist.r_list != NULL)
     {
       /* 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];
 
@@ -342,7 +342,7 @@ dl_open_worker (void *a)
     __libc_multiple_libcs = 1;
 
   /* 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];
 
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 137cb0f91b..a82a1cb9e1 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -1,5 +1,5 @@
 /* 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.
 
    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))
     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: ",
 		       l->l_name[0] ? l->l_name : _dl_argv[0],
 		       lazy ? " (lazy)\n" : "\n", NULL);
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 24f598c856..8c10180e26 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -37,13 +37,7 @@ char **_dl_argv = &__progname;	/* This is checked for some error messages.  */
 const char *_dl_platform;
 size_t _dl_platformlen;
 
-int _dl_debug_libs;
-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_mask;
 int _dl_lazy;
 /* 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
diff --git a/elf/dl-version.c b/elf/dl-version.c
index fe54c7b00c..88bc4b6be8 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -1,5 +1,5 @@
 /* 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.
    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;
 
   /* 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 ",
 		       map->l_name[0] ? map->l_name : _dl_argv[0],
 		       " required by file ", name, "\n", NULL);
diff --git a/elf/do-lookup.h b/elf/do-lookup.h
index 932c385168..8f6c6c07eb 100644
--- a/elf/do-lookup.h
+++ b/elf/do-lookup.h
@@ -1,5 +1,5 @@
 /* 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.
 
    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;
 
       /* 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=",
 			   map->l_name[0] ? map->l_name : _dl_argv[0],
 			   "\n", NULL);
diff --git a/elf/rtld.c b/elf/rtld.c
index 1cefb5622a..b228d2d45a 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -74,14 +74,7 @@ int _dl_dynamic_weak;
 #else
 int _dl_dynamic_weak = 1;
 #endif
-int _dl_debug_libs;
-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;
+int _dl_debug_mask;
 const char *_dl_inhibit_rpath;		/* RPATH values which should be
 					   ignored.  */
 const char *_dl_origin_path;
@@ -257,7 +250,8 @@ _dl_start_final (void *arg, struct link_map *bootstrap_map_p,
     }
 #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 ();
 
   return *start_addr;
@@ -1197,13 +1191,10 @@ process_dl_debug (const char *dl_debug)
 		 useful.  */
 	      if (memcmp (dl_debug, "all", 3) == 0)
 		{
-		  _dl_debug_libs = 1;
-		  _dl_debug_impcalls = 1;
-		  _dl_debug_reloc = 1;
-		  _dl_debug_files = 1;
-		  _dl_debug_symbols = 1;
-		  _dl_debug_bindings = 1;
-		  _dl_debug_versions = 1;
+		  _dl_debug_mask = (DL_DEBUG_LIBS | DL_DEBUG_IMPCALLS
+				    | DL_DEBUG_RELOC | DL_DEBUG_FILES
+				    | DL_DEBUG_SYMBOLS | DL_DEBUG_BINDINGS
+				    | DL_DEBUG_VERSIONS);
 		  any_debug = 1;
 		  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)
 		{
-		  _dl_debug_libs = 1;
-		  _dl_debug_impcalls = 1;
+		  _dl_debug_mask |= DL_DEBUG_LIBS | DL_DEBUG_IMPCALLS;
 		  any_debug = 1;
 		  continue;
 		}
@@ -1242,16 +1232,14 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
 	    case 5:
 	      if (memcmp (dl_debug, "reloc", 5) == 0)
 		{
-		  _dl_debug_reloc = 1;
-		  _dl_debug_impcalls = 1;
+		  _dl_debug_mask |= DL_DEBUG_RELOC | DL_DEBUG_IMPCALLS;
 		  any_debug = 1;
 		  continue;
 		}
 
 	      if (memcmp (dl_debug, "files", 5) == 0)
 		{
-		  _dl_debug_files = 1;
-		  _dl_debug_impcalls = 1;
+		  _dl_debug_mask |= DL_DEBUG_FILES | DL_DEBUG_IMPCALLS;
 		  any_debug = 1;
 		  continue;
 		}
@@ -1260,8 +1248,7 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
 	    case 7:
 	      if (memcmp (dl_debug, "symbols", 7) == 0)
 		{
-		  _dl_debug_symbols = 1;
-		  _dl_debug_impcalls = 1;
+		  _dl_debug_mask |= DL_DEBUG_SYMBOLS | DL_DEBUG_IMPCALLS;
 		  any_debug = 1;
 		  continue;
 		}
@@ -1270,16 +1257,14 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
 	    case 8:
 	      if (memcmp (dl_debug, "bindings", 8) == 0)
 		{
-		  _dl_debug_bindings = 1;
-		  _dl_debug_impcalls = 1;
+		  _dl_debug_mask |= DL_DEBUG_BINDINGS | DL_DEBUG_IMPCALLS;
 		  any_debug = 1;
 		  continue;
 		}
 
 	      if (memcmp (dl_debug, "versions", 8) == 0)
 		{
-		  _dl_debug_versions = 1;
-		  _dl_debug_impcalls = 1;
+		  _dl_debug_mask |= DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS;
 		  any_debug = 1;
 		  continue;
 		}
@@ -1288,7 +1273,7 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
 	    case 10:
 	      if (memcmp (dl_debug, "statistics", 10) == 0)
 		{
-		  _dl_debug_statistics = 1;
+		  _dl_debug_mask |= DL_DEBUG_STATISTICS;
 		  continue;
 		}
 	      break;
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c
index d92b4bac37..f08bbf1896 100644
--- a/sysdeps/generic/dl-cache.c
+++ b/sysdeps/generic/dl-cache.c
@@ -1,5 +1,5 @@
 /* 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.
 
    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;
 
   /* 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);
 
   if (cache == NULL)
@@ -252,7 +252,7 @@ _dl_load_cache_lookup (const char *name)
     }
 
   /* 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);
 
   return best;
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 7d9907b8b6..ee13591b78 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -184,6 +184,7 @@ extern struct link_map *_dl_profile_map;
 extern const char *_dl_profile_output;
 
 /* If nonzero the appropriate debug information is printed.  */
+#if 0
 extern int _dl_debug_libs;
 extern int _dl_debug_impcalls;
 extern int _dl_debug_bindings;
@@ -191,6 +192,17 @@ extern int _dl_debug_symbols;
 extern int _dl_debug_versions;
 extern int _dl_debug_reloc;
 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.  */
 extern int _dl_correct_cache_id;
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
index b651d73603..c02fa8a445 100644
--- a/sysdeps/generic/libc-start.c
+++ b/sysdeps/generic/libc-start.c
@@ -115,14 +115,14 @@ BP_SYM (__libc_start_main) (int (*main) (int, char **, char **),
 
   /* Call the initializer of the program, if any.  */
 #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);
 #endif
   if (init)
     (*init) ();
 
 #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);
 #endif