aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/libc_init_dynamic.cpp
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2018-11-22 03:16:06 -0800
committerRyan Prichard <rprichard@google.com>2018-12-03 17:14:44 -0800
commit746ad15912cfa82271424747e94d8125acc43d8c (patch)
treeb0744ec1a4a69acb0f5d54b92b13a337e82f05d2 /libc/bionic/libc_init_dynamic.cpp
parentbdab4a2b97c53af0205788875342ec08e6901376 (diff)
downloadandroid_bionic-746ad15912cfa82271424747e94d8125acc43d8c.tar.gz
android_bionic-746ad15912cfa82271424747e94d8125acc43d8c.tar.bz2
android_bionic-746ad15912cfa82271424747e94d8125acc43d8c.zip
Replace TLS_SLOT_BIONIC_PREINIT w/ shared globals
Instead of passing the address of a KernelArgumentBlock to libc.so for initialization, use __loader_shared_globals() to initialize globals. Most of the work happened in the previous CLs. This CL switches a few KernelArgumentBlock::getauxval calls to [__bionic_]getauxval and stops routing the KernelArgumentBlock address through the libc init functions. Bug: none Test: bionic unit tests Change-Id: I96c7b02c21d55c454558b7a5a9243c682782f2dd
Diffstat (limited to 'libc/bionic/libc_init_dynamic.cpp')
-rw-r--r--libc/bionic/libc_init_dynamic.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
index 2ec155688..af1b84776 100644
--- a/libc/bionic/libc_init_dynamic.cpp
+++ b/libc/bionic/libc_init_dynamic.cpp
@@ -77,12 +77,12 @@ __LIBC_HIDDEN__ void* __libc_sysinfo = reinterpret_cast<void*>(__libc_int0x80);
// after __stack_chk_guard is initialized and therefore can safely have a stack
// protector.
__attribute__((noinline))
-static void __libc_preinit_impl(KernelArgumentBlock& args) {
+static void __libc_preinit_impl() {
#if defined(__i386__)
- __libc_init_sysinfo(args);
+ __libc_init_sysinfo();
#endif
- __libc_init_globals(args);
+ __libc_init_globals();
__libc_init_common();
// Hooks for various libraries to let them know that we're starting up.
@@ -98,17 +98,11 @@ static void __libc_preinit_impl(KernelArgumentBlock& args) {
// to run before any others (such as the jemalloc constructor), and lower
// is better (http://b/68046352).
__attribute__((constructor(1))) static void __libc_preinit() {
- // Read the kernel argument block pointer from TLS, then clear the slot so no
- // other initializer sees its value.
- void** tls = __get_tls();
- KernelArgumentBlock* args = static_cast<KernelArgumentBlock*>(tls[TLS_SLOT_BIONIC_PREINIT]);
- tls[TLS_SLOT_BIONIC_PREINIT] = nullptr;
-
// The linker has initialized its copy of the global stack_chk_guard, and filled in the main
// thread's TLS slot with that value. Initialize the local global stack guard with its value.
- __stack_chk_guard = reinterpret_cast<uintptr_t>(tls[TLS_SLOT_STACK_GUARD]);
+ __stack_chk_guard = reinterpret_cast<uintptr_t>(__get_tls()[TLS_SLOT_STACK_GUARD]);
- __libc_preinit_impl(*args);
+ __libc_preinit_impl();
}
// This function is called from the executable's _start entry point