Merge "Move bionic over to GCC's 'warning' attribute."
diff --git a/libc/Android.mk b/libc/Android.mk
index 94664d1..7c098a8 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -605,10 +605,16 @@
   libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
 endif
 
+# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
+libc_crt_target_cflags := \
+    -I$(LOCAL_PATH)/include \
+    -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include \
+    -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
+
 ifeq ($(TARGET_ARCH),arm)
   libc_common_cflags += -DSOFTFLOAT
   libc_common_cflags += -fstrict-aliasing
-  libc_crt_target_cflags := -mthumb-interwork
+  libc_crt_target_cflags += -mthumb-interwork
 endif # arm
 
 ifeq ($(TARGET_ARCH),mips)
@@ -616,16 +622,16 @@
     libc_common_cflags += -DSOFTFLOAT
   endif
   libc_common_cflags += -fstrict-aliasing
-  libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
+  libc_crt_target_cflags += $(TARGET_GLOBAL_CFLAGS)
 endif # mips
 
 ifeq ($(TARGET_ARCH),x86)
-  libc_crt_target_cflags := -m32
+  libc_crt_target_cflags += -m32
   libc_crt_target_ldflags := -melf_i386
 endif # x86
 
 ifeq ($(TARGET_ARCH),x86_64)
-  libc_crt_target_cflags := -m64
+  libc_crt_target_cflags += -m64
   libc_crt_target_ldflags := -melf_x86_64
 endif # x86_64
 
@@ -636,12 +642,6 @@
     libc_common_cflags += -DANDROID_SMP=0
 endif
 
-# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
-libc_crt_target_cflags += \
-    -I$(LOCAL_PATH)/include  \
-    -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include \
-    -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
-
 # Define some common conlyflags
 libc_common_conlyflags := \
     -std=gnu99
@@ -684,7 +684,7 @@
 endif
 ifeq ($(TARGET_ARCH),mips)
     libc_crt_target_so_cflags := -fPIC
-libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.c
+    libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.c
 endif
 ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
     libc_crt_target_so_cflags := -fPIC
@@ -907,7 +907,7 @@
 # ========================================================
 # libc_bionic.a - home-grown C library code
 # ========================================================
-#
+
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(libc_bionic_src_files)
@@ -1022,12 +1022,14 @@
 LOCAL_C_INCLUDES := $(libc_common_c_includes)
 
 LOCAL_SRC_FILES := \
-	$(libc_arch_dynamic_src_files) \
-	$(libc_static_common_src_files) \
-	bionic/dlmalloc.c \
-	bionic/malloc_debug_common.cpp \
-	bionic/pthread_debug.cpp \
-	bionic/libc_init_dynamic.cpp
+    $(libc_arch_dynamic_src_files) \
+    $(libc_static_common_src_files) \
+    bionic/dlmalloc.c \
+    bionic/malloc_debug_common.cpp \
+    bionic/debug_mapinfo.cpp \
+    bionic/debug_stacktrace.cpp \
+    bionic/pthread_debug.cpp \
+    bionic/libc_init_dynamic.cpp \
 
 ifeq ($(TARGET_ARCH),arm)
 	LOCAL_NO_CRT := true
@@ -1103,8 +1105,6 @@
 # ========================================================
 # libc_malloc_debug_qemu.so
 # ========================================================
-#TODO: We do not build this library for now
-ifneq ($(TARGET_ARCH),aarch64)
 include $(CLEAR_VARS)
 
 LOCAL_CFLAGS := \
@@ -1130,7 +1130,6 @@
 
 include $(BUILD_SHARED_LIBRARY)
 
-endif	#!aarch64
 endif	#!user
 
 
diff --git a/libc/bionic/pthread_debug.cpp b/libc/bionic/pthread_debug.cpp
index 79a193d..f01f040 100644
--- a/libc/bionic/pthread_debug.cpp
+++ b/libc/bionic/pthread_debug.cpp
@@ -91,6 +91,8 @@
 the lock has been acquired.
 */
 
+#if PTHREAD_DEBUG_ENABLED
+
 // =============================================================================
 // log functions
 // =============================================================================
@@ -658,23 +660,6 @@
 
 /****************************************************************************/
 
-/* pthread_debug_init() is called from libc_init_dynamic() just
- * after system properties have been initialized
- */
-
-extern "C" __LIBC_HIDDEN__ void pthread_debug_init() {
-    char env[PROP_VALUE_MAX];
-    if (__system_property_get("debug.libc.pthread", env)) {
-        int level = atoi(env);
-        if (level) {
-            LOGI("pthread deadlock detection level %d enabled for pid %d (%s)",
-                    level, getpid(), __progname);
-            hashmap_init(&sMutexMap);
-            sPthreadDebugLevel = level;
-        }
-    }
-}
-
 /*
  * See if we were allowed to grab the lock at this time.  We do it
  * *after* acquiring the lock, rather than before, so that we can
@@ -712,3 +697,21 @@
     remove_most_recently_locked(object);
     mutex_unlock_checked(object);
 }
+
+#endif // PTHREAD_DEBUG_ENABLED
+
+// Called from libc_init_dynamic() just after system properties have been initialized.
+extern "C" __LIBC_HIDDEN__ void pthread_debug_init() {
+#if PTHREAD_DEBUG_ENABLED
+    char env[PROP_VALUE_MAX];
+    if (__system_property_get("debug.libc.pthread", env)) {
+        int level = atoi(env);
+        if (level) {
+            LOGI("pthread deadlock detection level %d enabled for pid %d (%s)",
+                    level, getpid(), __progname);
+            hashmap_init(&sMutexMap);
+            sPthreadDebugLevel = level;
+        }
+    }
+#endif
+}
diff --git a/tests/Android.mk b/tests/Android.mk
index a342be7..0a4db91 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -14,7 +14,7 @@
 # limitations under the License.
 #
 
-ifneq ($(BUILD_TINY_ANDROID), true)
+ifneq ($(BUILD_TINY_ANDROID),true)
 
 LOCAL_PATH := $(call my-dir)