Disable standalone relocation packer
We only support relocation packing inside lld now, remove calls to
the standalone relocation packer. Any shared library built with
LOCAL_USE_CLANG_LLD := false will no longer have relocation packing.
This will also prevent relocation packing on prebuilt shared
libraries.
Also enables relocation packing on Darwin since lld will work on
Darwin.
Bug: 110715614
Test: m checkbuild
Change-Id: Ib4d4bc86f164d05dd78455c8e7605d4b4f5a2a77
diff --git a/core/config.mk b/core/config.mk
index 3045929..5562fe3 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -710,9 +710,6 @@
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
diff --git a/core/definitions.mk b/core/definitions.mk
index 9f958fa..6ab52f0 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1898,16 +1898,6 @@
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
###########################################################
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 939af33..2f9c8ff 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -40,28 +40,6 @@
###################################
###########################################################
-## 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
###########################################################
ifeq ($(LOCAL_UNSTRIPPED_PATH),)
@@ -69,7 +47,7 @@
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 @@
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) ($@)"
diff --git a/core/pack_dyn_relocs_setup.mk b/core/pack_dyn_relocs_setup.mk
index 2147f44..c5564b1 100644
--- a/core/pack_dyn_relocs_setup.mk
+++ b/core/pack_dyn_relocs_setup.mk
@@ -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 @@
# 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
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index d5b7877..f82af2f 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -42,9 +42,6 @@
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 @@
# 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 @@
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 ($(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)