about summary refs log tree commit diff
path: root/elf/dl-init.c
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2014-02-28 16:47:23 -0800
committerPaul Pluzhnikov <ppluzhnikov@google.com>2014-02-28 16:47:23 -0800
commit8623844f33fa66a4ad37fa6986e2c1ebbb0d5c84 (patch)
tree1cf67f2888991f00a3ea9a36438f63e6f2e7e754 /elf/dl-init.c
parentdc8069787afab19e6e278722a92568977fc4e15d (diff)
downloadglibc-8623844f33fa66a4ad37fa6986e2c1ebbb0d5c84.tar.gz
glibc-8623844f33fa66a4ad37fa6986e2c1ebbb0d5c84.tar.xz
glibc-8623844f33fa66a4ad37fa6986e2c1ebbb0d5c84.zip
Add __google_auxv. Forward-ported from cl/51271693 (from cl/38027-p2).
Diffstat (limited to 'elf/dl-init.c')
-rw-r--r--elf/dl-init.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/elf/dl-init.c b/elf/dl-init.c
index 28a6ff6d8a..d30ab4e284 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -80,6 +80,8 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
 }
 
 
+ElfW(auxv_t) *__google_auxv;
+
 void
 internal_function
 _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
@@ -88,6 +90,17 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
   ElfW(Dyn) *preinit_array_size = main_map->l_info[DT_PREINIT_ARRAYSZ];
   unsigned int i;
 
+  /* _dl_init is called from _dl_start_user during loader startup.
+     It is also called from dl_open_worker.
+     Prevent multiple initialization of __google_auxv.  */
+  if (__google_auxv == NULL)
+    {
+      char **e;
+
+      for (e = env; *e; ++e) /* Skip.  */;
+      __google_auxv = (ElfW(auxv_t) *) ++e;
+    }
+
   if (__builtin_expect (GL(dl_initfirst) != NULL, 0))
     {
       call_init (GL(dl_initfirst), argc, argv, env);