about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrooks Moses <bmoses@google.com>2014-06-30 16:10:29 -0700
committerBrooks Moses <bmoses@google.com>2014-06-30 16:10:29 -0700
commit4ddf6cb7a611804bd725a8f049931ea330aea4ac (patch)
tree2e1035e638c8f7fde8bdffe2bf3cd4b59b8a8057
parent007f8306a3944bdee42c0f15ac849dc8132d67f1 (diff)
downloadglibc-4ddf6cb7a611804bd725a8f049931ea330aea4ac.tar.gz
glibc-4ddf6cb7a611804bd725a8f049931ea330aea4ac.tar.xz
glibc-4ddf6cb7a611804bd725a8f049931ea330aea4ac.zip
For b/15780211, consolidate setting of __google_auxv into earliest possible location. (Forward-port of cl/69729332.)
-rw-r--r--README.google5
-rw-r--r--csu/elf-init.c12
-rw-r--r--elf/dl-support.c3
3 files changed, 8 insertions, 12 deletions
diff --git a/README.google b/README.google
index 775e6b81e8..c9c9f962da 100644
--- a/README.google
+++ b/README.google
@@ -374,3 +374,8 @@ sysdeps/x86_64/start.S
   and initialize __google_auxv in __libc_csu_init instead.
   (ppluzhnikov, google-local)
 
+csu/elf-init.c
+elf/dl-support.c
+  For b/15780211, revert local change to csu/elf-init.c and move
+  initialization of __google_auxv earlier (in the fully-static link).
+  (ppluzhnikov, google-local)
diff --git a/csu/elf-init.c b/csu/elf-init.c
index d064d6969e..5a7aa2cab3 100644
--- a/csu/elf-init.c
+++ b/csu/elf-init.c
@@ -79,18 +79,6 @@ __libc_csu_init (int argc, char **argv, char **envp)
     for (i = 0; i < size; i++)
       (*__preinit_array_start [i]) (argc, argv, envp);
   }
-
-  extern ElfW(auxv_t) *__google_auxv;  /* Defined in dl-init.c  */
-  /* _dl_init() is never called for fully-static binary.
-     Initialize __google_auxv here.  */
-  if (__google_auxv == NULL)
-    {
-      char **e;
-
-      for (e = envp; *e; ++e) /* Skip.  */;
-      __google_auxv = (ElfW(auxv_t) *) ++e;
-    }
-
 #endif
 
 #ifndef NO_INITFINI
diff --git a/elf/dl-support.c b/elf/dl-support.c
index a794a7d671..c3082ead43 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -245,6 +245,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
   uid_t uid = 0;
   gid_t gid = 0;
 
+  extern ElfW(auxv_t) *__google_auxv;
+  __google_auxv = av;
+
   _dl_auxv = av;
   for (; av->a_type != AT_NULL; ++av)
     switch (av->a_type)