[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r9803 - in /trunk/libc: ./ csu/ elf/ sysdeps/generic/



Author: maxim
Date: Thu Feb  4 13:06:08 2010
New Revision: 9803

Log:
	EGLIBC_RTLD_DEBUG option group

	* option-groups.def (OPTION_EGLIBC_RTLD_DEBUG): Define new option
	group.
	* option-groups.defaults: Set the default.
	* sysdeps/generic/ldsodefs.h (GLRO_dl_debug_mask): Define to either
	`GLRO(dl_debug_mask)' or to `0' depending on RTLD_DEBUG option group.
	(_dl_debug_mask): Declare only if RTLD_DEBUG is enabled.
	* elf/dl-support.c (_dl_debug_mask): Define only if RTLD_DEBUG is
	enabled.
	* elf/rtld.c: Replace GLRO(dl_debug_mask) with GLRO_dl_debug_mask
	throughout the file.
	(process_dl_debug): Compile only if RTLD_DEBUG is enabled.
	(process_envvars): Update.
	* csu/libc-start.c, elf/dl-cache.c, elf/dl-close.c, elf/dl-conflict.c,
	* elf/dl-deps.c, elf/dl-error.c, elf/dl-fini.c, elf/dl-init.c,
	* elf/dl-load.c, elf/dl-lookup.c, elf/dl-object.c, elf/dl-open.c,
	* elf/dl-reloc.c, elf/dl-version.c: Replace GLRO(dl_debug_mask) with
	GLRO_dl_debug_mask throughout the file.

Modified:
    trunk/libc/ChangeLog.eglibc
    trunk/libc/csu/libc-start.c
    trunk/libc/elf/dl-cache.c
    trunk/libc/elf/dl-close.c
    trunk/libc/elf/dl-conflict.c
    trunk/libc/elf/dl-deps.c
    trunk/libc/elf/dl-error.c
    trunk/libc/elf/dl-fini.c
    trunk/libc/elf/dl-init.c
    trunk/libc/elf/dl-load.c
    trunk/libc/elf/dl-lookup.c
    trunk/libc/elf/dl-object.c
    trunk/libc/elf/dl-open.c
    trunk/libc/elf/dl-reloc.c
    trunk/libc/elf/dl-support.c
    trunk/libc/elf/dl-version.c
    trunk/libc/elf/rtld.c
    trunk/libc/option-groups.def
    trunk/libc/option-groups.defaults
    trunk/libc/sysdeps/generic/ldsodefs.h

Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Thu Feb  4 13:06:08 2010
@@ -1,3 +1,25 @@
+2010-02-04  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
+
+	EGLIBC_RTLD_DEBUG option group
+
+	* option-groups.def (OPTION_EGLIBC_RTLD_DEBUG): Define new option
+	group.
+	* option-groups.defaults: Set the default.
+	* sysdeps/generic/ldsodefs.h (GLRO_dl_debug_mask): Define to either
+	`GLRO(dl_debug_mask)' or to `0' depending on RTLD_DEBUG option group.
+	(_dl_debug_mask): Declare only if RTLD_DEBUG is enabled.
+	* elf/dl-support.c (_dl_debug_mask): Define only if RTLD_DEBUG is
+	enabled.
+	* elf/rtld.c: Replace GLRO(dl_debug_mask) with GLRO_dl_debug_mask
+	throughout the file.
+	(process_dl_debug): Compile only if RTLD_DEBUG is enabled.
+	(process_envvars): Update.
+	* csu/libc-start.c, elf/dl-cache.c, elf/dl-close.c, elf/dl-conflict.c,
+	* elf/dl-deps.c, elf/dl-error.c, elf/dl-fini.c, elf/dl-init.c,
+	* elf/dl-load.c, elf/dl-lookup.c, elf/dl-object.c, elf/dl-open.c,
+	* elf/dl-reloc.c, elf/dl-version.c: Replace GLRO(dl_debug_mask) with
+	GLRO_dl_debug_mask throughout the file.
+
 2009-11-20  Jakub Jelinek  <jakub@xxxxxxxxxx>
 
 	PR libc/10103

Modified: trunk/libc/csu/libc-start.c
==============================================================================
--- trunk/libc/csu/libc-start.c (original)
+++ trunk/libc/csu/libc-start.c Thu Feb  4 13:06:08 2010
@@ -178,7 +178,7 @@
 
   /* Call the initializer of the program, if any.  */
 #ifdef SHARED
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
     GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
 #endif
   if (init)
@@ -201,7 +201,7 @@
 #endif
 
 #ifdef SHARED
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
     GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
 #endif
 

Modified: trunk/libc/elf/dl-cache.c
==============================================================================
--- trunk/libc/elf/dl-cache.c (original)
+++ trunk/libc/elf/dl-cache.c Thu Feb  4 13:06:08 2010
@@ -187,7 +187,7 @@
   const char *best;
 
   /* Print a message if the loading of libs is traced.  */
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
     _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
 
   if (cache == NULL)
@@ -283,7 +283,7 @@
     }
 
   /* Print our result if wanted.  */
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)
       && best != NULL)
     _dl_debug_printf ("  trying file=%s\n", best);
 

