From 4d3d4141ae5d35cbb9fef31d606be9609411e327 Mon Sep 17 00:00:00 2001 From: Evgenii Stepanov Date: Thu, 11 Jun 2015 17:32:31 -0700 Subject: [PATCH] With SANITIZE_TARGET, move shared libraries to /data. A fully (or even mostly) asan-instrumented device will have 2 copies of each shared library, which might not fit on system partition. Moving instrumented libraries to /data. Bug: 21785137 Change-Id: I64184261da2eb24a1382c67e4931c34a5a38b3c0 --- core/clang/TARGET_arm.mk | 2 +- core/clang/TARGET_arm64.mk | 2 +- core/envsetup.mk | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/clang/TARGET_arm.mk b/core/clang/TARGET_arm.mk index 62ce2427c..1b130986a 100644 --- a/core/clang/TARGET_arm.mk +++ b/core/clang/TARGET_arm.mk @@ -69,4 +69,4 @@ $(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.p # Address sanitizer clang config $(clang_2nd_arch_prefix)ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan-arm-android -$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_RPATH := /system/lib/asan +$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_RPATH := /data/lib diff --git a/core/clang/TARGET_arm64.mk b/core/clang/TARGET_arm64.mk index ea4d93770..7900f93e5 100644 --- a/core/clang/TARGET_arm64.mk +++ b/core/clang/TARGET_arm64.mk @@ -67,4 +67,4 @@ TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-aarch64-android.a # Address sanitizer clang config ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan-arm64-android -ADDRESS_SANITIZER_RPATH := /system/lib64/asan +ADDRESS_SANITIZER_RPATH := /data/lib64 diff --git a/core/envsetup.mk b/core/envsetup.mk index daa82e1d2..688e6a492 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -275,14 +275,20 @@ TARGET_OUT_GEN := $(PRODUCT_OUT)/gen TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM) +ifeq ($(SANITIZE_TARGET),address) +target_out_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA) +else +target_out_shared_libraries_base := $(TARGET_OUT) +endif + TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin TARGET_OUT_OPTIONAL_EXECUTABLES := $(TARGET_OUT)/xbin ifeq ($(TARGET_IS_64_BIT),true) # /system/lib always contains 32-bit libraries, # and /system/lib64 (if present) always contains 64-bit libraries. -TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib64 +TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib64 else -TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib +TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib endif TARGET_OUT_JAVA_LIBRARIES := $(TARGET_OUT)/framework TARGET_OUT_APPS := $(TARGET_OUT)/app @@ -298,7 +304,7 @@ TARGET_2ND_ARCH_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX) TARGET_2ND_ARCH_MODULE_SUFFIX := $(HOST_2ND_ARCH_MODULE_SUFFIX) $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH) $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES)/lib -$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES := $(TARGET_OUT_EXECUTABLES) $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS := $(TARGET_OUT_APPS) $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT_APPS_PRIVILEGED)