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
Merged-In: I96c7b02c21d55c454558b7a5a9243c682782f2dd
(cherry picked from commit 746ad15912cfa82271424747e94d8125acc43d8c)
diff --git a/libc/bionic/__libc_init_main_thread.cpp b/libc/bionic/__libc_init_main_thread.cpp
index e6e0c56..5abdc07 100644
--- a/libc/bionic/__libc_init_main_thread.cpp
+++ b/libc/bionic/__libc_init_main_thread.cpp
@@ -72,7 +72,7 @@
void __libc_init_main_thread_early(KernelArgumentBlock& args) {
__libc_shared_globals()->auxv = args.auxv;
#if defined(__i386__)
- __libc_init_sysinfo(args);
+ __libc_init_sysinfo();
#endif
__set_tls(main_thread.tls);
__init_tls(&main_thread);
@@ -82,7 +82,7 @@
// Finish initializing the main thread.
__BIONIC_WEAK_FOR_NATIVE_BRIDGE
-void __libc_init_main_thread_late(KernelArgumentBlock& args) {
+void __libc_init_main_thread_late() {
main_thread.bionic_tls = __allocate_bionic_tls();
if (main_thread.bionic_tls == nullptr) {
// Avoid strerror because it might need bionic_tls.
@@ -109,7 +109,7 @@
// The TLS stack guard is set from the global, so ensure that we've initialized the global
// before we initialize the TLS. Dynamic executables will initialize their copy of the global
// stack protector from the one in the main thread's TLS.
- __libc_safe_arc4random_buf(&__stack_chk_guard, sizeof(__stack_chk_guard), args);
+ __libc_safe_arc4random_buf(&__stack_chk_guard, sizeof(__stack_chk_guard));
__init_tls_stack_guard(&main_thread);
__init_thread(&main_thread);