]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Thu, 27 Aug 1998 20:42:04 +0000 (20:42 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 27 Aug 1998 20:42:04 +0000 (20:42 +0000)
Call _dl_new_object with extra argument.
Call _dl_new_object with extra argument.
but the main one if new argument is nonzero.
* elf/ldsodefs.h: Adjust for _dl_new_object change.
(dl_main): Call _dl_new_object with extra argument.

ChangeLog
elf/dl-load.c
elf/dl-object.c
elf/ldsodefs.h
elf/rtld.c
sysdeps/unix/sysv/linux/dl-origin.h

index 3605250234fc73ddab11e4f190a6c0bf7a821dd0..b1f0fa7d1215c68b7c0cab8f5b84eb8b5459066c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        (_dl_map_object_from_fd): Define static is EXTERNAL_MAP_FROM_FD is
        not defined.
        Check EI_OSABI and EI_ABIVERSION fields in header.
+       Call _dl_new_object with extra argument.
        (_dl_map_object): Call decompose_path with correct argument.
        Call expand_dynamic_string_token instead of local_strdup to also
        expand DST.
+       Call _dl_new_object with extra argument.
        * elf/dl-object.c (_dl_new_object): Determine l_origin for all maps
-       but the main one.
+       but the main one if new argument is nonzero.
+       * elf/ldsodefs.h: Adjust for _dl_new_object change.
        * elf/dl-support.c: Define _dl_origin_path.
        * elf/rtld.c: Likewise.  Set _dl_origin_path based on LD_ORIGIN_PATH.
+       (dl_main): Call _dl_new_object with extra argument.
 
        * elf/dl-close (_dl_close): Free l_name and l_origin.
 
index 8e6a8537a3db017ff4b962c2b9d002add4a4c873..81c1d8ba2e3603c4f616ebe7e2c5ac4d3f07151c 100644 (file)
@@ -739,7 +739,7 @@ _dl_map_object_from_fd (char *name, int fd, char *realname,
 #endif
 
   /* Enter the new object in the list of loaded objects.  */
-  l = _dl_new_object (realname, name, l_type);
+  l = _dl_new_object (realname, name, l_type, loader != NULL);
   if (! l)
     lose (ENOMEM, "cannot create shared object descriptor");
   l->l_opencount = 1;
@@ -1290,7 +1290,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
 
          /* Enter the new object in the list of loaded objects.  */
          if ((name_copy = local_strdup (name)) == NULL
-             || (l = _dl_new_object (name_copy, name, type)) == NULL)
+             || (l = _dl_new_object (name_copy, name, type,
+                                     loader != NULL)) == NULL)
            _dl_signal_error (ENOMEM, name,
                              "cannot create shared object descriptor");
          /* We use an opencount of 0 as a sign for the faked entry.  */
index f2ef8163ce88c43350673e52ad67b1a9444bb689..e91beac926321562c00e706cfb17c9053066d551 100644 (file)
@@ -33,7 +33,7 @@ struct link_map *_dl_default_scope[5];
 
 struct link_map *
 internal_function
-_dl_new_object (char *realname, const char *libname, int type)
+_dl_new_object (char *realname, const char *libname, int type, int find_origin)
 {
   struct link_map *new = malloc (sizeof *new);
   struct libname_list *newname = malloc (sizeof *newname);
@@ -62,9 +62,8 @@ _dl_new_object (char *realname, const char *libname, int type)
       l->l_next = new;
     }
 
-  /* The REALNAME is "" for the main link map.  This name must be determined
-     specially.  */
-  if (realname[0] == '\0')
+  /* Don't try to find the origin for the main map.  */
+  if (! find_origin)
     new->l_origin = NULL;
   else
     {
index 847d5cec12937d3e1a5fd9525de1471150d4d1f9..b36fcd87253de4068bded4773ec4008470af0aab 100644 (file)
@@ -166,7 +166,7 @@ extern void _dl_sysdep_output (int fd, const char *string, ...);
    descriptor for this.  All arguments are `const char *'; args until
    a null pointer are concatenated to form the message to print.  If
    NEW_LINE is nonzero it is assumed that the message starts on a new
-   line.*/
+   line.  */
 extern void _dl_debug_message (int new_line, const char *string, ...);
 
 /* OS-dependent function to write a message on the standard output.
@@ -356,9 +356,11 @@ extern struct link_map **_dl_object_relocation_scope (struct link_map *map)
 
 
 /* Allocate a `struct link_map' for a new object being loaded,
-   and enter it into the _dl_loaded list.  */
+   and enter it into the _dl_loaded list.  If find origin is nonzero
+   determine the origin of the file.  */
 extern struct link_map *_dl_new_object (char *realname, const char *libname,
-                                       int type) internal_function;
+                                       int type, int find_origin)
+     internal_function;
 
 /* Relocate the given object (if it hasn't already been).
    SCOPE is passed to _dl_lookup_symbol in symbol lookups.
index 3b3dfbf66940ed0135a06fee6b7dbfbfeceab51f..600f062b3ca5b0b533f6489e8509a88cde9cdee1 100644 (file)
@@ -420,7 +420,7 @@ of this helper program; chances are you did not intend to run this program.\n\
     {
       /* Create a link_map for the executable itself.
         This will be what dlopen on "" returns.  */
-      main_map = _dl_new_object ((char *) "", "", lt_executable);
+      main_map = _dl_new_object ((char *) "", "", lt_executable, 0);
       if (main_map == NULL)
        _dl_sysdep_fatal ("cannot allocate memory for link map\n", NULL);
       main_map->l_phdr = phdr;
index eef067814a21916a61271b6812d37195fe3f304b..7f7d86c4047d3e4a01aa9c7de584b4eea5da8d48 100644 (file)
@@ -30,15 +30,15 @@ get_origin (void)
   char *result;
 
   if (readlink ("/proc/self/exe", linkval, PATH_MAX) != -1
-      && result[0] != '[')
+      && linkval[0] != '[')
     {
       /* We can use this value.  */
       char *last_slash = strrchr (linkval, '/');
-      result = (char *) malloc (linkval - last_slash + 1);
+      result = (char *) malloc (last_slash - linkval + 1);
       if (result == NULL)
        result = (char *) -1;
       else
-       *((char *) __mempcpy (result, linkval, linkval - last_slash)) = '\0';
+       *((char *) __mempcpy (result, linkval, last_slash - linkval)) = '\0';
     }
   else
     {
This page took 0.051891 seconds and 5 git commands to generate.