OSDN Git Service

Revert "Revert "Split out liblinker_malloc static library""
authorDimitry Ivanov <dimitry@google.com>
Tue, 16 Feb 2016 18:13:42 +0000 (10:13 -0800)
committerDimitry Ivanov <dimitry@google.com>
Tue, 16 Feb 2016 22:43:12 +0000 (14:43 -0800)
This reverts commit 3bbeca7a1ae3d31cddd97fb6a0140c4cf7e39f8e.

Change-Id: I5a757fcd52a14442c2eb7ca53f7d1f1923a4efe9

linker/Android.mk
linker/tests/Android.mk

index 85ac0ca..b940690 100644 (file)
@@ -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 @@ LOCAL_SRC_FILES := \
     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 \
@@ -65,6 +77,10 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_STATIC_LIBRARIES := libc_nomalloc libziparchive libutils libbase libz liblog
 
+# Important: The liblinker_malloc should be the last library in the list
+# to overwrite any other malloc implementations by other static libraries.
+LOCAL_STATIC_LIBRARIES += liblinker_malloc
+
 LOCAL_FORCE_STATIC_EXECUTABLE := true
 
 LOCAL_MODULE := linker
index a061877..e9f43e9 100644 (file)
@@ -32,11 +32,12 @@ LOCAL_SRC_FILES := \
   linker_block_allocator_test.cpp \
   ../linker_block_allocator.cpp \
   linker_memory_allocator_test.cpp \
-  ../linker_allocator.cpp \
   linker_utils_test.cpp \
   ../linker_utils.cpp
 
 # for __libc_fatal
 LOCAL_SRC_FILES += ../../libc/bionic/libc_logging.cpp
 
+LOCAL_STATIC_LIBRARIES := liblinker_malloc
+
 include $(BUILD_NATIVE_TEST)