Modified: trunk/libc/elf/dl-close.c
==============================================================================
--- trunk/libc/elf/dl-close.c (original)
+++ trunk/libc/elf/dl-close.c Thu Feb  4 13:06:08 2010
@@ -123,7 +123,7 @@
 	dl_close_state = rerun;
 
       /* There are still references to this object.  Do nothing more.  */
-      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
 	_dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n",
 			  map->l_name, map->l_direct_opencount);
 
@@ -249,7 +249,7 @@
 	  if (imap->l_init_called)
 	    {
 	      /* When debugging print a message first.  */
-	      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS,
+	      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS,
 				    0))
 		_dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
 				  imap->l_name, nsid);
@@ -628,7 +628,7 @@
 	  free (imap->l_reldeps);
 
 	  /* Print debugging message.  */
-	  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+	  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
 	    _dl_debug_printf ("\nfile=%s [%lu];  destroying link map\n",
 			      imap->l_name, imap->l_ns);
 

Modified: trunk/libc/elf/dl-conflict.c
==============================================================================
--- trunk/libc/elf/dl-conflict.c (original)
+++ trunk/libc/elf/dl-conflict.c Thu Feb  4 13:06:08 2010
@@ -33,7 +33,7 @@
 		       ElfW(Rela) *conflictend)
 {
 #if ! ELF_MACHINE_NO_RELA
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_RELOC, 0))
     _dl_debug_printf ("\nconflict processing: %s\n",
 		      l->l_name[0] ? l->l_name : rtld_progname);
 

Modified: trunk/libc/elf/dl-deps.c
==============================================================================
--- trunk/libc/elf/dl-deps.c (original)
+++ trunk/libc/elf/dl-deps.c Thu Feb  4 13:06:08 2010
@@ -129,7 +129,7 @@
 	    else							      \
 	      {								      \
 		/* This is for DT_AUXILIARY.  */			      \
-		if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))\
+		if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))\
 		  _dl_debug_printf (N_("\
 cannot load auxiliary `%s' because of empty dynamic string token "	      \
 					    "substitution\n"), __str);	      \
