Files
build/core/pack_dyn_relocs_setup.mk
Pirama Arumuga Nainar bf2af95f73 Explicitly add lld's relr relocation flags for Android Pie and above
Bug: http://b/119086751

https://android-review.googlesource.com/c/837025 disabled lld relocation
packing globally and enabled it for soong modules targeting pie and
above.  Turn it on for Android.mk modules as well.

Test: grep for -Wl,pack-dyn-relocs=android in
      out/build-aosp_<device>.ninja

Change-Id: I81b8625073aa6b364219b8cf3122b69c95ec7589
2019-07-30 22:36:29 -07:00

44 lines
1.5 KiB
Makefile

#############################################################
## Set up my_pack_module_relocations
## Input variables:
## DISABLE_RELOCATION_PACKER,
## 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
#############################################################
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
ifeq ($(filter SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
my_pack_module_relocations := false
endif
ifdef LOCAL_IS_HOST_MODULE
# Do not pack relocations on host modules
my_pack_module_relocations := false
endif
# Lld relocation packing cannot be enabled for binaries before Android Pie.
ifneq ($(LOCAL_SDK_VERSION),)
ifneq ($(LOCAL_SDK_VERSION),current)
ifeq ($(call math_lt,$(LOCAL_SDK_VERSION),28),true)
my_pack_module_relocations := false
endif
endif
endif