Merge "Disable standalone relocation packer"

am: effbc370dc

Change-Id: Ie72c24415f13f0960413f61d515b793ab780125a
This commit is contained in:
Colin Cross 2018-06-26 10:50:11 -07:00 committed by android-build-merger
commit bbbcf1c01e
5 changed files with 9 additions and 62 deletions

View File

@ -716,9 +716,6 @@ DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump2$(BUILD_EXECUTABLE_SUFFIX)
PROFMAN := $(HOST_OUT_EXECUTABLES)/profman
HIDDENAPI := $(HOST_OUT_EXECUTABLES)/hiddenapi
# relocation packer
RELOCATION_PACKER := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/relocation_packer/relocation_packer
FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin
FINDBUGS := $(FINDBUGS_DIR)/findbugs

View File

@ -1900,16 +1900,6 @@ $(hide) $(PRIVATE_OBJCOPY_ADD_SECTION) \
$(TARGET_STRIP_KEEP_SYMBOLS_EXTRA) $< $@
endef
###########################################################
## Commands for packing a target executable or library
###########################################################
define pack-elf-relocations
@echo "$($(PRIVATE_PREFIX)DISPLAY) Pack Relocations: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
$(hide) $(RELOCATION_PACKER) $@
endef
###########################################################
## Commands for running gcc to link an executable
###########################################################

View File

@ -39,28 +39,6 @@ include $(BUILD_SYSTEM)/use_lld_setup.mk
include $(BUILD_SYSTEM)/binary.mk
###################################
###########################################################
## Pack relocation tables
###########################################################
relocation_packer_input := $(linked_module)
relocation_packer_output := $(intermediates)/PACKED/$(my_built_module_stem)
include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
# Stand-alone relocation_packer does not work with LLD output,
# but it can be replaced by lld's --pack-dyn-relocs=android.
ifeq (true,$(my_pack_module_relocations))
ifeq (false,$(my_use_clang_lld))
# Pack relocations
$(relocation_packer_output): $(relocation_packer_input)
$(pack-elf-relocations)
else
relocation_packer_output := $(relocation_packer_input)
endif # my_use_clang_lld
else
relocation_packer_output := $(relocation_packer_input)
endif # my_pack_module_relocations
###########################################################
## Store a copy with symbols for symbolic debugging
###########################################################
@ -69,7 +47,7 @@ my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(m
else
my_unstripped_path := $(LOCAL_UNSTRIPPED_PATH)
endif
symbolic_input := $(relocation_packer_output)
symbolic_input := $(linked_module)
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
$(symbolic_output) : $(symbolic_input)
@echo "target Symbolic: $(PRIVATE_MODULE) ($@)"
@ -81,7 +59,7 @@ $(symbolic_output) : $(symbolic_input)
ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
breakpad_input := $(relocation_packer_output)
breakpad_input := $(linked_module)
breakpad_output := $(my_breakpad_path)/$(my_installed_module_stem).sym
$(breakpad_output) : $(breakpad_input) | $(BREAKPAD_DUMP_SYMS) $(PRIVATE_READELF)
@echo "target breakpad: $(PRIVATE_MODULE) ($@)"

View File

@ -5,6 +5,7 @@
## LOCAL_PACK_MODULE_RELOCATIONS*,
## *TARGET_PACK_MODULE_RELOCATIONS,
## LOCAL_MODULE_CLASS, HOST_OS
## LOCAL_IS_HOST_MODULE
## Output variables:
## my_pack_module_relocations, if false skip relocation_packer
#############################################################
@ -23,11 +24,11 @@ endif
# Do not pack relocations for executables. Because packing results in
# non-zero p_vaddr which causes kernel to load executables to lower
# address (starting at 0x8000) http://b/20665974
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
ifeq ($(filter SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
my_pack_module_relocations := false
endif
# TODO (dimitry): Relocation packer is not yet available for darwin
ifneq ($(HOST_OS),linux)
ifdef LOCAL_IS_HOST_MODULE
# Do not pack relocations on host modules
my_pack_module_relocations := false
endif

View File

@ -42,9 +42,6 @@ LOCAL_CHECKED_MODULE := $(my_prebuilt_src_file)
my_strip_module := $(firstword \
$(LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
$(LOCAL_STRIP_MODULE))
my_pack_module_relocations := $(firstword \
$(LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
$(LOCAL_PACK_MODULE_RELOCATIONS))
ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
# LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES indicates that this prebuilt should be
@ -63,21 +60,6 @@ ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
# Strip but not try to add debuglink
my_strip_module := no_debuglink
endif
ifeq ($(LOCAL_IS_HOST_MODULE)$(my_pack_module_relocations),)
# Do not pack relocations by default
my_pack_module_relocations := false
endif
ifeq ($(DISABLE_RELOCATION_PACKER),true)
my_pack_module_relocations := false
endif
# Relocation packer does not work with LLD yet.
# my_use_clang_lld might be used before being set up in binary.mk
ifeq ($(my_use_clang_lld),true)
my_pack_module_relocations := false
endif
endif
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
@ -141,7 +123,7 @@ $(error $(LOCAL_MODULE) : LOCAL_COMPRESSED_MODULE can only be defined for module
endif # LOCAL_COMPRESSED_MODULE
endif
ifneq ($(filter true keep_symbols no_debuglink mini-debug-info,$(my_strip_module) $(my_pack_module_relocations)),)
ifneq ($(filter true keep_symbols no_debuglink mini-debug-info,$(my_strip_module)),)
ifdef LOCAL_IS_HOST_MODULE
$(error Cannot strip/pack host module LOCAL_PATH=$(LOCAL_PATH))
endif
@ -151,13 +133,12 @@ ifneq ($(filter true keep_symbols no_debuglink mini-debug-info,$(my_strip_module
ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
$(error Cannot strip/pack scripts LOCAL_PATH=$(LOCAL_PATH))
endif
# Set the arch-specific variables to set up the strip/pack rules.
# Set the arch-specific variables to set up the strip rules
LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) := $(my_strip_module)
LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) := $(my_pack_module_relocations)
include $(BUILD_SYSTEM)/dynamic_binary.mk
built_module := $(linked_module)
else # my_strip_module and my_pack_module_relocations not true
else # my_strip_module not true
include $(BUILD_SYSTEM)/base_rules.mk
built_module := $(LOCAL_BUILT_MODULE)