Merge "Call __hwasan_init_static() during libc startup in statically linked executables." am: ebdf4c19f9
am: 4e1cfa62f3

Change-Id: Ibcd5a26af56030ffff96c613b0041974de016af9
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index 41f100d..b4bddce 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -202,7 +202,7 @@
   exit(slingshot(args.argc, args.argv, args.envp));
 }
 
-extern "C" void __hwasan_init();
+extern "C" void __hwasan_init_static();
 
 __attribute__((no_sanitize("hwaddress")))
 __noreturn void __libc_init(void* raw_args,
@@ -214,8 +214,9 @@
   // 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.
   __set_tls(&temp_tcb.tls_slot(0));
-  // Initialize HWASan. This sets up TLS_SLOT_SANITIZER, among other things.
-  __hwasan_init();
+  // Initialize HWASan enough to run instrumented code. This sets up TLS_SLOT_SANITIZER, among other
+  // things.
+  __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);