summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMartin Stjernholm <mast@google.com>2021-03-16 00:44:25 +0000
committerMartin Stjernholm <mast@google.com>2021-04-12 16:36:03 +0000
commitd3e9ff326a511ef48ea85afd2de9c292aa6ea20b (patch)
treeda924af40549dca5fb679173036049e70ca395e9 /tools
parent4531afd0d813fdfa2bb115522bc5918477c03dc2 (diff)
Merge libdexfile_external into libdexfile (reland 2).
To reduce the number of DSO's. libdexfile_external only adds a few small functions on top of libdexfile, and it's still only those functions that are available in the APEX stubs. Also rename libdexfile_external_static to libdexfile_static, for consistency. Since libdexfile now has stubs, we need to add test_for properties to avoid linking against the stubs in tests. This relands https://r.android.com/1666119 that got submitted out of order from https://r.android.com/1664026 - prerequisite changes now submitted with https://r.android.com/1671709. Test: Flash and boot with userdebug and eng to try both release and debug modules. Test: art/tools/buildbot-build.sh {--target,--host} Test: art/build/apex/runtests.sh Test: mmm art Bug: 143978909 Change-Id: I6de99052d6d8a9d01d748baabbbcecfe1f4509dc
Diffstat (limited to 'tools')
-rw-r--r--tools/pylibdexfile.py48
1 files changed, 24 insertions, 24 deletions
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