Ensure that __libc_init() never calls memset().

This isn't normally a concern: x86/x86-64 will use an xmm register, and
arm/arm64 will use a q register, but currently clang will prefer to call
memset() on riscv64. This prevented riscv64 cuttlefish from booting by
breaking all static executables.

Bug: http://b/365618934
Test: boot riscv64 cuttlefish
Change-Id: Ic8aa352b4b3559b71f871fafa023fd0a1da09e3a
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index f8f7d2a..2227856 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -473,7 +473,12 @@
 __attribute__((no_sanitize("hwaddress", "memtag"))) __noreturn void __libc_init(
     void* raw_args, void (*onexit)(void) __unused, int (*slingshot)(int, char**, char**),
     structors_array_t const* const structors) {
-  bionic_tcb temp_tcb = {};
+  // We _really_ don't want the compiler to call memset() here,
+  // but it's done so before for riscv64 (http://b/365618934),
+  // so we have to force it to behave.
+  bionic_tcb temp_tcb __attribute__((uninitialized));
+  __builtin_memset_inline(&temp_tcb, 0, sizeof(temp_tcb));
+
 #if __has_feature(hwaddress_sanitizer)
   // Install main thread TLS early. It will be initialized later in __libc_init_main_thread. For now
   // all we need is access to TLS_SLOT_SANITIZER.
@@ -483,6 +488,7 @@
   __hwasan_init_static();
   // We are ready to run HWASan-instrumented code, proceed with libc initialization...
 #endif
+
   __real_libc_init(raw_args, onexit, slingshot, structors, &temp_tcb);
 }