@@ -298,7 +298,7 @@
 		if (d->d_tag == DT_AUXILIARY)
 		  {
 		    /* Say that we are about to load an auxiliary library.  */
-		    if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
+		    if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS,
 					  0))
 		      _dl_debug_printf ("load auxiliary object=%s"
 					" requested by file=%s\n",
@@ -325,7 +325,7 @@
 		else
 		  {
 		    /* Say that we are about to load an auxiliary library.  */
-		    if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
+		    if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS,
 					  0))
 		      _dl_debug_printf ("load filtered object=%s"
 					" requested by file=%s\n",
@@ -526,7 +526,7 @@
       runp->map->l_reserved = 0;
     }
 
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) != 0
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_PRELINK, 0) != 0
       && map == GL(dl_ns)[LM_ID_BASE]._ns_loaded)
     {
       /* If we are to compute conflicts, we have to build local scope

Modified: trunk/libc/elf/dl-error.c
==============================================================================
--- trunk/libc/elf/dl-error.c (original)
+++ trunk/libc/elf/dl-error.c Thu Feb  4 13:06:08 2010
@@ -136,7 +136,7 @@
 _dl_signal_cerror (int errcode, const char *objname, const char *occation,
 		   const char *errstring)
 {
-  if (__builtin_expect (GLRO(dl_debug_mask)
+  if (__builtin_expect (GLRO_dl_debug_mask
 			& ~(DL_DEBUG_STATISTICS|DL_DEBUG_PRELINK), 0))
     _dl_debug_printf ("%s: error: %s: %s (%s)\n", objname, occation,
 		      errstring, receiver ? "continued" : "fatal");

Modified: trunk/libc/elf/dl-fini.c
==============================================================================
--- trunk/libc/elf/dl-fini.c (original)
+++ trunk/libc/elf/dl-fini.c Thu Feb  4 13:06:08 2010
@@ -225,7 +225,7 @@
 		  || l->l_info[DT_FINI] != NULL)
 		{
 		  /* When debugging print a message first.  */
-		  if (__builtin_expect (GLRO(dl_debug_mask)
+		  if (__builtin_expect (GLRO_dl_debug_mask
 					& DL_DEBUG_IMPCALLS, 0))
 		    _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
 				      l->l_name[0] ? l->l_name : rtld_progname,
@@ -277,7 +277,7 @@
       goto again;
     }
 
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS, 0))
     _dl_debug_printf ("\nruntime linker statistics:\n"
 		      "           final number of relocations: %lu\n"
 		      "final number of relocations from cache: %lu\n",

Modified: trunk/libc/elf/dl-init.c
==============================================================================
--- trunk/libc/elf/dl-init.c (original)
+++ trunk/libc/elf/dl-init.c Thu Feb  4 13:06:08 2010
@@ -53,7 +53,7 @@
     return;
 
   /* Print a debug message if wanted.  */
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
     _dl_debug_printf ("\ncalling init: %s\n\n",
 		      l->l_name[0] ? l->l_name : rtld_progname);
 
@@ -109,7 +109,7 @@
       ElfW(Addr) *addrs;
       unsigned int cnt;
 
-      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
 	_dl_debug_printf ("\ncalling preinit: %s\n\n",
 			  main_map->l_name[0]
 			  ? main_map->l_name : rtld_progname);

Modified: trunk/libc/elf/dl-load.c
==============================================================================
--- trunk/libc/elf/dl-load.c (original)
+++ trunk/libc/elf/dl-load.c Thu Feb  4 13:06:08 2010
@@ -911,7 +911,7 @@
     }
 
   /* Print debugging message.  */
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
     _dl_debug_printf ("file=%s [%lu];  generating link map\n", name, nsid);
 
   /* This is the ELF header.  We read it in `open_verify'.  */
@@ -1440,7 +1440,7 @@
 
   l->l_entry += l->l_addr;
 
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
     _dl_debug_printf ("\
   dynamic: 0x%0*lx  base: 0x%0*lx   size: 0x%0*Zx\n\
     entry: 0x%0*lx  phdr: 0x%0*lx  phnum:   %*u\n\n",
@@ -1830,7 +1830,7 @@
 
       /* If we are debugging the search for libraries print the path
 	 now if it hasn't happened now.  */
-      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
+      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)
 	  && current_what != this_dir->what)
 	{
 	  current_what = this_dir->what;
@@ -1851,7 +1851,7 @@
 	     - buf);
 
 	  /* Print name we try if this is wanted.  */
-	  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+	  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
 	    _dl_debug_printf ("  trying file=%s\n", buf);
 
 	  fd = open_verify (buf, fbp, loader, whatcode, found_other_class,
@@ -1997,7 +1997,7 @@
     }
 
   /* Display information if we are debugging.  */
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)
       && loader != NULL)
     _dl_debug_printf ("\nfile=%s [%lu];  needed by %s [%lu]\n", name, nsid,
 			      loader->l_name[0]
@@ -2038,7 +2038,7 @@
 
       size_t namelen = strlen (name) + 1;
 
-      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
 	_dl_debug_printf ("find library=%s [%lu]; searching\n", name, nsid);
 
       fd = -1;
@@ -2163,7 +2163,7 @@
 			&realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
 
       /* Add another newline when we are tracing the library loading.  */
-      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
         _dl_debug_printf ("\n");
     }
   else
