]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Sun, 8 Mar 1998 23:58:37 +0000 (23:58 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 8 Mar 1998 23:58:37 +0000 (23:58 +0000)
1998-03-08  Ulrich Drepper  <drepper@cygnus.com>

* elf/rtld.c (process_envvars): Also recognize LD_LIBRARY_PATH,
LD_PRELOAD, and LD_VERBOSE.
(dl_main): Use global variables set by process_envvars instead of
calling getenv.
* elf/dl-load.c (_dl_init_paths): Don't call getenv to get
LD_LIBRARY_PATH value, this comes with the parameter.

ChangeLog
elf/dl-load.c
elf/rtld.c

index ad0b113e31285a37c173803a091cc27c21d5e9c2..9ee23572ec73a5ee4f634b00753d2590b0073671 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+1998-03-08  Ulrich Drepper  <drepper@cygnus.com>
+
+       * elf/rtld.c (process_envvars): Also recognize LD_LIBRARY_PATH,
+       LD_PRELOAD, and LD_VERBOSE.
+       (dl_main): Use global variables set by process_envvars instead of
+       calling getenv.
+       * elf/dl-load.c (_dl_init_paths): Don't call getenv to get
+       LD_LIBRARY_PATH value, this comes with the parameter.
+
 1998-03-08 22:55  Ulrich Drepper  <drepper@cygnus.com>
 
        * elf/rtld.c (dl_main): Delay initialization of path structure if
index f91a7ae4d3c0a8ca1dbf478220e48d07f265ccc7..1d700f9da4f788ba683af99bec3db905c3f2da74 100644 (file)
@@ -333,11 +333,6 @@ _dl_init_paths (const char *llp)
   /* Number of elements in the library path.  */
   size_t nllp;
 
-  /* If the user has not specified a library path consider the environment
-     variable.  */
-  if (llp == NULL)
-    llp = getenv ("LD_LIBRARY_PATH");
-
   /* First determine how many elements the LD_LIBRARY_PATH contents has.  */
   if (llp != NULL && *llp != '\0')
     {
index 304d07a5baf0105b0ee5ee564cc4aeded64034b7..c466fa28c9b4374603d560f4f64cd0655f11ad3a 100644 (file)
@@ -261,7 +261,11 @@ match_version (const char *string, struct link_map *map)
   return 0;
 }
 
-unsigned int _dl_skip_args;    /* Nonzero if we were run directly.  */
+static unsigned int _dl_skip_args;     /* Nonzero if we were run directly.  */
+static const char *library_path;       /* The library search path.  */
+static const char *preloadlist;                /* The list preloaded objects.  */
+static int version_info;               /* Nonzero if information about
+                                          versions has to be printed.  */
 
 static void
 dl_main (const ElfW(Phdr) *phdr,
@@ -274,7 +278,6 @@ dl_main (const ElfW(Phdr) *phdr,
   enum mode mode;
   struct link_map **preloads;
   unsigned int npreloads;
-  const char *preloadlist;
   size_t file_size;
   char *file;
   int has_interp = 0;
@@ -303,9 +306,6 @@ dl_main (const ElfW(Phdr) *phdr,
         ourselves).  This is an easy way to test a new ld.so before
         installing it.  */
 
-      /* Overwrites LD_LIBRARY_PATH if given.  */
-      const char *library_path = NULL;
-
       /* Note the place where the dynamic linker actually came from.  */
       _dl_rtld_map.l_name = _dl_argv[0];
 
@@ -472,7 +472,7 @@ of this helper program; chances are you did not intend to run this program.\n",
   if (*user_entry != (ElfW(Addr)) &ENTRY_POINT)
     /* Initialize the data structures for the search paths for shared
        objects.  */
-    _dl_init_paths (NULL);
+    _dl_init_paths (library_path);
 
   /* Put the link_map for ourselves on the chain so it can be found by
      name.  Note that at this point the global chain of link maps contains
@@ -491,7 +491,6 @@ of this helper program; chances are you did not intend to run this program.\n",
   preloads = NULL;
   npreloads = 0;
 
-  preloadlist = getenv ("LD_PRELOAD");
   if (preloadlist)
     {
       /* The LD_PRELOAD environment variable gives list of libraries
@@ -732,7 +731,7 @@ of this helper program; chances are you did not intend to run this program.\n",
            }
 
 #define VERNEEDTAG (DT_NUM + DT_PROCNUM + DT_VERSIONTAGIDX (DT_VERNEED))
-         if (*(getenv ("LD_VERBOSE") ?: "") != '\0')
+         if (version_info)
            {
              /* Print more information.  This means here, print information
                 about the versions needed.  */
@@ -1006,6 +1005,26 @@ process_envvars (enum mode *modep, int *lazyp)
       if (result < 0)
        continue;
 
+      /* The library search path.  */
+      result = strncmp (&envline[3], "LIBRARY_PATH=", 13);
+      if (result == 0)
+       {
+         library_path = &envline[16];
+         continue;
+       }
+      if (result < 0)
+       continue;
+
+      /* List of objects to be preloaded.  */
+      result = strncmp (&envline[3], "PRELOAD=", 8);
+      if (result == 0)
+       {
+         preloadlist = &envline[11];
+         continue;
+       }
+      if (result < 0)
+       continue;
+
       /* Which shared object shall be profiled.  */
       result = strncmp (&envline[3], "PROFILE=", 8);
       if (result == 0)
@@ -1051,6 +1070,16 @@ process_envvars (enum mode *modep, int *lazyp)
       if (result < 0)
        continue;
 
+      /* Print information about versions.  */
+      result = strncmp (&envline[3], "VERBOSE=", 8);
+      if (result == 0)
+       {
+         version_info = envline[11] != '\0';
+         continue;
+       }
+      if (result < 0)
+       continue;
+
       /* Warning level, verbose or not.  */
       result = strncmp (&envline[3], "WARN=", 5);
       if (result == 0)