[uClibc] ld.so loading "false" libs

Peter S. Mazinger ps.m at gmx.net
Tue Sep 28 22:22:30 UTC 2004


On Tue, 28 Sep 2004, Erik Andersen wrote:

> On Tue Sep 28, 2004 at 10:08:47PM +0200, Peter S. Mazinger wrote:
> > I came across
> > #ifdef DEBUG
> > LDSO_CONF ../util/ld.so.conf
> > #else
> > LDSO_CONF UCLIBC_RUNTIME_PREFIX ld.so.conf
> > #endif
> > 
> > Is this in use?
> 
> No, this is leftover cruft and should be killed,

Ok, killed, attached the LDSO_CACHE_SUPPORT option.
I haven't changed the ld.so.* names.

Is the cache format the same as glibc (ld.so.cache)?

The conflict problem is if we want to install uclibc with RUNTIME_PREFIX=/ 
along w/ glibc, but this can't be done currently, because libpthread.so.1 
all the so links, all the shared libs conflict.
I think it is no use to have both libc's in /, so uclibc (maybe later 
on glibc ;) ) will go into some other prefix, along w/ etc/ld.so.*.
The only important file is ld-*.so.?, this have to be at the compile time 
location, all the rest is irrelevant, it should be only in path (I think).

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2

____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
-------------- next part --------------
--- uClibc-0.9.26/extra/Configs/Config.in.cache~	Wed Sep 29 00:07:59 2004
+++ uClibc-0.9.26/extra/Configs/Config.in	Wed Sep 29 00:08:06 2004
@@ -183,6 +183,18 @@
 	  be built for your target architecture.  If this option is available,
 	  to you, then you almost certainly want to answer Y.
 
+config LDSO_CACHE_SUPPORT
+	bool "Enable shared library loader cache"
+	depends on BUILD_UCLIBC_LDSO
+	default n
+	help
+	  If you wish to make use of /etc/ld.so.conf, the shared library loader
+	  cache configuration file to configure the search path for shared
+	  libraries, answer Y.
+	  After changing the file you have to run ldconfig to update the cache
+	  located at /etc/ld.so.cache.
+	  Both paths are relative to the chosen UCLIBC_RUNTIME_PREFIX.
+
 config FORCE_SHAREABLE_TEXT_SEGMENTS
 	bool "Only load shared libraries which can share their text segment"
 	depends on BUILD_UCLIBC_LDSO
--- uClibc-0.9.26/ldso/include/dl-elf.h.cache~	Wed Sep 29 00:07:59 2004
+++ uClibc-0.9.26/ldso/include/dl-elf.h	Wed Sep 29 00:09:00 2004
@@ -5,15 +5,9 @@
 #include <elf.h>
 #include <link.h>
 
-#ifdef DEBUG
-#  define LDSO_CONF  "../util/ld.so.conf"
-#  define LDSO_CACHE "../util/ld.so.cache"
-#  define LDSO_PRELOAD "../util/ld.so.preload"
-#else
-#  define LDSO_CONF  UCLIBC_RUNTIME_PREFIX "etc/ld.so.conf"
-#  define LDSO_CACHE UCLIBC_RUNTIME_PREFIX "etc/ld.so.cache"
-#  define LDSO_PRELOAD UCLIBC_RUNTIME_PREFIX "etc/ld.so.preload"
-#endif
+#define LDSO_CONF  UCLIBC_RUNTIME_PREFIX "etc/ld.so.conf"
+#define LDSO_CACHE UCLIBC_RUNTIME_PREFIX "etc/ld.so.cache"
+#define LDSO_PRELOAD UCLIBC_RUNTIME_PREFIX "etc/ld.so.preload"
 
 
 #define LIB_ANY	     -1
@@ -30,7 +24,7 @@
 
 
 /* Definitions and prototypes for cache stuff */
-#ifdef USE_CACHE
+#ifdef __LDSO_CACHE_SUPPORT
 extern int _dl_map_cache(void);
 extern int _dl_unmap_cache(void);
 
--- uClibc-0.9.26/ldso/ldso/dl-elf.c.cache~	Wed Sep 29 00:07:59 2004
+++ uClibc-0.9.26/ldso/ldso/dl-elf.c	Wed Sep 29 00:08:06 2004
@@ -32,7 +32,7 @@
 
 #include "ldso.h"
 
-#ifdef USE_CACHE
+#ifdef __LDSO_CACHE_SUPPORT
 
 static caddr_t _dl_cache_addr = NULL;
 static size_t _dl_cache_size = 0;
@@ -317,7 +317,7 @@
 	 * ABI, so we have some flexibility here.  For now, search it before
 	 * the hard coded paths that follow (i.e before /lib and /usr/lib).
 	 */
