am b7b27621: am 64119a7f: am ec6a9773: Merge "Pack relocation tables for all dynamic executables"

* commit 'b7b27621383a2360520f178c2b510f244e16fe86':
  Pack relocation tables for all dynamic executables
This commit is contained in:
Dmitriy Ivanov 2015-04-23 02:56:53 +00:00 committed by Android Git Automerger
commit ff084258ea
10 changed files with 45 additions and 15 deletions

View File

@ -93,6 +93,7 @@ LOCAL_COPY_HEADERS:=
LOCAL_FORCE_STATIC_EXECUTABLE:= LOCAL_FORCE_STATIC_EXECUTABLE:=
LOCAL_ADDITIONAL_DEPENDENCIES:= LOCAL_ADDITIONAL_DEPENDENCIES:=
LOCAL_STRIP_MODULE:= LOCAL_STRIP_MODULE:=
LOCAL_PACK_MODULE_RELOCATIONS:=
LOCAL_JNI_SHARED_LIBRARIES:= LOCAL_JNI_SHARED_LIBRARIES:=
LOCAL_JNI_SHARED_LIBRARIES_ABI:= LOCAL_JNI_SHARED_LIBRARIES_ABI:=
LOCAL_PREBUILT_JNI_LIBS:= LOCAL_PREBUILT_JNI_LIBS:=

View File

@ -188,8 +188,6 @@ $(combo_2nd_arch_prefix)TARGET_CRTEND_O := $($(combo_2nd_arch_prefix)TARGET_OUT_
$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o $(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
$(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o $(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm $(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
$(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker $(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker

View File

@ -158,8 +158,6 @@ TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
TARGET_STRIP_MODULE:=true
TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
TARGET_LINKER := /system/bin/linker64 TARGET_LINKER := /system/bin/linker64

View File

@ -162,8 +162,6 @@ $(combo_2nd_arch_prefix)TARGET_CRTEND_O := $($(combo_2nd_arch_prefix)TARGET_OUT_
$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o $(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
$(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o $(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm $(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
$(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker $(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker

View File

@ -169,8 +169,6 @@ TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
TARGET_STRIP_MODULE:=true
TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
TARGET_LINKER := /system/bin/linker64 TARGET_LINKER := /system/bin/linker64

View File

@ -142,8 +142,6 @@ $(combo_2nd_arch_prefix)TARGET_CRTEND_O := $($(combo_2nd_arch_prefix)TARGET_OUT_
$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o $(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
$(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o $(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm $(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
$(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker $(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker

View File

@ -151,8 +151,6 @@ TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
TARGET_STRIP_MODULE:=true
TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
TARGET_LINKER := /system/bin/linker64 TARGET_LINKER := /system/bin/linker64

View File

@ -425,6 +425,10 @@ ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX)
# dx is java behind a shell script; no .exe necessary. # dx is java behind a shell script; no .exe necessary.
DX := $(HOST_OUT_EXECUTABLES)/dx DX := $(HOST_OUT_EXECUTABLES)/dx
ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX) ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX)
# relocation packer
RELOCATION_PACKER := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/relocation_packer/relocation_packer
FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin
FINDBUGS := $(FINDBUGS_DIR)/findbugs FINDBUGS := $(FINDBUGS_DIR)/findbugs
EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX) EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX)

View File

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

View File

@ -57,11 +57,11 @@ $(symbolic_output) : $(symbolic_input) | $(ACP)
## Strip ## Strip
########################################################### ###########################################################
strip_input := $(symbolic_output) strip_input := $(symbolic_output)
strip_output := $(LOCAL_BUILT_MODULE) strip_output := $(intermediates)/STRIPPED/$(my_built_module_stem)
my_strip_module := $(LOCAL_STRIP_MODULE) my_strip_module := $(LOCAL_STRIP_MODULE)
ifeq ($(my_strip_module),) ifeq ($(my_strip_module),)
my_strip_module := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP_MODULE) my_strip_module := true
endif endif
$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP) $(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
@ -107,7 +107,35 @@ $(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)
# 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
ifneq (false,$(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) \
$(strip_output)