about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2012-05-20 10:34:00 -0700
committerRichard Henderson <rth@twiddle.net>2012-05-20 10:40:35 -0700
commitc7683a6d02f3ed59f5cd119b3e8547f45a15912f (patch)
tree029e73af4f78064dc5788972d5fc3a86fc70f1d6 /elf
parenta6f1845d45d0ea9303b3c71944c0a511e23bde26 (diff)
downloadglibc-c7683a6d02f3ed59f5cd119b3e8547f45a15912f.tar.gz
glibc-c7683a6d02f3ed59f5cd119b3e8547f45a15912f.tar.xz
glibc-c7683a6d02f3ed59f5cd119b3e8547f45a15912f.zip
Add <sys/auxv.h> and getauxval.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-support.c2
-rw-r--r--elf/dl-sysdep.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/elf/dl-support.c b/elf/dl-support.c
index a0f2122071..2bb468a5fb 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -125,6 +125,7 @@ int _dl_debug_fd = STDERR_FILENO;
 
 int _dl_correct_cache_id = _DL_CACHE_DEFAULT_ID;
 
+ElfW(auxv_t) *_dl_auxv;
 ElfW(Phdr) *_dl_phdr;
 size_t _dl_phnum;
 uint64_t _dl_hwcap __attribute__ ((nocommon));
@@ -187,6 +188,7 @@ _dl_aux_init (ElfW(auxv_t) *av)
   uid_t uid = 0;
   gid_t gid = 0;
 
+  _dl_auxv = av;
   for (; av->a_type != AT_NULL; ++av)
     switch (av->a_type)
       {
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index ea505a646f..e2a9d935ab 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -61,7 +61,6 @@ int __libc_multiple_libcs = 0;	/* Defining this here avoids the inclusion
 /* This variable contains the lowest stack address ever used.  */
 void *__libc_stack_end attribute_relro = NULL;
 rtld_hidden_data_def(__libc_stack_end)
-static ElfW(auxv_t) *_dl_auxv attribute_relro;
 void *_dl_random attribute_relro = NULL;
 
 #ifndef DL_FIND_ARG_COMPONENTS
@@ -111,12 +110,12 @@ _dl_sysdep_start (void **start_argptr,
 
   __libc_stack_end = DL_STACK_END (start_argptr);
   DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, INTUSE(_dl_argv), _environ,
-			  _dl_auxv);
+			  GLRO(dl_auxv));
 
   user_entry = (ElfW(Addr)) ENTRY_POINT;
   GLRO(dl_platform) = NULL; /* Default to nothing known about the platform.  */
 
-  for (av = _dl_auxv; av->a_type != AT_NULL; set_seen (av++))
+  for (av = GLRO(dl_auxv); av->a_type != AT_NULL; set_seen (av++))
     switch (av->a_type)
       {
       case AT_PHDR:
@@ -240,7 +239,7 @@ _dl_sysdep_start (void **start_argptr,
   if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
     __libc_check_standard_fds ();
 
-  (*dl_main) (phdr, phnum, &user_entry, _dl_auxv);
+  (*dl_main) (phdr, phnum, &user_entry, GLRO(dl_auxv));
   return user_entry;
 }
 
@@ -265,7 +264,7 @@ _dl_show_auxv (void)
      close by (otherwise the array will be too large).  In case we have
      to support a platform where these requirements are not fulfilled
      some alternative implementation has to be used.  */
-  for (av = _dl_auxv; av->a_type != AT_NULL; ++av)
+  for (av = GLRO(dl_auxv); av->a_type != AT_NULL; ++av)
     {
       static const struct
       {