-#ifdef USE_CACHE
+#ifdef __LDSO_CACHE_SUPPORT
 	if (_dl_cache_addr != NULL && _dl_cache_addr != (caddr_t) - 1) {
 		int i;
 		header_t *header = (header_t *) _dl_cache_addr;
@@ -357,7 +357,12 @@
 #endif
 	if ((tpnt1 = search_for_named_library(libname, secure,
 					UCLIBC_RUNTIME_PREFIX "lib:"
+#ifdef __LDSO_CACHE_SUPPORT
 					UCLIBC_RUNTIME_PREFIX "usr/lib"
+#else
+					uCLIBC_RUNTIME_PREFIX "usr/lib:"
+					UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib"
+#endif
 					, rpnt)
 		) != NULL)
 	{
--- uClibc-0.9.26/ldso/libdl/libdl.c.cache~	Wed Sep 29 00:07:59 2004
+++ uClibc-0.9.26/ldso/libdl/libdl.c	Wed Sep 29 00:08:06 2004
@@ -54,7 +54,7 @@
 extern struct r_debug *_dl_debug_addr __attribute__ ((__weak__));
 extern unsigned long _dl_error_number __attribute__ ((__weak__));
 extern void *(*_dl_malloc_function)(size_t) __attribute__ ((__weak__));
-#ifdef USE_CACHE
+#ifdef __LDSO_CACHE_SUPPORT
 int _dl_map_cache(void) __attribute__ ((__weak__));
 int _dl_unmap_cache(void) __attribute__ ((__weak__));
 #endif
--- uClibc-0.9.26/utils/ldconfig.c.cache~	Wed Sep 29 00:07:59 2004
+++ uClibc-0.9.26/utils/ldconfig.c	Wed Sep 29 00:08:06 2004
@@ -503,7 +503,7 @@
     {
 	if (!lp->islink)
 	    link_shlib(name, lp->name, lp->so);
-#ifdef USE_CACHE
+#ifdef __LDSO_CACHE_SUPPORT
 	if (!nocache)
 	    cache_dolib(name, lp->so, lp->libtype);
 #endif
@@ -553,7 +553,7 @@
     return res;
 }
 
-#ifdef USE_CACHE
+#ifdef __LDSO_CACHE_SUPPORT
 typedef struct liblist
 {
     int flags;
@@ -876,6 +876,9 @@
 	{
 	    scan_dir(UCLIBC_RUNTIME_PREFIX "lib");
 	    scan_dir(UCLIBC_RUNTIME_PREFIX "usr/lib");
+#ifndef __LDSO_CACHE_SUPPORT
+	    scan_dir(UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib");
+#endif
 
 	    /* I guess the defaults aren't good enough */
 	    if ((extpath = get_extpath()))
@@ -898,7 +901,7 @@
 	    }
 	}
 
-#ifdef USE_CACHE
+#ifdef __LDSO_CACHE_SUPPORT
 	if (!nocache)
 	    cache_write();
 #endif
--- uClibc-0.9.26/utils/ldd.c.cache~	Wed Sep 29 00:07:59 2004
+++ uClibc-0.9.26/utils/ldd.c	Wed Sep 29 00:08:06 2004
@@ -320,11 +320,6 @@
 		}
 	}
 
-#ifdef USE_CACHE
-	/* FIXME -- add code to check the Cache here */
-#endif
-
-
 	/* Next look for libraries wherever the shared library
 	 * loader was installed -- this is usually where we
 	 * should find things... */
@@ -339,7 +334,13 @@
 	/* Lastly, search the standard list of paths for the library.
 	   This list must exactly match the list in uClibc/ldso/ldso/dl-elf.c */
 	path =	UCLIBC_RUNTIME_PREFIX "lib:"
+#ifdef __LDSO_CACHE_SUPPORT
 		UCLIBC_RUNTIME_PREFIX "usr/lib";
+		/* FIXME -- add code to check the cache here */
+#else
+		UCLIBC_RUNTIME_PREFIX "usr/lib:"
+		UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib";
+#endif
 	search_for_named_library(lib->name, buf, path);
 	if (*buf != '\0') {
 		lib->path = buf;
--- uClibc-0.9.26/Rules.mak.cache~	Wed Sep 29 00:07:59 2004
+++ uClibc-0.9.26/Rules.mak	Wed Sep 29 00:08:06 2004
@@ -247,8 +247,10 @@
 endif
 
 ifeq ($(HAVE_SHARED),y)
-    LIBRARY_CACHE:=#-DUSE_CACHE
     ifeq ($(BUILD_UCLIBC_LDSO),y)
+	ifeq ($(LDSO_CACHE_SUPPORT),y)
+	    LIBRARY_CACHE:=-D__LDSO_CACHE_SUPPORT
+	endif
 	LDSO:=$(TOPDIR)lib/$(UCLIBC_LDSO)
 	DYNAMIC_LINKER:=$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO)
     else


More information about the uClibc mailing list