about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2012-04-04 20:09:09 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2012-04-11 00:13:52 +0530
commit73d65cc3784b1413b017fed31550ec11e717e45b (patch)
tree25c26d43b59d5f65bd15381a05a7566cb5ee90b7 /elf/rtld.c
parentd715c9144bdf32211cd512530d2240dc28648435 (diff)
downloadglibc-73d65cc3784b1413b017fed31550ec11e717e45b.tar.gz
glibc-73d65cc3784b1413b017fed31550ec11e717e45b.tar.xz
glibc-73d65cc3784b1413b017fed31550ec11e717e45b.zip
New ld.so argument --inhibit-ldcache to disable ld.so.cache lookup
It may sometimes be desirable to make the dynamic linker only pick up
libraries from the library path and rpath and not look at the
ld.so.cache that ldconfig generates. An example of such a use case is
the glibc testsuite where the dynamic linker must not be influenced by
any external paths or caches.

This change adds a new option --inhibit-ldcache that when used, tells
the dynamic linker to not use ld.so.cache even if it is available.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 0362b14968..88a340d1ee 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -161,6 +161,7 @@ struct rtld_global_ro _rtld_global_ro attribute_relro =
     ._dl_fpu_control = _FPU_DEFAULT,
     ._dl_pointer_guard = 1,
     ._dl_pagesize = EXEC_PAGESIZE,
+    ._dl_inhibit_cache = 0,
 
     /* Function pointers.  */
     ._dl_debug_printf = _dl_debug_printf,
@@ -973,6 +974,13 @@ dl_main (const ElfW(Phdr) *phdr,
 	    --_dl_argc;
 	    ++INTUSE(_dl_argv);
 	  }
+	else if (! strcmp (INTUSE(_dl_argv)[1], "--inhibit-cache"))
+	  {
+	    GLRO(dl_inhibit_cache) = 1;
+	    ++_dl_skip_args;
+	    --_dl_argc;
+	    ++INTUSE(_dl_argv);
+	  }
 	else if (! strcmp (INTUSE(_dl_argv)[1], "--library-path")
 		 && _dl_argc > 2)
 	  {
@@ -1022,6 +1030,7 @@ of this helper program; chances are you did not intend to run this program.\n\
   --list                list all dependencies and how they are resolved\n\
   --verify              verify that given object really is a dynamically linked\n\
 			object we can handle\n\
+  --inhibit-cache       Do not use " LD_SO_CACHE "\n\
   --library-path PATH   use given PATH instead of content of the environment\n\
 			variable LD_LIBRARY_PATH\n\
   --inhibit-rpath LIST  ignore RUNPATH and RPATH information in object names\n\