aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2016-02-16 10:13:42 -0800
committerDimitry Ivanov <dimitry@google.com>2016-02-16 14:43:12 -0800
commitaa9cb26ead0cb875075fb0c5cf78020c14daaff7 (patch)
treeca08d0fe9e2aac83d26b8e4c0bcc7e9300de167f
parent85665af917c74ff88668c1c1bffe5455e9f779cc (diff)
downloadbionic-aa9cb26ead0cb875075fb0c5cf78020c14daaff7.tar.gz
Revert "Revert "Split out liblinker_malloc static library""
This reverts commit 3bbeca7a1ae3d31cddd97fb6a0140c4cf7e39f8e. Change-Id: I5a757fcd52a14442c2eb7ca53f7d1f1923a4efe9
-rw-r--r--linker/Android.mk20
-rw-r--r--linker/tests/Android.mk3
2 files changed, 20 insertions, 3 deletions
diff --git a/linker/Android.mk b/linker/Android.mk
index 85ac0caf4..b940690af 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 @@ 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
diff --git a/linker/tests/Android.mk b/linker/tests/Android.mk
index a0618771f..e9f43e9f3 100644
--- a/linker/tests/Android.mk
+++ b/linker/tests/Android.mk
@@ -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)