Pack module before making symbolic version
We need PT_LOAD segments to match for the gdb sake.
If we pack module after stripping symbolic version
PT_LOAD differ from actual ones; this confuses gdb.
Bug: http://b/20687795
Change-Id: If7b1ffcda918d0cc47051a30ca1202007ed62403
(cherry picked from commit 258b29cf76
)
This commit is contained in:
@@ -38,6 +38,38 @@ LOCAL_INTERMEDIATE_TARGETS := $(linked_module)
|
|||||||
include $(BUILD_SYSTEM)/binary.mk
|
include $(BUILD_SYSTEM)/binary.mk
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
## Pack relocation tables
|
||||||
|
###########################################################
|
||||||
|
relocation_packer_input := $(linked_module)
|
||||||
|
relocation_packer_output := $(intermediates)/PACKED/$(my_built_module_stem)
|
||||||
|
|
||||||
|
my_pack_module_relocations := $(LOCAL_PACK_MODULE_RELOCATIONS)
|
||||||
|
|
||||||
|
ifeq ($(my_pack_module_relocations),)
|
||||||
|
my_pack_module_relocations := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PACK_MODULE_RELOCATIONS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Do not pack relocations for static executables.
|
||||||
|
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
|
||||||
|
my_pack_module_relocations := false
|
||||||
|
endif
|
||||||
|
|
||||||
|
# TODO (dimitry): Relocation packer is not yet available for darwin
|
||||||
|
ifneq ($(HOST_OS),linux)
|
||||||
|
my_pack_module_relocations := false
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (true,$(my_pack_module_relocations))
|
||||||
|
# Pack relocations
|
||||||
|
$(relocation_packer_output): $(relocation_packer_input) | $(ACP)
|
||||||
|
$(pack-elf-relocations)
|
||||||
|
else
|
||||||
|
$(relocation_packer_output): $(relocation_packer_input) | $(ACP)
|
||||||
|
@echo "target Unpacked: $(PRIVATE_MODULE) ($@)"
|
||||||
|
$(copy-file-to-target)
|
||||||
|
endif
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
## Store a copy with symbols for symbolic debugging
|
## Store a copy with symbols for symbolic debugging
|
||||||
###########################################################
|
###########################################################
|
||||||
@@ -46,7 +78,7 @@ my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(m
|
|||||||
else
|
else
|
||||||
my_unstripped_path := $(LOCAL_UNSTRIPPED_PATH)
|
my_unstripped_path := $(LOCAL_UNSTRIPPED_PATH)
|
||||||
endif
|
endif
|
||||||
symbolic_input := $(linked_module)
|
symbolic_input := $(relocation_packer_output)
|
||||||
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
|
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
|
||||||
$(symbolic_output) : $(symbolic_input) | $(ACP)
|
$(symbolic_output) : $(symbolic_input) | $(ACP)
|
||||||
@echo "target Symbolic: $(PRIVATE_MODULE) ($@)"
|
@echo "target Symbolic: $(PRIVATE_MODULE) ($@)"
|
||||||
@@ -57,7 +89,7 @@ $(symbolic_output) : $(symbolic_input) | $(ACP)
|
|||||||
## Strip
|
## Strip
|
||||||
###########################################################
|
###########################################################
|
||||||
strip_input := $(symbolic_output)
|
strip_input := $(symbolic_output)
|
||||||
strip_output := $(intermediates)/STRIPPED/$(my_built_module_stem)
|
strip_output := $(LOCAL_BUILT_MODULE)
|
||||||
|
|
||||||
my_strip_module := $(LOCAL_STRIP_MODULE)
|
my_strip_module := $(LOCAL_STRIP_MODULE)
|
||||||
ifeq ($(my_strip_module),)
|
ifeq ($(my_strip_module),)
|
||||||
@@ -107,38 +139,6 @@ $(strip_output): $(strip_input)
|
|||||||
endif
|
endif
|
||||||
endif # my_strip_module
|
endif # my_strip_module
|
||||||
|
|
||||||
###########################################################
|
|
||||||
## Pack relocation tables
|
|
||||||
###########################################################
|
|
||||||
relocation_packer_input := $(strip_output)
|
|
||||||
relocation_packer_output := $(LOCAL_BUILT_MODULE)
|
|
||||||
|
|
||||||
my_pack_module_relocations := $(LOCAL_PACK_MODULE_RELOCATIONS)
|
|
||||||
|
|
||||||
ifeq ($(my_pack_module_relocations),)
|
|
||||||
my_pack_module_relocations := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PACK_MODULE_RELOCATIONS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Do not pack relocations for static executables.
|
|
||||||
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
|
|
||||||
my_pack_module_relocations := false
|
|
||||||
endif
|
|
||||||
|
|
||||||
# TODO (dimitry): Relocation packer is not yet available for darwin
|
|
||||||
ifneq ($(HOST_OS),linux)
|
|
||||||
my_pack_module_relocations := false
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (true,$(my_pack_module_relocations))
|
|
||||||
# Pack relocations
|
|
||||||
$(relocation_packer_output): $(relocation_packer_input) | $(ACP)
|
|
||||||
$(pack-elf-relocations)
|
|
||||||
else
|
|
||||||
$(relocation_packer_output): $(relocation_packer_input) | $(ACP)
|
|
||||||
@echo "target Unpacked: $(PRIVATE_MODULE) ($@)"
|
|
||||||
$(copy-file-to-target)
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(cleantarget): PRIVATE_CLEAN_FILES += \
|
$(cleantarget): PRIVATE_CLEAN_FILES += \
|
||||||
$(linked_module) \
|
$(linked_module) \
|
||||||
$(symbolic_output) \
|
$(symbolic_output) \
|
||||||
|
Reference in New Issue
Block a user