From a32f00e553c1ffcd495b10d5b664e0744e53ac2c Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Mon, 18 Mar 2019 14:23:15 +0900 Subject: [PATCH] Add LOCAL_SOONG_SYMBOL_PATH The soong-only variable is used to specify the location where the symbol file is located. When unspecified, LOCAL_MODULE_PATH is used instead as before. This is needed when the path that a file is installed to is different from the path that the file is accessed from at runtime. For example, if TARGET_FLATTEN_APEX=true, a file lib/libX.so in an APEX com.android.foo is installed to /system/apex/com.android.foo/lib/libX.so. However, it's runtime path is /apex/com.android.foo/lib/libX.so as /system/apex/com.android.foo is bind-mounted to /apex/com,android.foo. Bug: 120846816 Test: m and inspect that symbol files exist under $(PRODUCT_OUT)/symbols/apex/com.android.runtime/ Change-Id: I1b39f6e0cde115d442f14380c365796feff3437b --- core/clear_vars.mk | 1 + core/soong_cc_prebuilt.mk | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 1e3f6ae437..1883743258 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -265,6 +265,7 @@ LOCAL_SOONG_PROGUARD_DICT := LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE := LOCAL_SOONG_RRO_DIRS := LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES := +LOCAL_SOONG_SYMBOL_PATH := LOCAL_SOONG_TOC := LOCAL_SOONG_UNSTRIPPED_BINARY := # '',true diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk index dd338526aa..8d248af339 100644 --- a/core/soong_cc_prebuilt.mk +++ b/core/soong_cc_prebuilt.mk @@ -121,8 +121,9 @@ endif ifndef LOCAL_IS_HOST_MODULE ifdef LOCAL_SOONG_UNSTRIPPED_BINARY + my_symbol_path := $(if $(LOCAL_SOONG_SYMBOL_PATH),$(LOCAL_SOONG_SYMBOL_PATH),$(my_module_path)) # Store a copy with symbols for symbolic debugging - my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path)) + my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path)) # drop /root as /root is mounted as / my_unstripped_path := $(patsubst $(TARGET_OUT_UNSTRIPPED)/root/%,$(TARGET_OUT_UNSTRIPPED)/%, $(my_unstripped_path)) symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem) @@ -130,7 +131,7 @@ ifndef LOCAL_IS_HOST_MODULE $(call add-dependency,$(LOCAL_BUILT_MODULE),$(symbolic_output)) ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true) - my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path)) + my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path)) breakpad_output := $(my_breakpad_path)/$(my_installed_module_stem).sym $(breakpad_output) : $(LOCAL_SOONG_UNSTRIPPED_BINARY) | $(BREAKPAD_DUMP_SYMS) $(PRIVATE_READELF) @echo "target breakpad: $(PRIVATE_MODULE) ($@)"