Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c042490 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh Committed by android-build-merger
Browse files

Merge "Call lld with --pack-dyn-relocs=none if my_pack_module_relocations is false" am: 2a801b3c

am: 41685cfe

Change-Id: I05999fbfbbbacb0530570f955fa83f1b7ae6439d
parents f7b84c7b 41685cfe
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -519,6 +519,10 @@ my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)G
my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
ifeq ($(my_use_clang_lld),true)
  my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
  include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
  ifeq ($(my_pack_module_relocations),false)
    my_target_global_ldflags += -Wl,--pack-dyn-relocs=none
  endif
else
  my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
endif # my_use_clang_lld
+11 −28
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module)
LOCAL_INTERMEDIATE_TARGETS := $(linked_module)

###################################
include $(BUILD_SYSTEM)/use_lld_setup.mk
include $(BUILD_SYSTEM)/binary.mk
###################################

@@ -44,35 +45,12 @@ include $(BUILD_SYSTEM)/binary.mk
relocation_packer_input := $(linked_module)
relocation_packer_output := $(intermediates)/PACKED/$(my_built_module_stem)

my_pack_module_relocations := false
ifneq ($(DISABLE_RELOCATION_PACKER),true)
    my_pack_module_relocations := $(firstword \
      $(LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
      $(LOCAL_PACK_MODULE_RELOCATIONS))
endif

ifeq ($(my_pack_module_relocations),)
  my_pack_module_relocations := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PACK_MODULE_RELOCATIONS)
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)),)
  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

# Relocation packer does not work with LLD yet.
ifeq ($(my_use_clang_lld),true)
  my_pack_module_relocations := false
endif
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)
@@ -80,7 +58,12 @@ else
$(relocation_packer_output): $(relocation_packer_input)
	@echo "target Unpacked: $(PRIVATE_MODULE) ($@)"
	$(copy-file-to-target)
endif
endif # my_use_clang_lld
else
$(relocation_packer_output): $(relocation_packer_input)
	@echo "target Unpacked: $(PRIVATE_MODULE) ($@)"
	$(copy-file-to-target)
endif # my_pack_module_relocations

###########################################################
## Store a copy with symbols for symbolic debugging
+33 −0
Original line number Diff line number Diff line
#############################################################
## Set up my_pack_module_relocations
## Input variables:
##   DISABLE_RELOCATION_PACKER,
##   LOCAL_PACK_MODULE_RELOCATIONS*,
##   *TARGET_PACK_MODULE_RELOCATIONS,
##   LOCAL_MODULE_CLASS, HOST_OS
## Output variables:
##   my_pack_module_relocations, if false skip relocation_packer
#############################################################

my_pack_module_relocations := false
ifneq ($(DISABLE_RELOCATION_PACKER),true)
  my_pack_module_relocations := $(firstword \
    $(LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
    $(LOCAL_PACK_MODULE_RELOCATIONS))
endif

ifeq ($(my_pack_module_relocations),)
  my_pack_module_relocations := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PACK_MODULE_RELOCATIONS)
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)),)
  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