Split out liblinker_malloc static library

Bug: http://b/14998480
Bug: http://b/25716705
Change-Id: I8c7ba3971d1b17dbfc1a2ab5553aa04fe5da6677
diff --git a/linker/Android.mk b/linker/Android.mk
index 85ac0ca..5bbe172 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -1,6 +1,20 @@
 LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
+LOCAL_CLANG := true
+
+LOCAL_MODULE := liblinker_malloc
+
+LOCAL_SRC_FILES := \
+    linker_allocator.cpp \
+    linker_memory.cpp
+
+# We need to access Bionic private headers in the linker.
+LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
+
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
 
 LOCAL_CLANG := true
 
@@ -8,11 +22,9 @@
     debugger.cpp \
     dlfcn.cpp \
     linker.cpp \
-    linker_allocator.cpp \
     linker_block_allocator.cpp \
     linker_libc_support.c \
     linker_mapped_file_fragment.cpp \
-    linker_memory.cpp \
     linker_phdr.cpp \
     linker_sdk_versions.cpp \
     linker_utils.cpp \
@@ -63,7 +75,7 @@
 
 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
-LOCAL_STATIC_LIBRARIES := libc_nomalloc libziparchive libutils libbase libz liblog
+LOCAL_STATIC_LIBRARIES := libc_nomalloc liblinker_malloc libziparchive libutils libbase libz liblog
 
 LOCAL_FORCE_STATIC_EXECUTABLE := true