@@ -2196,7 +2196,7 @@
   if (__builtin_expect (fd, 0) == -1)
     {
       if (trace_mode
-	  && __builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) == 0)
+	  && __builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_PRELINK, 0) == 0)
 	{
 	  /* We haven't found an appropriate library.  But since we
 	     are only interested in the list of libraries this isn't

Modified: trunk/libc/elf/dl-lookup.c
==============================================================================
--- trunk/libc/elf/dl-lookup.c (original)
+++ trunk/libc/elf/dl-lookup.c Thu Feb  4 13:06:08 2010
@@ -110,7 +110,7 @@
 	continue;
 
       /* Print some debugging info if wanted.  */
-      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0))
+      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SYMBOLS, 0))
 	_dl_debug_printf ("symbol=%s;  lookup in file=%s [%lu]\n",
 			  undef_name,
 			  map->l_name[0] ? map->l_name : rtld_progname,
@@ -646,7 +646,7 @@
 	}
 
       /* Display information if we are debugging.  */
-      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
 	_dl_debug_printf ("\
 \nfile=%s [%lu];  needed by %s [%lu] (relocation dependency)\n\n",
 			  map->l_name[0] ? map->l_name : rtld_progname,
@@ -825,7 +825,7 @@
   if (__builtin_expect (current_value.m->l_used == 0, 0))
     current_value.m->l_used = 1;
 
-  if (__builtin_expect (GLRO(dl_debug_mask)
+  if (__builtin_expect (GLRO_dl_debug_mask
 			& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
     _dl_debug_bindings (undef_name, undef_map, ref,
 			&current_value, version, type_class, protected);
@@ -890,7 +890,7 @@
 {
   const char *reference_name = undef_map->l_name;
 
-  if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
+  if (GLRO_dl_debug_mask & DL_DEBUG_BINDINGS)
     {
       _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
 			(reference_name[0]
@@ -906,7 +906,7 @@
 	_dl_debug_printf_c ("\n");
     }
 #ifdef SHARED
-  if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
+  if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
     {
       int conflict = 0;
       struct sym_val val = { NULL, NULL };

Modified: trunk/libc/elf/dl-object.c
==============================================================================
--- trunk/libc/elf/dl-object.c (original)
+++ trunk/libc/elf/dl-object.c Thu Feb  4 13:06:08 2010
@@ -69,7 +69,7 @@
   new->l_type = type;
   /* If we set the bit now since we know it is never used we avoid
      dirtying the cache line later.  */
-  if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0)
+  if ((GLRO_dl_debug_mask & DL_DEBUG_UNUSED) == 0)
     new->l_used = 1;
   new->l_loader = loader;
 #if NO_TLS_OFFSET != 0

Modified: trunk/libc/elf/dl-open.c
==============================================================================
--- trunk/libc/elf/dl-open.c (original)
+++ trunk/libc/elf/dl-open.c Thu Feb  4 13:06:08 2010
@@ -274,7 +274,7 @@
   if (__builtin_expect (new->l_searchlist.r_list != NULL, 0))
     {
       /* Let the user know about the opencount.  */
-      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
 	_dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
 			  new->l_name, new->l_ns, new->l_direct_opencount);
 
@@ -511,7 +511,7 @@
 #endif
 
   /* Let the user know about the opencount.  */
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
     _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
 		      new->l_name, new->l_ns, new->l_direct_opencount);
 }

Modified: trunk/libc/elf/dl-reloc.c
==============================================================================
--- trunk/libc/elf/dl-reloc.c (original)
+++ trunk/libc/elf/dl-reloc.c Thu Feb  4 13:06:08 2010
@@ -186,7 +186,7 @@
       && __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0))
     lazy = 0;
 
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_RELOC, 0))
     _dl_debug_printf ("\nrelocation processing: %s%s\n",
 		      l->l_name[0] ? l->l_name : rtld_progname,
 		      lazy ? " (lazy)" : "");

Modified: trunk/libc/elf/dl-support.c
==============================================================================
--- trunk/libc/elf/dl-support.c (original)
+++ trunk/libc/elf/dl-support.c Thu Feb  4 13:06:08 2010
@@ -40,7 +40,9 @@
 const char *_dl_platform;
 size_t _dl_platformlen;
 
+#if __OPTION_EGLIBC_RTLD_DEBUG
 int _dl_debug_mask;
+#endif
 int _dl_lazy;
 ElfW(Addr) _dl_use_load_bias = -2;
 int _dl_dynamic_weak;

Modified: trunk/libc/elf/dl-version.c
==============================================================================
--- trunk/libc/elf/dl-version.c (original)
+++ trunk/libc/elf/dl-version.c Thu Feb  4 13:06:08 2010
@@ -88,7 +88,7 @@
   int result = 0;
 
   /* Display information about what we are doing while debugging.  */
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_VERSIONS, 0))
     _dl_debug_printf ("\
 checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
 		      string, map->l_name[0] ? map->l_name : rtld_progname,

Modified: trunk/libc/elf/rtld.c
==============================================================================
--- trunk/libc/elf/rtld.c (original)
+++ trunk/libc/elf/rtld.c Thu Feb  4 13:06:08 2010
@@ -346,7 +346,7 @@
     }
 #endif
 
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0))
+  if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS, 0))
     {
 #ifndef HP_TIMING_NONAVAIL
       print_statistics (&rtld_total_time);
@@ -1888,7 +1888,7 @@
 	 after relocation.  */
       struct link_map *l;
 
-      if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
+      if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
 	{
 	  struct r_scope_elem *scope = &main_map->l_searchlist;
 
@@ -1920,7 +1920,7 @@
 		_dl_printf ("\n");
 	    }
 	}
