]> sourceware.org Git - glibc.git/blobdiff - elf/rtld.c
handle password file locking.
[glibc.git] / elf / rtld.c
index b8aa7311ab071a31e3760cdb4b83216805bd7d45..be71e88c3cf6cab1a4eb401684f4d8c7253d9fd7 100644 (file)
@@ -42,6 +42,15 @@ int _dl_argc;
 char **_dl_argv;
 const char *_dl_rpath;
 
+/* Set nonzero during loading and initialization of executable and
+   libraries, cleared before the executable's entry point runs.  This
+   must not be initialized to nonzero, because the unused dynamic
+   linker loaded in for libc.so's "ld.so.1" dep will provide the
+   definition seen by libc.so's initializer; that value must be zero,
+   and will be since that dynamic linker's _dl_start and dl_main will
+   never be called.  */
+int _dl_starting_up;
+
 static void dl_main (const ElfW(Phdr) *phdr,
                     ElfW(Half) phent,
                     ElfW(Addr) *user_entry);
@@ -195,12 +204,15 @@ of this helper program; chances are you did not intend to run this program.\n",
            {
              l = _dl_map_object (NULL, _dl_argv[0], lt_library);
            }
-         const char *err_str = NULL;
+         char *err_str = NULL;
          const char *obj_name __attribute__ ((unused));
 
          (void) _dl_catch_error (&err_str, &obj_name, doit);
          if (err_str != NULL)
-           _exit (EXIT_FAILURE);
+           {
+             free (err_str);
+             _exit (EXIT_FAILURE);
+           }
        }
       else
        l = _dl_map_object (NULL, _dl_argv[0], lt_library);
@@ -386,7 +398,8 @@ of this helper program; chances are you did not intend to run this program.\n",
            const ElfW(Sym) *ref = NULL;
            ElfW(Addr) loadbase = _dl_lookup_symbol (_dl_argv[i], &ref,
                                                     &_dl_default_scope[2],
-                                                    "argument", 0);
+                                                    "argument",
+                                                    DL_LOOKUP_NOPLT);
            char buf[20], *bp;
            buf[sizeof buf - 1] = '\0';
            bp = _itoa (ref->st_value, &buf[sizeof buf - 1], 16, 0);
@@ -479,13 +492,17 @@ of this helper program; chances are you did not intend to run this program.\n",
         dynamic linker.  There is no additional initialization
         required for the ABI-compliant dynamic linker.  */
 
-      (*(void (*) (void)) (_dl_rtld_map.l_addr +
-                          _dl_rtld_map.l_info[DT_INIT]->d_un.d_ptr)) ();
+      (*(void (*) (int, char **, char**))
+       (_dl_rtld_map.l_addr + _dl_rtld_map.l_info[DT_INIT]->d_un.d_ptr))
+       (0, NULL, NULL);
 
       /* Clear the field so a future dlopen won't run it again.  */
       _dl_rtld_map.l_info[DT_INIT] = NULL;
     }
 
+  /* We finished the intialization and will start up.  */
+  _dl_starting_up = 1;
+
   /* Once we return, _dl_sysdep_start will invoke
      the DT_INIT functions and then *USER_ENTRY.  */
 }
This page took 0.028928 seconds and 5 git commands to generate.