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/private/bionic_arc4random.h b/libc/private/bionic_arc4random.h
index 0e9376e..cdc9b6d 100644
--- a/libc/private/bionic_arc4random.h
+++ b/libc/private/bionic_arc4random.h
@@ -31,13 +31,11 @@
 
 #include <stddef.h>
 
-#include "private/KernelArgumentBlock.h"
-
 // arc4random(3) aborts if it's unable to fetch entropy, which is always
 // the case for init on devices. GCE kernels have a workaround to ensure
 // sufficient entropy during early boot, but no device kernels do. This
 // wrapper falls back to AT_RANDOM if the kernel doesn't have enough
 // entropy for getrandom(2) or /dev/urandom.
-void __libc_safe_arc4random_buf(void* buf, size_t n, KernelArgumentBlock& args);
+void __libc_safe_arc4random_buf(void* buf, size_t n);
 
 #endif
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
index 9c74d92..ba510b1 100644
--- a/libc/private/bionic_globals.h
+++ b/libc/private/bionic_globals.h
@@ -70,14 +70,13 @@
 __LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals();
 __LIBC_HIDDEN__ void __libc_init_fdsan();
 
-class KernelArgumentBlock;
 __LIBC_HIDDEN__ void __libc_init_malloc(libc_globals* globals);
-__LIBC_HIDDEN__ void __libc_init_setjmp_cookie(libc_globals* globals, KernelArgumentBlock& args);
-__LIBC_HIDDEN__ void __libc_init_vdso(libc_globals* globals, KernelArgumentBlock& args);
+__LIBC_HIDDEN__ void __libc_init_setjmp_cookie(libc_globals* globals);
+__LIBC_HIDDEN__ void __libc_init_vdso(libc_globals* globals);
 
 #if defined(__i386__)
 __LIBC_HIDDEN__ extern void* __libc_sysinfo;
-__LIBC_HIDDEN__ void __libc_init_sysinfo(KernelArgumentBlock& args);
+__LIBC_HIDDEN__ void __libc_init_sysinfo();
 #endif
 
 #endif
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index f65de34..80dc9bc 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -63,12 +63,6 @@
   TLS_SLOT_OPENGL_API = 3,
   TLS_SLOT_OPENGL = 4,
 
-  // This slot is only used to pass information from the dynamic linker to
-  // libc.so when the C library is loaded in to memory. The C runtime init
-  // function will then clear it. Since its use is extremely temporary,
-  // we reuse an existing location that isn't needed during libc startup.
-  TLS_SLOT_BIONIC_PREINIT = TLS_SLOT_OPENGL_API,
-
   TLS_SLOT_STACK_GUARD = 5, // GCC requires this specific slot for x86.
   TLS_SLOT_DLERROR,
 
@@ -133,7 +127,7 @@
 #if defined(__cplusplus)
 class KernelArgumentBlock;
 extern void __libc_init_main_thread_early(KernelArgumentBlock& args);
-extern void __libc_init_main_thread_late(KernelArgumentBlock& args);
+extern void __libc_init_main_thread_late();
 #endif
 
 #endif /* __BIONIC_PRIVATE_BIONIC_TLS_H_ */