Merge "Fix file-check-cxx to handle quoted arguments"
diff --git a/libc/Android.bp b/libc/Android.bp
index 507f6e4..2429634 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1926,7 +1926,7 @@
     // special for arm
     arch: {
         arm: {
-            //TODO: This is to work around b/19059885. Remove after root cause is fixed
+            //TODO: This is to work around b/24465209. Remove after root cause is fixed
             ldflags: ["-Wl,--hash-style=both"],
 
             shared: {
@@ -1941,7 +1941,7 @@
             ],
         },
         x86: {
-            //TODO: This is to work around b/19059885. Remove after root cause is fixed
+            //TODO: This is to work around b/24465209. Remove after root cause is fixed
             ldflags: ["-Wl,--hash-style=both"],
         },
         x86_64: {
@@ -2080,7 +2080,7 @@
     sanitize: ["never"],
     native_coverage: bionic_coverage,
 
-    //TODO: This is to work around b/19059885. Remove after root cause is fixed
+    //TODO: This is to work around b/24465209. Remove after root cause is fixed
     arch: {
         arm: {
             ldflags: ["-Wl,--hash-style=both"],
diff --git a/libc/Android.mk b/libc/Android.mk
index 3435c3f..6919fbb 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -1391,7 +1391,7 @@
 # prevent the build system from using this flag.
 LOCAL_NO_EXCLUDE_LIBS := true
 
-# TODO: This is to work around b/19059885. Remove after root cause is fixed
+# TODO: This is to work around b/24465209. Remove after root cause is fixed
 LOCAL_LDFLAGS_arm := -Wl,--hash-style=both
 LOCAL_LDFLAGS_x86 := -Wl,--hash-style=both
 
@@ -1531,7 +1531,7 @@
 LOCAL_CFLAGS := $(libc_common_cflags)
 LOCAL_CPPFLAGS := $(libc_common_cppflags)
 
-# TODO: This is to work around b/19059885. Remove after root cause is fixed
+# TODO: This is to work around b/24465209. Remove after root cause is fixed
 LOCAL_LDFLAGS_arm := -Wl,--hash-style=both
 LOCAL_LDFLAGS_x86 := -Wl,--hash-style=both
 
diff --git a/libc/arch-arm/cortex-a53.a57/cortex-a53.a57.mk b/libc/arch-arm/cortex-a53.a57/cortex-a53.a57.mk
new file mode 100644
index 0000000..0eec165
--- /dev/null
+++ b/libc/arch-arm/cortex-a53.a57/cortex-a53.a57.mk
@@ -0,0 +1,21 @@
+# This file represents the best optimized routines that are the middle
+# ground when running on a big/little system that is cortex-a57/cortex-a53.
+# The cortex-a7 optimized routines, and the cortex-a53 optimized routines
+# decrease performance on cortex-a57 processors by as much as 20%.
+
+libc_bionic_src_files_arm += \
+    arch-arm/cortex-a15/bionic/memcpy.S \
+    arch-arm/cortex-a15/bionic/memset.S \
+    arch-arm/cortex-a15/bionic/stpcpy.S \
+    arch-arm/cortex-a15/bionic/strcat.S \
+    arch-arm/cortex-a15/bionic/__strcat_chk.S \
+    arch-arm/cortex-a15/bionic/strcmp.S \
+    arch-arm/cortex-a15/bionic/strcpy.S \
+    arch-arm/cortex-a15/bionic/__strcpy_chk.S \
+    arch-arm/cortex-a15/bionic/strlen.S \
+
+libc_bionic_src_files_arm += \
+    arch-arm/generic/bionic/memcmp.S \
+
+libc_bionic_src_files_arm += \
+    arch-arm/denver/bionic/memmove.S \
diff --git a/libm/Android.mk b/libm/Android.mk
index d447417..fb8df07 100644
--- a/libm/Android.mk
+++ b/libm/Android.mk
@@ -514,7 +514,7 @@
 
 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/libm.map
 
-# TODO: This is to work around b/19059885. Remove after root cause is fixed
+# TODO: This is to work around b/24465209. Remove after root cause is fixed
 LOCAL_LDFLAGS_arm := -Wl,--hash-style=both
 LOCAL_LDFLAGS_x86 := -Wl,--hash-style=both
 
diff --git a/linker/Android.mk b/linker/Android.mk
index d8487d3..a962c76 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -35,8 +35,8 @@
     -fvisibility=hidden \
     -Wall -Wextra -Wunused -Werror \
 
-LOCAL_CFLAGS_arm += -D__work_around_b_19059885__
-LOCAL_CFLAGS_x86 += -D__work_around_b_19059885__
+LOCAL_CFLAGS_arm += -D__work_around_b_24465209__
+LOCAL_CFLAGS_x86 += -D__work_around_b_24465209__
 
 LOCAL_CONLYFLAGS += \
     -std=gnu99 \
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 3967ad5..7421b1d 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1656,7 +1656,7 @@
           }
         }
       } else {
-#if !defined(__work_around_b_19059885__)
+#if !defined(__work_around_b_24465209__)
         __libc_fatal("soinfo for \"%s\"@%p has no version", si->get_realpath(), si);
 #else
         PRINT("warning: soinfo for \"%s\"@%p has no version", si->get_realpath(), si);
@@ -2435,7 +2435,7 @@
 }
 
 const char* soinfo::get_realpath() const {
-#if defined(__work_around_b_19059885__)
+#if defined(__work_around_b_24465209__)
   if (has_min_version(2)) {
     return realpath_.c_str();
   } else {
@@ -2447,7 +2447,7 @@
 }
 
 const char* soinfo::get_soname() const {
-#if defined(__work_around_b_19059885__)
+#if defined(__work_around_b_24465209__)
   if (has_min_version(2)) {
     return soname_;
   } else {
@@ -2978,7 +2978,7 @@
     switch (d->d_tag) {
       case DT_SONAME:
         soname_ = get_string(d->d_un.d_val);
-#if defined(__work_around_b_19059885__)
+#if defined(__work_around_b_24465209__)
         strlcpy(old_name_, soname_, sizeof(old_name_));
 #endif
         break;
diff --git a/linker/linker.h b/linker/linker.h
index 6f8bf1f..39d3ff1 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -88,7 +88,7 @@
 
 #define SOINFO_VERSION 2
 
-#if defined(__work_around_b_19059885__)
+#if defined(__work_around_b_24465209__)
 #define SOINFO_NAME_LEN 128
 #endif
 
@@ -163,7 +163,7 @@
 struct soinfo {
  public:
   typedef LinkedList<soinfo, SoinfoListAllocator> soinfo_list_t;
-#if defined(__work_around_b_19059885__)
+#if defined(__work_around_b_24465209__)
  private:
   char old_name_[SOINFO_NAME_LEN];
 #endif
@@ -174,13 +174,13 @@
   ElfW(Addr) base;
   size_t size;
 
-#if defined(__work_around_b_19059885__)
+#if defined(__work_around_b_24465209__)
   uint32_t unused1;  // DO NOT USE, maintained for compatibility.
 #endif
 
   ElfW(Dyn)* dynamic;
 
-#if defined(__work_around_b_19059885__)
+#if defined(__work_around_b_24465209__)
   uint32_t unused2; // DO NOT USE, maintained for compatibility
   uint32_t unused3; // DO NOT USE, maintained for compatibility
 #endif
@@ -298,7 +298,7 @@
   bool is_gnu_hash() const;
 
   bool inline has_min_version(uint32_t min_version __unused) const {
-#if defined(__work_around_b_19059885__)
+#if defined(__work_around_b_24465209__)
     return (flags_ & FLAG_NEW_SOINFO) != 0 && version_ >= min_version;
 #else
     return true;
diff --git a/tests/Android.mk b/tests/Android.mk
index e964a03..262be64 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -253,7 +253,12 @@
 
 libBionicCtsGtestMain_cflags := $(test_cflags)
 
-libBionicCtsGtestMain_cppflags := $(test_cppflags) -DUSING_GTEST_OUTPUT_FORMAT
+libBionicCtsGtestMain_cppflags := $(test_cppflags) -DUSING_GTEST_OUTPUT_FORMAT \
+
+# Temporarily fix the job count to 1 for CTS since on some devices the
+# number of online cores is incorrectly read as the total number of cores
+# in the system. When b/24376925 is fixed, this should be removed.
+libBionicCtsGtestMain_cppflags += -DJOB_COUNT_FIXED=1
 
 module := libBionicCtsGtestMain
 module_tag := optional
@@ -420,6 +425,8 @@
 LOCAL_CLANG := false
 LOCAL_MODULE := bionic-compile-time-tests-g++
 LOCAL_CPPFLAGS := -Wall
+# Disable color diagnostics so the warnings output matches the source
+LOCAL_CPPFLAGS +=  -fdiagnostics-color=never
 LOCAL_SRC_FILES := fortify_compilation_test.cpp
 include $(BUILD_STATIC_LIBRARY)
 
@@ -437,6 +444,8 @@
 LOCAL_CLANG := true
 LOCAL_MODULE := bionic-compile-time-tests-clang++
 LOCAL_CPPFLAGS := -Wall
+# Disable color diagnostics so the warnings output matches the source
+LOCAL_CPPFLAGS += -fno-color-diagnostics
 # FileCheck will error if there aren't any CLANG: lines in the file, but there
 # don't appear to be any cases where clang _does_ emit warnings for sn?printf :(
 LOCAL_SRC_FILES :=
@@ -450,6 +459,7 @@
 # Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
 # Use the current target out directory as ANDROID_DATA.
 # BIONIC_TEST_FLAGS is either empty or it comes from the user.
+.PHONY: bionic-unit-tests-glibc-run
 bionic-unit-tests-glibc-run: bionic-unit-tests-glibc
 	mkdir -p $(TARGET_OUT_DATA)/local/tmp
 	ANDROID_DATA=$(TARGET_OUT_DATA) \
@@ -467,6 +477,7 @@
 TEST_TIMEOUT := 0
 
 # BIONIC_TEST_FLAGS is either empty or it comes from the user.
+.PHONY: bionic-unit-tests-run-on-host32
 bionic-unit-tests-run-on-host32: bionic-unit-tests bionic-prepare-run-on-host
 	ANDROID_DATA=$(TARGET_OUT_DATA) \
 	ANDROID_DNS_MODE=local \
@@ -476,6 +487,7 @@
 
 ifeq ($(TARGET_IS_64_BIT),true)
 # add target to run lp64 tests
+.PHONY: bionic-unit-tests-run-on-host64
 bionic-unit-tests-run-on-host64: bionic-unit-tests bionic-prepare-run-on-host
 	ANDROID_DATA=$(TARGET_OUT_DATA) \
 	ANDROID_DNS_MODE=local \
diff --git a/tests/gtest_main.cpp b/tests/gtest_main.cpp
index 6788a5d..dd2dece 100644
--- a/tests/gtest_main.cpp
+++ b/tests/gtest_main.cpp
@@ -69,7 +69,7 @@
 using testing::internal::COLOR_YELLOW;
 using testing::internal::ColoredPrintf;
 
-constexpr int DEFAULT_GLOBAL_TEST_RUN_DEADLINE_MS = 60000;
+constexpr int DEFAULT_GLOBAL_TEST_RUN_DEADLINE_MS = 90000;
 constexpr int DEFAULT_GLOBAL_TEST_RUN_WARNLINE_MS = 2000;
 
 // The time each test can run before killed for the reason of timeout.
@@ -877,8 +877,12 @@
   return all_tests_passed;
 }
 
-static size_t GetProcessorCount() {
+static size_t GetDefaultJobCount() {
+#if defined(JOB_COUNT_FIXED)
+  return JOB_COUNT_FIXED;
+#else
   return static_cast<size_t>(sysconf(_SC_NPROCESSORS_ONLN));
+#endif
 }
 
 static void AddPathSeparatorInTestProgramPath(std::vector<char*>& args) {
@@ -988,7 +992,7 @@
   }
 
   // Init default isolation test options.
-  options.job_count = GetProcessorCount();
+  options.job_count = GetDefaultJobCount();
   options.test_deadline_ms = DEFAULT_GLOBAL_TEST_RUN_DEADLINE_MS;
   options.test_warnline_ms = DEFAULT_GLOBAL_TEST_RUN_WARNLINE_MS;
   options.gtest_color = testing::GTEST_FLAG(color);