Revert "Merge libdexfile_external into libdexfile (reland)."
Revert "Rename libdexfile_external_static to libdexfile_static (..."
Revert "Rename libdexfile_external_static to libdexfile_static (..."
Revert submission 1666119-libdexfile-noext-2
Reason for revert: broken build 7270939 on aosp-master on full-eng
Reverted Changes:
I582e49ae7:Merge libdexfile_external into libdexfile (reland)...
Iaa6a90f41:Rename libdexfile_external_static to libdexfile_st...
I4315189b2:libdexfile_external is replaced by libdexfile (rel...
Ia065119c2:Rename libdexfile_external_static to libdexfile_st...
Bug: 184929782
Change-Id: Ie69a73f4f0f745ab988e627c568f4ccb83fd1c71
Test: forrest build for aosp-master on full-eng
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 3e1f5be..2e6bf1e 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -111,10 +111,6 @@
# 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 1f11f2e..ba1d430 100644
--- a/build/apex/Android.bp
+++ b/build/apex/Android.bp
@@ -50,7 +50,7 @@
// the ART APEX.
art_runtime_base_native_shared_libs = [
// External API (having APEX stubs).
- "libdexfile",
+ "libdexfile_external",
"libnativebridge",
"libnativehelper",
"libnativeloader",
@@ -104,7 +104,7 @@
"libadbconnectiond",
"libartd",
"libartd-compiler",
- "libdexfiled",
+ "libdexfiled_external",
"libopenjdkjvmd",
"libopenjdkjvmtid",
]
diff --git a/build/apex/art_apex_test.py b/build/apex/art_apex_test.py
index 581e20d..110553b 100755
--- a/build/apex/art_apex_test.py
+++ b/build/apex/art_apex_test.py
@@ -527,7 +527,7 @@
self._checker.check_symlinked_multilib_executable('dalvikvm')
# Check exported libraries for ART.
- self._checker.check_native_library('libdexfile')
+ self._checker.check_native_library('libdexfile_external')
self._checker.check_native_library('libnativebridge')
self._checker.check_native_library('libnativehelper')
self._checker.check_native_library('libnativeloader')
@@ -542,6 +542,7 @@
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')
@@ -676,9 +677,6 @@
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')
@@ -686,6 +684,7 @@
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')
@@ -708,6 +707,7 @@
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 2dadee0..386663f 100644
--- a/build/sdk/Android.bp
+++ b/build/sdk/Android.bp
@@ -65,7 +65,7 @@
native_shared_libs: [
"libandroidio",
- "libdexfile",
+ "libdexfile_external",
"libnativebridge",
"libnativehelper",
"libnativeloader",
@@ -77,7 +77,7 @@
],
native_static_libs: [
- "libdexfile_static",
+ "libdexfile_external_static",
"libnativehelper_lazy",
],
},
diff --git a/compiler/Android.bp b/compiler/Android.bp
index b90b7e8..935e255 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -341,10 +341,6 @@
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 922e134..f628f75 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -151,10 +151,6 @@
},
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 6a498db..8aa287f 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -46,19 +46,10 @@
"dex/type_lookup_table.cc",
"dex/utf.cc",
],
- header_libs: [
- "jni_headers",
- "libdexfile_external_headers",
- ],
- export_header_lib_headers: [
- "jni_headers",
- "libdexfile_external_headers",
- ],
+ header_libs: ["jni_headers"],
+ export_header_lib_headers: ["jni_headers"],
target: {
android: {
- srcs: [
- "external/dex_file_ext.cc",
- ],
static_libs: [
"libziparchive",
],
@@ -76,9 +67,6 @@
],
},
not_windows: {
- srcs: [
- "external/dex_file_ext.cc",
- ],
shared_libs: [
"libziparchive",
"libz",
@@ -200,11 +188,6 @@
"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 {
@@ -246,11 +229,6 @@
apex_available: [
"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_test {
@@ -326,6 +304,69 @@
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,
@@ -353,7 +394,7 @@
srcs: [
"external/dex_file_supp.cc",
],
- runtime_libs: ["libdexfile"],
+ runtime_libs: ["libdexfile_external"],
shared_libs: [
"liblog",
"libbase",
@@ -385,7 +426,7 @@
shared_libs: [
"libartbase",
"libbase",
- "libdexfile",
+ "libdexfile_external",
"libdexfile_support",
],
}
@@ -407,7 +448,7 @@
"libdexfile_static_defaults",
],
whole_static_libs: [
- "libdexfile",
+ "libdexfile_external",
"libdexfile_support_static",
],
}
@@ -418,8 +459,8 @@
"libdexfiled_static_defaults",
],
whole_static_libs: [
- "libdexfiled",
"libdexfile_support_static",
+ "libdexfiled_external",
],
}
@@ -437,7 +478,7 @@
// 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_static",
+ name: "libdexfile_external_static",
host_supported: true,
visibility: [
// Required for simpleperf, libsimpleperf_record, and libsimpleperf_report
@@ -456,14 +497,14 @@
}
art_cc_test {
- name: "art_libdexfile_static_tests",
+ name: "art_libdexfile_external_static_tests",
host_supported: true,
test_suites: ["general-tests"],
srcs: [
"external/dex_file_supp_test.cc",
],
static_libs: [
- "libdexfile_static",
+ "libdexfile_external_static",
],
enabled: false,
target: {
@@ -473,7 +514,7 @@
},
// 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_static.a, which contains libziparchive.a, which is
+ // libdexfile_external_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 302e188..4432f6a 100644
--- a/libdexfile/external/dex_file_ext.cc
+++ b/libdexfile/external/dex_file_ext.cc
@@ -18,6 +18,7 @@
#include <inttypes.h>
#include <stdint.h>
+#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
@@ -42,7 +43,6 @@
#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 6313afe..63dec1c 100644
--- a/libdexfile/external/dex_file_supp.cc
+++ b/libdexfile/external/dex_file_supp.cc
@@ -65,10 +65,10 @@
// 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.so";
+ const char* so_name = "libdexfiled_external.so";
void* handle = dlopen(so_name, RTLD_NOLOAD | RTLD_NOW | RTLD_NODELETE);
if (handle == nullptr) {
- so_name = "libdexfile.so";
+ so_name = "libdexfile_external.so";
handle = dlopen(so_name, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
}
if (handle == nullptr) {
diff --git a/libdexfile/external/libdexfile_external.map.txt b/libdexfile/external/libdexfile_external.map.txt
index 174a546..e9d12fb 100644
--- a/libdexfile/external/libdexfile_external.map.txt
+++ b/libdexfile/external/libdexfile_external.map.txt
@@ -1,4 +1,4 @@
-LIBDEXFILE_1 {
+LIBDEXFILE_EXTERNAL_1 {
global:
ExtDexFileClose;
ExtDexFileGetAllMethodInfos;
diff --git a/odrefresh/Android.bp b/odrefresh/Android.bp
index 8e39edf..a3fa07c 100644
--- a/odrefresh/Android.bp
+++ b/odrefresh/Android.bp
@@ -113,10 +113,6 @@
],
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 3674bf7..5c6e481 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -548,6 +548,8 @@
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: [
@@ -580,6 +582,9 @@
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 bc340bd..7df6ead 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -29,12 +29,6 @@
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",
},
@@ -54,8 +48,6 @@
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",
],
@@ -159,10 +151,6 @@
},
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",
],
}
@@ -199,10 +187,6 @@
},
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",
],
}
@@ -1051,10 +1035,6 @@
suffix: "64",
},
},
- test_for: [
- "com.android.art",
- "com.android.art.debug",
- ],
}
art_cc_test {
@@ -1071,10 +1051,6 @@
],
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 953cf0d..30c0b26 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.so external API
+# This script can get info out of dexfiles using libdexfile_external
#
from abc import ABC
@@ -24,8 +24,8 @@
import functools
import zipfile
-libdexfile = CDLL(
- os.path.expandvars("$ANDROID_HOST_OUT/lib64/libdexfile.so"))
+libdexfile_external = CDLL(
+ os.path.expandvars("$ANDROID_HOST_OUT/lib64/libdexfile_external.so"))
DexFileStr = c_void_p
ExtDexFile = c_void_p
@@ -37,28 +37,28 @@
AllMethodsCallback = CFUNCTYPE(c_int, POINTER(ExtMethodInfo), c_void_p)
-libdexfile.ExtDexFileOpenFromFd.argtypes = [
+libdexfile_external.ExtDexFileOpenFromFd.argtypes = [
c_int, c_size_t, c_char_p,
POINTER(DexFileStr),
POINTER(ExtDexFile)
]
-libdexfile.ExtDexFileOpenFromFd.restype = c_int
-libdexfile.ExtDexFileOpenFromMemory.argtypes = [
+libdexfile_external.ExtDexFileOpenFromFd.restype = c_int
+libdexfile_external.ExtDexFileOpenFromMemory.argtypes = [
c_void_p,
POINTER(c_size_t), c_char_p,
POINTER(DexFileStr),
POINTER(ExtDexFile)
]
-libdexfile.ExtDexFileOpenFromMemory.restype = c_int
-libdexfile.ExtDexFileFree.argtypes = [ExtDexFile]
-libdexfile.ExtDexFileGetAllMethodInfos.argtypes = [
+libdexfile_external.ExtDexFileOpenFromMemory.restype = c_int
+libdexfile_external.ExtDexFileFree.argtypes = [ExtDexFile]
+libdexfile_external.ExtDexFileGetAllMethodInfos.argtypes = [
ExtDexFile, c_int, AllMethodsCallback, c_void_p
]
-libdexfile.ExtDexFileGetString.argtypes = [
+libdexfile_external.ExtDexFileGetString.argtypes = [
DexFileStr, POINTER(c_size_t)
]
-libdexfile.ExtDexFileGetString.restype = c_char_p
-libdexfile.ExtDexFileFreeString.argtypes = [DexFileStr]
+libdexfile_external.ExtDexFileGetString.restype = c_char_p
+libdexfile_external.ExtDexFileFreeString.argtypes = [DexFileStr]
class DexClass(object):
@@ -105,9 +105,9 @@
def __init__(self, mi):
self.offset = mi.offset
self.len = mi.len
- self.name = libdexfile.ExtDexFileGetString(
+ self.name = libdexfile_external.ExtDexFileGetString(
mi.name, byref(c_size_t(0))).decode("utf-8")
- libdexfile.ExtDexFileFreeString(mi.name)
+ libdexfile_external.ExtDexFileFreeString(mi.name)
def __repr__(self):
return "(" + self.name + ")"
@@ -164,8 +164,8 @@
meths.append(Method(info[0]))
return 0
- libdexfile.ExtDexFileGetAllMethodInfos(self.ext_dex_file_,
- c_int(1), my_cb, c_void_p())
+ libdexfile_external.ExtDexFileGetAllMethodInfos(self.ext_dex_file_,
+ c_int(1), my_cb, c_void_p())
return meths
@@ -176,14 +176,14 @@
super().__init__()
res_fle_ptr = pointer(c_void_p())
err_ptr = pointer(c_void_p())
- res = libdexfile.ExtDexFileOpenFromFd(
+ res = libdexfile_external.ExtDexFileOpenFromFd(
c_int(fd), 0, create_string_buffer(bytes(loc, "utf-8")), err_ptr,
res_fle_ptr)
if res == 0:
- err = libdexfile.ExtDexFileGetString(err_ptr.contents,
- byref(c_size_t()))
+ err = libdexfile_external.ExtDexFileGetString(err_ptr.contents,
+ byref(c_size_t()))
out = Exception("Failed to open file: {}. Error was: {}".format(loc, err))
- libdexfile.ExtDexFileFreeString(err_ptr.contents)
+ libdexfile_external.ExtDexFileFreeString(err_ptr.contents)
raise out
self.ext_dex_file_ = res_fle_ptr.contents
@@ -209,14 +209,14 @@
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.ExtDexFileOpenFromMemory(
+ res = libdexfile_external.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.ExtDexFileGetString(err_ptr.contents,
- byref(c_size_t()))
+ err = libdexfile_external.ExtDexFileGetString(err_ptr.contents,
+ byref(c_size_t()))
out = Exception("Failed to open file: {}. Error was: {}".format(loc, err))
- libdexfile.ExtDexFileFreeString(err_ptr.contents)
+ libdexfile_external.ExtDexFileFreeString(err_ptr.contents)
raise out
self.ext_dex_file_ = res_fle_ptr.contents