aef719510a
Add code to support loading shared libraries directly from within APK files. Extends the linker's handling of LD_LIBRARY_PATH, DT_RUNPATH, etc to allow elements to be either directories as normal, or ZIP format files. For ZIP, the ZIP subdirectory string is separated from the path to file by '!'. For example, if DT_NEEDED is libchrome.so and Chrome.apk is the Android ARM APK then the path element /system/app/Chrome.apk!lib/armeabi-v7a would cause the linker to load lib/armeabi-v7a/libchrome.so directly from inside Chrome.apk. For loading to succeed, libchrome.so must be 'stored' and not compressed in Chrome.apk, and must be page aligned within the file. Motivation: Chromium tracking issue: https://code.google.com/p/chromium/issues/detail?id=390618 Bug: 8076853 Change-Id: Ic49046600b1417eae3ee8f37ee98c8ac1ecc19e7
41 lines
1.6 KiB
Makefile
41 lines
1.6 KiB
Makefile
#
|
|
# Copyright (C) 2014 The Android Open Source Project
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Library used by dlext tests - zipped and aligned
|
|
# -----------------------------------------------------------------------------
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
|
|
LOCAL_MODULE := libdlext_test_fd_zipaligned
|
|
LOCAL_MODULE_SUFFIX := .zip
|
|
LOCAL_MODULE_TAGS := tests
|
|
LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/libdlext_test_fd
|
|
LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
my_shared_libs := \
|
|
$($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libdlext_test_fd.so
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_ALIGNMENT := 4096 # PAGE_SIZE
|
|
$(LOCAL_BUILT_MODULE) : $(my_shared_libs) | $(ZIPALIGN)
|
|
@echo "Zipalign $(PRIVATE_ALIGNMENT): $@"
|
|
$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)/libdir
|
|
$(hide) cp $^ $(dir $@)/libdir
|
|
$(hide) (cd $(dir $@) && touch empty_file.txt && zip -rD0 $(notdir $@).unaligned empty_file.txt libdir/*.so)
|
|
$(hide) $(ZIPALIGN) $(PRIVATE_ALIGNMENT) $@.unaligned $@
|