Merge "libm: remove unused x86/x86_64 assembler."
diff --git a/libc/arch-common/bionic/__dso_handle_so.h b/libc/arch-common/bionic/__dso_handle_so.h
index e2c26b6..2c0df7b 100644
--- a/libc/arch-common/bionic/__dso_handle_so.h
+++ b/libc/arch-common/bionic/__dso_handle_so.h
@@ -26,4 +26,14 @@
  * SUCH DAMAGE.
  */
 
-__attribute__((__visibility__("hidden"))) void* __dso_handle = &__dso_handle;
+/*
+ * We would like __dso_handle to be:
+ *   1. A const so that if a DSO does not have any RW data, .data section can
+ *      be omitted.
+ *   2. Of type void* so that no awkward type conversion is needed when
+ *      &__dso_handle is passed to various functions, which all expect a void*.
+ * To achieve both, we do the following aliasing trick.
+ */
+static const void* const __dso_handle_const = &__dso_handle_const;
+__attribute__((__visibility__("hidden")))
+__attribute__((alias("__dso_handle_const"))) extern void* __dso_handle;
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index a8c0e36..46c91a3 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -408,6 +408,9 @@
       params.push_back({ "SDK_VER", buf });
     }
 
+    static std::string vndk = Config::get_vndk_version_string('-');
+    params.push_back({ "VNDK_VER", vndk });
+
     for (auto& path : paths) {
       format_string(&path, params);
     }