diff options
| author | 2019-07-30 22:32:20 -0700 | |
|---|---|---|
| committer | 2019-07-30 22:36:29 -0700 | |
| commit | bf2af95f73ad446fb4596fa7e65d4fd67a1b2bc5 (patch) | |
| tree | 7c5ea5b346d3050ac2460f065e418687b5176633 | |
| parent | d69e849c9bbeae637295c12e10192362bd07627b (diff) | |
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
| -rw-r--r-- | core/binary.mk | 4 | ||||
| -rw-r--r-- | core/pack_dyn_relocs_setup.mk | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/core/binary.mk b/core/binary.mk index 531e4c31db..8c271d12bd 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -1614,7 +1614,9 @@ my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLO 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) + ifeq ($(my_pack_module_relocations),true) + my_target_global_ldflags += -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags + else my_target_global_ldflags += -Wl,--pack-dyn-relocs=none endif else diff --git a/core/pack_dyn_relocs_setup.mk b/core/pack_dyn_relocs_setup.mk index c5564b1eca..f86e11e406 100644 --- a/core/pack_dyn_relocs_setup.mk +++ b/core/pack_dyn_relocs_setup.mk @@ -32,3 +32,12 @@ 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 |