about summary refs log tree commit diff
path: root/elf/dl-load.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/dl-load.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/dl-load.c')
-rw-r--r--elf/dl-load.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 41d48ee138..fe83f87eb9 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1,5 +1,5 @@
 /* Map in a shared object's segments from the file.
-   Copyright (C) 1995-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 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
@@ -2194,7 +2194,8 @@ _dl_map_object (struct link_map *loader, const char *name,
 
       if (fd == -1
 	  && (__builtin_expect (! (mode & __RTLD_SECURE), 1)
-	      || ! INTUSE(__libc_enable_secure)))
+	      || ! INTUSE(__libc_enable_secure))
+	  && __builtin_expect (GLRO(dl_inhibit_cache) == 0, 1))
 	{
 	  /* Check the list of libraries in the file /etc/ld.so.cache,
 	     for compatibility with Linux's ldconfig program.  */