Skip to content

Commit

Permalink
linker: Add build flag to allow text relocations for platform libs.
Browse files Browse the repository at this point in the history
  • Loading branch information
MWisBest authored and andi34 committed Sep 17, 2016
1 parent 7cdb481 commit a8fbd76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions linker/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ ifeq ($(TARGET_IS_64_BIT),true)
LOCAL_CPPFLAGS += -DTARGET_IS_64_BIT
endif

ifeq ($(TARGET_NEEDS_PLATFORM_TEXTRELS),true)
LOCAL_CFLAGS += -DALLOW_PLATFORM_TEXTRELS
endif

# We need to access Bionic private headers in the linker.
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/

Expand Down
6 changes: 6 additions & 0 deletions linker/linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3923,8 +3923,14 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t&

#if !defined(__LP64__)
if (has_text_relocations) {
#ifndef ALLOW_PLATFORM_TEXTRELS
// Fail if app is targeting sdk version > 22
if (get_application_target_sdk_version() > 22) {
#else
// Some devices require an exception for platform libs (e.g. vendor libs)
if (get_application_target_sdk_version() != __ANDROID_API__ &&
get_application_target_sdk_version() > 22) {
#endif
PRINT("%s: has text relocations", get_realpath());
DL_ERR("%s: has text relocations", get_realpath());
return false;
Expand Down

0 comments on commit a8fbd76

Please sign in to comment.