Merge "Make the atomic load explicit"
diff --git a/apex/Android.bp b/apex/Android.bp
index c97eb15..8aec64a 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -60,6 +60,8 @@
     ],
     native_static_libs: [
         "libasync_safe",
+        "note_memtag_heap_async",
+        "note_memtag_heap_sync",
     ],
     native_objects: [
         "crtbegin_dynamic",
diff --git a/libc/bionic/bionic_appcompat.cpp b/libc/bionic/bionic_appcompat.cpp
index 5b31c29..dcca0da 100644
--- a/libc/bionic/bionic_appcompat.cpp
+++ b/libc/bionic/bionic_appcompat.cpp
@@ -88,4 +88,4 @@
 
   close(file);
   return 0;
-}
\ No newline at end of file
+}
diff --git a/libc/bionic/bionic_appcompat.h b/libc/bionic/bionic_appcompat.h
index 1976e0b..fd37035 100644
--- a/libc/bionic/bionic_appcompat.h
+++ b/libc/bionic/bionic_appcompat.h
@@ -41,4 +41,4 @@
 
 int get_package_name(char* buffer, const int bufferlen);
 bool should_apply_soft_mac_bind_restrictions();
-bool should_apply_soft_mac_getlink_restrictions();
\ No newline at end of file
+bool should_apply_soft_mac_getlink_restrictions();
diff --git a/libc/bionic/heap_tagging.cpp b/libc/bionic/heap_tagging.cpp
index 72f8f1d..bf73d4a 100644
--- a/libc/bionic/heap_tagging.cpp
+++ b/libc/bionic/heap_tagging.cpp
@@ -134,8 +134,12 @@
     case M_HEAP_TAGGING_LEVEL_ASYNC:
     case M_HEAP_TAGGING_LEVEL_SYNC:
       if (heap_tagging_level == M_HEAP_TAGGING_LEVEL_NONE) {
+#if !__has_feature(hwaddress_sanitizer)
+        // Suppress the error message in HWASan builds. Apps can try to enable TBI (or even MTE
+        // modes) being unaware of HWASan, fail them silently.
         error_log(
             "SetHeapTaggingLevel: re-enabling tagging after it was disabled is not supported");
+#endif
         return false;
       } else if (tag_level == M_HEAP_TAGGING_LEVEL_TBI ||
                  heap_tagging_level == M_HEAP_TAGGING_LEVEL_TBI) {
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h
index bcddddd..40846fb 100644
--- a/libc/include/android/api-level.h
+++ b/libc/include/android/api-level.h
@@ -151,6 +151,9 @@
 /** Names the "S" API level (31), for comparison against `__ANDROID_API__`. */
 #define __ANDROID_API_S__ 31
 
+/* This file is included in <features.h>, and might be used from .S files. */
+#if !defined(__ASSEMBLY__)
+
 /**
  * Returns the `targetSdkVersion` of the caller, or `__ANDROID_API_FUTURE__` if
  * there is no known target SDK version (for code not running in the context of
@@ -167,7 +170,7 @@
 
 #if __ANDROID_API__ < 29
 
-// android_get_device_api_level is a static inline before API level 29.
+/* android_get_device_api_level is a static inline before API level 29. */
 #define __BIONIC_GET_DEVICE_API_LEVEL_INLINE static __inline
 #include <bits/get_device_api_level_inlines.h>
 #undef __BIONIC_GET_DEVICE_API_LEVEL_INLINE
@@ -185,6 +188,8 @@
 
 #endif
 
+#endif /* defined(__ASSEMBLY__) */
+
 __END_DECLS
 
 /** @} */
diff --git a/libc/private/bionic_asm.h b/libc/private/bionic_asm.h
index 6d4f7d5..d68a2d6 100644
--- a/libc/private/bionic_asm.h
+++ b/libc/private/bionic_asm.h
@@ -26,8 +26,10 @@
  * SUCH DAMAGE.
  */
 
-#ifndef _PRIVATE_BIONIC_ASM_H_
-#define _PRIVATE_BIONIC_ASM_H_
+#pragma once
+
+/* https://github.com/android/ndk/issues/1422 */
+#include <features.h>
 
 #include <asm/unistd.h> /* For system call numbers. */
 #define MAX_ERRNO 4095  /* For recognizing system call error returns. */
@@ -86,5 +88,3 @@
 
 #define NOTE_GNU_PROPERTY() \
     __bionic_asm_custom_note_gnu_section()
-
-#endif
diff --git a/tools/versioner/src/Driver.cpp b/tools/versioner/src/Driver.cpp
index adf93c3..24dc5ec 100644
--- a/tools/versioner/src/Driver.cpp
+++ b/tools/versioner/src/Driver.cpp
@@ -149,7 +149,7 @@
   cmd.push_back("-");
 
   auto diags = constructDiags();
-  driver::Driver driver("versioner", llvm::sys::getDefaultTargetTriple(), *diags, vfs);
+  driver::Driver driver("versioner", llvm::sys::getDefaultTargetTriple(), *diags, "versioner", vfs);
   driver.setCheckInputsExist(false);
 
   llvm::SmallVector<const char*, 32> driver_args;