Snap for 4756844 from 00bfaca0c3c923bd8f2db0992762a15b8b79e74f to pi-release

Change-Id: I38af65fe2dbd51259cf25d7338cdc32da9cdf40a
diff --git a/Android.bp b/Android.bp
index 3b2900b..5f63861 100644
--- a/Android.bp
+++ b/Android.bp
@@ -72,6 +72,14 @@
         // Explicitly enable the write-strings warning. VIXL uses
         // const correctly when handling string constants.
         "-Wwrite-strings",
+
+        // As we can load both libvixl-arm.so and libvixl-arm64.so in the
+        // same process, and some functions are emitted in both libraries,
+        // flags for selecting implementation details for these functions
+        // must be shared to emit identical code. Otherwise we can get
+        // undefined behavior, especially with link-time optimization.
+        // b/64359573
+        "-DVIXL_CODE_BUFFER_MALLOC",
     ],
     local_include_dirs: ["src"],
     native_coverage: false,
@@ -84,7 +92,6 @@
     name: "vixl-arm",
     defaults: ["vixl-common"],
     cppflags: [
-        "-DVIXL_CODE_BUFFER_MALLOC",
         "-DVIXL_INCLUDE_TARGET_T32",
         ],
     srcs: ["src/aarch32/*.cc"],
@@ -95,7 +102,6 @@
     defaults: ["vixl-common"],
     cppflags: [
         "-DVIXL_INCLUDE_SIMULATOR_AARCH64",
-        "-DVIXL_CODE_BUFFER_MMAP",
         "-DVIXL_INCLUDE_TARGET_A64",
         ],
     srcs: ["src/aarch64/*.cc"],