]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Sat Jun 15 18:13:43 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
authorRoland McGrath <roland@gnu.org>
Sun, 16 Jun 1996 01:27:54 +0000 (01:27 +0000)
committerRoland McGrath <roland@gnu.org>
Sun, 16 Jun 1996 01:27:54 +0000 (01:27 +0000)
* sysdeps/unix/sysv/linux/Dist: Add sys/klog.h.

* elf/dl-open.c (_dl_open): Remove PARENT argument, pass null.
* elf/link.h: Update prototype.
* elf/dl-load.c (_dl_map_object): If dependents' DT_RPATHs don't find
NAME, try the DT_RPATH of the executable itself if dynamic.
* elf/dlopen.c (dlopen): Don't pass first arg to _dl_open.

* elf/dl-load.c (_dl_map_object): Exit DT_RPATH checking loop when an
open succeeds.

* Makerules (build-shlib): Give -L opts for each elt of $(rpath-link).

* sysdeps/mach/hurd/Makefile (sysdep-LDFLAGS): Variable removed.
(rpath-link): Append to this instead.

ChangeLog
Makerules
elf/dl-load.c
elf/dl-open.c
elf/dlopen.c
elf/link.h
sysdeps/mach/hurd/Makefile
sysdeps/unix/sysv/linux/Dist

index be289c27cc41c88afa1e063ce7e4b40e866f51ed..667df43435904edabbecb88248bcdee8efb32856 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Sat Jun 15 18:13:43 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
+
+       * sysdeps/unix/sysv/linux/Dist: Add sys/klog.h.
+
+       * elf/dl-open.c (_dl_open): Remove PARENT argument, pass null.
+       * elf/link.h: Update prototype.
+       * elf/dl-load.c (_dl_map_object): If dependents' DT_RPATHs don't find
+       NAME, try the DT_RPATH of the executable itself if dynamic.
+       * elf/dlopen.c (dlopen): Don't pass first arg to _dl_open.
+
+       * elf/dl-load.c (_dl_map_object): Exit DT_RPATH checking loop when an
+       open succeeds.
+
+       * Makerules (build-shlib): Give -L opts for each elt of $(rpath-link).
+
+       * sysdeps/mach/hurd/Makefile (sysdep-LDFLAGS): Variable removed.
+       (rpath-link): Append to this instead.
+
 Fri Jun 14 01:51:47 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
 
        * version.c (banner): New static const variable, complete version
index 4ea38edd34022ef24aead3d35a412c296835b61a..cdb1bcb78c38847e5fa68986b69d9bb17dabf607 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -486,7 +486,7 @@ define build-shlib
 $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS)  \
          -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
          $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
-         -Wl,-rpath-link=$(common-objdir) \
+         -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
          -Wl,--whole-archive $^ $(no-whole-archive) \
          $(LDLIBS-$(@F:lib%.so=%).so)
 endef
index 48210731ccf64e39ffcbb29dab0c1e5d5475e378..f947bb8a93b819098cea4f075994802bcf7cf634 100644 (file)
@@ -469,13 +469,24 @@ _dl_map_object (struct link_map *loader, const char *name, int type)
        }
 
       fd = -1;
-      for (l = loader; l; l = l->l_loader)
+
+      /* First try the DT_RPATH of the dependent object that caused NAME
+        to be loaded.  Then that object's dependent, and on up.  */
+      for (l = loader; fd == -1 && l; l = l->l_loader)
        if (l && l->l_info[DT_RPATH])
          trypath ((const char *) (l->l_addr +
                                   l->l_info[DT_STRTAB]->d_un.d_ptr +
                                   l->l_info[DT_RPATH]->d_un.d_val));
+      /* If dynamically linked, try the DT_RPATH of the executable itself.  */
+      l = _dl_loaded;
+      if (fd == -1 && l && l->l_type != lt_loaded)
+       trypath ((const char *) (l->l_addr +
+                                l->l_info[DT_STRTAB]->d_un.d_ptr +
+                                l->l_info[DT_RPATH]->d_un.d_val));
+      /* Try an environment variable (unless setuid).  */
       if (fd == -1 && ! _dl_secure)
        trypath (getenv ("LD_LIBRARY_PATH"));
+      /* Finally, try the default path.  */
       if (fd == -1)
        {
          extern const char *_dl_rpath; /* Set in rtld.c. */
index 817183723642570ed3f070a7f101cdecabeb77c3..c24920f933fb971b74c0379788fff22bfeb1e626 100644 (file)
@@ -25,22 +25,15 @@ Cambridge, MA 02139, USA.  */
 size_t _dl_global_scope_alloc;
 
 struct link_map *
-_dl_open (struct link_map *parent, const char *file, int mode)
+_dl_open (const char *file, int mode)
 {
   struct link_map *new, *l;
   ElfW(Addr) init;
   struct r_debug *r;
 
 
-#ifdef PIC
-  if (! parent)
-    /* If no particular dependent object caused this load,
-       then use the DT_RPATH of the executable itself.  */
-      parent = _dl_loaded;
-#endif
-
   /* Load the named object.  */
-  new = _dl_map_object (parent, file, lt_loaded);
+  new = _dl_map_object (NULL, file, lt_loaded);
   if (new->l_searchlist)
     /* It was already open.  */
     return new;
index e261fcadd910a62a1ffd37b9ee29a92c965b9e16..9de787dd683ef12fb0a925df87712f9ea413e316 100644 (file)
@@ -28,7 +28,7 @@ dlopen (const char *file, int mode)
 
   void doit (void)
     {
-      new = _dl_open (_dl_loaded, file ?: "", mode);
+      new = _dl_open (file ?: "", mode);
     }
 
   return _dlerror_run (doit) ? NULL : new;
index f43ec411f86768c4d691dae006a18523bf53a2dd..1e0104a4eaf952290d7e2250e04a933cffacb2f9 100644 (file)
@@ -205,11 +205,9 @@ extern void _dl_setup_hash (struct link_map *map);
 
 
 /* Open the shared object NAME, relocate it, and run its initializer if it
-   hasn't already been run.  LOADER's DT_RPATH is used in searching for
-   NAME.  MODE is as for `dlopen' (see <dlfcn.h>).  If the object is
-   already opened, returns its existing map.  */
-extern struct link_map *_dl_open (struct link_map *loader,
-                                 const char *name, int mode);
+   hasn't already been run.  MODE is as for `dlopen' (see <dlfcn.h>).  If
+   the object is already opened, returns its existing map.  */
+extern struct link_map *_dl_open (const char *name, int mode);
 
 /* Close an object previously opened by _dl_open.  */
 extern void _dl_close (struct link_map *map);
index f4b590a06b51a027c8da389bc3a27edd253c3063..bbee3faa65914e2b29523ff47c159e4aa42e64a6 100644 (file)
@@ -104,7 +104,9 @@ endif
 # For the shared library, we don't need to do the linker script machination.
 # Instead, we specify the required libraries when building the shared object.
 LDLIBS-c.so = -lmachuser -lhurduser
-sysdep-LDFLAGS += -Wl,-rpath-link=$(..)mach:$(..)hurd
+ifndef objpfx
+rpath-link += $(..)mach:$(..)hurd
+endif
 \f
 
 endif  # in-Makerules
index affc75f8b06af4b8a60ba7107ed8d3e64f01ade1..9daf03a94766c9e33150938942285e8003c4674a 100644 (file)
@@ -4,6 +4,7 @@ nfs/nfs.h
 sys/acct.h
 sys/io.h
 sys/kdaemon.h
+sys/klog.h
 sys/module.h
 sys/mount.h
 sys/quota.h