diff options
-rw-r--r-- | CleanSpec.mk | 4 | ||||
-rw-r--r-- | build/apex/Android.bp | 4 | ||||
-rwxr-xr-x | build/apex/art_apex_test.py | 8 | ||||
-rw-r--r-- | build/sdk/Android.bp | 4 | ||||
-rw-r--r-- | compiler/Android.bp | 4 | ||||
-rw-r--r-- | dexlayout/Android.bp | 4 | ||||
-rw-r--r-- | libdexfile/Android.bp | 105 | ||||
-rw-r--r-- | libdexfile/external/dex_file_ext.cc | 2 | ||||
-rw-r--r-- | libdexfile/external/dex_file_supp.cc | 4 | ||||
-rw-r--r-- | odrefresh/Android.bp | 4 | ||||
-rw-r--r-- | runtime/Android.bp | 5 | ||||
-rw-r--r-- | test/Android.bp | 24 | ||||
-rw-r--r-- | tools/pylibdexfile.py | 48 |
13 files changed, 107 insertions, 113 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index 2e6bf1e03a..3e1f5be04d 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -111,6 +111,10 @@ $(call add-clean-step, find $(OUT_DIR)/soong/.intermediates/art -name 'libart*-s # Remove symbols/apex/com.android.art symlink (b/171406631) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/apex/com.android.art) +# art/tools/build_linux_bionic_tests.sh uses find here and can encounter +# libdexfile_external.so in incremental builds. +$(call add-clean-step, rm -rf $(HOST_OUT)) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/build/apex/Android.bp b/build/apex/Android.bp index ba1d4303c9..1f11f2e46b 100644 --- a/build/apex/Android.bp +++ b/build/apex/Android.bp @@ -50,7 +50,7 @@ art_runtime_base_binaries_prefer32_on_device_first_on_host = [ // the ART APEX. art_runtime_base_native_shared_libs = [ // External API (having APEX stubs). - "libdexfile_external", + "libdexfile", "libnativebridge", "libnativehelper", "libnativeloader", @@ -104,7 +104,7 @@ art_runtime_debug_native_shared_libs = [ "libadbconnectiond", "libartd", "libartd-compiler", - "libdexfiled_external", + "libdexfiled", "libopenjdkjvmd", "libopenjdkjvmtid", ] diff --git a/build/apex/art_apex_test.py b/build/apex/art_apex_test.py index 110553bfd4..581e20de50 100755 --- a/build/apex/art_apex_test.py +++ b/build/apex/art_apex_test.py @@ -527,7 +527,7 @@ class ReleaseChecker: self._checker.check_symlinked_multilib_executable('dalvikvm') # Check exported libraries for ART. - self._checker.check_native_library('libdexfile_external') + self._checker.check_native_library('libdexfile') self._checker.check_native_library('libnativebridge') self._checker.check_native_library('libnativehelper') self._checker.check_native_library('libnativeloader') @@ -542,7 +542,6 @@ class ReleaseChecker: self._checker.check_native_library('libartpalette') self._checker.check_native_library('libartservice') self._checker.check_native_library('libarttools') - self._checker.check_native_library('libdexfile') self._checker.check_native_library('libdexfile_support') self._checker.check_native_library('libdt_fd_forward') self._checker.check_native_library('libopenjdkjvm') @@ -677,6 +676,9 @@ class DebugChecker: self._checker.check_symlinked_multilib_executable('imgdiagd') self._checker.check_executable('profmand') + # Check exported libraries for ART. + self._checker.check_native_library('libdexfiled') + # Check internal libraries for ART. self._checker.check_native_library('libadbconnectiond') self._checker.check_native_library('libartbased') @@ -684,7 +686,6 @@ class DebugChecker: self._checker.check_native_library('libartd-compiler') self._checker.check_native_library('libartd-dexlayout') self._checker.check_native_library('libartd-disassembler') - self._checker.check_native_library('libdexfiled') self._checker.check_native_library('libopenjdkjvmd') self._checker.check_native_library('libopenjdkjvmtid') self._checker.check_native_library('libprofiled') @@ -707,7 +708,6 @@ class DebugTargetChecker: self._checker.check_executable('oatdumpd') # Check ART internal libraries. - self._checker.check_native_library('libdexfiled_external') self._checker.check_native_library('libperfetto_hprofd') # Check internal native library dependencies. diff --git a/build/sdk/Android.bp b/build/sdk/Android.bp index 386663f01f..2dadee007c 100644 --- a/build/sdk/Android.bp +++ b/build/sdk/Android.bp @@ -65,7 +65,7 @@ art_module_sdk { native_shared_libs: [ "libandroidio", - "libdexfile_external", + "libdexfile", "libnativebridge", "libnativehelper", "libnativeloader", @@ -77,7 +77,7 @@ art_module_sdk { ], native_static_libs: [ - "libdexfile_external_static", + "libdexfile_static", "libnativehelper_lazy", ], }, diff --git a/compiler/Android.bp b/compiler/Android.bp index 935e255dac..b90b7e89c8 100644 --- a/compiler/Android.bp +++ b/compiler/Android.bp @@ -341,6 +341,10 @@ art_cc_library { apex_available: [ "com.android.art.debug", + // TODO(b/183882457): This lib doesn't go into com.android.art, but + // apex_available lists need to be the same for internal libs to avoid + // stubs, and this depends on libdexfiled. + "com.android.art", ], } diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp index f628f75904..922e1346b8 100644 --- a/dexlayout/Android.bp +++ b/dexlayout/Android.bp @@ -151,6 +151,10 @@ art_cc_library { }, apex_available: [ "com.android.art.debug", + // TODO(b/183882457): This lib doesn't go into com.android.art, but + // apex_available lists need to be the same for internal libs to avoid + // stubs, and this depends on libdexfiled. + "com.android.art", ], } diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp index 3a6cc0dc89..e627ad017c 100644 --- a/libdexfile/Android.bp +++ b/libdexfile/Android.bp @@ -46,10 +46,19 @@ cc_defaults { "dex/type_lookup_table.cc", "dex/utf.cc", ], - header_libs: ["jni_headers"], - export_header_lib_headers: ["jni_headers"], + header_libs: [ + "jni_headers", + "libdexfile_external_headers", + ], + export_header_lib_headers: [ + "jni_headers", + "libdexfile_external_headers", + ], target: { android: { + srcs: [ + "external/dex_file_ext.cc", + ], static_libs: [ "libziparchive", ], @@ -67,6 +76,9 @@ cc_defaults { ], }, not_windows: { + srcs: [ + "external/dex_file_ext.cc", + ], shared_libs: [ "libziparchive", "libz", @@ -188,6 +200,11 @@ art_cc_library { "com.android.art", "com.android.art.debug", ], + stubs: { + // TODO(b/143978909): Rename and move this file to this directory. + symbol_file: "external/libdexfile_external.map.txt", + versions: ["1"], + }, } art_cc_library { @@ -233,6 +250,11 @@ art_cc_library { // stubs, and libartd depends on this. "com.android.art", ], + stubs: { + // TODO(b/143978909): Rename and move this file to this directory. + symbol_file: "external/libdexfile_external.map.txt", + versions: ["1"], + }, } art_cc_test { @@ -308,69 +330,6 @@ cc_library_headers { min_sdk_version: "S", } -cc_defaults { - name: "libdexfile_external-defaults", - host_supported: true, - srcs: [ - "external/dex_file_ext.cc", - ], - header_libs: [ - "jni_headers", - "libdexfile_external_headers", - ], - shared_libs: [ - "libbase", - ], - stubs: { - symbol_file: "external/libdexfile_external.map.txt", - versions: ["1"], - }, - export_header_lib_headers: [ - "jni_headers", - "libdexfile_external_headers", - ], -} - -art_cc_library { - name: "libdexfile_external", - defaults: [ - "art_defaults", - "libdexfile_external-defaults", - ], - visibility: ["//visibility:public"], - target: { - darwin: { - enabled: true, - }, - }, - shared_libs: [ - "libdexfile", - ], - apex_available: [ - "com.android.art", - "com.android.art.debug", - ], -} - -art_cc_library { - name: "libdexfiled_external", - defaults: [ - "art_debug_defaults", - "libdexfile_external-defaults", - ], - target: { - darwin: { - enabled: true, - }, - }, - shared_libs: [ - "libdexfiled", - ], - apex_available: [ - "com.android.art.debug", - ], -} - art_cc_test { name: "art_libdexfile_external_tests", host_supported: true, @@ -398,7 +357,7 @@ art_cc_library { srcs: [ "external/dex_file_supp.cc", ], - runtime_libs: ["libdexfile_external"], + runtime_libs: ["libdexfile"], shared_libs: [ "liblog", "libbase", @@ -430,7 +389,7 @@ art_cc_test { shared_libs: [ "libartbase", "libbase", - "libdexfile_external", + "libdexfile", "libdexfile_support", ], } @@ -452,7 +411,7 @@ cc_defaults { "libdexfile_static_defaults", ], whole_static_libs: [ - "libdexfile_external", + "libdexfile", "libdexfile_support_static", ], } @@ -463,8 +422,8 @@ cc_defaults { "libdexfiled_static_defaults", ], whole_static_libs: [ + "libdexfiled", "libdexfile_support_static", - "libdexfiled_external", ], } @@ -482,7 +441,7 @@ art_cc_test { // This is not allowed in any module that may end up in an APEX or platform // image, so visibility is restrictive. cc_library_static { - name: "libdexfile_external_static", + name: "libdexfile_static", host_supported: true, visibility: [ // Required for simpleperf, libsimpleperf_record, and libsimpleperf_report @@ -501,14 +460,14 @@ cc_library_static { } art_cc_test { - name: "art_libdexfile_external_static_tests", + name: "art_libdexfile_static_tests", host_supported: true, test_suites: ["general-tests"], srcs: [ "external/dex_file_supp_test.cc", ], static_libs: [ - "libdexfile_external_static", + "libdexfile_static", ], enabled: false, target: { @@ -518,7 +477,7 @@ art_cc_test { }, // TODO(b/181740144): Enable a ubsan check to create a dependency on // ubsan_minimal. It's needed to be able to link with the prebuilt - // libdexfile_external_static.a, which contains libziparchive.a, which is + // libdexfile_static.a, which contains libziparchive.a, which is // built with some ubsan checks // (https://cs.android.com/android/platform/superproject/+/master:system/libziparchive/Android.bp;l=47-59;drc=c7b498fdf2002194709e40ea58ce39f43684fc14) // that the SDK snapshots currently don't propagate properly for static diff --git a/libdexfile/external/dex_file_ext.cc b/libdexfile/external/dex_file_ext.cc index 4432f6a5d0..302e18800f 100644 --- a/libdexfile/external/dex_file_ext.cc +++ b/libdexfile/external/dex_file_ext.cc @@ -18,7 +18,6 @@ #include <inttypes.h> #include <stdint.h> -#include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> @@ -43,6 +42,7 @@ #include <dex/dex_file_loader.h> extern "C" { + // Wraps DexFile to add the caching needed by the external interface. This is // what gets passed over as ExtDexFile*. struct ExtDexFile { diff --git a/libdexfile/external/dex_file_supp.cc b/libdexfile/external/dex_file_supp.cc index 63dec1c336..6313afea06 100644 --- a/libdexfile/external/dex_file_supp.cc +++ b/libdexfile/external/dex_file_supp.cc @@ -65,10 +65,10 @@ bool TryLoadLibdexfileExternal([[maybe_unused]] std::string* err_msg) { // Check which version is already loaded to avoid loading both debug and // release builds. We might also be backtracing from separate process, in // which case neither is loaded. - const char* so_name = "libdexfiled_external.so"; + const char* so_name = "libdexfiled.so"; void* handle = dlopen(so_name, RTLD_NOLOAD | RTLD_NOW | RTLD_NODELETE); if (handle == nullptr) { - so_name = "libdexfile_external.so"; + so_name = "libdexfile.so"; handle = dlopen(so_name, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); } if (handle == nullptr) { diff --git a/odrefresh/Android.bp b/odrefresh/Android.bp index a3fa07c7ac..8e39edfe19 100644 --- a/odrefresh/Android.bp +++ b/odrefresh/Android.bp @@ -113,6 +113,10 @@ art_cc_binary { ], apex_available: [ "com.android.art.debug", + // TODO(b/183882457): This binary doesn't go into com.android.art, but + // apex_available lists need to be the same for internal libs to avoid + // stubs, and this depends on libartd. + "com.android.art", ], } diff --git a/runtime/Android.bp b/runtime/Android.bp index 33f4040ce9..97f46a46fd 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -548,8 +548,6 @@ art_cc_library { shared_libs: [ "libartbase", "libdexfile", - // We need to eagerly load it so libdexfile_support used from libunwindstack can find it. - "libdexfile_external", "libprofile", ], export_shared_lib_headers: [ @@ -582,9 +580,6 @@ art_cc_library { shared_libs: [ "libartbased", "libdexfiled", - // We need to eagerly preload it, so that libunwindstack can find it. - // Otherwise, it would try to load the non-debug version with dlopen. - "libdexfiled_external", "libprofiled", ], export_shared_lib_headers: [ diff --git a/test/Android.bp b/test/Android.bp index 7df6ead175..bc340bd27c 100644 --- a/test/Android.bp +++ b/test/Android.bp @@ -29,6 +29,12 @@ art_cc_defaults { name: "art_test_defaults", host_supported: true, target: { + android: { + test_for: [ + "com.android.art", + "com.android.art.debug", + ], + }, android_arm: { relative_install_path: "art/arm", }, @@ -48,6 +54,8 @@ art_cc_defaults { cflags: [ "-Wno-frame-larger-than=", ], + // Tests aren't generally included in any APEX, but this is necessary to + // avoid duplicate install rules for them by making them unavailable to platform. apex_available: [ "com.android.art.debug", ], @@ -151,6 +159,10 @@ art_cc_defaults { }, apex_available: [ "com.android.art.debug", + // TODO(b/183882457): This lib doesn't go into com.android.art, but + // apex_available lists need to be the same for internal libs to avoid + // stubs, and this depends on libdexfiled and others. + "com.android.art", ], } @@ -187,6 +199,10 @@ art_cc_library { }, apex_available: [ "com.android.art.debug", + // TODO(b/183882457): This lib doesn't go into com.android.art, but + // apex_available lists need to be the same for internal libs to avoid + // stubs, and this depends on libdexfiled and others. + "com.android.art", ], } @@ -1035,6 +1051,10 @@ art_cc_test { suffix: "64", }, }, + test_for: [ + "com.android.art", + "com.android.art.debug", + ], } art_cc_test { @@ -1051,6 +1071,10 @@ art_cc_test { ], test_suites: ["general-tests"], test_config: "art-gtests-target-chroot.xml", + test_for: [ + "com.android.art", + "com.android.art.debug", + ], } filegroup { diff --git a/tools/pylibdexfile.py b/tools/pylibdexfile.py index 30c0b268aa..953cf0d775 100644 --- a/tools/pylibdexfile.py +++ b/tools/pylibdexfile.py @@ -15,7 +15,7 @@ # limitations under the License. # -# This script can get info out of dexfiles using libdexfile_external +# This script can get info out of dexfiles using libdexfile.so external API # from abc import ABC @@ -24,8 +24,8 @@ import os.path import functools import zipfile -libdexfile_external = CDLL( - os.path.expandvars("$ANDROID_HOST_OUT/lib64/libdexfile_external.so")) +libdexfile = CDLL( + os.path.expandvars("$ANDROID_HOST_OUT/lib64/libdexfile.so")) DexFileStr = c_void_p ExtDexFile = c_void_p @@ -37,28 +37,28 @@ class ExtMethodInfo(Structure): AllMethodsCallback = CFUNCTYPE(c_int, POINTER(ExtMethodInfo), c_void_p) -libdexfile_external.ExtDexFileOpenFromFd.argtypes = [ +libdexfile.ExtDexFileOpenFromFd.argtypes = [ c_int, c_size_t, c_char_p, POINTER(DexFileStr), POINTER(ExtDexFile) ] -libdexfile_external.ExtDexFileOpenFromFd.restype = c_int -libdexfile_external.ExtDexFileOpenFromMemory.argtypes = [ +libdexfile.ExtDexFileOpenFromFd.restype = c_int +libdexfile.ExtDexFileOpenFromMemory.argtypes = [ c_void_p, POINTER(c_size_t), c_char_p, POINTER(DexFileStr), POINTER(ExtDexFile) ] -libdexfile_external.ExtDexFileOpenFromMemory.restype = c_int -libdexfile_external.ExtDexFileFree.argtypes = [ExtDexFile] -libdexfile_external.ExtDexFileGetAllMethodInfos.argtypes = [ +libdexfile.ExtDexFileOpenFromMemory.restype = c_int +libdexfile.ExtDexFileFree.argtypes = [ExtDexFile] +libdexfile.ExtDexFileGetAllMethodInfos.argtypes = [ ExtDexFile, c_int, AllMethodsCallback, c_void_p ] -libdexfile_external.ExtDexFileGetString.argtypes = [ +libdexfile.ExtDexFileGetString.argtypes = [ DexFileStr, POINTER(c_size_t) ] -libdexfile_external.ExtDexFileGetString.restype = c_char_p -libdexfile_external.ExtDexFileFreeString.argtypes = [DexFileStr] +libdexfile.ExtDexFileGetString.restype = c_char_p +libdexfile.ExtDexFileFreeString.argtypes = [DexFileStr] class DexClass(object): @@ -105,9 +105,9 @@ class Method(object): def __init__(self, mi): self.offset = mi.offset self.len = mi.len - self.name = libdexfile_external.ExtDexFileGetString( + self.name = libdexfile.ExtDexFileGetString( mi.name, byref(c_size_t(0))).decode("utf-8") - libdexfile_external.ExtDexFileFreeString(mi.name) + libdexfile.ExtDexFileFreeString(mi.name) def __repr__(self): return "(" + self.name + ")" @@ -164,8 +164,8 @@ class BaseDexFile(ABC): meths.append(Method(info[0])) return 0 - libdexfile_external.ExtDexFileGetAllMethodInfos(self.ext_dex_file_, - c_int(1), my_cb, c_void_p()) + libdexfile.ExtDexFileGetAllMethodInfos(self.ext_dex_file_, + c_int(1), my_cb, c_void_p()) return meths @@ -176,14 +176,14 @@ class FdDexFile(BaseDexFile): super().__init__() res_fle_ptr = pointer(c_void_p()) err_ptr = pointer(c_void_p()) - res = libdexfile_external.ExtDexFileOpenFromFd( + res = libdexfile.ExtDexFileOpenFromFd( c_int(fd), 0, create_string_buffer(bytes(loc, "utf-8")), err_ptr, res_fle_ptr) if res == 0: - err = libdexfile_external.ExtDexFileGetString(err_ptr.contents, - byref(c_size_t())) + err = libdexfile.ExtDexFileGetString(err_ptr.contents, + byref(c_size_t())) out = Exception("Failed to open file: {}. Error was: {}".format(loc, err)) - libdexfile_external.ExtDexFileFreeString(err_ptr.contents) + libdexfile.ExtDexFileFreeString(err_ptr.contents) raise out self.ext_dex_file_ = res_fle_ptr.contents @@ -209,14 +209,14 @@ class MemDexFile(BaseDexFile): self.mem_ref = (c_byte * len(dat)).from_buffer_copy(dat) res_fle_ptr = pointer(c_void_p()) err_ptr = pointer(c_void_p()) - res = libdexfile_external.ExtDexFileOpenFromMemory( + res = libdexfile.ExtDexFileOpenFromMemory( self.mem_ref, byref(c_size_t(len(dat))), create_string_buffer(bytes(loc, "utf-8")), err_ptr, res_fle_ptr) if res == 0: - err = libdexfile_external.ExtDexFileGetString(err_ptr.contents, - byref(c_size_t())) + err = libdexfile.ExtDexFileGetString(err_ptr.contents, + byref(c_size_t())) out = Exception("Failed to open file: {}. Error was: {}".format(loc, err)) - libdexfile_external.ExtDexFileFreeString(err_ptr.contents) + libdexfile.ExtDexFileFreeString(err_ptr.contents) raise out self.ext_dex_file_ = res_fle_ptr.contents |