summaryrefslogtreecommitdiffstats
path: root/core/dynamic_binary.mk
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2015-04-20 16:59:05 -0700
committerDmitriy Ivanov <dimitry@google.com>2015-04-23 12:07:16 -0700
commit4c2d1a64fb49e706a8c7877bb40212ada78d25d7 (patch)
treed36992ba06dfdf2b7cf182a7ad72fb3f73c4314a /core/dynamic_binary.mk
parent1ff47c7f36263a701797ac76594fa45ae2d89389 (diff)
downloadbuild-4c2d1a64fb49e706a8c7877bb40212ada78d25d7.zip
build-4c2d1a64fb49e706a8c7877bb40212ada78d25d7.tar.gz
build-4c2d1a64fb49e706a8c7877bb40212ada78d25d7.tar.bz2
Pack relocation tables for dynamic executables
Add replocation-packer step for dynmic executables. Enable it by default for arm and arm64 platforms. Bug: http://b/18051137 Change-Id: I0c88fd31595bcea62a087f219acb9ecf9c80f2e5
Diffstat (limited to 'core/dynamic_binary.mk')
-rw-r--r--core/dynamic_binary.mk38
1 files changed, 35 insertions, 3 deletions
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 7a423db..fe498ed 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -57,11 +57,11 @@ $(symbolic_output) : $(symbolic_input) | $(ACP)
## Strip
###########################################################
strip_input := $(symbolic_output)
-strip_output := $(LOCAL_BUILT_MODULE)
+strip_output := $(intermediates)/STRIPPED/$(my_built_module_stem)
my_strip_module := $(LOCAL_STRIP_MODULE)
ifeq ($(my_strip_module),)
- my_strip_module := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP_MODULE)
+ my_strip_module := true
endif
$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
@@ -107,7 +107,39 @@ $(strip_output): $(strip_input)
endif
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 += \
$(linked_module) \
- $(symbolic_output)
+ $(symbolic_output) \
+ $(strip_output)