Loading rootdir/etc/ld.config.txt +54 −4 Original line number Diff line number Diff line Loading @@ -377,7 +377,7 @@ namespace.vndk.link.sphal.allow_all_shared_libs = true # (LL-NDK only) access. ############################################################################### [vendor] additional.namespaces = runtime,system,vndk additional.namespaces = runtime,system,vndk%VNDK_IN_SYSTEM_NS% ############################################################################### # "default" namespace Loading Loading @@ -418,8 +418,9 @@ namespace.default.asan.permitted.paths += /odm namespace.default.asan.permitted.paths += /data/asan/vendor namespace.default.asan.permitted.paths += /vendor namespace.default.links = system,vndk namespace.default.links = system,vndk%VNDK_IN_SYSTEM_NS% namespace.default.link.system.shared_libs = %LLNDK_LIBRARIES% namespace.default.link.vndk_in_system.shared_libs = %VNDK_USING_CORE_VARIANT_LIBRARIES% namespace.default.link.vndk.shared_libs = %VNDK_SAMEPROCESS_LIBRARIES% namespace.default.link.vndk.shared_libs += %VNDK_CORE_LIBRARIES% Loading Loading @@ -468,14 +469,18 @@ namespace.vndk.asan.search.paths += /system/${LIB}/vndk%VNDK_VER% # When these NDK libs are required inside this namespace, then it is redirected # to the system namespace. This is possible since their ABI is stable across # Android releases. namespace.vndk.links = system,default # Android releases. The links here should be identical to that of the # 'vndk_in_system' namespace, except for the link between 'vndk' and # 'vndk_in_system'. namespace.vndk.links = system,default%VNDK_IN_SYSTEM_NS% namespace.vndk.link.system.shared_libs = %LLNDK_LIBRARIES% namespace.vndk.link.system.shared_libs += %SANITIZER_RUNTIME_LIBRARIES% namespace.vndk.link.default.allow_all_shared_libs = true namespace.vndk.link.vndk_in_system.shared_libs = %VNDK_USING_CORE_VARIANT_LIBRARIES% ############################################################################### # "system" namespace # Loading Loading @@ -503,6 +508,51 @@ namespace.system.link.runtime.shared_libs += libnativeloader.so # Workaround for b/124772622 namespace.system.link.runtime.shared_libs += libandroidicu.so ############################################################################### # "vndk_in_system" namespace # # This namespace is where no-vendor-variant VNDK libraries are loaded for a # vendor process. Note that we do not simply export these libraries from # "system" namespace, because in some case both the core variant and the # vendor variant of a VNDK library may be loaded. In such case, we do not # want to eliminate double-loading because doing so means the global states # of the library would be shared. # # Only the no-vendor-variant VNDK libraries are whitelisted in this namespace. # This is to ensure that we do not load libraries needed by no-vendor-variant # VNDK libraries into vndk_in_system namespace. ############################################################################### namespace.vndk_in_system.isolated = true namespace.vndk_in_system.visible = true # The search paths here should be kept the same as that of the 'system' # namespace. namespace.vndk_in_system.search.paths = /system/${LIB} namespace.vndk_in_system.search.paths += /%PRODUCT%/${LIB} namespace.vndk_in_system.search.paths += /%PRODUCT_SERVICES%/${LIB} namespace.vndk_in_system.asan.search.paths = /data/asan/system/${LIB} namespace.vndk_in_system.asan.search.paths += /system/${LIB} namespace.vndk_in_system.asan.search.paths += /data/asan/product/${LIB} namespace.vndk_in_system.asan.search.paths += /%PRODUCT%/${LIB} namespace.vndk_in_system.asan.search.paths += /data/asan/product_services/${LIB} namespace.vndk_in_system.asan.search.paths += /%PRODUCT_SERVICES%/${LIB} namespace.vndk_in_system.whitelisted = %VNDK_USING_CORE_VARIANT_LIBRARIES% # The links here should be identical to that of the 'vndk' namespace, with the # following exception: # 1. 'vndk_in_system' needs to be freely linked back to 'vndk'. # 2. 'vndk_in_system' does not need to link to 'default', as any library that # requires anything vendor would not be a vndk_in_system library. namespace.vndk_in_system.links = vndk,system namespace.vndk_in_system.link.system.shared_libs = %LLNDK_LIBRARIES% namespace.vndk_in_system.link.system.shared_libs += %SANITIZER_RUNTIME_LIBRARIES% namespace.vndk_in_system.link.vndk.allow_all_shared_libs = true ############################################################################### # Namespace config for native tests that need access to both system and vendor # libraries. This replicates the default linker config (done by Loading rootdir/update_and_install_ld_config.mk +36 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,11 @@ vndk_version := $(strip $(vndk_version)) lib_list_from_prebuilts := $(strip $(lib_list_from_prebuilts)) libz_is_llndk := $(strip $(libz_is_llndk)) my_vndk_use_core_variant := $(TARGET_VNDK_USE_CORE_VARIANT) ifeq ($(lib_list_from_prebuilts),true) my_vndk_use_core_variant := false endif compatibility_check_script := \ $(LOCAL_PATH)/ld_config_backward_compatibility_check.py intermediates_dir := $(call intermediates-dir-for,ETC,$(LOCAL_MODULE)) Loading @@ -35,6 +40,9 @@ llndk_libraries_file := $(library_lists_dir)/llndk.libraries.$(vndk_version).txt vndksp_libraries_file := $(library_lists_dir)/vndksp.libraries.$(vndk_version).txt vndkcore_libraries_file := $(library_lists_dir)/vndkcore.libraries.txt vndkprivate_libraries_file := $(library_lists_dir)/vndkprivate.libraries.txt ifeq ($(my_vndk_use_core_variant),true) vndk_using_core_variant_libraries_file := $(library_lists_dir)/vndk_using_core_variant.libraries.$(vndk_version).txt endif sanitizer_runtime_libraries := $(call normalize-path-list,$(addsuffix .so,\ $(ADDRESS_SANITIZER_RUNTIME_LIBRARY) \ Loading Loading @@ -68,6 +76,9 @@ $(eval $(call write-libs-to-file,$(llndk_libraries_list),$(llndk_libraries_file) $(eval $(call write-libs-to-file,$(vndksp_libraries_list),$(vndksp_libraries_file))) $(eval $(call write-libs-to-file,$(VNDK_CORE_LIBRARIES),$(vndkcore_libraries_file))) $(eval $(call write-libs-to-file,$(VNDK_PRIVATE_LIBRARIES),$(vndkprivate_libraries_file))) ifeq ($(my_vndk_use_core_variant),true) $(eval $(call write-libs-to-file,$(VNDK_USING_CORE_VARIANT_LIBRARIES),$(vndk_using_core_variant_libraries_file))) endif endif # ifneq ($(lib_list_from_prebuilts),true) # Given a file with a list of libs, filter-out the VNDK private libraries Loading @@ -94,6 +105,10 @@ deps := $(llndk_libraries_file) $(vndksp_libraries_file) $(vndkcore_libraries_fi ifeq ($(check_backward_compatibility),true) deps += $(compatibility_check_script) endif ifeq ($(my_vndk_use_core_variant),true) $(LOCAL_BUILT_MODULE): PRIVATE_VNDK_USING_CORE_VARIANT_LIBRARIES_FILE := $(vndk_using_core_variant_libraries_file) deps += $(vndk_using_core_variant_libraries_file) endif $(LOCAL_BUILT_MODULE): $(ld_config_template) $(deps) @echo "Generate: $< -> $@" Loading @@ -109,6 +124,20 @@ endif $(call private-filter-out-private-libs,$(PRIVATE_VNDK_CORE_LIBRARIES_FILE),$(PRIVATE_INTERMEDIATES_DIR)/vndkcore_filtered) $(hide) sed -i.bak -e "s?%VNDK_CORE_LIBRARIES%?$$(cat $(PRIVATE_INTERMEDIATES_DIR)/vndkcore_filtered)?g" $@ ifeq ($(my_vndk_use_core_variant),true) $(call private-filter-out-private-libs,$(PRIVATE_VNDK_USING_CORE_VARIANT_LIBRARIES_FILE),$(PRIVATE_INTERMEDIATES_DIR)/vndk_using_core_variant_filtered) $(hide) sed -i.bak -e "s?%VNDK_IN_SYSTEM_NS%?,vndk_in_system?g" $@ $(hide) sed -i.bak -e "s?%VNDK_USING_CORE_VARIANT_LIBRARIES%?$$(cat $(PRIVATE_INTERMEDIATES_DIR)/vndk_using_core_variant_filtered)?g" $@ else $(hide) sed -i.bak -e "s?%VNDK_IN_SYSTEM_NS%??g" $@ # Unlike LLNDK or VNDK-SP, VNDK_USING_CORE_VARIANT_LIBRARIES can be nothing # if TARGET_VNDK_USE_CORE_VARIANT is not set. In this case, we need to remove # the entire line in the linker config so that we are not left with a line # like: # namespace.sphal.link.default.shared_libs += $(hide) sed -i.bak -e "s?^.*\+= %VNDK_USING_CORE_VARIANT_LIBRARIES%\$$??" $@ endif $(hide) echo -n > $(PRIVATE_INTERMEDIATES_DIR)/private_llndk && \ cat $(PRIVATE_VNDK_PRIVATE_LIBRARIES_FILE) | \ xargs -n 1 -I privatelib bash -c "(grep privatelib $(PRIVATE_LLNDK_LIBRARIES_FILE) || true) >> $(PRIVATE_INTERMEDIATES_DIR)/private_llndk" && \ Loading Loading @@ -146,3 +175,10 @@ vndk_version_suffix := llndk_libraries_list := vndksp_libraries_list := write-libs-to-file := ifeq ($(my_vndk_use_core_variant),true) vndk_using_core_variant_libraries_file := vndk_using_core_variant_libraries_list := endif my_vndk_use_core_variant := Loading
rootdir/etc/ld.config.txt +54 −4 Original line number Diff line number Diff line Loading @@ -377,7 +377,7 @@ namespace.vndk.link.sphal.allow_all_shared_libs = true # (LL-NDK only) access. ############################################################################### [vendor] additional.namespaces = runtime,system,vndk additional.namespaces = runtime,system,vndk%VNDK_IN_SYSTEM_NS% ############################################################################### # "default" namespace Loading Loading @@ -418,8 +418,9 @@ namespace.default.asan.permitted.paths += /odm namespace.default.asan.permitted.paths += /data/asan/vendor namespace.default.asan.permitted.paths += /vendor namespace.default.links = system,vndk namespace.default.links = system,vndk%VNDK_IN_SYSTEM_NS% namespace.default.link.system.shared_libs = %LLNDK_LIBRARIES% namespace.default.link.vndk_in_system.shared_libs = %VNDK_USING_CORE_VARIANT_LIBRARIES% namespace.default.link.vndk.shared_libs = %VNDK_SAMEPROCESS_LIBRARIES% namespace.default.link.vndk.shared_libs += %VNDK_CORE_LIBRARIES% Loading Loading @@ -468,14 +469,18 @@ namespace.vndk.asan.search.paths += /system/${LIB}/vndk%VNDK_VER% # When these NDK libs are required inside this namespace, then it is redirected # to the system namespace. This is possible since their ABI is stable across # Android releases. namespace.vndk.links = system,default # Android releases. The links here should be identical to that of the # 'vndk_in_system' namespace, except for the link between 'vndk' and # 'vndk_in_system'. namespace.vndk.links = system,default%VNDK_IN_SYSTEM_NS% namespace.vndk.link.system.shared_libs = %LLNDK_LIBRARIES% namespace.vndk.link.system.shared_libs += %SANITIZER_RUNTIME_LIBRARIES% namespace.vndk.link.default.allow_all_shared_libs = true namespace.vndk.link.vndk_in_system.shared_libs = %VNDK_USING_CORE_VARIANT_LIBRARIES% ############################################################################### # "system" namespace # Loading Loading @@ -503,6 +508,51 @@ namespace.system.link.runtime.shared_libs += libnativeloader.so # Workaround for b/124772622 namespace.system.link.runtime.shared_libs += libandroidicu.so ############################################################################### # "vndk_in_system" namespace # # This namespace is where no-vendor-variant VNDK libraries are loaded for a # vendor process. Note that we do not simply export these libraries from # "system" namespace, because in some case both the core variant and the # vendor variant of a VNDK library may be loaded. In such case, we do not # want to eliminate double-loading because doing so means the global states # of the library would be shared. # # Only the no-vendor-variant VNDK libraries are whitelisted in this namespace. # This is to ensure that we do not load libraries needed by no-vendor-variant # VNDK libraries into vndk_in_system namespace. ############################################################################### namespace.vndk_in_system.isolated = true namespace.vndk_in_system.visible = true # The search paths here should be kept the same as that of the 'system' # namespace. namespace.vndk_in_system.search.paths = /system/${LIB} namespace.vndk_in_system.search.paths += /%PRODUCT%/${LIB} namespace.vndk_in_system.search.paths += /%PRODUCT_SERVICES%/${LIB} namespace.vndk_in_system.asan.search.paths = /data/asan/system/${LIB} namespace.vndk_in_system.asan.search.paths += /system/${LIB} namespace.vndk_in_system.asan.search.paths += /data/asan/product/${LIB} namespace.vndk_in_system.asan.search.paths += /%PRODUCT%/${LIB} namespace.vndk_in_system.asan.search.paths += /data/asan/product_services/${LIB} namespace.vndk_in_system.asan.search.paths += /%PRODUCT_SERVICES%/${LIB} namespace.vndk_in_system.whitelisted = %VNDK_USING_CORE_VARIANT_LIBRARIES% # The links here should be identical to that of the 'vndk' namespace, with the # following exception: # 1. 'vndk_in_system' needs to be freely linked back to 'vndk'. # 2. 'vndk_in_system' does not need to link to 'default', as any library that # requires anything vendor would not be a vndk_in_system library. namespace.vndk_in_system.links = vndk,system namespace.vndk_in_system.link.system.shared_libs = %LLNDK_LIBRARIES% namespace.vndk_in_system.link.system.shared_libs += %SANITIZER_RUNTIME_LIBRARIES% namespace.vndk_in_system.link.vndk.allow_all_shared_libs = true ############################################################################### # Namespace config for native tests that need access to both system and vendor # libraries. This replicates the default linker config (done by Loading
rootdir/update_and_install_ld_config.mk +36 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,11 @@ vndk_version := $(strip $(vndk_version)) lib_list_from_prebuilts := $(strip $(lib_list_from_prebuilts)) libz_is_llndk := $(strip $(libz_is_llndk)) my_vndk_use_core_variant := $(TARGET_VNDK_USE_CORE_VARIANT) ifeq ($(lib_list_from_prebuilts),true) my_vndk_use_core_variant := false endif compatibility_check_script := \ $(LOCAL_PATH)/ld_config_backward_compatibility_check.py intermediates_dir := $(call intermediates-dir-for,ETC,$(LOCAL_MODULE)) Loading @@ -35,6 +40,9 @@ llndk_libraries_file := $(library_lists_dir)/llndk.libraries.$(vndk_version).txt vndksp_libraries_file := $(library_lists_dir)/vndksp.libraries.$(vndk_version).txt vndkcore_libraries_file := $(library_lists_dir)/vndkcore.libraries.txt vndkprivate_libraries_file := $(library_lists_dir)/vndkprivate.libraries.txt ifeq ($(my_vndk_use_core_variant),true) vndk_using_core_variant_libraries_file := $(library_lists_dir)/vndk_using_core_variant.libraries.$(vndk_version).txt endif sanitizer_runtime_libraries := $(call normalize-path-list,$(addsuffix .so,\ $(ADDRESS_SANITIZER_RUNTIME_LIBRARY) \ Loading Loading @@ -68,6 +76,9 @@ $(eval $(call write-libs-to-file,$(llndk_libraries_list),$(llndk_libraries_file) $(eval $(call write-libs-to-file,$(vndksp_libraries_list),$(vndksp_libraries_file))) $(eval $(call write-libs-to-file,$(VNDK_CORE_LIBRARIES),$(vndkcore_libraries_file))) $(eval $(call write-libs-to-file,$(VNDK_PRIVATE_LIBRARIES),$(vndkprivate_libraries_file))) ifeq ($(my_vndk_use_core_variant),true) $(eval $(call write-libs-to-file,$(VNDK_USING_CORE_VARIANT_LIBRARIES),$(vndk_using_core_variant_libraries_file))) endif endif # ifneq ($(lib_list_from_prebuilts),true) # Given a file with a list of libs, filter-out the VNDK private libraries Loading @@ -94,6 +105,10 @@ deps := $(llndk_libraries_file) $(vndksp_libraries_file) $(vndkcore_libraries_fi ifeq ($(check_backward_compatibility),true) deps += $(compatibility_check_script) endif ifeq ($(my_vndk_use_core_variant),true) $(LOCAL_BUILT_MODULE): PRIVATE_VNDK_USING_CORE_VARIANT_LIBRARIES_FILE := $(vndk_using_core_variant_libraries_file) deps += $(vndk_using_core_variant_libraries_file) endif $(LOCAL_BUILT_MODULE): $(ld_config_template) $(deps) @echo "Generate: $< -> $@" Loading @@ -109,6 +124,20 @@ endif $(call private-filter-out-private-libs,$(PRIVATE_VNDK_CORE_LIBRARIES_FILE),$(PRIVATE_INTERMEDIATES_DIR)/vndkcore_filtered) $(hide) sed -i.bak -e "s?%VNDK_CORE_LIBRARIES%?$$(cat $(PRIVATE_INTERMEDIATES_DIR)/vndkcore_filtered)?g" $@ ifeq ($(my_vndk_use_core_variant),true) $(call private-filter-out-private-libs,$(PRIVATE_VNDK_USING_CORE_VARIANT_LIBRARIES_FILE),$(PRIVATE_INTERMEDIATES_DIR)/vndk_using_core_variant_filtered) $(hide) sed -i.bak -e "s?%VNDK_IN_SYSTEM_NS%?,vndk_in_system?g" $@ $(hide) sed -i.bak -e "s?%VNDK_USING_CORE_VARIANT_LIBRARIES%?$$(cat $(PRIVATE_INTERMEDIATES_DIR)/vndk_using_core_variant_filtered)?g" $@ else $(hide) sed -i.bak -e "s?%VNDK_IN_SYSTEM_NS%??g" $@ # Unlike LLNDK or VNDK-SP, VNDK_USING_CORE_VARIANT_LIBRARIES can be nothing # if TARGET_VNDK_USE_CORE_VARIANT is not set. In this case, we need to remove # the entire line in the linker config so that we are not left with a line # like: # namespace.sphal.link.default.shared_libs += $(hide) sed -i.bak -e "s?^.*\+= %VNDK_USING_CORE_VARIANT_LIBRARIES%\$$??" $@ endif $(hide) echo -n > $(PRIVATE_INTERMEDIATES_DIR)/private_llndk && \ cat $(PRIVATE_VNDK_PRIVATE_LIBRARIES_FILE) | \ xargs -n 1 -I privatelib bash -c "(grep privatelib $(PRIVATE_LLNDK_LIBRARIES_FILE) || true) >> $(PRIVATE_INTERMEDIATES_DIR)/private_llndk" && \ Loading Loading @@ -146,3 +175,10 @@ vndk_version_suffix := llndk_libraries_list := vndksp_libraries_list := write-libs-to-file := ifeq ($(my_vndk_use_core_variant),true) vndk_using_core_variant_libraries_file := vndk_using_core_variant_libraries_list := endif my_vndk_use_core_variant :=