-      else if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
+      else if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
 	{
 	  /* Look through the dependencies of the main executable
 	     and determine which of them is not actually
@@ -2024,7 +2024,7 @@
 		}
 	      while (l != NULL);
 
-	      if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
+	      if ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
 		  && rtld_multiple_ref)
 		{
 		  /* Mark the link map as not yet relocated again.  */
@@ -2158,7 +2158,7 @@
       if (r_list == r_listend && liblist == liblistend)
 	prelinked = true;
 
-      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+      if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
 	_dl_debug_printf ("\nprelink checking: %s\n",
 			  prelinked ? "ok" : "failed");
     }
@@ -2377,6 +2377,7 @@
 		    objname, errstring);
 }
 
+#if __OPTION_EGLIBC_RTLD_DEBUG
 /* Nonzero if any of the debugging options is enabled.  */
 static int any_debug attribute_relro;
 
@@ -2436,7 +2437,7 @@
 	    if (debopts[cnt].len == len
 		&& memcmp (dl_debug, debopts[cnt].name, len) == 0)
 	      {
-		GLRO(dl_debug_mask) |= debopts[cnt].mask;
+		GLRO_dl_debug_mask |= debopts[cnt].mask;
 		any_debug = 1;
 		break;
 	      }
@@ -2457,7 +2458,7 @@
       ++dl_debug;
     }
 
-  if (GLRO(dl_debug_mask) & DL_DEBUG_HELP)
+  if (GLRO_dl_debug_mask & DL_DEBUG_HELP)
     {
       size_t cnt;
 
@@ -2475,6 +2476,7 @@
       _exit (0);
     }
 }
+#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
 
 static void
 process_dl_audit (char *str)
@@ -2542,12 +2544,14 @@
 	  break;
 
 	case 5:
+#if __OPTION_EGLIBC_RTLD_DEBUG
 	  /* Debugging of the dynamic linker?  */
 	  if (memcmp (envline, "DEBUG", 5) == 0)
 	    {
 	      process_dl_debug (&envline[6]);
 	      break;
 	    }
