Use shared globals so getauxval works earlier
Make getauxval() work in .preinit_array. It still won't be usable for
ifuncs unless we can guarantee that the __loader_shared_globals relocation
is resolved before the ifunc calls [__bionic_]getauxval.
Define __bionic_getauxval for use in replacing calls to
KernelArgumentBlock::getauxval, which doesn't (and sometimes isn't allowed
to) access TLS variables like errno.
Bug: http://b/25751302
Test: bionic unit tests
Change-Id: I461feeaed7f43cfa2a2b6c34147194f0df82b516
Merged-In: I461feeaed7f43cfa2a2b6c34147194f0df82b516
(cherry picked from commit bdab4a2b97c53af0205788875342ec08e6901376)
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
index 906d569..9c74d92 100644
--- a/libc/private/bionic_globals.h
+++ b/libc/private/bionic_globals.h
@@ -30,6 +30,7 @@
#define _PRIVATE_BIONIC_GLOBALS_H
#include <sys/cdefs.h>
+#include <link.h>
#include <pthread.h>
#include "private/bionic_fdsan.h"
@@ -56,6 +57,8 @@
// the program it's loading. Typically 0, sometimes 1.
int initial_linker_arg_count;
+ ElfW(auxv_t)* auxv;
+
pthread_mutex_t abort_msg_lock;
abort_msg_t* abort_msg;