aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-10-03 16:13:14 -0700
committerRoland McGrath <roland@hack.frob.com>2012-10-03 16:13:14 -0700
commitf57f805541562734a40088b8be93e3bc9e86be54 (patch)
tree8137253002dda45425068fef98c9b7649825c3fb
parent8f565a27edb9908e237cbb77c8ffc7824f579f15 (diff)
downloadglibc-f57f805541562734a40088b8be93e3bc9e86be54.zip
glibc-f57f805541562734a40088b8be93e3bc9e86be54.tar.gz
glibc-f57f805541562734a40088b8be93e3bc9e86be54.tar.bz2
Clean up conditionalize of ld.so.cache support.
-rw-r--r--ChangeLog14
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure4
-rw-r--r--configure.in3
-rw-r--r--elf/Makefile9
-rw-r--r--elf/dl-load.c12
-rw-r--r--elf/dl-open.c4
-rw-r--r--elf/rtld.c2
-rw-r--r--sysdeps/mach/hurd/dl-cache.c28
9 files changed, 40 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index a19491f..c0726ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-10-03 Roland McGrath <roland@hack.frob.com>
+
+ * sysdeps/mach/hurd/dl-cache.c: File removed.
+ * config.h.in (USE_LDCONFIG): New #undef.
+ * configure.in (use_ldconfig): If set, define USE_LDCONFIG.
+ * configure: Regenerated.
+ * elf/Makefile (dl-routines): Add dl-cache only under
+ [$(use-ldconfig) = yes].
+ * elf/dl-load.c (_dl_map_object): Conditionalize code consulting the
+ cache on [USE_LDCONFIG].
+ * elf/dl-open.c (_dl_open): Call _dl_unload_cache only under
+ [USE_LDCONFIG].
+ * elf/rtld.c (dl_main): Likewise.
+
2012-10-03 Pino Toscano <toscano.pino@tiscali.it>
* sysdeps/posix/sysconf.c (__sysconf): Return 0 also for
diff --git a/config.h.in b/config.h.in
index 10a9925..5f9f3c3 100644
--- a/config.h.in
+++ b/config.h.in
@@ -177,6 +177,9 @@
/* Define if library functions should try to contact the nscd daemon. */
#undef USE_NSCD
+/* Define if the dynamic linker should consult an ld.so.cache file. */
+#undef USE_LDCONFIG
+
/*
*/
diff --git a/configure b/configure
index 739d2bd..a5e9316 100755
--- a/configure
+++ b/configure
@@ -7493,6 +7493,10 @@ fi
+if test x$use_ldconfig = xyes; then
+ $as_echo "#define USE_LDCONFIG 1" >>confdefs.h
+
+fi
diff --git a/configure.in b/configure.in
index 878bf1a..b9b5703 100644
--- a/configure.in
+++ b/configure.in
@@ -2156,6 +2156,9 @@ AC_SUBST(libc_cv_cc_nofma)
AC_SUBST(libc_cv_as_i686)
AC_SUBST(libc_cv_sparc_as_vis3)
+if test x$use_ldconfig = xyes; then
+ AC_DEFINE(USE_LDCONFIG)
+fi
AC_SUBST(use_ldconfig)
AC_SUBST(ldd_rewrite_script)
diff --git a/elf/Makefile b/elf/Makefile
index 2eb12d3..58cc15c 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -19,6 +19,8 @@
subdir := elf
+include ../Makeconfig
+
headers = elf.h bits/elfclass.h link.h bits/link.h
routines = $(dl-routines) dl-support dl-iteratephdr \
dl-addr enbl-secure dl-profstub \
@@ -26,10 +28,13 @@ routines = $(dl-routines) dl-support dl-iteratephdr \
# The core dynamic linking functions are in libc for the static and
# profiled libraries.
-dl-routines = $(addprefix dl-,load cache lookup object reloc deps \
+dl-routines = $(addprefix dl-,load lookup object reloc deps \
runtime error init fini debug misc \
version profile conflict tls origin scope \
execstack caller open close trampoline)
+ifeq (yes,$(use-ldconfig))
+dl-routines += dl-cache
+endif
all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
# But they are absent from the shared libc, because that code is in ld.so.
elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
@@ -45,8 +50,6 @@ CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
-include ../Makeconfig
-
ifeq ($(unwind-find-fde),yes)
routines += unwind-dw2-fde-glibc
shared-only-routines += unwind-dw2-fde-glibc
diff --git a/elf/dl-load.c b/elf/dl-load.c
index ea31417..0bfa74a 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2197,6 +2197,7 @@ _dl_map_object (struct link_map *loader, const char *name,
&loader->l_runpath_dirs, &realname, &fb, loader,
LA_SER_RUNPATH, &found_other_class);
+#ifdef USE_LDCONFIG
if (fd == -1
&& (__builtin_expect (! (mode & __RTLD_SECURE), 1)
|| ! INTUSE(__libc_enable_secure))
@@ -2208,22 +2209,22 @@ _dl_map_object (struct link_map *loader, const char *name,
if (cached != NULL)
{
-#ifdef SHARED
+# ifdef SHARED
// XXX Correct to unconditionally default to namespace 0?
l = (loader
?: GL(dl_ns)[LM_ID_BASE]._ns_loaded
?: &GL(dl_rtld_map));
-#else
+# else
l = loader;
-#endif
+# endif
/* If the loader has the DF_1_NODEFLIB flag set we must not
use a cache entry from any of these directories. */
if (
-#ifndef SHARED
+# ifndef SHARED
/* 'l' is always != NULL for dynamically linked objects. */
l != NULL &&
-#endif
+# endif
__builtin_expect (l->l_flags_1 & DF_1_NODEFLIB, 0))
{
const char *dirp = system_dirs;
@@ -2261,6 +2262,7 @@ _dl_map_object (struct link_map *loader, const char *name,
}
}
}
+#endif
/* Finally, try the default path. */
if (fd == -1
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 0bc447a..5149e57 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -654,8 +654,8 @@ no more namespaces available for dlmopen()"));
int errcode = _dl_catch_error (&objname, &errstring, &malloced,
dl_open_worker, &args);
-#ifndef MAP_COPY
- /* We must munmap() the cache file. */
+#if defined USE_LDCONFIG && !defined MAP_COPY
+ /* We must unmap the cache file. */
_dl_unload_cache ();
#endif
diff --git a/elf/rtld.c b/elf/rtld.c
index ed5d062..8a02645 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2400,7 +2400,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
_dl_debug_state ();
LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
-#ifndef MAP_COPY
+#if defined USE_LDCONFIG && !defined MAP_COPY
/* We must munmap() the cache file. */
_dl_unload_cache ();
#endif
diff --git a/sysdeps/mach/hurd/dl-cache.c b/sysdeps/mach/hurd/dl-cache.c
deleted file mode 100644
index 5c01c3d..0000000
--- a/sysdeps/mach/hurd/dl-cache.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Stubby version of dl-cache; the Hurd doesn't support this "feature".
- Copyright (C) 1996, 1997 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
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-const char *
-_dl_load_cache_lookup (const char *name)
-{
- return 0;
-}
-
-void
-_dl_unload_cache (void)
-{
-}