+#endif
 	  if (memcmp (envline, "AUDIT", 5) == 0)
 	    process_dl_audit (&envline[6]);
 	  break;
@@ -2656,7 +2660,9 @@
 	    {
 	      mode = trace;
 	      GLRO(dl_verbose) = 1;
-	      GLRO(dl_debug_mask) |= DL_DEBUG_PRELINK;
+#if __OPTION_EGLIBC_RTLD_DEBUG
+	      GLRO_dl_debug_mask |= DL_DEBUG_PRELINK;
+#endif
 	      GLRO(dl_trace_prelink) = &envline[17];
 	    }
 	  break;
@@ -2703,12 +2709,15 @@
       if (__access ("/etc/suid-debug", F_OK) != 0)
 	{
 	  unsetenv ("MALLOC_CHECK_");
-	  GLRO(dl_debug_mask) = 0;
+#if __OPTION_EGLIBC_RTLD_DEBUG
+	  GLRO_dl_debug_mask = 0;
+#endif
 	}
 
       if (mode != normal)
 	_exit (5);
     }
+#if __OPTION_EGLIBC_RTLD_DEBUG
   /* If we have to run the dynamic linker in debugging mode and the
      LD_DEBUG_OUTPUT environment variable is given, we write the debug
      messages to this file.  */
@@ -2733,6 +2742,7 @@
 	/* We use standard output if opening the file failed.  */
 	GLRO(dl_debug_fd) = STDOUT_FILENO;
     }
+#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
 }
 
 

Modified: trunk/libc/option-groups.def
==============================================================================
--- trunk/libc/option-groups.def (original)
+++ trunk/libc/option-groups.def Thu Feb  4 13:06:08 2010
@@ -635,6 +635,17 @@
         rresvport       ruserpass
         rresvport_af
         
+config OPTION_EGLIBC_RTLD_DEBUG
+   bool "Runtime linker debug print outs"
+   help
+      This option group enables debug output of the runtime linker
+      which is activated via LD_DEBUG and LD_TRACE_PRELINKING
+      environment variables.  Disabling this option group yields
+      a smaller runtime linker binary.
+      BEWARE: Disabling this option group is likely to break
+      the `ldd' utility which may also be used by the prelinker.
+      In particular, the `--unused' ldd option will not work correctly.
+
 config OPTION_EGLIBC_SPAWN
    bool "Support for POSIX posix_spawn functions"
    help

Modified: trunk/libc/option-groups.defaults
==============================================================================
--- trunk/libc/option-groups.defaults (original)
+++ trunk/libc/option-groups.defaults Thu Feb  4 13:06:08 2010
@@ -35,6 +35,7 @@
 OPTION_EGLIBC_NIS = y
 OPTION_EGLIBC_NSSWITCH = y
 OPTION_EGLIBC_RCMD = y
+OPTION_EGLIBC_RTLD_DEBUG = y
 OPTION_EGLIBC_SPAWN = y
 OPTION_EGLIBC_STREAMS = y
 OPTION_EGLIBC_SUNRPC = y

Modified: trunk/libc/sysdeps/generic/ldsodefs.h
==============================================================================
--- trunk/libc/sysdeps/generic/ldsodefs.h (original)
+++ trunk/libc/sysdeps/generic/ldsodefs.h Thu Feb  4 13:06:08 2010
@@ -529,6 +529,12 @@
 # undef __rtld_global_attribute__
 #endif
 
+#if __OPTION_EGLIBC_RTLD_DEBUG
+# define GLRO_dl_debug_mask GLRO(dl_debug_mask)
+#else
+# define GLRO_dl_debug_mask 0
+#endif
+
 #ifndef SHARED
 # define GLRO(name) _##name
 #else
@@ -541,8 +547,10 @@
 {
 #endif
 
+#if __OPTION_EGLIBC_RTLD_DEBUG
   /* If nonzero the appropriate debug information is printed.  */
   EXTERN int _dl_debug_mask;
+#endif
 #define DL_DEBUG_LIBS	    (1 << 0)
 #define DL_DEBUG_IMPCALLS   (1 << 1)
 #define DL_DEBUG_BINDINGS   (1 << 2)