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
This commit is contained in:
Jiyong Park 2019-03-18 14:23:15 +09:00
parent 0573298a18
commit a32f00e553
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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) ($@)"